#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 *, float, float);
int sin(int);
double sqr(float);
int main() {
  int i;
  for (i = 1; i < 16384; i++) {
    float j = 128.0 * sqr(((float)i) / 16384.0);
    float v = 100 * sin(2 * j * i / 512.0);
    printf("%f %f\n", v, j);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x4000,-0x8(%rbp)
jge    11e8 <main+0xb8>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeac(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <sqr@plt>
movaps %xmm0,%xmm1
movsd  0xe8c(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe87(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe55(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
imul   $0x64,%eax,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
lea    0xed9(%rip),%rbx
nop
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm0,(%rsp)
mulss  0xeac(%rip),%xmm0
call   1050 <sqr@plt>
mulsd  0xea7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
addss  %xmm0,%xmm0
mulss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe90(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
imul   $0x64,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    %rbx,%rdi
movss  0x4(%rsp),%xmm1
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x4000,%ebp
jne    1140 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%f %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
store i32 1, i32* %2
br label %5
5: ; preds = %31, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 16384
br i1 %7, label %8, label %34
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to float
%11 = fpext float %10 to double
%12 = fdiv double %11, 1.638400e+04
%13 = fptrunc double %12 to float
%14 = call double @sqr(float %13)
%15 = fmul double 1.280000e+02, %14
%16 = fptrunc double %15 to float
store float %16, float* %3
%17 = load float, float* %3
%18 = fmul float 2.000000e+00, %17
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to float
%21 = fmul float %18, %20
%22 = fpext float %21 to double
%23 = fdiv double %22, 5.120000e+02
%24 = fptosi double %23 to i32
%25 = call i32 @sin(i32 %24)
%26 = mul nsw i32 100, %25
%27 = sitofp i32 %26 to float
store float %27, float* %4
%28 = load float, float* %4
%29 = load float, float* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %28, float %29)
br label %31
31: ; preds = %8
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %5
34: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%f %f\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %17, %1 ]
%3 = sitofp i32 %2 to float
%4 = fmul float %3, 0x3F10000000000000
%5 = tail call double @sqr(float %4)
%6 = fmul double %5, 1.280000e+02
%7 = fptrunc double %6 to float
%8 = fmul float %7, 2.000000e+00
%9 = fmul float %8, %3
%10 = fpext float %9 to double
%11 = fmul double %10, 0x3F60000000000000
%12 = fptosi double %11 to i32
%13 = tail call i32 @sin(i32 %12)
%14 = mul nsw i32 %13, 100
%15 = sitofp i32 %14 to float
%16 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %15, float %7)
%17 = add nuw nsw i32 %2, 1
%18 = icmp eq i32 %17, 16384
br i1 %18, label %19, label %1
19: ; preds = %1
ret i32 0
}