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


x86 assembly (clang, -O0):
<SinEvalPts2>:
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    1193 <SinEvalPts2+0x83>
cvtsi2sdl -0x14(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xebe(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe96(%rip),%xmm0
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 <SinEvalPts2+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SinEvalPts2>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1220 <SinEvalPts2+0x110>
mov    %rsi,%r14
lea    (%rdi,%rdi,1),%eax
cvtsi2sd %eax,%xmm0
mov    %edi,%r15d
cmp    $0x1,%edi
jne    1143 <SinEvalPts2+0x33>
xor    %ebx,%ebx
test   $0x1,%r15b
jne    11ea <SinEvalPts2+0xda>
jmp    1220 <SinEvalPts2+0x110>
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
movsd  0xe85(%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  0xe4b(%rip),%xmm0
mulsd  0xe4b(%rip),%xmm0
mulsd  0xe4b(%rip),%xmm0
divsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %r12,%rbx
jne    1160 <SinEvalPts2+0x50>
movsd  (%rsp),%xmm0
test   $0x1,%r15b
je     1220 <SinEvalPts2+0x110>
movapd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm0,%xmm0
addsd  0xdff(%rip),%xmm0
mulsd  0xdff(%rip),%xmm0
mulsd  0xdff(%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 @SinEvalPts2(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 = %27, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %30
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 = fmul double 5.000000e-01, %18
%20 = load double, double* %6
%21 = fdiv double %19, %20
%22 = call double @sin(double %21)
%23 = load double*, double** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double %22, double* %26
br label %27
27: ; preds = %14
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %10
30: ; preds = %10
ret void
}

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