#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 */
typedef int uint8_t;
typedef int uint64_t;
typedef int int64_t;
typedef int int16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int abs(int);
int fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int int_sqrt(int);
int log16(int);
scalar_t__ memcmp(int *, char *, int);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int run_psnr(FILE *f[2], int len, int shift, int skip_bytes) {
  int i, j;
  uint64_t sse = 0;
  uint64_t dev;
  uint8_t buf[2][2048];
  uint64_t psnr;
  int64_t max = (1 << (8 * len)) - 1;
  int size0 = 0;
  int size1 = 0;
  int maxdist = 0;
  rewind(f[0]);
  rewind(f[1]);
  for (i = 0; i < 2; i++) {
    uint8_t *p = buf[i];
    if (fread(p, 1, 12, f[i]) != 12)
      return 1;
    if (!memcmp(p, "RIFF", 4) && !memcmp(p + 8, "WAVE", 4)) {
      if (fread(p, 1, 8, f[i]) != 8)
        return 1;
      while (memcmp(p, "data", 4)) {
        int s = p[4] | p[5] << 8 | p[6] << 16 | p[7] << 24;
        fseek(f[i], s, SEEK_CUR);
        if (fread(p, 1, 8, f[i]) != 8)
          return 1;
      }
    } else {
      fseek(f[i], -12, SEEK_CUR);
    }
  }
  fseek(f[shift < 0], abs(shift), SEEK_CUR);
  fseek(f[0], skip_bytes, SEEK_CUR);
  fseek(f[1], skip_bytes, SEEK_CUR);
  for (;;) {
    int s0 = fread(buf[0], 1, 2048, f[0]);
    int s1 = fread(buf[1], 1, 2048, f[1]);
    for (j = 0; j < ((s0) > (s1) ? (s1) : (s0)); j++) {
      int64_t a = buf[0][j];
      int64_t b = buf[1][j];
      int dist;
      if (len == 2) {
        a = (int16_t)(a | (buf[0][++j] << 8));
        b = (int16_t)(b | (buf[1][j] << 8));
      }
      sse += (a - b) * (a - b);
      dist = abs(a - b);
      if (dist > maxdist)
        maxdist = dist;
    }
    size0 += s0;
    size1 += s1;
    if (s0 + s1 <= 0)
      break;
  }
  i = ((size0) > (size1) ? (size1) : (size0)) / len;
  if (!i)
    i = 1;
  dev =
      int_sqrt(((sse / i) * 100 * 100) + (((sse % i) * 100 * 100) + i / 2) / i);
  if (sse)
    psnr = ((2 * log16(max << 16) + log16(i) - log16(sse)) * 284619LL * 100 +
            (1LL << 31)) /
           (1LL << 32);
  else
    psnr = 1000 * 100 - 1;
  printf("stddev:%5d.%02d PSNR:%3d.%02d MAXDIFF:%5d bytes:%9d/%9d\n",
         (int)(dev / 100), (int)(dev % 100), (int)(psnr / 100),
         (int)(psnr % 100), maxdist, size0, size1);
  return psnr;
}


x86 assembly (clang, -O0):
<run_psnr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40a0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x14(%rbp),%ecx
shl    $0x3,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x4038(%rbp)
movl   $0x0,-0x403c(%rbp)
movl   $0x0,-0x4040(%rbp)
movl   $0x0,-0x4044(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <rewind@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <rewind@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x20(%rbp)
jge    13c3 <run_psnr+0x243>
movslq -0x20(%rbp),%rcx
lea    -0x4030(%rbp),%rax
shl    $0xd,%rcx
add    %rcx,%rax
mov    %rax,-0x4050(%rbp)
mov    -0x4050(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    $0x1,%esi
mov    $0xc,%edx
call   1030 <fread@plt>
cmp    $0xc,%eax
je     124d <run_psnr+0xcd>
movl   $0x1,-0x4(%rbp)
jmp    177a <run_psnr+0x5fa>
mov    -0x4050(%rbp),%rdi
lea    0xda5(%rip),%rsi
mov    $0x4,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jne    1391 <run_psnr+0x211>
mov    -0x4050(%rbp),%rdi
add    $0x20,%rdi
lea    0xd84(%rip),%rsi
mov    $0x4,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jne    1391 <run_psnr+0x211>
mov    -0x4050(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
je     12cc <run_psnr+0x14c>
movl   $0x1,-0x4(%rbp)
jmp    177a <run_psnr+0x5fa>
jmp    12d1 <run_psnr+0x151>
mov    -0x4050(%rbp),%rdi
lea    0xd2b(%rip),%rsi
mov    $0x4,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     138c <run_psnr+0x20c>
mov    -0x4050(%rbp),%rax
mov    0x10(%rax),%eax
mov    -0x4050(%rbp),%rcx
mov    0x14(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4050(%rbp),%rcx
mov    0x18(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x4050(%rbp),%rcx
mov    0x1c(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x4054(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x4054(%rbp),%esi
mov    0x2c9f(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
mov    -0x4050(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
je     1387 <run_psnr+0x207>
movl   $0x1,-0x4(%rbp)
jmp    177a <run_psnr+0x5fa>
jmp    12d1 <run_psnr+0x151>
jmp    13b0 <run_psnr+0x230>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2c44(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1080 <fseek@plt>
jmp    13b5 <run_psnr+0x235>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f3 <run_psnr+0x73>
mov    -0x10(%rbp),%rax
cmpl   $0x0,-0x18(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x4070(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <abs@plt>
mov    -0x4070(%rbp),%rdi
mov    %eax,%esi
mov    0x2bee(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2bd6(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2bbd(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
lea    -0x4030(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    $0x1,%esi
mov    $0x800,%edx
call   1030 <fread@plt>
mov    %eax,-0x4058(%rbp)
lea    -0x4030(%rbp),%rdi
add    $0x2000,%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    $0x1,%esi
mov    $0x800,%edx
call   1030 <fread@plt>
mov    %eax,-0x405c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4074(%rbp)
mov    -0x4058(%rbp),%eax
cmp    -0x405c(%rbp),%eax
jle    14b3 <run_psnr+0x333>
mov    -0x405c(%rbp),%eax
mov    %eax,-0x4078(%rbp)
jmp    14bf <run_psnr+0x33f>
mov    -0x4058(%rbp),%eax
mov    %eax,-0x4078(%rbp)
mov    -0x4074(%rbp),%eax
mov    -0x4078(%rbp),%ecx
cmp    %ecx,%eax
jge    15a8 <run_psnr+0x428>
movslq -0x24(%rbp),%rax
mov    -0x4030(%rbp,%rax,4),%eax
mov    %eax,-0x4060(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x2030(%rbp,%rax,4),%eax
mov    %eax,-0x4064(%rbp)
cmpl   $0x2,-0x14(%rbp)
jne    153f <run_psnr+0x3bf>
mov    -0x4060(%rbp),%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
movslq %ecx,%rcx
mov    -0x4030(%rbp,%rcx,4),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x4060(%rbp)
mov    -0x4064(%rbp),%eax
movslq -0x24(%rbp),%rcx
mov    -0x2030(%rbp,%rcx,4),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x4064(%rbp)
mov    -0x4060(%rbp),%eax
sub    -0x4064(%rbp),%eax
mov    -0x4060(%rbp),%ecx
sub    -0x4064(%rbp),%ecx
imul   %ecx,%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x4060(%rbp),%edi
sub    -0x4064(%rbp),%edi
call   1040 <abs@plt>
mov    %eax,-0x4068(%rbp)
mov    -0x4068(%rbp),%eax
cmp    -0x4044(%rbp),%eax
jle    1595 <run_psnr+0x415>
mov    -0x4068(%rbp),%eax
mov    %eax,-0x4044(%rbp)
jmp    159a <run_psnr+0x41a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1487 <run_psnr+0x307>
mov    -0x4058(%rbp),%eax
add    -0x403c(%rbp),%eax
mov    %eax,-0x403c(%rbp)
mov    -0x405c(%rbp),%eax
add    -0x4040(%rbp),%eax
mov    %eax,-0x4040(%rbp)
mov    -0x4058(%rbp),%eax
add    -0x405c(%rbp),%eax
cmp    $0x0,%eax
jg     15e6 <run_psnr+0x466>
jmp    15eb <run_psnr+0x46b>
jmp    1432 <run_psnr+0x2b2>
mov    -0x403c(%rbp),%eax
cmp    -0x4040(%rbp),%eax
jle    160e <run_psnr+0x48e>
mov    -0x4040(%rbp),%eax
mov    %eax,-0x407c(%rbp)
jmp    161a <run_psnr+0x49a>
mov    -0x403c(%rbp),%eax
mov    %eax,-0x407c(%rbp)
mov    -0x407c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1638 <run_psnr+0x4b8>
movl   $0x1,-0x20(%rbp)
mov    -0x28(%rbp),%eax
cltd
idivl  -0x20(%rbp)
imul   $0x64,%eax,%eax
imul   $0x64,%eax,%edi
mov    -0x28(%rbp),%eax
cltd
idivl  -0x20(%rbp)
imul   $0x64,%edx,%eax
imul   $0x64,%eax,%eax
mov    %eax,-0x4080(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4080(%rbp),%eax
add    %ecx,%eax
cltd
idivl  -0x20(%rbp)
add    %eax,%edi
call   10a0 <int_sqrt@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     16fa <run_psnr+0x57a>
mov    -0x4038(%rbp),%edi
shl    $0x10,%edi
call   1090 <log16@plt>
shl    $0x1,%eax
mov    %eax,-0x4088(%rbp)
mov    -0x20(%rbp),%edi
call   1090 <log16@plt>
mov    %eax,%ecx
mov    -0x4088(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4084(%rbp)
mov    -0x28(%rbp),%edi
call   1090 <log16@plt>
mov    %eax,%ecx
mov    -0x4084(%rbp),%eax
sub    %ecx,%eax
cltq
imul   $0x457cb,%rax,%rax
imul   $0x64,%rax,%rax
movabs $0x80000000,%rcx
add    %rcx,%rax
movabs $0x100000000,%rcx
cqto
idiv   %rcx
mov    %eax,-0x4034(%rbp)
jmp    1704 <run_psnr+0x584>
movl   $0x1869f,-0x4034(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x2c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x408c(%rbp)
mov    -0x4034(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4034(%rbp),%eax
mov    $0x64,%edi
cltd
idiv   %edi
mov    %edx,%r8d
mov    -0x408c(%rbp),%edx
mov    -0x4044(%rbp),%r9d
mov    -0x403c(%rbp),%r10d
mov    -0x4040(%rbp),%eax
lea    0x8ab(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <printf@plt>
mov    -0x4034(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_psnr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4028,%rsp
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0x0(,%r15,8),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %eax,0x14(%rsp)
mov    (%rdi),%rdi
call   1050 <rewind@plt>
mov    0x8(%rbx),%rdi
call   1050 <rewind@plt>
mov    %rbx,0x8(%rsp)
mov    (%rbx),%rcx
lea    0x20(%rsp),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
mov    $0xc,%edx
call   1030 <fread@plt>
cmp    $0xc,%eax
jne    14ca <run_psnr+0x35a>
lea    0xe1e(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    $0x4,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
jne    1215 <run_psnr+0xa5>
lea    0x40(%rsp),%rdi
lea    0xe03(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
je     14de <run_psnr+0x36e>
mov    0x8(%rsp),%rbx
mov    (%rbx),%rdi
mov    0x2dc4(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1070 <fseek@plt>
lea    0x2020(%rsp),%rbp
mov    0x8(%rbx),%rcx
mov    $0x1,%ebx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0xc,%edx
call   1030 <fread@plt>
cmp    $0xc,%eax
jne    14ca <run_psnr+0x35a>
lea    0xd9d(%rip),%rsi
mov    %rbp,%rdi
mov    $0x4,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
jne    1297 <run_psnr+0x127>
lea    0x2040(%rsp),%rdi
lea    0xd81(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
je     157f <run_psnr+0x40f>
mov    0x8(%rsp),%rbx
mov    0x8(%rbx),%rdi
mov    0x2d41(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1070 <fseek@plt>
notl   0x14(%rsp)
mov    %r12d,%eax
shr    $0x1f,%eax
mov    (%rbx,%rax,8),%rdi
mov    %r12d,%esi
neg    %esi
cmovs  %r12d,%esi
mov    0x2d17(%rip),%rbp
mov    0x0(%rbp),%edx
call   1070 <fseek@plt>
mov    (%rbx),%rdi
mov    0x0(%rbp),%edx
mov    %r14d,%esi
call   1070 <fseek@plt>
mov    0x8(%rbx),%rdi
mov    0x0(%rbp),%edx
mov    %r14d,%esi
call   1070 <fseek@plt>
xor    %ecx,%ecx
xor    %r13d,%r13d
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    1324 <run_psnr+0x1b4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x18(%rsp),%rcx
add    %r12d,%ecx
add    %eax,%r13d
add    %r12d,%eax
jle    13d1 <run_psnr+0x261>
mov    %rcx,0x18(%rsp)
mov    0x8(%rsp),%rbp
mov    0x0(%rbp),%rcx
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0x800,%edx
call   1030 <fread@plt>
mov    %eax,%r12d
mov    0x8(%rbp),%rcx
lea    0x2020(%rsp),%rdi
mov    $0x1,%esi
mov    $0x800,%edx
call   1030 <fread@plt>
cmp    %eax,%r12d
mov    %r12d,%r8d
cmovg  %eax,%r8d
test   %r8d,%r8d
jle    1310 <run_psnr+0x1a0>
xor    %edx,%edx
jmp    13a3 <run_psnr+0x233>
nopw   0x0(%rax,%rax,1)
sub    %edi,%esi
mov    %esi,%ecx
imul   %esi,%ecx
add    %ecx,%ebx
mov    %esi,%ecx
neg    %ecx
cmovs  %esi,%ecx
cmp    %r14d,%ecx
cmovg  %ecx,%r14d
add    $0x1,%edx
cmp    %r8d,%edx
jge    1310 <run_psnr+0x1a0>
movslq %edx,%rcx
mov    0x20(%rsp,%rcx,4),%esi
mov    0x2020(%rsp,%rcx,4),%edi
cmp    $0x2,%r15d
jne    1380 <run_psnr+0x210>
lea    0x1(%rcx),%edx
mov    0x24(%rsp,%rcx,4),%ebp
shl    $0x8,%ebp
or     %ebp,%esi
mov    0x2024(%rsp,%rcx,4),%ecx
shl    $0x8,%ecx
or     %ecx,%edi
jmp    1380 <run_psnr+0x210>
cmp    %r13d,%ecx
mov    %rcx,0x18(%rsp)
mov    %ecx,%eax
cmovg  %r13d,%eax
cltd
idiv   %r15d
test   %eax,%eax
mov    $0x1,%r15d
cmovne %eax,%r15d
mov    %ebx,%eax
cltd
idiv   %r15d
imul   $0x2710,%eax,%edi
imul   $0x2710,%edx,%ecx
mov    %r15d,%eax
shr    $0x1f,%eax
add    %r15d,%eax
sar    %eax
add    %ecx,%eax
cltd
idiv   %r15d
add    %eax,%edi
call   1090 <int_sqrt@plt>
test   %ebx,%ebx
je     1473 <run_psnr+0x303>
mov    0x14(%rsp),%edi
shl    $0x10,%edi
mov    %eax,0x8(%rsp)
call   1080 <log16@plt>
mov    %eax,%r12d
mov    %r15d,%edi
call   1080 <log16@plt>
lea    (%rax,%r12,2),%ebp
mov    %ebx,%edi
call   1080 <log16@plt>
sub    %eax,%ebp
movslq %ebp,%rax
imul   $0x1b24b4c,%rax,%rax
movabs $0x17fffffff,%rbx
add    %rax,%rbx
sub    $0xffffffff80000000,%rax
test   %rax,%rax
cmovns %rax,%rbx
mov    0x8(%rsp),%eax
shr    $0x20,%rbx
jmp    1478 <run_psnr+0x308>
mov    $0x1869f,%ebx
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x25,%rsi
add    %eax,%esi
imul   $0x64,%esi,%eax
sub    %eax,%edx
movslq %ebx,%r8
imul   $0x51eb851f,%r8,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x25,%rcx
add    %eax,%ecx
imul   $0x64,%ecx,%eax
sub    %eax,%r8d
lea    0xb57(%rip),%rdi
mov    %r14d,%r9d
push   %r13
push   0x20(%rsp)
call   1040 <printf@plt>
add    $0x10,%rsp
mov    %ebx,%eax
add    $0x4028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%rax
mov    (%rax),%rcx
lea    0x20(%rsp),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
jne    14ca <run_psnr+0x35a>
lea    0x20(%rsp),%rbp
mov    0x2ad8(%rip),%r13
mov    %rbp,%rdi
lea    0xaf0(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
mov    0x8(%rsp),%rbx
je     1230 <run_psnr+0xc0>
mov    0x34(%rsp),%eax
shl    $0x8,%eax
or     0x30(%rsp),%eax
mov    0x38(%rsp),%ecx
shl    $0x10,%ecx
mov    0x3c(%rsp),%esi
shl    $0x18,%esi
or     %ecx,%esi
or     %eax,%esi
mov    (%rbx),%rdi
mov    0x0(%r13),%edx
call   1070 <fseek@plt>
mov    (%rbx),%rcx
mov    $0x1,%ebx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
je     1510 <run_psnr+0x3a0>
jmp    14ca <run_psnr+0x35a>
mov    0x8(%rsp),%rax
mov    0x8(%rax),%rcx
mov    $0x1,%ebx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
jne    14ca <run_psnr+0x35a>
mov    0x2a39(%rip),%r13
nop
mov    %rbp,%rdi
lea    0xa50(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
mov    0x8(%rsp),%rbx
je     12b3 <run_psnr+0x143>
mov    0x2034(%rsp),%eax
shl    $0x8,%eax
or     0x2030(%rsp),%eax
mov    0x2038(%rsp),%ecx
shl    $0x10,%ecx
mov    0x203c(%rsp),%esi
shl    $0x18,%esi
or     %ecx,%esi
or     %eax,%esi
mov    0x8(%rbx),%rdi
mov    0x0(%r13),%edx
call   1070 <fseek@plt>
mov    0x8(%rbx),%rcx
mov    $0x1,%ebx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
je     15b0 <run_psnr+0x440>
jmp    14ca <run_psnr+0x35a>

LLVM IR (-O0):
@.str = [5 x i8] c"RIFF\00"
@.str.1 = [5 x i8] c"WAVE\00"
@.str.2 = [5 x i8] c"data\00"
@SEEK_CUR = global i32 0
@.str.3 = [57 x i8] c"stddev:%5d.%02d PSNR:%3d.%02d MAXDIFF:%5d bytes:%9d/%9d\0A\00"
define i32 @run_psnr(i32** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [2 x [2048 x i32]]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32** %0, i32*** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 0, i32* %12
%27 = load i32, i32* %7
%28 = mul nsw i32 8, %27
%29 = shl i32 1, %28
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %16
store i32 0, i32* %17
store i32 0, i32* %18
store i32 0, i32* %19
%31 = load i32**, i32*** %6
%32 = getelementptr inbounds i32*, i32** %31, i64 0
%33 = load i32*, i32** %32
%34 = call i32 @rewind(i32* %33)
%35 = load i32**, i32*** %6
%36 = getelementptr inbounds i32*, i32** %35, i64 1
%37 = load i32*, i32** %36
%38 = call i32 @rewind(i32* %37)
store i32 0, i32* %10
br label %39
39: ; preds = %127, %4
%40 = load i32, i32* %10
%41 = icmp slt i32 %40, 2
br i1 %41, label %42, label %130
42: ; preds = %39
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %14, i64 0, i64 %44
%46 = getelementptr inbounds [2048 x i32], [2048 x i32]* %45, i64 0, i64 0
store i32* %46, i32** %20
%47 = load i32*, i32** %20
%48 = load i32**, i32*** %6
%49 = load i32, i32* %10
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32*, i32** %48, i64 %50
%52 = load i32*, i32** %51
%53 = call i32 @fread(i32* %47, i32 1, i32 12, i32* %52)
%54 = icmp ne i32 %53, 12
br i1 %54, label %55, label %56
55: ; preds = %42
store i32 1, i32* %5
br label %313
56: ; preds = %42
%57 = load i32*, i32** %20
%58 = call i64 @memcmp(i32* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%59 = icmp ne i64 %58, 0
br i1 %59, label %118, label %60
60: ; preds = %56
%61 = load i32*, i32** %20
%62 = getelementptr inbounds i32, i32* %61, i64 8
%63 = call i64 @memcmp(i32* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%64 = icmp ne i64 %63, 0
br i1 %64, label %118, label %65
65: ; preds = %60
%66 = load i32*, i32** %20
%67 = load i32**, i32*** %6
%68 = load i32, i32* %10
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32*, i32** %67, i64 %69
%71 = load i32*, i32** %70
%72 = call i32 @fread(i32* %66, i32 1, i32 8, i32* %71)
%73 = icmp ne i32 %72, 8
br i1 %73, label %74, label %75
74: ; preds = %65
store i32 1, i32* %5
br label %313
75: ; preds = %65
br label %76
76: ; preds = %116, %75
%77 = load i32*, i32** %20
%78 = call i64 @memcmp(i32* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %117
80: ; preds = %76
%81 = load i32*, i32** %20
%82 = getelementptr inbounds i32, i32* %81, i64 4
%83 = load i32, i32* %82
%84 = load i32*, i32** %20
%85 = getelementptr inbounds i32, i32* %84, i64 5
%86 = load i32, i32* %85
%87 = shl i32 %86, 8
%88 = or i32 %83, %87
%89 = load i32*, i32** %20
%90 = getelementptr inbounds i32, i32* %89, i64 6
%91 = load i32, i32* %90
%92 = shl i32 %91, 16
%93 = or i32 %88, %92
%94 = load i32*, i32** %20
%95 = getelementptr inbounds i32, i32* %94, i64 7
%96 = load i32, i32* %95
%97 = shl i32 %96, 24
%98 = or i32 %93, %97
store i32 %98, i32* %21
%99 = load i32**, i32*** %6
%100 = load i32, i32* %10
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32*, i32** %99, i64 %101
%103 = load i32*, i32** %102
%104 = load i32, i32* %21
%105 = load i32, i32* @SEEK_CUR
%106 = call i32 @fseek(i32* %103, i32 %104, i32 %105)
%107 = load i32*, i32** %20
%108 = load i32**, i32*** %6
%109 = load i32, i32* %10
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i32*, i32** %108, i64 %110
%112 = load i32*, i32** %111
%113 = call i32 @fread(i32* %107, i32 1, i32 8, i32* %112)
%114 = icmp ne i32 %113, 8
br i1 %114, label %115, label %116
115: ; preds = %80
store i32 1, i32* %5
br label %313
116: ; preds = %80
br label %76
117: ; preds = %76
br label %126
118: ; preds = %60, %56
%119 = load i32**, i32*** %6
%120 = load i32, i32* %10
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i32*, i32** %119, i64 %121
%123 = load i32*, i32** %122
%124 = load i32, i32* @SEEK_CUR
%125 = call i32 @fseek(i32* %123, i32 -12, i32 %124)
br label %126
126: ; preds = %118, %117
br label %127
127: ; preds = %126
%128 = load i32, i32* %10
%129 = add nsw i32 %128, 1
store i32 %129, i32* %10
br label %39
130: ; preds = %39
%131 = load i32**, i32*** %6
%132 = load i32, i32* %8
%133 = icmp slt i32 %132, 0
%134 = zext i1 %133 to i32
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i32*, i32** %131, i64 %135
%137 = load i32*, i32** %136
%138 = load i32, i32* %8
%139 = call i32 @abs(i32 %138)
%140 = load i32, i32* @SEEK_CUR
%141 = call i32 @fseek(i32* %137, i32 %139, i32 %140)
%142 = load i32**, i32*** %6
%143 = getelementptr inbounds i32*, i32** %142, i64 0
%144 = load i32*, i32** %143
%145 = load i32, i32* %9
%146 = load i32, i32* @SEEK_CUR
%147 = call i32 @fseek(i32* %144, i32 %145, i32 %146)
%148 = load i32**, i32*** %6
%149 = getelementptr inbounds i32*, i32** %148, i64 1
%150 = load i32*, i32** %149
%151 = load i32, i32* %9
%152 = load i32, i32* @SEEK_CUR
%153 = call i32 @fseek(i32* %150, i32 %151, i32 %152)
br label %154
154: ; preds = %245, %130
%155 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %14, i64 0, i64 0
%156 = getelementptr inbounds [2048 x i32], [2048 x i32]* %155, i64 0, i64 0
%157 = load i32**, i32*** %6
%158 = getelementptr inbounds i32*, i32** %157, i64 0
%159 = load i32*, i32** %158
%160 = call i32 @fread(i32* %156, i32 1, i32 2048, i32* %159)
store i32 %160, i32* %22
%161 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %14, i64 0, i64 1
%162 = getelementptr inbounds [2048 x i32], [2048 x i32]* %161, i64 0, i64 0
%163 = load i32**, i32*** %6
%164 = getelementptr inbounds i32*, i32** %163, i64 1
%165 = load i32*, i32** %164
%166 = call i32 @fread(i32* %162, i32 1, i32 2048, i32* %165)
store i32 %166, i32* %23
store i32 0, i32* %11
br label %167
167: ; preds = %230, %154
%168 = load i32, i32* %11
%169 = load i32, i32* %22
%170 = load i32, i32* %23
%171 = icmp sgt i32 %169, %170
br i1 %171, label %172, label %174
172: ; preds = %167
%173 = load i32, i32* %23
br label %176
174: ; preds = %167
%175 = load i32, i32* %22
br label %176
176: ; preds = %174, %172
%177 = phi i32 [ %173, %172 ], [ %175, %174 ]
%178 = icmp slt i32 %168, %177
br i1 %178, label %179, label %233
179: ; preds = %176
%180 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %14, i64 0, i64 0
%181 = load i32, i32* %11
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds [2048 x i32], [2048 x i32]* %180, i64 0, i64 %182
%184 = load i32, i32* %183
store i32 %184, i32* %24
%185 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %14, i64 0, i64 1
%186 = load i32, i32* %11
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [2048 x i32], [2048 x i32]* %185, i64 0, i64 %187
%189 = load i32, i32* %188
store i32 %189, i32* %25
%190 = load i32, i32* %7
%191 = icmp eq i32 %190, 2
br i1 %191, label %192, label %210
192: ; preds = %179
%193 = load i32, i32* %24
%194 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %14, i64 0, i64 0
%195 = load i32, i32* %11
%196 = add nsw i32 %195, 1
store i32 %196, i32* %11
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [2048 x i32], [2048 x i32]* %194, i64 0, i64 %197
%199 = load i32, i32* %198
%200 = shl i32 %199, 8
%201 = or i32 %193, %200
store i32 %201, i32* %24
%202 = load i32, i32* %25
%203 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %14, i64 0, i64 1
%204 = load i32, i32* %11
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [2048 x i32], [2048 x i32]* %203, i64 0, i64 %205
%207 = load i32, i32* %206
%208 = shl i32 %207, 8
%209 = or i32 %202, %208
store i32 %209, i32* %25
br label %210
210: ; preds = %192, %179
%211 = load i32, i32* %24
%212 = load i32, i32* %25
%213 = sub nsw i32 %211, %212
%214 = load i32, i32* %24
%215 = load i32, i32* %25
%216 = sub nsw i32 %214, %215
%217 = mul nsw i32 %213, %216
%218 = load i32, i32* %12
%219 = add nsw i32 %218, %217
store i32 %219, i32* %12
%220 = load i32, i32* %24
%221 = load i32, i32* %25
%222 = sub nsw i32 %220, %221
%223 = call i32 @abs(i32 %222)
store i32 %223, i32* %26
%224 = load i32, i32* %26
%225 = load i32, i32* %19
%226 = icmp sgt i32 %224, %225
br i1 %226, label %227, label %229
227: ; preds = %210
%228 = load i32, i32* %26
store i32 %228, i32* %19
br label %229
229: ; preds = %227, %210
br label %230
230: ; preds = %229
%231 = load i32, i32* %11
%232 = add nsw i32 %231, 1
store i32 %232, i32* %11
br label %167
233: ; preds = %176
%234 = load i32, i32* %22
%235 = load i32, i32* %17
%236 = add nsw i32 %235, %234
store i32 %236, i32* %17
%237 = load i32, i32* %23
%238 = load i32, i32* %18
%239 = add nsw i32 %238, %237
store i32 %239, i32* %18
%240 = load i32, i32* %22
%241 = load i32, i32* %23
%242 = add nsw i32 %240, %241
%243 = icmp sle i32 %242, 0
br i1 %243, label %244, label %245
244: ; preds = %233
br label %246
245: ; preds = %233
br label %154
246: ; preds = %244
%247 = load i32, i32* %17
%248 = load i32, i32* %18
%249 = icmp sgt i32 %247, %248
br i1 %249, label %250, label %252
250: ; preds = %246
%251 = load i32, i32* %18
br label %254
252: ; preds = %246
%253 = load i32, i32* %17
br label %254
254: ; preds = %252, %250
%255 = phi i32 [ %251, %250 ], [ %253, %252 ]
%256 = load i32, i32* %7
%257 = sdiv i32 %255, %256
store i32 %257, i32* %10
%258 = load i32, i32* %10
%259 = icmp ne i32 %258, 0
br i1 %259, label %261, label %260
260: ; preds = %254
store i32 1, i32* %10
br label %261
261: ; preds = %260, %254
%262 = load i32, i32* %12
%263 = load i32, i32* %10
%264 = sdiv i32 %262, %263
%265 = mul nsw i32 %264, 100
%266 = mul nsw i32 %265, 100
%267 = load i32, i32* %12
%268 = load i32, i32* %10
%269 = srem i32 %267, %268
%270 = mul nsw i32 %269, 100
%271 = mul nsw i32 %270, 100
%272 = load i32, i32* %10
%273 = sdiv i32 %272, 2
%274 = add nsw i32 %271, %273
%275 = load i32, i32* %10
%276 = sdiv i32 %274, %275
%277 = add nsw i32 %266, %276
%278 = call i32 @int_sqrt(i32 %277)
store i32 %278, i32* %13
%279 = load i32, i32* %12
%280 = icmp ne i32 %279, 0
br i1 %280, label %281, label %298
281: ; preds = %261
%282 = load i32, i32* %16
%283 = shl i32 %282, 16
%284 = call i32 @log16(i32 %283)
%285 = mul nsw i32 2, %284
%286 = load i32, i32* %10
%287 = call i32 @log16(i32 %286)
%288 = add nsw i32 %285, %287
%289 = load i32, i32* %12
%290 = call i32 @log16(i32 %289)
%291 = sub nsw i32 %288, %290
%292 = sext i32 %291 to i64
%293 = mul nsw i64 %292, 284619
%294 = mul nsw i64 %293, 100
%295 = add nsw i64 %294, 2147483648
%296 = sdiv i64 %295, 4294967296
%297 = trunc i64 %296 to i32
store i32 %297, i32* %15
br label %299
298: ; preds = %261
store i32 99999, i32* %15
br label %299
299: ; preds = %298, %281
%300 = load i32, i32* %13
%301 = sdiv i32 %300, 100
%302 = load i32, i32* %13
%303 = srem i32 %302, 100
%304 = load i32, i32* %15
%305 = sdiv i32 %304, 100
%306 = load i32, i32* %15
%307 = srem i32 %306, 100
%308 = load i32, i32* %19
%309 = load i32, i32* %17
%310 = load i32, i32* %18
%311 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i32 %301, i32 %303, i32 %305, i32 %307, i32 %308, i32 %309, i32 %310)
%312 = load i32, i32* %15
store i32 %312, i32* %5
br label %313
313: ; preds = %299, %115, %74, %55
%314 = load i32, i32* %5
ret i32 %314
}

LLVM IR (-O2):
@.str = [5 x i8] c"RIFF\00"
@.str.1 = [5 x i8] c"WAVE\00"
@.str.2 = [5 x i8] c"data\00"
@SEEK_CUR = global i32 0
@.str.3 = [57 x i8] c"stddev:%5d.%02d PSNR:%3d.%02d MAXDIFF:%5d bytes:%9d/%9d\0A\00"
define i32 @run_psnr(i32** nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [2 x [2048 x i32]]
%6 = bitcast [2 x [2048 x i32]]* %5 to i8*
%7 = shl nsw i32 %1, 3
%8 = shl nsw i32 -1, %7
%9 = xor i32 %8, -1
%10 = load i32*, i32** %0
%11 = tail call i32 @rewind(i32* %10)
%12 = getelementptr inbounds i32*, i32** %0, i64 1
%13 = load i32*, i32** %12
%14 = tail call i32 @rewind(i32* %13)
%15 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 0
%16 = load i32*, i32** %0
%17 = call i32 @fread(i32* %15, i32 1, i32 12, i32* %16)
%18 = icmp eq i32 %17, 12
br i1 %18, label %19, label %209
19: ; preds = %4
%20 = call i64 @memcmp(i32* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %55
22: ; preds = %19
%23 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 8
%24 = call i64 @memcmp(i32* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %55
26: ; preds = %22
%27 = load i32*, i32** %0
%28 = call i32 @fread(i32* %15, i32 1, i32 8, i32* %27)
%29 = icmp eq i32 %28, 8
br i1 %29, label %30, label %209
30: ; preds = %26
%31 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 4
%32 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 5
%33 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 6
%34 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 7
br label %35
35: ; preds = %30, %38
%36 = call i64 @memcmp(i32* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%37 = icmp eq i64 %36, 0
br i1 %37, label %59, label %38
38: ; preds = %35
%39 = load i32, i32* %31
%40 = load i32, i32* %32
%41 = shl i32 %40, 8
%42 = or i32 %41, %39
%43 = load i32, i32* %33
%44 = shl i32 %43, 16
%45 = or i32 %42, %44
%46 = load i32, i32* %34
%47 = shl i32 %46, 24
%48 = or i32 %45, %47
%49 = load i32*, i32** %0
%50 = load i32, i32* @SEEK_CUR
%51 = call i32 @fseek(i32* %49, i32 %48, i32 %50)
%52 = load i32*, i32** %0
%53 = call i32 @fread(i32* %15, i32 1, i32 8, i32* %52)
%54 = icmp eq i32 %53, 8
br i1 %54, label %35, label %209
55: ; preds = %22, %19
%56 = load i32*, i32** %0
%57 = load i32, i32* @SEEK_CUR
%58 = call i32 @fseek(i32* %56, i32 -12, i32 %57)
br label %59
59: ; preds = %35, %55
%60 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 0
%61 = getelementptr inbounds i32*, i32** %0, i64 1
%62 = load i32*, i32** %61
%63 = call i32 @fread(i32* %60, i32 1, i32 12, i32* %62)
%64 = icmp eq i32 %63, 12
br i1 %64, label %65, label %209
65: ; preds = %59
%66 = call i64 @memcmp(i32* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 8
%70 = call i64 @memcmp(i32* %69, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%71 = icmp eq i64 %70, 0
br i1 %71, label %76, label %72
72: ; preds = %68, %65
%73 = load i32*, i32** %61
%74 = load i32, i32* @SEEK_CUR
%75 = call i32 @fseek(i32* %73, i32 -12, i32 %74)
br label %105
76: ; preds = %68
%77 = load i32*, i32** %61
%78 = call i32 @fread(i32* %60, i32 1, i32 8, i32* %77)
%79 = icmp eq i32 %78, 8
br i1 %79, label %80, label %209
80: ; preds = %76
%81 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 4
%82 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 5
%83 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 6
%84 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 7
br label %85
85: ; preds = %88, %80
%86 = call i64 @memcmp(i32* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%87 = icmp eq i64 %86, 0
br i1 %87, label %105, label %88
88: ; preds = %85
%89 = load i32, i32* %81
%90 = load i32, i32* %82
%91 = shl i32 %90, 8
%92 = or i32 %91, %89
%93 = load i32, i32* %83
%94 = shl i32 %93, 16
%95 = or i32 %92, %94
%96 = load i32, i32* %84
%97 = shl i32 %96, 24
%98 = or i32 %95, %97
%99 = load i32*, i32** %61
%100 = load i32, i32* @SEEK_CUR
%101 = call i32 @fseek(i32* %99, i32 %98, i32 %100)
%102 = load i32*, i32** %61
%103 = call i32 @fread(i32* %60, i32 1, i32 8, i32* %102)
%104 = icmp eq i32 %103, 8
br i1 %104, label %85, label %209
105: ; preds = %85, %72
%106 = lshr i32 %2, 31
%107 = zext i32 %106 to i64
%108 = getelementptr inbounds i32*, i32** %0, i64 %107
%109 = load i32*, i32** %108
%110 = call i32 @llvm.abs.i32(i32 %2, i1 true)
%111 = load i32, i32* @SEEK_CUR
%112 = call i32 @fseek(i32* %109, i32 %110, i32 %111)
%113 = load i32*, i32** %0
%114 = load i32, i32* @SEEK_CUR
%115 = call i32 @fseek(i32* %113, i32 %3, i32 %114)
%116 = load i32*, i32** %12
%117 = load i32, i32* @SEEK_CUR
%118 = call i32 @fseek(i32* %116, i32 %3, i32 %117)
%119 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 0
%120 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 0
%121 = icmp eq i32 %1, 2
br label %122
122: ; preds = %166, %105
%123 = phi i32 [ 0, %105 ], [ %169, %166 ]
%124 = phi i32 [ 0, %105 ], [ %170, %166 ]
%125 = phi i32 [ 0, %105 ], [ %167, %166 ]
%126 = phi i32 [ 0, %105 ], [ %168, %166 ]
%127 = load i32*, i32** %0
%128 = call i32 @fread(i32* %119, i32 1, i32 2048, i32* %127)
%129 = load i32*, i32** %12
%130 = call i32 @fread(i32* %120, i32 1, i32 2048, i32* %129)
%131 = icmp sgt i32 %128, %130
%132 = select i1 %131, i32 %130, i32 %128
%133 = icmp sgt i32 %132, 0
br i1 %133, label %134, label %166
134: ; preds = %122, %154
%135 = phi i32 [ %164, %154 ], [ 0, %122 ]
%136 = phi i32 [ %160, %154 ], [ %126, %122 ]
%137 = phi i32 [ %163, %154 ], [ %125, %122 ]
%138 = sext i32 %135 to i64
%139 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 %138
%140 = load i32, i32* %139
%141 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 %138
%142 = load i32, i32* %141
br i1 %121, label %143, label %154
143: ; preds = %134
%144 = add nsw i32 %135, 1
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 0, i64 %145
%147 = load i32, i32* %146
%148 = shl i32 %147, 8
%149 = or i32 %148, %140
%150 = getelementptr inbounds [2 x [2048 x i32]], [2 x [2048 x i32]]* %5, i64 0, i64 1, i64 %145
%151 = load i32, i32* %150
%152 = shl i32 %151, 8
%153 = or i32 %152, %142
br label %154
154: ; preds = %143, %134
%155 = phi i32 [ %144, %143 ], [ %135, %134 ]
%156 = phi i32 [ %149, %143 ], [ %140, %134 ]
%157 = phi i32 [ %153, %143 ], [ %142, %134 ]
%158 = sub nsw i32 %156, %157
%159 = mul nsw i32 %158, %158
%160 = add nsw i32 %159, %136
%161 = call i32 @llvm.abs.i32(i32 %158, i1 true)
%162 = icmp sgt i32 %161, %137
%163 = select i1 %162, i32 %161, i32 %137
%164 = add nsw i32 %155, 1
%165 = icmp slt i32 %164, %132
br i1 %165, label %134, label %166
166: ; preds = %154, %122
%167 = phi i32 [ %125, %122 ], [ %163, %154 ]
%168 = phi i32 [ %126, %122 ], [ %160, %154 ]
%169 = add nsw i32 %128, %123
%170 = add nsw i32 %130, %124
%171 = add nsw i32 %130, %128
%172 = icmp slt i32 %171, 1
br i1 %172, label %173, label %122
173: ; preds = %166
%174 = icmp sgt i32 %169, %170
%175 = select i1 %174, i32 %170, i32 %169
%176 = sdiv i32 %175, %1
%177 = icmp eq i32 %176, 0
%178 = select i1 %177, i32 1, i32 %176
%179 = sdiv i32 %168, %178
%180 = mul i32 %179, 10000
%181 = srem i32 %168, %178
%182 = mul i32 %181, 10000
%183 = sdiv i32 %178, 2
%184 = add nsw i32 %182, %183
%185 = sdiv i32 %184, %178
%186 = add nsw i32 %185, %180
%187 = call i32 @int_sqrt(i32 %186)
%188 = icmp eq i32 %168, 0
br i1 %188, label %202, label %189
189: ; preds = %173
%190 = shl i32 %9, 16
%191 = call i32 @log16(i32 %190)
%192 = shl nsw i32 %191, 1
%193 = call i32 @log16(i32 %178)
%194 = add nsw i32 %192, %193
%195 = call i32 @log16(i32 %168)
%196 = sub i32 %194, %195
%197 = sext i32 %196 to i64
%198 = mul nsw i64 %197, 28461900
%199 = add nsw i64 %198, 2147483648
%200 = sdiv i64 %199, 4294967296
%201 = trunc i64 %200 to i32
br label %202
202: ; preds = %173, %189
%203 = phi i32 [ %201, %189 ], [ 99999, %173 ]
%204 = sdiv i32 %187, 100
%205 = srem i32 %187, 100
%206 = sdiv i32 %203, 100
%207 = srem i32 %203, 100
%208 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), i32 %204, i32 %205, i32 %206, i32 %207, i32 %167, i32 %169, i32 %170)
br label %209
209: ; preds = %26, %4, %59, %76, %38, %88, %202
%210 = phi i32 [ %203, %202 ], [ 1, %88 ], [ 1, %38 ], [ 1, %76 ], [ 1, %59 ], [ 1, %4 ], [ 1, %26 ]
ret i32 %210
}