#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 angle(int, int);
double cos(int);
int /*<<< orphan*/ drive(int, double, double);
int /*<<< orphan*/ printf(char *, int, int, int);
double sin(int);
int main() {
  for (int i = 0; i < 360; i += 15) {
    int x = cos(i * 3.141592654 / 180.0) * 10.0;
    int y = sin(i * 3.141592654 / 180.0) * 10.0;
    int angleVal = angle(x, y);
    printf("Angle for X:%d, Y:%d = %d\n", x, y, angleVal);
    drive(angleVal, 1.0, 1.0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x168,-0x8(%rbp)
jge    1229 <main+0xd9>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe84(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <cos@plt>
movsd  0xe67(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe5f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  0xe2e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <angle@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
movsd  0xded(%rip),%xmm1
movaps %xmm1,%xmm0
call   1070 <drive@plt>
mov    -0x8(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm0,%xmm0
mov    $0xfffffff1,%r12d
lea    0xebb(%rip),%r14
nopl   (%rax)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe7c(%rip),%xmm0
divsd  0xe7c(%rip),%xmm0
cvttsd2si %xmm0,%ebp
mov    %ebp,%edi
call   1060 <cos@plt>
movsd  0xe71(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%r15d
mov    %ebp,%edi
call   1040 <sin@plt>
mulsd  0xe59(%rip),%xmm0
cvttsd2si %xmm0,%ebp
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <angle@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
movsd  0xe38(%rip),%xmm0
movaps %xmm0,%xmm1
call   1070 <drive@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe2a(%rip),%xmm0
add    $0xf,%r12d
cmp    $0x159,%r12d
jb     1170 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Angle for X:%d, Y:%d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %35, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 360
br i1 %8, label %9, label %38
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fmul double %11, 0x400921FB54524550
%13 = fdiv double %12, 1.800000e+02
%14 = fptosi double %13 to i32
%15 = call double @cos(i32 %14)
%16 = fmul double %15, 1.000000e+01
%17 = fptosi double %16 to i32
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = fmul double %19, 0x400921FB54524550
%21 = fdiv double %20, 1.800000e+02
%22 = fptosi double %21 to i32
%23 = call double @sin(i32 %22)
%24 = fmul double %23, 1.000000e+01
%25 = fptosi double %24 to i32
store i32 %25, i32* %4
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 @angle(i32 %26, i32 %27)
store i32 %28, i32* %5
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30, i32 %31)
%33 = load i32, i32* %5
%34 = call i32 @drive(i32 %33, double 1.000000e+00, double 1.000000e+00)
br label %35
35: ; preds = %9
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 15
store i32 %37, i32* %2
br label %6
38: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Angle for X:%d, Y:%d = %d\0A\00"
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %17, %2 ]
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 0x400921FB54524550
%6 = fdiv double %5, 1.800000e+02
%7 = fptosi double %6 to i32
%8 = tail call double @cos(i32 %7)
%9 = fmul double %8, 1.000000e+01
%10 = fptosi double %9 to i32
%11 = tail call double @sin(i32 %7)
%12 = fmul double %11, 1.000000e+01
%13 = fptosi double %12 to i32
%14 = tail call i32 @angle(i32 %10, i32 %13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13, i32 %14)
%16 = tail call i32 @drive(i32 %14, double 1.000000e+00, double 1.000000e+00)
%17 = add nuw nsw i32 %3, 15
%18 = icmp ult i32 %3, 345
br i1 %18, label %2, label %1
}