#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 */
scalar_t__ cos(double);
int const log(double);
int const log_add(double, double);
double log_conv(scalar_t__);
double mel_conv(double, int);
scalar_t__ sin(double);
void mgclsp2sp(double a, double g, double *lsp, const int m, double *x,
               const int l, const int gain) {
  int i, p;
  double w, eq1, eq2, ap = 0.0;
  for (p = 0; p < l; p++) {
    eq1 = 0.0;
    eq2 = 0.0;
    w = mel_conv(a, p * (3.1415926535897932384626433832795 / (l - 1)));
    if (m % 2 == 0) {
      for (i = 0; i < m / 2; i++) {
        eq1 += 2.0 * log_conv(cos(w) - cos(lsp[2 * i + gain]));
        eq2 += 2.0 * log_conv(cos(w) - cos(lsp[2 * i + 1 + gain]));
      }
      eq1 += 2.0 * log_conv(cos(w / 2.0));
      eq2 += 2.0 * log_conv(sin(w / 2.0));
      ap = m * log(2.0) + log_add(eq1, eq2);
    } else {
      for (i = 0; i < (m + 1) / 2; i++)
        eq1 += 2.0 * log_conv(cos(w) - cos(lsp[2 * i + gain]));
      for (i = 0; i < (m - 1) / 2; i++)
        eq2 += 2.0 * log_conv(cos(w) - cos(lsp[2 * i + 1 + gain]));
      eq2 += 2.0 * log_conv(sin(w));
      ap = (m - 1.0) * log(2.0) + log_add(eq1, eq2);
    }
    x[p] = -0.5 * ap;
    x[p] *= -(1.0 / g);
    if (gain == 1)
      x[p] += lsp[0];
  }
}


x86 assembly (clang, -O0):
<mgclsp2sp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8d,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1576 <mgclsp2sp+0x416>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x38(%rbp),%xmm1
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm3
movsd  0xe32(%rip),%xmm2
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1050 <mel_conv@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    135c <mgclsp2sp+0x1fc>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
cmp    %ecx,%eax
jge    12ba <mgclsp2sp+0x15a>
movsd  -0x40(%rbp),%xmm0
call   1070 <cos@plt>
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <cos@plt>
mov    -0x70(%rbp),%rdi
sub    %rax,%rdi
call   1030 <log_conv@plt>
movsd  -0x48(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1070 <cos@plt>
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <cos@plt>
mov    -0x68(%rbp),%rdi
sub    %rax,%rdi
call   1030 <log_conv@plt>
movsd  -0x50(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ff <mgclsp2sp+0x9f>
movsd  -0x40(%rbp),%xmm0
movsd  0xd41(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1070 <cos@plt>
mov    %rax,%rdi
call   1030 <log_conv@plt>
movsd  -0x48(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xd11(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
mov    %rax,%rdi
call   1030 <log_conv@plt>
movsd  -0x50(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x78(%rbp)
movsd  0xce0(%rip),%xmm0
call   1080 <log@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x74(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1060 <log_add@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    14ef <mgclsp2sp+0x38f>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
cmp    %ecx,%eax
jge    13de <mgclsp2sp+0x27e>
movsd  -0x40(%rbp),%xmm0
call   1070 <cos@plt>
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <cos@plt>
mov    -0x88(%rbp),%rdi
sub    %rax,%rdi
call   1030 <log_conv@plt>
movsd  -0x48(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1363 <mgclsp2sp+0x203>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
cmp    %ecx,%eax
jge    1469 <mgclsp2sp+0x309>
movsd  -0x40(%rbp),%xmm0
call   1070 <cos@plt>
mov    %rax,-0x98(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <cos@plt>
mov    -0x98(%rbp),%rdi
sub    %rax,%rdi
call   1030 <log_conv@plt>
movsd  -0x50(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13e5 <mgclsp2sp+0x285>
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
mov    %rax,%rdi
call   1030 <log_conv@plt>
movsd  -0x50(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xb76(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xb5a(%rip),%xmm0
call   1080 <log@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1060 <log_add@plt>
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xa0(%rbp),%xmm2
ff
cvtsi2sd %eax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xb21(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xaff(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
cmpl   $0x1,-0x30(%rbp)
jne    1563 <mgclsp2sp+0x403>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1568 <mgclsp2sp+0x408>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1196 <mgclsp2sp+0x36>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mgclsp2sp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movsd  %xmm0,0x90(%rsp)
test   %ecx,%ecx
jle    1592 <mgclsp2sp+0x432>
mov    %r8d,%r12d
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %rdi,%r13
lea    -0x1(%rcx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe60(%rip),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x88(%rsp)
lea    0x1(%r14),%eax
shr    $0x1f,%eax
lea    (%r14,%rax,1),%r15d
add    $0x1,%r15d
sar    %r15d
lea    -0x1(%r14),%eax
shr    $0x1f,%eax
lea    (%r14,%rax,1),%edx
add    $0xffffffff,%edx
sar    %edx
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
movsd  0xe2a(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,0x68(%rsp)
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
mov    %rax,0x58(%rsp)
divsd  %xmm1,%xmm2
movsd  %xmm2,0x80(%rsp)
cmp    $0x2,%r15d
mov    $0x1,%eax
cmovl  %eax,%r15d
movslq %r8d,%rsi
cmp    $0x2,%edx
cmovl  %eax,%edx
mov    %rdx,0x60(%rsp)
mov    %ecx,%eax
mov    %rax,0x78(%rsp)
lea    (%rdi,%rsi,8),%rax
mov    %rax,0x38(%rsp)
shl    $0x4,%r15
add    $0x1,%esi
mov    %rsi,0x30(%rsp)
xor    %ebx,%ebx
mov    %r14,0x40(%rsp)
mov    %r15,0x50(%rsp)
mov    %rbp,0x48(%rsp)
mov    %r8d,0xc(%rsp)
jmp    126f <mgclsp2sp+0x10f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    0x78(%rsp),%rbx
je     1592 <mgclsp2sp+0x432>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0x88(%rsp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0x90(%rsp),%xmm0
call   1050 <mel_conv@plt>
test   $0x1,%r14b
jne    1410 <mgclsp2sp+0x2b0>
xorpd  %xmm1,%xmm1
cmp    $0x2,%r14d
jl     1366 <mgclsp2sp+0x206>
movsd  %xmm0,(%rsp)
xorpd  %xmm0,%xmm0
mov    0x58(%rsp),%r12
mov    0x38(%rsp),%r14
mov    0x30(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1070 <cos@plt>
mov    %rax,%rbp
movsd  (%r14),%xmm0
call   1070 <cos@plt>
sub    %rax,%rbp
mov    %rbp,%rdi
call   1030 <log_conv@plt>
movaps %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1070 <cos@plt>
mov    %rax,%rbp
movslq %r15d,%r15
movsd  0x0(%r13,%r15,8),%xmm0
call   1070 <cos@plt>
sub    %rax,%rbp
mov    %rbp,%rdi
call   1030 <log_conv@plt>
movapd 0x20(%rsp),%xmm2
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
addpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
addpd  %xmm2,%xmm0
add    $0x2,%r15d
add    $0x10,%r14
add    $0xffffffffffffffff,%r12
jne    12d0 <mgclsp2sp+0x170>
addpd  %xmm2,%xmm1
mov    0xc(%rsp),%r12d
mov    0x48(%rsp),%rbp
mov    0x40(%rsp),%r14
movsd  (%rsp),%xmm0
movapd %xmm1,0x10(%rsp)
mulsd  0xca4(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1070 <cos@plt>
mov    %rax,%rdi
call   1030 <log_conv@plt>
addsd  %xmm0,%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
mov    %rax,%rdi
call   1030 <log_conv@plt>
movapd 0x10(%rsp),%xmm1
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0xc48(%rip),%xmm0
call   1080 <log@plt>
mov    %r12d,%r15d
mov    %rbp,%r12
mov    %eax,%ebp
imul   %r14d,%ebp
movsd  0x20(%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
call   1060 <log_add@plt>
add    %ebp,%eax
mov    %r12,%rbp
mov    %r15d,%r12d
mov    0x50(%rsp),%r15
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    1560 <mgclsp2sp+0x400>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,0x70(%rsp)
xorpd  %xmm1,%xmm1
test   %r14d,%r14d
mov    0x38(%rsp),%r12
movsd  %xmm0,(%rsp)
jle    1475 <mgclsp2sp+0x315>
xorpd  %xmm1,%xmm1
xor    %ebx,%ebx
xchg   %ax,%ax
movsd  %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1070 <cos@plt>
mov    %rax,%rbp
movsd  (%r12,%rbx,1),%xmm0
call   1070 <cos@plt>
sub    %rax,%rbp
mov    %rbp,%rdi
call   1030 <log_conv@plt>
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
add    $0x10,%rbx
cmp    %rbx,%r15
jne    1430 <mgclsp2sp+0x2d0>
movsd  %xmm1,0x10(%rsp)
cmp    $0x3,%r14d
mov    0xc(%rsp),%r12d
xorpd  %xmm1,%xmm1
jl     14e9 <mgclsp2sp+0x389>
xorpd  %xmm1,%xmm1
mov    0x60(%rsp),%r14
mov    0x30(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1070 <cos@plt>
mov    %rax,%rbp
movslq %ebx,%rbx
movsd  0x0(%r13,%rbx,8),%xmm0
call   1070 <cos@plt>
sub    %rax,%rbp
mov    %rbp,%rdi
call   1030 <log_conv@plt>
movsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
add    $0x2,%ebx
add    $0xffffffffffffffff,%r14
jne    14a0 <mgclsp2sp+0x340>
movsd  %xmm1,0x20(%rsp)
call   1040 <sin@plt>
mov    %rax,%rdi
call   1030 <log_conv@plt>
addsd  %xmm0,%xmm0
movsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0xaf8(%rip),%xmm0
call   1080 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x68(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1060 <log_add@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
mov    0x40(%rsp),%r14
mov    0x50(%rsp),%r15
mov    0x70(%rsp),%rbx
mov    0x48(%rsp),%rbp
mulsd  0xab8(%rip),%xmm0
mulsd  0x80(%rsp),%xmm0
movsd  %xmm0,0x0(%rbp,%rbx,8)
cmp    $0x1,%r12d
jne    1260 <mgclsp2sp+0x100>
addsd  0x0(%r13),%xmm0
movsd  %xmm0,0x0(%rbp,%rbx,8)
jmp    1260 <mgclsp2sp+0x100>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @mgclsp2sp(double %0, double %1, double* nocapture %2, i32 %3, double* nocapture writeonly %4, i32 %5, i32 %6) {
%8 = icmp sgt i32 %5, 0
br i1 %8, label %9, label %140
9: ; preds = %7
%10 = add nsw i32 %5, -1
%11 = sitofp i32 %10 to double
%12 = fdiv double 0x400921FB54442D18, %11
%13 = and i32 %3, 1
%14 = icmp eq i32 %13, 0
%15 = add nsw i32 %3, 1
%16 = sdiv i32 %15, 2
%17 = icmp sgt i32 %3, 0
%18 = add nsw i32 %3, -1
%19 = sdiv i32 %18, 2
%20 = icmp sgt i32 %3, 2
%21 = add i32 %6, 1
%22 = sitofp i32 %3 to double
%23 = fadd double %22, -1.000000e+00
%24 = sdiv i32 %3, 2
%25 = icmp sgt i32 %3, 1
%26 = fdiv double -1.000000e+00, %1
%27 = icmp eq i32 %6, 1
%28 = sext i32 %6 to i64
%29 = call i32 @llvm.smax.i32(i32 %16, i32 1)
%30 = call i32 @llvm.smax.i32(i32 %19, i32 1)
%31 = zext i32 %5 to i64
%32 = zext i32 %29 to i64
%33 = zext i32 %30 to i64
%34 = zext i32 %24 to i64
br label %35
35: ; preds = %9, %137
%36 = phi i64 [ 0, %9 ], [ %138, %137 ]
%37 = trunc i64 %36 to i32
%38 = sitofp i32 %37 to double
%39 = fmul double %12, %38
%40 = fptosi double %39 to i32
%41 = tail call double @mel_conv(double %0, i32 %40)
br i1 %14, label %43, label %42
42: ; preds = %35
br i1 %17, label %89, label %87
43: ; preds = %35
br i1 %25, label %44, label %71
44: ; preds = %43, %44
%45 = phi i64 [ %67, %44 ], [ 0, %43 ]
%46 = phi <2 x double> [ %66, %44 ], [ zeroinitializer, %43 ]
%47 = tail call i64 @cos(double %41)
%48 = shl nuw nsw i64 %45, 1
%49 = add nsw i64 %48, %28
%50 = getelementptr inbounds double, double* %2, i64 %49
%51 = load double, double* %50
%52 = tail call i64 @cos(double %51)
%53 = sub nsw i64 %47, %52
%54 = tail call double @log_conv(i64 %53)
%55 = tail call i64 @cos(double %41)
%56 = trunc i64 %48 to i32
%57 = add i32 %21, %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %2, i64 %58
%60 = load double, double* %59
%61 = tail call i64 @cos(double %60)
%62 = sub nsw i64 %55, %61
%63 = tail call double @log_conv(i64 %62)
%64 = insertelement <2 x double> poison, double %54, i64 0
%65 = insertelement <2 x double> %64, double %63, i64 1
%66 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %65, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %46)
%67 = add nuw nsw i64 %45, 1
%68 = icmp eq i64 %67, %34
br i1 %68, label %69, label %44
69: ; preds = %44
%70 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %65, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %46)
br label %71
71: ; preds = %69, %43
%72 = phi <2 x double> [ zeroinitializer, %43 ], [ %70, %69 ]
%73 = fmul double %41, 5.000000e-01
%74 = tail call i64 @cos(double %73)
%75 = tail call double @log_conv(i64 %74)
%76 = extractelement <2 x double> %72, i64 0
%77 = tail call double @llvm.fmuladd.f64(double %75, double 2.000000e+00, double %76)
%78 = tail call i64 @sin(double %73)
%79 = tail call double @log_conv(i64 %78)
%80 = extractelement <2 x double> %72, i64 1
%81 = tail call double @llvm.fmuladd.f64(double %79, double 2.000000e+00, double %80)
%82 = tail call i32 @log(double 2.000000e+00)
%83 = mul nsw i32 %82, %3
%84 = tail call i32 @log_add(double %77, double %81)
%85 = add nsw i32 %83, %84
%86 = sitofp i32 %85 to double
br label %129
87: ; preds = %89, %42
%88 = phi double [ 0.000000e+00, %42 ], [ %100, %89 ]
br i1 %20, label %103, label %119
89: ; preds = %42, %89
%90 = phi i64 [ %101, %89 ], [ 0, %42 ]
%91 = phi double [ %100, %89 ], [ 0.000000e+00, %42 ]
%92 = tail call i64 @cos(double %41)
%93 = shl nuw nsw i64 %90, 1
%94 = add nsw i64 %93, %28
%95 = getelementptr inbounds double, double* %2, i64 %94
%96 = load double, double* %95
%97 = tail call i64 @cos(double %96)
%98 = sub nsw i64 %92, %97
%99 = tail call double @log_conv(i64 %98)
%100 = tail call double @llvm.fmuladd.f64(double %99, double 2.000000e+00, double %91)
%101 = add nuw nsw i64 %90, 1
%102 = icmp eq i64 %101, %32
br i1 %102, label %87, label %89
103: ; preds = %87, %103
%104 = phi i64 [ %117, %103 ], [ 0, %87 ]
%105 = phi double [ %116, %103 ], [ 0.000000e+00, %87 ]
%106 = tail call i64 @cos(double %41)
%107 = trunc i64 %104 to i32
%108 = shl i32 %107, 1
%109 = add i32 %21, %108
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %2, i64 %110
%112 = load double, double* %111
%113 = tail call i64 @cos(double %112)
%114 = sub nsw i64 %106, %113
%115 = tail call double @log_conv(i64 %114)
%116 = tail call double @llvm.fmuladd.f64(double %115, double 2.000000e+00, double %105)
%117 = add nuw nsw i64 %104, 1
%118 = icmp eq i64 %117, %33
br i1 %118, label %119, label %103
119: ; preds = %103, %87
%120 = phi double [ 0.000000e+00, %87 ], [ %116, %103 ]
%121 = tail call i64 @sin(double %41)
%122 = tail call double @log_conv(i64 %121)
%123 = tail call double @llvm.fmuladd.f64(double %122, double 2.000000e+00, double %120)
%124 = tail call i32 @log(double 2.000000e+00)
%125 = sitofp i32 %124 to double
%126 = tail call i32 @log_add(double %88, double %123)
%127 = sitofp i32 %126 to double
%128 = tail call double @llvm.fmuladd.f64(double %23, double %125, double %127)
br label %129
129: ; preds = %119, %71
%130 = phi double [ %86, %71 ], [ %128, %119 ]
%131 = fmul double %130, -5.000000e-01
%132 = getelementptr inbounds double, double* %4, i64 %36
%133 = fmul double %26, %131
store double %133, double* %132
br i1 %27, label %134, label %137
134: ; preds = %129
%135 = load double, double* %2
%136 = fadd double %133, %135
store double %136, double* %132
br label %137
137: ; preds = %129, %134
%138 = add nuw nsw i64 %36, 1
%139 = icmp eq i64 %138, %31
br i1 %139, label %140, label %35
140: ; preds = %137, %7
ret void
}