#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);
void 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
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xeba(%rip),%xmm0
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xea2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xecd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x168,-0x4(%rbp)
jg     11ee <main+0xbe>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xe8e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    118f <main+0x5f>
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>
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 = [19 x i8] c"angle Sine\0A\00"
@.str.3 = [16 x i8] c"%3d %f\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%6 = call double @atan(double 1.000000e+00)
%7 = fmul double 4.000000e+00, %6
store double %7, double* %3
%8 = load double, double* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %11
11: ; preds = %14, %0
%12 = load i32, i32* %1
%13 = icmp sle i32 %12, 360
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load double, double* %3
%16 = load i32, i32* %1
%17 = sitofp i32 %16 to double
%18 = fmul double %15, %17
%19 = fdiv double %18, 1.800000e+02
store double %19, double* %2
%20 = load double, double* %2
%21 = call double @sin(double %20)
store double %21, double* %4
%22 = load i32, i32* %1
%23 = load double, double* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %22, double %23)
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 10
store i32 %26, i32* %1
br label %11
27: ; preds = %11
ret void
}

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 = [18 x i8] c"angle Sine\00"
define void @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 ([18 x i8], [18 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 void
}