#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 */
struct creature {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DoFov(struct creature *, float, float);
float cos(float);
float sin(float);
void FOV(struct creature *cc) {
  float x, y;
  int i;
  for (i = 0; i < 360; i += 1) {
    x = cos((float)i * 0.01745f);
    y = sin((float)i * 0.01745f);
    DoFov(cc, x, y);
  }
}


x86 assembly (clang, -O0):
<FOV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x168,-0x14(%rbp)
jge    11a7 <FOV+0x77>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  0xea3(%rip),%xmm1
mulss  %xmm1,%xmm0
call   1050 <cos@plt>
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
movss  0xe88(%rip),%xmm1
mulss  %xmm1,%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1030 <DoFov@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <FOV+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FOV>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
mulss  0xeb1(%rip),%xmm0
movss  %xmm0,(%rsp)
call   1050 <cos@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movss  0x4(%rsp),%xmm0
call   1030 <DoFov@plt>
add    $0x1,%ebp
cmp    $0x168,%ebp
jne    1140 <FOV+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.creature = type { i32 }
define void @FOV(%struct.creature* %0) {
%2 = alloca %struct.creature*
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store %struct.creature* %0, %struct.creature** %2
store i32 0, i32* %5
br label %6
6: ; preds = %22, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 360
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to float
%12 = fmul float %11, 0x3F91DE69A0000000
%13 = call float @cos(float %12)
store float %13, float* %3
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to float
%16 = fmul float %15, 0x3F91DE69A0000000
%17 = call float @sin(float %16)
store float %17, float* %4
%18 = load %struct.creature*, %struct.creature** %2
%19 = load float, float* %3
%20 = load float, float* %4
%21 = call i32 @DoFov(%struct.creature* %18, float %19, float %20)
br label %22
22: ; preds = %9
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %6
25: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.creature = type { i32 }
define void @FOV(%struct.creature* %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %9, %2 ]
%4 = sitofp i32 %3 to float
%5 = fmul float %4, 0x3F91DE69A0000000
%6 = tail call float @cos(float %5)
%7 = tail call float @sin(float %5)
%8 = tail call i32 @DoFov(%struct.creature* %0, float %6, float %7)
%9 = add nuw nsw i32 %3, 1
%10 = icmp eq i32 %9, 360
br i1 %10, label %11, label %2
11: ; preds = %2
ret void
}