#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_sampled_kernel(double *, double *, int, int,
                                            double, int);
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 k;
  int N;
  switch (argc) {
  case 6:
    sigma = atof(argv[2]);
    k = atoi(argv[3]);
    N = atoi(argv[4]);
    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));
  double s = sqrt((double)N) * sigma;
  gaussconv_sampled_kernel(x, y1, w, h, s, k);
  for (int j = 0; j < w * h; j++)
    t[j] = x[j];
  for (int i = 0; i < N; i++) {
    gaussconv_sampled_kernel(t, y2, w, h, sigma, k);
    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[5]);
  printImage(y1, w, h, name);
  sprintf(name, "%s_iter.png", argv[5]);
  printImage(y2, w, h, name);
  sprintf(name, "%s_diff.png", argv[5]);
  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    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x6,%eax
jne    1231 <main+0x61>
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   10a0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    1244 <main+0x74>
mov    $0x0,%al
call   10e0 <print_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1528 <main+0x358>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1090 <read_image_to_gray@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm0
call   10b0 <sqrt@plt>
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
movsd  -0x58(%rbp),%xmm0
mov    -0x1c(%rbp),%r8d
call   10f0 <gaussconv_sampled_kernel@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x24(%rbp),%ecx
imul   -0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    132e <main+0x15e>
mov    -0x30(%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    12f4 <main+0x124>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    13b1 <main+0x1e1>
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%r8d
call   10f0 <gaussconv_sampled_kernel@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0x24(%rbp),%ecx
imul   -0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    139e <main+0x1ce>
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1364 <main+0x194>
jmp    13a3 <main+0x1d3>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1335 <main+0x165>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    -0x24(%rbp),%ecx
imul   -0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    13ff <main+0x22f>
mov    -0x40(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x68(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x68(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    13b8 <main+0x1e8>
mov    0x2be2(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x88(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    0xbc3(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x88(%rbp),%rcx
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   10c0 <printImage@plt>
mov    -0x88(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    0xba0(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x88(%rbp),%rcx
mov    -0x48(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   10c0 <printImage@plt>
mov    -0x88(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdx
lea    0xb7b(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x88(%rbp),%rcx
mov    -0x50(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1060 <printImage_LinearConversion@plt>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x24(%rbp),%edx
imul   -0x28(%rbp),%edx
call   1040 <rmse@plt>
movsd  %xmm0,-0x80(%rbp)
mov    0x2afe(%rip),%rax
mov    (%rax),%edi
movsd  -0x80(%rbp),%xmm0
lea    0xb3e(%rip),%rsi
call   1070 <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    -0x70(%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    $0x6,%edi
jne    1290 <main+0xc0>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x40(%rbp)
mov    0x18(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x34(%rbp)
mov    0x20(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
mov    %rbx,-0x58(%rbp)
mov    0x8(%rbx),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   1090 <read_image_to_gray@plt>
mov    %rax,%r15
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,%r13
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    -0x30(%rbp),%edi
imul   -0x2c(%rbp),%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %r14d,-0x38(%rbp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %rax,-0x48(%rbp)
jb     12a1 <main+0xd1>
sqrtsd %xmm0,%xmm0
jmp    12a6 <main+0xd6>
xor    %eax,%eax
call   10e0 <print_usage@plt>
mov    $0xffffffff,%eax
jmp    1979 <main+0x7a9>
call   10b0 <sqrt@plt>
mulsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    -0x34(%rbp),%r8d
call   10f0 <gaussconv_sampled_kernel@plt>
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    %ecx,%r9d
imul   %edx,%r9d
test   %r9d,%r9d
jle    148a <main+0x2ba>
mov    %r9d,%r10d
cmp    $0x4,%r9d
jb     1300 <main+0x130>
lea    (%r15,%r10,8),%rax
cmp    %rax,%r13
jae    1395 <main+0x1c5>
lea    0x0(,%r10,8),%rax
add    %r13,%rax
cmp    %rax,%r15
jae    1395 <main+0x1c5>
xor    %edi,%edi
mov    %rdi,%rax
not    %rax
add    %r10,%rax
mov    %r10,%rsi
and    $0x3,%rsi
je     1337 <main+0x167>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%r15,%rdi,8),%xmm0
movsd  %xmm0,0x0(%r13,%rdi,8)
add    $0x1,%rdi
add    $0xffffffffffffffff,%rsi
jne    1320 <main+0x150>
cmp    $0x3,%rax
jb     148a <main+0x2ba>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rdi,8),%xmm0
movsd  %xmm0,0x0(%r13,%rdi,8)
movsd  0x8(%r15,%rdi,8),%xmm0
movsd  %xmm0,0x8(%r13,%rdi,8)
movsd  0x10(%r15,%rdi,8),%xmm0
movsd  %xmm0,0x10(%r13,%rdi,8)
movsd  0x18(%r15,%rdi,8),%xmm0
movsd  %xmm0,0x18(%r13,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%r10
jne    1350 <main+0x180>
jmp    148a <main+0x2ba>
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    13be <main+0x1ee>
xor    %esi,%esi
jmp    143d <main+0x26d>
and    $0xfffffffffffffffc,%rax
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups (%r15,%rsi,8),%xmm0
movups 0x10(%r15,%rsi,8),%xmm1
movups %xmm0,0x0(%r13,%rsi,8)
movups %xmm1,0x10(%r13,%rsi,8)
movups 0x20(%r15,%rsi,8),%xmm0
movups 0x30(%r15,%rsi,8),%xmm1
movups %xmm0,0x20(%r13,%rsi,8)
movups %xmm1,0x30(%r13,%rsi,8)
movups 0x40(%r15,%rsi,8),%xmm0
movups 0x50(%r15,%rsi,8),%xmm1
movups %xmm0,0x40(%r13,%rsi,8)
movups %xmm1,0x50(%r13,%rsi,8)
movupd 0x60(%r15,%rsi,8),%xmm0
movupd 0x70(%r15,%rsi,8),%xmm1
movupd %xmm0,0x60(%r13,%rsi,8)
movupd %xmm1,0x70(%r13,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rax
jne    13d0 <main+0x200>
test   %r8,%r8
je     1481 <main+0x2b1>
lea    0x10(,%rsi,8),%r11
add    %r13,%r11
lea    (%r15,%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    1460 <main+0x290>
cmp    %r10,%rdi
jne    1302 <main+0x132>
mov    %rbx,-0x50(%rbp)
cmpl   $0x0,-0x38(%rbp)
mov    -0x34(%rbp),%ebx
jle    16b0 <main+0x4e0>
lea    0x10(%r13),%rax
mov    %rax,-0x68(%rbp)
lea    0x10(%r12),%rax
mov    %rax,-0x60(%rbp)
xor    %r14d,%r14d
jmp    14ce <main+0x2fe>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
cmp    -0x38(%rbp),%r14d
je     16b0 <main+0x4e0>
mov    %r13,%rdi
mov    %r12,%rsi
movsd  -0x40(%rbp),%xmm0
mov    %ebx,%r8d
call   10f0 <gaussconv_sampled_kernel@plt>
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    %ecx,%r9d
imul   %edx,%r9d
test   %r9d,%r9d
jle    14c0 <main+0x2f0>
mov    %r9d,%r10d
cmp    $0x4,%r9d
jb     151d <main+0x34d>
lea    (%r12,%r10,8),%rax
cmp    %rax,%r13
jae    15b5 <main+0x3e5>
lea    0x0(,%r10,8),%rax
add    %r13,%rax
cmp    %rax,%r12
jae    15b5 <main+0x3e5>
xor    %edi,%edi
mov    %rdi,%rax
not    %rax
add    %r10,%rax
mov    %r10,%rsi
and    $0x3,%rsi
je     1557 <main+0x387>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%rdi,8),%xmm0
movsd  %xmm0,0x0(%r13,%rdi,8)
add    $0x1,%rdi
add    $0xffffffffffffffff,%rsi
jne    1540 <main+0x370>
cmp    $0x3,%rax
jb     14c0 <main+0x2f0>
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    1570 <main+0x3a0>
jmp    14c0 <main+0x2f0>
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    15de <main+0x40e>
xor    %esi,%esi
jmp    165d <main+0x48d>
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    15f0 <main+0x420>
test   %r8,%r8
je     169f <main+0x4cf>
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    1680 <main+0x4b0>
cmp    %r10,%rdi
mov    -0x34(%rbp),%ebx
je     14c0 <main+0x2f0>
jmp    151f <main+0x34f>
test   %r9d,%r9d
mov    -0x50(%rbp),%rbx
mov    -0x48(%rbp),%rcx
jle    188c <main+0x6bc>
mov    %r9d,%r10d
cmp    $0x4,%r9d
jae    1777 <main+0x5a7>
xor    %eax,%eax
mov    %rax,%rdx
not    %rdx
add    %r10,%rdx
mov    %r10,%rsi
and    $0x3,%rsi
je     170a <main+0x53a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rbx,%rax,8),%xmm0
subsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%rcx,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rsi
jne    16f0 <main+0x520>
cmp    $0x3,%rdx
jb     188c <main+0x6bc>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rbx,%rax,8),%xmm0
subsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%rcx,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
subsd  0x8(%r12,%rax,8),%xmm0
movsd  %xmm0,0x8(%rcx,%rax,8)
movsd  0x10(%rbx,%rax,8),%xmm0
subsd  0x10(%r12,%rax,8),%xmm0
movsd  %xmm0,0x10(%rcx,%rax,8)
movsd  0x18(%rbx,%rax,8),%xmm0
subsd  0x18(%r12,%rax,8),%xmm0
movsd  %xmm0,0x18(%rcx,%rax,8)
add    $0x4,%rax
cmp    %rax,%r10
jne    1720 <main+0x550>
jmp    188c <main+0x6bc>
lea    (%rcx,%r10,8),%rax
lea    (%rbx,%r10,8),%rdx
lea    (%r12,%r10,8),%rsi
cmp    %rdx,%rcx
setb   %dil
cmp    %rax,%rbx
setb   %r8b
cmp    %rsi,%rcx
setb   %dl
cmp    %rax,%r12
setb   %sil
xor    %eax,%eax
test   %r8b,%dil
jne    16d0 <main+0x500>
and    %sil,%dl
jne    16d0 <main+0x500>
mov    %r10d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rsi
mov    %rsi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1988 <main+0x7b8>
movabs $0x7ffffffffffffffc,%rdi
ff ff 7f
or     $0x2,%rdi
and    %rdx,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd (%rbx,%rsi,8),%xmm0
movupd 0x10(%rbx,%rsi,8),%xmm1
movupd (%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,(%rcx,%rsi,8)
movupd %xmm1,0x10(%rcx,%rsi,8)
movupd 0x20(%rbx,%rsi,8),%xmm0
movupd 0x30(%rbx,%rsi,8),%xmm1
movupd 0x20(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x30(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,0x20(%rcx,%rsi,8)
movupd %xmm1,0x30(%rcx,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    17f0 <main+0x620>
test   $0x1,%dl
je     1883 <main+0x6b3>
movupd (%rbx,%rsi,8),%xmm0
movupd 0x10(%rbx,%rsi,8),%xmm1
movupd (%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r12,%rsi,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,(%rcx,%rsi,8)
movupd %xmm1,0x10(%rcx,%rsi,8)
cmp    %r10,%rax
jne    16d0 <main+0x500>
mov    %rsp,-0x40(%rbp)
mov    0x2751(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x58(%rbp),%rax
mov    0x28(%rax),%rdx
lea    0x747(%rip),%rsi
mov    %r14,%rdi
call   10d0 <sprintf@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    %rbx,%rdi
mov    %r14,%rcx
call   10c0 <printImage@plt>
mov    -0x58(%rbp),%rbx
mov    0x28(%rbx),%rdx
lea    0x72d(%rip),%rsi
mov    %r14,%rdi
call   10d0 <sprintf@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    %r12,%rdi
mov    %r14,%rcx
call   10c0 <printImage@plt>
mov    0x28(%rbx),%rdx
lea    0x715(%rip),%rsi
mov    %r14,%rdi
call   10d0 <sprintf@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x48(%rbp),%rdi
mov    %r14,%rcx
call   1060 <printImage_LinearConversion@plt>
mov    -0x2c(%rbp),%edx
imul   -0x30(%rbp),%edx
mov    -0x50(%rbp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <rmse@plt>
mov    0x269c(%rip),%rax
mov    (%rax),%edi
lea    0x6e1(%rip),%rsi
call   1070 <fprintf@plt>
mov    %r15,%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    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%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    1858 <main+0x688>
jmp    1883 <main+0x6b3>

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

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