#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 atan(double);
int /*<<< orphan*/ printf(char *, ...);
double sin(double);
int main() {
  int angle_degree;
  double angle_radian, pi, value;
  printf("\nCompute a table of the sine function\n\n");
  pi = 4.0 * atan(1.0);
  printf("Value of PI = %f \n\n", pi);
  printf(" angle     Sine \n");
  angle_degree = 0;
  while (angle_degree <= 360) {
    angle_radian = pi * angle_degree / 180.0;
    value = sin(angle_radian);
    printf(" %3d      %f \n ", angle_degree, value);
    angle_degree = angle_degree + 10;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xeb3(%rip),%xmm0
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe9b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xec6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x168,-0x8(%rbp)
jg     11f5 <main+0xc5>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe57(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x66>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
movsd  0xea8(%rip),%xmm0
call   1060 <atan@plt>
lea    0xebc(%rip),%rdi
movsd  0xe9c(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm0,%xmm0
mov    $0xfffffff6,%ebx
lea    0xea5(%rip),%r14
nop
movsd  %xmm0,(%rsp)
add    $0xa,%ebx
movsd  (%rsp),%xmm0
mulsd  0xe63(%rip),%xmm0
divsd  0xe63(%rip),%xmm0
call   1050 <sin@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe4d(%rip),%xmm0
cmp    $0x15f,%ebx
jb     1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [40 x i8] c"\0ACompute a table of the sine function\0A\0A\00"
@.str.1 = [20 x i8] c"Value of PI = %f \0A\0A\00"
@.str.2 = [18 x i8] c" angle Sine \0A\00"
@.str.3 = [16 x i8] c" %3d %f \0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%7 = call double @atan(double 1.000000e+00)
%8 = fmul double 4.000000e+00, %7
store double %8, double* %4
%9 = load double, double* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %12
12: ; preds = %15, %0
%13 = load i32, i32* %2
%14 = icmp sle i32 %13, 360
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load double, double* %4
%17 = load i32, i32* %2
%18 = sitofp i32 %17 to double
%19 = fmul double %16, %18
%20 = fdiv double %19, 1.800000e+02
store double %20, double* %3
%21 = load double, double* %3
%22 = call double @sin(double %21)
store double %22, double* %5
%23 = load i32, i32* %2
%24 = load double, double* %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %23, double %24)
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 10
store i32 %27, i32* %2
br label %12
28: ; preds = %12
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"Value of PI = %f \0A\0A\00"
@.str.3 = [16 x i8] c" %3d %f \0A \00"
@str = [39 x i8] c"\0ACompute a table of the sine function\0A\00"
@str.4 = [17 x i8] c" angle Sine \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%2 = tail call double @atan(double 1.000000e+00)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double 0x400921FB54442D18)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %12, %5 ]
%7 = sitofp i32 %6 to double
%8 = fmul double %7, 0x400921FB54442D18
%9 = fdiv double %8, 1.800000e+02
%10 = tail call double @sin(double %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %6, double %10)
%12 = add nuw nsw i32 %6, 10
%13 = icmp ult i32 %6, 351
br i1 %13, label %5, label %14
14: ; preds = %5
ret i32 0
}