#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 */
scalar_t__ RAND_MAX;
int atan(int);
int /*<<< orphan*/ printf(char *, double);
double rand();
double sin(int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(void) {
  int i;
  double val, r, phi, f;
  srand(time(0));
  f = 1000 * ((rand() / (double)RAND_MAX) + 1) + 1000;
  phi = (2 * 4 * atan(1)) * ((rand() / (double)RAND_MAX) + 1);
  for (i = 0; i < 101; ++i) {
    r = 1.5 * (rand() / (double)RAND_MAX + 1) - .75;
    val = sin(2 * 4 * atan(1) * f * (i / 8000) + phi) + r;
    printf("%f\n", val);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1080 <rand@plt>
mov    0x2e5d(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe64(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe60(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x1,%edi
call   1070 <atan@plt>
shl    $0x3,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mov    0x2e07(%rip),%rax
cvtsi2sdq (%rax),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe0e(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x65,-0x8(%rbp)
jge    12b4 <main+0x154>
mov    $0x0,%al
call   1080 <rand@plt>
mov    0x2dca(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdd1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdd5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x1,%edi
call   1070 <atan@plt>
shl    $0x3,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%eax
mov    $0x1f40,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin@plt>
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xd7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1206 <main+0xa6>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    0x2e64(%rip),%r14
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
addsd  0xe6b(%rip),%xmm0
movsd  0xe6b(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%edi
call   1070 <atan@plt>
shl    $0x3,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
addsd  0xe20(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xe2d(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
addsd  0xde5(%rip),%xmm0
mulsd  0xded(%rip),%xmm0
addsd  0xded(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%edi
call   1070 <atan@plt>
shl    $0x3,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x18(%rsp),%xmm0
movzwl %bp,%eax
shr    $0x6,%eax
imul   $0x419,%eax,%eax
shr    $0x11,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1050 <sin@plt>
addsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
jne    1200 <main+0xa0>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = call i32 @time(i32 0)
%8 = call i32 @srand(i32 %7)
%9 = call double (...) @rand()
%10 = load i64, i64* @RAND_MAX
%11 = sitofp i64 %10 to double
%12 = fdiv double %9, %11
%13 = fadd double %12, 1.000000e+00
%14 = call double @llvm.fmuladd.f64(double 1.000000e+03, double %13, double 1.000000e+03)
store double %14, double* %6
%15 = call i32 @atan(i32 1)
%16 = mul nsw i32 8, %15
%17 = sitofp i32 %16 to double
%18 = call double (...) @rand()
%19 = load i64, i64* @RAND_MAX
%20 = sitofp i64 %19 to double
%21 = fdiv double %18, %20
%22 = fadd double %21, 1.000000e+00
%23 = fmul double %17, %22
store double %23, double* %5
store i32 0, i32* %2
br label %24
24: ; preds = %50, %0
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 101
br i1 %26, label %27, label %53
27: ; preds = %24
%28 = call double (...) @rand()
%29 = load i64, i64* @RAND_MAX
%30 = sitofp i64 %29 to double
%31 = fdiv double %28, %30
%32 = fadd double %31, 1.000000e+00
%33 = call double @llvm.fmuladd.f64(double 1.500000e+00, double %32, double -7.500000e-01)
store double %33, double* %4
%34 = call i32 @atan(i32 1)
%35 = mul nsw i32 8, %34
%36 = sitofp i32 %35 to double
%37 = load double, double* %6
%38 = fmul double %36, %37
%39 = load i32, i32* %2
%40 = sdiv i32 %39, 8000
%41 = sitofp i32 %40 to double
%42 = load double, double* %5
%43 = call double @llvm.fmuladd.f64(double %38, double %41, double %42)
%44 = fptosi double %43 to i32
%45 = call double @sin(i32 %44)
%46 = load double, double* %4
%47 = fadd double %45, %46
store double %47, double* %3
%48 = load double, double* %3
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %48)
br label %50
50: ; preds = %27
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %24
53: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32 0)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call double (...) @rand()
%4 = load i64, i64* @RAND_MAX
%5 = sitofp i64 %4 to double
%6 = fdiv double %3, %5
%7 = fadd double %6, 1.000000e+00
%8 = tail call double @llvm.fmuladd.f64(double %7, double 1.000000e+03, double 1.000000e+03)
%9 = tail call i32 @atan(i32 1)
%10 = shl nsw i32 %9, 3
%11 = sitofp i32 %10 to double
%12 = tail call double (...) @rand()
%13 = load i64, i64* @RAND_MAX
%14 = sitofp i64 %13 to double
%15 = fdiv double %12, %14
%16 = fadd double %15, 1.000000e+00
%17 = fmul double %16, %11
br label %18
18: ; preds = %0, %18
%19 = phi i32 [ 0, %0 ], [ %38, %18 ]
%20 = tail call double (...) @rand()
%21 = load i64, i64* @RAND_MAX
%22 = sitofp i64 %21 to double
%23 = fdiv double %20, %22
%24 = fadd double %23, 1.000000e+00
%25 = tail call double @llvm.fmuladd.f64(double %24, double 1.500000e+00, double -7.500000e-01)
%26 = tail call i32 @atan(i32 1)
%27 = shl nsw i32 %26, 3
%28 = sitofp i32 %27 to double
%29 = fmul double %8, %28
%30 = trunc i32 %19 to i16
%31 = udiv i16 %30, 8000
%32 = uitofp i16 %31 to double
%33 = tail call double @llvm.fmuladd.f64(double %29, double %32, double %17)
%34 = fptosi double %33 to i32
%35 = tail call double @sin(i32 %34)
%36 = fadd double %35, %25
%37 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %36)
%38 = add nuw nsw i32 %19, 1
%39 = icmp eq i32 %38, 101
br i1 %39, label %40, label %18
40: ; preds = %18
ret i32 0
}