#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 */
int /*<<< orphan*/ cube(double, double, double, int);
int /*<<< orphan*/ cylinder(double, double, double);
int /*<<< orphan*/ endintersection();
int /*<<< orphan*/ endonion();
int /*<<< orphan*/ endrotate();
int /*<<< orphan*/ endxlate();
int /*<<< orphan*/ intersection();
int /*<<< orphan*/ onion();
int /*<<< orphan*/ rotate(int, int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ xlate(double, double, double);
void gothic_arch(double width, double height, double depth) {
  double radius;
  double archheight;
  double cubeheight;
  if (height < width * 2.0)
    width = height / 2.0;
  radius = 5.0 * width / 4.0;
  archheight = width;
  cubeheight = height - archheight;
  xlate(-depth / 2.0, 0, cubeheight);
  onion();
  intersection();
  xlate(0, 3.0 * width / 4.0, 0);
  rotate(90, 0, 1, 0);
  cylinder(depth, radius, radius);
  endrotate();
  endxlate();
  xlate(0, -3.0 * width / 4.0, 0);
  rotate(90, 0, 1, 0);
  cylinder(depth, radius, radius);
  endrotate();
  endxlate();
  endintersection();
  xlate(depth / 2.0, 0, -cubeheight / 2.0);
  cube(depth, width, cubeheight, 1);
  endxlate();
  endonion();
  endxlate();
}


x86 assembly (clang, -O0):
<gothic_arch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xe3c(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e9 <gothic_arch+0x49>
movsd  -0x10(%rbp),%xmm0
movsd  0xe20(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe2f(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe0a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdbc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm2
xorps  %xmm1,%xmm1
call   1040 <xlate@plt>
mov    $0x0,%al
call   1050 <onion@plt>
mov    $0x0,%al
call   1090 <intersection@plt>
movsd  0xdad(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xd90(%rip),%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
call   1040 <xlate@plt>
mov    $0x5a,%edi
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1060 <rotate@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <cylinder@plt>
mov    $0x0,%al
call   1070 <endrotate@plt>
mov    $0x0,%al
call   1080 <endxlate@plt>
movsd  0xd4c(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xd37(%rip),%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
call   1040 <xlate@plt>
mov    $0x5a,%edi
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1060 <rotate@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <cylinder@plt>
mov    $0x0,%al
call   1070 <endrotate@plt>
mov    $0x0,%al
call   1080 <endxlate@plt>
mov    $0x0,%al
call   10b0 <endintersection@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xcd7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
movsd  0xcaf(%rip),%xmm1
divsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
call   1040 <xlate@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    $0x1,%edi
call   10c0 <cube@plt>
mov    $0x0,%al
call   1080 <endxlate@plt>
mov    $0x0,%al
call   10a0 <endonion@plt>
mov    $0x0,%al
call   1080 <endxlate@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gothic_arch>:
sub    $0x38,%rsp
movsd  %xmm2,0x8(%rsp)
movapd %xmm0,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm1,%xmm4
mulsd  0xe42(%rip),%xmm4
movapd %xmm1,%xmm5
cmpltsd %xmm3,%xmm5
andpd  %xmm5,%xmm4
andnpd %xmm0,%xmm5
orpd   %xmm4,%xmm5
movapd %xmm5,0x20(%rsp)
movsd  0xe27(%rip),%xmm0
mulsd  %xmm5,%xmm0
mulsd  0xe23(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm3
subsd  %xmm5,%xmm3
movsd  %xmm3,0x18(%rsp)
movapd %xmm2,%xmm0
mulsd  0xe0b(%rip),%xmm0
xorpd  %xmm1,%xmm1
movapd %xmm3,%xmm2
call   1040 <xlate@plt>
xor    %eax,%eax
call   1050 <onion@plt>
xor    %eax,%eax
call   1090 <intersection@plt>
movsd  0xdf0(%rip),%xmm1
mulsd  0x20(%rsp),%xmm1
mulsd  0xdd2(%rip),%xmm1
xorpd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
call   1040 <xlate@plt>
mov    $0x5a,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1060 <rotate@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movaps %xmm1,%xmm2
call   1030 <cylinder@plt>
xor    %eax,%eax
call   1070 <endrotate@plt>
xor    %eax,%eax
call   1080 <endxlate@plt>
movapd 0x20(%rsp),%xmm1
mulsd  0xd9a(%rip),%xmm1
mulsd  0xd7a(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
call   1040 <xlate@plt>
mov    $0x5a,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1060 <rotate@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movaps %xmm1,%xmm2
call   1030 <cylinder@plt>
xor    %eax,%eax
call   1070 <endrotate@plt>
xor    %eax,%eax
call   1080 <endxlate@plt>
xor    %eax,%eax
call   10b0 <endintersection@plt>
movsd  0xd1b(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0xd25(%rip),%xmm2
mulsd  0x18(%rsp),%xmm2
xorps  %xmm1,%xmm1
call   1040 <xlate@plt>
movsd  0x8(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
mov    $0x1,%edi
call   10c0 <cube@plt>
xor    %eax,%eax
call   1080 <endxlate@plt>
xor    %eax,%eax
call   10a0 <endonion@plt>
xor    %eax,%eax
add    $0x38,%rsp
jmp    1080 <endxlate@plt>

LLVM IR (-O0):
define void @gothic_arch(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = load double, double* %5
%11 = load double, double* %4
%12 = fmul double %11, 2.000000e+00
%13 = fcmp olt double %10, %12
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load double, double* %5
%16 = fdiv double %15, 2.000000e+00
store double %16, double* %4
br label %17
17: ; preds = %14, %3
%18 = load double, double* %4
%19 = fmul double 5.000000e+00, %18
%20 = fdiv double %19, 4.000000e+00
store double %20, double* %7
%21 = load double, double* %4
store double %21, double* %8
%22 = load double, double* %5
%23 = load double, double* %8
%24 = fsub double %22, %23
store double %24, double* %9
%25 = load double, double* %6
%26 = fneg double %25
%27 = fdiv double %26, 2.000000e+00
%28 = load double, double* %9
%29 = call i32 @xlate(double %27, double 0.000000e+00, double %28)
%30 = call i32 (...) @onion()
%31 = call i32 (...) @intersection()
%32 = load double, double* %4
%33 = fmul double 3.000000e+00, %32
%34 = fdiv double %33, 4.000000e+00
%35 = call i32 @xlate(double 0.000000e+00, double %34, double 0.000000e+00)
%36 = call i32 @rotate(i32 90, i32 0, i32 1, i32 0)
%37 = load double, double* %6
%38 = load double, double* %7
%39 = load double, double* %7
%40 = call i32 @cylinder(double %37, double %38, double %39)
%41 = call i32 (...) @endrotate()
%42 = call i32 (...) @endxlate()
%43 = load double, double* %4
%44 = fmul double -3.000000e+00, %43
%45 = fdiv double %44, 4.000000e+00
%46 = call i32 @xlate(double 0.000000e+00, double %45, double 0.000000e+00)
%47 = call i32 @rotate(i32 90, i32 0, i32 1, i32 0)
%48 = load double, double* %6
%49 = load double, double* %7
%50 = load double, double* %7
%51 = call i32 @cylinder(double %48, double %49, double %50)
%52 = call i32 (...) @endrotate()
%53 = call i32 (...) @endxlate()
%54 = call i32 (...) @endintersection()
%55 = load double, double* %6
%56 = fdiv double %55, 2.000000e+00
%57 = load double, double* %9
%58 = fneg double %57
%59 = fdiv double %58, 2.000000e+00
%60 = call i32 @xlate(double %56, double 0.000000e+00, double %59)
%61 = load double, double* %6
%62 = load double, double* %4
%63 = load double, double* %9
%64 = call i32 @cube(double %61, double %62, double %63, i32 1)
%65 = call i32 (...) @endxlate()
%66 = call i32 (...) @endonion()
%67 = call i32 (...) @endxlate()
ret void
}

LLVM IR (-O2):
define void @gothic_arch(double %0, double %1, double %2) {
%4 = fmul double %0, 2.000000e+00
%5 = fcmp ogt double %4, %1
%6 = fmul double %1, 5.000000e-01
%7 = select i1 %5, double %6, double %0
%8 = fmul double %7, 5.000000e+00
%9 = fmul double %8, 2.500000e-01
%10 = fsub double %1, %7
%11 = fmul double %2, -5.000000e-01
%12 = tail call i32 @xlate(double %11, double 0.000000e+00, double %10)
%13 = tail call i32 (...) @onion()
%14 = tail call i32 (...) @intersection()
%15 = fmul double %7, 3.000000e+00
%16 = fmul double %15, 2.500000e-01
%17 = tail call i32 @xlate(double 0.000000e+00, double %16, double 0.000000e+00)
%18 = tail call i32 @rotate(i32 90, i32 0, i32 1, i32 0)
%19 = tail call i32 @cylinder(double %2, double %9, double %9)
%20 = tail call i32 (...) @endrotate()
%21 = tail call i32 (...) @endxlate()
%22 = fmul double %7, -3.000000e+00
%23 = fmul double %22, 2.500000e-01
%24 = tail call i32 @xlate(double 0.000000e+00, double %23, double 0.000000e+00)
%25 = tail call i32 @rotate(i32 90, i32 0, i32 1, i32 0)
%26 = tail call i32 @cylinder(double %2, double %9, double %9)
%27 = tail call i32 (...) @endrotate()
%28 = tail call i32 (...) @endxlate()
%29 = tail call i32 (...) @endintersection()
%30 = fmul double %2, 5.000000e-01
%31 = fmul double %10, -5.000000e-01
%32 = tail call i32 @xlate(double %30, double 0.000000e+00, double %31)
%33 = tail call i32 @cube(double %2, double %7, double %10, i32 1)
%34 = tail call i32 (...) @endxlate()
%35 = tail call i32 (...) @endonion()
%36 = tail call i32 (...) @endxlate()
ret void
}