#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 cos(float);
int /*<<< orphan*/ drawSquare(float, float, int);
int sin(float);
void spiral_squares(int cx, int cy, int s, int r, float t) {
  if (r < 10)
    return;
  float x = r * cos(t) + cx;
  float y = r * sin(t) + cy;
  drawSquare(x, y, s);
  float nt = t + .75 > 2 * 3.1415926 ? t + .75 - (2 * 3.1415926) : t + .75;
  spiral_squares(cx, cy, 9 * s / 10, 9 * r / 10, nt);
  return;
}


x86 assembly (clang, -O0):
<spiral_squares>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    1168 <spiral_squares+0x28>
jmp    126c <spiral_squares+0x12c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
imul   %ecx,%eax
add    -0x4(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   %ecx,%eax
add    -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0xc(%rbp),%edi
call   1050 <drawSquare@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe35(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe21(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1214 <spiral_squares+0xd4>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe0e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdfa(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    122e <spiral_squares+0xee>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
imul   $0x9,-0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
imul   $0x9,-0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x34(%rbp),%edx
mov    %eax,%ecx
movss  -0x20(%rbp),%xmm0
call   1060 <spiral_squares@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spiral_squares>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0xa,%ecx
jl     120a <spiral_squares+0xda>
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%r15d
nopw   0x0(%rax,%rax,1)
movss  %xmm0,(%rsp)
call   1040 <cos@plt>
imul   %ebx,%eax
add    %r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1030 <sin@plt>
imul   %ebx,%eax
add    %r14d,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  0x4(%rsp),%xmm0
mov    %ebp,%edi
call   1050 <drawSquare@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe5e(%rip),%xmm0
movapd %xmm0,%xmm1
addsd  0xe5a(%rip),%xmm1
movsd  0xe5a(%rip),%xmm2
cmpltsd %xmm0,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
lea    0x0(%rbp,%rbp,8),%eax
cltq
imul   $0x66666667,%rax,%rbp
mov    %rbp,%rax
shr    $0x3f,%rax
sar    $0x22,%rbp
add    %eax,%ebp
lea    (%rbx,%rbx,8),%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rbx
add    %ecx,%ebx
cmp    $0x63,%eax
jg     1150 <spiral_squares+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @spiral_squares(i32 %0, i32 %1, i32 %2, i32 %3, float %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store float %4, float* %10
%14 = load i32, i32* %9
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %17
16: ; preds = %5
br label %61
17: ; preds = %5
%18 = load i32, i32* %9
%19 = load float, float* %10
%20 = call i32 @cos(float %19)
%21 = mul nsw i32 %18, %20
%22 = load i32, i32* %6
%23 = add nsw i32 %21, %22
%24 = sitofp i32 %23 to float
store float %24, float* %11
%25 = load i32, i32* %9
%26 = load float, float* %10
%27 = call i32 @sin(float %26)
%28 = mul nsw i32 %25, %27
%29 = load i32, i32* %7
%30 = add nsw i32 %28, %29
%31 = sitofp i32 %30 to float
store float %31, float* %12
%32 = load float, float* %11
%33 = load float, float* %12
%34 = load i32, i32* %8
%35 = call i32 @drawSquare(float %32, float %33, i32 %34)
%36 = load float, float* %10
%37 = fpext float %36 to double
%38 = fadd double %37, 7.500000e-01
%39 = fcmp ogt double %38, 0x401921FB4D12D84A
br i1 %39, label %40, label %45
40: ; preds = %17
%41 = load float, float* %10
%42 = fpext float %41 to double
%43 = fadd double %42, 7.500000e-01
%44 = fsub double %43, 0x401921FB4D12D84A
br label %49
45: ; preds = %17
%46 = load float, float* %10
%47 = fpext float %46 to double
%48 = fadd double %47, 7.500000e-01
br label %49
49: ; preds = %45, %40
%50 = phi double [ %44, %40 ], [ %48, %45 ]
%51 = fptrunc double %50 to float
store float %51, float* %13
%52 = load i32, i32* %6
%53 = load i32, i32* %7
%54 = load i32, i32* %8
%55 = mul nsw i32 9, %54
%56 = sdiv i32 %55, 10
%57 = load i32, i32* %9
%58 = mul nsw i32 9, %57
%59 = sdiv i32 %58, 10
%60 = load float, float* %13
br label %61
61: ; preds = %49, %16
ret void
}

LLVM IR (-O2):
define void @spiral_squares(i32 %0, i32 %1, i32 %2, i32 %3, float %4) {
%6 = icmp slt i32 %3, 10
br i1 %6, label %31, label %7
7: ; preds = %5, %7
%8 = phi float [ %25, %7 ], [ %4, %5 ]
%9 = phi i32 [ %29, %7 ], [ %3, %5 ]
%10 = phi i32 [ %27, %7 ], [ %2, %5 ]
%11 = tail call i32 @cos(float %8)
%12 = mul nsw i32 %11, %9
%13 = add nsw i32 %12, %0
%14 = sitofp i32 %13 to float
%15 = tail call i32 @sin(float %8)
%16 = mul nsw i32 %15, %9
%17 = add nsw i32 %16, %1
%18 = sitofp i32 %17 to float
%19 = tail call i32 @drawSquare(float %14, float %18, i32 %10)
%20 = fpext float %8 to double
%21 = fadd double %20, 7.500000e-01
%22 = fcmp ogt double %21, 0x401921FB4D12D84A
%23 = fadd double %21, 0xC01921FB4D12D84A
%24 = select i1 %22, double %23, double %21
%25 = fptrunc double %24 to float
%26 = mul nsw i32 %10, 9
%27 = sdiv i32 %26, 10
%28 = mul nsw i32 %9, 9
%29 = sdiv i32 %28, 10
%30 = icmp slt i32 %28, 100
br i1 %30, label %31, label %7
31: ; preds = %7, %5
ret void
}