#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double M_PI;
double atan2(double, double);
int /*<<< orphan*/ cube(double, double, double, int /*<<< orphan*/);
int /*<<< orphan*/ endrotate();
int /*<<< orphan*/ endxlate();
double hypot(double, double);
double perturb(double, double);
int /*<<< orphan*/ rotate(double, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ scadinline(char *, double, double, int);
int /*<<< orphan*/ xlate(double, double, double);
void wall(double x1, double y1, double x2, double y2, double thickness,
          double height) {
  double angle;
  double dist;
  double clen, ch, c;
  height = perturb(height, 0.1);
  angle = atan2(y2 - y1, x2 - x1);
  scadinline("/* %lf, %lf, angle = %d */\n", (y2 - y1), (x2 - x1),
             (int)(angle * 180.0 / M_PI));
  dist = hypot(x2 - x1, y2 - y1);
  xlate(x1, y1, 0);
  rotate(angle * 180 / M_PI, 0, 0, 1);
  cube(dist, thickness, height, 0);
  c = 0.0;
  ch = thickness;
  clen = thickness * 1.5;
  while (c < dist) {
    xlate(c, 0, height - thickness);
    cube(clen, ch, ch * 2, 0);
    endxlate();
    c += clen + thickness;
  }
  endrotate();
  endxlate();
}


x86 assembly (clang, -O0):
<wall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe4d(%rip),%xmm1
call   1040 <perturb@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
call   1050 <atan2@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
movsd  0xe01(%rip),%xmm2
mulsd  -0x38(%rbp),%xmm2
mov    0x2dd5(%rip),%rax
divsd  (%rax),%xmm2
cvttsd2si %xmm2,%esi
lea    0xdfe(%rip),%rdi
call   1060 <scadinline@plt>
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
call   1080 <hypot@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
xorps  %xmm2,%xmm2
call   1030 <xlate@plt>
movsd  0xda9(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    0x2d7d(%rip),%rax
divsd  (%rax),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1070 <rotate@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
xor    %edi,%edi
call   10b0 <cube@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd53(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1320 <wall+0x190>
movsd  -0x58(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
subsd  -0x28(%rbp),%xmm2
xorps  %xmm1,%xmm1
call   1030 <xlate@plt>
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xd24(%rip),%xmm2
mulsd  -0x50(%rbp),%xmm2
xor    %edi,%edi
call   10b0 <cube@plt>
mov    $0x0,%al
call   10a0 <endxlate@plt>
movsd  -0x48(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    12b7 <wall+0x127>
mov    $0x0,%al
call   1090 <endrotate@plt>
mov    $0x0,%al
call   10a0 <endxlate@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wall>:
push   %rbx
sub    $0x40,%rsp
movsd  %xmm4,0x38(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
movsd  0xe45(%rip),%xmm1
movaps %xmm5,%xmm0
call   1040 <perturb@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
subsd  0x18(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
call   1050 <atan2@plt>
mulsd  0xe0e(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    0x2de1(%rip),%rbx
movapd %xmm0,%xmm1
divsd  (%rbx),%xmm1
cvttsd2si %xmm1,%esi
lea    0xdfe(%rip),%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1060 <scadinline@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1080 <hypot@plt>
movsd  %xmm0,0x8(%rsp)
xorps  %xmm2,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1030 <xlate@plt>
movsd  0x30(%rsp),%xmm0
divsd  (%rbx),%xmm0
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1070 <rotate@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
xor    %edi,%edi
call   10b0 <cube@plt>
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm2
ucomisd %xmm0,%xmm2
jbe    132d <wall+0x19d>
movsd  0xd6d(%rip),%xmm4
movsd  0x38(%rsp),%xmm3
mulsd  %xmm3,%xmm4
movsd  0x28(%rsp),%xmm1
subsd  %xmm3,%xmm1
movsd  %xmm1,0x28(%rsp)
movapd %xmm3,%xmm1
addsd  %xmm3,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  %xmm4,0x20(%rsp)
addsd  %xmm3,%xmm4
movsd  %xmm4,0x30(%rsp)
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm1,%xmm1
movsd  0x28(%rsp),%xmm2
call   1030 <xlate@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
xor    %edi,%edi
call   10b0 <cube@plt>
xor    %eax,%eax
call   10a0 <endxlate@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
addsd  0x30(%rsp),%xmm0
ucomisd %xmm0,%xmm2
ja     12e0 <wall+0x150>
xor    %eax,%eax
call   1090 <endrotate@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
jmp    10a0 <endxlate@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"/* %lf, %lf, angle = %d */\0A\00"
@M_PI = global double 0.000000e+00
define void @wall(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%18 = load double, double* %12
%19 = call double @perturb(double %18, double 1.000000e-01)
store double %19, double* %12
%20 = load double, double* %10
%21 = load double, double* %8
%22 = fsub double %20, %21
%23 = load double, double* %9
%24 = load double, double* %7
%25 = fsub double %23, %24
%26 = call double @atan2(double %22, double %25)
store double %26, double* %13
%27 = load double, double* %10
%28 = load double, double* %8
%29 = fsub double %27, %28
%30 = load double, double* %9
%31 = load double, double* %7
%32 = fsub double %30, %31
%33 = load double, double* %13
%34 = fmul double %33, 1.800000e+02
%35 = load double, double* @M_PI
%36 = fdiv double %34, %35
%37 = fptosi double %36 to i32
%38 = call i32 @scadinline(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %29, double %32, i32 %37)
%39 = load double, double* %9
%40 = load double, double* %7
%41 = fsub double %39, %40
%42 = load double, double* %10
%43 = load double, double* %8
%44 = fsub double %42, %43
%45 = call double @hypot(double %41, double %44)
store double %45, double* %14
%46 = load double, double* %7
%47 = load double, double* %8
%48 = call i32 @xlate(double %46, double %47, double 0.000000e+00)
%49 = load double, double* %13
%50 = fmul double %49, 1.800000e+02
%51 = load double, double* @M_PI
%52 = fdiv double %50, %51
%53 = call i32 @rotate(double %52, i32 0, i32 0, i32 1)
%54 = load double, double* %14
%55 = load double, double* %11
%56 = load double, double* %12
%57 = call i32 @cube(double %54, double %55, double %56, i32 0)
store double 0.000000e+00, double* %17
%58 = load double, double* %11
store double %58, double* %16
%59 = load double, double* %11
%60 = fmul double %59, 1.500000e+00
store double %60, double* %15
br label %61
61: ; preds = %65, %6
%62 = load double, double* %17
%63 = load double, double* %14
%64 = fcmp olt double %62, %63
br i1 %64, label %65, label %82
65: ; preds = %61
%66 = load double, double* %17
%67 = load double, double* %12
%68 = load double, double* %11
%69 = fsub double %67, %68
%70 = call i32 @xlate(double %66, double 0.000000e+00, double %69)
%71 = load double, double* %15
%72 = load double, double* %16
%73 = load double, double* %16
%74 = fmul double %73, 2.000000e+00
%75 = call i32 @cube(double %71, double %72, double %74, i32 0)
%76 = call i32 (...) @endxlate()
%77 = load double, double* %15
%78 = load double, double* %11
%79 = fadd double %77, %78
%80 = load double, double* %17
%81 = fadd double %80, %79
store double %81, double* %17
br label %61
82: ; preds = %61
%83 = call i32 (...) @endrotate()
%84 = call i32 (...) @endxlate()
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"/* %lf, %lf, angle = %d */\0A\00"
@M_PI = global double 0.000000e+00
define void @wall(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = tail call double @perturb(double %5, double 1.000000e-01)
%8 = fsub double %3, %1
%9 = fsub double %2, %0
%10 = tail call double @atan2(double %8, double %9)
%11 = fmul double %10, 1.800000e+02
%12 = load double, double* @M_PI
%13 = fdiv double %11, %12
%14 = fptosi double %13 to i32
%15 = tail call i32 @scadinline(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %8, double %9, i32 %14)
%16 = tail call double @hypot(double %9, double %8)
%17 = tail call i32 @xlate(double %0, double %1, double 0.000000e+00)
%18 = load double, double* @M_PI
%19 = fdiv double %11, %18
%20 = tail call i32 @rotate(double %19, i32 0, i32 0, i32 1)
%21 = tail call i32 @cube(double %16, double %4, double %7, i32 0)
%22 = fmul double %4, 1.500000e+00
%23 = fcmp ogt double %16, 0.000000e+00
br i1 %23, label %24, label %35
24: ; preds = %6
%25 = fsub double %7, %4
%26 = fmul double %4, 2.000000e+00
%27 = fadd double %22, %4
br label %28
28: ; preds = %24, %28
%29 = phi double [ 0.000000e+00, %24 ], [ %33, %28 ]
%30 = tail call i32 @xlate(double %29, double 0.000000e+00, double %25)
%31 = tail call i32 @cube(double %22, double %4, double %26, i32 0)
%32 = tail call i32 (...) @endxlate()
%33 = fadd double %27, %29
%34 = fcmp olt double %33, %16
br i1 %34, label %28, label %35
35: ; preds = %28, %6
%36 = tail call i32 (...) @endrotate()
%37 = tail call i32 (...) @endxlate()
ret void
}