#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*/ fprintf(int /*<<< orphan*/, char *, int, scalar_t__,
                           scalar_t__);
scalar_t__ sin(int);
scalar_t__ sin4(int);
int /*<<< orphan*/ stderr;
int main() {
  int i;
  for (i = 0; i < 2048; ++i) {
    fprintf(stderr, "%d %24.16le %24.16le\n", i, sin4(i / 256.),
            sin4(i / 256.) - sin(i / 256.));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jge    11e6 <main+0xb6>
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin4@plt>
mov    %rax,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe70(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin4@plt>
mov    %rax,-0x20(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe52(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
sub    %rax,%r8
lea    0xe35(%rip),%rsi
call   1030 <fprintf@plt>
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   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
lea    0xec8(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
mov    0x2e84(%rip),%rax
mov    (%rax),%r15d
movsd  (%rsp),%xmm0
mulsd  0xe94(%rip),%xmm0
cvttsd2si %xmm0,%ebp
mov    %ebp,%edi
call   1050 <sin4@plt>
mov    %rax,%r12
mov    %ebp,%edi
call   1050 <sin4@plt>
mov    %rax,%r13
mov    %ebp,%edi
call   1040 <sin@plt>
sub    %rax,%r13
mov    %r15d,%edi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %r12,%rcx
mov    %r13,%r8
call   1030 <fprintf@plt>
movsd  (%rsp),%xmm0
addsd  0xe5a(%rip),%xmm0
add    $0x1,%ebx
cmp    $0x800,%ebx
jne    1150 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"%d %24.16le %24.16le\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 = %26, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 2048
br i1 %5, label %6, label %29
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = fdiv double %10, 2.560000e+02
%12 = fptosi double %11 to i32
%13 = call i64 @sin4(i32 %12)
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 2.560000e+02
%17 = fptosi double %16 to i32
%18 = call i64 @sin4(i32 %17)
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, 2.560000e+02
%22 = fptosi double %21 to i32
%23 = call i64 @sin(i32 %22)
%24 = sub nsw i64 %18, %23
%25 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8, i64 %13, i64 %24)
br label %26
26: ; preds = %6
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %3
29: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"%d %24.16le %24.16le\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %12, %1 ]
%3 = load i32, i32* @stderr
%4 = sitofp i32 %2 to double
%5 = fmul double %4, 3.906250e-03
%6 = fptosi double %5 to i32
%7 = tail call i64 @sin4(i32 %6)
%8 = tail call i64 @sin4(i32 %6)
%9 = tail call i64 @sin(i32 %6)
%10 = sub nsw i64 %8, %9
%11 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %2, i64 %7, i64 %10)
%12 = add nuw nsw i32 %2, 1
%13 = icmp eq i32 %12, 2048
br i1 %13, label %14, label %1
14: ; preds = %1
ret i32 0
}