#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 size_t uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t checksum(char *, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int sscanf(char *, char *, size_t *, ...);
int /*<<< orphan*/ stderr;
int strlen(char *);
int hexfile_getline(FILE *fd, uint16_t *address, uint8_t *dest, size_t n) {
  char line[522];
  uint8_t count = 0, type = 0, cksum = 0;
  int r, i;
  fgets(line, sizeof(line), fd);
  if (line[0] != ':') {
    fprintf(stderr, "line can't be parsed: %s\n", line);
    return -1;
  }
  r = sscanf(line, ":%02hhx%04hx%02hhx", &count, address, &type);
  if (r != 3) {
    fprintf(stderr, "line parse error: %s\n", line);
    return -2;
  }
  if (count > n) {
    fprintf(stderr, "internal buffer too small to handle: %s\n", line);
    return -3;
  }
  if (strlen(line) < 11 + count) {
    fprintf(stderr, "line too small: %zu, should be %i\n", strlen(line),
            11 + count);
    return -4;
  }
  r = sscanf(line + 9 + 2 * count, "%02hhx", &cksum);
  if ((r != 1) || (checksum(line + 1, 2 * count + 8) != cksum)) {
    fprintf(stderr, "checksum error: %s\n", line);
    return -5;
  }
  if (type == 0) {
    for (i = 0; i < count; i++) {
      uint8_t b;
      r = sscanf(line + 9 + i * 2, "%02hhx", &b);
      if (r != 1) {
        fprintf(stderr, "data error: %s\n", line);
        return -6;
      }
      dest[i] = b;
    }
    return count;
  }
  if (type != 1) {
    fprintf(stderr, "unknown type on line: %s\n", line);
    return -666;
  }
  return 0;
}


x86 assembly (clang, -O0):
<hexfile_getline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movq   $0x0,-0x248(%rbp)
movq   $0x0,-0x250(%rbp)
movq   $0x0,-0x258(%rbp)
lea    -0x240(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x20a,%esi
call   1050 <fgets@plt>
movsbl -0x240(%rbp),%eax
cmp    $0x3a,%eax
je     11db <hexfile_getline+0x8b>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    -0x240(%rbp),%rdx
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
lea    -0x240(%rbp),%rdi
mov    -0x18(%rbp),%rcx
lea    0xe2d(%rip),%rsi
lea    -0x248(%rbp),%rdx
lea    -0x250(%rbp),%r8
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    %eax,-0x25c(%rbp)
cmpl   $0x3,-0x25c(%rbp)
je     123f <hexfile_getline+0xef>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
lea    -0x240(%rbp),%rdx
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
mov    -0x248(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    127a <hexfile_getline+0x12a>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
lea    -0x240(%rbp),%rdx
lea    0xddc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
lea    -0x240(%rbp),%rdi
call   1030 <strlen@plt>
cltq
mov    -0x248(%rbp),%rcx
add    $0xb,%rcx
cmp    %rcx,%rax
jae    12e4 <hexfile_getline+0x194>
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x26c(%rbp)
lea    -0x240(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x26c(%rbp),%edi
mov    %eax,%edx
mov    -0x248(%rbp),%rcx
add    $0xb,%rcx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
lea    -0x240(%rbp),%rdi
add    $0x9,%rdi
mov    -0x248(%rbp),%rax
shl    $0x1,%rax
add    %rax,%rdi
lea    0xd22(%rip),%rsi
lea    -0x258(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    %eax,-0x25c(%rbp)
cmpl   $0x1,-0x25c(%rbp)
jne    1353 <hexfile_getline+0x203>
lea    -0x240(%rbp),%rdi
add    $0x1,%rdi
mov    -0x248(%rbp),%rax
shl    $0x1,%rax
add    $0x8,%rax
mov    %eax,%esi
call   1040 <checksum@plt>
cmp    -0x258(%rbp),%rax
je     137d <hexfile_getline+0x22d>
mov    0x2c86(%rip),%rax
mov    (%rax),%edi
lea    -0x240(%rbp),%rdx
lea    0xd25(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xfffffffb,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
cmpq   $0x0,-0x250(%rbp)
jne    144d <hexfile_getline+0x2fd>
movl   $0x0,-0x260(%rbp)
movslq -0x260(%rbp),%rax
cmp    -0x248(%rbp),%rax
jae    143e <hexfile_getline+0x2ee>
lea    -0x240(%rbp),%rdi
add    $0x9,%rdi
mov    -0x260(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
lea    0xc5d(%rip),%rsi
lea    -0x268(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    %eax,-0x25c(%rbp)
cmpl   $0x1,-0x25c(%rbp)
je     1414 <hexfile_getline+0x2c4>
mov    0x2bef(%rip),%rax
mov    (%rax),%edi
lea    -0x240(%rbp),%rdx
lea    0xca2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xfffffffa,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
mov    -0x268(%rbp),%rdx
mov    -0x20(%rbp),%rax
movslq -0x260(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x260(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x260(%rbp)
jmp    1395 <hexfile_getline+0x245>
mov    -0x248(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
cmpq   $0x1,-0x250(%rbp)
01
je     1485 <hexfile_getline+0x335>
mov    0x2b7e(%rip),%rax
mov    (%rax),%edi
lea    -0x240(%rbp),%rdx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xfffffd66,-0x4(%rbp)
jmp    148c <hexfile_getline+0x33c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexfile_getline>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x230,%rsp
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rdx
movq   $0x0,(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x20a,%esi
call   1050 <fgets@plt>
cmpb   $0x3a,0x20(%rsp)
jne    11eb <hexfile_getline+0x9b>
lea    0xe77(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    %rsp,%rdx
lea    0x10(%rsp),%r8
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <sscanf@plt>
cmp    $0x3,%eax
jne    1211 <hexfile_getline+0xc1>
cmp    %r15,(%rsp)
jbe    1237 <hexfile_getline+0xe7>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffffd,%eax
jmp    1340 <hexfile_getline+0x1f0>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe05(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1340 <hexfile_getline+0x1f0>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
lea    0xe0c(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffffe,%eax
jmp    1340 <hexfile_getline+0x1f0>
lea    0x20(%rsp),%rdi
call   1030 <strlen@plt>
movslq %eax,%rcx
mov    (%rsp),%rax
lea    0xb(%rax),%rdx
cmp    %rcx,%rdx
jbe    1288 <hexfile_getline+0x138>
mov    0x2d88(%rip),%rax
mov    (%rax),%ebx
lea    0x20(%rsp),%rdi
call   1030 <strlen@plt>
mov    (%rsp),%rcx
add    $0xb,%rcx
lea    0xdf9(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffffc,%eax
jmp    1340 <hexfile_getline+0x1f0>
lea    (%rsp,%rax,2),%rdi
add    $0x29,%rdi
lea    0xd8f(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    131f <hexfile_getline+0x1cf>
lea    0x21(%rsp),%rdi
mov    (%rsp),%eax
lea    (%rax,%rax,1),%esi
add    $0x8,%esi
call   1040 <checksum@plt>
cmp    0x8(%rsp),%rax
jne    131f <hexfile_getline+0x1cf>
xor    %eax,%eax
mov    0x10(%rsp),%rcx
cmp    $0x1,%rcx
je     1340 <hexfile_getline+0x1f0>
test   %rcx,%rcx
jne    1351 <hexfile_getline+0x201>
cmpq   $0x0,(%rsp)
je     1340 <hexfile_getline+0x1f0>
lea    0x29(%rsp),%r13
lea    0xd3f(%rip),%r15
lea    0x18(%rsp),%r12
xor    %ebx,%ebx
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    1374 <hexfile_getline+0x224>
mov    0x18(%rsp),%rax
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
mov    (%rsp),%rax
add    $0x2,%r13
cmp    %rbx,%rax
ja     12ee <hexfile_getline+0x19e>
jmp    1340 <hexfile_getline+0x1f0>
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
lea    0xd60(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffffb,%eax
add    $0x230,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
lea    0xd52(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffd66,%eax
jmp    1340 <hexfile_getline+0x1f0>
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
lea    0xd1f(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffffa,%eax
jmp    1340 <hexfile_getline+0x1f0>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"line can't be parsed: %s\0A\00"
@.str.1 = [19 x i8] c":%02hhx%04hx%02hhx\00"
@.str.2 = [22 x i8] c"line parse error: %s\0A\00"
@.str.3 = [41 x i8] c"internal buffer too small to handle: %s\0A\00"
@.str.4 = [35 x i8] c"line too small: %zu, should be %i\0A\00"
@.str.5 = [7 x i8] c"%02hhx\00"
@.str.6 = [20 x i8] c"checksum error: %s\0A\00"
@.str.7 = [16 x i8] c"data error: %s\0A\00"
@.str.8 = [26 x i8] c"unknown type on line: %s\0A\00"
define i32 @hexfile_getline(i32* %0, i32* %1, i64* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i64*
%9 = alloca i64
%10 = alloca [522 x i8]
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i64
store i32* %0, i32** %6
store i32* %1, i32** %7
store i64* %2, i64** %8
store i64 %3, i64* %9
store i64 0, i64* %11
store i64 0, i64* %12
store i64 0, i64* %13
%17 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%18 = load i32*, i32** %6
%19 = call i32 @fgets(i8* %17, i32 522, i32* %18)
%20 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 58
br i1 %23, label %24, label %28
24: ; preds = %4
%25 = load i32, i32* @stderr
%26 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %26)
store i32 -1, i32* %5
br label %126
28: ; preds = %4
%29 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%30 = load i32*, i32** %7
%31 = call i32 (i8*, i8*, i64*, ...) @sscanf(i8* %29, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64* %11, i32* %30, i64* %12)
store i32 %31, i32* %14
%32 = load i32, i32* %14
%33 = icmp ne i32 %32, 3
br i1 %33, label %34, label %38
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %36)
store i32 -2, i32* %5
br label %126
38: ; preds = %28
%39 = load i64, i64* %11
%40 = load i64, i64* %9
%41 = icmp ugt i64 %39, %40
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = load i32, i32* @stderr
%44 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %44)
store i32 -3, i32* %5
br label %126
46: ; preds = %38
%47 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%48 = call i32 @strlen(i8* %47)
%49 = sext i32 %48 to i64
%50 = load i64, i64* %11
%51 = add i64 11, %50
%52 = icmp ult i64 %49, %51
br i1 %52, label %53, label %60
53: ; preds = %46
%54 = load i32, i32* @stderr
%55 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%56 = call i32 @strlen(i8* %55)
%57 = load i64, i64* %11
%58 = add i64 11, %57
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %56, i64 %58)
store i32 -4, i32* %5
br label %126
60: ; preds = %46
%61 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%62 = getelementptr inbounds i8, i8* %61, i64 9
%63 = load i64, i64* %11
%64 = mul i64 2, %63
%65 = getelementptr inbounds i8, i8* %62, i64 %64
%66 = call i32 (i8*, i8*, i64*, ...) @sscanf(i8* %65, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64* %13)
store i32 %66, i32* %14
%67 = load i32, i32* %14
%68 = icmp ne i32 %67, 1
br i1 %68, label %79, label %69
69: ; preds = %60
%70 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%71 = getelementptr inbounds i8, i8* %70, i64 1
%72 = load i64, i64* %11
%73 = mul i64 2, %72
%74 = add i64 %73, 8
%75 = trunc i64 %74 to i32
%76 = call i64 @checksum(i8* %71, i32 %75)
%77 = load i64, i64* %13
%78 = icmp ne i64 %76, %77
br i1 %78, label %79, label %83
79: ; preds = %69, %60
%80 = load i32, i32* @stderr
%81 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %81)
store i32 -5, i32* %5
br label %126
83: ; preds = %69
%84 = load i64, i64* %12
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %118
86: ; preds = %83
store i32 0, i32* %15
br label %87
87: ; preds = %112, %86
%88 = load i32, i32* %15
%89 = sext i32 %88 to i64
%90 = load i64, i64* %11
%91 = icmp ult i64 %89, %90
br i1 %91, label %92, label %115
92: ; preds = %87
%93 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%94 = getelementptr inbounds i8, i8* %93, i64 9
%95 = load i32, i32* %15
%96 = mul nsw i32 %95, 2
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %94, i64 %97
%99 = call i32 (i8*, i8*, i64*, ...) @sscanf(i8* %98, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64* %16)
store i32 %99, i32* %14
%100 = load i32, i32* %14
%101 = icmp ne i32 %100, 1
br i1 %101, label %102, label %106
102: ; preds = %92
%103 = load i32, i32* @stderr
%104 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %104)
store i32 -6, i32* %5
br label %126
106: ; preds = %92
%107 = load i64, i64* %16
%108 = load i64*, i64** %8
%109 = load i32, i32* %15
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i64, i64* %108, i64 %110
store i64 %107, i64* %111
br label %112
112: ; preds = %106
%113 = load i32, i32* %15
%114 = add nsw i32 %113, 1
store i32 %114, i32* %15
br label %87
115: ; preds = %87
%116 = load i64, i64* %11
%117 = trunc i64 %116 to i32
store i32 %117, i32* %5
br label %126
118: ; preds = %83
%119 = load i64, i64* %12
%120 = icmp ne i64 %119, 1
br i1 %120, label %121, label %125
121: ; preds = %118
%122 = load i32, i32* @stderr
%123 = getelementptr inbounds [522 x i8], [522 x i8]* %10, i64 0, i64 0
%124 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %123)
store i32 -666, i32* %5
br label %126
125: ; preds = %118
store i32 0, i32* %5
br label %126
126: ; preds = %125, %121, %115, %102, %79, %53, %42, %34, %24
%127 = load i32, i32* %5
ret i32 %127
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"line can't be parsed: %s\0A\00"
@.str.1 = [19 x i8] c":%02hhx%04hx%02hhx\00"
@.str.2 = [22 x i8] c"line parse error: %s\0A\00"
@.str.3 = [41 x i8] c"internal buffer too small to handle: %s\0A\00"
@.str.4 = [35 x i8] c"line too small: %zu, should be %i\0A\00"
@.str.5 = [7 x i8] c"%02hhx\00"
@.str.6 = [20 x i8] c"checksum error: %s\0A\00"
@.str.7 = [16 x i8] c"data error: %s\0A\00"
@.str.8 = [26 x i8] c"unknown type on line: %s\0A\00"
define i32 @hexfile_getline(i32* nocapture %0, i32* %1, i64* nocapture writeonly %2, i64 %3) {
%5 = alloca [522 x i8]
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = getelementptr inbounds [522 x i8], [522 x i8]* %5, i64 0, i64 0
%11 = bitcast i64* %6 to i8*
store i64 0, i64* %6
%12 = bitcast i64* %7 to i8*
store i64 0, i64* %7
%13 = bitcast i64* %8 to i8*
store i64 0, i64* %8
%14 = call i32 @fgets(i8* %10, i32 522, i32* %0)
%15 = load i8, i8* %10
%16 = icmp eq i8 %15, 58
br i1 %16, label %20, label %17
17: ; preds = %4
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %89
20: ; preds = %4
%21 = call i32 (i8*, i8*, i64*, ...) @sscanf(i8* %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64* %6, i32* %1, i64* %7)
%22 = icmp eq i32 %21, 3
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %89
26: ; preds = %20
%27 = load i64, i64* %6
%28 = icmp ugt i64 %27, %3
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %89
32: ; preds = %26
%33 = call i32 @strlen(i8* %10)
%34 = sext i32 %33 to i64
%35 = load i64, i64* %6
%36 = add i64 %35, 11
%37 = icmp ugt i64 %36, %34
br i1 %37, label %38, label %44
38: ; preds = %32
%39 = load i32, i32* @stderr
%40 = call i32 @strlen(i8* %10)
%41 = load i64, i64* %6
%42 = add i64 %41, 11
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %40, i64 %42)
br label %89
44: ; preds = %32
%45 = getelementptr inbounds [522 x i8], [522 x i8]* %5, i64 0, i64 9
%46 = shl i64 %35, 1
%47 = getelementptr inbounds i8, i8* %45, i64 %46
%48 = call i32 (i8*, i8*, i64*, ...) @sscanf(i8* %47, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64* %8)
%49 = icmp eq i32 %48, 1
br i1 %49, label %50, label %59
50: ; preds = %44
%51 = getelementptr inbounds [522 x i8], [522 x i8]* %5, i64 0, i64 1
%52 = load i64, i64* %6
%53 = trunc i64 %52 to i32
%54 = shl i32 %53, 1
%55 = add i32 %54, 8
%56 = call i64 @checksum(i8* %51, i32 %55)
%57 = load i64, i64* %8
%58 = icmp eq i64 %56, %57
br i1 %58, label %62, label %59
59: ; preds = %50, %44
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %10)
br label %89
62: ; preds = %50
%63 = load i64, i64* %7
switch i64 %63, label %86 [
i64 0, label %64
i64 1, label %89
]
64: ; preds = %62
%65 = load i64, i64* %6
%66 = icmp eq i64 %65, 0
br i1 %66, label %89, label %67
67: ; preds = %64
%68 = bitcast i64* %9 to i8*
br label %69
69: ; preds = %67, %78
%70 = phi i64 [ 0, %67 ], [ %81, %78 ]
%71 = shl nuw nsw i64 %70, 1
%72 = getelementptr inbounds i8, i8* %45, i64 %71
%73 = call i32 (i8*, i8*, i64*, ...) @sscanf(i8* %72, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64* %9)
%74 = icmp eq i32 %73, 1
br i1 %74, label %78, label %75
75: ; preds = %69
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %10)
br label %89
78: ; preds = %69
%79 = load i64, i64* %9
%80 = getelementptr inbounds i64, i64* %2, i64 %70
store i64 %79, i64* %80
%81 = add nuw i64 %70, 1
%82 = load i64, i64* %6
%83 = icmp ugt i64 %82, %81
br i1 %83, label %69, label %84
84: ; preds = %78
%85 = trunc i64 %82 to i32
br label %89
86: ; preds = %62
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %10)
br label %89
89: ; preds = %64, %84, %75, %62, %86, %59, %38, %29, %23, %17
%90 = phi i32 [ -1, %17 ], [ -2, %23 ], [ -3, %29 ], [ -4, %38 ], [ -5, %59 ], [ -6, %75 ], [ -666, %86 ], [ 0, %62 ], [ 0, %64 ], [ %85, %84 ]
ret i32 %90
}