#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 */
double sin(double);
void SinEvalPts(int n, double *eval_pts) {
  int i;
  double twoN;
  twoN = (double)(2 * n);
  for (i = 0; i < n; i++)
    eval_pts[i] =
        sin(((2.0 * ((double)i) + 1.0) * 3.14159265358979323846) / twoN);
}


x86 assembly (clang, -O0):
<SinEvalPts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1187 <SinEvalPts+0x77>
cvtsi2sdl -0x14(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <SinEvalPts+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SinEvalPts>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1204 <SinEvalPts+0xf4>
mov    %rsi,%r14
lea    (%rdi,%rdi,1),%eax
cvtsi2sd %eax,%xmm0
mov    %edi,%r15d
cmp    $0x1,%edi
jne    1143 <SinEvalPts+0x33>
xor    %ebx,%ebx
test   $0x1,%r15b
jne    11d6 <SinEvalPts+0xc6>
jmp    1204 <SinEvalPts+0xf4>
mov    %r15d,%r12d
and    $0xfffffffe,%r12d
xor    %ebx,%ebx
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm0,%xmm0
movsd  0xe8d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe89(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%r14,%rbx,8)
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm0
addsd  0xe57(%rip),%xmm0
mulsd  0xe57(%rip),%xmm0
divsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %r12,%rbx
jne    1160 <SinEvalPts+0x50>
movsd  (%rsp),%xmm0
test   $0x1,%r15b
je     1204 <SinEvalPts+0xf4>
movapd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm0,%xmm0
addsd  0xe13(%rip),%xmm0
mulsd  0xe13(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @SinEvalPts(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
store i32 %0, i32* %3
store double* %1, double** %4
%7 = load i32, i32* %3
%8 = mul nsw i32 2, %7
%9 = sitofp i32 %8 to double
store double %9, double* %6
store i32 0, i32* %5
br label %10
10: ; preds = %26, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = load i32, i32* %5
%16 = sitofp i32 %15 to double
%17 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %16, double 1.000000e+00)
%18 = fmul double %17, 0x400921FB54442D18
%19 = load double, double* %6
%20 = fdiv double %18, %19
%21 = call double @sin(double %20)
%22 = load double*, double** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
store double %21, double* %25
br label %26
26: ; preds = %14
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %10
29: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @SinEvalPts(i32 %0, double* nocapture writeonly %1) {
%3 = shl nsw i32 %0, 1
%4 = sitofp i32 %3 to double
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %44
6: ; preds = %2
%7 = zext i32 %0 to i64
%8 = and i64 %7, 1
%9 = icmp eq i32 %0, 1
br i1 %9, label %33, label %10
10: ; preds = %6
%11 = and i64 %7, 4294967294
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %30, %12 ]
%14 = phi i64 [ 0, %10 ], [ %31, %12 ]
%15 = trunc i64 %13 to i32
%16 = sitofp i32 %15 to double
%17 = tail call double @llvm.fmuladd.f64(double %16, double 2.000000e+00, double 1.000000e+00)
%18 = fmul double %17, 0x400921FB54442D18
%19 = fdiv double %18, %4
%20 = tail call double @sin(double %19)
%21 = getelementptr inbounds double, double* %1, i64 %13
store double %20, double* %21
%22 = or i64 %13, 1
%23 = trunc i64 %22 to i32
%24 = sitofp i32 %23 to double
%25 = tail call double @llvm.fmuladd.f64(double %24, double 2.000000e+00, double 1.000000e+00)
%26 = fmul double %25, 0x400921FB54442D18
%27 = fdiv double %26, %4
%28 = tail call double @sin(double %27)
%29 = getelementptr inbounds double, double* %1, i64 %22
store double %28, double* %29
%30 = add nuw nsw i64 %13, 2
%31 = add i64 %14, 2
%32 = icmp eq i64 %31, %11
br i1 %32, label %33, label %12
33: ; preds = %12, %6
%34 = phi i64 [ 0, %6 ], [ %30, %12 ]
%35 = icmp eq i64 %8, 0
br i1 %35, label %44, label %36
36: ; preds = %33
%37 = trunc i64 %34 to i32
%38 = sitofp i32 %37 to double
%39 = tail call double @llvm.fmuladd.f64(double %38, double 2.000000e+00, double 1.000000e+00)
%40 = fmul double %39, 0x400921FB54442D18
%41 = fdiv double %40, %4
%42 = tail call double @sin(double %41)
%43 = getelementptr inbounds double, double* %1, i64 %34
store double %42, double* %43
br label %44
44: ; preds = %36, %33, %2
ret void
}