#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 asin(int);
int cos(double);
int /*<<< orphan*/ printf(char *, int, int, int);
int sin(double);
int main(int argc, char **argv) {
  int degree;
  int x;
  int y;
  double radian;
  double Half_PI = asin(1);
  for (degree = 0; degree <= 45; degree += 1) {
    radian = (degree * Half_PI) / 90.0;
    x = (int)((32768 * sin(radian)) + 0.5);
    if (x >= 32768)
      x = 32767;
    else if (x < -32768)
      x = -32768;
    y = (int)((32768 * cos(radian)) + 0.5);
    if (y >= 32768)
      y = 32767;
    else if (y < -32768)
      y = -32768;
    printf("   {%5d,%5d},          /* %d degrees. */\n", x, y, degree);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1050 <asin@plt>
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2d,-0x14(%rbp)
jg     1260 <main+0x120>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <sin@plt>
shl    $0xf,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe56(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x8000,-0x18(%rbp)
jl     11ce <main+0x8e>
movl   $0x7fff,-0x18(%rbp)
jmp    11e7 <main+0xa7>
cmpl   $0xffff8000,-0x18(%rbp)
jge    11e2 <main+0xa2>
movl   $0xffff8000,-0x18(%rbp)
jmp    11e7 <main+0xa7>
movsd  -0x28(%rbp),%xmm0
call   1060 <cos@plt>
shl    $0xf,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe00(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x8000,-0x1c(%rbp)
jl     1224 <main+0xe4>
movl   $0x7fff,-0x1c(%rbp)
jmp    123d <main+0xfd>
cmpl   $0xffff8000,-0x1c(%rbp)
jge    1238 <main+0xf8>
movl   $0xffff8000,-0x1c(%rbp)
jmp    123d <main+0xfd>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xdc3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116c <main+0x2c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    $0x1,%edi
call   1050 <asin@plt>
movsd  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
xorpd  %xmm1,%xmm1
lea    0xecb(%rip),%r14
jmp    1194 <main+0x54>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%ecx
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm1
addsd  0xe80(%rip),%xmm1
add    $0x1,%ebx
cmp    $0x2e,%ebx
je     126a <main+0x12a>
movsd  0x8(%rsp),%xmm0
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm1,%xmm0
divsd  0xe54(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <sin@plt>
mov    %eax,%ebp
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
movd   %ebp,%xmm0
movd   %eax,%xmm1
punpckldq %xmm0,%xmm1
pslld  $0xf,%xmm1
cvtdq2pd %xmm1,%xmm0
addpd  0xe2f(%rip),%xmm0
cvttpd2dq %xmm0,%xmm0
movapd %xmm0,%xmm1
pcmpgtd 0xe2f(%rip),%xmm1
pshufd $0x50,%xmm1,%xmm1
movmskpd %xmm1,%eax
mov    $0xffff8000,%edx
test   $0x2,%al
jne    1220 <main+0xe0>
mov    $0xffff8000,%esi
cmp    $0x7fff,%esi
jge    1231 <main+0xf1>
jmp    1236 <main+0xf6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
pshufd $0x55,%xmm0,%xmm1
movd   %xmm1,%esi
cmp    $0x7fff,%esi
jl     1236 <main+0xf6>
mov    $0x7fff,%esi
test   $0x1,%al
jne    1250 <main+0x110>
cmp    $0x7fff,%edx
jl     1170 <main+0x30>
jmp    1260 <main+0x120>
nopl   0x0(%rax,%rax,1)
movd   %xmm0,%edx
cmp    $0x7fff,%edx
jl     1170 <main+0x30>
mov    $0x7fff,%edx
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c" {%5d,%5d}, /* %d degrees. */\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call double @asin(i32 1)
store double %11, double* %10
store i32 0, i32* %6
br label %12
12: ; preds = %55, %2
%13 = load i32, i32* %6
%14 = icmp sle i32 %13, 45
br i1 %14, label %15, label %58
15: ; preds = %12
%16 = load i32, i32* %6
%17 = sitofp i32 %16 to double
%18 = load double, double* %10
%19 = fmul double %17, %18
%20 = fdiv double %19, 9.000000e+01
store double %20, double* %9
%21 = load double, double* %9
%22 = call i32 @sin(double %21)
%23 = mul nsw i32 32768, %22
%24 = sitofp i32 %23 to double
%25 = fadd double %24, 5.000000e-01
%26 = fptosi double %25 to i32
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp sge i32 %27, 32768
br i1 %28, label %29, label %30
29: ; preds = %15
store i32 32767, i32* %7
br label %35
30: ; preds = %15
%31 = load i32, i32* %7
%32 = icmp slt i32 %31, -32768
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 -32768, i32* %7
br label %34
34: ; preds = %33, %30
br label %35
35: ; preds = %34, %29
%36 = load double, double* %9
%37 = call i32 @cos(double %36)
%38 = mul nsw i32 32768, %37
%39 = sitofp i32 %38 to double
%40 = fadd double %39, 5.000000e-01
%41 = fptosi double %40 to i32
store i32 %41, i32* %8
%42 = load i32, i32* %8
%43 = icmp sge i32 %42, 32768
br i1 %43, label %44, label %45
44: ; preds = %35
store i32 32767, i32* %8
br label %50
45: ; preds = %35
%46 = load i32, i32* %8
%47 = icmp slt i32 %46, -32768
br i1 %47, label %48, label %49
48: ; preds = %45
store i32 -32768, i32* %8
br label %49
49: ; preds = %48, %45
br label %50
50: ; preds = %49, %44
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = load i32, i32* %6
%54 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %51, i32 %52, i32 %53)
br label %55
55: ; preds = %50
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %12
58: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c" {%5d,%5d}, /* %d degrees. */\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double @asin(i32 1)
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %29, %4 ]
%6 = sitofp i32 %5 to double
%7 = fmul double %3, %6
%8 = fdiv double %7, 9.000000e+01
%9 = tail call i32 @sin(double %8)
%10 = tail call i32 @cos(double %8)
%11 = insertelement <2 x i32> poison, i32 %10, i64 0
%12 = insertelement <2 x i32> %11, i32 %9, i64 1
%13 = shl nsw <2 x i32> %12, <i32 15, i32 15>
%14 = sitofp <2 x i32> %13 to <2 x double>
%15 = fadd <2 x double> %14, <double 5.000000e-01, double 5.000000e-01>
%16 = fptosi <2 x double> %15 to <2 x i32>
%17 = icmp sgt <2 x i32> %16, <i32 -32768, i32 -32768>
%18 = extractelement <2 x i1> %17, i64 1
%19 = extractelement <2 x i32> %16, i64 1
%20 = select i1 %18, i32 %19, i32 -32768
%21 = icmp slt i32 %20, 32767
%22 = select i1 %21, i32 %20, i32 32767
%23 = extractelement <2 x i1> %17, i64 0
%24 = extractelement <2 x i32> %16, i64 0
%25 = select i1 %23, i32 %24, i32 -32768
%26 = icmp slt i32 %25, 32767
%27 = select i1 %26, i32 %25, i32 32767
%28 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %27, i32 %5)
%29 = add nuw nsw i32 %5, 1
%30 = icmp eq i32 %29, 46
br i1 %30, label %31, label %4
31: ; preds = %4
ret i32 0
}