#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 */
float log(double);
void correction(float *tilt, float *noise, float *codebook, float *corrbook,
                int num_codes) {
  float aux[32 + 1];
  double exp();
  int i, j, offset;
  void resfft();
  for (i = 0, offset = 0; i < num_codes; i++, offset += (12 + 1)) {
    for (j = 0; j <= 12; j++)
      aux[j] = noise[j] - tilt[j] - codebook[offset + j];
    for (j = 12 + 1; j <= 32; j++)
      aux[j] = 0.0;
    resfft(aux, 32, 5);
    for (j = 0; j <= 32; j++)
      aux[j] = log(exp((double)aux[j]) + 1.0);
    resfft(aux, 32, 5);
    for (j = 0; j <= 12; j++)
      corrbook[offset + j] = aux[j] / 64;
  }
}


x86 assembly (clang, -O0):
<correction>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xbc(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    133f <correction+0x20f>
movl   $0x0,-0xb8(%rbp)
cmpl   $0xc,-0xb8(%rbp)
jg     11e5 <correction+0xb5>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xb8(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
mov    -0xbc(%rbp),%ecx
add    -0xb8(%rbp),%ecx
movslq %ecx,%rcx
subss  (%rax,%rcx,4),%xmm0
movslq -0xb8(%rbp),%rax
movss  %xmm0,-0xb0(%rbp,%rax,4)
ff ff
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    117c <correction+0x4c>
movl   $0xd,-0xb8(%rbp)
cmpl   $0x20,-0xb8(%rbp)
jg     1223 <correction+0xf3>
movslq -0xb8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,-0xb0(%rbp,%rax,4)
ff ff
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    11ef <correction+0xbf>
lea    -0xb0(%rbp),%rdi
mov    $0x20,%esi
mov    $0x5,%edx
mov    $0x0,%al
call   1030 <resfft@plt>
movl   $0x0,-0xb8(%rbp)
cmpl   $0x20,-0xb8(%rbp)
jg     12a0 <correction+0x170>
movslq -0xb8(%rbp),%rax
movss  -0xb0(%rbp,%rax,4),%xmm0
ff ff
cvtss2sd %xmm0,%xmm0
call   1040 <exp@plt>
movsd  0xd95(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <log@plt>
movslq -0xb8(%rbp),%rax
movss  %xmm0,-0xb0(%rbp,%rax,4)
ff ff
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    1245 <correction+0x115>
lea    -0xb0(%rbp),%rdi
mov    $0x20,%esi
mov    $0x5,%edx
mov    $0x0,%al
call   1030 <resfft@plt>
movl   $0x0,-0xb8(%rbp)
cmpl   $0xc,-0xb8(%rbp)
jg     1317 <correction+0x1e7>
movslq -0xb8(%rbp),%rax
movss  -0xb0(%rbp,%rax,4),%xmm0
ff ff
movss  0xd19(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0xbc(%rbp),%ecx
add    -0xb8(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    12c2 <correction+0x192>
jmp    131c <correction+0x1ec>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
mov    -0xbc(%rbp),%eax
add    $0xd,%eax
mov    %eax,-0xbc(%rbp)
jmp    1163 <correction+0x33>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<correction>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rcx,0x18(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rsi,0x8(%rsp)
mov    %r8d,0x4(%rsp)
test   %r8d,%r8d
jle    12b2 <correction+0x182>
mov    %rdi,%rbp
lea    0x20(%rsp),%rbx
xor    %r13d,%r13d
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    0x8(%rsp),%rcx
movups (%rcx),%xmm0
movups 0x0(%rbp),%xmm1
subps  %xmm1,%xmm0
mov    0x10(%rsp),%rax
movups (%rax,%r13,4),%xmm1
subps  %xmm1,%xmm0
movaps %xmm0,0x20(%rsp)
movups 0x10(%rcx),%xmm0
movups 0x10(%rbp),%xmm1
subps  %xmm1,%xmm0
movups 0x10(%rax,%r13,4),%xmm1
subps  %xmm1,%xmm0
movaps %xmm0,0x30(%rsp)
movups 0x20(%rcx),%xmm0
movups 0x20(%rbp),%xmm1
subps  %xmm1,%xmm0
movups 0x20(%rax,%r13,4),%xmm1
subps  %xmm1,%xmm0
movaps %xmm0,0x40(%rsp)
movss  0x30(%rcx),%xmm0
subss  0x30(%rbp),%xmm0
subss  0x30(%rax,%r13,4),%xmm0
movss  %xmm0,0x50(%rsp)
lea    0x54(%rsp),%rax
xorps  %xmm0,%xmm0
movups %xmm0,0x40(%rax)
movups %xmm0,0x30(%rax)
movups %xmm0,0x20(%rax)
movups %xmm0,0x10(%rax)
movups %xmm0,(%rax)
mov    %rbx,%r12
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <resfft@plt>
xor    %r15d,%r15d
nop
movss  0x20(%rsp,%r15,4),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <exp@plt>
addsd  0xdd8(%rip),%xmm0
call   1050 <log@plt>
movss  %xmm0,0x20(%rsp,%r15,4)
add    $0x1,%r15
cmp    $0x21,%r15
jne    1210 <correction+0xe0>
mov    %r12,%rbx
mov    %r12,%rdi
mov    $0x20,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <resfft@plt>
movaps 0x20(%rsp),%xmm0
movaps 0xdaf(%rip),%xmm1
mulps  %xmm1,%xmm0
mov    0x18(%rsp),%rax
movups %xmm0,(%rax,%r13,4)
movaps 0x30(%rsp),%xmm0
mulps  %xmm1,%xmm0
movups %xmm0,0x10(%rax,%r13,4)
movaps 0x40(%rsp),%xmm0
mulps  %xmm1,%xmm0
movups %xmm0,0x20(%rax,%r13,4)
movss  0x50(%rsp),%xmm0
mulss  0xd88(%rip),%xmm0
movss  %xmm0,0x30(%rax,%r13,4)
add    $0x1,%r14d
add    $0xd,%r13
cmp    0x4(%rsp),%r14d
jne    1170 <correction+0x40>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @correction(float* %0, float* %1, float* %2, float* %3, i32 %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca i32
%11 = alloca [33 x float]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store float* %3, float** %9
store i32 %4, i32* %10
store i32 0, i32* %12
store i32 0, i32* %14
br label %15
15: ; preds = %101, %5
%16 = load i32, i32* %12
%17 = load i32, i32* %10
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %106
19: ; preds = %15
store i32 0, i32* %13
br label %20
20: ; preds = %46, %19
%21 = load i32, i32* %13
%22 = icmp sle i32 %21, 12
br i1 %22, label %23, label %49
23: ; preds = %20
%24 = load float*, float** %7
%25 = load i32, i32* %13
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds float, float* %24, i64 %26
%28 = load float, float* %27
%29 = load float*, float** %6
%30 = load i32, i32* %13
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %29, i64 %31
%33 = load float, float* %32
%34 = fsub float %28, %33
%35 = load float*, float** %8
%36 = load i32, i32* %14
%37 = load i32, i32* %13
%38 = add nsw i32 %36, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %35, i64 %39
%41 = load float, float* %40
%42 = fsub float %34, %41
%43 = load i32, i32* %13
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [33 x float], [33 x float]* %11, i64 0, i64 %44
store float %42, float* %45
br label %46
46: ; preds = %23
%47 = load i32, i32* %13
%48 = add nsw i32 %47, 1
store i32 %48, i32* %13
br label %20
49: ; preds = %20
store i32 13, i32* %13
br label %50
50: ; preds = %57, %49
%51 = load i32, i32* %13
%52 = icmp sle i32 %51, 32
br i1 %52, label %53, label %60
53: ; preds = %50
%54 = load i32, i32* %13
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [33 x float], [33 x float]* %11, i64 0, i64 %55
store float 0.000000e+00, float* %56
br label %57
57: ; preds = %53
%58 = load i32, i32* %13
%59 = add nsw i32 %58, 1
store i32 %59, i32* %13
br label %50
60: ; preds = %50
%61 = getelementptr inbounds [33 x float], [33 x float]* %11, i64 0, i64 0
store i32 0, i32* %13
br label %62
62: ; preds = %77, %60
%63 = load i32, i32* %13
%64 = icmp sle i32 %63, 32
br i1 %64, label %65, label %80
65: ; preds = %62
%66 = load i32, i32* %13
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [33 x float], [33 x float]* %11, i64 0, i64 %67
%69 = load float, float* %68
%70 = fpext float %69 to double
%71 = call double @exp(double %70)
%72 = fadd double %71, 1.000000e+00
%73 = call float @log(double %72)
%74 = load i32, i32* %13
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [33 x float], [33 x float]* %11, i64 0, i64 %75
store float %73, float* %76
br label %77
77: ; preds = %65
%78 = load i32, i32* %13
%79 = add nsw i32 %78, 1
store i32 %79, i32* %13
br label %62
80: ; preds = %62
%81 = getelementptr inbounds [33 x float], [33 x float]* %11, i64 0, i64 0
store i32 0, i32* %13
br label %82
82: ; preds = %97, %80
%83 = load i32, i32* %13
%84 = icmp sle i32 %83, 12
br i1 %84, label %85, label %100
85: ; preds = %82
%86 = load i32, i32* %13
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [33 x float], [33 x float]* %11, i64 0, i64 %87
%89 = load float, float* %88
%90 = fdiv float %89, 6.400000e+01
%91 = load float*, float** %9
%92 = load i32, i32* %14
%93 = load i32, i32* %13
%94 = add nsw i32 %92, %93
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds float, float* %91, i64 %95
store float %90, float* %96
br label %97
97: ; preds = %85
%98 = load i32, i32* %13
%99 = add nsw i32 %98, 1
store i32 %99, i32* %13
br label %82
100: ; preds = %82
br label %101
101: ; preds = %100
%102 = load i32, i32* %12
%103 = add nsw i32 %102, 1
store i32 %103, i32* %12
%104 = load i32, i32* %14
%105 = add nsw i32 %104, 13
store i32 %105, i32* %14
br label %15
106: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @correction(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture writeonly %3, i32 %4) {
%6 = alloca [33 x float]
%7 = bitcast [33 x float]* %6 to i8*
%8 = icmp sgt i32 %4, 0
br i1 %8, label %9, label %96
9: ; preds = %5
%10 = getelementptr inbounds [33 x float], [33 x float]* %6, i64 0, i64 0
%11 = getelementptr inbounds [33 x float], [33 x float]* %6, i64 0, i64 13
%12 = bitcast float* %11 to i8*
%13 = getelementptr inbounds float, float* %1, i64 4
%14 = getelementptr inbounds float, float* %0, i64 4
%15 = getelementptr inbounds [33 x float], [33 x float]* %6, i64 0, i64 4
%16 = getelementptr inbounds float, float* %1, i64 8
%17 = getelementptr inbounds float, float* %0, i64 8
%18 = getelementptr inbounds [33 x float], [33 x float]* %6, i64 0, i64 8
%19 = getelementptr inbounds float, float* %1, i64 12
%20 = getelementptr inbounds float, float* %0, i64 12
%21 = getelementptr inbounds [33 x float], [33 x float]* %6, i64 0, i64 12
%22 = bitcast float* %1 to <4 x float>*
%23 = bitcast float* %0 to <4 x float>*
%24 = bitcast [33 x float]* %6 to <4 x float>*
%25 = bitcast float* %13 to <4 x float>*
%26 = bitcast float* %14 to <4 x float>*
%27 = bitcast float* %15 to <4 x float>*
%28 = bitcast float* %16 to <4 x float>*
%29 = bitcast float* %17 to <4 x float>*
%30 = bitcast float* %18 to <4 x float>*
%31 = bitcast [33 x float]* %6 to <4 x float>*
%32 = bitcast float* %15 to <4 x float>*
%33 = bitcast float* %18 to <4 x float>*
br label %34
34: ; preds = %9, %77
%35 = phi i64 [ 0, %9 ], [ %94, %77 ]
%36 = phi i32 [ 0, %9 ], [ %93, %77 ]
%37 = getelementptr inbounds float, float* %2, i64 %35
%38 = load <4 x float>, <4 x float>* %22
%39 = load <4 x float>, <4 x float>* %23
%40 = fsub <4 x float> %38, %39
%41 = bitcast float* %37 to <4 x float>*
%42 = load <4 x float>, <4 x float>* %41
%43 = fsub <4 x float> %40, %42
store <4 x float> %43, <4 x float>* %24
%44 = add nuw nsw i64 %35, 4
%45 = getelementptr inbounds float, float* %2, i64 %44
%46 = load <4 x float>, <4 x float>* %25
%47 = load <4 x float>, <4 x float>* %26
%48 = fsub <4 x float> %46, %47
%49 = bitcast float* %45 to <4 x float>*
%50 = load <4 x float>, <4 x float>* %49
%51 = fsub <4 x float> %48, %50
store <4 x float> %51, <4 x float>* %27
%52 = add nuw nsw i64 %35, 8
%53 = getelementptr inbounds float, float* %2, i64 %52
%54 = load <4 x float>, <4 x float>* %28
%55 = load <4 x float>, <4 x float>* %29
%56 = fsub <4 x float> %54, %55
%57 = bitcast float* %53 to <4 x float>*
%58 = load <4 x float>, <4 x float>* %57
%59 = fsub <4 x float> %56, %58
store <4 x float> %59, <4 x float>* %30
%60 = load float, float* %19
%61 = load float, float* %20
%62 = fsub float %60, %61
%63 = add nuw nsw i64 %35, 12
%64 = getelementptr inbounds float, float* %2, i64 %63
%65 = load float, float* %64
%66 = fsub float %62, %65
store float %66, float* %21
br label %67
67: ; preds = %34, %67
%68 = phi i64 [ 0, %34 ], [ %75, %67 ]
%69 = getelementptr inbounds [33 x float], [33 x float]* %6, i64 0, i64 %68
%70 = load float, float* %69
%71 = fpext float %70 to double
%72 = call double @exp(double %71)
%73 = fadd double %72, 1.000000e+00
%74 = call float @log(double %73)
store float %74, float* %69
%75 = add nuw nsw i64 %68, 1
%76 = icmp eq i64 %75, 33
br i1 %76, label %77, label %67
77: ; preds = %67
%78 = getelementptr inbounds float, float* %3, i64 %35
%79 = load <4 x float>, <4 x float>* %31
%80 = fmul <4 x float> %79, <float 1.562500e-02, float 1.562500e-02, float 1.562500e-02, float 1.562500e-02>
%81 = bitcast float* %78 to <4 x float>*
store <4 x float> %80, <4 x float>* %81
%82 = getelementptr inbounds float, float* %3, i64 %44
%83 = load <4 x float>, <4 x float>* %32
%84 = fmul <4 x float> %83, <float 1.562500e-02, float 1.562500e-02, float 1.562500e-02, float 1.562500e-02>
%85 = bitcast float* %82 to <4 x float>*
store <4 x float> %84, <4 x float>* %85
%86 = getelementptr inbounds float, float* %3, i64 %52
%87 = load <4 x float>, <4 x float>* %33
%88 = fmul <4 x float> %87, <float 1.562500e-02, float 1.562500e-02, float 1.562500e-02, float 1.562500e-02>
%89 = bitcast float* %86 to <4 x float>*
store <4 x float> %88, <4 x float>* %89
%90 = load float, float* %21
%91 = fmul float %90, 1.562500e-02
%92 = getelementptr inbounds float, float* %3, i64 %63
store float %91, float* %92
%93 = add nuw nsw i32 %36, 1
%94 = add nuw nsw i64 %35, 13
%95 = icmp eq i32 %93, %4
br i1 %95, label %96, label %34
96: ; preds = %77, %5
ret void
}