#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 cos(double);
double sin(double);
void FreqSample(int N, double A[], double h[], int symm) {
  int n, k;
  double x, val, M;
  M = (N - 1.0) / 2.0;
  if (symm == 1) {
    if (N % 2) {
      for (n = 0; n < N; n++) {
        val = A[0];
        x = (2. * 3.1415926535897932384626433832795029) * (n - M) / N;
        for (k = 1; k <= M; k++)
          val += 2.0 * A[k] * cos(x * k);
        h[n] = val / N;
      }
    } else {
      for (n = 0; n < N; n++) {
        val = A[0];
        x = (2. * 3.1415926535897932384626433832795029) * (n - M) / N;
        for (k = 1; k <= (N / 2 - 1); k++)
          val += 2.0 * A[k] * cos(x * k);
        h[n] = val / N;
      }
    }
  } else {
    if (N % 2) {
      for (n = 0; n < N; n++) {
        val = 0;
        x = (2. * 3.1415926535897932384626433832795029) * (n - M) / N;
        for (k = 1; k <= M; k++)
          val += 2.0 * A[k] * sin(x * k);
        h[n] = val / N;
      }
    } else {
      for (n = 0; n < N; n++) {
        val = A[N / 2] * sin(3.1415926535897932384626433832795029 * (n - M));
        x = (2. * 3.1415926535897932384626433832795029) * (n - M) / N;
        for (k = 1; k <= (N / 2 - 1); k++)
          val += 2.0 * A[k] * sin(x * k);
        h[n] = val / N;
      }
    }
  }
}


x86 assembly (clang, -O0):
<FreqSample>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xec2(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeae(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    134f <FreqSample+0x22f>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     125b <FreqSample+0x13b>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1256 <FreqSample+0x136>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
movsd  0xe65(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x24(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     122d <FreqSample+0x10d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  0xe18(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c4 <FreqSample+0xa4>
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1180 <FreqSample+0x60>
jmp    134a <FreqSample+0x22a>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1345 <FreqSample+0x225>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
movsd  0xd83(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     131c <FreqSample+0x1fc>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  0xd29(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12a6 <FreqSample+0x186>
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1262 <FreqSample+0x142>
jmp    134a <FreqSample+0x22a>
jmp    1579 <FreqSample+0x459>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1440 <FreqSample+0x320>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    143b <FreqSample+0x31b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
movsd  0xc80(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x24(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1412 <FreqSample+0x2f2>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  0xc33(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13a9 <FreqSample+0x289>
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    136a <FreqSample+0x24a>
jmp    1574 <FreqSample+0x454>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    156f <FreqSample+0x44f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
movsd  0xb8d(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
movsd  0xb59(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1546 <FreqSample+0x426>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  0xaff(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x30(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14d0 <FreqSample+0x3b0>
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1447 <FreqSample+0x327>
jmp    1574 <FreqSample+0x454>
jmp    1579 <FreqSample+0x459>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FreqSample>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebx
cvtsi2sd %edi,%xmm0
movsd  0xebe(%rip),%xmm1
movsd  %xmm0,0x18(%rsp)
addsd  %xmm0,%xmm1
mulsd  0xeb4(%rip),%xmm1
cmp    $0x1,%ecx
movsd  %xmm1,0x20(%rsp)
mov    %edi,0x2c(%rsp)
jne    1303 <FreqSample+0x1e3>
test   $0x1,%bl
jne    14d2 <FreqSample+0x3b2>
test   %ebx,%ebx
jle    166c <FreqSample+0x54c>
mov    %ebx,%eax
shr    %eax
cmp    $0x3,%eax
mov    $0x2,%ebp
cmovge %eax,%ebp
mov    %ebx,%eax
add    $0xffffffffffffffff,%rbp
mov    %rbp,0x38(%rsp)
and    $0xfffffffffffffffe,%rbp
xor    %r13d,%r13d
movsd  0xe77(%rip),%xmm0
mov    %rax,0x30(%rsp)
jmp    11c9 <FreqSample+0xa9>
nopl   0x0(%rax,%rax,1)
divsd  0x18(%rsp),%xmm2
movsd  %xmm2,(%r14,%r13,8)
add    $0x1,%r13
cmp    %rax,%r13
je     166c <FreqSample+0x54c>
xorps  %xmm3,%xmm3
cvtsi2sd %r13d,%xmm3
movsd  (%r15),%xmm2
subsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
cmp    $0x4,%ebx
jb     11b0 <FreqSample+0x90>
divsd  0x18(%rsp),%xmm3
mov    $0x1,%r12d
cmp    $0x6,%ebx
jb     12a7 <FreqSample+0x187>
mov    %r14,%rbx
mov    $0x1,%r12d
movsd  %xmm3,0x10(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  %xmm2,0x8(%rsp)
movsd  (%r15,%r12,8),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
mulsd  %xmm3,%xmm0
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%r15,%r12,8),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
lea    0x1(%r12),%r14
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x10(%rsp),%xmm3
movapd %xmm0,%xmm2
mulsd  (%rsp),%xmm2
addsd  0x8(%rsp),%xmm2
add    $0x2,%r12
cmp    %rbp,%r14
jne    1210 <FreqSample+0xf0>
mov    %rbx,%r14
movsd  0x20(%rsp),%xmm1
mov    0x2c(%rsp),%ebx
mov    0x30(%rsp),%rax
movsd  0xd71(%rip),%xmm0
testb  $0x1,0x38(%rsp)
je     11b0 <FreqSample+0x90>
movsd  (%r15,%r12,8),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
mulsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm2
mov    0x30(%rsp),%rax
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm0
addsd  %xmm0,%xmm2
movsd  0xd1a(%rip),%xmm0
jmp    11b0 <FreqSample+0x90>
test   $0x1,%bl
jne    159c <FreqSample+0x47c>
test   %ebx,%ebx
jle    166c <FreqSample+0x54c>
mov    %ebx,%ecx
shr    %ecx
cmp    $0x3,%ecx
mov    $0x2,%r12d
mov    %rcx,%rax
mov    %rcx,0x38(%rsp)
cmovge %ecx,%r12d
mov    %ebx,%eax
mov    %rax,0x30(%rsp)
add    $0xffffffffffffffff,%r12
mov    %r12,0x40(%rsp)
and    $0xfffffffffffffffe,%r12
xor    %r13d,%r13d
jmp    1371 <FreqSample+0x251>
cs nopw 0x0(%rax,%rax,1)
movsd  0x20(%rsp),%xmm1
divsd  0x18(%rsp),%xmm2
movsd  %xmm2,(%r14,%r13,8)
add    $0x1,%r13
cmp    0x30(%rsp),%r13
je     166c <FreqSample+0x54c>
mov    0x38(%rsp),%rax
movsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  0xc84(%rip),%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm2
movsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm2
mulsd  0xc5f(%rip),%xmm0
cmp    $0x4,%ebx
jb     1350 <FreqSample+0x230>
divsd  0x18(%rsp),%xmm0
mov    $0x1,%ebp
cmp    $0x6,%ebx
jae    13f0 <FreqSample+0x2d0>
movsd  0x20(%rsp),%xmm1
testb  $0x1,0x40(%rsp)
je     1356 <FreqSample+0x236>
jmp    1491 <FreqSample+0x371>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%ebp
movsd  %xmm0,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x10(%rsp)
movsd  (%r15,%rbp,8),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%r15,%rbp,8),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
lea    0x1(%rbp),%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm2
mulsd  (%rsp),%xmm2
addsd  0x10(%rsp),%xmm2
add    $0x2,%rbp
cmp    %r12,%rbx
jne    1400 <FreqSample+0x2e0>
movsd  0x20(%rsp),%xmm1
mov    0x2c(%rsp),%ebx
movsd  0x8(%rsp),%xmm0
testb  $0x1,0x40(%rsp)
je     1356 <FreqSample+0x236>
movsd  (%r15,%rbp,8),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm2,0x10(%rsp)
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm2
jmp    1356 <FreqSample+0x236>
test   %ebx,%ebx
jle    166c <FreqSample+0x54c>
mov    %ebx,%ebx
xor    %r12d,%r12d
movsd  0xb29(%rip),%xmm0
jmp    1511 <FreqSample+0x3f1>
nopl   0x0(%rax)
divsd  0x18(%rsp),%xmm2
movsd  %xmm2,(%r14,%r12,8)
add    $0x1,%r12
cmp    %rbx,%r12
movsd  0xb05(%rip),%xmm0
je     166c <FreqSample+0x54c>
ucomisd %xmm0,%xmm1
movsd  (%r15),%xmm2
xorps  %xmm3,%xmm3
cvtsi2sd %r12d,%xmm3
subsd  %xmm1,%xmm3
mulsd  0xaea(%rip),%xmm3
movsd  %xmm3,(%rsp)
jb     14f0 <FreqSample+0x3d0>
movsd  (%rsp),%xmm1
divsd  0x18(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
movsd  %xmm2,0x8(%rsp)
mulsd  (%rsp),%xmm0
movsd  (%r15,%rbp,8),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm2
add    $0x1,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
ucomisd %xmm0,%xmm1
jae    1550 <FreqSample+0x430>
jmp    14f0 <FreqSample+0x3d0>
test   %ebx,%ebx
jle    166c <FreqSample+0x54c>
mov    %ebx,%ebx
xor    %r12d,%r12d
jmp    15c9 <FreqSample+0x4a9>
nopl   0x0(%rax,%rax,1)
divsd  0x18(%rsp),%xmm2
movsd  %xmm2,(%r14,%r12,8)
add    $0x1,%r12
cmp    %rbx,%r12
je     166c <FreqSample+0x54c>
ucomisd 0xa3f(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
subsd  %xmm1,%xmm0
mulsd  0xa33(%rip),%xmm0
movsd  %xmm0,(%rsp)
xorpd  %xmm2,%xmm2
jb     15b0 <FreqSample+0x490>
movsd  (%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rsp)
xorpd  %xmm2,%xmm2
mov    $0x1,%ebp
movsd  0x9ff(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x8(%rsp)
mulsd  (%rsp),%xmm0
movsd  (%r15,%rbp,8),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm2
add    $0x1,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
ucomisd %xmm0,%xmm1
jae    1620 <FreqSample+0x500>
jmp    15b0 <FreqSample+0x490>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @FreqSample(i32 %0, double* %1, double* %2, i32 %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to double
%16 = fsub double %15, 1.000000e+00
%17 = fdiv double %16, 2.000000e+00
store double %17, double* %13
%18 = load i32, i32* %8
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %130
20: ; preds = %4
%21 = load i32, i32* %5
%22 = srem i32 %21, 2
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %76
24: ; preds = %20
store i32 0, i32* %9
br label %25
25: ; preds = %72, %24
%26 = load i32, i32* %9
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %75
29: ; preds = %25
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 0
%32 = load double, double* %31
store double %32, double* %12
%33 = load i32, i32* %9
%34 = sitofp i32 %33 to double
%35 = load double, double* %13
%36 = fsub double %34, %35
%37 = fmul double 0x401921FB54442D18, %36
%38 = load i32, i32* %5
%39 = sitofp i32 %38 to double
%40 = fdiv double %37, %39
store double %40, double* %11
store i32 1, i32* %10
br label %41
41: ; preds = %60, %29
%42 = load i32, i32* %10
%43 = sitofp i32 %42 to double
%44 = load double, double* %13
%45 = fcmp ole double %43, %44
br i1 %45, label %46, label %63
46: ; preds = %41
%47 = load double*, double** %6
%48 = load i32, i32* %10
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = fmul double 2.000000e+00, %51
%53 = load double, double* %11
%54 = load i32, i32* %10
%55 = sitofp i32 %54 to double
%56 = fmul double %53, %55
%57 = call double @cos(double %56)
%58 = load double, double* %12
%59 = call double @llvm.fmuladd.f64(double %52, double %57, double %58)
store double %59, double* %12
br label %60
60: ; preds = %46
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
store i32 %62, i32* %10
br label %41
63: ; preds = %41
%64 = load double, double* %12
%65 = load i32, i32* %5
%66 = sitofp i32 %65 to double
%67 = fdiv double %64, %66
%68 = load double*, double** %7
%69 = load i32, i32* %9
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
store double %67, double* %71
br label %72
72: ; preds = %63
%73 = load i32, i32* %9
%74 = add nsw i32 %73, 1
store i32 %74, i32* %9
br label %25
75: ; preds = %25
br label %129
76: ; preds = %20
store i32 0, i32* %9
br label %77
77: ; preds = %125, %76
%78 = load i32, i32* %9
%79 = load i32, i32* %5
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %128
81: ; preds = %77
%82 = load double*, double** %6
%83 = getelementptr inbounds double, double* %82, i64 0
%84 = load double, double* %83
store double %84, double* %12
%85 = load i32, i32* %9
%86 = sitofp i32 %85 to double
%87 = load double, double* %13
%88 = fsub double %86, %87
%89 = fmul double 0x401921FB54442D18, %88
%90 = load i32, i32* %5
%91 = sitofp i32 %90 to double
%92 = fdiv double %89, %91
store double %92, double* %11
store i32 1, i32* %10
br label %93
93: ; preds = %113, %81
%94 = load i32, i32* %10
%95 = load i32, i32* %5
%96 = sdiv i32 %95, 2
%97 = sub nsw i32 %96, 1
%98 = icmp sle i32 %94, %97
br i1 %98, label %99, label %116
99: ; preds = %93
%100 = load double*, double** %6
%101 = load i32, i32* %10
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %100, i64 %102
%104 = load double, double* %103
%105 = fmul double 2.000000e+00, %104
%106 = load double, double* %11
%107 = load i32, i32* %10
%108 = sitofp i32 %107 to double
%109 = fmul double %106, %108
%110 = call double @cos(double %109)
%111 = load double, double* %12
%112 = call double @llvm.fmuladd.f64(double %105, double %110, double %111)
store double %112, double* %12
br label %113
113: ; preds = %99
%114 = load i32, i32* %10
%115 = add nsw i32 %114, 1
store i32 %115, i32* %10
br label %93
116: ; preds = %93
%117 = load double, double* %12
%118 = load i32, i32* %5
%119 = sitofp i32 %118 to double
%120 = fdiv double %117, %119
%121 = load double*, double** %7
%122 = load i32, i32* %9
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %121, i64 %123
store double %120, double* %124
br label %125
125: ; preds = %116
%126 = load i32, i32* %9
%127 = add nsw i32 %126, 1
store i32 %127, i32* %9
br label %77
128: ; preds = %77
br label %129
129: ; preds = %128, %75
br label %247
130: ; preds = %4
%131 = load i32, i32* %5
%132 = srem i32 %131, 2
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %183
134: ; preds = %130
store i32 0, i32* %9
br label %135
135: ; preds = %179, %134
%136 = load i32, i32* %9
%137 = load i32, i32* %5
%138 = icmp slt i32 %136, %137
br i1 %138, label %139, label %182
139: ; preds = %135
store double 0.000000e+00, double* %12
%140 = load i32, i32* %9
%141 = sitofp i32 %140 to double
%142 = load double, double* %13
%143 = fsub double %141, %142
%144 = fmul double 0x401921FB54442D18, %143
%145 = load i32, i32* %5
%146 = sitofp i32 %145 to double
%147 = fdiv double %144, %146
store double %147, double* %11
store i32 1, i32* %10
br label %148
148: ; preds = %167, %139
%149 = load i32, i32* %10
%150 = sitofp i32 %149 to double
%151 = load double, double* %13
%152 = fcmp ole double %150, %151
br i1 %152, label %153, label %170
153: ; preds = %148
%154 = load double*, double** %6
%155 = load i32, i32* %10
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double, double* %154, i64 %156
%158 = load double, double* %157
%159 = fmul double 2.000000e+00, %158
%160 = load double, double* %11
%161 = load i32, i32* %10
%162 = sitofp i32 %161 to double
%163 = fmul double %160, %162
%164 = call double @sin(double %163)
%165 = load double, double* %12
%166 = call double @llvm.fmuladd.f64(double %159, double %164, double %165)
store double %166, double* %12
br label %167
167: ; preds = %153
%168 = load i32, i32* %10
%169 = add nsw i32 %168, 1
store i32 %169, i32* %10
br label %148
170: ; preds = %148
%171 = load double, double* %12
%172 = load i32, i32* %5
%173 = sitofp i32 %172 to double
%174 = fdiv double %171, %173
%175 = load double*, double** %7
%176 = load i32, i32* %9
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds double, double* %175, i64 %177
store double %174, double* %178
br label %179
179: ; preds = %170
%180 = load i32, i32* %9
%181 = add nsw i32 %180, 1
store i32 %181, i32* %9
br label %135
182: ; preds = %135
br label %246
183: ; preds = %130
store i32 0, i32* %9
br label %184
184: ; preds = %242, %183
%185 = load i32, i32* %9
%186 = load i32, i32* %5
%187 = icmp slt i32 %185, %186
br i1 %187, label %188, label %245
188: ; preds = %184
%189 = load double*, double** %6
%190 = load i32, i32* %5
%191 = sdiv i32 %190, 2
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds double, double* %189, i64 %192
%194 = load double, double* %193
%195 = load i32, i32* %9
%196 = sitofp i32 %195 to double
%197 = load double, double* %13
%198 = fsub double %196, %197
%199 = fmul double 0x400921FB54442D18, %198
%200 = call double @sin(double %199)
%201 = fmul double %194, %200
store double %201, double* %12
%202 = load i32, i32* %9
%203 = sitofp i32 %202 to double
%204 = load double, double* %13
%205 = fsub double %203, %204
%206 = fmul double 0x401921FB54442D18, %205
%207 = load i32, i32* %5
%208 = sitofp i32 %207 to double
%209 = fdiv double %206, %208
store double %209, double* %11
store i32 1, i32* %10
br label %210
210: ; preds = %230, %188
%211 = load i32, i32* %10
%212 = load i32, i32* %5
%213 = sdiv i32 %212, 2
%214 = sub nsw i32 %213, 1
%215 = icmp sle i32 %211, %214
br i1 %215, label %216, label %233
216: ; preds = %210
%217 = load double*, double** %6
%218 = load i32, i32* %10
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds double, double* %217, i64 %219
%221 = load double, double* %220
%222 = fmul double 2.000000e+00, %221
%223 = load double, double* %11
%224 = load i32, i32* %10
%225 = sitofp i32 %224 to double
%226 = fmul double %223, %225
%227 = call double @sin(double %226)
%228 = load double, double* %12
%229 = call double @llvm.fmuladd.f64(double %222, double %227, double %228)
store double %229, double* %12
br label %230
230: ; preds = %216
%231 = load i32, i32* %10
%232 = add nsw i32 %231, 1
store i32 %232, i32* %10
br label %210
233: ; preds = %210
%234 = load double, double* %12
%235 = load i32, i32* %5
%236 = sitofp i32 %235 to double
%237 = fdiv double %234, %236
%238 = load double*, double** %7
%239 = load i32, i32* %9
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds double, double* %238, i64 %240
store double %237, double* %241
br label %242
242: ; preds = %233
%243 = load i32, i32* %9
%244 = add nsw i32 %243, 1
store i32 %244, i32* %9
br label %184
245: ; preds = %184
br label %246
246: ; preds = %245, %182
br label %247
247: ; preds = %246, %129
ret void
}

LLVM IR (-O2):
define void @FreqSample(i32 %0, double* nocapture %1, double* nocapture writeonly %2, i32 %3) {
%5 = sitofp i32 %0 to double
%6 = fadd double %5, -1.000000e+00
%7 = fmul double %6, 5.000000e-01
%8 = icmp eq i32 %3, 1
%9 = and i32 %0, 1
%10 = icmp eq i32 %9, 0
%11 = icmp sgt i32 %0, 0
br i1 %8, label %12, label %109
12: ; preds = %4
br i1 %10, label %17, label %13
13: ; preds = %12
br i1 %11, label %14, label %210
14: ; preds = %13
%15 = fcmp ult double %7, 1.000000e+00
%16 = zext i32 %0 to i64
br label %29
17: ; preds = %12
br i1 %11, label %18, label %210
18: ; preds = %17
%19 = lshr i32 %0, 1
%20 = icmp ugt i32 %0, 3
%21 = call i32 @llvm.smax.i32(i32 %19, i32 2)
%22 = zext i32 %0 to i64
%23 = zext i32 %21 to i64
%24 = add nsw i64 %23, -1
%25 = and i64 %24, 1
%26 = icmp ult i32 %0, 6
%27 = and i64 %24, -2
%28 = icmp eq i64 %25, 0
br label %57
29: ; preds = %14, %51
%30 = phi i64 [ 0, %14 ], [ %55, %51 ]
%31 = load double, double* %1
%32 = trunc i64 %30 to i32
%33 = sitofp i32 %32 to double
%34 = fsub double %33, %7
%35 = fmul double %34, 0x401921FB54442D18
%36 = fdiv double %35, %5
br i1 %15, label %51, label %37
37: ; preds = %29, %37
%38 = phi i64 [ %47, %37 ], [ 1, %29 ]
%39 = phi double [ %49, %37 ], [ 1.000000e+00, %29 ]
%40 = phi double [ %46, %37 ], [ %31, %29 ]
%41 = getelementptr inbounds double, double* %1, i64 %38
%42 = load double, double* %41
%43 = fmul double %42, 2.000000e+00
%44 = fmul double %36, %39
%45 = tail call double @cos(double %44)
%46 = tail call double @llvm.fmuladd.f64(double %43, double %45, double %40)
%47 = add nuw i64 %38, 1
%48 = trunc i64 %47 to i32
%49 = sitofp i32 %48 to double
%50 = fcmp ult double %7, %49
br i1 %50, label %51, label %37
51: ; preds = %37, %29
%52 = phi double [ %31, %29 ], [ %46, %37 ]
%53 = fdiv double %52, %5
%54 = getelementptr inbounds double, double* %2, i64 %30
store double %53, double* %54
%55 = add nuw nsw i64 %30, 1
%56 = icmp eq i64 %55, %16
br i1 %56, label %210, label %29
57: ; preds = %18, %103
%58 = phi i64 [ 0, %18 ], [ %107, %103 ]
%59 = load double, double* %1
%60 = trunc i64 %58 to i32
%61 = sitofp i32 %60 to double
%62 = fsub double %61, %7
%63 = fmul double %62, 0x401921FB54442D18
%64 = fdiv double %63, %5
br i1 %20, label %65, label %103
65: ; preds = %57
br i1 %26, label %90, label %66
66: ; preds = %65, %66
%67 = phi i64 [ %87, %66 ], [ 1, %65 ]
%68 = phi double [ %86, %66 ], [ %59, %65 ]
%69 = phi i64 [ %88, %66 ], [ 0, %65 ]
%70 = getelementptr inbounds double, double* %1, i64 %67
%71 = load double, double* %70
%72 = fmul double %71, 2.000000e+00
%73 = trunc i64 %67 to i32
%74 = sitofp i32 %73 to double
%75 = fmul double %64, %74
%76 = tail call double @cos(double %75)
%77 = tail call double @llvm.fmuladd.f64(double %72, double %76, double %68)
%78 = add nuw nsw i64 %67, 1
%79 = getelementptr inbounds double, double* %1, i64 %78
%80 = load double, double* %79
%81 = fmul double %80, 2.000000e+00
%82 = trunc i64 %78 to i32
%83 = sitofp i32 %82 to double
%84 = fmul double %64, %83
%85 = tail call double @cos(double %84)
%86 = tail call double @llvm.fmuladd.f64(double %81, double %85, double %77)
%87 = add nuw nsw i64 %67, 2
%88 = add i64 %69, 2
%89 = icmp eq i64 %88, %27
br i1 %89, label %90, label %66
90: ; preds = %66, %65
%91 = phi double [ undef, %65 ], [ %86, %66 ]
%92 = phi i64 [ 1, %65 ], [ %87, %66 ]
%93 = phi double [ %59, %65 ], [ %86, %66 ]
br i1 %28, label %103, label %94
94: ; preds = %90
%95 = getelementptr inbounds double, double* %1, i64 %92
%96 = load double, double* %95
%97 = fmul double %96, 2.000000e+00
%98 = trunc i64 %92 to i32
%99 = sitofp i32 %98 to double
%100 = fmul double %64, %99
%101 = tail call double @cos(double %100)
%102 = tail call double @llvm.fmuladd.f64(double %97, double %101, double %93)
br label %103
103: ; preds = %94, %90, %57
%104 = phi double [ %59, %57 ], [ %91, %90 ], [ %102, %94 ]
%105 = fdiv double %104, %5
%106 = getelementptr inbounds double, double* %2, i64 %58
store double %105, double* %106
%107 = add nuw nsw i64 %58, 1
%108 = icmp eq i64 %107, %22
br i1 %108, label %210, label %57
109: ; preds = %4
br i1 %10, label %114, label %110
110: ; preds = %109
br i1 %11, label %111, label %210
111: ; preds = %110
%112 = fcmp ult double %7, 1.000000e+00
%113 = zext i32 %0 to i64
br label %128
114: ; preds = %109
br i1 %11, label %115, label %210
115: ; preds = %114
%116 = lshr i32 %0, 1
%117 = zext i32 %116 to i64
%118 = getelementptr inbounds double, double* %1, i64 %117
%119 = icmp ugt i32 %0, 3
%120 = call i32 @llvm.smax.i32(i32 %116, i32 2)
%121 = zext i32 %0 to i64
%122 = zext i32 %120 to i64
%123 = add nsw i64 %122, -1
%124 = and i64 %123, 1
%125 = icmp ult i32 %0, 6
%126 = and i64 %123, -2
%127 = icmp eq i64 %124, 0
br label %155
128: ; preds = %111, %149
%129 = phi i64 [ 0, %111 ], [ %153, %149 ]
%130 = trunc i64 %129 to i32
%131 = sitofp i32 %130 to double
%132 = fsub double %131, %7
%133 = fmul double %132, 0x401921FB54442D18
%134 = fdiv double %133, %5
br i1 %112, label %149, label %135
135: ; preds = %128, %135
%136 = phi i64 [ %145, %135 ], [ 1, %128 ]
%137 = phi double [ %147, %135 ], [ 1.000000e+00, %128 ]
%138 = phi double [ %144, %135 ], [ 0.000000e+00, %128 ]
%139 = getelementptr inbounds double, double* %1, i64 %136
%140 = load double, double* %139
%141 = fmul double %140, 2.000000e+00
%142 = fmul double %134, %137
%143 = tail call double @sin(double %142)
%144 = tail call double @llvm.fmuladd.f64(double %141, double %143, double %138)
%145 = add nuw i64 %136, 1
%146 = trunc i64 %145 to i32
%147 = sitofp i32 %146 to double
%148 = fcmp ult double %7, %147
br i1 %148, label %149, label %135
149: ; preds = %135, %128
%150 = phi double [ 0.000000e+00, %128 ], [ %144, %135 ]
%151 = fdiv double %150, %5
%152 = getelementptr inbounds double, double* %2, i64 %129
store double %151, double* %152
%153 = add nuw nsw i64 %129, 1
%154 = icmp eq i64 %153, %113
br i1 %154, label %210, label %128
155: ; preds = %115, %204
%156 = phi i64 [ 0, %115 ], [ %208, %204 ]
%157 = load double, double* %118
%158 = trunc i64 %156 to i32
%159 = sitofp i32 %158 to double
%160 = fsub double %159, %7
%161 = fmul double %160, 0x400921FB54442D18
%162 = tail call double @sin(double %161)
%163 = fmul double %157, %162
%164 = fmul double %160, 0x401921FB54442D18
%165 = fdiv double %164, %5
br i1 %119, label %166, label %204
166: ; preds = %155
br i1 %125, label %191, label %167
167: ; preds = %166, %167
%168 = phi i64 [ %188, %167 ], [ 1, %166 ]
%169 = phi double [ %187, %167 ], [ %163, %166 ]
%170 = phi i64 [ %189, %167 ], [ 0, %166 ]
%171 = getelementptr inbounds double, double* %1, i64 %168
%172 = load double, double* %171
%173 = fmul double %172, 2.000000e+00
%174 = trunc i64 %168 to i32
%175 = sitofp i32 %174 to double
%176 = fmul double %165, %175
%177 = tail call double @sin(double %176)
%178 = tail call double @llvm.fmuladd.f64(double %173, double %177, double %169)
%179 = add nuw nsw i64 %168, 1
%180 = getelementptr inbounds double, double* %1, i64 %179
%181 = load double, double* %180
%182 = fmul double %181, 2.000000e+00
%183 = trunc i64 %179 to i32
%184 = sitofp i32 %183 to double
%185 = fmul double %165, %184
%186 = tail call double @sin(double %185)
%187 = tail call double @llvm.fmuladd.f64(double %182, double %186, double %178)
%188 = add nuw nsw i64 %168, 2
%189 = add i64 %170, 2
%190 = icmp eq i64 %189, %126
br i1 %190, label %191, label %167
191: ; preds = %167, %166
%192 = phi double [ undef, %166 ], [ %187, %167 ]
%193 = phi i64 [ 1, %166 ], [ %188, %167 ]
%194 = phi double [ %163, %166 ], [ %187, %167 ]
br i1 %127, label %204, label %195
195: ; preds = %191
%196 = getelementptr inbounds double, double* %1, i64 %193
%197 = load double, double* %196
%198 = fmul double %197, 2.000000e+00
%199 = trunc i64 %193 to i32
%200 = sitofp i32 %199 to double
%201 = fmul double %165, %200
%202 = tail call double @sin(double %201)
%203 = tail call double @llvm.fmuladd.f64(double %198, double %202, double %194)
br label %204
204: ; preds = %195, %191, %155
%205 = phi double [ %163, %155 ], [ %192, %191 ], [ %203, %195 ]
%206 = fdiv double %205, %5
%207 = getelementptr inbounds double, double* %2, i64 %156
store double %206, double* %207
%208 = add nuw nsw i64 %156, 1
%209 = icmp eq i64 %208, %121
br i1 %209, label %210, label %155
210: ; preds = %149, %204, %51, %103, %110, %114, %13, %17
ret void
}