#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int v;
  FILE *fp;
  unsigned char buf[10];
  unsigned short top;
  if (argc != 2 && argc != 3) {
    fprintf(stderr, "%s [executable] {size}\n", argv[0]);
    exit(1);
  }
  if (argc == 2)
    fp = fopen(argv[1], "r");
  else
    fp = fopen(argv[1], "r+");
  if (fp == NULL) {
    perror(argv[1]);
    exit(1);
  }
  if (fread(buf, 10, 1, fp) != 1) {
    fprintf(stderr, "%s: too short ?\n", argv[0]);
    exit(1);
  }
  if ((buf[0] != 0x4C && buf[0] != 0xC3) || buf[3] != 'F' || buf[4] != 'Z' ||
      buf[5] != 'X' || buf[6] != '1') {
    fprintf(stderr, "%s: not a Fuzix binary format.\n", argv[1]);
    exit(1);
  }
  if (argc == 2) {
    top = buf[8] | (buf[9] << 8);
    if (top)
      printf("Fuzix binary set at %d bytes.\n", top);
    else
      printf("Fuzix binary, set to allocate all available.\n");
    exit(0);
  }
  if (sscanf(argv[2], "%d", &v) != 1 || v < 0 || v > 65536) {
    fprintf(stderr, "%s: invalid chmem value '%s'.\n", argv[0], argv[2]);
    exit(1);
  }
  buf[8] = v & 0xFF;
  buf[9] = v >> 8;
  rewind(fp);
  if (fwrite(buf, 10, 1, fp) != 1) {
    fprintf(stderr, "%s: write error.\n", argv[0]);
    exit(1);
  }
  fclose(fp);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11f2 <main+0x52>
cmpl   $0x3,-0x8(%rbp)
je     11f2 <main+0x52>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1219 <main+0x79>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
jmp    1231 <main+0x91>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf2(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1253 <main+0xb3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    -0x2a(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0xa,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     129b <main+0xfb>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd93(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movzbl -0x2a(%rbp),%eax
cmp    $0x4c,%eax
je     12b7 <main+0x117>
movzbl -0x2a(%rbp),%eax
cmp    $0xc3,%eax
jne    12eb <main+0x14b>
movzbl -0x27(%rbp),%eax
cmp    $0x46,%eax
jne    12eb <main+0x14b>
movzbl -0x26(%rbp),%eax
cmp    $0x5a,%eax
jne    12eb <main+0x14b>
movzbl -0x25(%rbp),%eax
cmp    $0x58,%eax
jne    12eb <main+0x14b>
movzbl -0x24(%rbp),%eax
cmp    $0x31,%eax
je     1314 <main+0x174>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd2b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1366 <main+0x1c6>
movzbl -0x22(%rbp),%eax
movzbl -0x21(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %ax,-0x2c(%rbp)
cmpw   $0x0,-0x2c(%rbp)
je     1351 <main+0x1b1>
movzwl -0x2c(%rbp),%esi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    135f <main+0x1bf>
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd26(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    139e <main+0x1fe>
cmpl   $0x0,-0x14(%rbp)
jl     139e <main+0x1fe>
cmpl   $0x10000,-0x14(%rbp)
jle    13ce <main+0x22e>
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xce1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x14(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x22(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <rewind@plt>
lea    -0x2a(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0xa,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
cmp    $0x1,%eax
je     1433 <main+0x293>
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc9b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%eax
and    $0xfffffffe,%eax
cmp    $0x2,%eax
jne    11fd <main+0x4d>
mov    %edi,%ebp
cmp    $0x2,%edi
mov    0x8(%rbx),%rdi
lea    0xe43(%rip),%rax
lea    0xe3e(%rip),%rsi
cmove  %rax,%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
jne    1215 <main+0x65>
mov    0x8(%rbx),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdf0(%rip),%rsi
jmp    12b0 <main+0x100>
mov    %rax,%r14
lea    0x2(%rsp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
cmp    $0x1,%eax
jne    1287 <main+0xd7>
mov    0x2(%rsp),%al
cmp    $0x4c,%al
setne  %cl
cmp    $0xc3,%al
setne  %al
test   %al,%cl
jne    129c <main+0xec>
cmpb   $0x46,0x5(%rsp)
jne    129c <main+0xec>
cmpb   $0x5a,0x6(%rsp)
jne    129c <main+0xec>
cmpb   $0x58,0x7(%rsp)
jne    129c <main+0xec>
cmpb   $0x31,0x8(%rsp)
jne    129c <main+0xec>
cmp    $0x2,%ebp
jne    12c1 <main+0x111>
movzwl 0xa(%rsp),%esi
test   %esi,%esi
jne    1322 <main+0x172>
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd83(%rip),%rsi
jmp    12b0 <main+0x100>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd7e(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x10(%rbx),%rdi
lea    0xda1(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    1337 <main+0x187>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     1337 <main+0x187>
cmp    $0x10001,%eax
jge    1337 <main+0x187>
mov    %ax,0xa(%rsp)
mov    %r14,%rdi
call   1070 <rewind@plt>
lea    0x2(%rsp),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10d0 <fwrite@plt>
cmp    $0x1,%eax
jne    135f <main+0x1af>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    0xd25(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
mov    0x10(%rbx),%rcx
lea    0xd22(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd1d(%rip),%rsi
jmp    12b0 <main+0x100>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"%s [executable] {size}\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [17 x i8] c"%s: too short ?\0A\00"
@.str.4 = [32 x i8] c"%s: not a Fuzix binary format.\0A\00"
@.str.5 = [31 x i8] c"Fuzix binary set at %d bytes.\0A\00"
@.str.6 = [46 x i8] c"Fuzix binary, set to allocate all available.\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [31 x i8] c"%s: invalid chmem value '%s'.\0A\00"
@.str.9 = [18 x i8] c"%s: write error.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca [10 x i8]
%9 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %22
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %12, %2
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %30
25: ; preds = %22
%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 ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %7
br label %35
30: ; preds = %22
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %34, i32** %7
br label %35
35: ; preds = %30, %25
%36 = load i32*, i32** %7
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %44
38: ; preds = %35
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i32 @perror(i8* %41)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %35
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%46 = load i32*, i32** %7
%47 = call i32 @fread(i8* %45, i32 10, i32 1, i32* %46)
%48 = icmp ne i32 %47, 1
br i1 %48, label %49, label %56
49: ; preds = %44
%50 = load i32, i32* @stderr
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 0
%53 = load i8*, i8** %52
%54 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %53)
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %44
%57 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = icmp ne i32 %59, 76
br i1 %60, label %61, label %66
61: ; preds = %56
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = icmp ne i32 %64, 195
br i1 %65, label %86, label %66
66: ; preds = %61, %56
%67 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 3
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = icmp ne i32 %69, 70
br i1 %70, label %86, label %71
71: ; preds = %66
%72 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 4
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = icmp ne i32 %74, 90
br i1 %75, label %86, label %76
76: ; preds = %71
%77 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 5
%78 = load i8, i8* %77
%79 = zext i8 %78 to i32
%80 = icmp ne i32 %79, 88
br i1 %80, label %86, label %81
81: ; preds = %76
%82 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 6
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = icmp ne i32 %84, 49
br i1 %85, label %86, label %93
86: ; preds = %81, %76, %71, %66, %61
%87 = load i32, i32* @stderr
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 1
%90 = load i8*, i8** %89
%91 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %90)
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %81
%94 = load i32, i32* %4
%95 = icmp eq i32 %94, 2
br i1 %95, label %96, label %116
96: ; preds = %93
%97 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 8
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 9
%101 = load i8, i8* %100
%102 = zext i8 %101 to i32
%103 = shl i32 %102, 8
%104 = or i32 %99, %103
%105 = trunc i32 %104 to i16
store i16 %105, i16* %9
%106 = load i16, i16* %9
%107 = icmp ne i16 %106, 0
br i1 %107, label %108, label %112
108: ; preds = %96
%109 = load i16, i16* %9
%110 = zext i16 %109 to i32
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %110)
br label %114
112: ; preds = %96
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
br label %114
114: ; preds = %112, %108
%115 = call i32 @exit(i32 0)
unreachable
116: ; preds = %93
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 2
%119 = load i8*, i8** %118
%120 = call i32 @sscanf(i8* %119, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %6)
%121 = icmp ne i32 %120, 1
br i1 %121, label %128, label %122
122: ; preds = %116
%123 = load i32, i32* %6
%124 = icmp slt i32 %123, 0
br i1 %124, label %128, label %125
125: ; preds = %122
%126 = load i32, i32* %6
%127 = icmp sgt i32 %126, 65536
br i1 %127, label %128, label %138
128: ; preds = %125, %122, %116
%129 = load i32, i32* @stderr
%130 = load i8**, i8*** %5
%131 = getelementptr inbounds i8*, i8** %130, i64 0
%132 = load i8*, i8** %131
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 2
%135 = load i8*, i8** %134
%136 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %129, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %132, i8* %135)
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %125
%139 = load i32, i32* %6
%140 = and i32 %139, 255
%141 = trunc i32 %140 to i8
%142 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 8
store i8 %141, i8* %142
%143 = load i32, i32* %6
%144 = ashr i32 %143, 8
%145 = trunc i32 %144 to i8
%146 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 9
store i8 %145, i8* %146
%147 = load i32*, i32** %7
%148 = call i32 @rewind(i32* %147)
%149 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%150 = load i32*, i32** %7
%151 = call i32 @fwrite(i8* %149, i32 10, i32 1, i32* %150)
%152 = icmp ne i32 %151, 1
br i1 %152, label %153, label %160
153: ; preds = %138
%154 = load i32, i32* @stderr
%155 = load i8**, i8*** %5
%156 = getelementptr inbounds i8*, i8** %155, i64 0
%157 = load i8*, i8** %156
%158 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %154, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %157)
%159 = call i32 @exit(i32 1)
unreachable
160: ; preds = %138
%161 = load i32*, i32** %7
%162 = call i32 @fclose(i32* %161)
%163 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"%s [executable] {size}\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [17 x i8] c"%s: too short ?\0A\00"
@.str.4 = [32 x i8] c"%s: not a Fuzix binary format.\0A\00"
@.str.5 = [31 x i8] c"Fuzix binary set at %d bytes.\0A\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [31 x i8] c"%s: invalid chmem value '%s'.\0A\00"
@.str.9 = [18 x i8] c"%s: write error.\0A\00"
@str = [45 x i8] c"Fuzix binary, set to allocate all available.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%7 = and i32 %0, -2
%8 = icmp eq i32 %7, 2
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = icmp eq i32 %0, 2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = select i1 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%19 = tail call i32* @fopen(i8* %17, i8* %18)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %26
21: ; preds = %14
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = tail call i32 @perror(i8* %23)
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %14
%27 = call i32 @fread(i8* %6, i32 10, i32 1, i32* %19)
%28 = icmp eq i32 %27, 1
br i1 %28, label %34, label %29
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %1
%32 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %26
%35 = load i8, i8* %6
%36 = icmp ne i8 %35, 76
%37 = icmp ne i8 %35, -61
%38 = and i1 %36, %37
%39 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 3
%40 = load i8, i8* %39
%41 = icmp ne i8 %40, 70
%42 = select i1 %38, i1 true, i1 %41
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 4
%44 = load i8, i8* %43
%45 = icmp ne i8 %44, 90
%46 = select i1 %42, i1 true, i1 %45
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 5
%48 = load i8, i8* %47
%49 = icmp ne i8 %48, 88
%50 = select i1 %46, i1 true, i1 %49
%51 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 6
%52 = load i8, i8* %51
%53 = icmp ne i8 %52, 49
%54 = select i1 %50, i1 true, i1 %53
br i1 %54, label %55, label %61
55: ; preds = %34
%56 = load i32, i32* @stderr
%57 = getelementptr inbounds i8*, i8** %1, i64 1
%58 = load i8*, i8** %57
%59 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %58)
%60 = tail call i32 @exit(i32 1)
unreachable
61: ; preds = %34
br i1 %15, label %62, label %79
62: ; preds = %61
%63 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 8
%64 = load i8, i8* %63
%65 = zext i8 %64 to i16
%66 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 9
%67 = load i8, i8* %66
%68 = zext i8 %67 to i16
%69 = shl nuw i16 %68, 8
%70 = or i16 %69, %65
%71 = icmp eq i16 %70, 0
br i1 %71, label %75, label %72
72: ; preds = %62
%73 = zext i16 %70 to i32
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %73)
br label %77
75: ; preds = %62
%76 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
br label %77
77: ; preds = %75, %72
%78 = tail call i32 @exit(i32 0)
unreachable
79: ; preds = %61
%80 = getelementptr inbounds i8*, i8** %1, i64 2
%81 = load i8*, i8** %80
%82 = call i32 @sscanf(i8* %81, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%83 = icmp ne i32 %82, 1
%84 = load i32, i32* %3
%85 = icmp slt i32 %84, 0
%86 = select i1 %83, i1 true, i1 %85
%87 = icmp sgt i32 %84, 65536
%88 = select i1 %86, i1 true, i1 %87
br i1 %88, label %89, label %95
89: ; preds = %79
%90 = load i32, i32* @stderr
%91 = load i8*, i8** %1
%92 = load i8*, i8** %80
%93 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %91, i8* %92)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %79
%96 = trunc i32 %84 to i8
%97 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 8
store i8 %96, i8* %97
%98 = lshr i32 %84, 8
%99 = trunc i32 %98 to i8
%100 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 9
store i8 %99, i8* %100
%101 = call i32 @rewind(i32* %19)
%102 = call i32 @fwrite(i8* %6, i32 10, i32 1, i32* %19)
%103 = icmp eq i32 %102, 1
br i1 %103, label %109, label %104
104: ; preds = %95
%105 = load i32, i32* @stderr
%106 = load i8*, i8** %1
%107 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %106)
%108 = call i32 @exit(i32 1)
unreachable
109: ; preds = %95
%110 = call i32 @fclose(i32* %19)
%111 = call i32 @exit(i32 0)
unreachable
}