#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 *, ...);
scalar_t__ round(double);
double sin(int);
int main() {
  int i;
  for (i = 0; i < 8192; i++) {
    printf(
        "%4d, ",
        (int)round((sin(2 * 3.14159265358979323 * (float)i / 8192.0) +
                    .5 * sin(4 * 3.14159265358979323 * (float)i / 8192.0) +
                    .5 * sin(8 * 3.14159265358979323 * (float)i / 8192.0) + 2) *
                   65.5));
    if (i % 32 == 31)
      printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2000,-0x8(%rbp)
jge    1267 <main+0x137>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe95(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe79(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe57(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe49(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe35(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0xe13(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdfb(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xde7(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <round@plt>
mov    %eax,%esi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cmp    $0x1f,%edx
jne    1254 <main+0x124>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1259 <main+0x129>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xeeb(%rip),%rbx
xor    %ebp,%ebp
jmp    116f <main+0x2f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x2000,%ebp
je     1247 <main+0x107>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0xe78(%rip),%xmm0
movsd  0xe78(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe5f(%rip),%xmm0
mulsd  0xe4f(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin@plt>
movapd %xmm0,%xmm1
movsd  0xe4a(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe34(%rip),%xmm0
mulsd  0xe14(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin@plt>
mulsd  0xe13(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
addsd  0xe15(%rip),%xmm0
mulsd  0xe15(%rip),%xmm0
call   1060 <round@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
not    %eax
test   $0x1f,%al
jne    1160 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x20>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%4d, \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %41, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 8192
br i1 %5, label %6, label %44
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to float
%9 = fpext float %8 to double
%10 = fmul double 0x401921FB54442D18, %9
%11 = fdiv double %10, 8.192000e+03
%12 = fptosi double %11 to i32
%13 = call double @sin(i32 %12)
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to float
%16 = fpext float %15 to double
%17 = fmul double 0x402921FB54442D18, %16
%18 = fdiv double %17, 8.192000e+03
%19 = fptosi double %18 to i32
%20 = call double @sin(i32 %19)
%21 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %20, double %13)
%22 = load i32, i32* %2
%23 = sitofp i32 %22 to float
%24 = fpext float %23 to double
%25 = fmul double 0x403921FB54442D18, %24
%26 = fdiv double %25, 8.192000e+03
%27 = fptosi double %26 to i32
%28 = call double @sin(i32 %27)
%29 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %28, double %21)
%30 = fadd double %29, 2.000000e+00
%31 = fmul double %30, 6.550000e+01
%32 = call i64 @round(double %31)
%33 = trunc i64 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %2
%36 = srem i32 %35, 32
%37 = icmp eq i32 %36, 31
br i1 %37, label %38, label %40
38: ; preds = %6
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %6
br label %41
41: ; preds = %40
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %3
44: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%4d, \00"
define i32 @main() {
br label %1
1: ; preds = %0, %28
%2 = phi i32 [ 0, %0 ], [ %29, %28 ]
%3 = sitofp i32 %2 to float
%4 = fpext float %3 to double
%5 = fmul double %4, 0x401921FB54442D18
%6 = fmul double %5, 0x3F20000000000000
%7 = fptosi double %6 to i32
%8 = tail call double @sin(i32 %7)
%9 = fmul double %4, 0x402921FB54442D18
%10 = fmul double %9, 0x3F20000000000000
%11 = fptosi double %10 to i32
%12 = tail call double @sin(i32 %11)
%13 = tail call double @llvm.fmuladd.f64(double %12, double 5.000000e-01, double %8)
%14 = fmul double %4, 0x403921FB54442D18
%15 = fmul double %14, 0x3F20000000000000
%16 = fptosi double %15 to i32
%17 = tail call double @sin(i32 %16)
%18 = tail call double @llvm.fmuladd.f64(double %17, double 5.000000e-01, double %13)
%19 = fadd double %18, 2.000000e+00
%20 = fmul double %19, 6.550000e+01
%21 = tail call i64 @round(double %20)
%22 = trunc i64 %21 to i32
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = and i32 %2, 31
%25 = icmp eq i32 %24, 31
br i1 %25, label %26, label %28
26: ; preds = %1
%27 = tail call i32 @putchar(i32 10)
br label %28
28: ; preds = %1, %26
%29 = add nuw nsw i32 %2, 1
%30 = icmp eq i32 %29, 8192
br i1 %30, label %31, label %1
31: ; preds = %28
ret i32 0
}