#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 uint32_t;
typedef size_t int64_t;
typedef int int32_t;
typedef size_t int16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double fabs(double);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(int *, int, int, int /*<<< orphan*/ *);
scalar_t__ memcmp(int *, ...);
int /*<<< orphan*/ printf(char *, char *, ...);
double sqrt(double);
scalar_t__ strcmp(char *, char *);
double strtod(char *, char **);
int main(int argc, char **argv) {
  uint8_t buf1[3000], buf2[3000], *p1, *p2;
  int64_t acc = 0, cnt = 0;
  size_t r1, r2, i;
  double ref = 0.0;
  if (argc != 4)
    goto fail;
  if (strcmp(argv[3], "?")) {
    char *p;
    ref = strtod(argv[3], &p);
    if (*p || p == argv[3])
      goto fail;
  }
  FILE *fp1 = fopen(argv[1], "rb");
  FILE *fp2 = fopen(argv[2], "rb");
  if (!fp1 || !fp2)
    goto fail;
  if (fread(buf1, 44, 1, fp1) != 1 || fread(buf2, 44, 1, fp2) != 1)
    goto fail;
  if (memcmp(buf1, buf2, 44) || memcmp(buf1, "RIFF", 4))
    goto fail;
  int bps;
  switch (buf1[34] | (buf1[35] << 8)) {
  case 16:
    bps = 2;
    break;
  case 24:
    bps = 3;
    break;
  default:
    goto fail;
  }
  do {
    r1 = fread(buf1, 1, 3000, fp1);
    r2 = fread(buf2, 1, 3000, fp2);
    if (r1 != r2 || r1 % bps)
      goto fail;
    for (i = 0, p1 = buf1, p2 = buf2; i < r1 / bps; i++, p1 += bps, p2 += bps) {
      int64_t d;
      if (bps == 3) {
        uint32_t u1 = (p1[0] << 8) | (p1[1] << 16) | ((uint32_t)p1[2] << 24);
        uint32_t u2 = (p2[0] << 8) | (p2[1] << 16) | ((uint32_t)p2[2] << 24);
        int32_t v1 = (int32_t)u1 >> 8;
        int32_t v2 = (int32_t)u2 >> 8;
        d = v1 - v2;
      } else {
        int16_t v1 = p1[0] | (p1[1] << 8);
        int16_t v2 = p2[0] | (p2[1] << 8);
        d = v1 - v2;
      }
      acc += d * d;
    }
    cnt += i;
  } while (r1 == 3000);
  if (!cnt)
    goto fail;
  double var = (double)acc / cnt;
  double dev = sqrt(var);
  if (strcmp(argv[3], "?")) {
    if (fabs(dev - ref) > 0.1)
      goto fail;
    printf("%s: OK\n", argv[1]);
  } else {
    printf("%s: %f\n", argv[1], dev);
  }
  return 0;
fail:
  printf("%s: FAILED\n", argc > 1 ? argv[1] : "???");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5e80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x5de8(%rbp)
movq   $0x0,-0x5df0(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x5e10(%rbp)
ff
cmpl   $0x4,-0x8(%rbp)
je     11b9 <main+0x49>
jmp    16f8 <main+0x588>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe96(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1225 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x5e18(%rbp),%rsi
call   1040 <strtod@plt>
movsd  %xmm0,-0x5e10(%rbp)
ff
mov    -0x5e18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    121b <main+0xab>
mov    -0x5e18(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x18(%rcx),%rax
jne    1220 <main+0xb0>
jmp    16f8 <main+0x588>
jmp    1225 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe04(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x5e20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xde9(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x5e28(%rbp)
cmpq   $0x0,-0x5e20(%rbp)
je     1277 <main+0x107>
cmpq   $0x0,-0x5e28(%rbp)
jne    127c <main+0x10c>
jmp    16f8 <main+0x588>
lea    -0x2ef0(%rbp),%rdi
mov    -0x5e20(%rbp),%rcx
mov    $0x2c,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    12c8 <main+0x158>
lea    -0x5dd0(%rbp),%rdi
mov    -0x5e28(%rbp),%rcx
mov    $0x2c,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     12cd <main+0x15d>
jmp    16f8 <main+0x588>
lea    -0x2ef0(%rbp),%rdi
lea    -0x5dd0(%rbp),%rsi
xor    %eax,%eax
mov    $0x2c,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
jne    1315 <main+0x1a5>
lea    -0x2ef0(%rbp),%rdi
lea    0xd3c(%rip),%rsi
xor    %eax,%eax
mov    $0x4,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     131a <main+0x1aa>
jmp    16f8 <main+0x588>
mov    -0x2e68(%rbp),%eax
mov    -0x2e64(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x5e6c(%rbp)
sub    $0x10,%eax
je     1353 <main+0x1e3>
jmp    133f <main+0x1cf>
mov    -0x5e6c(%rbp),%eax
sub    $0x18,%eax
je     1362 <main+0x1f2>
jmp    1371 <main+0x201>
movl   $0x2,-0x5e2c(%rbp)
jmp    1376 <main+0x206>
movl   $0x3,-0x5e2c(%rbp)
jmp    1376 <main+0x206>
jmp    16f8 <main+0x588>
jmp    137b <main+0x20b>
lea    -0x2ef0(%rbp),%rdi
mov    -0x5e20(%rbp),%rcx
mov    $0x1,%esi
mov    $0xbb8,%edx
call   1030 <fread@plt>
cltq
mov    %rax,-0x5df8(%rbp)
lea    -0x5dd0(%rbp),%rdi
mov    -0x5e28(%rbp),%rcx
mov    $0x1,%esi
mov    $0xbb8,%edx
call   1030 <fread@plt>
cltq
mov    %rax,-0x5e00(%rbp)
mov    -0x5df8(%rbp),%rax
cmp    -0x5e00(%rbp),%rax
jne    13f8 <main+0x288>
mov    -0x5df8(%rbp),%rax
movslq -0x5e2c(%rbp),%rcx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
je     13fd <main+0x28d>
jmp    16f8 <main+0x588>
movq   $0x0,-0x5e08(%rbp)
lea    -0x2ef0(%rbp),%rax
mov    %rax,-0x5dd8(%rbp)
lea    -0x5dd0(%rbp),%rax
mov    %rax,-0x5de0(%rbp)
mov    -0x5e08(%rbp),%rax
mov    %rax,-0x5e78(%rbp)
mov    -0x5df8(%rbp),%rax
movslq -0x5e2c(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x5e78(%rbp),%rax
cmp    %rcx,%rax
jae    15c4 <main+0x454>
cmpl   $0x3,-0x5e2c(%rbp)
jne    14fd <main+0x38d>
mov    -0x5dd8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x5dd8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x5dd8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x5e3c(%rbp)
mov    -0x5de0(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x5de0(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x5de0(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x5e40(%rbp)
mov    -0x5e3c(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x5e44(%rbp)
mov    -0x5e40(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x5e48(%rbp)
mov    -0x5e44(%rbp),%eax
sub    -0x5e48(%rbp),%eax
cltq
mov    %rax,-0x5e38(%rbp)
jmp    1554 <main+0x3e4>
mov    -0x5dd8(%rbp),%rax
mov    (%rax),%eax
mov    -0x5dd8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x5e50(%rbp)
mov    -0x5de0(%rbp),%rax
mov    (%rax),%eax
mov    -0x5de0(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x5e58(%rbp)
mov    -0x5e50(%rbp),%rax
sub    -0x5e58(%rbp),%rax
mov    %rax,-0x5e38(%rbp)
mov    -0x5e38(%rbp),%rax
imul   -0x5e38(%rbp),%rax
ff
add    -0x5de8(%rbp),%rax
mov    %rax,-0x5de8(%rbp)
mov    -0x5e08(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x5e08(%rbp)
mov    -0x5e2c(%rbp),%ecx
mov    -0x5dd8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x5dd8(%rbp)
mov    -0x5e2c(%rbp),%ecx
mov    -0x5de0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x5de0(%rbp)
jmp    1424 <main+0x2b4>
mov    -0x5e08(%rbp),%rax
add    -0x5df0(%rbp),%rax
mov    %rax,-0x5df0(%rbp)
cmpq   $0xbb8,-0x5df8(%rbp)
je     137b <main+0x20b>
cmpq   $0x0,-0x5df0(%rbp)
jne    15fd <main+0x48d>
jmp    16f8 <main+0x588>
movq   -0x5de8(%rbp),%xmm0
ff
movaps 0x9f4(%rip),%xmm3
punpckldq %xmm3,%xmm0
movapd 0x9f8(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x5df0(%rbp),%xmm1
ff
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x5e60(%rbp)
ff
movsd  -0x5e60(%rbp),%xmm0
ff
call   1090 <sqrt@plt>
movsd  %xmm0,-0x5e68(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0x9ec(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     16ce <main+0x55e>
movsd  -0x5e68(%rbp),%xmm0
ff
subsd  -0x5e10(%rbp),%xmm0
ff
movaps 0x988(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0x98c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    16b3 <main+0x543>
jmp    16f8 <main+0x588>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x97e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    16ec <main+0x57c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
movsd  -0x5e68(%rbp),%xmm0
ff
lea    0x963(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1745 <main+0x5d5>
cmpl   $0x1,-0x8(%rbp)
jle    1716 <main+0x5a6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x5e80(%rbp)
jmp    1729 <main+0x5b9>
lea    0x93f(%rip),%rax
mov    %rax,-0x5e80(%rbp)
jmp    1729 <main+0x5b9>
mov    -0x5e80(%rbp),%rsi
lea    0x919(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5e80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x5df8,%rsp
mov    %rsi,%rbx
mov    %edi,%r13d
cmp    $0x4,%edi
jne    14c5 <main+0x355>
mov    0x18(%rbx),%rdi
lea    0xec3(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11cc <main+0x5c>
mov    0x18(%rbx),%rdi
lea    0x30(%rsp),%rsi
call   1040 <strtod@plt>
mov    0x30(%rsp),%rax
cmpb   $0x0,(%rax)
jne    14cb <main+0x35b>
cmp    0x18(%rbx),%rax
jne    11d0 <main+0x60>
jmp    14cb <main+0x35b>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0x8(%rbx),%rdi
lea    0xe57(%rip),%rbp
mov    %rbp,%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
mov    %rbp,%rsi
call   1080 <fopen@plt>
test   %r14,%r14
je     14cb <main+0x35b>
mov    %rax,%rbp
test   %rax,%rax
je     14cb <main+0x35b>
lea    0x30(%rsp),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    14cb <main+0x35b>
lea    0x2f10(%rsp),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    14cb <main+0x35b>
lea    0x30(%rsp),%rdi
lea    0x2f10(%rsp),%rsi
mov    $0x2c,%edx
xor    %eax,%eax
call   1060 <memcmp@plt>
test   %rax,%rax
jne    14cb <main+0x35b>
lea    0xdc2(%rip),%rsi
lea    0x30(%rsp),%rdi
mov    $0x4,%edx
xor    %eax,%eax
call   1060 <memcmp@plt>
test   %rax,%rax
jne    14cb <main+0x35b>
mov    0xbc(%rsp),%eax
shl    $0x8,%eax
or     0xb8(%rsp),%eax
cmp    $0x10,%eax
je     12c7 <main+0x157>
cmp    $0x18,%eax
jne    14cb <main+0x35b>
mov    %rbp,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    $0x3,%r8d
mov    $0x1,%r14b
jmp    12da <main+0x16a>
mov    %rbp,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    $0x2,%r8d
xor    %r14d,%r14d
lea    0x0(,%r8,4),%r12
xor    %eax,%eax
xor    %r15d,%r15d
mov    %r8,0x28(%rsp)
jmp    1304 <main+0x194>
xor    %ecx,%ecx
mov    (%rsp),%rax
add    %rcx,%rax
cmp    $0xbb8,%r9d
jne    1427 <main+0x2b7>
mov    %rax,(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0xbb8,%edx
mov    0x18(%rsp),%rcx
call   1030 <fread@plt>
mov    %eax,%ebp
lea    0x2f10(%rsp),%rdi
mov    $0x1,%esi
mov    $0xbb8,%edx
mov    0x10(%rsp),%rcx
call   1030 <fread@plt>
mov    0x28(%rsp),%r8
cmp    %eax,%ebp
jne    14c5 <main+0x355>
mov    %ebp,%r9d
movslq %ebp,%rcx
mov    %rcx,%rax
shr    $0x20,%rax
je     1365 <main+0x1f5>
mov    %rcx,%rax
xor    %edx,%edx
div    %r8
jmp    136d <main+0x1fd>
mov    %r9d,%eax
xor    %edx,%edx
div    %r8d
test   %rdx,%rdx
jne    14c5 <main+0x355>
cmp    %rcx,%r8
ja     12ee <main+0x17e>
cmp    $0x2,%rax
mov    $0x1,%ecx
cmovb  %rcx,%rax
xor    %edx,%edx
xor    %ecx,%ecx
jmp    13da <main+0x26a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x34(%rsp,%rdx,1),%edi
shl    $0x8,%edi
or     %esi,%edi
movslq %edi,%rsi
mov    0x2f14(%rsp,%rdx,1),%edi
shl    $0x8,%edi
or     0x2f10(%rsp,%rdx,1),%edi
movslq %edi,%rdi
sub    %rdi,%rsi
imul   %rsi,%rsi
add    %rsi,%r15
add    $0x1,%rcx
add    %r12,%rdx
cmp    %rax,%rcx
je     12f0 <main+0x180>
mov    0x30(%rsp,%rdx,1),%esi
test   %r14b,%r14b
je     13a0 <main+0x230>
shl    $0x8,%esi
mov    0x34(%rsp,%rdx,1),%edi
mov    0x38(%rsp,%rdx,1),%ebp
shl    $0x10,%edi
or     %esi,%edi
shl    $0x18,%ebp
or     %edi,%ebp
mov    0x2f10(%rsp,%rdx,1),%esi
mov    0x2f14(%rsp,%rdx,1),%edi
shl    $0x8,%esi
shl    $0x10,%edi
or     %esi,%edi
mov    0x2f18(%rsp,%rdx,1),%esi
shl    $0x18,%esi
or     %edi,%esi
sar    $0x8,%ebp
sar    $0x8,%esi
sub    %esi,%ebp
movslq %ebp,%rsi
jmp    13c3 <main+0x253>
test   %rax,%rax
je     14c5 <main+0x355>
mov    %rax,%rcx
movq   %r15,%xmm1
movdqa 0xbc0(%rip),%xmm2
punpckldq %xmm2,%xmm1
movapd 0xbc4(%rip),%xmm3
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movq   %rax,%xmm1
punpckldq %xmm2,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1489 <main+0x319>
sqrtsd %xmm0,%xmm0
jmp    148e <main+0x31e>
call   1090 <sqrt@plt>
movapd %xmm0,(%rsp)
mov    0x18(%rbx),%rdi
lea    0xbc0(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     14ff <main+0x38f>
movapd (%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
andpd  0xb65(%rip),%xmm0
ucomisd 0xb6d(%rip),%xmm0
jbe    151a <main+0x3aa>
cmp    $0x2,%r13d
jl     14d1 <main+0x361>
mov    0x8(%rbx),%rsi
jmp    14d8 <main+0x368>
lea    0xb84(%rip),%rsi
lea    0xb71(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x5df8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbx),%rsi
lea    0xb3e(%rip),%rdi
movapd (%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
xor    %ebx,%ebx
jmp    14eb <main+0x37b>
mov    0x8(%rbx),%rsi
lea    0xb1b(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    14eb <main+0x37b>

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [5 x i8] c"RIFF\00"
@.str.3 = [8 x i8] c"%s: OK\0A\00"
@.str.4 = [8 x i8] c"%s: %f\0A\00"
@.str.5 = [12 x i8] c"%s: FAILED\0A\00"
@.str.6 = [4 x i8] c"???\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3000 x i32]
%7 = alloca [3000 x i32]
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca double
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32
%20 = alloca i64
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i64
%26 = alloca i64
%27 = alloca double
%28 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %10
store i64 0, i64* %11
store double 0.000000e+00, double* %15
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 4
br i1 %30, label %31, label %32
31: ; preds = %2
br label %253
32: ; preds = %2
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 3
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %55
38: ; preds = %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 3
%41 = load i8*, i8** %40
%42 = call double @strtod(i8* %41, i8** %16)
store double %42, double* %15
%43 = load i8*, i8** %16
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %45, 0
br i1 %46, label %53, label %47
47: ; preds = %38
%48 = load i8*, i8** %16
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 3
%51 = load i8*, i8** %50
%52 = icmp eq i8* %48, %51
br i1 %52, label %53, label %54
53: ; preds = %47, %38
br label %253
54: ; preds = %47
br label %55
55: ; preds = %54, %32
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %59, i32** %17
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %63, i32** %18
%64 = load i32*, i32** %17
%65 = icmp ne i32* %64, null
br i1 %65, label %66, label %69
66: ; preds = %55
%67 = load i32*, i32** %18
%68 = icmp ne i32* %67, null
br i1 %68, label %70, label %69
69: ; preds = %66, %55
br label %253
70: ; preds = %66
%71 = getelementptr inbounds [3000 x i32], [3000 x i32]* %6, i64 0, i64 0
%72 = load i32*, i32** %17
%73 = call i32 @fread(i32* %71, i32 44, i32 1, i32* %72)
%74 = icmp ne i32 %73, 1
br i1 %74, label %80, label %75
75: ; preds = %70
%76 = getelementptr inbounds [3000 x i32], [3000 x i32]* %7, i64 0, i64 0
%77 = load i32*, i32** %18
%78 = call i32 @fread(i32* %76, i32 44, i32 1, i32* %77)
%79 = icmp ne i32 %78, 1
br i1 %79, label %80, label %81
80: ; preds = %75, %70
br label %253
81: ; preds = %75
%82 = getelementptr inbounds [3000 x i32], [3000 x i32]* %6, i64 0, i64 0
%83 = getelementptr inbounds [3000 x i32], [3000 x i32]* %7, i64 0, i64 0
%84 = call i64 (i32*, ...) @memcmp(i32* %82, i32* %83, i32 44)
%85 = icmp ne i64 %84, 0
br i1 %85, label %90, label %86
86: ; preds = %81
%87 = getelementptr inbounds [3000 x i32], [3000 x i32]* %6, i64 0, i64 0
%88 = call i64 (i32*, ...) @memcmp(i32* %87, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%89 = icmp ne i64 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %86, %81
br label %253
91: ; preds = %86
%92 = getelementptr inbounds [3000 x i32], [3000 x i32]* %6, i64 0, i64 34
%93 = load i32, i32* %92
%94 = getelementptr inbounds [3000 x i32], [3000 x i32]* %6, i64 0, i64 35
%95 = load i32, i32* %94
%96 = shl i32 %95, 8
%97 = or i32 %93, %96
switch i32 %97, label %100 [
i32 16, label %98
i32 24, label %99
]
98: ; preds = %91
store i32 2, i32* %19
br label %101
99: ; preds = %91
store i32 3, i32* %19
br label %101
100: ; preds = %91
br label %253
101: ; preds = %99, %98
br label %102
102: ; preds = %214, %101
%103 = getelementptr inbounds [3000 x i32], [3000 x i32]* %6, i64 0, i64 0
%104 = load i32*, i32** %17
%105 = call i32 @fread(i32* %103, i32 1, i32 3000, i32* %104)
%106 = sext i32 %105 to i64
store i64 %106, i64* %12
%107 = getelementptr inbounds [3000 x i32], [3000 x i32]* %7, i64 0, i64 0
%108 = load i32*, i32** %18
%109 = call i32 @fread(i32* %107, i32 1, i32 3000, i32* %108)
%110 = sext i32 %109 to i64
store i64 %110, i64* %13
%111 = load i64, i64* %12
%112 = load i64, i64* %13
%113 = icmp ne i64 %111, %112
br i1 %113, label %120, label %114
114: ; preds = %102
%115 = load i64, i64* %12
%116 = load i32, i32* %19
%117 = sext i32 %116 to i64
%118 = urem i64 %115, %117
%119 = icmp ne i64 %118, 0
br i1 %119, label %120, label %121
120: ; preds = %114, %102
br label %253
121: ; preds = %114
store i64 0, i64* %14
%122 = getelementptr inbounds [3000 x i32], [3000 x i32]* %6, i64 0, i64 0
store i32* %122, i32** %8
%123 = getelementptr inbounds [3000 x i32], [3000 x i32]* %7, i64 0, i64 0
store i32* %123, i32** %9
br label %124
124: ; preds = %199, %121
%125 = load i64, i64* %14
%126 = load i64, i64* %12
%127 = load i32, i32* %19
%128 = sext i32 %127 to i64
%129 = udiv i64 %126, %128
%130 = icmp ult i64 %125, %129
br i1 %130, label %131, label %210
131: ; preds = %124
%132 = load i32, i32* %19
%133 = icmp eq i32 %132, 3
br i1 %133, label %134, label %171
134: ; preds = %131
%135 = load i32*, i32** %8
%136 = getelementptr inbounds i32, i32* %135, i64 0
%137 = load i32, i32* %136
%138 = shl i32 %137, 8
%139 = load i32*, i32** %8
%140 = getelementptr inbounds i32, i32* %139, i64 1
%141 = load i32, i32* %140
%142 = shl i32 %141, 16
%143 = or i32 %138, %142
%144 = load i32*, i32** %8
%145 = getelementptr inbounds i32, i32* %144, i64 2
%146 = load i32, i32* %145
%147 = shl i32 %146, 24
%148 = or i32 %143, %147
store i32 %148, i32* %21
%149 = load i32*, i32** %9
%150 = getelementptr inbounds i32, i32* %149, i64 0
%151 = load i32, i32* %150
%152 = shl i32 %151, 8
%153 = load i32*, i32** %9
%154 = getelementptr inbounds i32, i32* %153, i64 1
%155 = load i32, i32* %154
%156 = shl i32 %155, 16
%157 = or i32 %152, %156
%158 = load i32*, i32** %9
%159 = getelementptr inbounds i32, i32* %158, i64 2
%160 = load i32, i32* %159
%161 = shl i32 %160, 24
%162 = or i32 %157, %161
store i32 %162, i32* %22
%163 = load i32, i32* %21
%164 = ashr i32 %163, 8
store i32 %164, i32* %23
%165 = load i32, i32* %22
%166 = ashr i32 %165, 8
store i32 %166, i32* %24
%167 = load i32, i32* %23
%168 = load i32, i32* %24
%169 = sub nsw i32 %167, %168
%170 = sext i32 %169 to i64
store i64 %170, i64* %20
br label %193
171: ; preds = %131
%172 = load i32*, i32** %8
%173 = getelementptr inbounds i32, i32* %172, i64 0
%174 = load i32, i32* %173
%175 = load i32*, i32** %8
%176 = getelementptr inbounds i32, i32* %175, i64 1
%177 = load i32, i32* %176
%178 = shl i32 %177, 8
%179 = or i32 %174, %178
%180 = sext i32 %179 to i64
store i64 %180, i64* %25
%181 = load i32*, i32** %9
%182 = getelementptr inbounds i32, i32* %181, i64 0
%183 = load i32, i32* %182
%184 = load i32*, i32** %9
%185 = getelementptr inbounds i32, i32* %184, i64 1
%186 = load i32, i32* %185
%187 = shl i32 %186, 8
%188 = or i32 %183, %187
%189 = sext i32 %188 to i64
store i64 %189, i64* %26
%190 = load i64, i64* %25
%191 = load i64, i64* %26
%192 = sub i64 %190, %191
store i64 %192, i64* %20
br label %193
193: ; preds = %171, %134
%194 = load i64, i64* %20
%195 = load i64, i64* %20
%196 = mul i64 %194, %195
%197 = load i64, i64* %10
%198 = add i64 %197, %196
store i64 %198, i64* %10
br label %199
199: ; preds = %193
%200 = load i64, i64* %14
%201 = add i64 %200, 1
store i64 %201, i64* %14
%202 = load i32, i32* %19
%203 = load i32*, i32** %8
%204 = sext i32 %202 to i64
%205 = getelementptr inbounds i32, i32* %203, i64 %204
store i32* %205, i32** %8
%206 = load i32, i32* %19
%207 = load i32*, i32** %9
%208 = sext i32 %206 to i64
%209 = getelementptr inbounds i32, i32* %207, i64 %208
store i32* %209, i32** %9
br label %124
210: ; preds = %124
%211 = load i64, i64* %14
%212 = load i64, i64* %11
%213 = add i64 %212, %211
store i64 %213, i64* %11
br label %214
214: ; preds = %210
%215 = load i64, i64* %12
%216 = icmp eq i64 %215, 3000
br i1 %216, label %102, label %217
217: ; preds = %214
%218 = load i64, i64* %11
%219 = icmp ne i64 %218, 0
br i1 %219, label %221, label %220
220: ; preds = %217
br label %253
221: ; preds = %217
%222 = load i64, i64* %10
%223 = uitofp i64 %222 to double
%224 = load i64, i64* %11
%225 = uitofp i64 %224 to double
%226 = fdiv double %223, %225
store double %226, double* %27
%227 = load double, double* %27
%228 = call double @sqrt(double %227)
store double %228, double* %28
%229 = load i8**, i8*** %5
%230 = getelementptr inbounds i8*, i8** %229, i64 3
%231 = load i8*, i8** %230
%232 = call i64 @strcmp(i8* %231, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%233 = icmp ne i64 %232, 0
br i1 %233, label %234, label %246
234: ; preds = %221
%235 = load double, double* %28
%236 = load double, double* %15
%237 = fsub double %235, %236
%238 = call double @llvm.fabs.f64(double %237)
%239 = fcmp ogt double %238, 1.000000e-01
br i1 %239, label %240, label %241
240: ; preds = %234
br label %253
241: ; preds = %234
%242 = load i8**, i8*** %5
%243 = getelementptr inbounds i8*, i8** %242, i64 1
%244 = load i8*, i8** %243
%245 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %244)
br label %252
246: ; preds = %221
%247 = load i8**, i8*** %5
%248 = getelementptr inbounds i8*, i8** %247, i64 1
%249 = load i8*, i8** %248
%250 = load double, double* %28
%251 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %249, double %250)
br label %252
252: ; preds = %246, %241
store i32 0, i32* %3
br label %264
253: ; preds = %240, %220, %120, %100, %90, %80, %69, %53, %31
%254 = load i32, i32* %4
%255 = icmp sgt i32 %254, 1
br i1 %255, label %256, label %260
256: ; preds = %253
%257 = load i8**, i8*** %5
%258 = getelementptr inbounds i8*, i8** %257, i64 1
%259 = load i8*, i8** %258
br label %261
260: ; preds = %253
br label %261
261: ; preds = %260, %256
%262 = phi i8* [ %259, %256 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), %260 ]
%263 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %262)
store i32 1, i32* %3
br label %264
264: ; preds = %261, %252
%265 = load i32, i32* %3
ret i32 %265
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [5 x i8] c"RIFF\00"
@.str.3 = [8 x i8] c"%s: OK\0A\00"
@.str.4 = [8 x i8] c"%s: %f\0A\00"
@.str.5 = [12 x i8] c"%s: FAILED\0A\00"
@.str.6 = [4 x i8] c"???\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [3000 x i32]
%4 = alloca [3000 x i32]
%5 = alloca i8*
%6 = bitcast [3000 x i32]* %3 to i8*
%7 = bitcast [3000 x i32]* %4 to i8*
%8 = icmp eq i32 %0, 4
br i1 %8, label %9, label %153
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %26, label %14
14: ; preds = %9
%15 = bitcast i8** %5 to i8*
%16 = load i8*, i8** %10
%17 = call double @strtod(i8* %16, i8** %5)
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %14
%22 = load i8*, i8** %10
%23 = icmp eq i8* %18, %22
br i1 %23, label %24, label %25
24: ; preds = %14, %21
br label %155
25: ; preds = %21
br label %26
26: ; preds = %25, %9
%27 = phi double [ %17, %25 ], [ 0.000000e+00, %9 ]
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = tail call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%31 = getelementptr inbounds i8*, i8** %1, i64 2
%32 = load i8*, i8** %31
%33 = tail call i32* @fopen(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp ne i32* %30, null
%35 = icmp ne i32* %33, null
%36 = and i1 %34, %35
br i1 %36, label %37, label %155
37: ; preds = %26
%38 = getelementptr inbounds [3000 x i32], [3000 x i32]* %3, i64 0, i64 0
%39 = call i32 @fread(i32* %38, i32 44, i32 1, i32* %30)
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %155
41: ; preds = %37
%42 = getelementptr inbounds [3000 x i32], [3000 x i32]* %4, i64 0, i64 0
%43 = call i32 @fread(i32* %42, i32 44, i32 1, i32* %33)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %155
45: ; preds = %41
%46 = call i64 (i32*, ...) @memcmp(i32* %38, i32* %42, i32 44)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %155
48: ; preds = %45
%49 = call i64 (i32*, ...) @memcmp(i32* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %155
51: ; preds = %48
%52 = getelementptr inbounds [3000 x i32], [3000 x i32]* %3, i64 0, i64 34
%53 = load i32, i32* %52
%54 = getelementptr inbounds [3000 x i32], [3000 x i32]* %3, i64 0, i64 35
%55 = load i32, i32* %54
%56 = shl i32 %55, 8
%57 = or i32 %56, %53
switch i32 %57, label %155 [
i32 16, label %59
i32 24, label %58
]
58: ; preds = %51
br label %59
59: ; preds = %51, %58
%60 = phi i1 [ true, %58 ], [ false, %51 ]
%61 = phi i64 [ 3, %58 ], [ 2, %51 ]
br label %62
62: ; preds = %128, %59
%63 = phi i64 [ 0, %59 ], [ %131, %128 ]
%64 = phi i64 [ 0, %59 ], [ %130, %128 ]
%65 = call i32 @fread(i32* %38, i32 1, i32 3000, i32* %30)
%66 = sext i32 %65 to i64
%67 = call i32 @fread(i32* %42, i32 1, i32 3000, i32* %33)
%68 = icmp eq i32 %65, %67
br i1 %68, label %69, label %153
69: ; preds = %62
%70 = urem i64 %66, %61
%71 = udiv i64 %66, %61
%72 = icmp eq i64 %70, 0
br i1 %72, label %73, label %153
73: ; preds = %69
%74 = icmp ugt i64 %61, %66
br i1 %74, label %128, label %75
75: ; preds = %73
%76 = call i64 @llvm.umax.i64(i64 %71, i64 1)
br label %77
77: ; preds = %75, %120
%78 = phi i32* [ %125, %120 ], [ %38, %75 ]
%79 = phi i32* [ %126, %120 ], [ %42, %75 ]
%80 = phi i64 [ %123, %120 ], [ %64, %75 ]
%81 = phi i64 [ %124, %120 ], [ 0, %75 ]
%82 = load i32, i32* %78
br i1 %60, label %83, label %107
83: ; preds = %77
%84 = shl i32 %82, 8
%85 = getelementptr inbounds i32, i32* %78, i64 1
%86 = load i32, i32* %85
%87 = shl i32 %86, 16
%88 = or i32 %87, %84
%89 = getelementptr inbounds i32, i32* %78, i64 2
%90 = load i32, i32* %89
%91 = shl i32 %90, 24
%92 = or i32 %88, %91
%93 = load i32, i32* %79
%94 = shl i32 %93, 8
%95 = getelementptr inbounds i32, i32* %79, i64 1
%96 = load i32, i32* %95
%97 = shl i32 %96, 16
%98 = or i32 %97, %94
%99 = getelementptr inbounds i32, i32* %79, i64 2
%100 = load i32, i32* %99
%101 = shl i32 %100, 24
%102 = or i32 %98, %101
%103 = ashr exact i32 %92, 8
%104 = ashr exact i32 %102, 8
%105 = sub nsw i32 %103, %104
%106 = sext i32 %105 to i64
br label %120
107: ; preds = %77
%108 = getelementptr inbounds i32, i32* %78, i64 1
%109 = load i32, i32* %108
%110 = shl i32 %109, 8
%111 = or i32 %110, %82
%112 = sext i32 %111 to i64
%113 = load i32, i32* %79
%114 = getelementptr inbounds i32, i32* %79, i64 1
%115 = load i32, i32* %114
%116 = shl i32 %115, 8
%117 = or i32 %116, %113
%118 = sext i32 %117 to i64
%119 = sub nsw i64 %112, %118
br label %120
120: ; preds = %107, %83
%121 = phi i64 [ %106, %83 ], [ %119, %107 ]
%122 = mul i64 %121, %121
%123 = add i64 %122, %80
%124 = add nuw nsw i64 %81, 1
%125 = getelementptr inbounds i32, i32* %78, i64 %61
%126 = getelementptr inbounds i32, i32* %79, i64 %61
%127 = icmp eq i64 %124, %76
br i1 %127, label %128, label %77
128: ; preds = %120, %73
%129 = phi i64 [ 0, %73 ], [ %124, %120 ]
%130 = phi i64 [ %64, %73 ], [ %123, %120 ]
%131 = add i64 %129, %63
%132 = icmp eq i32 %65, 3000
br i1 %132, label %62, label %133
133: ; preds = %128
%134 = icmp eq i64 %131, 0
br i1 %134, label %153, label %135
135: ; preds = %133
%136 = uitofp i64 %130 to double
%137 = uitofp i64 %131 to double
%138 = fdiv double %136, %137
%139 = call double @sqrt(double %138)
%140 = load i8*, i8** %10
%141 = call i64 @strcmp(i8* %140, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%142 = icmp eq i64 %141, 0
br i1 %142, label %150, label %143
143: ; preds = %135
%144 = fsub double %139, %27
%145 = call double @llvm.fabs.f64(double %144)
%146 = fcmp ogt double %145, 1.000000e-01
br i1 %146, label %153, label %147
147: ; preds = %143
%148 = load i8*, i8** %28
%149 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %148)
br label %161
150: ; preds = %135
%151 = load i8*, i8** %28
%152 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %151, double %139)
br label %161
153: ; preds = %62, %69, %143, %133, %2
%154 = icmp sgt i32 %0, 1
br i1 %154, label %155, label %158
155: ; preds = %26, %41, %37, %48, %45, %51, %24, %153
%156 = getelementptr inbounds i8*, i8** %1, i64 1
%157 = load i8*, i8** %156
br label %158
158: ; preds = %153, %155
%159 = phi i8* [ %157, %155 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), %153 ]
%160 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %159)
br label %161
161: ; preds = %147, %150, %158
%162 = phi i32 [ 1, %158 ], [ 0, %150 ], [ 0, %147 ]
ret i32 %162
}