#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 abs(int);
double fabs(double);
int /*<<< orphan*/ free(float *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ resample_close(void *);
int resample_get_filter_width(void *);
void *resample_open(int, double, double);
int resample_process(void *, double, float *, int, int, int *, float *, int);
double sin(int);
double sqrt(double);
void runtest(int srclen, double freq, double factor, int srcblocksize,
             int dstblocksize) {
  int expectedlen = (int)(srclen * factor);
  int dstlen = expectedlen + 1000;
  float *src = (float *)malloc((srclen + 100) * sizeof(float));
  float *dst = (float *)malloc((dstlen + 100) * sizeof(float));
  void *handle;
  double sum, sumsq, err, rmserr;
  int i, out, o, srcused, errcount, rangecount;
  int statlen, srcpos, lendiff;
  int fwidth;
  printf("-- srclen: %d sin freq: %.1f factor: %.3f srcblk: %d dstblk: %d\n",
         srclen, freq, factor, srcblocksize, dstblocksize);
  for (i = 0; i < srclen; i++)
    src[i] = sin(i / freq);
  for (i = srclen; i < srclen + 100; i++)
    src[i] = -99.0;
  for (i = 0; i < dstlen + 100; i++)
    dst[i] = -99.0;
  handle = resample_open(1, factor, factor);
  fwidth = resample_get_filter_width(handle);
  out = 0;
  srcpos = 0;
  for (;;) {
    int srcBlock =
        (srclen - srcpos) < (srcblocksize) ? (srclen - srcpos) : (srcblocksize);
    int lastFlag = (srcBlock == srclen - srcpos);
    o = resample_process(
        handle, factor, &src[srcpos], srcBlock, lastFlag, &srcused, &dst[out],
        (dstlen - out) < (dstblocksize) ? (dstlen - out) : (dstblocksize));
    srcpos += srcused;
    if (o >= 0)
      out += o;
    if (o < 0 || (o == 0 && srcpos == srclen))
      break;
  }
  resample_close(handle);
  if (o < 0) {
    printf("Error: resample_process returned an error: %d\n", o);
  }
  if (out <= 0) {
    printf("Error: resample_process returned %d samples\n", out);
    free(src);
    free(dst);
    return;
  }
  lendiff = abs(out - expectedlen);
  if (lendiff > (int)(2 * factor + 1.0)) {
    printf("   Expected ~%d, got %d samples out\n", expectedlen, out);
  }
  sum = 0.0;
  sumsq = 0.0;
  errcount = 0.0;
  statlen = out - fwidth;
  for (i = 0; i < statlen; i++) {
    double diff = sin((i / freq) / factor) - dst[i];
    if (fabs(diff) > 0.05) {
      if (errcount == 0)
        printf("   First error at i=%d: expected %.3f, got %.3f\n", i,
               sin((i / freq) / factor), dst[i]);
      errcount++;
    }
    sum += fabs(diff);
    sumsq += diff * diff;
  }
  rangecount = 0;
  for (i = 0; i < statlen; i++) {
    if (dst[i] < -1.01 || dst[i] > 1.01) {
      if (rangecount == 0)
        printf("   Error at i=%d: value is %.3f\n", i, dst[i]);
      rangecount++;
    }
  }
  if (rangecount > 1)
    printf("   At least %d samples were out of range\n", rangecount);
  if (errcount > 0) {
    i = out - 1;
    printf("   i=%d:  expected %.3f, got %.3f\n", i, sin((i / freq) / factor),
           dst[i]);
    printf("   At least %d samples had significant error.\n", errcount);
  }
  err = sum / statlen;
  rmserr = sqrt(sumsq / statlen);
  printf("   Out: %d samples  Avg err: %f RMS err: %f\n", out, err, rmserr);
  free(src);
  free(dst);
}


x86 assembly (clang, -O0):
<runtest>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x3e8,%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0x64,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0x64,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe12(%rip),%rdi
mov    $0x2,%al
call   1090 <printf@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    126e <runtest+0xce>
cvtsi2sdl -0x64(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   10a0 <sin@plt>
cvtsd2ss %xmm0,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1230 <runtest+0x90>
mov    -0x4(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x64,%ecx
cmp    %ecx,%eax
jge    12a8 <runtest+0x108>
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  0xd9b(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1274 <runtest+0xd4>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0x28(%rbp),%ecx
add    $0x64,%ecx
cmp    %ecx,%eax
jge    12e3 <runtest+0x143>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  0xd60(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12af <runtest+0x10f>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    $0x1,%edi
call   1030 <resample_open@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1080 <resample_get_filter_width@plt>
mov    %eax,-0x88(%rbp)
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x80(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x80(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1338 <runtest+0x198>
mov    -0x4(%rbp),%eax
sub    -0x80(%rbp),%eax
mov    %eax,-0x9c(%rbp)
jmp    1341 <runtest+0x1a1>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x80(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x90(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0xc8(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x80(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0xb8(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0x90(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x68(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x28(%rbp),%eax
sub    -0x68(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    13e5 <runtest+0x245>
mov    -0x28(%rbp),%eax
sub    -0x68(%rbp),%eax
mov    %eax,-0xcc(%rbp)
jmp    13ee <runtest+0x24e>
mov    -0x20(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xa8(%rbp),%r9
mov    -0xac(%rbp),%ecx
mov    -0xb0(%rbp),%edx
mov    -0xb8(%rbp),%rsi
movsd  -0xc0(%rbp),%xmm0
ff
mov    -0xc8(%rbp),%rdi
mov    -0xcc(%rbp),%eax
lea    -0x70(%rbp),%r8
mov    %eax,(%rsp)
call   1070 <resample_process@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x70(%rbp),%eax
add    -0x80(%rbp),%eax
mov    %eax,-0x80(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jl     1448 <runtest+0x2a8>
mov    -0x6c(%rbp),%eax
add    -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jl     1468 <runtest+0x2c8>
cmpl   $0x0,-0x6c(%rbp)
jne    146d <runtest+0x2cd>
mov    -0x80(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    146d <runtest+0x2cd>
jmp    1472 <runtest+0x2d2>
jmp    1318 <runtest+0x178>
mov    -0x40(%rbp),%rdi
call   1050 <resample_close@plt>
cmpl   $0x0,-0x6c(%rbp)
jge    1496 <runtest+0x2f6>
mov    -0x6c(%rbp),%esi
lea    0xbe6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x68(%rbp)
jg     14c8 <runtest+0x328>
mov    -0x68(%rbp),%esi
lea    0xbfa(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
jmp    17cf <runtest+0x62f>
mov    -0x68(%rbp),%edi
sub    -0x24(%rbp),%edi
call   1060 <abs@plt>
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
movsd  -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xb10(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
cmp    %ecx,%eax
jle    1514 <runtest+0x374>
mov    -0x24(%rbp),%esi
mov    -0x68(%rbp),%edx
lea    0xbc4(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x68(%rbp),%eax
sub    -0x88(%rbp),%eax
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    164a <runtest+0x4aa>
cvtsi2sdl -0x64(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   10a0 <sin@plt>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movaps 0xa92(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xa7e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15fd <runtest+0x45d>
cmpl   $0x0,-0x74(%rbp)
jne    15f4 <runtest+0x454>
mov    -0x64(%rbp),%eax
mov    %eax,-0xd0(%rbp)
cvtsi2sdl -0x64(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   10a0 <sin@plt>
mov    -0xd0(%rbp),%esi
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xb09(%rip),%rdi
mov    $0x2,%al
call   1090 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movaps 0xa14(%rip),%xmm1
pand   %xmm1,%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    153e <runtest+0x39e>
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    16f2 <runtest+0x552>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x98b(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     16aa <runtest+0x50a>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x970(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    16df <runtest+0x53f>
cmpl   $0x0,-0x78(%rbp)
jne    16d6 <runtest+0x536>
mov    -0x64(%rbp),%esi
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa58(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    16e4 <runtest+0x544>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1658 <runtest+0x4b8>
cmpl   $0x1,-0x78(%rbp)
jle    170d <runtest+0x56d>
mov    -0x78(%rbp),%esi
lea    0xa42(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x74(%rbp)
jle    1777 <runtest+0x5d7>
mov    -0x68(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0xd4(%rbp)
cvtsi2sdl -0x64(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   10a0 <sin@plt>
mov    -0xd4(%rbp),%esi
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xa13(%rip),%rdi
mov    $0x2,%al
call   1090 <printf@plt>
mov    -0x74(%rbp),%esi
lea    0xa25(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x7c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
cvtsi2sdl -0x7c(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   10c0 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x68(%rbp),%esi
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
lea    0xa0e(%rip),%rdi
mov    $0x2,%al
call   1090 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runtest>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %edx,%r14d
mov    %esi,%ebx
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    %edi,%r15d
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%r13d
lea    0x190(,%r15,4),%edi
call   10a0 <malloc@plt>
mov    %rax,%r12
lea    0x1130(,%r13,4),%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
lea    0xe5f(%rip),%rdi
mov    %r15d,%esi
movsd  0x18(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
mov    %ebx,0x60(%rsp)
mov    %ebx,%edx
mov    %r14d,0x20(%rsp)
mov    %r14d,%ecx
mov    $0x2,%al
call   1080 <printf@plt>
test   %r15d,%r15d
mov    %r15,0x10(%rsp)
jle    12b8 <runtest+0x128>
mov    %r15d,%r14d
cmp    $0x1,%r15d
jne    1231 <runtest+0xa1>
xor    %ebx,%ebx
test   $0x1,%r14b
jne    1298 <runtest+0x108>
jmp    12b8 <runtest+0x128>
mov    %r14d,%r15d
and    $0xfffffffe,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1090 <sin@plt>
cvtsd2ss %xmm0,%xmm0
lea    0x1(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movss  %xmm0,(%r12,%rbx,4)
divsd  0x18(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1090 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%r12,%rbx,4)
add    $0x2,%rbx
cmp    %r15,%rbx
jne    1240 <runtest+0xb0>
mov    0x10(%rsp),%r15
test   $0x1,%r14b
je     12b8 <runtest+0x128>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1090 <sin@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r12,%rbx,4)
movslq %r15d,%rax
movaps 0xd3e(%rip),%xmm0
movups %xmm0,(%r12,%rax,4)
movups %xmm0,0x10(%r12,%rax,4)
movups %xmm0,0x20(%r12,%rax,4)
movups %xmm0,0x30(%r12,%rax,4)
movups %xmm0,0x40(%r12,%rax,4)
movups %xmm0,0x50(%r12,%rax,4)
movups %xmm0,0x60(%r12,%rax,4)
movups %xmm0,0x70(%r12,%rax,4)
movups %xmm0,0x80(%r12,%rax,4)
movups %xmm0,0x90(%r12,%rax,4)
movups %xmm0,0xa0(%r12,%rax,4)
movups %xmm0,0xb0(%r12,%rax,4)
movups %xmm0,0xc0(%r12,%rax,4)
movups %xmm0,0xd0(%r12,%rax,4)
movups %xmm0,0xe0(%r12,%rax,4)
movups %xmm0,0xf0(%r12,%rax,4)
movups %xmm0,0x100(%r12,%rax,4)
movups %xmm0,0x110(%r12,%rax,4)
movups %xmm0,0x120(%r12,%rax,4)
movups %xmm0,0x130(%r12,%rax,4)
movups %xmm0,0x140(%r12,%rax,4)
movups %xmm0,0x150(%r12,%rax,4)
movups %xmm0,0x160(%r12,%rax,4)
movups %xmm0,0x170(%r12,%rax,4)
movups %xmm0,0x180(%r12,%rax,4)
cmp    $0xfffffbb4,%r13d
jle    14b1 <runtest+0x321>
lea    0x44c(%r13),%ecx
cmp    $0x2,%ecx
mov    $0x1,%eax
cmovge %ecx,%eax
cmp    $0x8,%eax
jae    13b5 <runtest+0x225>
xor    %ecx,%ecx
jmp    14a0 <runtest+0x310>
mov    %eax,%ecx
and    $0x7ffffff8,%ecx
lea    -0x8(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x7,%edx
cmp    $0x38,%rdi
jae    13de <runtest+0x24e>
xor    %edi,%edi
jmp    1462 <runtest+0x2d2>
and    $0xfffffffffffffff8,%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups %xmm0,0x0(%rbp,%rdi,4)
movups %xmm0,0x10(%rbp,%rdi,4)
movups %xmm0,0x20(%rbp,%rdi,4)
movups %xmm0,0x30(%rbp,%rdi,4)
movups %xmm0,0x40(%rbp,%rdi,4)
movups %xmm0,0x50(%rbp,%rdi,4)
movups %xmm0,0x60(%rbp,%rdi,4)
movups %xmm0,0x70(%rbp,%rdi,4)
movups %xmm0,0x80(%rbp,%rdi,4)
movups %xmm0,0x90(%rbp,%rdi,4)
movups %xmm0,0xa0(%rbp,%rdi,4)
movups %xmm0,0xb0(%rbp,%rdi,4)
movups %xmm0,0xc0(%rbp,%rdi,4)
movups %xmm0,0xd0(%rbp,%rdi,4)
movups %xmm0,0xe0(%rbp,%rdi,4)
movups %xmm0,0xf0(%rbp,%rdi,4)
add    $0x40,%rdi
add    $0xfffffffffffffff8,%rsi
jne    13f0 <runtest+0x260>
test   %rdx,%rdx
je     1492 <runtest+0x302>
lea    0x10(,%rdi,4),%rsi
add    %rbp,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
movups %xmm0,-0x10(%rsi,%rdi,1)
movups %xmm0,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    1480 <runtest+0x2f0>
cmp    %rax,%rcx
je     14b1 <runtest+0x321>
nopw   0x0(%rax,%rax,1)
movl   $0xc2c60000,0x0(%rbp,%rcx,4)
c2
add    $0x1,%rcx
cmp    %rcx,%rax
jne    14a0 <runtest+0x310>
mov    %rbp,0x30(%rsp)
mov    %r12,0x40(%rsp)
mov    %r13,0x38(%rsp)
lea    0x3e8(%r13),%eax
mov    %eax,0x50(%rsp)
mov    $0x1,%edi
movsd  0x28(%rsp),%xmm0
movapd %xmm0,%xmm1
call   1030 <resample_open@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <resample_get_filter_width@plt>
mov    %eax,0x48(%rsp)
xor    %ebp,%ebp
xor    %r15d,%r15d
mov    0x10(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r15d,%r12d
mov    %ebx,%edx
sub    %ebp,%edx
xor    %ecx,%ecx
mov    0x60(%rsp),%eax
cmp    %eax,%edx
cmovge %eax,%edx
setle  %cl
movslq %ebp,%rbp
mov    0x40(%rsp),%rax
lea    (%rax,%rbp,4),%rsi
mov    %r15d,%eax
mov    0x30(%rsp),%rdi
lea    (%rdi,%rax,4),%r9
mov    0x50(%rsp),%eax
sub    %r15d,%eax
mov    0x20(%rsp),%edi
cmp    %edi,%eax
cmovge %edi,%eax
mov    %eax,(%rsp)
mov    %r14,%rdi
movsd  0x28(%rsp),%xmm0
lea    0x4c(%rsp),%r8
call   1060 <resample_process@plt>
mov    %eax,%r13d
add    0x4c(%rsp),%ebp
test   %eax,%eax
mov    $0x0,%r15d
cmovns %eax,%r15d
add    %r12d,%r15d
mov    %ebp,%eax
xor    %ebx,%eax
or     %r13d,%eax
sete   %al
test   %r13d,%r13d
js     157c <runtest+0x3ec>
test   %al,%al
je     1500 <runtest+0x370>
mov    %r14,%rdi
call   1050 <resample_close@plt>
test   %r13d,%r13d
js     1772 <runtest+0x5e2>
test   %r15d,%r15d
jle    178c <runtest+0x5fc>
mov    %r15d,%eax
mov    0x38(%rsp),%rsi
sub    %esi,%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
movsd  0x28(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0xa67(%rip),%xmm0
cvttsd2si %xmm0,%eax
cmp    %eax,%ecx
jle    15d2 <runtest+0x442>
lea    0xb1d(%rip),%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15d,%ebp
sub    0x48(%rsp),%ebp
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
test   %ebp,%ebp
jle    1821 <runtest+0x691>
mov    %ebp,0x38(%rsp)
mov    %ebp,%r13d
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xb07(%rip),%r14
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
xor    %r12d,%r12d
movsd  0x18(%rsp),%xmm1
jmp    165b <runtest+0x4cb>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12d
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm2,%xmm2
movsd  0x20(%rsp),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x20(%rsp)
add    $0x1,%rbp
cmp    %rbp,%r13
je     16ea <runtest+0x55a>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
divsd  %xmm1,%xmm0
divsd  0x28(%rsp),%xmm0
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
call   1090 <sin@plt>
movapd %xmm0,%xmm2
mov    0x30(%rsp),%rax
movss  (%rax,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm3
andpd  0x977(%rip),%xmm3
ucomisd 0x987(%rip),%xmm3
jbe    1624 <runtest+0x494>
test   %r12d,%r12d
jne    1620 <runtest+0x490>
mov    %ebx,%edi
movapd %xmm2,0x60(%rsp)
movapd %xmm3,0x50(%rsp)
call   1090 <sin@plt>
mov    0x30(%rsp),%rax
movss  (%rax,%rbp,4),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x2,%al
call   1080 <printf@plt>
movapd 0x50(%rsp),%xmm3
movapd 0x60(%rsp),%xmm2
jmp    1620 <runtest+0x490>
mov    0x38(%rsp),%ebp
test   %ebp,%ebp
jle    17c3 <runtest+0x633>
xor    %ebp,%ebp
movsd  0x930(%rip),%xmm2
lea    0xa34(%rip),%rbx
movsd  0x929(%rip),%xmm3
xor    %r14d,%r14d
jmp    1732 <runtest+0x5a2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %r14d,%r14d
je     174e <runtest+0x5be>
add    $0x1,%r14d
add    $0x1,%rbp
cmp    %rbp,%r13
je     17a2 <runtest+0x612>
mov    0x30(%rsp),%rax
movss  (%rax,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
ucomisd %xmm0,%xmm2
ja     1720 <runtest+0x590>
ucomisd %xmm3,%xmm0
jbe    1729 <runtest+0x599>
jmp    1720 <runtest+0x590>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1080 <printf@plt>
movsd  0x8d6(%rip),%xmm3
movsd  0x8c6(%rip),%xmm2
movsd  0x18(%rsp),%xmm1
jmp    1725 <runtest+0x595>
lea    0x910(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r15d,%r15d
jg     1596 <runtest+0x406>
lea    0x925(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    186d <runtest+0x6dd>
cmp    $0x2,%r14d
mov    0x38(%rsp),%ebp
jl     17c3 <runtest+0x633>
lea    0x9a9(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
movsd  0x18(%rsp),%xmm1
test   %r12d,%r12d
jle    1815 <runtest+0x685>
lea    -0x1(%r15),%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  %xmm1,%xmm0
divsd  0x28(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1090 <sin@plt>
mov    0x30(%rsp),%rax
movss  (%rax,%rbx,4),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0x98b(%rip),%rdi
mov    %ebx,%esi
mov    $0x2,%al
call   1080 <printf@plt>
lea    0x99e(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
divsd  %xmm0,%xmm2
ucomisd 0x802(%rip),%xmm2
movapd %xmm2,%xmm0
jb     184d <runtest+0x6bd>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1856 <runtest+0x6c6>
call   10b0 <sqrt@plt>
movapd %xmm0,%xmm1
lea    0x97b(%rip),%rdi
mov    %r15d,%esi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1080 <printf@plt>
mov    0x40(%rsp),%rdi
call   1040 <free@plt>
mov    0x30(%rsp),%rdi
call   1040 <free@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [65 x i8] c"-- srclen: %d sin freq: %.1f factor: %.3f srcblk: %d dstblk: %d\0A\00"
@.str.1 = [47 x i8] c"Error: resample_process returned an error: %d\0A\00"
@.str.2 = [45 x i8] c"Error: resample_process returned %d samples\0A\00"
@.str.3 = [37 x i8] c" Expected ~%d, got %d samples out\0A\00"
@.str.4 = [49 x i8] c" First error at i=%d: expected %.3f, got %.3f\0A\00"
@.str.5 = [33 x i8] c" Error at i=%d: value is %.3f\0A\00"
@.str.6 = [42 x i8] c" At least %d samples were out of range\0A\00"
@.str.7 = [35 x i8] c" i=%d: expected %.3f, got %.3f\0A\00"
@.str.8 = [47 x i8] c" At least %d samples had significant error.\0A\00"
@.str.9 = [45 x i8] c" Out: %d samples Avg err: %f RMS err: %f\0A\00"
define void @runtest(i32 %0, double %1, double %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float*
%14 = alloca float*
%15 = alloca i8*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca double
store i32 %0, i32* %6
store double %1, double* %7
store double %2, double* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%33 = load i32, i32* %6
%34 = sitofp i32 %33 to double
%35 = load double, double* %8
%36 = fmul double %34, %35
%37 = fptosi double %36 to i32
store i32 %37, i32* %11
%38 = load i32, i32* %11
%39 = add nsw i32 %38, 1000
store i32 %39, i32* %12
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 100
%42 = sext i32 %41 to i64
%43 = mul i64 %42, 4
%44 = trunc i64 %43 to i32
%45 = call i64 @malloc(i32 %44)
%46 = inttoptr i64 %45 to float*
store float* %46, float** %13
%47 = load i32, i32* %12
%48 = add nsw i32 %47, 100
%49 = sext i32 %48 to i64
%50 = mul i64 %49, 4
%51 = trunc i64 %50 to i32
%52 = call i64 @malloc(i32 %51)
%53 = inttoptr i64 %52 to float*
store float* %53, float** %14
%54 = load i32, i32* %6
%55 = load double, double* %7
%56 = load double, double* %8
%57 = load i32, i32* %9
%58 = load i32, i32* %10
%59 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i32 %54, double %55, double %56, i32 %57, i32 %58)
store i32 0, i32* %20
br label %60
60: ; preds = %76, %5
%61 = load i32, i32* %20
%62 = load i32, i32* %6
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %79
64: ; preds = %60
%65 = load i32, i32* %20
%66 = sitofp i32 %65 to double
%67 = load double, double* %7
%68 = fdiv double %66, %67
%69 = fptosi double %68 to i32
%70 = call double @sin(i32 %69)
%71 = fptrunc double %70 to float
%72 = load float*, float** %13
%73 = load i32, i32* %20
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds float, float* %72, i64 %74
store float %71, float* %75
br label %76
76: ; preds = %64
%77 = load i32, i32* %20
%78 = add nsw i32 %77, 1
store i32 %78, i32* %20
br label %60
79: ; preds = %60
%80 = load i32, i32* %6
store i32 %80, i32* %20
br label %81
81: ; preds = %91, %79
%82 = load i32, i32* %20
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 100
%85 = icmp slt i32 %82, %84
br i1 %85, label %86, label %94
86: ; preds = %81
%87 = load float*, float** %13
%88 = load i32, i32* %20
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds float, float* %87, i64 %89
store float -9.900000e+01, float* %90
br label %91
91: ; preds = %86
%92 = load i32, i32* %20
%93 = add nsw i32 %92, 1
store i32 %93, i32* %20
br label %81
94: ; preds = %81
store i32 0, i32* %20
br label %95
95: ; preds = %105, %94
%96 = load i32, i32* %20
%97 = load i32, i32* %12
%98 = add nsw i32 %97, 100
%99 = icmp slt i32 %96, %98
br i1 %99, label %100, label %108
100: ; preds = %95
%101 = load float*, float** %14
%102 = load i32, i32* %20
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds float, float* %101, i64 %103
store float -9.900000e+01, float* %104
br label %105
105: ; preds = %100
%106 = load i32, i32* %20
%107 = add nsw i32 %106, 1
store i32 %107, i32* %20
br label %95
108: ; preds = %95
%109 = load double, double* %8
%110 = load double, double* %8
%111 = call i8* @resample_open(i32 1, double %109, double %110)
store i8* %111, i8** %15
%112 = load i8*, i8** %15
%113 = call i32 @resample_get_filter_width(i8* %112)
store i32 %113, i32* %29
store i32 0, i32* %21
store i32 0, i32* %27
br label %114
114: ; preds = %180, %108
%115 = load i32, i32* %6
%116 = load i32, i32* %27
%117 = sub nsw i32 %115, %116
%118 = load i32, i32* %9
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %124
120: ; preds = %114
%121 = load i32, i32* %6
%122 = load i32, i32* %27
%123 = sub nsw i32 %121, %122
br label %126
124: ; preds = %114
%125 = load i32, i32* %9
br label %126
126: ; preds = %124, %120
%127 = phi i32 [ %123, %120 ], [ %125, %124 ]
store i32 %127, i32* %30
%128 = load i32, i32* %30
%129 = load i32, i32* %6
%130 = load i32, i32* %27
%131 = sub nsw i32 %129, %130
%132 = icmp eq i32 %128, %131
%133 = zext i1 %132 to i32
store i32 %133, i32* %31
%134 = load i8*, i8** %15
%135 = load double, double* %8
%136 = load float*, float** %13
%137 = load i32, i32* %27
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds float, float* %136, i64 %138
%140 = load i32, i32* %30
%141 = load i32, i32* %31
%142 = load float*, float** %14
%143 = load i32, i32* %21
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds float, float* %142, i64 %144
%146 = load i32, i32* %12
%147 = load i32, i32* %21
%148 = sub nsw i32 %146, %147
%149 = load i32, i32* %10
%150 = icmp slt i32 %148, %149
br i1 %150, label %151, label %155
151: ; preds = %126
%152 = load i32, i32* %12
%153 = load i32, i32* %21
%154 = sub nsw i32 %152, %153
br label %157
155: ; preds = %126
%156 = load i32, i32* %10
br label %157
157: ; preds = %155, %151
%158 = phi i32 [ %154, %151 ], [ %156, %155 ]
%159 = call i32 @resample_process(i8* %134, double %135, float* %139, i32 %140, i32 %141, i32* %23, float* %145, i32 %158)
store i32 %159, i32* %22
%160 = load i32, i32* %23
%161 = load i32, i32* %27
%162 = add nsw i32 %161, %160
store i32 %162, i32* %27
%163 = load i32, i32* %22
%164 = icmp sge i32 %163, 0
br i1 %164, label %165, label %169
165: ; preds = %157
%166 = load i32, i32* %22
%167 = load i32, i32* %21
%168 = add nsw i32 %167, %166
store i32 %168, i32* %21
br label %169
169: ; preds = %165, %157
%170 = load i32, i32* %22
%171 = icmp slt i32 %170, 0
br i1 %171, label %179, label %172
172: ; preds = %169
%173 = load i32, i32* %22
%174 = icmp eq i32 %173, 0
br i1 %174, label %175, label %180
175: ; preds = %172
%176 = load i32, i32* %27
%177 = load i32, i32* %6
%178 = icmp eq i32 %176, %177
br i1 %178, label %179, label %180
179: ; preds = %175, %169
br label %181
180: ; preds = %175, %172
br label %114
181: ; preds = %179
%182 = load i8*, i8** %15
%183 = call i32 @resample_close(i8* %182)
%184 = load i32, i32* %22
%185 = icmp slt i32 %184, 0
br i1 %185, label %186, label %189
186: ; preds = %181
%187 = load i32, i32* %22
%188 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %187)
br label %189
189: ; preds = %186, %181
%190 = load i32, i32* %21
%191 = icmp sle i32 %190, 0
br i1 %191, label %192, label %199
192: ; preds = %189
%193 = load i32, i32* %21
%194 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %193)
%195 = load float*, float** %13
%196 = call i32 @free(float* %195)
%197 = load float*, float** %14
%198 = call i32 @free(float* %197)
br label %363
199: ; preds = %189
%200 = load i32, i32* %21
%201 = load i32, i32* %11
%202 = sub nsw i32 %200, %201
%203 = call i32 @abs(i32 %202)
store i32 %203, i32* %28
%204 = load i32, i32* %28
%205 = load double, double* %8
%206 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %205, double 1.000000e+00)
%207 = fptosi double %206 to i32
%208 = icmp sgt i32 %204, %207
br i1 %208, label %209, label %213
209: ; preds = %199
%210 = load i32, i32* %11
%211 = load i32, i32* %21
%212 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %210, i32 %211)
br label %213
213: ; preds = %209, %199
store double 0.000000e+00, double* %16
store double 0.000000e+00, double* %17
store i32 0, i32* %24
%214 = load i32, i32* %21
%215 = load i32, i32* %29
%216 = sub nsw i32 %214, %215
store i32 %216, i32* %26
store i32 0, i32* %20
br label %217
217: ; preds = %272, %213
%218 = load i32, i32* %20
%219 = load i32, i32* %26
%220 = icmp slt i32 %218, %219
br i1 %220, label %221, label %275
221: ; preds = %217
%222 = load i32, i32* %20
%223 = sitofp i32 %222 to double
%224 = load double, double* %7
%225 = fdiv double %223, %224
%226 = load double, double* %8
%227 = fdiv double %225, %226
%228 = fptosi double %227 to i32
%229 = call double @sin(i32 %228)
%230 = load float*, float** %14
%231 = load i32, i32* %20
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds float, float* %230, i64 %232
%234 = load float, float* %233
%235 = fpext float %234 to double
%236 = fsub double %229, %235
store double %236, double* %32
%237 = load double, double* %32
%238 = call double @llvm.fabs.f64(double %237)
%239 = fcmp ogt double %238, 5.000000e-02
br i1 %239, label %240, label %263
240: ; preds = %221
%241 = load i32, i32* %24
%242 = icmp eq i32 %241, 0
br i1 %242, label %243, label %260
243: ; preds = %240
%244 = load i32, i32* %20
%245 = load i32, i32* %20
%246 = sitofp i32 %245 to double
%247 = load double, double* %7
%248 = fdiv double %246, %247
%249 = load double, double* %8
%250 = fdiv double %248, %249
%251 = fptosi double %250 to i32
%252 = call double @sin(i32 %251)
%253 = load float*, float** %14
%254 = load i32, i32* %20
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds float, float* %253, i64 %255
%257 = load float, float* %256
%258 = fpext float %257 to double
%259 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %244, double %252, double %258)
br label %260
260: ; preds = %243, %240
%261 = load i32, i32* %24
%262 = add nsw i32 %261, 1
store i32 %262, i32* %24
br label %263
263: ; preds = %260, %221
%264 = load double, double* %32
%265 = call double @llvm.fabs.f64(double %264)
%266 = load double, double* %16
%267 = fadd double %266, %265
store double %267, double* %16
%268 = load double, double* %32
%269 = load double, double* %32
%270 = load double, double* %17
%271 = call double @llvm.fmuladd.f64(double %268, double %269, double %270)
store double %271, double* %17
br label %272
272: ; preds = %263
%273 = load i32, i32* %20
%274 = add nsw i32 %273, 1
store i32 %274, i32* %20
br label %217
275: ; preds = %217
store i32 0, i32* %25
store i32 0, i32* %20
br label %276
276: ; preds = %312, %275
%277 = load i32, i32* %20
%278 = load i32, i32* %26
%279 = icmp slt i32 %277, %278
br i1 %279, label %280, label %315
280: ; preds = %276
%281 = load float*, float** %14
%282 = load i32, i32* %20
%283 = sext i32 %282 to i64
%284 = getelementptr inbounds float, float* %281, i64 %283
%285 = load float, float* %284
%286 = fpext float %285 to double
%287 = fcmp olt double %286, -1.010000e+00
br i1 %287, label %296, label %288
288: ; preds = %280
%289 = load float*, float** %14
%290 = load i32, i32* %20
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds float, float* %289, i64 %291
%293 = load float, float* %292
%294 = fpext float %293 to double
%295 = fcmp ogt double %294, 1.010000e+00
br i1 %295, label %296, label %311
296: ; preds = %288, %280
%297 = load i32, i32* %25
%298 = icmp eq i32 %297, 0
br i1 %298, label %299, label %308
299: ; preds = %296
%300 = load i32, i32* %20
%301 = load float*, float** %14
%302 = load i32, i32* %20
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds float, float* %301, i64 %303
%305 = load float, float* %304
%306 = fpext float %305 to double
%307 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %300, double %306)
br label %308
308: ; preds = %299, %296
%309 = load i32, i32* %25
%310 = add nsw i32 %309, 1
store i32 %310, i32* %25
br label %311
311: ; preds = %308, %288
br label %312
312: ; preds = %311
%313 = load i32, i32* %20
%314 = add nsw i32 %313, 1
store i32 %314, i32* %20
br label %276
315: ; preds = %276
%316 = load i32, i32* %25
%317 = icmp sgt i32 %316, 1
br i1 %317, label %318, label %321
318: ; preds = %315
%319 = load i32, i32* %25
%320 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 %319)
br label %321
321: ; preds = %318, %315
%322 = load i32, i32* %24
%323 = icmp sgt i32 %322, 0
br i1 %323, label %324, label %345
324: ; preds = %321
%325 = load i32, i32* %21
%326 = sub nsw i32 %325, 1
store i32 %326, i32* %20
%327 = load i32, i32* %20
%328 = load i32, i32* %20
%329 = sitofp i32 %328 to double
%330 = load double, double* %7
%331 = fdiv double %329, %330
%332 = load double, double* %8
%333 = fdiv double %331, %332
%334 = fptosi double %333 to i32
%335 = call double @sin(i32 %334)
%336 = load float*, float** %14
%337 = load i32, i32* %20
%338 = sext i32 %337 to i64
%339 = getelementptr inbounds float, float* %336, i64 %338
%340 = load float, float* %339
%341 = fpext float %340 to double
%342 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %327, double %335, double %341)
%343 = load i32, i32* %24
%344 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i32 %343)
br label %345
345: ; preds = %324, %321
%346 = load double, double* %16
%347 = load i32, i32* %26
%348 = sitofp i32 %347 to double
%349 = fdiv double %346, %348
store double %349, double* %18
%350 = load double, double* %17
%351 = load i32, i32* %26
%352 = sitofp i32 %351 to double
%353 = fdiv double %350, %352
%354 = call double @sqrt(double %353)
store double %354, double* %19
%355 = load i32, i32* %21
%356 = load double, double* %18
%357 = load double, double* %19
%358 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), i32 %355, double %356, double %357)
%359 = load float*, float** %13
%360 = call i32 @free(float* %359)
%361 = load float*, float** %14
%362 = call i32 @free(float* %361)
br label %363
363: ; preds = %345, %192
ret void
}

LLVM IR (-O2):
@.str = [65 x i8] c"-- srclen: %d sin freq: %.1f factor: %.3f srcblk: %d dstblk: %d\0A\00"
@.str.1 = [47 x i8] c"Error: resample_process returned an error: %d\0A\00"
@.str.2 = [45 x i8] c"Error: resample_process returned %d samples\0A\00"
@.str.3 = [37 x i8] c" Expected ~%d, got %d samples out\0A\00"
@.str.4 = [49 x i8] c" First error at i=%d: expected %.3f, got %.3f\0A\00"
@.str.5 = [33 x i8] c" Error at i=%d: value is %.3f\0A\00"
@.str.6 = [42 x i8] c" At least %d samples were out of range\0A\00"
@.str.7 = [35 x i8] c" i=%d: expected %.3f, got %.3f\0A\00"
@.str.8 = [47 x i8] c" At least %d samples had significant error.\0A\00"
@.str.9 = [45 x i8] c" Out: %d samples Avg err: %f RMS err: %f\0A\00"
define void @runtest(i32 %0, double %1, double %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = sitofp i32 %0 to double
%8 = fmul double %7, %2
%9 = fptosi double %8 to i32
%10 = add nsw i32 %9, 1000
%11 = shl i32 %0, 2
%12 = add i32 %11, 400
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to float*
%15 = add nsw i32 %9, 1100
%16 = shl i32 %15, 2
%17 = tail call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to float*
%19 = bitcast i32* %6 to i8*
%20 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i32 %0, double %1, double %2, i32 %3, i32 %4)
%21 = icmp sgt i32 %0, 0
br i1 %21, label %22, label %39
22: ; preds = %5
%23 = zext i32 %0 to i64
%24 = and i64 %23, 1
%25 = icmp eq i32 %0, 1
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = and i64 %23, 4294967294
br label %116
28: ; preds = %116, %22
%29 = phi i64 [ 0, %22 ], [ %134, %116 ]
%30 = icmp eq i64 %24, 0
br i1 %30, label %39, label %31
31: ; preds = %28
%32 = trunc i64 %29 to i32
%33 = sitofp i32 %32 to double
%34 = fdiv double %33, %1
%35 = fptosi double %34 to i32
%36 = tail call double @sin(i32 %35)
%37 = fptrunc double %36 to float
%38 = getelementptr inbounds float, float* %14, i64 %29
store float %37, float* %38
br label %39
39: ; preds = %31, %28, %5
%40 = sext i32 %0 to i64
%41 = getelementptr inbounds float, float* %14, i64 %40
%42 = bitcast float* %41 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %42
%43 = add nsw i64 %40, 4
%44 = getelementptr inbounds float, float* %14, i64 %43
%45 = bitcast float* %44 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %45
%46 = add nsw i64 %40, 8
%47 = getelementptr inbounds float, float* %14, i64 %46
%48 = bitcast float* %47 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %48
%49 = add nsw i64 %40, 12
%50 = getelementptr inbounds float, float* %14, i64 %49
%51 = bitcast float* %50 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %51
%52 = add nsw i64 %40, 16
%53 = getelementptr inbounds float, float* %14, i64 %52
%54 = bitcast float* %53 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %54
%55 = add nsw i64 %40, 20
%56 = getelementptr inbounds float, float* %14, i64 %55
%57 = bitcast float* %56 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %57
%58 = add nsw i64 %40, 24
%59 = getelementptr inbounds float, float* %14, i64 %58
%60 = bitcast float* %59 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %60
%61 = add nsw i64 %40, 28
%62 = getelementptr inbounds float, float* %14, i64 %61
%63 = bitcast float* %62 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %63
%64 = add nsw i64 %40, 32
%65 = getelementptr inbounds float, float* %14, i64 %64
%66 = bitcast float* %65 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %66
%67 = add nsw i64 %40, 36
%68 = getelementptr inbounds float, float* %14, i64 %67
%69 = bitcast float* %68 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %69
%70 = add nsw i64 %40, 40
%71 = getelementptr inbounds float, float* %14, i64 %70
%72 = bitcast float* %71 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %72
%73 = add nsw i64 %40, 44
%74 = getelementptr inbounds float, float* %14, i64 %73
%75 = bitcast float* %74 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %75
%76 = add nsw i64 %40, 48
%77 = getelementptr inbounds float, float* %14, i64 %76
%78 = bitcast float* %77 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %78
%79 = add nsw i64 %40, 52
%80 = getelementptr inbounds float, float* %14, i64 %79
%81 = bitcast float* %80 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %81
%82 = add nsw i64 %40, 56
%83 = getelementptr inbounds float, float* %14, i64 %82
%84 = bitcast float* %83 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %84
%85 = add nsw i64 %40, 60
%86 = getelementptr inbounds float, float* %14, i64 %85
%87 = bitcast float* %86 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %87
%88 = add nsw i64 %40, 64
%89 = getelementptr inbounds float, float* %14, i64 %88
%90 = bitcast float* %89 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %90
%91 = add nsw i64 %40, 68
%92 = getelementptr inbounds float, float* %14, i64 %91
%93 = bitcast float* %92 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %93
%94 = add nsw i64 %40, 72
%95 = getelementptr inbounds float, float* %14, i64 %94
%96 = bitcast float* %95 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %96
%97 = add nsw i64 %40, 76
%98 = getelementptr inbounds float, float* %14, i64 %97
%99 = bitcast float* %98 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %99
%100 = add nsw i64 %40, 80
%101 = getelementptr inbounds float, float* %14, i64 %100
%102 = bitcast float* %101 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %102
%103 = add nsw i64 %40, 84
%104 = getelementptr inbounds float, float* %14, i64 %103
%105 = bitcast float* %104 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %105
%106 = add nsw i64 %40, 88
%107 = getelementptr inbounds float, float* %14, i64 %106
%108 = bitcast float* %107 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %108
%109 = add nsw i64 %40, 92
%110 = getelementptr inbounds float, float* %14, i64 %109
%111 = bitcast float* %110 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %111
%112 = add nsw i64 %40, 96
%113 = getelementptr inbounds float, float* %14, i64 %112
%114 = bitcast float* %113 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %114
%115 = icmp sgt i32 %9, -1100
br i1 %115, label %137, label %217
116: ; preds = %116, %26
%117 = phi i64 [ 0, %26 ], [ %134, %116 ]
%118 = phi i64 [ 0, %26 ], [ %135, %116 ]
%119 = trunc i64 %117 to i32
%120 = sitofp i32 %119 to double
%121 = fdiv double %120, %1
%122 = fptosi double %121 to i32
%123 = tail call double @sin(i32 %122)
%124 = fptrunc double %123 to float
%125 = getelementptr inbounds float, float* %14, i64 %117
store float %124, float* %125
%126 = or i64 %117, 1
%127 = trunc i64 %126 to i32
%128 = sitofp i32 %127 to double
%129 = fdiv double %128, %1
%130 = fptosi double %129 to i32
%131 = tail call double @sin(i32 %130)
%132 = fptrunc double %131 to float
%133 = getelementptr inbounds float, float* %14, i64 %126
store float %132, float* %133
%134 = add nuw nsw i64 %117, 2
%135 = add i64 %118, 2
%136 = icmp eq i64 %135, %27
br i1 %136, label %28, label %116
137: ; preds = %39
%138 = call i32 @llvm.smax.i32(i32 %15, i32 1)
%139 = zext i32 %138 to i64
%140 = icmp ult i32 %138, 8
br i1 %140, label %210, label %141
141: ; preds = %137
%142 = and i64 %139, 2147483640
%143 = add nsw i64 %142, -8
%144 = lshr exact i64 %143, 3
%145 = add nuw nsw i64 %144, 1
%146 = and i64 %145, 7
%147 = icmp ult i64 %143, 56
br i1 %147, label %195, label %148
148: ; preds = %141
%149 = and i64 %145, 4611686018427387896
br label %150
150: ; preds = %150, %148
%151 = phi i64 [ 0, %148 ], [ %192, %150 ]
%152 = phi i64 [ 0, %148 ], [ %193, %150 ]
%153 = getelementptr inbounds float, float* %18, i64 %151
%154 = bitcast float* %153 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %154
%155 = getelementptr inbounds float, float* %153, i64 4
%156 = bitcast float* %155 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %156
%157 = or i64 %151, 8
%158 = getelementptr inbounds float, float* %18, i64 %157
%159 = bitcast float* %158 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %159
%160 = getelementptr inbounds float, float* %158, i64 4
%161 = bitcast float* %160 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %161
%162 = or i64 %151, 16
%163 = getelementptr inbounds float, float* %18, i64 %162
%164 = bitcast float* %163 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %164
%165 = getelementptr inbounds float, float* %163, i64 4
%166 = bitcast float* %165 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %166
%167 = or i64 %151, 24
%168 = getelementptr inbounds float, float* %18, i64 %167
%169 = bitcast float* %168 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %169
%170 = getelementptr inbounds float, float* %168, i64 4
%171 = bitcast float* %170 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %171
%172 = or i64 %151, 32
%173 = getelementptr inbounds float, float* %18, i64 %172
%174 = bitcast float* %173 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %174
%175 = getelementptr inbounds float, float* %173, i64 4
%176 = bitcast float* %175 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %176
%177 = or i64 %151, 40
%178 = getelementptr inbounds float, float* %18, i64 %177
%179 = bitcast float* %178 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %179
%180 = getelementptr inbounds float, float* %178, i64 4
%181 = bitcast float* %180 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %181
%182 = or i64 %151, 48
%183 = getelementptr inbounds float, float* %18, i64 %182
%184 = bitcast float* %183 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %184
%185 = getelementptr inbounds float, float* %183, i64 4
%186 = bitcast float* %185 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %186
%187 = or i64 %151, 56
%188 = getelementptr inbounds float, float* %18, i64 %187
%189 = bitcast float* %188 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %189
%190 = getelementptr inbounds float, float* %188, i64 4
%191 = bitcast float* %190 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %191
%192 = add nuw i64 %151, 64
%193 = add nuw i64 %152, 8
%194 = icmp eq i64 %193, %149
br i1 %194, label %195, label %150
195: ; preds = %150, %141
%196 = phi i64 [ 0, %141 ], [ %192, %150 ]
%197 = icmp eq i64 %146, 0
br i1 %197, label %208, label %198
198: ; preds = %195, %198
%199 = phi i64 [ %205, %198 ], [ %196, %195 ]
%200 = phi i64 [ %206, %198 ], [ 0, %195 ]
%201 = getelementptr inbounds float, float* %18, i64 %199
%202 = bitcast float* %201 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %202
%203 = getelementptr inbounds float, float* %201, i64 4
%204 = bitcast float* %203 to <4 x float>*
store <4 x float> <float -9.900000e+01, float -9.900000e+01, float -9.900000e+01, float -9.900000e+01>, <4 x float>* %204
%205 = add nuw i64 %199, 8
%206 = add i64 %200, 1
%207 = icmp eq i64 %206, %146
br i1 %207, label %208, label %198
208: ; preds = %198, %195
%209 = icmp eq i64 %142, %139
br i1 %209, label %217, label %210
210: ; preds = %137, %208
%211 = phi i64 [ 0, %137 ], [ %142, %208 ]
br label %212
212: ; preds = %210, %212
%213 = phi i64 [ %215, %212 ], [ %211, %210 ]
%214 = getelementptr inbounds float, float* %18, i64 %213
store float -9.900000e+01, float* %214
%215 = add nuw nsw i64 %213, 1
%216 = icmp eq i64 %215, %139
br i1 %216, label %217, label %212
217: ; preds = %212, %208, %39
%218 = tail call i8* @resample_open(i32 1, double %2, double %2)
%219 = tail call i32 @resample_get_filter_width(i8* %218)
br label %220
220: ; preds = %220, %217
%221 = phi i32 [ 0, %217 ], [ %237, %220 ]
%222 = phi i32 [ 0, %217 ], [ %240, %220 ]
%223 = sub nsw i32 %0, %221
%224 = icmp slt i32 %223, %3
%225 = select i1 %224, i32 %223, i32 %3
%226 = icmp sle i32 %223, %3
%227 = zext i1 %226 to i32
%228 = sext i32 %221 to i64
%229 = getelementptr inbounds float, float* %14, i64 %228
%230 = zext i32 %222 to i64
%231 = getelementptr inbounds float, float* %18, i64 %230
%232 = sub i32 %10, %222
%233 = icmp slt i32 %232, %4
%234 = select i1 %233, i32 %232, i32 %4
%235 = call i32 @resample_process(i8* %218, double %2, float* %229, i32 %225, i32 %227, i32* %6, float* %231, i32 %234)
%236 = load i32, i32* %6
%237 = add nsw i32 %236, %221
%238 = icmp sgt i32 %235, 0
%239 = select i1 %238, i32 %235, i32 0
%240 = add nuw nsw i32 %239, %222
%241 = icmp slt i32 %235, 0
%242 = icmp eq i32 %235, 0
%243 = icmp eq i32 %237, %0
%244 = select i1 %242, i1 %243, i1 false
%245 = select i1 %241, i1 true, i1 %244
br i1 %245, label %246, label %220
246: ; preds = %220
%247 = call i32 @resample_close(i8* %218)
br i1 %241, label %248, label %250
248: ; preds = %246
%249 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %235)
br label %250
250: ; preds = %248, %246
%251 = icmp slt i32 %240, 1
br i1 %251, label %252, label %254
252: ; preds = %250
%253 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %240)
br label %349
254: ; preds = %250
%255 = sub nsw i32 %240, %9
%256 = call i32 @llvm.abs.i32(i32 %255, i1 true)
%257 = call double @llvm.fmuladd.f64(double %2, double 2.000000e+00, double 1.000000e+00)
%258 = fptosi double %257 to i32
%259 = icmp sgt i32 %256, %258
br i1 %259, label %260, label %262
260: ; preds = %254
%261 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %240)
br label %262
262: ; preds = %260, %254
%263 = sub i32 %240, %219
%264 = icmp sgt i32 %263, 0
br i1 %264, label %265, label %341
265: ; preds = %262
%266 = zext i32 %263 to i64
br label %270
267: ; preds = %296
br i1 %264, label %268, label %326
268: ; preds = %267
%269 = zext i32 %263 to i64
br label %302
270: ; preds = %265, %296
%271 = phi i64 [ 0, %265 ], [ %300, %296 ]
%272 = phi double [ 0.000000e+00, %265 ], [ %298, %296 ]
%273 = phi double [ 0.000000e+00, %265 ], [ %299, %296 ]
%274 = phi i32 [ 0, %265 ], [ %297, %296 ]
%275 = trunc i64 %271 to i32
%276 = sitofp i32 %275 to double
%277 = fdiv double %276, %1
%278 = fdiv double %277, %2
%279 = fptosi double %278 to i32
%280 = call double @sin(i32 %279)
%281 = getelementptr inbounds float, float* %18, i64 %271
%282 = load float, float* %281
%283 = fpext float %282 to double
%284 = fsub double %280, %283
%285 = call double @llvm.fabs.f64(double %284)
%286 = fcmp ogt double %285, 5.000000e-02
br i1 %286, label %287, label %296
287: ; preds = %270
%288 = icmp eq i32 %274, 0
br i1 %288, label %289, label %294
289: ; preds = %287
%290 = call double @sin(i32 %279)
%291 = load float, float* %281
%292 = fpext float %291 to double
%293 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %275, double %290, double %292)
br label %294
294: ; preds = %289, %287
%295 = add nsw i32 %274, 1
br label %296
296: ; preds = %294, %270
%297 = phi i32 [ %295, %294 ], [ %274, %270 ]
%298 = fadd double %272, %285
%299 = call double @llvm.fmuladd.f64(double %284, double %284, double %273)
%300 = add nuw nsw i64 %271, 1
%301 = icmp eq i64 %300, %266
br i1 %301, label %267, label %270
302: ; preds = %268, %318
%303 = phi i64 [ 0, %268 ], [ %320, %318 ]
%304 = phi i32 [ 0, %268 ], [ %319, %318 ]
%305 = getelementptr inbounds float, float* %18, i64 %303
%306 = load float, float* %305
%307 = fpext float %306 to double
%308 = fcmp olt double %307, -1.010000e+00
%309 = fcmp ogt double %307, 1.010000e+00
%310 = or i1 %308, %309
br i1 %310, label %311, label %318
311: ; preds = %302
%312 = icmp eq i32 %304, 0
br i1 %312, label %313, label %316
313: ; preds = %311
%314 = trunc i64 %303 to i32
%315 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %314, double %307)
br label %316
316: ; preds = %313, %311
%317 = add nsw i32 %304, 1
br label %318
318: ; preds = %302, %316
%319 = phi i32 [ %317, %316 ], [ %304, %302 ]
%320 = add nuw nsw i64 %303, 1
%321 = icmp eq i64 %320, %269
br i1 %321, label %322, label %302
322: ; preds = %318
%323 = icmp sgt i32 %319, 1
br i1 %323, label %324, label %326
324: ; preds = %322
%325 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 %319)
br label %326
326: ; preds = %267, %324, %322
%327 = icmp sgt i32 %297, 0
br i1 %327, label %328, label %341
328: ; preds = %326
%329 = add nsw i32 %240, -1
%330 = sitofp i32 %329 to double
%331 = fdiv double %330, %1
%332 = fdiv double %331, %2
%333 = fptosi double %332 to i32
%334 = call double @sin(i32 %333)
%335 = zext i32 %329 to i64
%336 = getelementptr inbounds float, float* %18, i64 %335
%337 = load float, float* %336
%338 = fpext float %337 to double
%339 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %329, double %334, double %338)
%340 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i32 %297)
br label %341
341: ; preds = %262, %328, %326
%342 = phi double [ %298, %328 ], [ %298, %326 ], [ 0.000000e+00, %262 ]
%343 = phi double [ %299, %328 ], [ %299, %326 ], [ 0.000000e+00, %262 ]
%344 = sitofp i32 %263 to double
%345 = fdiv double %342, %344
%346 = fdiv double %343, %344
%347 = call double @sqrt(double %346)
%348 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), i32 %240, double %345, double %347)
br label %349
349: ; preds = %341, %252
%350 = call i32 @free(float* %14)
%351 = call i32 @free(float* %18)
ret void
}