#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 /*<<< orphan*/ envelope_matrix(double **, double **, int, int, double,
                                   double, double, int /*<<< orphan*/);
int /*<<< orphan*/ filter_image(double **, double **, int, int);
int /*<<< orphan*/ free(double **);
int /*<<< orphan*/ gray_log(double **, double **, int, int);
int int_pow(int, int);
int /*<<< orphan*/ load_image(double **, int, int, char *);
scalar_t__ malloc(int);
scalar_t__ power_two(int, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ write_image(double **, int, int, char *);
int /*<<< orphan*/ zero_padding_matrix(double **, double **, int, int, int,
                                       int);
int main(int argc, char *argv[]) {
  int len = 8445, pad_len = 0, line = 128;
  ;
  int powd;
  double **sig = NULL, **pad = NULL, **env = NULL, **env2 = NULL;
  int i = 0;
  if (power_two(len, &powd)) {
    powd++;
  }
  pad_len = int_pow(2, powd);
  printf("pad_len = %i\n", pad_len);
  sig = (double **)malloc(len * sizeof(double *));
  pad = (double **)malloc(pad_len * sizeof(double *));
  env = (double **)malloc(pad_len * sizeof(double *));
  env2 = (double **)malloc(pad_len * sizeof(double *));
  for (i = 0; i < len; i++) {
    sig[i] = (double *)malloc(line * sizeof(double));
    pad[i] = (double *)malloc(line * sizeof(double));
    env[i] = (double *)malloc(line * sizeof(double));
    env2[i] = (double *)malloc(line * sizeof(double));
  }
  for (i = len; i < pad_len; i++) {
    pad[i] = (double *)malloc(line * sizeof(double));
    env[i] = (double *)malloc(line * sizeof(double));
    env2[i] = (double *)malloc(line * sizeof(double));
  }
  double f = 125000000.0;
  load_image(sig, len, line, "int10.txt");
  zero_padding_matrix(sig, pad, len, line, pad_len, 1);
  write_image(pad, pad_len, line, "im_pad.txt");
  envelope_matrix(pad, env, pad_len, line, f, 500000.0, 5500000.0, 0);
  write_image(env, len, line, "im_env.txt");
  gray_log(env, env2, len, line);
  write_image(env2, len, line, "im_log.txt");
  filter_image(env, env2, len, line);
  write_image(env2, len, line, "im2_env.txt");
  free(sig);
  free(pad);
  free(env);
  free(env2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x20fd,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x80,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1040 <power_two@plt>
cmp    $0x0,%rax
je     1221 <main+0x71>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
mov    $0x2,%edi
call   1060 <int_pow@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xddd(%rip),%rdi
call   1070 <printf@plt>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x38(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1325 <main+0x175>
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1293 <main+0xe3>
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    139f <main+0x1ef>
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    132b <main+0x17b>
movsd  0xc69(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xc69(%rip),%rcx
call   10b0 <load_image@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x1,%r9d
call   1050 <zero_padding_matrix@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xc40(%rip),%rcx
call   10d0 <write_image@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
movsd  -0x50(%rbp),%xmm0
movsd  0xbf0(%rip),%xmm1
movsd  0xbf0(%rip),%xmm2
xor    %r8d,%r8d
call   1080 <envelope_matrix@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xc0a(%rip),%rcx
call   10d0 <write_image@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1090 <gray_log@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xbec(%rip),%rcx
call   10d0 <write_image@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   10a0 <filter_image@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xbce(%rip),%rcx
call   10d0 <write_image@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xc(%rsp),%rsi
mov    $0x20fd,%edi
call   1040 <power_two@plt>
mov    0xc(%rsp),%esi
test   %rax,%rax
je     11dd <main+0x2d>
add    $0x1,%esi
mov    %esi,0xc(%rsp)
mov    $0x2,%edi
call   1060 <int_pow@plt>
mov    %eax,%r13d
lea    0xe27(%rip),%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    $0x107e8,%edi
call   10c0 <malloc@plt>
mov    %rax,%r14
lea    0x0(,%r13,8),%ebx
mov    %ebx,%edi
call   10c0 <malloc@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   10c0 <malloc@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   10c0 <malloc@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
nopl   (%rax)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,(%r14,%rbp,8)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,(%r15,%rbp,8)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,(%r12,%rbp,8)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    $0x20fd,%rbp
jne    1230 <main+0x80>
mov    %r13,0x10(%rsp)
cmp    $0x20fe,%r13d
jl     12c3 <main+0x113>
mov    0x10(%rsp),%ebp
mov    $0x20fd,%r13d
nopl   (%rax)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,(%r15,%r13,8)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,(%r12,%r13,8)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,(%rbx,%r13,8)
add    $0x1,%r13
cmp    %r13,%rbp
jne    1290 <main+0xe0>
lea    0xd5c(%rip),%rcx
mov    %r14,%rdi
mov    $0x20fd,%esi
mov    $0x80,%edx
call   10b0 <load_image@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x20fd,%edx
mov    $0x80,%ecx
mov    0x10(%rsp),%rbp
mov    %ebp,%r8d
mov    $0x1,%r9d
call   1050 <zero_padding_matrix@plt>
lea    0xd2a(%rip),%rcx
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x80,%edx
call   10d0 <write_image@plt>
movsd  0xce3(%rip),%xmm0
movsd  0xce3(%rip),%xmm1
movsd  0xce3(%rip),%xmm2
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    $0x80,%ecx
xor    %r8d,%r8d
call   1080 <envelope_matrix@plt>
lea    0xcf2(%rip),%rcx
mov    %r12,%rdi
mov    $0x20fd,%esi
mov    $0x80,%edx
call   10d0 <write_image@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x20fd,%edx
mov    $0x80,%ecx
call   1090 <gray_log@plt>
lea    0xccf(%rip),%rcx
mov    %rbx,%rdi
mov    $0x20fd,%esi
mov    $0x80,%edx
call   10d0 <write_image@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x20fd,%edx
mov    $0x80,%ecx
call   10a0 <filter_image@plt>
lea    0xcac(%rip),%rcx
mov    %rbx,%rdi
mov    $0x20fd,%esi
mov    $0x80,%edx
call   10d0 <write_image@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"pad_len = %i\0A\00"
@.str.1 = [10 x i8] c"int10.txt\00"
@.str.2 = [11 x i8] c"im_pad.txt\00"
@.str.3 = [11 x i8] c"im_env.txt\00"
@.str.4 = [11 x i8] c"im_log.txt\00"
@.str.5 = [12 x i8] c"im2_env.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double**
%11 = alloca double**
%12 = alloca double**
%13 = alloca double**
%14 = alloca i32
%15 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 8445, i32* %6
store i32 0, i32* %7
store i32 128, i32* %8
store double** null, double*** %10
store double** null, double*** %11
store double** null, double*** %12
store double** null, double*** %13
store i32 0, i32* %14
%16 = load i32, i32* %6
%17 = call i64 @power_two(i32 %16, i32* %9)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = load i32, i32* %9
%21 = add nsw i32 %20, 1
store i32 %21, i32* %9
br label %22
22: ; preds = %19, %2
%23 = load i32, i32* %9
%24 = call i32 @int_pow(i32 2, i32 %23)
store i32 %24, i32* %7
%25 = load i32, i32* %7
%26 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = mul i64 %28, 8
%30 = trunc i64 %29 to i32
%31 = call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to double**
store double** %32, double*** %10
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 8
%36 = trunc i64 %35 to i32
%37 = call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to double**
store double** %38, double*** %11
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = mul i64 %40, 8
%42 = trunc i64 %41 to i32
%43 = call i64 @malloc(i32 %42)
%44 = inttoptr i64 %43 to double**
store double** %44, double*** %12
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = mul i64 %46, 8
%48 = trunc i64 %47 to i32
%49 = call i64 @malloc(i32 %48)
%50 = inttoptr i64 %49 to double**
store double** %50, double*** %13
store i32 0, i32* %14
br label %51
51: ; preds = %96, %22
%52 = load i32, i32* %14
%53 = load i32, i32* %6
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %99
55: ; preds = %51
%56 = load i32, i32* %8
%57 = sext i32 %56 to i64
%58 = mul i64 %57, 8
%59 = trunc i64 %58 to i32
%60 = call i64 @malloc(i32 %59)
%61 = inttoptr i64 %60 to double*
%62 = load double**, double*** %10
%63 = load i32, i32* %14
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double*, double** %62, i64 %64
store double* %61, double** %65
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = mul i64 %67, 8
%69 = trunc i64 %68 to i32
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to double*
%72 = load double**, double*** %11
%73 = load i32, i32* %14
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double*, double** %72, i64 %74
store double* %71, double** %75
%76 = load i32, i32* %8
%77 = sext i32 %76 to i64
%78 = mul i64 %77, 8
%79 = trunc i64 %78 to i32
%80 = call i64 @malloc(i32 %79)
%81 = inttoptr i64 %80 to double*
%82 = load double**, double*** %12
%83 = load i32, i32* %14
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double*, double** %82, i64 %84
store double* %81, double** %85
%86 = load i32, i32* %8
%87 = sext i32 %86 to i64
%88 = mul i64 %87, 8
%89 = trunc i64 %88 to i32
%90 = call i64 @malloc(i32 %89)
%91 = inttoptr i64 %90 to double*
%92 = load double**, double*** %13
%93 = load i32, i32* %14
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double*, double** %92, i64 %94
store double* %91, double** %95
br label %96
96: ; preds = %55
%97 = load i32, i32* %14
%98 = add nsw i32 %97, 1
store i32 %98, i32* %14
br label %51
99: ; preds = %51
%100 = load i32, i32* %6
store i32 %100, i32* %14
br label %101
101: ; preds = %136, %99
%102 = load i32, i32* %14
%103 = load i32, i32* %7
%104 = icmp slt i32 %102, %103
br i1 %104, label %105, label %139
105: ; preds = %101
%106 = load i32, i32* %8
%107 = sext i32 %106 to i64
%108 = mul i64 %107, 8
%109 = trunc i64 %108 to i32
%110 = call i64 @malloc(i32 %109)
%111 = inttoptr i64 %110 to double*
%112 = load double**, double*** %11
%113 = load i32, i32* %14
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double*, double** %112, i64 %114
store double* %111, double** %115
%116 = load i32, i32* %8
%117 = sext i32 %116 to i64
%118 = mul i64 %117, 8
%119 = trunc i64 %118 to i32
%120 = call i64 @malloc(i32 %119)
%121 = inttoptr i64 %120 to double*
%122 = load double**, double*** %12
%123 = load i32, i32* %14
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double*, double** %122, i64 %124
store double* %121, double** %125
%126 = load i32, i32* %8
%127 = sext i32 %126 to i64
%128 = mul i64 %127, 8
%129 = trunc i64 %128 to i32
%130 = call i64 @malloc(i32 %129)
%131 = inttoptr i64 %130 to double*
%132 = load double**, double*** %13
%133 = load i32, i32* %14
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds double*, double** %132, i64 %134
store double* %131, double** %135
br label %136
136: ; preds = %105
%137 = load i32, i32* %14
%138 = add nsw i32 %137, 1
store i32 %138, i32* %14
br label %101
139: ; preds = %101
store double 1.250000e+08, double* %15
%140 = load double**, double*** %10
%141 = load i32, i32* %6
%142 = load i32, i32* %8
%143 = call i32 @load_image(double** %140, i32 %141, i32 %142, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%144 = load double**, double*** %10
%145 = load double**, double*** %11
%146 = load i32, i32* %6
%147 = load i32, i32* %8
%148 = load i32, i32* %7
%149 = call i32 @zero_padding_matrix(double** %144, double** %145, i32 %146, i32 %147, i32 %148, i32 1)
%150 = load double**, double*** %11
%151 = load i32, i32* %7
%152 = load i32, i32* %8
%153 = call i32 @write_image(double** %150, i32 %151, i32 %152, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%154 = load double**, double*** %11
%155 = load double**, double*** %12
%156 = load i32, i32* %7
%157 = load i32, i32* %8
%158 = load double, double* %15
%159 = call i32 @envelope_matrix(double** %154, double** %155, i32 %156, i32 %157, double %158, double 5.000000e+05, double 5.500000e+06, i32 0)
%160 = load double**, double*** %12
%161 = load i32, i32* %6
%162 = load i32, i32* %8
%163 = call i32 @write_image(double** %160, i32 %161, i32 %162, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%164 = load double**, double*** %12
%165 = load double**, double*** %13
%166 = load i32, i32* %6
%167 = load i32, i32* %8
%168 = call i32 @gray_log(double** %164, double** %165, i32 %166, i32 %167)
%169 = load double**, double*** %13
%170 = load i32, i32* %6
%171 = load i32, i32* %8
%172 = call i32 @write_image(double** %169, i32 %170, i32 %171, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%173 = load double**, double*** %12
%174 = load double**, double*** %13
%175 = load i32, i32* %6
%176 = load i32, i32* %8
%177 = call i32 @filter_image(double** %173, double** %174, i32 %175, i32 %176)
%178 = load double**, double*** %13
%179 = load i32, i32* %6
%180 = load i32, i32* %8
%181 = call i32 @write_image(double** %178, i32 %179, i32 %180, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%182 = load double**, double*** %10
%183 = call i32 @free(double** %182)
%184 = load double**, double*** %11
%185 = call i32 @free(double** %184)
%186 = load double**, double*** %12
%187 = call i32 @free(double** %186)
%188 = load double**, double*** %13
%189 = call i32 @free(double** %188)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"pad_len = %i\0A\00"
@.str.1 = [10 x i8] c"int10.txt\00"
@.str.2 = [11 x i8] c"im_pad.txt\00"
@.str.3 = [11 x i8] c"im_env.txt\00"
@.str.4 = [11 x i8] c"im_log.txt\00"
@.str.5 = [12 x i8] c"im2_env.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @power_two(i32 8445, i32* %3)
%6 = icmp eq i64 %5, 0
%7 = load i32, i32* %3
br i1 %6, label %10, label %8
8: ; preds = %2
%9 = add nsw i32 %7, 1
store i32 %9, i32* %3
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ %9, %8 ], [ %7, %2 ]
%12 = call i32 @int_pow(i32 2, i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i64 @malloc(i32 67560)
%15 = inttoptr i64 %14 to double**
%16 = shl i32 %12, 3
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to double**
%19 = call i64 @malloc(i32 %16)
%20 = inttoptr i64 %19 to double**
%21 = call i64 @malloc(i32 %16)
%22 = inttoptr i64 %21 to double**
br label %27
23: ; preds = %27
%24 = icmp sgt i32 %12, 8445
br i1 %24, label %25, label %56
25: ; preds = %23
%26 = zext i32 %12 to i64
br label %43
27: ; preds = %10, %27
%28 = phi i64 [ 0, %10 ], [ %41, %27 ]
%29 = call i64 @malloc(i32 1024)
%30 = inttoptr i64 %29 to double*
%31 = getelementptr inbounds double*, double** %15, i64 %28
store double* %30, double** %31
%32 = call i64 @malloc(i32 1024)
%33 = inttoptr i64 %32 to double*
%34 = getelementptr inbounds double*, double** %18, i64 %28
store double* %33, double** %34
%35 = call i64 @malloc(i32 1024)
%36 = inttoptr i64 %35 to double*
%37 = getelementptr inbounds double*, double** %20, i64 %28
store double* %36, double** %37
%38 = call i64 @malloc(i32 1024)
%39 = inttoptr i64 %38 to double*
%40 = getelementptr inbounds double*, double** %22, i64 %28
store double* %39, double** %40
%41 = add nuw nsw i64 %28, 1
%42 = icmp eq i64 %41, 8445
br i1 %42, label %23, label %27
43: ; preds = %25, %43
%44 = phi i64 [ 8445, %25 ], [ %54, %43 ]
%45 = call i64 @malloc(i32 1024)
%46 = inttoptr i64 %45 to double*
%47 = getelementptr inbounds double*, double** %18, i64 %44
store double* %46, double** %47
%48 = call i64 @malloc(i32 1024)
%49 = inttoptr i64 %48 to double*
%50 = getelementptr inbounds double*, double** %20, i64 %44
store double* %49, double** %50
%51 = call i64 @malloc(i32 1024)
%52 = inttoptr i64 %51 to double*
%53 = getelementptr inbounds double*, double** %22, i64 %44
store double* %52, double** %53
%54 = add nuw nsw i64 %44, 1
%55 = icmp eq i64 %54, %26
br i1 %55, label %56, label %43
56: ; preds = %43, %23
%57 = call i32 @load_image(double** %15, i32 8445, i32 128, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%58 = call i32 @zero_padding_matrix(double** %15, double** %18, i32 8445, i32 128, i32 %12, i32 1)
%59 = call i32 @write_image(double** %18, i32 %12, i32 128, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%60 = call i32 @envelope_matrix(double** %18, double** %20, i32 %12, i32 128, double 1.250000e+08, double 5.000000e+05, double 5.500000e+06, i32 0)
%61 = call i32 @write_image(double** %20, i32 8445, i32 128, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%62 = call i32 @gray_log(double** %20, double** %22, i32 8445, i32 128)
%63 = call i32 @write_image(double** %22, i32 8445, i32 128, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 @filter_image(double** %20, double** %22, i32 8445, i32 128)
%65 = call i32 @write_image(double** %22, i32 8445, i32 128, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%66 = call i32 @free(double** %15)
%67 = call i32 @free(double** %18)
%68 = call i32 @free(double** %20)
%69 = call i32 @free(double** %22)
ret i32 0
}