#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void inhale_wcd_format(unsigned char *image, int *blackadjp, FILE *inf) {
  int i, sum;
  unsigned char *p;
  unsigned char scratch[512];
  p = image;
  for (i = 0; i < 246; i++) {
    if (fread(p, 1, 512, inf) != 512)
      goto errout;
    p += 2 * 512;
  }
  for (i = 0; i < 10; i++) {
    if (fread(scratch, 1, 512, inf) != 512)
      goto errout;
  }
  p = &image[512];
  for (i = 0; i < 246; i++) {
    if (fread(p, 1, 512, inf) != 512)
      goto errout;
    p += 2 * 512;
  }
  for (i = 0; i < 8; i++) {
    if (fread(scratch, 1, 512, inf) != 512)
      goto errout;
  }
  sum = 0;
  if (fread(scratch, 1, 512, inf) != 512)
    goto errout;
  for (i = 0; i < 246; i++)
    sum += scratch[i];
  if (fread(scratch, 1, 512, inf) != 512)
    goto errout;
  for (i = 0; i < 246; i++)
    sum += scratch[i];
  sum /= (2 * 246);
  *blackadjp = sum;
  return;
errout:
  fprintf(stderr, "Error reading .wcd format input\n");
  exit(1);
}


x86 assembly (clang, -O0):
<inhale_wcd_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xf6,-0x1c(%rbp)
jge    11a6 <inhale_wcd_format+0x76>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
cmp    $0x200,%eax
je     118a <inhale_wcd_format+0x5a>
jmp    138a <inhale_wcd_format+0x25a>
mov    -0x28(%rbp),%rax
add    $0x400,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1156 <inhale_wcd_format+0x26>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    11f4 <inhale_wcd_format+0xc4>
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
cmp    $0x200,%eax
je     11e1 <inhale_wcd_format+0xb1>
jmp    138a <inhale_wcd_format+0x25a>
jmp    11e6 <inhale_wcd_format+0xb6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ad <inhale_wcd_format+0x7d>
mov    -0x8(%rbp),%rax
add    $0x200,%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xf6,-0x1c(%rbp)
jge    1259 <inhale_wcd_format+0x129>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
cmp    $0x200,%eax
je     123d <inhale_wcd_format+0x10d>
jmp    138a <inhale_wcd_format+0x25a>
mov    -0x28(%rbp),%rax
add    $0x400,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1209 <inhale_wcd_format+0xd9>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    12a7 <inhale_wcd_format+0x177>
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
cmp    $0x200,%eax
je     1294 <inhale_wcd_format+0x164>
jmp    138a <inhale_wcd_format+0x25a>
jmp    1299 <inhale_wcd_format+0x169>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1260 <inhale_wcd_format+0x130>
movl   $0x0,-0x20(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
cmp    $0x200,%eax
je     12d8 <inhale_wcd_format+0x1a8>
jmp    138a <inhale_wcd_format+0x25a>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xf6,-0x1c(%rbp)
jge    130c <inhale_wcd_format+0x1dc>
movslq -0x1c(%rbp),%rax
movzbl -0x230(%rbp,%rax,1),%eax
ff
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12df <inhale_wcd_format+0x1af>
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1030 <fread@plt>
cmp    $0x200,%eax
je     1336 <inhale_wcd_format+0x206>
jmp    138a <inhale_wcd_format+0x25a>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xf6,-0x1c(%rbp)
jge    136a <inhale_wcd_format+0x23a>
movslq -0x1c(%rbp),%rax
movzbl -0x230(%rbp,%rax,1),%eax
ff
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    133d <inhale_wcd_format+0x20d>
mov    -0x20(%rbp),%eax
mov    $0x1ec,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x230,%rsp
pop    %rbp
ret
mov    0x2c4f(%rip),%rax
mov    (%rax),%edi
lea    0xc66(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<inhale_wcd_format>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rdx,%r15
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
xor    %ebp,%ebp
xchg   %ax,%ax
lea    (%rbx,%rbp,1),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
add    $0x400,%rbp
cmp    $0x3d800,%ebp
jne    1150 <inhale_wcd_format+0x20>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
mov    $0x200,%ebp
nopl   0x0(%rax)
lea    (%rbx,%rbp,1),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
add    $0x400,%rbp
cmp    $0x3da00,%ebp
jne    12e0 <inhale_wcd_format+0x1b0>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
pxor   %xmm0,%xmm0
xor    %eax,%eax
pxor   %xmm6,%xmm6
pxor   %xmm5,%xmm5
movq   0x30(%rsp,%rax,1),%xmm2
movd   0x34(%rsp,%rax,1),%xmm1
punpcklbw %xmm0,%xmm2
punpcklwd %xmm0,%xmm2
paddd  %xmm6,%xmm2
punpcklbw %xmm0,%xmm1
punpcklwd %xmm0,%xmm1
paddd  %xmm5,%xmm1
movq   0x38(%rsp,%rax,1),%xmm3
movd   0x3c(%rsp,%rax,1),%xmm4
punpcklbw %xmm0,%xmm3
punpcklwd %xmm0,%xmm3
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
movq   0x40(%rsp,%rax,1),%xmm6
movd   0x44(%rsp,%rax,1),%xmm5
punpcklbw %xmm0,%xmm6
punpcklwd %xmm0,%xmm6
paddd  %xmm3,%xmm6
paddd  %xmm2,%xmm6
punpcklbw %xmm0,%xmm5
punpcklwd %xmm0,%xmm5
paddd  %xmm4,%xmm5
paddd  %xmm1,%xmm5
add    $0x18,%rax
cmp    $0xf0,%rax
jne    1450 <inhale_wcd_format+0x320>
movdqa %xmm6,0x10(%rsp)
movdqa %xmm5,0x20(%rsp)
movzbl 0x120(%rsp),%r12d
movzbl 0x121(%rsp),%r14d
movzbl 0x122(%rsp),%ebp
movzbl 0x123(%rsp),%ebx
movzbl 0x124(%rsp),%r13d
movzbl 0x125(%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x200,%eax
jne    1665 <inhale_wcd_format+0x535>
movdqa 0x20(%rsp),%xmm1
paddd  0x10(%rsp),%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
add    %r12d,%eax
add    %r14d,%eax
add    %ebp,%eax
add    %ebx,%eax
add    %r13d,%eax
add    0x4(%rsp),%eax
movd   %eax,%xmm2
pxor   %xmm0,%xmm0
xor    %eax,%eax
pxor   %xmm1,%xmm1
xchg   %ax,%ax
movq   0x30(%rsp,%rax,1),%xmm4
movd   0x34(%rsp,%rax,1),%xmm3
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
paddd  %xmm2,%xmm4
punpcklbw %xmm0,%xmm3
punpcklwd %xmm0,%xmm3
paddd  %xmm1,%xmm3
movq   0x38(%rsp,%rax,1),%xmm5
movd   0x3c(%rsp,%rax,1),%xmm6
punpcklbw %xmm0,%xmm5
punpcklwd %xmm0,%xmm5
punpcklbw %xmm0,%xmm6
punpcklwd %xmm0,%xmm6
movq   0x40(%rsp,%rax,1),%xmm2
movd   0x44(%rsp,%rax,1),%xmm1
punpcklbw %xmm0,%xmm2
punpcklwd %xmm0,%xmm2
paddd  %xmm5,%xmm2
paddd  %xmm4,%xmm2
punpcklbw %xmm0,%xmm1
punpcklwd %xmm0,%xmm1
paddd  %xmm6,%xmm1
paddd  %xmm3,%xmm1
add    $0x18,%rax
cmp    $0xf0,%rax
jne    1570 <inhale_wcd_format+0x440>
paddd  %xmm2,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
movzbl 0x120(%rsp),%ecx
add    %eax,%ecx
movzbl 0x121(%rsp),%eax
add    %ecx,%eax
movzbl 0x122(%rsp),%ecx
add    %eax,%ecx
movzbl 0x123(%rsp),%eax
add    %ecx,%eax
movzbl 0x124(%rsp),%ecx
add    %eax,%ecx
movzbl 0x125(%rsp),%eax
add    %ecx,%eax
shr    $0x2,%eax
imul   $0x214d0215,%rax,%rax
shr    $0x24,%rax
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2974(%rip),%rax
mov    (%rax),%edi
lea    0x98b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Error reading .wcd format input\0A\00"
define void @inhale_wcd_format(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca [512 x i8]
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%11 = load i8*, i8** %4
store i8* %11, i8** %9
store i32 0, i32* %7
br label %12
12: ; preds = %24, %3
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 246
br i1 %14, label %15, label %27
15: ; preds = %12
%16 = load i8*, i8** %9
%17 = load i32*, i32** %6
%18 = call i32 @fread(i8* %16, i32 1, i32 512, i32* %17)
%19 = icmp ne i32 %18, 512
br i1 %19, label %20, label %21
20: ; preds = %15
br label %120
21: ; preds = %15
%22 = load i8*, i8** %9
%23 = getelementptr inbounds i8, i8* %22, i64 1024
store i8* %23, i8** %9
br label %24
24: ; preds = %21
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %12
27: ; preds = %12
store i32 0, i32* %7
br label %28
28: ; preds = %38, %27
%29 = load i32, i32* %7
%30 = icmp slt i32 %29, 10
br i1 %30, label %31, label %41
31: ; preds = %28
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%33 = load i32*, i32** %6
%34 = call i32 @fread(i8* %32, i32 1, i32 512, i32* %33)
%35 = icmp ne i32 %34, 512
br i1 %35, label %36, label %37
36: ; preds = %31
br label %120
37: ; preds = %31
br label %38
38: ; preds = %37
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %28
41: ; preds = %28
%42 = load i8*, i8** %4
%43 = getelementptr inbounds i8, i8* %42, i64 512
store i8* %43, i8** %9
store i32 0, i32* %7
br label %44
44: ; preds = %56, %41
%45 = load i32, i32* %7
%46 = icmp slt i32 %45, 246
br i1 %46, label %47, label %59
47: ; preds = %44
%48 = load i8*, i8** %9
%49 = load i32*, i32** %6
%50 = call i32 @fread(i8* %48, i32 1, i32 512, i32* %49)
%51 = icmp ne i32 %50, 512
br i1 %51, label %52, label %53
52: ; preds = %47
br label %120
53: ; preds = %47
%54 = load i8*, i8** %9
%55 = getelementptr inbounds i8, i8* %54, i64 1024
store i8* %55, i8** %9
br label %56
56: ; preds = %53
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
br label %44
59: ; preds = %44
store i32 0, i32* %7
br label %60
60: ; preds = %70, %59
%61 = load i32, i32* %7
%62 = icmp slt i32 %61, 8
br i1 %62, label %63, label %73
63: ; preds = %60
%64 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%65 = load i32*, i32** %6
%66 = call i32 @fread(i8* %64, i32 1, i32 512, i32* %65)
%67 = icmp ne i32 %66, 512
br i1 %67, label %68, label %69
68: ; preds = %63
br label %120
69: ; preds = %63
br label %70
70: ; preds = %69
%71 = load i32, i32* %7
%72 = add nsw i32 %71, 1
store i32 %72, i32* %7
br label %60
73: ; preds = %60
store i32 0, i32* %8
%74 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%75 = load i32*, i32** %6
%76 = call i32 @fread(i8* %74, i32 1, i32 512, i32* %75)
%77 = icmp ne i32 %76, 512
br i1 %77, label %78, label %79
78: ; preds = %73
br label %120
79: ; preds = %73
store i32 0, i32* %7
br label %80
80: ; preds = %91, %79
%81 = load i32, i32* %7
%82 = icmp slt i32 %81, 246
br i1 %82, label %83, label %94
83: ; preds = %80
%84 = load i32, i32* %7
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 %85
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = load i32, i32* %8
%90 = add nsw i32 %89, %88
store i32 %90, i32* %8
br label %91
91: ; preds = %83
%92 = load i32, i32* %7
%93 = add nsw i32 %92, 1
store i32 %93, i32* %7
br label %80
94: ; preds = %80
%95 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%96 = load i32*, i32** %6
%97 = call i32 @fread(i8* %95, i32 1, i32 512, i32* %96)
%98 = icmp ne i32 %97, 512
br i1 %98, label %99, label %100
99: ; preds = %94
br label %120
100: ; preds = %94
store i32 0, i32* %7
br label %101
101: ; preds = %112, %100
%102 = load i32, i32* %7
%103 = icmp slt i32 %102, 246
br i1 %103, label %104, label %115
104: ; preds = %101
%105 = load i32, i32* %7
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = zext i8 %108 to i32
%110 = load i32, i32* %8
%111 = add nsw i32 %110, %109
store i32 %111, i32* %8
br label %112
112: ; preds = %104
%113 = load i32, i32* %7
%114 = add nsw i32 %113, 1
store i32 %114, i32* %7
br label %101
115: ; preds = %101
%116 = load i32, i32* %8
%117 = sdiv i32 %116, 492
store i32 %117, i32* %8
%118 = load i32, i32* %8
%119 = load i32*, i32** %5
store i32 %118, i32* %119
ret void
120: ; preds = %99, %78, %68, %52, %36, %20
%121 = load i32, i32* @stderr
%122 = call i32 @fprintf(i32 %121, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%123 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Error reading .wcd format input\0A\00"
define void @inhale_wcd_format(i8* nocapture %0, i32* nocapture writeonly %1, i32* nocapture %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
br label %6
6: ; preds = %3, %11
%7 = phi i8* [ %0, %3 ], [ %12, %11 ]
%8 = phi i32 [ 0, %3 ], [ %13, %11 ]
%9 = tail call i32 @fread(i8* %7, i32 1, i32 512, i32* %2)
%10 = icmp eq i32 %9, 512
br i1 %10, label %11, label %218
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %7, i64 1024
%13 = add nuw nsw i32 %8, 1
%14 = icmp eq i32 %13, 246
br i1 %14, label %15, label %6
15: ; preds = %11
%16 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%17 = icmp eq i32 %16, 512
br i1 %17, label %18, label %218
18: ; preds = %15
%19 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%20 = icmp eq i32 %19, 512
br i1 %20, label %21, label %218
21: ; preds = %18
%22 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%23 = icmp eq i32 %22, 512
br i1 %23, label %24, label %218
24: ; preds = %21
%25 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%26 = icmp eq i32 %25, 512
br i1 %26, label %27, label %218
27: ; preds = %24
%28 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%29 = icmp eq i32 %28, 512
br i1 %29, label %30, label %218
30: ; preds = %27
%31 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%32 = icmp eq i32 %31, 512
br i1 %32, label %33, label %218
33: ; preds = %30
%34 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%35 = icmp eq i32 %34, 512
br i1 %35, label %36, label %218
36: ; preds = %33
%37 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%38 = icmp eq i32 %37, 512
br i1 %38, label %39, label %218
39: ; preds = %36
%40 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%41 = icmp eq i32 %40, 512
br i1 %41, label %42, label %218
42: ; preds = %39
%43 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%44 = icmp eq i32 %43, 512
br i1 %44, label %45, label %218
45: ; preds = %42
%46 = getelementptr inbounds i8, i8* %0, i64 512
br label %47
47: ; preds = %45, %52
%48 = phi i8* [ %46, %45 ], [ %53, %52 ]
%49 = phi i32 [ 0, %45 ], [ %54, %52 ]
%50 = tail call i32 @fread(i8* %48, i32 1, i32 512, i32* %2)
%51 = icmp eq i32 %50, 512
br i1 %51, label %52, label %218
52: ; preds = %47
%53 = getelementptr inbounds i8, i8* %48, i64 1024
%54 = add nuw nsw i32 %49, 1
%55 = icmp eq i32 %54, 246
br i1 %55, label %56, label %47
56: ; preds = %52
%57 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%58 = icmp eq i32 %57, 512
br i1 %58, label %59, label %218
59: ; preds = %56
%60 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%61 = icmp eq i32 %60, 512
br i1 %61, label %62, label %218
62: ; preds = %59
%63 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%64 = icmp eq i32 %63, 512
br i1 %64, label %65, label %218
65: ; preds = %62
%66 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%67 = icmp eq i32 %66, 512
br i1 %67, label %68, label %218
68: ; preds = %65
%69 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%70 = icmp eq i32 %69, 512
br i1 %70, label %71, label %218
71: ; preds = %68
%72 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%73 = icmp eq i32 %72, 512
br i1 %73, label %74, label %218
74: ; preds = %71
%75 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%76 = icmp eq i32 %75, 512
br i1 %76, label %77, label %218
77: ; preds = %74
%78 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%79 = icmp eq i32 %78, 512
br i1 %79, label %80, label %218
80: ; preds = %77
%81 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%82 = icmp eq i32 %81, 512
br i1 %82, label %83, label %218
83: ; preds = %80, %83
%84 = phi i64 [ %119, %83 ], [ 0, %80 ]
%85 = phi <4 x i32> [ %117, %83 ], [ zeroinitializer, %80 ]
%86 = phi <4 x i32> [ %118, %83 ], [ zeroinitializer, %80 ]
%87 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %84
%88 = bitcast i8* %87 to <4 x i8>*
%89 = load <4 x i8>, <4 x i8>* %88
%90 = getelementptr inbounds i8, i8* %87, i64 4
%91 = bitcast i8* %90 to <4 x i8>*
%92 = load <4 x i8>, <4 x i8>* %91
%93 = zext <4 x i8> %89 to <4 x i32>
%94 = zext <4 x i8> %92 to <4 x i32>
%95 = add <4 x i32> %85, %93
%96 = add <4 x i32> %86, %94
%97 = add nuw nsw i64 %84, 8
%98 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %97
%99 = bitcast i8* %98 to <4 x i8>*
%100 = load <4 x i8>, <4 x i8>* %99
%101 = getelementptr inbounds i8, i8* %98, i64 4
%102 = bitcast i8* %101 to <4 x i8>*
%103 = load <4 x i8>, <4 x i8>* %102
%104 = zext <4 x i8> %100 to <4 x i32>
%105 = zext <4 x i8> %103 to <4 x i32>
%106 = add <4 x i32> %95, %104
%107 = add <4 x i32> %96, %105
%108 = add nuw nsw i64 %84, 16
%109 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %108
%110 = bitcast i8* %109 to <4 x i8>*
%111 = load <4 x i8>, <4 x i8>* %110
%112 = getelementptr inbounds i8, i8* %109, i64 4
%113 = bitcast i8* %112 to <4 x i8>*
%114 = load <4 x i8>, <4 x i8>* %113
%115 = zext <4 x i8> %111 to <4 x i32>
%116 = zext <4 x i8> %114 to <4 x i32>
%117 = add <4 x i32> %106, %115
%118 = add <4 x i32> %107, %116
%119 = add nuw nsw i64 %84, 24
%120 = icmp eq i64 %119, 240
br i1 %120, label %121, label %83
121: ; preds = %83
%122 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 240
%123 = load i8, i8* %122
%124 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 241
%125 = load i8, i8* %124
%126 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 242
%127 = load i8, i8* %126
%128 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 243
%129 = load i8, i8* %128
%130 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 244
%131 = load i8, i8* %130
%132 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 245
%133 = load i8, i8* %132
%134 = call i32 @fread(i8* %5, i32 1, i32 512, i32* %2)
%135 = icmp eq i32 %134, 512
br i1 %135, label %136, label %218
136: ; preds = %121
%137 = add <4 x i32> %118, %117
%138 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %137)
%139 = zext i8 %123 to i32
%140 = add nuw nsw i32 %138, %139
%141 = zext i8 %125 to i32
%142 = add nuw nsw i32 %140, %141
%143 = zext i8 %127 to i32
%144 = add nuw nsw i32 %142, %143
%145 = zext i8 %129 to i32
%146 = add nuw nsw i32 %144, %145
%147 = zext i8 %131 to i32
%148 = add nuw nsw i32 %146, %147
%149 = zext i8 %133 to i32
%150 = add nuw nsw i32 %148, %149
%151 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %150, i64 0
br label %152
152: ; preds = %152, %136
%153 = phi i64 [ 0, %136 ], [ %188, %152 ]
%154 = phi <4 x i32> [ %151, %136 ], [ %186, %152 ]
%155 = phi <4 x i32> [ zeroinitializer, %136 ], [ %187, %152 ]
%156 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %153
%157 = bitcast i8* %156 to <4 x i8>*
%158 = load <4 x i8>, <4 x i8>* %157
%159 = getelementptr inbounds i8, i8* %156, i64 4
%160 = bitcast i8* %159 to <4 x i8>*
%161 = load <4 x i8>, <4 x i8>* %160
%162 = zext <4 x i8> %158 to <4 x i32>
%163 = zext <4 x i8> %161 to <4 x i32>
%164 = add <4 x i32> %154, %162
%165 = add <4 x i32> %155, %163
%166 = add nuw nsw i64 %153, 8
%167 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %166
%168 = bitcast i8* %167 to <4 x i8>*
%169 = load <4 x i8>, <4 x i8>* %168
%170 = getelementptr inbounds i8, i8* %167, i64 4
%171 = bitcast i8* %170 to <4 x i8>*
%172 = load <4 x i8>, <4 x i8>* %171
%173 = zext <4 x i8> %169 to <4 x i32>
%174 = zext <4 x i8> %172 to <4 x i32>
%175 = add <4 x i32> %164, %173
%176 = add <4 x i32> %165, %174
%177 = add nuw nsw i64 %153, 16
%178 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %177
%179 = bitcast i8* %178 to <4 x i8>*
%180 = load <4 x i8>, <4 x i8>* %179
%181 = getelementptr inbounds i8, i8* %178, i64 4
%182 = bitcast i8* %181 to <4 x i8>*
%183 = load <4 x i8>, <4 x i8>* %182
%184 = zext <4 x i8> %180 to <4 x i32>
%185 = zext <4 x i8> %183 to <4 x i32>
%186 = add <4 x i32> %175, %184
%187 = add <4 x i32> %176, %185
%188 = add nuw nsw i64 %153, 24
%189 = icmp eq i64 %188, 240
br i1 %189, label %190, label %152
190: ; preds = %152
%191 = add <4 x i32> %187, %186
%192 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %191)
%193 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 240
%194 = load i8, i8* %193
%195 = zext i8 %194 to i32
%196 = add nuw nsw i32 %192, %195
%197 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 241
%198 = load i8, i8* %197
%199 = zext i8 %198 to i32
%200 = add nuw nsw i32 %196, %199
%201 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 242
%202 = load i8, i8* %201
%203 = zext i8 %202 to i32
%204 = add nuw nsw i32 %200, %203
%205 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 243
%206 = load i8, i8* %205
%207 = zext i8 %206 to i32
%208 = add nuw nsw i32 %204, %207
%209 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 244
%210 = load i8, i8* %209
%211 = zext i8 %210 to i32
%212 = add nuw nsw i32 %208, %211
%213 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 245
%214 = load i8, i8* %213
%215 = zext i8 %214 to i32
%216 = add nuw nsw i32 %212, %215
%217 = udiv i32 %216, 492
store i32 %217, i32* %1
ret void
218: ; preds = %6, %47, %15, %18, %21, %24, %27, %30, %33, %36, %39, %42, %56, %59, %62, %65, %68, %71, %74, %77, %121, %80
%219 = load i32, i32* @stderr
%220 = tail call i32 @fprintf(i32 %219, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%221 = tail call i32 @exit(i32 1)
unreachable
}