#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 ssize_t;
typedef char *off_t;
typedef int /*<<< orphan*/ buf_to;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int lseek(int, char *, int /*<<< orphan*/);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
char *strerror(int /*<<< orphan*/);
void verify_data(int to_fd, off_t to_offset, int from_fd, off_t from_offset,
                 ssize_t size) {
  char buf_to[4096];
  char buf_from[4096];
  int ret;
  int to_read;
  int c;
  char *ptr;
  ret = lseek(to_fd, to_offset, SEEK_SET);
  if (ret < 0) {
    printf("error: "
           "failed to seek output file to %lx"
           ": %s"
           "\n",
           to_offset, strerror(errno));
    exit(-1);
  };
  ret = lseek(from_fd, from_offset, SEEK_SET);
  if (ret < 0) {
    printf("error: "
           "failed to seek input file to %lx"
           ": %s"
           "\n",
           from_offset, strerror(errno));
    exit(-1);
  };
  while (size != 0) {
    to_read = sizeof(buf_to);
    if (size > 0 && to_read > size)
      to_read = size;
    ptr = buf_to;
    c = to_read;
    while (c > 0) {
      ret = read(to_fd, ptr, c);
      if (ret < 0) {
        printf("error: "
               "failed to read from output file"
               ": %s"
               "\n",
               strerror(errno));
        exit(-1);
      };
      if (ret == 0 && size < 0)
        return;
      if (ret == 0) {
        printf("error: "
               "eof while reading output file"
               ": %s"
               "\n",
               strerror(errno));
        exit(-1);
      };
      ptr += ret;
      c -= ret;
    }
    ptr = buf_from;
    c = to_read;
    while (c > 0) {
      ret = read(from_fd, ptr, c);
      if (ret < 0) {
        printf("error: "
               "failed to read from input file"
               ": %s"
               "\n",
               strerror(errno));
        exit(-1);
      };
      if (ret == 0 && size < 0)
        return;
      if (ret == 0) {
        printf("error: "
               "eof while reading input file"
               ": %s"
               "\n",
               strerror(errno));
        exit(-1);
      };
      ptr += ret;
      c -= ret;
    }
    if (memcmp(buf_from, buf_to, to_read) != 0) {
      printf("error: "
             "mismatch while verifying written data"
             "\n");
      exit(-1);
    };
    size -= to_read;
  }
}


x86 assembly (clang, -O0):
<verify_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2060,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2e4d(%rip),%rax
mov    (%rax),%edx
call   1040 <lseek@plt>
mov    %eax,-0x2034(%rbp)
cmpl   $0x0,-0x2034(%rbp)
jge    11e0 <verify_data+0x80>
mov    -0x10(%rbp),%rax
mov    %rax,-0x2050(%rbp)
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x2050(%rbp),%rsi
mov    %rax,%rdx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    0x2dea(%rip),%rax
mov    (%rax),%edx
call   1040 <lseek@plt>
mov    %eax,-0x2034(%rbp)
cmpl   $0x0,-0x2034(%rbp)
jge    1243 <verify_data+0xe3>
mov    -0x20(%rbp),%rax
mov    %rax,-0x2058(%rbp)
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x2058(%rbp),%rsi
mov    %rax,%rdx
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
jmp    1248 <verify_data+0xe8>
cmpl   $0x0,-0x24(%rbp)
je     14c6 <verify_data+0x366>
movl   $0x1000,-0x2038(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    127e <verify_data+0x11e>
mov    -0x2038(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    127e <verify_data+0x11e>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2038(%rbp)
lea    -0x1030(%rbp),%rax
mov    %rax,-0x2048(%rbp)
mov    -0x2038(%rbp),%eax
mov    %eax,-0x203c(%rbp)
cmpl   $0x0,-0x203c(%rbp)
jle    137b <verify_data+0x21b>
mov    -0x4(%rbp),%edi
mov    -0x2048(%rbp),%rsi
mov    -0x203c(%rbp),%edx
call   1050 <read@plt>
mov    %eax,-0x2034(%rbp)
cmpl   $0x0,-0x2034(%rbp)
jge    12f6 <verify_data+0x196>
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    %rax,%rsi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
cmpl   $0x0,-0x2034(%rbp)
jne    1312 <verify_data+0x1b2>
cmpl   $0x0,-0x24(%rbp)
jge    1312 <verify_data+0x1b2>
jmp    14c6 <verify_data+0x366>
cmpl   $0x0,-0x2034(%rbp)
jne    1348 <verify_data+0x1e8>
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    %rax,%rsi
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x2034(%rbp),%ecx
mov    -0x2048(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x2048(%rbp)
mov    -0x2034(%rbp),%ecx
mov    -0x203c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x203c(%rbp)
jmp    1298 <verify_data+0x138>
lea    -0x2030(%rbp),%rax
mov    %rax,-0x2048(%rbp)
mov    -0x2038(%rbp),%eax
mov    %eax,-0x203c(%rbp)
cmpl   $0x0,-0x203c(%rbp)
jle    1478 <verify_data+0x318>
mov    -0x14(%rbp),%edi
mov    -0x2048(%rbp),%rsi
mov    -0x203c(%rbp),%edx
call   1050 <read@plt>
mov    %eax,-0x2034(%rbp)
cmpl   $0x0,-0x2034(%rbp)
jge    13f3 <verify_data+0x293>
mov    0x2c0f(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    %rax,%rsi
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
cmpl   $0x0,-0x2034(%rbp)
jne    140f <verify_data+0x2af>
cmpl   $0x0,-0x24(%rbp)
jge    140f <verify_data+0x2af>
jmp    14c6 <verify_data+0x366>
cmpl   $0x0,-0x2034(%rbp)
jne    1445 <verify_data+0x2e5>
mov    0x2bbd(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    %rax,%rsi
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x2034(%rbp),%ecx
mov    -0x2048(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x2048(%rbp)
mov    -0x2034(%rbp),%ecx
mov    -0x203c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x203c(%rbp)
jmp    1395 <verify_data+0x235>
lea    -0x2030(%rbp),%rdi
lea    -0x1030(%rbp),%rsi
mov    -0x2038(%rbp),%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     14b3 <verify_data+0x353>
lea    0xc63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x2038(%rbp),%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
jmp    1248 <verify_data+0xe8>
add    $0x2060,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2018,%rsp
mov    %r8d,%r12d
mov    %rcx,%r15
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%r13d
mov    0x2e41(%rip),%rbp
mov    0x0(%rbp),%edx
call   1050 <lseek@plt>
test   %eax,%eax
js     1307 <verify_data+0x197>
mov    0x0(%rbp),%edx
mov    %r14d,%edi
mov    %r15,%rsi
call   1050 <lseek@plt>
test   %eax,%eax
js     1321 <verify_data+0x1b1>
test   %r12d,%r12d
je     1287 <verify_data+0x117>
lea    -0x1(%r12),%eax
cmp    $0xfff,%eax
mov    $0x1000,%ebx
cmovb  %r12d,%ebx
lea    0x1010(%rsp),%r15
mov    %ebx,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13d,%edi
mov    %r15,%rsi
mov    %ebx,%edx
call   1060 <read@plt>
test   %eax,%eax
js     1299 <verify_data+0x129>
jne    120c <verify_data+0x9c>
test   %r12d,%r12d
js     1287 <verify_data+0x117>
test   %eax,%eax
je     12b0 <verify_data+0x140>
mov    %eax,%ecx
add    %rcx,%r15
sub    %eax,%ebx
jg     11f0 <verify_data+0x80>
lea    0x10(%rsp),%rbx
mov    0xc(%rsp),%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <read@plt>
test   %eax,%eax
js     12c7 <verify_data+0x157>
jne    124c <verify_data+0xdc>
test   %r12d,%r12d
js     1287 <verify_data+0x117>
test   %eax,%eax
je     12de <verify_data+0x16e>
mov    %eax,%ecx
add    %rcx,%rbx
sub    %eax,%ebp
jg     1230 <verify_data+0xc0>
lea    0x10(%rsp),%rdi
lea    0x1010(%rsp),%rsi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
jne    134d <verify_data+0x1dd>
sub    %ebx,%r12d
jne    11c6 <verify_data+0x56>
add    $0x2018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xdad(%rip),%rdi
jmp    12f3 <verify_data+0x183>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xdc2(%rip),%rdi
jmp    12f3 <verify_data+0x183>
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xdd5(%rip),%rdi
jmp    12f3 <verify_data+0x183>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xde9(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xce4(%rip),%rdi
mov    %rbx,%rsi
jmp    1339 <verify_data+0x1c9>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xcf8(%rip),%rdi
mov    %r15,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
lea    0xdb1(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [46 x i8] c"error: failed to seek output file to %lx: %s\0A\00"
@errno = global i32 0
@.str.1 = [45 x i8] c"error: failed to seek input file to %lx: %s\0A\00"
@.str.2 = [44 x i8] c"error: failed to read from output file: %s\0A\00"
@.str.3 = [42 x i8] c"error: eof while reading output file: %s\0A\00"
@.str.4 = [43 x i8] c"error: failed to read from input file: %s\0A\00"
@.str.5 = [41 x i8] c"error: eof while reading input file: %s\0A\00"
@.str.6 = [46 x i8] c"error: mismatch while verifying written data\0A\00"
define void @verify_data(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [4096 x i8]
%12 = alloca [4096 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%17 = load i32, i32* %6
%18 = load i8*, i8** %7
%19 = load i32, i32* @SEEK_SET
%20 = call i32 @lseek(i32 %17, i8* %18, i32 %19)
store i32 %20, i32* %13
%21 = load i32, i32* %13
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %5
%24 = load i8*, i8** %7
%25 = load i32, i32* @errno
%26 = call i8* @strerror(i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %26)
%28 = call i32 @exit(i32 -1)
unreachable
29: ; preds = %5
%30 = load i32, i32* %8
%31 = load i8*, i8** %9
%32 = load i32, i32* @SEEK_SET
%33 = call i32 @lseek(i32 %30, i8* %31, i32 %32)
store i32 %33, i32* %13
%34 = load i32, i32* %13
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %42
36: ; preds = %29
%37 = load i8*, i8** %9
%38 = load i32, i32* @errno
%39 = call i8* @strerror(i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %37, i8* %39)
%41 = call i32 @exit(i32 -1)
unreachable
42: ; preds = %29
br label %43
43: ; preds = %146, %42
%44 = load i32, i32* %10
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %150
46: ; preds = %43
store i32 4096, i32* %14
%47 = load i32, i32* %10
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %55
49: ; preds = %46
%50 = load i32, i32* %14
%51 = load i32, i32* %10
%52 = icmp sgt i32 %50, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = load i32, i32* %10
store i32 %54, i32* %14
br label %55
55: ; preds = %53, %49, %46
%56 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
store i8* %56, i8** %16
%57 = load i32, i32* %14
store i32 %57, i32* %15
br label %58
58: ; preds = %88, %55
%59 = load i32, i32* %15
%60 = icmp sgt i32 %59, 0
br i1 %60, label %61, label %96
61: ; preds = %58
%62 = load i32, i32* %6
%63 = load i8*, i8** %16
%64 = load i32, i32* %15
%65 = call i32 @read(i32 %62, i8* %63, i32 %64)
store i32 %65, i32* %13
%66 = load i32, i32* %13
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %61
%69 = load i32, i32* @errno
%70 = call i8* @strerror(i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %70)
%72 = call i32 @exit(i32 -1)
unreachable
73: ; preds = %61
%74 = load i32, i32* %13
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = load i32, i32* %10
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %76
br label %150
80: ; preds = %76, %73
%81 = load i32, i32* %13
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = load i32, i32* @errno
%85 = call i8* @strerror(i32 %84)
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %85)
%87 = call i32 @exit(i32 -1)
unreachable
88: ; preds = %80
%89 = load i32, i32* %13
%90 = load i8*, i8** %16
%91 = sext i32 %89 to i64
%92 = getelementptr inbounds i8, i8* %90, i64 %91
store i8* %92, i8** %16
%93 = load i32, i32* %13
%94 = load i32, i32* %15
%95 = sub nsw i32 %94, %93
store i32 %95, i32* %15
br label %58
96: ; preds = %58
%97 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
store i8* %97, i8** %16
%98 = load i32, i32* %14
store i32 %98, i32* %15
br label %99
99: ; preds = %129, %96
%100 = load i32, i32* %15
%101 = icmp sgt i32 %100, 0
br i1 %101, label %102, label %137
102: ; preds = %99
%103 = load i32, i32* %8
%104 = load i8*, i8** %16
%105 = load i32, i32* %15
%106 = call i32 @read(i32 %103, i8* %104, i32 %105)
store i32 %106, i32* %13
%107 = load i32, i32* %13
%108 = icmp slt i32 %107, 0
br i1 %108, label %109, label %114
109: ; preds = %102
%110 = load i32, i32* @errno
%111 = call i8* @strerror(i32 %110)
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %111)
%113 = call i32 @exit(i32 -1)
unreachable
114: ; preds = %102
%115 = load i32, i32* %13
%116 = icmp eq i32 %115, 0
br i1 %116, label %117, label %121
117: ; preds = %114
%118 = load i32, i32* %10
%119 = icmp slt i32 %118, 0
br i1 %119, label %120, label %121
120: ; preds = %117
br label %150
121: ; preds = %117, %114
%122 = load i32, i32* %13
%123 = icmp eq i32 %122, 0
br i1 %123, label %124, label %129
124: ; preds = %121
%125 = load i32, i32* @errno
%126 = call i8* @strerror(i32 %125)
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %126)
%128 = call i32 @exit(i32 -1)
unreachable
129: ; preds = %121
%130 = load i32, i32* %13
%131 = load i8*, i8** %16
%132 = sext i32 %130 to i64
%133 = getelementptr inbounds i8, i8* %131, i64 %132
store i8* %133, i8** %16
%134 = load i32, i32* %13
%135 = load i32, i32* %15
%136 = sub nsw i32 %135, %134
store i32 %136, i32* %15
br label %99
137: ; preds = %99
%138 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%139 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%140 = load i32, i32* %14
%141 = call i64 @memcmp(i8* %138, i8* %139, i32 %140)
%142 = icmp ne i64 %141, 0
br i1 %142, label %143, label %146
143: ; preds = %137
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%145 = call i32 @exit(i32 -1)
unreachable
146: ; preds = %137
%147 = load i32, i32* %14
%148 = load i32, i32* %10
%149 = sub nsw i32 %148, %147
store i32 %149, i32* %10
br label %43
150: ; preds = %79, %120, %43
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [46 x i8] c"error: failed to seek output file to %lx: %s\0A\00"
@errno = global i32 0
@.str.1 = [45 x i8] c"error: failed to seek input file to %lx: %s\0A\00"
@.str.2 = [44 x i8] c"error: failed to read from output file: %s\0A\00"
@.str.3 = [42 x i8] c"error: eof while reading output file: %s\0A\00"
@.str.4 = [43 x i8] c"error: failed to read from input file: %s\0A\00"
@.str.5 = [41 x i8] c"error: eof while reading input file: %s\0A\00"
@str = [45 x i8] c"error: mismatch while verifying written data\00"
define void @verify_data(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca [4096 x i8]
%7 = alloca [4096 x i8]
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%10 = load i32, i32* @SEEK_SET
%11 = tail call i32 @lseek(i32 %0, i8* %1, i32 %10)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %5
%14 = load i32, i32* @errno
%15 = tail call i8* @strerror(i32 %14)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %15)
%17 = tail call i32 @exit(i32 -1)
unreachable
18: ; preds = %5
%19 = load i32, i32* @SEEK_SET
%20 = tail call i32 @lseek(i32 %2, i8* %3, i32 %19)
%21 = icmp slt i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = icmp eq i32 %4, 0
br i1 %23, label %94, label %31
24: ; preds = %18
%25 = load i32, i32* @errno
%26 = tail call i8* @strerror(i32 %25)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %26)
%28 = tail call i32 @exit(i32 -1)
unreachable
29: ; preds = %87
%30 = icmp eq i32 %90, 0
br i1 %30, label %94, label %31
31: ; preds = %22, %29
%32 = phi i32 [ %90, %29 ], [ %4, %22 ]
%33 = add i32 %32, -1
%34 = icmp ult i32 %33, 4095
%35 = select i1 %34, i32 %32, i32 4096
%36 = icmp slt i32 %32, 0
br label %39
37: ; preds = %58
%38 = icmp slt i32 %32, 0
br label %63
39: ; preds = %31, %58
%40 = phi i8* [ %8, %31 ], [ %60, %58 ]
%41 = phi i32 [ %35, %31 ], [ %61, %58 ]
%42 = call i32 @read(i32 %0, i8* %40, i32 %41)
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %39
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* %46)
%48 = call i32 @exit(i32 -1)
unreachable
49: ; preds = %39
%50 = icmp eq i32 %42, 0
%51 = select i1 %50, i1 %36, i1 false
br i1 %51, label %94, label %52
52: ; preds = %49
br i1 %50, label %53, label %58
53: ; preds = %52
%54 = load i32, i32* @errno
%55 = call i8* @strerror(i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%57 = call i32 @exit(i32 -1)
unreachable
58: ; preds = %52
%59 = zext i32 %42 to i64
%60 = getelementptr inbounds i8, i8* %40, i64 %59
%61 = sub nsw i32 %41, %42
%62 = icmp sgt i32 %61, 0
br i1 %62, label %39, label %37
63: ; preds = %37, %82
%64 = phi i8* [ %9, %37 ], [ %84, %82 ]
%65 = phi i32 [ %35, %37 ], [ %85, %82 ]
%66 = call i32 @read(i32 %2, i8* %64, i32 %65)
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %63
%69 = load i32, i32* @errno
%70 = call i8* @strerror(i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %70)
%72 = call i32 @exit(i32 -1)
unreachable
73: ; preds = %63
%74 = icmp eq i32 %66, 0
%75 = select i1 %74, i1 %38, i1 false
br i1 %75, label %94, label %76
76: ; preds = %73
br i1 %74, label %77, label %82
77: ; preds = %76
%78 = load i32, i32* @errno
%79 = call i8* @strerror(i32 %78)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %79)
%81 = call i32 @exit(i32 -1)
unreachable
82: ; preds = %76
%83 = zext i32 %66 to i64
%84 = getelementptr inbounds i8, i8* %64, i64 %83
%85 = sub nsw i32 %65, %66
%86 = icmp sgt i32 %85, 0
br i1 %86, label %63, label %87
87: ; preds = %82
%88 = call i64 @memcmp(i8* %9, i8* %8, i32 %35)
%89 = icmp eq i64 %88, 0
%90 = sub nsw i32 %32, %35
br i1 %89, label %29, label %91
91: ; preds = %87
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%93 = call i32 @exit(i32 -1)
unreachable
94: ; preds = %29, %49, %73, %22
ret void
}