#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ error(int, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ memcmp(char *, char const *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ readFileAt(int, size_t, char *, int);
size_t readFileDWORD(int, size_t);
unsigned short readFileWORD(int, size_t);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
size_t findDataSection(int fileIndex, size_t *size) {
  char buf[1024];
  const char headerMZ[2] = {'M', 'Z'};
  readFileAt(fileIndex, 0, buf, 2);
  if (memcmp(buf, headerMZ, 2) != 0) {
    error(fileIndex, "MZ header not found, not a driver file!");
  }
  size_t peHeaderOffset = readFileDWORD(fileIndex, 0x0000003C);
  const char headerPE[4] = {'P', 'E', 0, 0};
  readFileAt(fileIndex, peHeaderOffset, buf, 4);
  if (memcmp(buf, headerPE, 4) != 0) {
    error(fileIndex, "PE header not found, not a driver file!\n");
  }
  peHeaderOffset += 4;
  unsigned short sectionCount = readFileWORD(fileIndex, peHeaderOffset + 2);
  fprintf(stderr, "found %hu sections\n", sectionCount);
  unsigned short optionalHeaderSize =
      readFileWORD(fileIndex, peHeaderOffset + 16);
  fprintf(stderr, "%hu bytes of optional PE header\n", optionalHeaderSize);
  size_t sectionOffset = peHeaderOffset + 20 + optionalHeaderSize;
  fprintf(stderr, "first section header at %08x\n\n", (int)sectionOffset);
  unsigned short i;
  size_t dataSectionAddress = 0;
  for (i = 0; i < sectionCount; i++) {
    size_t curSectionOffset = sectionOffset + 40 * i;
    char sectionName[9];
    memset(sectionName, 0, 9);
    readFileAt(fileIndex, curSectionOffset, sectionName, 8);
    size_t curSectionSize = readFileDWORD(fileIndex, curSectionOffset + 16);
    size_t curSectionAddress = readFileDWORD(fileIndex, curSectionOffset + 20);
    fprintf(stderr, "section %8s: %8d bytes at %08x\n", sectionName,
            (int)curSectionSize, (int)curSectionAddress);
    if (0 == strcmp(sectionName, ".data")) {
      *size = curSectionSize;
      dataSectionAddress = curSectionAddress;
    }
  }
  fprintf(stderr, "\n");
  if (0 != dataSectionAddress)
    return dataSectionAddress;
  error(fileIndex, "could not find .data section!");
  return 0;
}


x86 assembly (clang, -O0):
<findDataSection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0xe67(%rip),%ax
mov    %ax,-0x422(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x420(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%ecx
call   1060 <readFileAt@plt>
lea    -0x420(%rbp),%rdi
lea    -0x422(%rbp),%rsi
mov    $0x2,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     11e9 <findDataSection+0x69>
mov    -0xc(%rbp),%edi
lea    0xe1e(%rip),%rsi
call   10a0 <error@plt>
mov    -0xc(%rbp),%edi
mov    $0x3c,%esi
call   1030 <readFileDWORD@plt>
mov    %rax,-0x430(%rbp)
mov    0xee8(%rip),%eax
mov    %eax,-0x434(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x430(%rbp),%rsi
lea    -0x420(%rbp),%rdx
mov    $0x4,%ecx
call   1060 <readFileAt@plt>
lea    -0x420(%rbp),%rdi
lea    -0x434(%rbp),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1255 <findDataSection+0xd5>
mov    -0xc(%rbp),%edi
lea    0xdda(%rip),%rsi
call   10a0 <error@plt>
mov    -0x430(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x430(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x430(%rbp),%rsi
add    $0x2,%rsi
call   1090 <readFileWORD@plt>
mov    %ax,-0x436(%rbp)
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
movzwl -0x436(%rbp),%edx
lea    0xdbb(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xc(%rbp),%edi
mov    -0x430(%rbp),%rsi
add    $0x10,%rsi
call   1090 <readFileWORD@plt>
mov    %ax,-0x438(%rbp)
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
movzwl -0x438(%rbp),%edx
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x430(%rbp),%rax
add    $0x14,%rax
movzwl -0x438(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x440(%rbp)
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
mov    -0x440(%rbp),%rax
mov    %eax,%edx
lea    0xd7c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movq   $0x0,-0x450(%rbp)
movw   $0x0,-0x442(%rbp)
movzwl -0x442(%rbp),%eax
movzwl -0x436(%rbp),%ecx
cmp    %ecx,%eax
jge    1447 <findDataSection+0x2c7>
mov    -0x440(%rbp),%rax
movzwl -0x442(%rbp),%ecx
imul   $0x28,%ecx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x458(%rbp)
lea    -0x461(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
mov    -0xc(%rbp),%edi
mov    -0x458(%rbp),%rsi
lea    -0x461(%rbp),%rdx
mov    $0x8,%ecx
call   1060 <readFileAt@plt>
mov    -0xc(%rbp),%edi
mov    -0x458(%rbp),%rsi
add    $0x10,%rsi
call   1030 <readFileDWORD@plt>
mov    %rax,-0x470(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x458(%rbp),%rsi
add    $0x14,%rsi
call   1030 <readFileDWORD@plt>
mov    %rax,-0x478(%rbp)
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    -0x461(%rbp),%rdx
mov    -0x470(%rbp),%rax
mov    %eax,%ecx
mov    -0x478(%rbp),%rax
mov    %eax,%r8d
lea    0xcc0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x461(%rbp),%rdi
lea    0xccb(%rip),%rsi
call   1070 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    142b <findDataSection+0x2ab>
mov    -0x470(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x478(%rbp),%rax
mov    %rax,-0x450(%rbp)
jmp    1430 <findDataSection+0x2b0>
mov    -0x442(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x442(%rbp)
jmp    1327 <findDataSection+0x1a7>
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
lea    0xc4e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
xor    %eax,%eax
cmp    -0x450(%rbp),%rax
je     147d <findDataSection+0x2fd>
mov    -0x450(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1494 <findDataSection+0x314>
mov    -0xc(%rbp),%edi
lea    0xc46(%rip),%rsi
call   10a0 <error@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findDataSection>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rsi,0x18(%rsp)
mov    %edi,%r15d
movw   $0x5a4d,0xa(%rsp)
lea    0x30(%rsp),%rbx
xor    %esi,%esi
mov    %rbx,%rdx
mov    $0x2,%ecx
call   1060 <readFileAt@plt>
lea    0xa(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     11da <findDataSection+0x5a>
lea    0xe2e(%rip),%rsi
mov    %r15d,%edi
call   10a0 <error@plt>
mov    $0x3c,%esi
mov    %r15d,%edi
call   1030 <readFileDWORD@plt>
mov    %rax,%r14
movl   $0x4550,0xc(%rsp)
lea    0x30(%rsp),%rbx
mov    %r15d,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
mov    $0x4,%ecx
call   1060 <readFileAt@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
je     1230 <findDataSection+0xb0>
lea    0xe00(%rip),%rsi
mov    %r15d,%edi
call   10a0 <error@plt>
lea    0x6(%r14),%rsi
mov    %r15d,%edi
call   1090 <readFileWORD@plt>
mov    0x2d9d(%rip),%r12
mov    (%r12),%edi
movzwl %ax,%ebx
lea    0xe00(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0x14(%r14),%rsi
mov    %r15d,%edi
call   1090 <readFileWORD@plt>
mov    (%r12),%edi
movzwl %ax,%ebp
lea    0xdf1(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    %r14,%rbp
add    $0x18,%rbp
mov    (%r12),%edi
lea    0xdf7(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %bx,%bx
je     136b <findDataSection+0x1eb>
lea    0x27(%rsp),%r13
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    12be <findDataSection+0x13e>
nop
add    $0x28,%rbp
add    $0xffffffffffffffff,%rbx
je     1348 <findDataSection+0x1c8>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    $0x8,%ecx
call   1060 <readFileAt@plt>
lea    0x10(%rbp),%rsi
mov    %r15d,%edi
call   1030 <readFileDWORD@plt>
mov    %rax,%r14
lea    0x14(%rbp),%rsi
mov    %r15d,%edi
call   1030 <readFileDWORD@plt>
mov    %rax,%r12
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
lea    0xd97(%rip),%rsi
mov    %r13,%rdx
mov    %r14d,%ecx
mov    %r12d,%r8d
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r13,%rdi
lea    0xd9d(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    12b0 <findDataSection+0x130>
mov    0x18(%rsp),%rax
mov    %r14,(%rax)
mov    %r12,0x10(%rsp)
jmp    12b0 <findDataSection+0x130>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
lea    0xd4b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x10(%rsp),%rax
test   %rax,%rax
jne    138e <findDataSection+0x20e>
jmp    137d <findDataSection+0x1fd>
mov    (%r12),%edi
lea    0xd2d(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xd47(%rip),%rsi
mov    %r15d,%edi
call   10a0 <error@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.findDataSection.headerMZ = [2 x i8] c"MZ"
@.str = [40 x i8] c"MZ header not found, not a driver file!\00"
@__const.findDataSection.headerPE = [4 x i8] c"PE\00\00"
@.str.1 = [41 x i8] c"PE header not found, not a driver file!\0A\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"found %hu sections\0A\00"
@.str.3 = [33 x i8] c"%hu bytes of optional PE header\0A\00"
@.str.4 = [31 x i8] c"first section header at %08x\0A\0A\00"
@.str.5 = [32 x i8] c"section %8s: %8d bytes at %08x\0A\00"
@.str.6 = [6 x i8] c".data\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [30 x i8] c"could not find .data section!\00"
define i64 @findDataSection(i32 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64*
%6 = alloca [1024 x i8]
%7 = alloca [2 x i8]
%8 = alloca i64
%9 = alloca [4 x i8]
%10 = alloca i16
%11 = alloca i16
%12 = alloca i64
%13 = alloca i16
%14 = alloca i64
%15 = alloca i64
%16 = alloca [9 x i8]
%17 = alloca i64
%18 = alloca i64
store i32 %0, i32* %4
store i64* %1, i64** %5
%19 = bitcast [2 x i8]* %7 to i8*
%20 = load i32, i32* %4
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%22 = call i32 @readFileAt(i32 %20, i64 0, i8* %21, i32 2)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%24 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%25 = call i64 @memcmp(i8* %23, i8* %24, i32 2)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %2
%28 = load i32, i32* %4
%29 = call i32 @error(i32 %28, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %27, %2
%31 = load i32, i32* %4
%32 = call i64 @readFileDWORD(i32 %31, i64 60)
store i64 %32, i64* %8
%33 = bitcast [4 x i8]* %9 to i8*
%34 = load i32, i32* %4
%35 = load i64, i64* %8
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%37 = call i32 @readFileAt(i32 %34, i64 %35, i8* %36, i32 4)
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%39 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%40 = call i64 @memcmp(i8* %38, i8* %39, i32 4)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %30
%43 = load i32, i32* %4
%44 = call i32 @error(i32 %43, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %45
45: ; preds = %42, %30
%46 = load i64, i64* %8
%47 = add i64 %46, 4
store i64 %47, i64* %8
%48 = load i32, i32* %4
%49 = load i64, i64* %8
%50 = add i64 %49, 2
%51 = call zeroext i16 @readFileWORD(i32 %48, i64 %50)
store i16 %51, i16* %10
%52 = load i32, i32* @stderr
%53 = load i16, i16* %10
%54 = zext i16 %53 to i32
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %4
%57 = load i64, i64* %8
%58 = add i64 %57, 16
%59 = call zeroext i16 @readFileWORD(i32 %56, i64 %58)
store i16 %59, i16* %11
%60 = load i32, i32* @stderr
%61 = load i16, i16* %11
%62 = zext i16 %61 to i32
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %62)
%64 = load i64, i64* %8
%65 = add i64 %64, 20
%66 = load i16, i16* %11
%67 = zext i16 %66 to i64
%68 = add i64 %65, %67
store i64 %68, i64* %12
%69 = load i32, i32* @stderr
%70 = load i64, i64* %12
%71 = trunc i64 %70 to i32
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %71)
store i64 0, i64* %14
store i16 0, i16* %13
br label %73
73: ; preds = %115, %45
%74 = load i16, i16* %13
%75 = zext i16 %74 to i32
%76 = load i16, i16* %10
%77 = zext i16 %76 to i32
%78 = icmp slt i32 %75, %77
br i1 %78, label %79, label %118
79: ; preds = %73
%80 = load i64, i64* %12
%81 = load i16, i16* %13
%82 = zext i16 %81 to i32
%83 = mul nsw i32 40, %82
%84 = sext i32 %83 to i64
%85 = add i64 %80, %84
store i64 %85, i64* %15
%86 = getelementptr inbounds [9 x i8], [9 x i8]* %16, i64 0, i64 0
%87 = call i32 @memset(i8* %86, i32 0, i32 9)
%88 = load i32, i32* %4
%89 = load i64, i64* %15
%90 = getelementptr inbounds [9 x i8], [9 x i8]* %16, i64 0, i64 0
%91 = call i32 @readFileAt(i32 %88, i64 %89, i8* %90, i32 8)
%92 = load i32, i32* %4
%93 = load i64, i64* %15
%94 = add i64 %93, 16
%95 = call i64 @readFileDWORD(i32 %92, i64 %94)
store i64 %95, i64* %17
%96 = load i32, i32* %4
%97 = load i64, i64* %15
%98 = add i64 %97, 20
%99 = call i64 @readFileDWORD(i32 %96, i64 %98)
store i64 %99, i64* %18
%100 = load i32, i32* @stderr
%101 = getelementptr inbounds [9 x i8], [9 x i8]* %16, i64 0, i64 0
%102 = load i64, i64* %17
%103 = trunc i64 %102 to i32
%104 = load i64, i64* %18
%105 = trunc i64 %104 to i32
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %101, i32 %103, i32 %105)
%107 = getelementptr inbounds [9 x i8], [9 x i8]* %16, i64 0, i64 0
%108 = call i64 @strcmp(i8* %107, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%109 = icmp eq i64 0, %108
br i1 %109, label %110, label %114
110: ; preds = %79
%111 = load i64, i64* %17
%112 = load i64*, i64** %5
store i64 %111, i64* %112
%113 = load i64, i64* %18
store i64 %113, i64* %14
br label %114
114: ; preds = %110, %79
br label %115
115: ; preds = %114
%116 = load i16, i16* %13
%117 = add i16 %116, 1
store i16 %117, i16* %13
br label %73
118: ; preds = %73
%119 = load i32, i32* @stderr
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%121 = load i64, i64* %14
%122 = icmp ne i64 0, %121
br i1 %122, label %123, label %125
123: ; preds = %118
%124 = load i64, i64* %14
store i64 %124, i64* %3
br label %128
125: ; preds = %118
%126 = load i32, i32* %4
%127 = call i32 @error(i32 %126, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
store i64 0, i64* %3
br label %128
128: ; preds = %125, %123
%129 = load i64, i64* %3
ret i64 %129
}

LLVM IR (-O2):
@.str = [40 x i8] c"MZ header not found, not a driver file!\00"
@.str.1 = [41 x i8] c"PE header not found, not a driver file!\0A\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"found %hu sections\0A\00"
@.str.3 = [33 x i8] c"%hu bytes of optional PE header\0A\00"
@.str.4 = [31 x i8] c"first section header at %08x\0A\0A\00"
@.str.5 = [32 x i8] c"section %8s: %8d bytes at %08x\0A\00"
@.str.6 = [6 x i8] c".data\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [30 x i8] c"could not find .data section!\00"
define i64 @findDataSection(i32 %0, i64* nocapture writeonly %1) {
%3 = alloca [1024 x i8]
%4 = alloca i16
%5 = alloca i32
%6 = alloca [9 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = bitcast i16* %4 to i8*
store i16 23117, i16* %4
%9 = call i32 @readFileAt(i32 %0, i64 0, i8* %7, i32 2)
%10 = call i64 @memcmp(i8* %7, i8* %8, i32 2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 @error(i32 %0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = call i64 @readFileDWORD(i32 %0, i64 60)
%16 = bitcast i32* %5 to i8*
store i32 17744, i32* %5
%17 = call i32 @readFileAt(i32 %0, i64 %15, i8* %7, i32 4)
%18 = call i64 @memcmp(i8* %7, i8* %16, i32 4)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = call i32 @error(i32 %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %14
%23 = add i64 %15, 6
%24 = call zeroext i16 @readFileWORD(i32 %0, i64 %23)
%25 = load i32, i32* @stderr
%26 = zext i16 %24 to i32
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = add i64 %15, 20
%29 = call zeroext i16 @readFileWORD(i32 %0, i64 %28)
%30 = load i32, i32* @stderr
%31 = zext i16 %29 to i32
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = add i64 %15, 24
%34 = zext i16 %29 to i64
%35 = add i64 %33, %34
%36 = load i32, i32* @stderr
%37 = trunc i64 %35 to i32
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%39 = icmp eq i16 %24, 0
br i1 %39, label %40, label %43
40: ; preds = %22
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %72
43: ; preds = %22
%44 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%45 = zext i16 %24 to i64
br label %46
46: ; preds = %43, %64
%47 = phi i64 [ 0, %43 ], [ %66, %64 ]
%48 = phi i64 [ 0, %43 ], [ %65, %64 ]
%49 = mul nuw nsw i64 %47, 40
%50 = add i64 %49, %35
%51 = call i32 @memset(i8* %44, i32 0, i32 9)
%52 = call i32 @readFileAt(i32 %0, i64 %50, i8* %44, i32 8)
%53 = add i64 %50, 16
%54 = call i64 @readFileDWORD(i32 %0, i64 %53)
%55 = add i64 %50, 20
%56 = call i64 @readFileDWORD(i32 %0, i64 %55)
%57 = load i32, i32* @stderr
%58 = trunc i64 %54 to i32
%59 = trunc i64 %56 to i32
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %44, i32 %58, i32 %59)
%61 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %46
store i64 %54, i64* %1
br label %64
64: ; preds = %63, %46
%65 = phi i64 [ %56, %63 ], [ %48, %46 ]
%66 = add nuw nsw i64 %47, 1
%67 = icmp eq i64 %66, %45
br i1 %67, label %68, label %46
68: ; preds = %64
%69 = load i32, i32* @stderr
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%71 = icmp eq i64 %65, 0
br i1 %71, label %72, label %74
72: ; preds = %40, %68
%73 = call i32 @error(i32 %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %74
74: ; preds = %68, %72
%75 = phi i64 [ %65, %68 ], [ 0, %72 ]
ret i64 %75
}