#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);
int /*<<< orphan*/ printf(char *, ...);
double sin(float);
int main() {
  int i = 0;
  float theta = 0;
  printf("ANGLE\tSIN\tCOS\n");
  for (i; i < 181; i += 15) {
    theta = (3.14 * i) / 90;
    printf("%d\t%.2f\t%.2f \n", i, sin(theta), cos(theta));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xb5,-0x8(%rbp)
jge    11d5 <main+0xa5>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe92(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1050 <cos@plt>
mov    -0x1c(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
lea    0xe5f(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <main+0x2c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm0,%xmm0
mov    $0xfffffff1,%ebx
lea    0xeb5(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,0x8(%rsp)
add    $0xf,%ebx
movsd  0x8(%rsp),%xmm0
mulsd  0xe79(%rip),%xmm0
divsd  0xe79(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
call   1050 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe3e(%rip),%xmm0
cmp    $0xa6,%ebx
jb     1170 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"ANGLE\09SIN\09COS\0A\00"
@.str.1 = [15 x i8] c"%d\09%.2f\09%.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store float 0.000000e+00, float* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
br label %6
6: ; preds = %21, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 181
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fmul double 3.140000e+00, %11
%13 = fdiv double %12, 9.000000e+01
%14 = fptrunc double %13 to float
store float %14, float* %3
%15 = load i32, i32* %2
%16 = load float, float* %3
%17 = call double @sin(float %16)
%18 = load float, float* %3
%19 = call double @cos(float %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %15, double %17, double %19)
br label %21
21: ; preds = %9
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 15
store i32 %23, i32* %2
br label %6
24: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"%d\09%.2f\09%.2f \0A\00"
@str = [14 x i8] c"ANGLE\09SIN\09COS\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %11, %2 ]
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 3.140000e+00
%6 = fdiv double %5, 9.000000e+01
%7 = fptrunc double %6 to float
%8 = tail call double @sin(float %7)
%9 = tail call double @cos(float %7)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %3, double %8, double %9)
%11 = add nuw nsw i32 %3, 15
%12 = icmp ult i32 %3, 166
br i1 %12, label %2, label %13
13: ; preds = %2
ret i32 0
}