#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*/ crenelated_rectangle(double, double, double, double, double);
int /*<<< orphan*/ endrotate();
int /*<<< orphan*/ english_house(double, double, double, double);
int /*<<< orphan*/ generic_tower(int /*<<< orphan*/, int /*<<< orphan*/, double,
                                 int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ gothic_hall(double, double, double, int, int, double, int);
int irandomn(int);
int /*<<< orphan*/ perturb(double, double);
int /*<<< orphan*/ rotate(int, int /*<<< orphan*/, int /*<<< orphan*/, int);
void xkeep_topper(double width, double length, double height, int rot) {
  if (rot)
    rotate(90, 0, 0, 1);
  if (irandomn(100) < 30) {
    english_house(width, length, height,
                  ((width) < (length) ? (width) : (length)) * 0.75);
    if (rot)
      endrotate();
    return;
  }
  if (irandomn(100) < 30) {
    gothic_hall(length, width, height, 3, 2, length * 0.1, 1);
    if (rot)
      endrotate();
    return;
  }
  if (rot)
    endrotate();
  rotate(90, 0, 0, 1);
  crenelated_rectangle(length, width, height * 0.2, length * 0.1,
                       length * 0.05);
  endrotate();
  if (irandomn(1000) < 500)
    generic_tower(0, 0, ((length) < (width) ? (length) : (width)) / 3.0,
                  perturb(height * 2.0, 0.2), 0);
}


x86 assembly (clang, -O0):
<xkeep_topper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11b7 <xkeep_topper+0x37>
mov    $0x5a,%edi
xor    %edx,%edx
mov    $0x1,%ecx
mov    %edx,%esi
call   1070 <rotate@plt>
mov    $0x64,%edi
call   10a0 <irandomn@plt>
cmp    $0x1e,%eax
jge    1250 <xkeep_topper+0xd0>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    120b <xkeep_topper+0x8b>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1215 <xkeep_topper+0x95>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm3
movsd  0xdf7(%rip),%xmm4
mulsd  %xmm4,%xmm3
call   1060 <english_house@plt>
cmpl   $0x0,-0x1c(%rbp)
je     124b <xkeep_topper+0xcb>
mov    $0x0,%al
call   1080 <endrotate@plt>
jmp    138e <xkeep_topper+0x20e>
mov    $0x64,%edi
call   10a0 <irandomn@plt>
cmp    $0x1e,%eax
jge    12a9 <xkeep_topper+0x129>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  0xd8e(%rip),%xmm3
mulsd  -0x10(%rbp),%xmm3
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <gothic_hall@plt>
cmpl   $0x0,-0x1c(%rbp)
je     12a4 <xkeep_topper+0x124>
mov    $0x0,%al
call   1080 <endrotate@plt>
jmp    138e <xkeep_topper+0x20e>
cmpl   $0x0,-0x1c(%rbp)
je     12ba <xkeep_topper+0x13a>
mov    $0x0,%al
call   1080 <endrotate@plt>
mov    $0x5a,%edi
xor    %edx,%edx
mov    $0x1,%ecx
mov    %edx,%esi
call   1070 <rotate@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xd31(%rip),%xmm2
mulsd  -0x18(%rbp),%xmm2
movsd  0xd1c(%rip),%xmm3
mulsd  -0x10(%rbp),%xmm3
movsd  0xd07(%rip),%xmm4
mulsd  -0x10(%rbp),%xmm4
call   1090 <crenelated_rectangle@plt>
mov    $0x0,%al
call   1080 <endrotate@plt>
mov    $0x3e8,%edi
call   10a0 <irandomn@plt>
cmp    $0x1f4,%eax
jge    138e <xkeep_topper+0x20e>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1342 <xkeep_topper+0x1c2>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    134c <xkeep_topper+0x1cc>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0xcc7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xcae(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xc99(%rip),%xmm1
call   1040 <perturb@plt>
movsd  -0x50(%rbp),%xmm0
mov    %eax,%edx
xor    %ecx,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
call   1050 <generic_tower@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xkeep_topper>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
test   %edi,%edi
je     11b0 <xkeep_topper+0x30>
mov    $0x5a,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1070 <rotate@plt>
mov    $0x64,%edi
call   10a0 <irandomn@plt>
cmp    $0x1d,%eax
jg     11ef <xkeep_topper+0x6f>
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm3
movsd  0x8(%rsp),%xmm1
minsd  %xmm1,%xmm3
mulsd  0xe45(%rip),%xmm3
movsd  0x18(%rsp),%xmm2
call   1060 <english_house@plt>
test   %ebx,%ebx
jne    1238 <xkeep_topper+0xb8>
jmp    12fa <xkeep_topper+0x17a>
mov    $0x64,%edi
call   10a0 <irandomn@plt>
cmp    $0x1d,%eax
jg     1244 <xkeep_topper+0xc4>
movsd  0xe02(%rip),%xmm3
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm3
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <gothic_hall@plt>
test   %ebx,%ebx
je     12fa <xkeep_topper+0x17a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1080 <endrotate@plt>
test   %ebx,%ebx
je     124f <xkeep_topper+0xcf>
xor    %eax,%eax
call   1080 <endrotate@plt>
mov    $0x5a,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1070 <rotate@plt>
movsd  0xd96(%rip),%xmm2
mulsd  0x18(%rsp),%xmm2
movsd  0xd90(%rip),%xmm3
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm3
movsd  0xd86(%rip),%xmm4
mulsd  %xmm0,%xmm4
movsd  0x10(%rsp),%xmm1
call   1090 <crenelated_rectangle@plt>
xor    %eax,%eax
call   1080 <endrotate@plt>
mov    $0x3e8,%edi
call   10a0 <irandomn@plt>
cmp    $0x1f3,%eax
jg     12fa <xkeep_topper+0x17a>
movsd  0x8(%rsp),%xmm0
minsd  0x10(%rsp),%xmm0
divsd  0xd53(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xd23(%rip),%xmm1
call   1040 <perturb@plt>
xor    %edi,%edi
xor    %esi,%esi
movsd  0x8(%rsp),%xmm0
mov    %eax,%edx
xor    %ecx,%ecx
add    $0x20,%rsp
pop    %rbx
jmp    1050 <generic_tower@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @xkeep_topper(double %0, double %1, double %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = call i32 @rotate(i32 90, i32 0, i32 0, i32 1)
br label %13
13: ; preds = %11, %4
%14 = call i32 @irandomn(i32 100)
%15 = icmp slt i32 %14, 30
br i1 %15, label %16, label %36
16: ; preds = %13
%17 = load double, double* %5
%18 = load double, double* %6
%19 = load double, double* %7
%20 = load double, double* %5
%21 = load double, double* %6
%22 = fcmp olt double %20, %21
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = load double, double* %5
br label %27
25: ; preds = %16
%26 = load double, double* %6
br label %27
27: ; preds = %25, %23
%28 = phi double [ %24, %23 ], [ %26, %25 ]
%29 = fmul double %28, 7.500000e-01
%30 = call i32 @english_house(double %17, double %18, double %19, double %29)
%31 = load i32, i32* %8
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 (...) @endrotate()
br label %35
35: ; preds = %33, %27
br label %85
36: ; preds = %13
%37 = call i32 @irandomn(i32 100)
%38 = icmp slt i32 %37, 30
br i1 %38, label %39, label %51
39: ; preds = %36
%40 = load double, double* %6
%41 = load double, double* %5
%42 = load double, double* %7
%43 = load double, double* %6
%44 = fmul double %43, 1.000000e-01
%45 = call i32 @gothic_hall(double %40, double %41, double %42, i32 3, i32 2, double %44, i32 1)
%46 = load i32, i32* %8
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %39
%49 = call i32 (...) @endrotate()
br label %50
50: ; preds = %48, %39
br label %85
51: ; preds = %36
%52 = load i32, i32* %8
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 (...) @endrotate()
br label %56
56: ; preds = %54, %51
%57 = call i32 @rotate(i32 90, i32 0, i32 0, i32 1)
%58 = load double, double* %6
%59 = load double, double* %5
%60 = load double, double* %7
%61 = fmul double %60, 2.000000e-01
%62 = load double, double* %6
%63 = fmul double %62, 1.000000e-01
%64 = load double, double* %6
%65 = fmul double %64, 5.000000e-02
%66 = call i32 @crenelated_rectangle(double %58, double %59, double %61, double %63, double %65)
%67 = call i32 (...) @endrotate()
%68 = call i32 @irandomn(i32 1000)
%69 = icmp slt i32 %68, 500
br i1 %69, label %70, label %85
70: ; preds = %56
%71 = load double, double* %6
%72 = load double, double* %5
%73 = fcmp olt double %71, %72
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = load double, double* %6
br label %78
76: ; preds = %70
%77 = load double, double* %5
br label %78
78: ; preds = %76, %74
%79 = phi double [ %75, %74 ], [ %77, %76 ]
%80 = fdiv double %79, 3.000000e+00
%81 = load double, double* %7
%82 = fmul double %81, 2.000000e+00
%83 = call i32 @perturb(double %82, double 2.000000e-01)
%84 = call i32 @generic_tower(i32 0, i32 0, double %80, i32 %83, i32 0)
br label %85
85: ; preds = %35, %50, %78, %56
ret void
}

LLVM IR (-O2):
define void @xkeep_topper(double %0, double %1, double %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @rotate(i32 90, i32 0, i32 0, i32 1)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @irandomn(i32 100)
%10 = icmp slt i32 %9, 30
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = fcmp olt double %0, %1
%13 = select i1 %12, double %0, double %1
%14 = fmul double %13, 7.500000e-01
%15 = tail call i32 @english_house(double %0, double %1, double %2, double %14)
br i1 %5, label %45, label %16
16: ; preds = %11
%17 = tail call i32 (...) @endrotate()
br label %45
18: ; preds = %8
%19 = tail call i32 @irandomn(i32 100)
%20 = icmp slt i32 %19, 30
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = fmul double %1, 1.000000e-01
%23 = tail call i32 @gothic_hall(double %1, double %0, double %2, i32 3, i32 2, double %22, i32 1)
br i1 %5, label %45, label %24
24: ; preds = %21
%25 = tail call i32 (...) @endrotate()
br label %45
26: ; preds = %18
br i1 %5, label %29, label %27
27: ; preds = %26
%28 = tail call i32 (...) @endrotate()
br label %29
29: ; preds = %27, %26
%30 = tail call i32 @rotate(i32 90, i32 0, i32 0, i32 1)
%31 = fmul double %2, 2.000000e-01
%32 = fmul double %1, 1.000000e-01
%33 = fmul double %1, 5.000000e-02
%34 = tail call i32 @crenelated_rectangle(double %1, double %0, double %31, double %32, double %33)
%35 = tail call i32 (...) @endrotate()
%36 = tail call i32 @irandomn(i32 1000)
%37 = icmp slt i32 %36, 500
br i1 %37, label %38, label %45
38: ; preds = %29
%39 = fcmp olt double %1, %0
%40 = select i1 %39, double %1, double %0
%41 = fdiv double %40, 3.000000e+00
%42 = fmul double %2, 2.000000e+00
%43 = tail call i32 @perturb(double %42, double 2.000000e-01)
%44 = tail call i32 @generic_tower(i32 0, i32 0, double %41, i32 %43, i32 0)
br label %45
45: ; preds = %21, %24, %11, %16, %38, %29
ret void
}