#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 */
long M_PI;
long cos(long);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  long i, xxx;
  xxx = 1 << 16;
  for (i = 0; i < 360; i++) {
    printf("%6.0f, ", cos(i * M_PI / 180) * xxx);
    if (i == 90)
      printf("\n\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x10000,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x168,-0x10(%rbp)
jge    11b3 <main+0x93>
mov    -0x10(%rbp),%rax
mov    0x2e90(%rip),%rcx
imul   (%rcx),%rax
mov    $0xb4,%ecx
cqto
idiv   %rcx
mov    %rax,%rdi
call   1040 <cos@plt>
mov    %rax,%rsi
imul   -0x18(%rbp),%rsi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x5a,-0x10(%rbp)
jne    119d <main+0x7d>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a2 <main+0x82>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2ea8(%rip),%r15
movabs $0x2d82d82d82d82d83,%r12
d8 82 2d
lea    0xeaf(%rip),%r13
lea    0xeb0(%rip),%r14
xor    %ebx,%ebx
jmp    116d <main+0x3d>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0x168,%rbx
je     11ab <main+0x7b>
mov    (%r15),%rax
imul   %rbx,%rax
imul   %r12
mov    %rdx,%rdi
shr    $0x3f,%rdi
sar    $0x5,%rdx
add    %rdx,%rdi
call   1050 <cos@plt>
shl    $0x10,%rax
mov    %r13,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x5a,%rbx
jne    1160 <main+0x30>
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%6.0f, \00"
@M_PI = global i64 0
@.str.1 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 65536, i64* %3
store i64 0, i64* %2
br label %4
4: ; preds = %21, %0
%5 = load i64, i64* %2
%6 = icmp slt i64 %5, 360
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = load i64, i64* %2
%9 = load i64, i64* @M_PI
%10 = mul nsw i64 %8, %9
%11 = sdiv i64 %10, 180
%12 = call i64 @cos(i64 %11)
%13 = load i64, i64* %3
%14 = mul nsw i64 %12, %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %14)
%16 = load i64, i64* %2
%17 = icmp eq i64 %16, 90
br i1 %17, label %18, label %20
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %7
br label %21
21: ; preds = %20
%22 = load i64, i64* %2
%23 = add nsw i64 %22, 1
store i64 %23, i64* %2
br label %4
24: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%6.0f, \00"
@M_PI = global i64 0
@str = [2 x i8] c"\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %12
%2 = phi i64 [ 0, %0 ], [ %13, %12 ]
%3 = load i64, i64* @M_PI
%4 = mul nsw i64 %3, %2
%5 = sdiv i64 %4, 180
%6 = tail call i64 @cos(i64 %5)
%7 = shl nsw i64 %6, 16
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = icmp eq i64 %2, 90
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %1, %10
%13 = add nuw nsw i64 %2, 1
%14 = icmp eq i64 %13, 360
br i1 %14, label %15, label %1
15: ; preds = %12
ret i32 0
}