#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*/ O_RDWR;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ calloc(int, int);
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ lseek(int, int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int read(int, unsigned char *, int);
int /*<<< orphan*/ stderr;
void *strtol(char *, int /*<<< orphan*/ *, int);
int write(int, unsigned char *, int);
int main(int argc, char **argv) {
  int i, dc = 0, fd;
  int sz, cnt, offset;
  char *fn;
  unsigned char *buf, *data;
  if (3 > argc) {
    fputs("usage: grok fn offset [cdata]+\n", stderr);
    exit(1);
  }
  fn = argv[1];
  offset = strtol(argv[2], NULL, 16);
  data = (unsigned char *)calloc(argc - 2, sizeof(unsigned char));
  for (i = 3; i < argc; i++) {
    long x;
    x = strtol(argv[i], NULL, 16);
    data[dc++] = 0xff & x;
  }
  if (0 > (fd = open(fn, O_RDWR))) {
    fprintf(stderr, "cannot open %s, errno %d\n", fn, errno);
    exit(2);
  }
  if (0 > lseek(fd, offset, SEEK_SET)) {
    fprintf(stderr, "cannot seek to %x, errno %d\n", offset, errno);
    exit(2);
  }
  buf = (unsigned char *)calloc(dc, sizeof(unsigned char));
  if (0 > (cnt = read(fd, buf, dc))) {
    fprintf(stderr, "cannot read %d bytes at %x, errno %d\n", dc, offset,
            errno);
    exit(3);
  }
  printf("read %d of %d bytes\n", cnt, dc);
  if (0 > lseek(fd, offset, SEEK_SET)) {
    fprintf(stderr, "cannot seek to %x, errno %d\n", offset, errno);
    exit(2);
  }
  if (0 > (sz = write(fd, data, cnt))) {
    fprintf(stderr, "cannot write %d bytes at %x, errno %d\n", cnt, offset,
            errno);
    exit(4);
  }
  printf("wrote %d of %d bytes\n", sz, cnt);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jle    11ea <main+0x4a>
mov    0x2e06(%rip),%rax
mov    (%rax),%esi
lea    0xe25(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10a0 <strtol@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1283 <main+0xe3>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10a0 <strtol@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
and    $0xff,%rax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    122a <main+0x8a>
mov    -0x30(%rbp),%rdi
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    12d2 <main+0x132>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
mov    0x2d18(%rip),%rax
mov    (%rax),%ecx
lea    0xd5f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    0x2ce9(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1321 <main+0x181>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
mov    0x2cc9(%rip),%rax
mov    (%rax),%ecx
lea    0xd2a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    -0x18(%rbp),%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1070 <read@plt>
mov    %eax,%ecx
mov    %ecx,-0x24(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    1381 <main+0x1e1>
mov    0x2c81(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    0x2c6a(%rip),%rax
mov    (%rax),%r8d
lea    0xce7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x3,%edi
call   10c0 <exit@plt>
mov    -0x24(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xcef(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    0x2c28(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    13e2 <main+0x242>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
mov    0x2c08(%rip),%rax
mov    (%rax),%ecx
lea    0xc69(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <write@plt>
mov    %eax,%ecx
mov    %ecx,-0x20(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    1431 <main+0x291>
mov    0x2bd1(%rip),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    0x2bba(%rip),%rax
mov    (%rax),%r8d
lea    0xc72(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x4,%edi
call   10c0 <exit@plt>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xc7b(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jg     11cf <main+0x2f>
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
lea    0xe40(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    %rsi,%rbx
mov    %edi,%r15d
mov    0x8(%rsi),%r12
mov    0x10(%rsi),%rdi
xor    %r14d,%r14d
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <strtol@plt>
mov    %rax,(%rsp)
lea    -0x2(%r15),%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%r13
cmp    $0x3,%r15d
je     1232 <main+0x92>
add    $0xfffffffd,%r15d
xor    %ebp,%ebp
nopl   (%rax)
mov    0x18(%rbx,%rbp,8),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <strtol@plt>
mov    %al,0x0(%r13,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1210 <main+0x70>
mov    %r15d,%r14d
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   10b0 <open@plt>
test   %eax,%eax
jns    1274 <main+0xd4>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
mov    0x2d79(%rip),%rax
mov    (%rax),%ecx
lea    0xdc0(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    %eax,%ebp
mov    0x2d4b(%rip),%r12
mov    (%r12),%edx
mov    %eax,%edi
mov    (%rsp),%rbx
mov    %ebx,%esi
call   1050 <lseek@plt>
test   %rax,%rax
js     1307 <main+0x167>
mov    %r14d,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %ebp,%edi
mov    %rax,%rsi
mov    %r14d,%edx
call   1070 <read@plt>
test   %eax,%eax
jns    12e1 <main+0x141>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
mov    0x2d0f(%rip),%rax
mov    (%rax),%r8d
lea    0xd8c(%rip),%rsi
mov    %r14d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x3,%edi
call   10c0 <exit@plt>
mov    %eax,%r15d
lea    0xd92(%rip),%rdi
mov    %eax,%esi
mov    %r14d,%edx
call   1040 <printf@plt>
mov    (%r12),%edx
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <lseek@plt>
test   %rax,%rax
jns    1333 <main+0x193>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
mov    0x2cb9(%rip),%rax
mov    (%rax),%ecx
lea    0xd1a(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r15d,%edx
call   1030 <write@plt>
test   %eax,%eax
jns    1374 <main+0x1d4>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
mov    0x2c7c(%rip),%rax
mov    (%rax),%r8d
lea    0xd34(%rip),%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x4,%edi
call   10c0 <exit@plt>
lea    0xd3e(%rip),%rdi
mov    %eax,%esi
mov    %r15d,%edx
call   1040 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"usage: grok fn offset [cdata]+\0A\00"
@stderr = global i32 0
@O_RDWR = global i32 0
@.str.1 = [26 x i8] c"cannot open %s, errno %d\0A\00"
@errno = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [29 x i8] c"cannot seek to %x, errno %d\0A\00"
@.str.3 = [38 x i8] c"cannot read %d bytes at %x, errno %d\0A\00"
@.str.4 = [21 x i8] c"read %d of %d bytes\0A\00"
@.str.5 = [39 x i8] c"cannot write %d bytes at %x, errno %d\0A\00"
@.str.6 = [22 x i8] c"wrote %d of %d bytes\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%16 = load i32, i32* %4
%17 = icmp sgt i32 3, %16
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
store i8* %25, i8** %12
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i8* @strtol(i8* %28, i32* null, i32 16)
%30 = ptrtoint i8* %29 to i32
store i32 %30, i32* %11
%31 = load i32, i32* %4
%32 = sub nsw i32 %31, 2
%33 = call i64 @calloc(i32 %32, i32 1)
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %14
store i32 3, i32* %6
br label %35
35: ; preds = %55, %22
%36 = load i32, i32* %6
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %58
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i8* @strtol(i8* %44, i32* null, i32 16)
%46 = ptrtoint i8* %45 to i64
store i64 %46, i64* %15
%47 = load i64, i64* %15
%48 = and i64 255, %47
%49 = trunc i64 %48 to i8
%50 = load i8*, i8** %14
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
store i8 %49, i8* %54
br label %55
55: ; preds = %39
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %35
58: ; preds = %35
%59 = load i8*, i8** %12
%60 = load i32, i32* @O_RDWR
%61 = call i32 @open(i8* %59, i32 %60)
store i32 %61, i32* %8
%62 = icmp sgt i32 0, %61
br i1 %62, label %63, label %69
63: ; preds = %58
%64 = load i32, i32* @stderr
%65 = load i8*, i8** %12
%66 = load i32, i32* @errno
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %65, i32 %66)
%68 = call i32 @exit(i32 2)
unreachable
69: ; preds = %58
%70 = load i32, i32* %8
%71 = load i32, i32* %11
%72 = load i32, i32* @SEEK_SET
%73 = call i64 @lseek(i32 %70, i32 %71, i32 %72)
%74 = icmp sgt i64 0, %73
br i1 %74, label %75, label %81
75: ; preds = %69
%76 = load i32, i32* @stderr
%77 = load i32, i32* %11
%78 = load i32, i32* @errno
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %77, i32 %78)
%80 = call i32 @exit(i32 2)
unreachable
81: ; preds = %69
%82 = load i32, i32* %7
%83 = call i64 @calloc(i32 %82, i32 1)
%84 = inttoptr i64 %83 to i8*
store i8* %84, i8** %13
%85 = load i32, i32* %8
%86 = load i8*, i8** %13
%87 = load i32, i32* %7
%88 = call i32 @read(i32 %85, i8* %86, i32 %87)
store i32 %88, i32* %10
%89 = icmp sgt i32 0, %88
br i1 %89, label %90, label %97
90: ; preds = %81
%91 = load i32, i32* @stderr
%92 = load i32, i32* %7
%93 = load i32, i32* %11
%94 = load i32, i32* @errno
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %92, i32 %93, i32 %94)
%96 = call i32 @exit(i32 3)
unreachable
97: ; preds = %81
%98 = load i32, i32* %10
%99 = load i32, i32* %7
%100 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %98, i32 %99)
%101 = load i32, i32* %8
%102 = load i32, i32* %11
%103 = load i32, i32* @SEEK_SET
%104 = call i64 @lseek(i32 %101, i32 %102, i32 %103)
%105 = icmp sgt i64 0, %104
br i1 %105, label %106, label %112
106: ; preds = %97
%107 = load i32, i32* @stderr
%108 = load i32, i32* %11
%109 = load i32, i32* @errno
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %108, i32 %109)
%111 = call i32 @exit(i32 2)
unreachable
112: ; preds = %97
%113 = load i32, i32* %8
%114 = load i8*, i8** %14
%115 = load i32, i32* %10
%116 = call i32 @write(i32 %113, i8* %114, i32 %115)
store i32 %116, i32* %9
%117 = icmp sgt i32 0, %116
br i1 %117, label %118, label %125
118: ; preds = %112
%119 = load i32, i32* @stderr
%120 = load i32, i32* %10
%121 = load i32, i32* %11
%122 = load i32, i32* @errno
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %120, i32 %121, i32 %122)
%124 = call i32 @exit(i32 4)
unreachable
125: ; preds = %112
%126 = load i32, i32* %9
%127 = load i32, i32* %10
%128 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %126, i32 %127)
%129 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [32 x i8] c"usage: grok fn offset [cdata]+\0A\00"
@stderr = global i32 0
@O_RDWR = global i32 0
@.str.1 = [26 x i8] c"cannot open %s, errno %d\0A\00"
@errno = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [29 x i8] c"cannot seek to %x, errno %d\0A\00"
@.str.3 = [38 x i8] c"cannot read %d bytes at %x, errno %d\0A\00"
@.str.4 = [21 x i8] c"read %d of %d bytes\0A\00"
@.str.5 = [39 x i8] c"cannot write %d bytes at %x, errno %d\0A\00"
@.str.6 = [22 x i8] c"wrote %d of %d bytes\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i8* @strtol(i8* nocapture %12, i32* null, i32 16)
%14 = ptrtoint i8* %13 to i64
%15 = trunc i64 %14 to i32
%16 = add nsw i32 %0, -2
%17 = tail call i64 @calloc(i32 %16, i32 1)
%18 = inttoptr i64 %17 to i8*
%19 = icmp eq i32 %0, 3
br i1 %19, label %35, label %20
20: ; preds = %8
%21 = add nsw i32 %0, -3
%22 = zext i32 %21 to i64
br label %23
23: ; preds = %20, %23
%24 = phi i64 [ 0, %20 ], [ %31, %23 ]
%25 = phi i64 [ 3, %20 ], [ %33, %23 ]
%26 = getelementptr inbounds i8*, i8** %1, i64 %25
%27 = load i8*, i8** %26
%28 = tail call i8* @strtol(i8* nocapture %27, i32* null, i32 16)
%29 = ptrtoint i8* %28 to i64
%30 = trunc i64 %29 to i8
%31 = add nuw nsw i64 %24, 1
%32 = getelementptr inbounds i8, i8* %18, i64 %24
store i8 %30, i8* %32
%33 = add nuw nsw i64 %25, 1
%34 = icmp eq i64 %31, %22
br i1 %34, label %35, label %23
35: ; preds = %23, %8
%36 = phi i32 [ 0, %8 ], [ %21, %23 ]
%37 = load i32, i32* @O_RDWR
%38 = tail call i32 @open(i8* %10, i32 %37)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i32, i32* @stderr
%42 = load i32, i32* @errno
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32 %42)
%44 = tail call i32 @exit(i32 2)
unreachable
45: ; preds = %35
%46 = load i32, i32* @SEEK_SET
%47 = tail call i64 @lseek(i32 %38, i32 %15, i32 %46)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %45
%50 = load i32, i32* @stderr
%51 = load i32, i32* @errno
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %51)
%53 = tail call i32 @exit(i32 2)
unreachable
54: ; preds = %45
%55 = tail call i64 @calloc(i32 %36, i32 1)
%56 = inttoptr i64 %55 to i8*
%57 = tail call i32 @read(i32 %38, i8* %56, i32 %36)
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %64
59: ; preds = %54
%60 = load i32, i32* @stderr
%61 = load i32, i32* @errno
%62 = tail call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %36, i32 %15, i32 %61)
%63 = tail call i32 @exit(i32 3)
unreachable
64: ; preds = %54
%65 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %57, i32 %36)
%66 = load i32, i32* @SEEK_SET
%67 = tail call i64 @lseek(i32 %38, i32 %15, i32 %66)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %74
69: ; preds = %64
%70 = load i32, i32* @stderr
%71 = load i32, i32* @errno
%72 = tail call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %71)
%73 = tail call i32 @exit(i32 2)
unreachable
74: ; preds = %64
%75 = tail call i32 @write(i32 %38, i8* %18, i32 %57)
%76 = icmp slt i32 %75, 0
br i1 %76, label %77, label %82
77: ; preds = %74
%78 = load i32, i32* @stderr
%79 = load i32, i32* @errno
%80 = tail call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %57, i32 %15, i32 %79)
%81 = tail call i32 @exit(i32 4)
unreachable
82: ; preds = %74
%83 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %75, i32 %57)
%84 = tail call i32 @exit(i32 0)
unreachable
}