#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 EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int loadhex(FILE *inf, unsigned char *buf) {
  int l = 0, c, i;
  while ((c = getc(inf)) != EOF) {
    if (c == ':') {
      int n, check;
      unsigned char sum;
      int addr;
      int linetype;
      if (fscanf(inf, "%02x", &n) != 1) {
        {
          fprintf(stderr, "%s\n", "File format error");
          exit(1);
        };
      }
      sum = n;
      if (fscanf(inf, "%04x", &addr) != 1) {
        {
          fprintf(stderr, "%s\n", "File format error");
          exit(1);
        };
      }
      sum += addr / 256;
      sum += addr % 256;
      if (fscanf(inf, "%02x", &linetype) != 1) {
        {
          fprintf(stderr, "%s\n", "File format error");
          exit(1);
        };
      }
      sum += linetype;
      if (linetype != 0) {
        continue;
      }
      for (i = 0; i < n; i++) {
        if (fscanf(inf, "%02x", &c) != 1) {
          {
            fprintf(stderr, "%s\n", "File format error");
            exit(1);
          };
        }
        if (addr >= (256 * 1024)) {
          {
            fprintf(stderr, "%s\n", "File too large");
            exit(1);
          };
        }
        buf[addr++] = c;
        if (addr > l) {
          l = addr;
        }
        sum += c;
      }
      if (fscanf(inf, "%02x", &check) != 1) {
        {
          fprintf(stderr, "%s\n", "File format error");
          exit(1);
        };
      }
      sum = ~sum + 1;
      if (check != sum) {
        {
          fprintf(stderr, "%s\n", "Line checksum error");
          exit(1);
        };
      }
    }
  }
  return l;
}


x86 assembly (clang, -O0):
<loadhex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
je     13ee <loadhex+0x2ae>
cmpl   $0x3a,-0x18(%rbp)
jne    13e9 <loadhex+0x2a9>
mov    -0x8(%rbp),%rdi
lea    0xe79(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
je     11bf <loadhex+0x7f>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
lea    0xe59(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x20(%rbp),%eax
mov    %al,-0x25(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
je     1208 <loadhex+0xc8>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
lea    0xe10(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x2c(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
movzbl -0x25(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x25(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
movzbl -0x25(%rbp),%eax
add    %edx,%eax
mov    %al,-0x25(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xdc3(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
je     1275 <loadhex+0x135>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
lea    0xda6(%rip),%rsi
lea    0xda3(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x30(%rbp),%ecx
movzbl -0x25(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x25(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     1290 <loadhex+0x150>
jmp    1157 <loadhex+0x17>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    135f <loadhex+0x21f>
mov    -0x8(%rbp),%rdi
lea    0xd52(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
je     12e6 <loadhex+0x1a6>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
lea    0xd35(%rip),%rsi
lea    0xd32(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x40000,-0x2c(%rbp)
jl     1319 <loadhex+0x1d9>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
lea    0xd02(%rip),%rsi
lea    0xd16(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x2c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1345 <loadhex+0x205>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%ecx
movzbl -0x25(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x25(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1297 <loadhex+0x157>
mov    -0x8(%rbp),%rdi
lea    0xc96(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
je     13a2 <loadhex+0x262>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
lea    0xc79(%rip),%rsi
lea    0xc76(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movzbl -0x25(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
mov    %al,-0x25(%rbp)
mov    -0x24(%rbp),%eax
movzbl -0x25(%rbp),%ecx
cmp    %ecx,%eax
je     13e4 <loadhex+0x2a4>
mov    0x2c13(%rip),%rax
mov    (%rax),%edi
lea    0xc37(%rip),%rsi
lea    0xc5a(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    13e9 <loadhex+0x2a9>
jmp    1157 <loadhex+0x17>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadhex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,0x20(%rsp)
mov    %rdi,%rbx
call   1060 <getc@plt>
mov    %eax,0xc(%rsp)
mov    0x2e82(%rip),%r12
xor    %r14d,%r14d
cmp    (%r12),%eax
jne    1181 <loadhex+0x41>
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
lea    0xe75(%rip),%r15
nopl   0x0(%rax,%rax,1)
cmp    $0x3a,%eax
jne    11f4 <loadhex+0xb4>
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0x14(%rsp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    12cc <loadhex+0x18c>
mov    0x14(%rsp),%r13d
mov    %rbx,%rdi
lea    0xe5e(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    12cc <loadhex+0x18c>
mov    0x10(%rsp),%ebp
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0x18(%rsp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    12cc <loadhex+0x18c>
cmpl   $0x0,0x18(%rsp)
je     120b <loadhex+0xcb>
mov    %rbx,%rdi
call   1060 <getc@plt>
mov    %eax,0xc(%rsp)
cmp    (%r12),%eax
jne    1190 <loadhex+0x50>
jmp    116f <loadhex+0x2f>
lea    0xff(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
sar    $0x8,%eax
add    %ebp,%r13d
add    %eax,%r13d
cmpl   $0x0,0x14(%rsp)
jle    1286 <loadhex+0x146>
xor    %r12d,%r12d
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0xc(%rsp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    12cc <loadhex+0x18c>
movslq 0x10(%rsp),%rax
cmp    $0x40000,%rax
jge    12f2 <loadhex+0x1b2>
mov    0xc(%rsp),%ecx
lea    0x1(%rax),%edx
mov    %edx,0x10(%rsp)
mov    0x20(%rsp),%rsi
mov    %cl,(%rsi,%rax,1)
cmp    %r14d,%eax
cmovge %edx,%r14d
movzbl %r13b,%r13d
add    %ecx,%r13d
add    $0x1,%r12d
cmp    0x14(%rsp),%r12d
jl     1230 <loadhex+0xf0>
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0x1c(%rsp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    12cc <loadhex+0x18c>
neg    %r13d
movzbl %r13b,%eax
cmp    %eax,0x1c(%rsp)
mov    0x2d3b(%rip),%r12
je     11f4 <loadhex+0xb4>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
lea    0xd42(%rip),%rsi
lea    0xd65(%rip),%rdx
jmp    12e3 <loadhex+0x1a3>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
lea    0xd29(%rip),%rsi
lea    0xd26(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
lea    0xd03(%rip),%rsi
lea    0xd17(%rip),%rdx
jmp    12e3 <loadhex+0x1a3>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [5 x i8] c"%02x\00"
@stderr = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [18 x i8] c"File format error\00"
@.str.3 = [5 x i8] c"%04x\00"
@.str.4 = [15 x i8] c"File too large\00"
@.str.5 = [20 x i8] c"Line checksum error\00"
define i32 @loadhex(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %3 to i8*
%9 = call i32 @getc(i32* %0)
store i32 %9, i32* %3
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %113, label %12
12: ; preds = %2
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
br label %17
17: ; preds = %12, %108
%18 = phi i32 [ %9, %12 ], [ %110, %108 ]
%19 = phi i32 [ 0, %12 ], [ %109, %108 ]
br label %20
20: ; preds = %17, %104
%21 = phi i32 [ %18, %17 ], [ %105, %104 ]
%22 = icmp eq i32 %21, 58
br i1 %22, label %23, label %108
23: ; preds = %20
%24 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %4)
%25 = icmp eq i32 %24, 1
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %23
%31 = load i32, i32* %4
%32 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %6)
%33 = icmp eq i32 %32, 1
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %30
%39 = load i32, i32* %6
%40 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %7)
%41 = icmp eq i32 %40, 1
br i1 %41, label %46, label %42
42: ; preds = %38
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %38
%47 = load i32, i32* %7
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %104
49: ; preds = %46
%50 = sdiv i32 %39, 256
%51 = add i32 %39, %31
%52 = add i32 %51, %50
%53 = load i32, i32* %4
%54 = icmp sgt i32 %53, 0
br i1 %54, label %55, label %85
55: ; preds = %49, %72
%56 = phi i32 [ %81, %72 ], [ %52, %49 ]
%57 = phi i32 [ %82, %72 ], [ 0, %49 ]
%58 = phi i32 [ %79, %72 ], [ %19, %49 ]
%59 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3)
%60 = icmp eq i32 %59, 1
br i1 %60, label %65, label %61
61: ; preds = %55
%62 = load i32, i32* @stderr
%63 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %55
%66 = load i32, i32* %6
%67 = icmp sgt i32 %66, 262143
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %65
%73 = load i32, i32* %3
%74 = trunc i32 %73 to i8
%75 = add nsw i32 %66, 1
store i32 %75, i32* %6
%76 = sext i32 %66 to i64
%77 = getelementptr inbounds i8, i8* %1, i64 %76
store i8 %74, i8* %77
%78 = icmp slt i32 %66, %58
%79 = select i1 %78, i32 %58, i32 %75
%80 = and i32 %56, 255
%81 = add nsw i32 %73, %80
%82 = add nuw nsw i32 %57, 1
%83 = load i32, i32* %4
%84 = icmp slt i32 %82, %83
br i1 %84, label %55, label %85
85: ; preds = %72, %49
%86 = phi i32 [ %19, %49 ], [ %79, %72 ]
%87 = phi i32 [ %52, %49 ], [ %81, %72 ]
%88 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %5)
%89 = icmp eq i32 %88, 1
br i1 %89, label %94, label %90
90: ; preds = %85
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %85
%95 = sub i32 0, %87
%96 = load i32, i32* %5
%97 = and i32 %95, 255
%98 = icmp eq i32 %96, %97
br i1 %98, label %99, label %100
99: ; preds = %94
br label %108
100: ; preds = %94
%101 = load i32, i32* @stderr
%102 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %46
%105 = call i32 @getc(i32* %0)
store i32 %105, i32* %3
%106 = load i32, i32* @EOF
%107 = icmp eq i32 %105, %106
br i1 %107, label %113, label %20
108: ; preds = %20, %99
%109 = phi i32 [ %86, %99 ], [ %19, %20 ]
%110 = call i32 @getc(i32* %0)
store i32 %110, i32* %3
%111 = load i32, i32* @EOF
%112 = icmp eq i32 %110, %111
br i1 %112, label %113, label %17
113: ; preds = %108, %104, %2
%114 = phi i32 [ 0, %2 ], [ %19, %104 ], [ %109, %108 ]
ret i32 %114
}