#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 cos(float);
float dToR(int);
scalar_t__ pow(double, int);
double sin(float);
float sqrt(scalar_t__);
void PositionSetup(float heightMap[]) {
  int degree;
  float rad = 0;
  float x = 0;
  float y = 0;
  float y2 = 0;
  for (degree = 270; degree <= 450; ++degree) {
    rad = dToR(degree);
    x = 2.34 * cos(rad);
    y = 2.34 * sin(rad);
    y2 = sqrt(56.25 - pow(4.0876 - x, 2));
    heightMap[degree - 270] = y2 + y;
  }
}


x86 assembly (clang, -O0):
<PositionSetup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x10e,-0xc(%rbp)
cmpl   $0x1c2,-0xc(%rbp)
jg     124d <PositionSetup+0xfd>
mov    -0xc(%rbp),%edi
call   1040 <dToR@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe5e(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe3c(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe16(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
cvtsi2sd %rax,%xmm1
movsd  0xdf3(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <sqrt@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x10e,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1183 <PositionSetup+0x33>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PositionSetup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    0x10e(%rbx),%edi
call   1040 <dToR@plt>
movss  %xmm0,(%rsp)
call   1050 <cos@plt>
movsd  0xe83(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0xe63(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xe4d(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xe37(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1070 <sqrt@plt>
addss  (%rsp),%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    $0xb5,%rbx
jne    1160 <PositionSetup+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @PositionSetup(float* %0) {
%2 = alloca float*
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float* %0, float** %2
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
store i32 270, i32* %3
br label %8
8: ; preds = %38, %1
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 450
br i1 %10, label %11, label %41
11: ; preds = %8
%12 = load i32, i32* %3
%13 = call float @dToR(i32 %12)
store float %13, float* %4
%14 = load float, float* %4
%15 = call double @cos(float %14)
%16 = fmul double 2.340000e+00, %15
%17 = fptrunc double %16 to float
store float %17, float* %5
%18 = load float, float* %4
%19 = call double @sin(float %18)
%20 = fmul double 2.340000e+00, %19
%21 = fptrunc double %20 to float
store float %21, float* %6
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = fsub double 4.087600e+00, %23
%25 = call i64 @pow(double %24, i32 2)
%26 = sitofp i64 %25 to double
%27 = fsub double 5.625000e+01, %26
%28 = fptosi double %27 to i64
%29 = call float @sqrt(i64 %28)
store float %29, float* %7
%30 = load float, float* %7
%31 = load float, float* %6
%32 = fadd float %30, %31
%33 = load float*, float** %2
%34 = load i32, i32* %3
%35 = sub nsw i32 %34, 270
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds float, float* %33, i64 %36
store float %32, float* %37
br label %38
38: ; preds = %11
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %8
41: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @PositionSetup(float* nocapture writeonly %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 270, %1 ], [ %22, %2 ]
%4 = trunc i64 %3 to i32
%5 = tail call float @dToR(i32 %4)
%6 = tail call double @cos(float %5)
%7 = fmul double %6, 2.340000e+00
%8 = fptrunc double %7 to float
%9 = tail call double @sin(float %5)
%10 = fmul double %9, 2.340000e+00
%11 = fptrunc double %10 to float
%12 = fpext float %8 to double
%13 = fsub double 4.087600e+00, %12
%14 = tail call i64 @pow(double %13, i32 2)
%15 = sitofp i64 %14 to double
%16 = fsub double 5.625000e+01, %15
%17 = fptosi double %16 to i64
%18 = tail call float @sqrt(i64 %17)
%19 = fadd float %18, %11
%20 = add nsw i64 %3, -270
%21 = getelementptr inbounds float, float* %0, i64 %20
store float %19, float* %21
%22 = add nuw nsw i64 %3, 1
%23 = icmp eq i64 %22, 451
br i1 %23, label %24, label %2
24: ; preds = %2
ret void
}