#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 /*<<< orphan*/ SEEK_SET;
int abs(int);
int fread(int *, int, int, int /*<<< orphan*/ *);
scalar_t__ 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 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;
  int noseek;
  noseek = fseek(f[0], 0, SEEK_SET) || fseek(f[1], 0, SEEK_SET);
  if (!noseek) {
    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    $0x40b0,%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
mov    0x2e07(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x4069(%rbp)
jne    1214 <run_psnr+0xa4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dda(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x4069(%rbp)
mov    -0x4069(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4048(%rbp)
cmpl   $0x0,-0x4048(%rbp)
jne    1478 <run_psnr+0x308>
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x20(%rbp)
jge    1409 <run_psnr+0x299>
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     1293 <run_psnr+0x123>
movl   $0x1,-0x4(%rbp)
jmp    17c5 <run_psnr+0x655>
mov    -0x4050(%rbp),%rdi
lea    0xd5f(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
jne    13d7 <run_psnr+0x267>
mov    -0x4050(%rbp),%rdi
add    $0x20,%rdi
lea    0xd3e(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
jne    13d7 <run_psnr+0x267>
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     1312 <run_psnr+0x1a2>
movl   $0x1,-0x4(%rbp)
jmp    17c5 <run_psnr+0x655>
jmp    1317 <run_psnr+0x1a7>
mov    -0x4050(%rbp),%rdi
lea    0xce5(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     13d2 <run_psnr+0x262>
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    0x2c59(%rip),%rax
mov    (%rax),%edx
call   1070 <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     13cd <run_psnr+0x25d>
movl   $0x1,-0x4(%rbp)
jmp    17c5 <run_psnr+0x655>
jmp    1317 <run_psnr+0x1a7>
jmp    13f6 <run_psnr+0x286>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2bfe(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1070 <fseek@plt>
jmp    13fb <run_psnr+0x28b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1239 <run_psnr+0xc9>
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,-0x4078(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <abs@plt>
mov    -0x4078(%rbp),%rdi
mov    %eax,%esi
mov    0x2ba8(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2b90(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2b77(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
jmp    147d <run_psnr+0x30d>
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,-0x407c(%rbp)
mov    -0x4058(%rbp),%eax
cmp    -0x405c(%rbp),%eax
jle    14fe <run_psnr+0x38e>
mov    -0x405c(%rbp),%eax
mov    %eax,-0x4080(%rbp)
jmp    150a <run_psnr+0x39a>
mov    -0x4058(%rbp),%eax
mov    %eax,-0x4080(%rbp)
mov    -0x407c(%rbp),%eax
mov    -0x4080(%rbp),%ecx
cmp    %ecx,%eax
jge    15f3 <run_psnr+0x483>
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    158a <run_psnr+0x41a>
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    15e0 <run_psnr+0x470>
mov    -0x4068(%rbp),%eax
mov    %eax,-0x4044(%rbp)
jmp    15e5 <run_psnr+0x475>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14d2 <run_psnr+0x362>
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     1631 <run_psnr+0x4c1>
jmp    1636 <run_psnr+0x4c6>
jmp    147d <run_psnr+0x30d>
mov    -0x403c(%rbp),%eax
cmp    -0x4040(%rbp),%eax
jle    1659 <run_psnr+0x4e9>
mov    -0x4040(%rbp),%eax
mov    %eax,-0x4084(%rbp)
jmp    1665 <run_psnr+0x4f5>
mov    -0x403c(%rbp),%eax
mov    %eax,-0x4084(%rbp)
mov    -0x4084(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1683 <run_psnr+0x513>
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,-0x4088(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4088(%rbp),%eax
add    %ecx,%eax
cltd
idivl  -0x20(%rbp)
add    %eax,%edi
call   1090 <int_sqrt@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1745 <run_psnr+0x5d5>
mov    -0x4038(%rbp),%edi
shl    $0x10,%edi
call   1080 <log16@plt>
shl    $0x1,%eax
mov    %eax,-0x4090(%rbp)
mov    -0x20(%rbp),%edi
call   1080 <log16@plt>
mov    %eax,%ecx
mov    -0x4090(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x408c(%rbp)
mov    -0x28(%rbp),%edi
call   1080 <log16@plt>
mov    %eax,%ecx
mov    -0x408c(%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    174f <run_psnr+0x5df>
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,-0x4094(%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    -0x4094(%rbp),%edx
mov    -0x4044(%rbp),%r9d
mov    -0x403c(%rbp),%r10d
mov    -0x4040(%rbp),%eax
lea    0x860(%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    $0x40b0,%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    %esi,%r15d
lea    0x0(,%r15,8),%ecx
mov    $0xffffffff,%r13d
shl    %cl,%r13d
mov    %edx,%r12d
mov    %rdi,%rbp
mov    (%rdi),%rdi
mov    0x2e40(%rip),%rbx
mov    (%rbx),%edx
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %esi,%esi
call   1060 <fseek@plt>
test   %rax,%rax
mov    %rbp,0x8(%rsp)
jne    11c8 <run_psnr+0x68>
mov    0x8(%rbp),%rdi
mov    (%rbx),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
test   %rax,%rax
je     13ae <run_psnr+0x24e>
not    %r13d
mov    %r13d,0x1c(%rsp)
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    11f8 <run_psnr+0x98>
nopw   0x0(%rax,%rax,1)
add    %r12d,%r13d
mov    0x10(%rsp),%rcx
add    %eax,%ecx
mov    %rcx,0x10(%rsp)
add    %r12d,%eax
jle    12a1 <run_psnr+0x141>
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    11e0 <run_psnr+0x80>
xor    %edx,%edx
jmp    1273 <run_psnr+0x113>
cs 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    11e0 <run_psnr+0x80>
movslq %edx,%rcx
mov    0x20(%rsp,%rcx,4),%esi
mov    0x2020(%rsp,%rcx,4),%edi
cmp    $0x2,%r15d
jne    1250 <run_psnr+0xf0>
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    1250 <run_psnr+0xf0>
mov    0x10(%rsp),%rcx
cmp    %ecx,%r13d
mov    %r13d,%eax
cmovg  %ecx,%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   1080 <int_sqrt@plt>
test   %ebx,%ebx
je     1343 <run_psnr+0x1e3>
mov    0x1c(%rsp),%edi
shl    $0x10,%edi
mov    %eax,0x8(%rsp)
call   1070 <log16@plt>
mov    %eax,%r12d
mov    %r15d,%edi
call   1070 <log16@plt>
lea    (%rax,%r12,2),%ebp
mov    %ebx,%edi
call   1070 <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    1348 <run_psnr+0x1e8>
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    0xc87(%rip),%rdi
mov    %r14d,%r9d
push   0x10(%rsp)
push   %r13
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    0x0(%rbp),%rcx
lea    0x20(%rsp),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
mov    $0xc,%edx
call   1030 <fread@plt>
cmp    $0xc,%eax
jne    139a <run_psnr+0x23a>
lea    0xc29(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    140a <run_psnr+0x2aa>
lea    0x40(%rsp),%rdi
lea    0xc0e(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     14eb <run_psnr+0x38b>
mov    0x8(%rsp),%rbx
mov    (%rbx),%rdi
mov    0x2bcf(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1060 <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    139a <run_psnr+0x23a>
lea    0xba8(%rip),%rsi
mov    %rbp,%rdi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    148c <run_psnr+0x32c>
lea    0x2040(%rsp),%rdi
lea    0xb8c(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     158e <run_psnr+0x42e>
mov    0x8(%rsp),%rbp
mov    0x8(%rbp),%rdi
mov    0x2b4c(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffff4,%esi
call   1060 <fseek@plt>
mov    %r12d,%eax
shr    $0x1f,%eax
mov    0x0(%rbp,%rax,8),%rdi
mov    %r12d,%esi
neg    %esi
cmovs  %r12d,%esi
mov    0x2b25(%rip),%rbx
mov    (%rbx),%edx
call   1060 <fseek@plt>
mov    0x0(%rbp),%rdi
mov    (%rbx),%edx
mov    %r14d,%esi
call   1060 <fseek@plt>
mov    0x8(%rbp),%rdi
mov    (%rbx),%edx
mov    %r14d,%esi
call   1060 <fseek@plt>
jmp    11c8 <run_psnr+0x68>
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    139a <run_psnr+0x23a>
mov    0x2acc(%rip),%rbp
lea    0x20(%rsp),%rdi
lea    0xae2(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
mov    0x8(%rsp),%rbx
je     1425 <run_psnr+0x2c5>
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(%rbp),%edx
call   1060 <fseek@plt>
mov    (%rbx),%rcx
mov    $0x1,%ebx
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
cmp    $0x8,%eax
je     151c <run_psnr+0x3bc>
jmp    139a <run_psnr+0x23a>
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    139a <run_psnr+0x23a>
mov    %rbp,%rdi
lea    0xa49(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
mov    0x8(%rsp),%rbp
je     14a8 <run_psnr+0x348>
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(%rbp),%rdi
mov    0x29db(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    0x8(%rbp),%rcx
mov    $0x1,%ebx
lea    0x2020(%rsp),%rbp
jmp    159c <run_psnr+0x43c>

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

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