#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(int);
int /*<<< orphan*/ cst_free(float *);
scalar_t__ cst_safe_alloc(int);
unsigned char cst_short_to_ulaw(short);
float cst_ulaw_to_short(unsigned char const);
void add_residual_windowed(int targ_size, unsigned char *targ_residual,
                           int unit_size, const unsigned char *unit_residual) {
  float *window, *unit, *residual;
  int i, j, k, offset, win_size;
  win_size = (targ_size * 2) + 1;
  window = ((float *)cst_safe_alloc(sizeof(float) * (win_size)));
  window[targ_size + 1] = 1.0;
  k = 3.14159265358979323846 / (win_size - 1);
  for (i = 0, j = win_size - 1; i < targ_size + 1; i++, j--)
    window[j] = window[i] = 0.54 - (0.46 * cos(k * i));
  residual = ((float *)cst_safe_alloc(sizeof(float) * (win_size)));
  for (i = 0; i < win_size; i++)
    residual[i] = cst_ulaw_to_short(targ_residual[i]);
  unit = ((float *)cst_safe_alloc(sizeof(float) * ((unit_size * 2) + 1)));
  for (i = 0; i < (unit_size * 2) + 1; i++)
    unit[i] = cst_ulaw_to_short(unit_residual[i]);
  if (targ_size < unit_size)
    for (i = 0; i < win_size; i++)
      residual[i] += window[i] * unit[i + (unit_size - targ_size) / 2];
  else {
    offset = (targ_size - unit_size) / 2;
    for (i = offset; i < win_size - offset; i++)
      residual[i] += window[i] * unit[i - offset];
  }
  for (i = 0; i < win_size; i++)
    targ_residual[i] = cst_short_to_ulaw((short)residual[i]);
  cst_free(window);
  cst_free(residual);
  cst_free(unit);
}


x86 assembly (clang, -O0):
<add_residual_windowed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <cst_safe_alloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movss  0xe7e(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe4f(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1236 <add_residual_windowed+0xe6>
mov    -0x44(%rbp),%edi
imul   -0x3c(%rbp),%edi
call   1050 <cos@plt>
movsd  0xe17(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe13(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
jmp    11cc <add_residual_windowed+0x7c>
movslq -0x4c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <cst_safe_alloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1288 <add_residual_windowed+0x138>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1040 <cst_ulaw_to_short@plt>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1250 <add_residual_windowed+0x100>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <cst_safe_alloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    12e9 <add_residual_windowed+0x199>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1040 <cst_ulaw_to_short@plt>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12a9 <add_residual_windowed+0x159>
mov    -0x4(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    136b <add_residual_windowed+0x21b>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1366 <add_residual_windowed+0x216>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x3c(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x58(%rbp),%rax
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12fc <add_residual_windowed+0x1ac>
jmp    13df <add_residual_windowed+0x28f>
mov    -0x4(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x4c(%rbp),%ecx
sub    -0x48(%rbp),%ecx
cmp    %ecx,%eax
jge    13da <add_residual_windowed+0x28a>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1382 <add_residual_windowed+0x232>
jmp    13df <add_residual_windowed+0x28f>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    1426 <add_residual_windowed+0x2d6>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvttss2si %xmm0,%eax
movswl %ax,%edi
call   1060 <cst_short_to_ulaw@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    13e6 <add_residual_windowed+0x296>
mov    -0x28(%rbp),%rdi
call   1070 <cst_free@plt>
mov    -0x38(%rbp),%rdi
call   1070 <cst_free@plt>
mov    -0x30(%rbp),%rdi
call   1070 <cst_free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_residual_windowed>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%r14
mov    %rdx,0x20(%rsp)
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x0(%rbp,%rbp,1),%r15d
lea    0x1(%rbp,%rbp,1),%eax
mov    %eax,0xc(%rsp)
lea    0x4(,%r15,4),%r13d
mov    %r13d,%edi
call   1030 <cst_safe_alloc@plt>
lea    0x1(%rbp),%edx
movslq %edx,%rcx
mov    %rax,(%rsp)
movl   $0x3f800000,(%rax,%rcx,4)
mov    %rbp,0x18(%rsp)
test   %ebp,%ebp
mov    %rbx,0x10(%rsp)
mov    %r14,0x40(%rsp)
js     12c6 <add_residual_windowed+0x176>
cvtsi2sd %r15d,%xmm0
movsd  0xe43(%rip),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
movslq %r15d,%rcx
mov    %edx,%eax
xor    %r12d,%r12d
cmpl   $0x0,0x18(%rsp)
je     145e <add_residual_windowed+0x30e>
mov    %r13d,0x28(%rsp)
mov    %rax,0x30(%rsp)
mov    %eax,%r14d
and    $0xfffffffe,%r14d
mov    (%rsp),%rbx
mov    %rcx,0x38(%rsp)
lea    (%rbx,%rcx,4),%r13
lea    (%rdi,%rdi,1),%eax
mov    %eax,0x2c(%rsp)
xor    %ebp,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12d,%edi
call   1050 <cos@plt>
movsd  0xde8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde4(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rbx,%rbp,4)
movss  %xmm0,0x0(%r13)
lea    (%r15,%r12,1),%edi
call   1050 <cos@plt>
mulsd  0xdb8(%rip),%xmm0
addsd  0xdb8(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rbx,%rbp,4)
movss  %xmm0,-0x4(%r13)
add    $0x2,%rbp
add    $0xfffffffffffffff8,%r13
add    0x2c(%rsp),%r12d
cmp    %rbp,%r14
jne    1210 <add_residual_windowed+0xc0>
mov    0x38(%rsp),%rcx
sub    %rbp,%rcx
mov    0x10(%rsp),%rbx
mov    0x28(%rsp),%r13d
mov    %r15,%rdi
mov    0x30(%rsp),%rax
test   $0x1,%al
je     12c6 <add_residual_windowed+0x176>
imul   %ebp,%edi
mov    %rcx,%r15
call   1050 <cos@plt>
mulsd  0xd5d(%rip),%xmm0
addsd  0xd5d(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    (%rsp),%rax
movss  %xmm0,(%rax,%rbp,4)
movss  %xmm0,(%rax,%r15,4)
mov    %r13d,%edi
call   1030 <cst_safe_alloc@plt>
mov    %rax,%r15
mov    0xc(%rsp),%eax
mov    %eax,%r14d
test   %eax,%eax
jle    12f8 <add_residual_windowed+0x1a8>
xor    %ebp,%ebp
xchg   %ax,%ax
movzbl (%rbx,%rbp,1),%edi
call   1040 <cst_ulaw_to_short@plt>
movss  %xmm0,(%r15,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    12e0 <add_residual_windowed+0x190>
mov    0x20(%rsp),%rcx
lea    (%rcx,%rcx,1),%eax
lea    (%rcx,%rcx,1),%ebx
add    $0x1,%ebx
lea    0x4(,%rax,4),%edi
call   1030 <cst_safe_alloc@plt>
mov    %rax,%r13
test   %ebx,%ebx
mov    0x40(%rsp),%r12
jle    134a <add_residual_windowed+0x1fa>
mov    %ebx,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r12,%rbx,1),%edi
call   1040 <cst_ulaw_to_short@plt>
movss  %xmm0,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1330 <add_residual_windowed+0x1e0>
mov    0x18(%rsp),%rax
mov    %eax,%ecx
sub    0x20(%rsp),%ecx
mov    0xc(%rsp),%ebp
jge    1394 <add_residual_windowed+0x244>
test   %ebp,%ebp
mov    (%rsp),%rbx
mov    %r13,%r12
mov    0x10(%rsp),%r13
jle    166c <add_residual_windowed+0x51c>
mov    0x20(%rsp),%rcx
sub    0x18(%rsp),%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
movslq %eax,%rcx
cmp    $0x8,%ebp
jae    146d <add_residual_windowed+0x31d>
xor    %eax,%eax
jmp    15ca <add_residual_windowed+0x47a>
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
mov    %ebp,%r10d
sub    %eax,%r10d
cmp    %r10d,%eax
mov    (%rsp),%rbx
mov    %r13,%r12
mov    0x10(%rsp),%r13
jge    163c <add_residual_windowed+0x4ec>
movslq %eax,%r8
movslq %r10d,%r11
mov    %r11,%r9
sub    %r8,%r9
mov    %r8,%rdx
cmp    $0x8,%r9
jae    1512 <add_residual_windowed+0x3c2>
sub    %edx,%r10d
mov    %rdx,%rax
not    %rax
test   $0x1,%r10b
je     1401 <add_residual_windowed+0x2b1>
movss  (%rbx,%rdx,4),%xmm0
mov    %rdx,%rcx
sub    %r8,%rcx
mulss  (%r12,%rcx,4),%xmm0
addss  (%r15,%rdx,4),%xmm0
movss  %xmm0,(%r15,%rdx,4)
add    $0x1,%rdx
add    %r11,%rax
je     163c <add_residual_windowed+0x4ec>
mov    $0x1,%eax
sub    %r8,%rax
lea    (%r12,%rax,4),%rax
cs nopw 0x0(%rax,%rax,1)
movss  (%rbx,%rdx,4),%xmm0
mulss  -0x4(%rax,%rdx,4),%xmm0
addss  (%r15,%rdx,4),%xmm0
movss  %xmm0,(%r15,%rdx,4)
movss  0x4(%rbx,%rdx,4),%xmm0
mulss  (%rax,%rdx,4),%xmm0
addss  0x4(%r15,%rdx,4),%xmm0
movss  %xmm0,0x4(%r15,%rdx,4)
add    $0x2,%rdx
cmp    %rdx,%r11
jne    1420 <add_residual_windowed+0x2d0>
jmp    163c <add_residual_windowed+0x4ec>
xor    %ebp,%ebp
test   $0x1,%al
jne    1298 <add_residual_windowed+0x148>
jmp    12c6 <add_residual_windowed+0x176>
lea    (%r15,%r14,4),%rax
lea    (%rbx,%r14,4),%rdx
lea    (%r12,%rcx,4),%rsi
lea    (%r14,%rcx,1),%rdi
lea    (%r12,%rdi,4),%rdi
cmp    %rdx,%r15
setb   %r8b
cmp    %rax,%rbx
setb   %bl
cmp    %rdi,%r15
setb   %dl
cmp    %rax,%rsi
setb   %sil
xor    %eax,%eax
test   %bl,%r8b
jne    15c6 <add_residual_windowed+0x476>
and    %sil,%dl
mov    (%rsp),%rbx
jne    15ca <add_residual_windowed+0x47a>
mov    %r14d,%eax
and    $0xfffffff8,%eax
lea    (%r12,%rcx,4),%rdx
add    $0x10,%rdx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups (%rbx,%rsi,4),%xmm0
movups 0x10(%rbx,%rsi,4),%xmm1
movups -0x10(%rdx,%rsi,4),%xmm2
mulps  %xmm0,%xmm2
movups (%rdx,%rsi,4),%xmm0
mulps  %xmm1,%xmm0
movups (%r15,%rsi,4),%xmm1
addps  %xmm2,%xmm1
movups 0x10(%r15,%rsi,4),%xmm2
addps  %xmm0,%xmm2
movups %xmm1,(%r15,%rsi,4)
movups %xmm2,0x10(%r15,%rsi,4)
add    $0x8,%rsi
cmp    %rsi,%rax
jne    14d0 <add_residual_windowed+0x380>
jmp    15ca <add_residual_windowed+0x47a>
lea    (%r15,%r8,4),%rax
lea    (%r15,%r11,4),%rcx
lea    (%rbx,%r8,4),%rdx
lea    (%rbx,%r11,4),%rsi
lea    (%r12,%r9,4),%rdi
cmp    %rsi,%rax
setb   %sil
cmp    %rcx,%rdx
setb   %bl
cmp    %rdi,%rax
setb   %al
cmp    %rcx,%r12
setb   %cl
mov    %r8,%rdx
test   %bl,%sil
mov    (%rsp),%rbx
jne    13d1 <add_residual_windowed+0x281>
mov    %r8,%rdx
and    %cl,%al
jne    13d1 <add_residual_windowed+0x281>
mov    %r9,%rdi
and    $0xfffffffffffffff8,%rdi
lea    (%rdi,%r8,1),%rdx
lea    (%rbx,%r8,4),%rcx
add    $0x10,%rcx
lea    (%r15,%r8,4),%rsi
add    $0x10,%rsi
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movups -0x10(%rcx,%rax,4),%xmm0
movups (%rcx,%rax,4),%xmm1
movups (%r12,%rax,4),%xmm2
mulps  %xmm0,%xmm2
movups 0x10(%r12,%rax,4),%xmm0
mulps  %xmm1,%xmm0
movups -0x10(%rsi,%rax,4),%xmm1
addps  %xmm2,%xmm1
movups (%rsi,%rax,4),%xmm2
addps  %xmm0,%xmm2
movups %xmm1,-0x10(%rsi,%rax,4)
movups %xmm2,(%rsi,%rax,4)
add    $0x8,%rax
cmp    %rax,%rdi
jne    1580 <add_residual_windowed+0x430>
cmp    %rdi,%r9
jne    13d1 <add_residual_windowed+0x281>
jmp    163c <add_residual_windowed+0x4ec>
mov    (%rsp),%rbx
mov    %rax,%rdx
not    %rdx
movss  (%rbx,%rax,4),%xmm0
lea    (%rax,%rcx,1),%rsi
mulss  (%r12,%rsi,4),%xmm0
addss  (%r15,%rax,4),%xmm0
movss  %xmm0,(%r15,%rax,4)
add    %r14,%rdx
je     163c <add_residual_windowed+0x4ec>
lea    -0x1(%r14),%rdx
lea    (%r12,%rcx,4),%rcx
add    $0x8,%rcx
nopl   0x0(%rax)
movss  0x4(%rbx,%rax,4),%xmm0
mulss  -0x4(%rcx,%rax,4),%xmm0
addss  0x4(%r15,%rax,4),%xmm0
movss  %xmm0,0x4(%r15,%rax,4)
movss  0x8(%rbx,%rax,4),%xmm0
mulss  (%rcx,%rax,4),%xmm0
addss  0x8(%r15,%rax,4),%xmm0
movss  %xmm0,0x8(%r15,%rax,4)
add    $0x2,%rax
cmp    %rax,%rdx
jne    1600 <add_residual_windowed+0x4b0>
test   %ebp,%ebp
jle    166c <add_residual_windowed+0x51c>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cvttss2si (%r15,%rbp,4),%eax
movswl %ax,%edi
call   1060 <cst_short_to_ulaw@plt>
mov    %al,0x0(%r13,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1650 <add_residual_windowed+0x500>
mov    %rbx,%rdi
call   1070 <cst_free@plt>
mov    %r15,%rdi
call   1070 <cst_free@plt>
mov    %r12,%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <cst_free@plt>

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

LLVM IR (-O2):
define void @add_residual_windowed(i32 %0, i8* nocapture %1, i32 %2, i8* nocapture %3) {
%5 = shl nsw i32 %0, 1
%6 = or i32 %5, 1
%7 = shl i32 %6, 2
%8 = tail call i64 @cst_safe_alloc(i32 %7)
%9 = inttoptr i64 %8 to float*
%10 = inttoptr i64 %8 to i8*
%11 = add i32 %0, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds float, float* %9, i64 %12
store float 1.000000e+00, float* %13
%14 = icmp slt i32 %0, 0
br i1 %14, label %61, label %15
15: ; preds = %4
%16 = sitofp i32 %5 to double
%17 = fdiv double 0x400921FB54442D18, %16
%18 = fptosi double %17 to i32
%19 = sext i32 %5 to i64
%20 = zext i32 %11 to i64
%21 = and i64 %20, 1
%22 = icmp eq i32 %0, 0
br i1 %22, label %49, label %23
23: ; preds = %15
%24 = and i64 %20, 4294967294
br label %25
25: ; preds = %25, %23
%26 = phi i64 [ %19, %23 ], [ %46, %25 ]
%27 = phi i64 [ 0, %23 ], [ %45, %25 ]
%28 = phi i64 [ 0, %23 ], [ %47, %25 ]
%29 = trunc i64 %27 to i32
%30 = mul i32 %29, %18
%31 = tail call double @cos(i32 %30)
%32 = tail call double @llvm.fmuladd.f64(double %31, double -4.600000e-01, double 5.400000e-01)
%33 = fptrunc double %32 to float
%34 = getelementptr inbounds float, float* %9, i64 %27
store float %33, float* %34
%35 = getelementptr inbounds float, float* %9, i64 %26
store float %33, float* %35
%36 = or i64 %27, 1
%37 = add nsw i64 %26, -1
%38 = trunc i64 %36 to i32
%39 = mul i32 %38, %18
%40 = tail call double @cos(i32 %39)
%41 = tail call double @llvm.fmuladd.f64(double %40, double -4.600000e-01, double 5.400000e-01)
%42 = fptrunc double %41 to float
%43 = getelementptr inbounds float, float* %9, i64 %36
store float %42, float* %43
%44 = getelementptr inbounds float, float* %9, i64 %37
store float %42, float* %44
%45 = add nuw nsw i64 %27, 2
%46 = add nsw i64 %26, -2
%47 = add i64 %28, 2
%48 = icmp eq i64 %47, %24
br i1 %48, label %49, label %25
49: ; preds = %25, %15
%50 = phi i64 [ %19, %15 ], [ %46, %25 ]
%51 = phi i64 [ 0, %15 ], [ %45, %25 ]
%52 = icmp eq i64 %21, 0
br i1 %52, label %61, label %53
53: ; preds = %49
%54 = trunc i64 %51 to i32
%55 = mul i32 %54, %18
%56 = tail call double @cos(i32 %55)
%57 = tail call double @llvm.fmuladd.f64(double %56, double -4.600000e-01, double 5.400000e-01)
%58 = fptrunc double %57 to float
%59 = getelementptr inbounds float, float* %9, i64 %51
store float %58, float* %59
%60 = getelementptr inbounds float, float* %9, i64 %50
store float %58, float* %60
br label %61
61: ; preds = %53, %49, %4
%62 = tail call i64 @cst_safe_alloc(i32 %7)
%63 = inttoptr i64 %62 to float*
%64 = inttoptr i64 %62 to i8*
%65 = icmp sgt i32 %6, 0
br i1 %65, label %66, label %76
66: ; preds = %61
%67 = zext i32 %6 to i64
br label %68
68: ; preds = %66, %68
%69 = phi i64 [ 0, %66 ], [ %74, %68 ]
%70 = getelementptr inbounds i8, i8* %1, i64 %69
%71 = load i8, i8* %70
%72 = tail call float @cst_ulaw_to_short(i8 zeroext %71)
%73 = getelementptr inbounds float, float* %63, i64 %69
store float %72, float* %73
%74 = add nuw nsw i64 %69, 1
%75 = icmp eq i64 %74, %67
br i1 %75, label %76, label %68
76: ; preds = %68, %61
%77 = shl nsw i32 %2, 1
%78 = or i32 %77, 1
%79 = shl i32 %78, 2
%80 = tail call i64 @cst_safe_alloc(i32 %79)
%81 = inttoptr i64 %80 to float*
%82 = inttoptr i64 %80 to i8*
%83 = icmp sgt i32 %78, 0
br i1 %83, label %84, label %94
84: ; preds = %76
%85 = zext i32 %78 to i64
br label %86
86: ; preds = %84, %86
%87 = phi i64 [ 0, %84 ], [ %92, %86 ]
%88 = getelementptr inbounds i8, i8* %3, i64 %87
%89 = load i8, i8* %88
%90 = tail call float @cst_ulaw_to_short(i8 zeroext %89)
%91 = getelementptr inbounds float, float* %81, i64 %87
store float %90, float* %91
%92 = add nuw nsw i64 %87, 1
%93 = icmp eq i64 %92, %85
br i1 %93, label %94, label %86
94: ; preds = %86, %76
%95 = icmp slt i32 %0, %2
br i1 %95, label %96, label %183
96: ; preds = %94
br i1 %65, label %97, label %293
97: ; preds = %96
%98 = sub nsw i32 %2, %0
%99 = sdiv i32 %98, 2
%100 = sext i32 %99 to i64
%101 = zext i32 %6 to i64
%102 = icmp ult i32 %6, 8
br i1 %102, label %148, label %103
103: ; preds = %97
%104 = getelementptr float, float* %63, i64 %101
%105 = bitcast float* %104 to i8*
%106 = getelementptr float, float* %9, i64 %101
%107 = bitcast float* %106 to i8*
%108 = getelementptr float, float* %81, i64 %100
%109 = add nsw i64 %101, %100
%110 = getelementptr float, float* %81, i64 %109
%111 = bitcast float* %110 to i8*
%112 = icmp ult i8* %64, %107
%113 = icmp ult i8* %10, %105
%114 = and i1 %112, %113
%115 = icmp ult i8* %64, %111
%116 = icmp ult float* %108, %104
%117 = and i1 %115, %116
%118 = or i1 %114, %117
br i1 %118, label %148, label %119
119: ; preds = %103
%120 = and i64 %101, 4294967288
br label %121
121: ; preds = %121, %119
%122 = phi i64 [ 0, %119 ], [ %146, %121 ]
%123 = getelementptr inbounds float, float* %9, i64 %122
%124 = bitcast float* %123 to <4 x float>*
%125 = load <4 x float>, <4 x float>* %124
%126 = getelementptr inbounds float, float* %123, i64 4
%127 = bitcast float* %126 to <4 x float>*
%128 = load <4 x float>, <4 x float>* %127
%129 = add nsw i64 %122, %100
%130 = getelementptr inbounds float, float* %81, i64 %129
%131 = bitcast float* %130 to <4 x float>*
%132 = load <4 x float>, <4 x float>* %131
%133 = getelementptr inbounds float, float* %130, i64 4
%134 = bitcast float* %133 to <4 x float>*
%135 = load <4 x float>, <4 x float>* %134
%136 = getelementptr inbounds float, float* %63, i64 %122
%137 = bitcast float* %136 to <4 x float>*
%138 = load <4 x float>, <4 x float>* %137
%139 = getelementptr inbounds float, float* %136, i64 4
%140 = bitcast float* %139 to <4 x float>*
%141 = load <4 x float>, <4 x float>* %140
%142 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %125, <4 x float> %132, <4 x float> %138)
%143 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %128, <4 x float> %135, <4 x float> %141)
%144 = bitcast float* %136 to <4 x float>*
store <4 x float> %142, <4 x float>* %144
%145 = bitcast float* %139 to <4 x float>*
store <4 x float> %143, <4 x float>* %145
%146 = add nuw i64 %122, 8
%147 = icmp eq i64 %146, %120
br i1 %147, label %148, label %121
148: ; preds = %121, %103, %97
%149 = phi i64 [ 0, %103 ], [ 0, %97 ], [ %120, %121 ]
%150 = xor i64 %149, -1
%151 = getelementptr inbounds float, float* %9, i64 %149
%152 = load float, float* %151
%153 = add nsw i64 %149, %100
%154 = getelementptr inbounds float, float* %81, i64 %153
%155 = load float, float* %154
%156 = getelementptr inbounds float, float* %63, i64 %149
%157 = load float, float* %156
%158 = tail call float @llvm.fmuladd.f32(float %152, float %155, float %157)
store float %158, float* %156
%159 = or i64 %149, 1
%160 = sub nsw i64 0, %101
%161 = icmp eq i64 %150, %160
br i1 %161, label %281, label %162
162: ; preds = %148, %162
%163 = phi i64 [ %181, %162 ], [ %159, %148 ]
%164 = getelementptr inbounds float, float* %9, i64 %163
%165 = load float, float* %164
%166 = add nsw i64 %163, %100
%167 = getelementptr inbounds float, float* %81, i64 %166
%168 = load float, float* %167
%169 = getelementptr inbounds float, float* %63, i64 %163
%170 = load float, float* %169
%171 = tail call float @llvm.fmuladd.f32(float %165, float %168, float %170)
store float %171, float* %169
%172 = add nuw nsw i64 %163, 1
%173 = getelementptr inbounds float, float* %9, i64 %172
%174 = load float, float* %173
%175 = add nsw i64 %172, %100
%176 = getelementptr inbounds float, float* %81, i64 %175
%177 = load float, float* %176
%178 = getelementptr inbounds float, float* %63, i64 %172
%179 = load float, float* %178
%180 = tail call float @llvm.fmuladd.f32(float %174, float %177, float %179)
store float %180, float* %178
%181 = add nuw nsw i64 %163, 2
%182 = icmp eq i64 %181, %101
br i1 %182, label %281, label %162
183: ; preds = %94
%184 = sub nsw i32 %0, %2
%185 = sdiv i32 %184, 2
%186 = sub i32 %6, %185
%187 = icmp slt i32 %185, %186
br i1 %187, label %188, label %281
188: ; preds = %183
%189 = sext i32 %185 to i64
%190 = sext i32 %186 to i64
%191 = sub nsw i64 %190, %189
%192 = icmp ult i64 %191, 8
br i1 %192, label %240, label %193
193: ; preds = %188
%194 = getelementptr float, float* %63, i64 %189
%195 = getelementptr float, float* %63, i64 %190
%196 = bitcast float* %195 to i8*
%197 = getelementptr float, float* %9, i64 %189
%198 = getelementptr float, float* %9, i64 %190
%199 = sub nsw i64 %190, %189
%200 = getelementptr float, float* %81, i64 %199
%201 = icmp ult float* %194, %198
%202 = icmp ult float* %197, %195
%203 = and i1 %201, %202
%204 = icmp ult float* %194, %200
%205 = icmp ult i8* %82, %196
%206 = and i1 %204, %205
%207 = or i1 %203, %206
br i1 %207, label %240, label %208
208: ; preds = %193
%209 = and i64 %191, -8
%210 = add nsw i64 %209, %189
br label %211
211: ; preds = %211, %208
%212 = phi i64 [ 0, %208 ], [ %236, %211 ]
%213 = add i64 %212, %189
%214 = getelementptr inbounds float, float* %9, i64 %213
%215 = bitcast float* %214 to <4 x float>*
%216 = load <4 x float>, <4 x float>* %215
%217 = getelementptr inbounds float, float* %214, i64 4
%218 = bitcast float* %217 to <4 x float>*
%219 = load <4 x float>, <4 x float>* %218
%220 = getelementptr inbounds float, float* %81, i64 %212
%221 = bitcast float* %220 to <4 x float>*
%222 = load <4 x float>, <4 x float>* %221
%223 = getelementptr inbounds float, float* %220, i64 4
%224 = bitcast float* %223 to <4 x float>*
%225 = load <4 x float>, <4 x float>* %224
%226 = getelementptr inbounds float, float* %63, i64 %213
%227 = bitcast float* %226 to <4 x float>*
%228 = load <4 x float>, <4 x float>* %227
%229 = getelementptr inbounds float, float* %226, i64 4
%230 = bitcast float* %229 to <4 x float>*
%231 = load <4 x float>, <4 x float>* %230
%232 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %216, <4 x float> %222, <4 x float> %228)
%233 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %219, <4 x float> %225, <4 x float> %231)
%234 = bitcast float* %226 to <4 x float>*
store <4 x float> %232, <4 x float>* %234
%235 = bitcast float* %229 to <4 x float>*
store <4 x float> %233, <4 x float>* %235
%236 = add nuw i64 %212, 8
%237 = icmp eq i64 %236, %209
br i1 %237, label %238, label %211
238: ; preds = %211
%239 = icmp eq i64 %191, %209
br i1 %239, label %281, label %240
240: ; preds = %193, %188, %238
%241 = phi i64 [ %189, %193 ], [ %189, %188 ], [ %210, %238 ]
%242 = sub nsw i64 %190, %241
%243 = xor i64 %241, -1
%244 = and i64 %242, 1
%245 = icmp eq i64 %244, 0
br i1 %245, label %256, label %246
246: ; preds = %240
%247 = getelementptr inbounds float, float* %9, i64 %241
%248 = load float, float* %247
%249 = sub nsw i64 %241, %189
%250 = getelementptr inbounds float, float* %81, i64 %249
%251 = load float, float* %250
%252 = getelementptr inbounds float, float* %63, i64 %241
%253 = load float, float* %252
%254 = tail call float @llvm.fmuladd.f32(float %248, float %251, float %253)
store float %254, float* %252
%255 = add nsw i64 %241, 1
br label %256
256: ; preds = %246, %240
%257 = phi i64 [ %241, %240 ], [ %255, %246 ]
%258 = sub nsw i64 0, %190
%259 = icmp eq i64 %243, %258
br i1 %259, label %281, label %260
260: ; preds = %256, %260
%261 = phi i64 [ %279, %260 ], [ %257, %256 ]
%262 = getelementptr inbounds float, float* %9, i64 %261
%263 = load float, float* %262
%264 = sub nsw i64 %261, %189
%265 = getelementptr inbounds float, float* %81, i64 %264
%266 = load float, float* %265
%267 = getelementptr inbounds float, float* %63, i64 %261
%268 = load float, float* %267
%269 = tail call float @llvm.fmuladd.f32(float %263, float %266, float %268)
store float %269, float* %267
%270 = add nsw i64 %261, 1
%271 = getelementptr inbounds float, float* %9, i64 %270
%272 = load float, float* %271
%273 = sub nsw i64 %270, %189
%274 = getelementptr inbounds float, float* %81, i64 %273
%275 = load float, float* %274
%276 = getelementptr inbounds float, float* %63, i64 %270
%277 = load float, float* %276
%278 = tail call float @llvm.fmuladd.f32(float %272, float %275, float %277)
store float %278, float* %276
%279 = add nsw i64 %261, 2
%280 = icmp eq i64 %279, %190
br i1 %280, label %281, label %260
281: ; preds = %256, %260, %148, %162, %238, %183
br i1 %65, label %282, label %293
282: ; preds = %281
%283 = zext i32 %6 to i64
br label %284
284: ; preds = %282, %284
%285 = phi i64 [ 0, %282 ], [ %291, %284 ]
%286 = getelementptr inbounds float, float* %63, i64 %285
%287 = load float, float* %286
%288 = fptosi float %287 to i16
%289 = tail call zeroext i8 @cst_short_to_ulaw(i16 signext %288)
%290 = getelementptr inbounds i8, i8* %1, i64 %285
store i8 %289, i8* %290
%291 = add nuw nsw i64 %285, 1
%292 = icmp eq i64 %291, %283
br i1 %292, label %293, label %284
293: ; preds = %284, %96, %281
%294 = tail call i32 @cst_free(float* %9)
%295 = tail call i32 @cst_free(float* %63)
%296 = tail call i32 @cst_free(float* %81)
ret void
}