#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*/ arched_opening(int, int, double);
int /*<<< orphan*/ endrotate();
int /*<<< orphan*/ endxlate();
int irandomn(int);
double randomn(double);
int /*<<< orphan*/ rotate(double, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ xlate(int /*<<< orphan*/, int /*<<< orphan*/, double);
void add_windows(double tower_radius, double tower_height) {
  int i, nwindows;
  double h;
  double angle;
  nwindows = irandomn(3);
  for (i = 0; i < nwindows; i++) {
    h = randomn(tower_height / 4.0) + tower_height * 0.5;
    angle = (double)randomn(360.0);
    xlate(0, 0, h);
    rotate(angle, 0, 0, 1);
    arched_opening(5, 2, tower_radius * 3);
    endrotate();
    endxlate();
  }
}


x86 assembly (clang, -O0):
<add_windows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x3,%edi
call   1090 <irandomn@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1240 <add_windows+0xd0>
movsd  -0x10(%rbp),%xmm0
movsd  0xe69(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <randomn@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe48(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe2b(%rip),%xmm0
call   1080 <randomn@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1030 <xlate@plt>
movsd  -0x28(%rbp),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1050 <rotate@plt>
movsd  0xdf0(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    $0x5,%edi
mov    $0x2,%esi
call   1040 <arched_opening@plt>
mov    $0x0,%al
call   1060 <endrotate@plt>
mov    $0x0,%al
call   1070 <endxlate@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1196 <add_windows+0x26>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_windows>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    $0x3,%edi
call   1090 <irandomn@plt>
test   %eax,%eax
jle    1245 <add_windows+0xd5>
mov    %eax,%ebx
movsd  0xe63(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0xe5d(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mulsd  0xe47(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
nop
movsd  0x18(%rsp),%xmm0
call   1080 <randomn@plt>
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0xe29(%rip),%xmm0
call   1080 <randomn@plt>
movsd  %xmm0,0x20(%rsp)
xor    %edi,%edi
xor    %esi,%esi
movsd  0x28(%rsp),%xmm0
call   1030 <xlate@plt>
movsd  0x20(%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <rotate@plt>
mov    $0x5,%edi
mov    $0x2,%esi
movsd  0x8(%rsp),%xmm0
call   1040 <arched_opening@plt>
xor    %eax,%eax
call   1060 <endrotate@plt>
xor    %eax,%eax
call   1070 <endxlate@plt>
add    $0xffffffff,%ebx
jne    11d0 <add_windows+0x60>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @add_windows(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store double %0, double* %3
store double %1, double* %4
%9 = call i32 @irandomn(i32 3)
store i32 %9, i32* %6
store i32 0, i32* %5
br label %10
10: ; preds = %30, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %33
14: ; preds = %10
%15 = load double, double* %4
%16 = fdiv double %15, 4.000000e+00
%17 = call double @randomn(double %16)
%18 = load double, double* %4
%19 = call double @llvm.fmuladd.f64(double %18, double 5.000000e-01, double %17)
store double %19, double* %7
%20 = call double @randomn(double 3.600000e+02)
store double %20, double* %8
%21 = load double, double* %7
%22 = call i32 @xlate(i32 0, i32 0, double %21)
%23 = load double, double* %8
%24 = call i32 @rotate(double %23, i32 0, i32 0, i32 1)
%25 = load double, double* %3
%26 = fmul double %25, 3.000000e+00
%27 = call i32 @arched_opening(i32 5, i32 2, double %26)
%28 = call i32 (...) @endrotate()
%29 = call i32 (...) @endxlate()
br label %30
30: ; preds = %14
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %10
33: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @add_windows(double %0, double %1) {
%3 = tail call i32 @irandomn(i32 3)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %20
5: ; preds = %2
%6 = fmul double %1, 2.500000e-01
%7 = fmul double %0, 3.000000e+00
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ 0, %5 ], [ %18, %8 ]
%10 = tail call double @randomn(double %6)
%11 = tail call double @llvm.fmuladd.f64(double %1, double 5.000000e-01, double %10)
%12 = tail call double @randomn(double 3.600000e+02)
%13 = tail call i32 @xlate(i32 0, i32 0, double %11)
%14 = tail call i32 @rotate(double %12, i32 0, i32 0, i32 1)
%15 = tail call i32 @arched_opening(i32 5, i32 2, double %7)
%16 = tail call i32 (...) @endrotate()
%17 = tail call i32 (...) @endxlate()
%18 = add nuw nsw i32 %9, 1
%19 = icmp eq i32 %18, %3
br i1 %19, label %20, label %8
20: ; preds = %8, %2
ret void
}