#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 FILENAME_MAX;
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ gaussconv_dct(double *, double *, int, int, double);
scalar_t__ malloc(int);
int /*<<< orphan*/ printImage(double *, int, int, char *);
int /*<<< orphan*/ printImage_LinearConversion(double *, int, int, char *);
int /*<<< orphan*/ print_usage();
double *read_image_to_gray(char *, int *, int *);
double rmse(double *, double *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
double sqrt(double);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  double sigma;
  int N;
  switch (argc) {
  case 5:
    sigma = atof(argv[2]);
    N = atoi(argv[3]);
    break;
  default:
    print_usage();
    return -1;
  }
  int w, h;
  double *x = read_image_to_gray(argv[1], &w, &h);
  double *t = (double *)malloc(w * h * sizeof(double));
  double *y1 = (double *)malloc(w * h * sizeof(double));
  double *y2 = (double *)malloc(w * h * sizeof(double));
  double *d = (double *)malloc(w * h * sizeof(double));
  gaussconv_dct(x, y1, w, h, sqrt((double)N) * sigma);
  for (int j = 0; j < w * h; j++)
    t[j] = x[j];
  for (int i = 0; i < N; i++) {
    gaussconv_dct(t, y2, w, h, sigma);
    for (int j = 0; j < w * h; j++)
      t[j] = y2[j];
  }
  for (int j = 0; j < w * h; j++) {
    d[j] = y1[j] - y2[j];
  }
  char name[FILENAME_MAX];
  sprintf(name, "%s_direct.png", argv[4]);
  printImage(y1, w, h, name);
  sprintf(name, "%s_iter.png", argv[4]);
  printImage(y2, w, h, name);
  sprintf(name, "%s_diff.png", argv[4]);
  printImage_LinearConversion(d, w, h, name);
  double err = rmse(y1, y2, w * h);
  fprintf(stdout, "RMSE = %g \n", err);
  free(x);
  free(t);
  free(y1);
  free(y2);
  free(d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x5,%eax
jne    1221 <main+0x51>
jmp    11fa <main+0x2a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1234 <main+0x64>
mov    $0x0,%al
call   10f0 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    152e <main+0x35e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   10a0 <read_image_to_gray@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x7c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
call   10c0 <sqrt@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    -0x80(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mulsd  -0x18(%rbp),%xmm0
call   1070 <gaussconv_dct@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    1338 <main+0x168>
mov    -0x30(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12fe <main+0x12e>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    13b7 <main+0x1e7>
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
movsd  -0x18(%rbp),%xmm0
call   1070 <gaussconv_dct@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    13a4 <main+0x1d4>
mov    -0x48(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    136a <main+0x19a>
jmp    13a9 <main+0x1d9>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    133f <main+0x16f>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    1405 <main+0x235>
mov    -0x40(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x60(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    13be <main+0x1ee>
mov    0x2bdc(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x98(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xbbd(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x98(%rbp),%rcx
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   10d0 <printImage@plt>
mov    -0x98(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xb9a(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x98(%rbp),%rcx
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   10d0 <printImage@plt>
mov    -0x98(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xb75(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x98(%rbp),%rcx
mov    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1060 <printImage_LinearConversion@plt>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x20(%rbp),%edx
imul   -0x24(%rbp),%edx
call   1040 <rmse@plt>
movsd  %xmm0,-0x78(%rbp)
mov    0x2af8(%rip),%rax
mov    (%rax),%edi
movsd  -0x78(%rbp),%xmm0
lea    0xb38(%rip),%rsi
call   1080 <fprintf@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>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x5,%edi
jne    1286 <main+0xb6>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x48(%rbp)
mov    0x18(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %rbx,-0x58(%rbp)
mov    0x8(%rbx),%rdi
mov    %eax,%ebx
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   10a0 <read_image_to_gray@plt>
mov    %rax,%r14
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1090 <malloc@plt>
mov    %rax,%r13
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1090 <malloc@plt>
mov    -0x30(%rbp),%edx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mov    -0x2c(%rbp),%r15d
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %rax,-0x50(%rbp)
jb     1297 <main+0xc7>
sqrtsd %xmm0,%xmm0
jmp    12a2 <main+0xd2>
xor    %eax,%eax
call   10f0 <print_usage@plt>
mov    $0xffffffff,%eax
jmp    194a <main+0x77a>
mov    %edx,-0x34(%rbp)
call   10c0 <sqrt@plt>
mov    -0x34(%rbp),%edx
mulsd  -0x48(%rbp),%xmm0
mov    %r14,%rdi
mov    -0x40(%rbp),%rsi
mov    %r15d,%ecx
call   1070 <gaussconv_dct@plt>
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    %ecx,%r9d
imul   %edx,%r9d
test   %r9d,%r9d
jle    147a <main+0x2aa>
mov    %r9d,%r10d
cmp    $0x4,%r9d
jb     12f6 <main+0x126>
lea    (%r14,%r10,8),%rax
cmp    %rax,%r13
jae    1385 <main+0x1b5>
lea    0x0(,%r10,8),%rax
add    %r13,%rax
cmp    %rax,%r14
jae    1385 <main+0x1b5>
xor    %edi,%edi
mov    %rdi,%rax
not    %rax
add    %r10,%rax
mov    %r10,%rsi
and    $0x3,%rsi
je     1327 <main+0x157>
nopw   0x0(%rax,%rax,1)
movsd  (%r14,%rdi,8),%xmm0
movsd  %xmm0,0x0(%r13,%rdi,8)
add    $0x1,%rdi
add    $0xffffffffffffffff,%rsi
jne    1310 <main+0x140>
cmp    $0x3,%rax
jb     147a <main+0x2aa>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rdi,8),%xmm0
movsd  %xmm0,0x0(%r13,%rdi,8)
movsd  0x8(%r14,%rdi,8),%xmm0
movsd  %xmm0,0x8(%r13,%rdi,8)
movsd  0x10(%r14,%rdi,8),%xmm0
movsd  %xmm0,0x10(%r13,%rdi,8)
movsd  0x18(%r14,%rdi,8),%xmm0
movsd  %xmm0,0x18(%r13,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%r10
jne    1340 <main+0x170>
jmp    147a <main+0x2aa>
mov    %r10d,%edi
and    $0xfffffffc,%edi
lea    -0x4(%rdi),%rsi
mov    %rsi,%rax
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r8d
and    $0x3,%r8d
cmp    $0xc,%rsi
jae    13ae <main+0x1de>
xor    %esi,%esi
jmp    142d <main+0x25d>
and    $0xfffffffffffffffc,%rax
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups (%r14,%rsi,8),%xmm0
movups 0x10(%r14,%rsi,8),%xmm1
movups %xmm0,0x0(%r13,%rsi,8)
movups %xmm1,0x10(%r13,%rsi,8)
movups 0x20(%r14,%rsi,8),%xmm0
movups 0x30(%r14,%rsi,8),%xmm1
movups %xmm0,0x20(%r13,%rsi,8)
movups %xmm1,0x30(%r13,%rsi,8)
movups 0x40(%r14,%rsi,8),%xmm0
movups 0x50(%r14,%rsi,8),%xmm1
movups %xmm0,0x40(%r13,%rsi,8)
movups %xmm1,0x50(%r13,%rsi,8)
movupd 0x60(%r14,%rsi,8),%xmm0
movupd 0x70(%r14,%rsi,8),%xmm1
movupd %xmm0,0x60(%r13,%rsi,8)
movupd %xmm1,0x70(%r13,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rax
jne    13c0 <main+0x1f0>
test   %r8,%r8
je     1471 <main+0x2a1>
lea    0x10(,%rsi,8),%r11
add    %r13,%r11
lea    (%r14,%rsi,8),%rsi
add    $0x10,%rsi
shl    $0x5,%r8
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movupd -0x10(%rsi,%rax,1),%xmm0
movupd (%rsi,%rax,1),%xmm1
movupd %xmm0,-0x10(%r11,%rax,1)
movupd %xmm1,(%r11,%rax,1)
add    $0x20,%rax
cmp    %rax,%r8
jne    1450 <main+0x280>
cmp    %r10,%rdi
jne    12f8 <main+0x128>
test   %ebx,%ebx
jle    1680 <main+0x4b0>
lea    0x10(%r13),%rax
mov    %rax,-0x68(%rbp)
lea    0x10(%r12),%rax
mov    %rax,-0x60(%rbp)
xor    %r15d,%r15d
mov    %ebx,-0x34(%rbp)
jmp    14ad <main+0x2dd>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    %ebx,%r15d
je     1680 <main+0x4b0>
mov    %r13,%rdi
mov    %r12,%rsi
movsd  -0x48(%rbp),%xmm0
call   1070 <gaussconv_dct@plt>
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    %ecx,%r9d
imul   %edx,%r9d
test   %r9d,%r9d
jle    14a0 <main+0x2d0>
mov    %r9d,%r10d
cmp    $0x4,%r9d
jb     14f9 <main+0x329>
lea    (%r12,%r10,8),%rax
cmp    %rax,%r13
jae    1585 <main+0x3b5>
lea    0x0(,%r10,8),%rax
add    %r13,%rax
cmp    %rax,%r12
jae    1585 <main+0x3b5>
xor    %edi,%edi
mov    %rdi,%rax
not    %rax
add    %r10,%rax
mov    %r10,%rsi
and    $0x3,%rsi
je     1527 <main+0x357>
nopl   (%rax)
movsd  (%r12,%rdi,8),%xmm0
movsd  %xmm0,0x0(%r13,%rdi,8)
add    $0x1,%rdi
add    $0xffffffffffffffff,%rsi
jne    1510 <main+0x340>
cmp    $0x3,%rax
jb     14a0 <main+0x2d0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%rdi,8),%xmm0
movsd  %xmm0,0x0(%r13,%rdi,8)
movsd  0x8(%r12,%rdi,8),%xmm0
movsd  %xmm0,0x8(%r13,%rdi,8)
movsd  0x10(%r12,%rdi,8),%xmm0
movsd  %xmm0,0x10(%r13,%rdi,8)
movsd  0x18(%r12,%rdi,8),%xmm0
movsd  %xmm0,0x18(%r13,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%r10
jne    1540 <main+0x370>
jmp    14a0 <main+0x2d0>
mov    %r10d,%edi
and    $0xfffffffc,%edi
lea    -0x4(%rdi),%rsi
mov    %rsi,%rax
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r8d
and    $0x3,%r8d
cmp    $0xc,%rsi
jae    15ae <main+0x3de>
xor    %esi,%esi
jmp    162d <main+0x45d>
movabs $0x7ffffffffffffffc,%rsi
ff ff 7f
and    %rsi,%rax
xor    %esi,%esi
nopl   (%rax)
movups (%r12,%rsi,8),%xmm0
movups 0x10(%r12,%rsi,8),%xmm1
movups %xmm0,0x0(%r13,%rsi,8)
movups %xmm1,0x10(%r13,%rsi,8)
movups 0x20(%r12,%rsi,8),%xmm0
movups 0x30(%r12,%rsi,8),%xmm1
movups %xmm0,0x20(%r13,%rsi,8)
movups %xmm1,0x30(%r13,%rsi,8)
movups 0x40(%r12,%rsi,8),%xmm0
movups 0x50(%r12,%rsi,8),%xmm1
movups %xmm0,0x40(%r13,%rsi,8)
movups %xmm1,0x50(%r13,%rsi,8)
movupd 0x60(%r12,%rsi,8),%xmm0
movupd 0x70(%r12,%rsi,8),%xmm1
movupd %xmm0,0x60(%r13,%rsi,8)
movupd %xmm1,0x70(%r13,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rax
jne    15c0 <main+0x3f0>
test   %r8,%r8
je     166f <main+0x49f>
mov    -0x68(%rbp),%rax
lea    (%rax,%rsi,8),%rax
mov    -0x60(%rbp),%rbx
lea    (%rbx,%rsi,8),%rsi
shl    $0x5,%r8
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movupd -0x10(%rsi,%rbx,1),%xmm0
movupd (%rsi,%rbx,1),%xmm1
movupd %xmm0,-0x10(%rax,%rbx,1)
movupd %xmm1,(%rax,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%r8
jne    1650 <main+0x480>
cmp    %r10,%rdi
mov    -0x34(%rbp),%ebx
je     14a0 <main+0x2d0>
jmp    14fb <main+0x32b>
test   %r9d,%r9d
mov    -0x40(%rbp),%rcx
mov    -0x50(%rbp),%rbx
jle    185c <main+0x68c>
mov    %r9d,%r10d
cmp    $0x4,%r9d
jae    1747 <main+0x577>
xor    %eax,%eax
mov    %rax,%rdx
not    %rdx
add    %r10,%rdx
mov    %r10,%rsi
and    $0x3,%rsi
je     16da <main+0x50a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rcx,%rax,8),%xmm0
subsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%rbx,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rsi
jne    16c0 <main+0x4f0>
cmp    $0x3,%rdx
jb     185c <main+0x68c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rcx,%rax,8),%xmm0
subsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%rbx,%rax,8)
movsd  0x8(%rcx,%rax,8),%xmm0
subsd  0x8(%r12,%rax,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rax,8)
movsd  0x10(%rcx,%rax,8),%xmm0
subsd  0x10(%r12,%rax,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rax,8)
movsd  0x18(%rcx,%rax,8),%xmm0
subsd  0x18(%r12,%rax,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rax,8)
add    $0x4,%rax
cmp    %rax,%r10
jne    16f0 <main+0x520>
jmp    185c <main+0x68c>
lea    (%rbx,%r10,8),%rax
lea    (%rcx,%r10,8),%rdx
lea    (%r12,%r10,8),%rsi
cmp    %rdx,%rbx
setb   %dil
cmp    %rax,%rcx
setb   %r8b
cmp    %rsi,%rbx
setb   %dl
cmp    %rax,%r12
setb   %sil
xor    %eax,%eax
test   %r8b,%dil
jne    16a0 <main+0x4d0>
and    %sil,%dl
jne    16a0 <main+0x4d0>
mov    %r10d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rsi
mov    %rsi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1959 <main+0x789>
movabs $0x7ffffffffffffffc,%rdi
ff ff 7f
or     $0x2,%rdi
and    %rdx,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd (%rcx,%rsi,8),%xmm0
movupd 0x10(%rcx,%rsi,8),%xmm1
movupd (%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,(%rbx,%rsi,8)
movupd %xmm1,0x10(%rbx,%rsi,8)
movupd 0x20(%rcx,%rsi,8),%xmm0
movupd 0x30(%rcx,%rsi,8),%xmm1
movupd 0x20(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x30(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,0x20(%rbx,%rsi,8)
movupd %xmm1,0x30(%rbx,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    17c0 <main+0x5f0>
test   $0x1,%dl
je     1853 <main+0x683>
movupd (%rcx,%rsi,8),%xmm0
movupd 0x10(%rcx,%rsi,8),%xmm1
movupd (%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,(%rbx,%rsi,8)
movupd %xmm1,0x10(%rbx,%rsi,8)
cmp    %r10,%rax
jne    16a0 <main+0x4d0>
mov    %rsp,-0x48(%rbp)
mov    0x2781(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    -0x58(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0x777(%rip),%rsi
mov    %r15,%rdi
call   10e0 <sprintf@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x40(%rbp),%rdi
mov    %r15,%rcx
call   10d0 <printImage@plt>
mov    -0x58(%rbp),%rbx
mov    0x20(%rbx),%rdx
lea    0x75c(%rip),%rsi
mov    %r15,%rdi
call   10e0 <sprintf@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    %r12,%rdi
mov    %r15,%rcx
call   10d0 <printImage@plt>
mov    0x20(%rbx),%rdx
lea    0x744(%rip),%rsi
mov    %r15,%rdi
call   10e0 <sprintf@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x50(%rbp),%rdi
mov    %r15,%rcx
call   1060 <printImage_LinearConversion@plt>
mov    -0x2c(%rbp),%edx
imul   -0x30(%rbp),%edx
mov    -0x40(%rbp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <rmse@plt>
mov    0x26cb(%rip),%rax
mov    (%rax),%edi
lea    0x710(%rip),%rsi
call   1080 <fprintf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %esi,%esi
test   $0x1,%dl
jne    1828 <main+0x658>
jmp    1853 <main+0x683>

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

LLVM IR (-O2):
@FILENAME_MAX = global i32 0
@.str = [14 x i8] c"%s_direct.png\00"
@.str.1 = [12 x i8] c"%s_iter.png\00"
@.str.2 = [12 x i8] c"%s_diff.png\00"
@stdout = global i32 0
@.str.3 = [12 x i8] c"RMSE = %g \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = icmp eq i32 %0, 5
br i1 %5, label %6, label %163
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call double @atof(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = bitcast i32* %3 to i8*
%14 = bitcast i32* %4 to i8*
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call double* @read_image_to_gray(i8* %16, i32* %3, i32* %4)
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = shl i32 %18, 3
%21 = mul i32 %20, %19
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to double*
%24 = inttoptr i64 %22 to i8*
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = shl i32 %25, 3
%28 = mul i32 %27, %26
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to double*
%31 = inttoptr i64 %29 to i8*
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = shl i32 %32, 3
%35 = mul i32 %34, %33
%36 = call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to double*
%38 = inttoptr i64 %36 to i8*
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = shl i32 %39, 3
%42 = mul i32 %41, %40
%43 = call i64 @malloc(i32 %42)
%44 = inttoptr i64 %43 to double*
%45 = inttoptr i64 %43 to i8*
%46 = load i32, i32* %3
%47 = load i32, i32* %4
%48 = sitofp i32 %12 to double
%49 = call double @sqrt(double %48)
%50 = fmul double %9, %49
%51 = call i32 @gaussconv_dct(double* %17, double* %30, i32 %46, i32 %47, double %50)
%52 = load i32, i32* %3
%53 = load i32, i32* %4
%54 = mul i32 %53, %52
%55 = icmp sgt i32 %54, 0
br i1 %55, label %56, label %165
56: ; preds = %6
%57 = zext i32 %54 to i64
%58 = icmp ult i32 %54, 4
br i1 %58, label %145, label %59
59: ; preds = %56
%60 = getelementptr double, double* %23, i64 %57
%61 = getelementptr double, double* %17, i64 %57
%62 = bitcast double* %61 to i8*
%63 = icmp ult i8* %24, %62
%64 = icmp ult double* %17, %60
%65 = and i1 %63, %64
br i1 %65, label %145, label %66
66: ; preds = %59
%67 = and i64 %57, 4294967292
%68 = add nsw i64 %67, -4
%69 = lshr exact i64 %68, 2
%70 = add nuw nsw i64 %69, 1
%71 = and i64 %70, 3
%72 = icmp ult i64 %68, 12
br i1 %72, label %124, label %73
73: ; preds = %66
%74 = and i64 %70, 9223372036854775804
br label %75
75: ; preds = %75, %73
%76 = phi i64 [ 0, %73 ], [ %121, %75 ]
%77 = phi i64 [ 0, %73 ], [ %122, %75 ]
%78 = getelementptr inbounds double, double* %17, i64 %76
%79 = bitcast double* %78 to <2 x double>*
%80 = load <2 x double>, <2 x double>* %79
%81 = getelementptr inbounds double, double* %78, i64 2
%82 = bitcast double* %81 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = getelementptr inbounds double, double* %23, i64 %76
%85 = bitcast double* %84 to <2 x double>*
store <2 x double> %80, <2 x double>* %85
%86 = getelementptr inbounds double, double* %84, i64 2
%87 = bitcast double* %86 to <2 x double>*
store <2 x double> %83, <2 x double>* %87
%88 = or i64 %76, 4
%89 = getelementptr inbounds double, double* %17, i64 %88
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = getelementptr inbounds double, double* %89, i64 2
%93 = bitcast double* %92 to <2 x double>*
%94 = load <2 x double>, <2 x double>* %93
%95 = getelementptr inbounds double, double* %23, i64 %88
%96 = bitcast double* %95 to <2 x double>*
store <2 x double> %91, <2 x double>* %96
%97 = getelementptr inbounds double, double* %95, i64 2
%98 = bitcast double* %97 to <2 x double>*
store <2 x double> %94, <2 x double>* %98
%99 = or i64 %76, 8
%100 = getelementptr inbounds double, double* %17, i64 %99
%101 = bitcast double* %100 to <2 x double>*
%102 = load <2 x double>, <2 x double>* %101
%103 = getelementptr inbounds double, double* %100, i64 2
%104 = bitcast double* %103 to <2 x double>*
%105 = load <2 x double>, <2 x double>* %104
%106 = getelementptr inbounds double, double* %23, i64 %99
%107 = bitcast double* %106 to <2 x double>*
store <2 x double> %102, <2 x double>* %107
%108 = getelementptr inbounds double, double* %106, i64 2
%109 = bitcast double* %108 to <2 x double>*
store <2 x double> %105, <2 x double>* %109
%110 = or i64 %76, 12
%111 = getelementptr inbounds double, double* %17, i64 %110
%112 = bitcast double* %111 to <2 x double>*
%113 = load <2 x double>, <2 x double>* %112
%114 = getelementptr inbounds double, double* %111, i64 2
%115 = bitcast double* %114 to <2 x double>*
%116 = load <2 x double>, <2 x double>* %115
%117 = getelementptr inbounds double, double* %23, i64 %110
%118 = bitcast double* %117 to <2 x double>*
store <2 x double> %113, <2 x double>* %118
%119 = getelementptr inbounds double, double* %117, i64 2
%120 = bitcast double* %119 to <2 x double>*
store <2 x double> %116, <2 x double>* %120
%121 = add nuw i64 %76, 16
%122 = add nuw i64 %77, 4
%123 = icmp eq i64 %122, %74
br i1 %123, label %124, label %75
124: ; preds = %75, %66
%125 = phi i64 [ 0, %66 ], [ %121, %75 ]
%126 = icmp eq i64 %71, 0
br i1 %126, label %143, label %127
127: ; preds = %124, %127
%128 = phi i64 [ %140, %127 ], [ %125, %124 ]
%129 = phi i64 [ %141, %127 ], [ 0, %124 ]
%130 = getelementptr inbounds double, double* %17, i64 %128
%131 = bitcast double* %130 to <2 x double>*
%132 = load <2 x double>, <2 x double>* %131
%133 = getelementptr inbounds double, double* %130, i64 2
%134 = bitcast double* %133 to <2 x double>*
%135 = load <2 x double>, <2 x double>* %134
%136 = getelementptr inbounds double, double* %23, i64 %128
%137 = bitcast double* %136 to <2 x double>*
store <2 x double> %132, <2 x double>* %137
%138 = getelementptr inbounds double, double* %136, i64 2
%139 = bitcast double* %138 to <2 x double>*
store <2 x double> %135, <2 x double>* %139
%140 = add nuw i64 %128, 4
%141 = add i64 %129, 1
%142 = icmp eq i64 %141, %71
br i1 %142, label %143, label %127
143: ; preds = %127, %124
%144 = icmp eq i64 %67, %57
br i1 %144, label %165, label %145
145: ; preds = %59, %56, %143
%146 = phi i64 [ 0, %59 ], [ 0, %56 ], [ %67, %143 ]
%147 = xor i64 %146, -1
%148 = add nsw i64 %147, %57
%149 = and i64 %57, 3
%150 = icmp eq i64 %149, 0
br i1 %150, label %160, label %151
151: ; preds = %145, %151
%152 = phi i64 [ %157, %151 ], [ %146, %145 ]
%153 = phi i64 [ %158, %151 ], [ 0, %145 ]
%154 = getelementptr inbounds double, double* %17, i64 %152
%155 = load double, double* %154
%156 = getelementptr inbounds double, double* %23, i64 %152
store double %155, double* %156
%157 = add nuw nsw i64 %152, 1
%158 = add i64 %153, 1
%159 = icmp eq i64 %158, %149
br i1 %159, label %160, label %151
160: ; preds = %151, %145
%161 = phi i64 [ %146, %145 ], [ %157, %151 ]
%162 = icmp ult i64 %148, 3
br i1 %162, label %165, label %167
163: ; preds = %2
%164 = tail call i32 (...) @print_usage()
br label %505
165: ; preds = %160, %167, %143, %6
%166 = icmp sgt i32 %12, 0
br i1 %166, label %303, label %186
167: ; preds = %160, %167
%168 = phi i64 [ %184, %167 ], [ %161, %160 ]
%169 = getelementptr inbounds double, double* %17, i64 %168
%170 = load double, double* %169
%171 = getelementptr inbounds double, double* %23, i64 %168
store double %170, double* %171
%172 = add nuw nsw i64 %168, 1
%173 = getelementptr inbounds double, double* %17, i64 %172
%174 = load double, double* %173
%175 = getelementptr inbounds double, double* %23, i64 %172
store double %174, double* %175
%176 = add nuw nsw i64 %168, 2
%177 = getelementptr inbounds double, double* %17, i64 %176
%178 = load double, double* %177
%179 = getelementptr inbounds double, double* %23, i64 %176
store double %178, double* %179
%180 = add nuw nsw i64 %168, 3
%181 = getelementptr inbounds double, double* %17, i64 %180
%182 = load double, double* %181
%183 = getelementptr inbounds double, double* %23, i64 %180
store double %182, double* %183
%184 = add nuw nsw i64 %168, 4
%185 = icmp eq i64 %184, %57
br i1 %185, label %165, label %167
186: ; preds = %420, %165
%187 = phi i32 [ %54, %165 ], [ %310, %420 ]
%188 = icmp sgt i32 %187, 0
br i1 %188, label %189, label %442
189: ; preds = %186
%190 = zext i32 %187 to i64
%191 = icmp ult i32 %187, 4
br i1 %191, label %282, label %192
192: ; preds = %189
%193 = getelementptr double, double* %44, i64 %190
%194 = bitcast double* %193 to i8*
%195 = getelementptr double, double* %30, i64 %190
%196 = bitcast double* %195 to i8*
%197 = getelementptr double, double* %37, i64 %190
%198 = bitcast double* %197 to i8*
%199 = icmp ult i8* %45, %196
%200 = icmp ult i8* %31, %194
%201 = and i1 %199, %200
%202 = icmp ult i8* %45, %198
%203 = icmp ult i8* %38, %194
%204 = and i1 %202, %203
%205 = or i1 %201, %204
br i1 %205, label %282, label %206
206: ; preds = %192
%207 = and i64 %190, 4294967292
%208 = add nsw i64 %207, -4
%209 = lshr exact i64 %208, 2
%210 = add nuw nsw i64 %209, 1
%211 = and i64 %210, 1
%212 = icmp eq i64 %208, 0
br i1 %212, label %258, label %213
213: ; preds = %206
%214 = and i64 %210, 9223372036854775806
br label %215
215: ; preds = %215, %213
%216 = phi i64 [ 0, %213 ], [ %255, %215 ]
%217 = phi i64 [ 0, %213 ], [ %256, %215 ]
%218 = getelementptr inbounds double, double* %30, i64 %216
%219 = bitcast double* %218 to <2 x double>*
%220 = load <2 x double>, <2 x double>* %219
%221 = getelementptr inbounds double, double* %218, i64 2
%222 = bitcast double* %221 to <2 x double>*
%223 = load <2 x double>, <2 x double>* %222
%224 = getelementptr inbounds double, double* %37, i64 %216
%225 = bitcast double* %224 to <2 x double>*
%226 = load <2 x double>, <2 x double>* %225
%227 = getelementptr inbounds double, double* %224, i64 2
%228 = bitcast double* %227 to <2 x double>*
%229 = load <2 x double>, <2 x double>* %228
%230 = fsub <2 x double> %220, %226
%231 = fsub <2 x double> %223, %229
%232 = getelementptr inbounds double, double* %44, i64 %216
%233 = bitcast double* %232 to <2 x double>*
store <2 x double> %230, <2 x double>* %233
%234 = getelementptr inbounds double, double* %232, i64 2
%235 = bitcast double* %234 to <2 x double>*
store <2 x double> %231, <2 x double>* %235
%236 = or i64 %216, 4
%237 = getelementptr inbounds double, double* %30, i64 %236
%238 = bitcast double* %237 to <2 x double>*
%239 = load <2 x double>, <2 x double>* %238
%240 = getelementptr inbounds double, double* %237, i64 2
%241 = bitcast double* %240 to <2 x double>*
%242 = load <2 x double>, <2 x double>* %241
%243 = getelementptr inbounds double, double* %37, i64 %236
%244 = bitcast double* %243 to <2 x double>*
%245 = load <2 x double>, <2 x double>* %244
%246 = getelementptr inbounds double, double* %243, i64 2
%247 = bitcast double* %246 to <2 x double>*
%248 = load <2 x double>, <2 x double>* %247
%249 = fsub <2 x double> %239, %245
%250 = fsub <2 x double> %242, %248
%251 = getelementptr inbounds double, double* %44, i64 %236
%252 = bitcast double* %251 to <2 x double>*
store <2 x double> %249, <2 x double>* %252
%253 = getelementptr inbounds double, double* %251, i64 2
%254 = bitcast double* %253 to <2 x double>*
store <2 x double> %250, <2 x double>* %254
%255 = add nuw i64 %216, 8
%256 = add i64 %217, 2
%257 = icmp eq i64 %256, %214
br i1 %257, label %258, label %215
258: ; preds = %215, %206
%259 = phi i64 [ 0, %206 ], [ %255, %215 ]
%260 = icmp eq i64 %211, 0
br i1 %260, label %280, label %261
261: ; preds = %258
%262 = getelementptr inbounds double, double* %30, i64 %259
%263 = bitcast double* %262 to <2 x double>*
%264 = load <2 x double>, <2 x double>* %263
%265 = getelementptr inbounds double, double* %262, i64 2
%266 = bitcast double* %265 to <2 x double>*
%267 = load <2 x double>, <2 x double>* %266
%268 = getelementptr inbounds double, double* %37, i64 %259
%269 = bitcast double* %268 to <2 x double>*
%270 = load <2 x double>, <2 x double>* %269
%271 = getelementptr inbounds double, double* %268, i64 2
%272 = bitcast double* %271 to <2 x double>*
%273 = load <2 x double>, <2 x double>* %272
%274 = fsub <2 x double> %264, %270
%275 = fsub <2 x double> %267, %273
%276 = getelementptr inbounds double, double* %44, i64 %259
%277 = bitcast double* %276 to <2 x double>*
store <2 x double> %274, <2 x double>* %277
%278 = getelementptr inbounds double, double* %276, i64 2
%279 = bitcast double* %278 to <2 x double>*
store <2 x double> %275, <2 x double>* %279
br label %280
280: ; preds = %258, %261
%281 = icmp eq i64 %207, %190
br i1 %281, label %442, label %282
282: ; preds = %192, %189, %280
%283 = phi i64 [ 0, %192 ], [ 0, %189 ], [ %207, %280 ]
%284 = xor i64 %283, -1
%285 = add nsw i64 %284, %190
%286 = and i64 %190, 3
%287 = icmp eq i64 %286, 0
br i1 %287, label %300, label %288
288: ; preds = %282, %288
%289 = phi i64 [ %297, %288 ], [ %283, %282 ]
%290 = phi i64 [ %298, %288 ], [ 0, %282 ]
%291 = getelementptr inbounds double, double* %30, i64 %289
%292 = load double, double* %291
%293 = getelementptr inbounds double, double* %37, i64 %289
%294 = load double, double* %293
%295 = fsub double %292, %294
%296 = getelementptr inbounds double, double* %44, i64 %289
store double %295, double* %296
%297 = add nuw nsw i64 %289, 1
%298 = add i64 %290, 1
%299 = icmp eq i64 %298, %286
br i1 %299, label %300, label %288
300: ; preds = %288, %282
%301 = phi i64 [ %283, %282 ], [ %297, %288 ]
%302 = icmp ult i64 %285, 3
br i1 %302, label %442, label %474
303: ; preds = %165, %420
%304 = phi i32 [ %309, %420 ], [ %53, %165 ]
%305 = phi i32 [ %308, %420 ], [ %52, %165 ]
%306 = phi i32 [ %421, %420 ], [ 0, %165 ]
%307 = call i32 @gaussconv_dct(double* %23, double* %37, i32 %305, i32 %304, double %9)
%308 = load i32, i32* %3
%309 = load i32, i32* %4
%310 = mul i32 %309, %308
%311 = icmp sgt i32 %310, 0
br i1 %311, label %312, label %420
312: ; preds = %303
%313 = zext i32 %310 to i64
%314 = icmp ult i32 %310, 4
br i1 %314, label %402, label %315
315: ; preds = %312
%316 = getelementptr double, double* %23, i64 %313
%317 = bitcast double* %316 to i8*
%318 = getelementptr double, double* %37, i64 %313
%319 = bitcast double* %318 to i8*
%320 = icmp ult i8* %24, %319
%321 = icmp ult i8* %38, %317
%322 = and i1 %320, %321
br i1 %322, label %402, label %323
323: ; preds = %315
%324 = and i64 %313, 4294967292
%325 = add nsw i64 %324, -4
%326 = lshr exact i64 %325, 2
%327 = add nuw nsw i64 %326, 1
%328 = and i64 %327, 3
%329 = icmp ult i64 %325, 12
br i1 %329, label %381, label %330
330: ; preds = %323
%331 = and i64 %327, 9223372036854775804
br label %332
332: ; preds = %332, %330
%333 = phi i64 [ 0, %330 ], [ %378, %332 ]
%334 = phi i64 [ 0, %330 ], [ %379, %332 ]
%335 = getelementptr inbounds double, double* %37, i64 %333
%336 = bitcast double* %335 to <2 x double>*
%337 = load <2 x double>, <2 x double>* %336
%338 = getelementptr inbounds double, double* %335, i64 2
%339 = bitcast double* %338 to <2 x double>*
%340 = load <2 x double>, <2 x double>* %339
%341 = getelementptr inbounds double, double* %23, i64 %333
%342 = bitcast double* %341 to <2 x double>*
store <2 x double> %337, <2 x double>* %342
%343 = getelementptr inbounds double, double* %341, i64 2
%344 = bitcast double* %343 to <2 x double>*
store <2 x double> %340, <2 x double>* %344
%345 = or i64 %333, 4
%346 = getelementptr inbounds double, double* %37, i64 %345
%347 = bitcast double* %346 to <2 x double>*
%348 = load <2 x double>, <2 x double>* %347
%349 = getelementptr inbounds double, double* %346, i64 2
%350 = bitcast double* %349 to <2 x double>*
%351 = load <2 x double>, <2 x double>* %350
%352 = getelementptr inbounds double, double* %23, i64 %345
%353 = bitcast double* %352 to <2 x double>*
store <2 x double> %348, <2 x double>* %353
%354 = getelementptr inbounds double, double* %352, i64 2
%355 = bitcast double* %354 to <2 x double>*
store <2 x double> %351, <2 x double>* %355
%356 = or i64 %333, 8
%357 = getelementptr inbounds double, double* %37, i64 %356
%358 = bitcast double* %357 to <2 x double>*
%359 = load <2 x double>, <2 x double>* %358
%360 = getelementptr inbounds double, double* %357, i64 2
%361 = bitcast double* %360 to <2 x double>*
%362 = load <2 x double>, <2 x double>* %361
%363 = getelementptr inbounds double, double* %23, i64 %356
%364 = bitcast double* %363 to <2 x double>*
store <2 x double> %359, <2 x double>* %364
%365 = getelementptr inbounds double, double* %363, i64 2
%366 = bitcast double* %365 to <2 x double>*
store <2 x double> %362, <2 x double>* %366
%367 = or i64 %333, 12
%368 = getelementptr inbounds double, double* %37, i64 %367
%369 = bitcast double* %368 to <2 x double>*
%370 = load <2 x double>, <2 x double>* %369
%371 = getelementptr inbounds double, double* %368, i64 2
%372 = bitcast double* %371 to <2 x double>*
%373 = load <2 x double>, <2 x double>* %372
%374 = getelementptr inbounds double, double* %23, i64 %367
%375 = bitcast double* %374 to <2 x double>*
store <2 x double> %370, <2 x double>* %375
%376 = getelementptr inbounds double, double* %374, i64 2
%377 = bitcast double* %376 to <2 x double>*
store <2 x double> %373, <2 x double>* %377
%378 = add nuw i64 %333, 16
%379 = add nuw i64 %334, 4
%380 = icmp eq i64 %379, %331
br i1 %380, label %381, label %332
381: ; preds = %332, %323
%382 = phi i64 [ 0, %323 ], [ %378, %332 ]
%383 = icmp eq i64 %328, 0
br i1 %383, label %400, label %384
384: ; preds = %381, %384
%385 = phi i64 [ %397, %384 ], [ %382, %381 ]
%386 = phi i64 [ %398, %384 ], [ 0, %381 ]
%387 = getelementptr inbounds double, double* %37, i64 %385
%388 = bitcast double* %387 to <2 x double>*
%389 = load <2 x double>, <2 x double>* %388
%390 = getelementptr inbounds double, double* %387, i64 2
%391 = bitcast double* %390 to <2 x double>*
%392 = load <2 x double>, <2 x double>* %391
%393 = getelementptr inbounds double, double* %23, i64 %385
%394 = bitcast double* %393 to <2 x double>*
store <2 x double> %389, <2 x double>* %394
%395 = getelementptr inbounds double, double* %393, i64 2
%396 = bitcast double* %395 to <2 x double>*
store <2 x double> %392, <2 x double>* %396
%397 = add nuw i64 %385, 4
%398 = add i64 %386, 1
%399 = icmp eq i64 %398, %328
br i1 %399, label %400, label %384
400: ; preds = %384, %381
%401 = icmp eq i64 %324, %313
br i1 %401, label %420, label %402
402: ; preds = %315, %312, %400
%403 = phi i64 [ 0, %315 ], [ 0, %312 ], [ %324, %400 ]
%404 = xor i64 %403, -1
%405 = add nsw i64 %404, %313
%406 = and i64 %313, 3
%407 = icmp eq i64 %406, 0
br i1 %407, label %417, label %408
408: ; preds = %402, %408
%409 = phi i64 [ %414, %408 ], [ %403, %402 ]
%410 = phi i64 [ %415, %408 ], [ 0, %402 ]
%411 = getelementptr inbounds double, double* %37, i64 %409
%412 = load double, double* %411
%413 = getelementptr inbounds double, double* %23, i64 %409
store double %412, double* %413
%414 = add nuw nsw i64 %409, 1
%415 = add i64 %410, 1
%416 = icmp eq i64 %415, %406
br i1 %416, label %417, label %408
417: ; preds = %408, %402
%418 = phi i64 [ %403, %402 ], [ %414, %408 ]
%419 = icmp ult i64 %405, 3
br i1 %419, label %420, label %423
420: ; preds = %417, %423, %400, %303
%421 = add nuw nsw i32 %306, 1
%422 = icmp eq i32 %421, %12
br i1 %422, label %186, label %303
423: ; preds = %417, %423
%424 = phi i64 [ %440, %423 ], [ %418, %417 ]
%425 = getelementptr inbounds double, double* %37, i64 %424
%426 = load double, double* %425
%427 = getelementptr inbounds double, double* %23, i64 %424
store double %426, double* %427
%428 = add nuw nsw i64 %424, 1
%429 = getelementptr inbounds double, double* %37, i64 %428
%430 = load double, double* %429
%431 = getelementptr inbounds double, double* %23, i64 %428
store double %430, double* %431
%432 = add nuw nsw i64 %424, 2
%433 = getelementptr inbounds double, double* %37, i64 %432
%434 = load double, double* %433
%435 = getelementptr inbounds double, double* %23, i64 %432
store double %434, double* %435
%436 = add nuw nsw i64 %424, 3
%437 = getelementptr inbounds double, double* %37, i64 %436
%438 = load double, double* %437
%439 = getelementptr inbounds double, double* %23, i64 %436
store double %438, double* %439
%440 = add nuw nsw i64 %424, 4
%441 = icmp eq i64 %440, %313
br i1 %441, label %420, label %423
442: ; preds = %300, %474, %280, %186
%443 = load i32, i32* @FILENAME_MAX
%444 = zext i32 %443 to i64
%445 = call i8* @llvm.stacksave()
%446 = alloca i8, i64 %444
%447 = getelementptr inbounds i8*, i8** %1, i64 4
%448 = load i8*, i8** %447
%449 = call i32 @sprintf(i8* %446, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %448)
%450 = load i32, i32* %3
%451 = load i32, i32* %4
%452 = call i32 @printImage(double* %30, i32 %450, i32 %451, i8* %446)
%453 = load i8*, i8** %447
%454 = call i32 @sprintf(i8* %446, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %453)
%455 = load i32, i32* %3
%456 = load i32, i32* %4
%457 = call i32 @printImage(double* %37, i32 %455, i32 %456, i8* %446)
%458 = load i8*, i8** %447
%459 = call i32 @sprintf(i8* %446, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %458)
%460 = load i32, i32* %3
%461 = load i32, i32* %4
%462 = call i32 @printImage_LinearConversion(double* %44, i32 %460, i32 %461, i8* %446)
%463 = load i32, i32* %3
%464 = load i32, i32* %4
%465 = mul nsw i32 %464, %463
%466 = call double @rmse(double* %30, double* %37, i32 %465)
%467 = load i32, i32* @stdout
%468 = call i32 @fprintf(i32 %467, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), double %466)
%469 = call i32 @free(double* %17)
%470 = call i32 @free(double* %23)
%471 = call i32 @free(double* %30)
%472 = call i32 @free(double* %37)
%473 = call i32 @free(double* %44)
br label %505
474: ; preds = %300, %474
%475 = phi i64 [ %503, %474 ], [ %301, %300 ]
%476 = getelementptr inbounds double, double* %30, i64 %475
%477 = load double, double* %476
%478 = getelementptr inbounds double, double* %37, i64 %475
%479 = load double, double* %478
%480 = fsub double %477, %479
%481 = getelementptr inbounds double, double* %44, i64 %475
store double %480, double* %481
%482 = add nuw nsw i64 %475, 1
%483 = getelementptr inbounds double, double* %30, i64 %482
%484 = load double, double* %483
%485 = getelementptr inbounds double, double* %37, i64 %482
%486 = load double, double* %485
%487 = fsub double %484, %486
%488 = getelementptr inbounds double, double* %44, i64 %482
store double %487, double* %488
%489 = add nuw nsw i64 %475, 2
%490 = getelementptr inbounds double, double* %30, i64 %489
%491 = load double, double* %490
%492 = getelementptr inbounds double, double* %37, i64 %489
%493 = load double, double* %492
%494 = fsub double %491, %493
%495 = getelementptr inbounds double, double* %44, i64 %489
store double %494, double* %495
%496 = add nuw nsw i64 %475, 3
%497 = getelementptr inbounds double, double* %30, i64 %496
%498 = load double, double* %497
%499 = getelementptr inbounds double, double* %37, i64 %496
%500 = load double, double* %499
%501 = fsub double %498, %500
%502 = getelementptr inbounds double, double* %44, i64 %496
store double %501, double* %502
%503 = add nuw nsw i64 %475, 4
%504 = icmp eq i64 %503, %190
br i1 %504, label %442, label %474
505: ; preds = %442, %163
%506 = phi i32 [ 0, %442 ], [ -1, %163 ]
ret i32 %506
}