#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 /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int loop = 0, n = 0;
  double value = 0, sum = 0, term = 0;
  printf("The Sine series will be :\n");
  for (loop = 0; loop <= 360; loop = loop + 30) {
    value = loop * 3.1415 / 180;
    term = value;
    sum = value;
    n = 1;
    while ((term > 0.0000001) || (term < -0.0000001)) {
      term = (-1) * value * value * term / ((2 * n) * (2 * n + 1));
      n++;
      sum += term;
    }
    printf("\t\tSine(%d)=%lf\n", loop, sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x168,-0x8(%rbp)
jg     125a <main+0x14a>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0xc(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    $0x1,%al
movsd  0xe5d(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x29(%rbp)
ja     11d3 <main+0xc3>
movsd  0xe50(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
seta   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11e3 <main+0xd3>
jmp    1236 <main+0x126>
movsd  0xe35(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11a4 <main+0x94>
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xdfe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1e,%eax
mov    %eax,-0x8(%rbp)
jmp    115a <main+0x4a>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf25(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
xorpd  %xmm1,%xmm1
movsd  0xed2(%rip),%xmm4
movsd  0xed2(%rip),%xmm5
lea    0xef3(%rip),%r14
jmp    118a <main+0x6a>
nop
movapd %xmm1,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xeb0(%rip),%xmm5
movsd  0xea0(%rip),%xmm4
movsd  (%rsp),%xmm1
addsd  0xea3(%rip),%xmm1
lea    0x1e(%rbx),%eax
cmp    $0x14b,%ebx
mov    %eax,%ebx
jae    11fd <main+0xdd>
movsd  %xmm1,(%rsp)
mulsd  0xe69(%rip),%xmm1
divsd  0xe69(%rip),%xmm1
ucomisd %xmm4,%xmm1
ja     11ab <main+0x8b>
ucomisd %xmm1,%xmm5
jbe    1150 <main+0x30>
movapd %xmm1,%xmm2
xorpd  0xe79(%rip),%xmm2
mulsd  %xmm1,%xmm2
mov    $0x3,%eax
movapd %xmm1,%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mulsd  %xmm2,%xmm1
lea    -0x1(%rax),%ecx
imul   %eax,%ecx
xorps  %xmm3,%xmm3
cvtsi2sd %ecx,%xmm3
divsd  %xmm3,%xmm1
addsd  %xmm1,%xmm0
add    $0x2,%eax
ucomisd %xmm4,%xmm1
ja     11d0 <main+0xb0>
ucomisd %xmm1,%xmm5
ja     11d0 <main+0xb0>
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"The Sine series will be :\0A\00"
@.str.1 = [16 x i8] c"\09\09Sine(%d)=%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %8
8: ; preds = %50, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 360
br i1 %10, label %11, label %53
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 3.141500e+00
%15 = fdiv double %14, 1.800000e+02
store double %15, double* %4
%16 = load double, double* %4
store double %16, double* %6
%17 = load double, double* %4
store double %17, double* %5
store i32 1, i32* %3
br label %18
18: ; preds = %26, %11
%19 = load double, double* %6
%20 = fcmp ogt double %19, 0x3E7AD7F29ABCAF48
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load double, double* %6
%23 = fcmp olt double %22, 0xBE7AD7F29ABCAF48
br label %24
24: ; preds = %21, %18
%25 = phi i1 [ true, %18 ], [ %23, %21 ]
br i1 %25, label %26, label %46
26: ; preds = %24
%27 = load double, double* %4
%28 = fmul double -1.000000e+00, %27
%29 = load double, double* %4
%30 = fmul double %28, %29
%31 = load double, double* %6
%32 = fmul double %30, %31
%33 = load i32, i32* %3
%34 = mul nsw i32 2, %33
%35 = load i32, i32* %3
%36 = mul nsw i32 2, %35
%37 = add nsw i32 %36, 1
%38 = mul nsw i32 %34, %37
%39 = sitofp i32 %38 to double
%40 = fdiv double %32, %39
store double %40, double* %6
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
%43 = load double, double* %6
%44 = load double, double* %5
%45 = fadd double %44, %43
store double %45, double* %5
br label %18
46: ; preds = %24
%47 = load i32, i32* %2
%48 = load double, double* %5
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %47, double %48)
br label %50
50: ; preds = %46
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 30
store i32 %52, i32* %2
br label %8
53: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"\09\09Sine(%d)=%lf\0A\00"
@str = [26 x i8] c"The Sine series will be :\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %28
%3 = phi i32 [ 0, %0 ], [ %31, %28 ]
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 3.141500e+00
%6 = fdiv double %5, 1.800000e+02
%7 = fcmp ogt double %6, 0x3E7AD7F29ABCAF48
%8 = fcmp olt double %6, 0xBE7AD7F29ABCAF48
%9 = or i1 %7, %8
br i1 %9, label %10, label %28
10: ; preds = %2
%11 = fneg double %6
%12 = fmul double %6, %11
br label %13
13: ; preds = %10, %13
%14 = phi double [ %6, %10 ], [ %22, %13 ]
%15 = phi double [ %6, %10 ], [ %24, %13 ]
%16 = phi i32 [ 1, %10 ], [ %23, %13 ]
%17 = fmul double %12, %14
%18 = shl nuw nsw i32 %16, 1
%19 = or i32 %18, 1
%20 = mul nsw i32 %19, %18
%21 = sitofp i32 %20 to double
%22 = fdiv double %17, %21
%23 = add nuw nsw i32 %16, 1
%24 = fadd double %15, %22
%25 = fcmp ogt double %22, 0x3E7AD7F29ABCAF48
%26 = fcmp olt double %22, 0xBE7AD7F29ABCAF48
%27 = or i1 %25, %26
br i1 %27, label %13, label %28
28: ; preds = %13, %2
%29 = phi double [ %6, %2 ], [ %24, %13 ]
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %3, double %29)
%31 = add nuw nsw i32 %3, 30
%32 = icmp ult i32 %3, 331
br i1 %32, label %2, label %33
33: ; preds = %28
ret i32 0
}