#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*/ FseekEnd(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ dump_fw(int /*<<< orphan*/ *, int /*<<< orphan*/ *, long);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, long);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strrchr(char *, char);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  if (argc != 2)
    usage(argv[0]);
  FILE *fp = fopen(argv[1], "rb");
  if (fp == NULL) {
    puts("Error opening file!");
    exit(1);
  }
  char *basename = strrchr(argv[1], '/');
  if (basename == NULL)
    basename = argv[1];
  else
    basename = basename + 1;
  int len = strlen(basename);
  char fn1[len + 5], fn2[len + 5];
  strcpy(fn1, basename);
  strcpy(fn2, basename);
  strcat(fn1, ".fw1");
  strcat(fn2, ".fw2");
  FILE *fw1 = fopen(fn1, "wb");
  FILE *fw2 = fopen(fn2, "wb");
  long romsz;
  FseekEnd(fp, -1);
  romsz = ftell(fp) + 1;
  printf("size of %s: 0x%lx\n", argv[1], romsz);
  if (romsz & 0xff) {
    puts("The ROM size must be multiple of 0x100");
    exit(1);
  }
  unsigned char offs[8];
  FseekEnd(fp, -0x100);
  fread(offs, 8, 1, fp);
  assert(offs[0] + offs[2] == 0xff);
  assert(offs[1] + offs[3] == 0xff);
  assert(offs[4] + offs[6] == 0xff);
  assert(offs[5] + offs[7] == 0xff);
  long offw1 = (offs[0] << 16) | (offs[1] << 8);
  long offw2 = (offs[4] << 16) | (offs[5] << 8);
  dump_fw(fw1, fp, offw1);
  dump_fw(fw2, fp, offw2);
  fclose(fp);
  fclose(fw1);
  fclose(fw2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     121f <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10d0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd2(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1258 <main+0x68>
lea    0xdba(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x2f,%esi
call   10a0 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    128a <main+0x9a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1296 <main+0xa6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1080 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x5,%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x80(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x5,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x78(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x80(%rbp),%rdi
lea    0xd09(%rip),%rsi
call   10f0 <strcat@plt>
mov    -0x78(%rbp),%rdi
lea    0xcfe(%rip),%rsi
call   10f0 <strcat@plt>
mov    -0x80(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   10e0 <fopen@plt>
mov    -0x78(%rbp),%rdi
mov    %rax,-0x48(%rbp)
lea    0xcdf(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0xffffffff,%esi
call   1110 <FseekEnd@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <ftell@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x58(%rbp),%rdx
lea    0xca6(%rip),%rdi
call   1090 <printf@plt>
mov    -0x58(%rbp),%rax
and    $0xff,%rax
cmp    $0x0,%rax
je     13ad <main+0x1bd>
lea    0xc99(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    $0xffffff00,%esi
call   1110 <FseekEnd@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x8,%esi
mov    $0x1,%edx
call   1050 <fread@plt>
movzbl -0x60(%rbp),%eax
movzbl -0x5e(%rbp),%ecx
add    %ecx,%eax
cmp    $0xff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
movzbl -0x5f(%rbp),%eax
movzbl -0x5d(%rbp),%ecx
add    %ecx,%eax
cmp    $0xff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
movzbl -0x5c(%rbp),%eax
movzbl -0x5a(%rbp),%ecx
add    %ecx,%eax
cmp    $0xff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
movzbl -0x5b(%rbp),%eax
movzbl -0x59(%rbp),%ecx
add    %ecx,%eax
cmp    $0xff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
movzbl -0x60(%rbp),%eax
shl    $0x10,%eax
movzbl -0x5f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x68(%rbp)
movzbl -0x5c(%rbp),%eax
shl    $0x10,%eax
movzbl -0x5b(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x70(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x68(%rbp),%rdx
call   1060 <dump_fw@plt>
mov    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x70(%rbp),%rdx
call   1060 <dump_fw@plt>
mov    -0x18(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x48(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x50(%rbp),%rdi
call   1070 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
cmp    $0x2,%edi
je     1212 <main+0x22>
mov    (%r12),%rdi
call   10d0 <usage@plt>
mov    0x8(%r12),%rdi
lea    0xde2(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13f5 <main+0x205>
mov    %rax,%r13
mov    0x8(%r12),%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   10a0 <strrchr@plt>
lea    0x1(%rax),%r14
test   %rax,%rax
cmove  %rbx,%r14
mov    %r14,%rdi
call   1080 <strlen@plt>
add    $0x5,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rsp,%r15
sub    %rax,%r15
mov    %r15,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xd89(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <strcat@plt>
lea    0xd7f(%rip),%rsi
mov    %r15,%rdi
call   10f0 <strcat@plt>
lea    0xd75(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    %r15,%rdi
mov    %r14,%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    %r13,%rdi
mov    $0xffffffff,%esi
call   1110 <FseekEnd@plt>
mov    %r13,%rdi
call   10c0 <ftell@plt>
add    $0x1,%eax
movslq %eax,%rbx
mov    0x8(%r12),%rsi
lea    0xd33(%rip),%rdi
mov    %rbx,%rdx
call   1090 <printf@plt>
test   %bl,%bl
jne    13fe <main+0x20e>
mov    %r13,%rdi
mov    $0xffffff00,%esi
call   1110 <FseekEnd@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1050 <fread@plt>
movzbl -0x30(%rbp),%r14d
movzbl -0x2e(%rbp),%eax
add    %r14d,%eax
xor    %edi,%edi
cmp    $0xff,%eax
sete   %dil
call   10b0 <assert@plt>
movzbl -0x2f(%rbp),%r12d
movzbl -0x2d(%rbp),%eax
add    %r12d,%eax
xor    %edi,%edi
cmp    $0xff,%eax
sete   %dil
call   10b0 <assert@plt>
movzbl -0x2c(%rbp),%r15d
movzbl -0x2a(%rbp),%eax
add    %r15d,%eax
xor    %edi,%edi
cmp    $0xff,%eax
sete   %dil
call   10b0 <assert@plt>
movzbl -0x2b(%rbp),%ebx
movzbl -0x29(%rbp),%eax
add    %ebx,%eax
xor    %edi,%edi
cmp    $0xff,%eax
sete   %dil
call   10b0 <assert@plt>
shl    $0x10,%r14
shl    $0x8,%r12
or     %r14,%r12
shl    $0x10,%r15
shl    $0x8,%rbx
or     %r15,%rbx
mov    -0x40(%rbp),%r14
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1060 <dump_fw@plt>
mov    -0x38(%rbp),%r15
mov    %r15,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <dump_fw@plt>
mov    %r13,%rdi
call   1070 <fclose@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
mov    %r15,%rdi
call   1070 <fclose@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc07(%rip),%rdi
jmp    1405 <main+0x215>
lea    0xc32(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [20 x i8] c"Error opening file!\00"
@.str.2 = [5 x i8] c".fw1\00"
@.str.3 = [5 x i8] c".fw2\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [19 x i8] c"size of %s: 0x%lx\0A\00"
@.str.6 = [39 x i8] c"The ROM size must be multiple of 0x100\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i64
%15 = alloca [8 x i8]
%16 = alloca i64
%17 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @usage(i8* %23)
br label %25
25: ; preds = %20, %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %29, i32** %6
%30 = load i32*, i32** %6
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %25
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i8* @strrchr(i8* %38, i8 signext 47)
store i8* %39, i8** %7
%40 = load i8*, i8** %7
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %46
42: ; preds = %35
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
store i8* %45, i8** %7
br label %49
46: ; preds = %35
%47 = load i8*, i8** %7
%48 = getelementptr inbounds i8, i8* %47, i64 1
store i8* %48, i8** %7
br label %49
49: ; preds = %46, %42
%50 = load i8*, i8** %7
%51 = call i32 @strlen(i8* %50)
store i32 %51, i32* %8
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 5
%54 = zext i32 %53 to i64
%55 = call i8* @llvm.stacksave()
store i8* %55, i8** %9
%56 = alloca i8, i64 %54
store i64 %54, i64* %10
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 5
%59 = zext i32 %58 to i64
%60 = alloca i8, i64 %59
store i64 %59, i64* %11
%61 = load i8*, i8** %7
%62 = call i32 @strcpy(i8* %56, i8* %61)
%63 = load i8*, i8** %7
%64 = call i32 @strcpy(i8* %60, i8* %63)
%65 = call i32 @strcat(i8* %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%66 = call i32 @strcat(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%67 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %67, i32** %12
%68 = call i32* @fopen(i8* %60, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %68, i32** %13
%69 = load i32*, i32** %6
%70 = call i32 @FseekEnd(i32* %69, i32 -1)
%71 = load i32*, i32** %6
%72 = call i32 @ftell(i32* %71)
%73 = add nsw i32 %72, 1
%74 = sext i32 %73 to i64
store i64 %74, i64* %14
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 1
%77 = load i8*, i8** %76
%78 = load i64, i64* %14
%79 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %77, i64 %78)
%80 = load i64, i64* %14
%81 = and i64 %80, 255
%82 = icmp ne i64 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %49
%84 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %49
%87 = load i32*, i32** %6
%88 = call i32 @FseekEnd(i32* %87, i32 -256)
%89 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 0
%90 = load i32*, i32** %6
%91 = call i32 @fread(i8* %89, i32 8, i32 1, i32* %90)
%92 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 0
%93 = load i8, i8* %92
%94 = zext i8 %93 to i32
%95 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 2
%96 = load i8, i8* %95
%97 = zext i8 %96 to i32
%98 = add nsw i32 %94, %97
%99 = icmp eq i32 %98, 255
%100 = zext i1 %99 to i32
%101 = call i32 @assert(i32 %100)
%102 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 1
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 3
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = add nsw i32 %104, %107
%109 = icmp eq i32 %108, 255
%110 = zext i1 %109 to i32
%111 = call i32 @assert(i32 %110)
%112 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 4
%113 = load i8, i8* %112
%114 = zext i8 %113 to i32
%115 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 6
%116 = load i8, i8* %115
%117 = zext i8 %116 to i32
%118 = add nsw i32 %114, %117
%119 = icmp eq i32 %118, 255
%120 = zext i1 %119 to i32
%121 = call i32 @assert(i32 %120)
%122 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 5
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 7
%126 = load i8, i8* %125
%127 = zext i8 %126 to i32
%128 = add nsw i32 %124, %127
%129 = icmp eq i32 %128, 255
%130 = zext i1 %129 to i32
%131 = call i32 @assert(i32 %130)
%132 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 0
%133 = load i8, i8* %132
%134 = zext i8 %133 to i32
%135 = shl i32 %134, 16
%136 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 1
%137 = load i8, i8* %136
%138 = zext i8 %137 to i32
%139 = shl i32 %138, 8
%140 = or i32 %135, %139
%141 = sext i32 %140 to i64
store i64 %141, i64* %16
%142 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 4
%143 = load i8, i8* %142
%144 = zext i8 %143 to i32
%145 = shl i32 %144, 16
%146 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 5
%147 = load i8, i8* %146
%148 = zext i8 %147 to i32
%149 = shl i32 %148, 8
%150 = or i32 %145, %149
%151 = sext i32 %150 to i64
store i64 %151, i64* %17
%152 = load i32*, i32** %12
%153 = load i32*, i32** %6
%154 = load i64, i64* %16
%155 = call i32 @dump_fw(i32* %152, i32* %153, i64 %154)
%156 = load i32*, i32** %13
%157 = load i32*, i32** %6
%158 = load i64, i64* %17
%159 = call i32 @dump_fw(i32* %156, i32* %157, i64 %158)
%160 = load i32*, i32** %6
%161 = call i32 @fclose(i32* %160)
%162 = load i32*, i32** %12
%163 = call i32 @fclose(i32* %162)
%164 = load i32*, i32** %13
%165 = call i32 @fclose(i32* %164)
store i32 0, i32* %3
%166 = load i8*, i8** %9
%167 = load i32, i32* %3
ret i32 %167
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [20 x i8] c"Error opening file!\00"
@.str.2 = [5 x i8] c".fw1\00"
@.str.3 = [5 x i8] c".fw2\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [19 x i8] c"size of %s: 0x%lx\0A\00"
@.str.6 = [39 x i8] c"The ROM size must be multiple of 0x100\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @usage(i8* %6)
br label %8
8: ; preds = %5, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %8
%17 = load i8*, i8** %9
%18 = tail call i8* @strrchr(i8* dereferenceable(1) %17, i8 signext 47)
%19 = icmp eq i8* %18, null
%20 = getelementptr inbounds i8, i8* %18, i64 1
%21 = select i1 %19, i8* %17, i8* %20
%22 = tail call i32 @strlen(i8* %21)
%23 = add nsw i32 %22, 5
%24 = zext i32 %23 to i64
%25 = alloca i8, i64 %24
%26 = alloca i8, i64 %24
%27 = call i32 @strcpy(i8* %25, i8* %21)
%28 = call i32 @strcpy(i8* %26, i8* %21)
%29 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%32 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 @FseekEnd(i32* %11, i32 -1)
%34 = call i32 @ftell(i32* %11)
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = load i8*, i8** %9
%38 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %37, i64 %36)
%39 = and i64 %36, 255
%40 = icmp eq i64 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %16
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %16
%45 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%46 = call i32 @FseekEnd(i32* %11, i32 -256)
%47 = call i32 @fread(i8* %45, i32 8, i32 1, i32* %11)
%48 = load i8, i8* %45
%49 = zext i8 %48 to i32
%50 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 2
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = add nuw nsw i32 %52, %49
%54 = icmp eq i32 %53, 255
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 1
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 3
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = add nuw nsw i32 %62, %59
%64 = icmp eq i32 %63, 255
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 4
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 6
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = add nuw nsw i32 %72, %69
%74 = icmp eq i32 %73, 255
%75 = zext i1 %74 to i32
%76 = call i32 @assert(i32 %75)
%77 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 5
%78 = load i8, i8* %77
%79 = zext i8 %78 to i32
%80 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 7
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = add nuw nsw i32 %82, %79
%84 = icmp eq i32 %83, 255
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = zext i8 %48 to i64
%88 = shl nuw nsw i64 %87, 16
%89 = zext i8 %58 to i64
%90 = shl nuw nsw i64 %89, 8
%91 = or i64 %90, %88
%92 = zext i8 %68 to i64
%93 = shl nuw nsw i64 %92, 16
%94 = zext i8 %78 to i64
%95 = shl nuw nsw i64 %94, 8
%96 = or i64 %95, %93
%97 = call i32 @dump_fw(i32* %31, i32* %11, i64 %91)
%98 = call i32 @dump_fw(i32* %32, i32* %11, i64 %96)
%99 = call i32 @fclose(i32* %11)
%100 = call i32 @fclose(i32* %31)
%101 = call i32 @fclose(i32* %32)
ret i32 0
}