#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 long off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t const, ...);
int fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
size_t my_fread(void *, int, size_t const, int /*<<< orphan*/ *);
size_t my_fwrite(void *, int, size_t const, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int file_copy_bytes(FILE *inp, FILE *out, off_t in_offset, off_t out_offset,
                    const size_t bytes, void *userbuf, const size_t bufsize) {
  long this_offset = ftell(inp);
  if (this_offset < 0) {
    fprintf(stderr,
            "Error: Could not get file pointer position. Attempting to check "
            "if input file pointer is at %lld bytes\n",
            (long long)in_offset);
    perror(NULL);
    return this_offset;
  }
  if (this_offset != in_offset) {
    int status = fseek(inp, in_offset, SEEK_SET);
    fprintf(stderr, "Error:Could not seek to position = %lld in input file\n",
            (long long)in_offset);
    perror(NULL);
    return status;
  }
  this_offset = ftell(out);
  if (this_offset < 0) {
    fprintf(stderr,
            "Error: Could not get file pointer position. Attempting to check "
            "if output file pointer is at %lld bytes\n",
            (long long)out_offset);
    perror(NULL);
    return this_offset;
  }
  if (this_offset != out_offset) {
    int status = fseek(out, out_offset, SEEK_SET);
    fprintf(stderr, "Error:Could not seek to position = %lld in output file\n",
            (long long)out_offset);
    perror(NULL);
    return status;
  }
  size_t bytes_left = bytes;
  size_t total_bytes_read = 0, total_bytes_written = 0;
  while (bytes_left > 0) {
    const size_t bytes_to_read = bufsize > bytes_left ? bytes_left : bufsize;
    size_t nread = my_fread(userbuf, 1, bytes_to_read, inp);
    if (nread != bytes_to_read) {
      fprintf(stderr,
              "Error: During read of %zu bytes, encountered while reading "
              "bytes [%zu -- %zu].\n",
              bytes, total_bytes_read, total_bytes_read + bytes_to_read);
      perror(NULL);
      return EXIT_FAILURE;
    }
    total_bytes_read += (size_t)bytes_to_read;
    size_t nwritten = my_fwrite(userbuf, 1, bytes_to_read, out);
    if (nwritten != bytes_to_read) {
      fprintf(stderr,
              "Error: During write of %zu bytes, encountered while writing "
              "bytes [%zu -- %zu].\n",
              bytes, total_bytes_read, total_bytes_read + bytes_to_read);
      perror(NULL);
      return EXIT_FAILURE;
    }
    total_bytes_written += (size_t)bytes_to_read;
    bytes_left -= (size_t)bytes_to_read;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<file_copy_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <ftell@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    11cf <file_copy_bytes+0x6f>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <perror@plt>
mov    -0x40(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    141b <file_copy_bytes+0x2bb>
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1225 <file_copy_bytes+0xc5>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x2dec(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    %eax,-0x44(%rbp)
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <perror@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    141b <file_copy_bytes+0x2bb>
mov    -0x18(%rbp),%rdi
call   1060 <ftell@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    126d <file_copy_bytes+0x10d>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <perror@plt>
mov    -0x40(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    141b <file_copy_bytes+0x2bb>
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     12c3 <file_copy_bytes+0x163>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x2d4e(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    %eax,-0x48(%rbp)
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <perror@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    141b <file_copy_bytes+0x2bb>
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
cmpq   $0x0,-0x50(%rbp)
jbe    140f <file_copy_bytes+0x2af>
mov    0x10(%rbp),%rax
cmp    -0x50(%rbp),%rax
jbe    1301 <file_copy_bytes+0x1a1>
mov    -0x50(%rbp),%rax
mov    %rax,-0x80(%rbp)
jmp    1309 <file_copy_bytes+0x1a9>
mov    0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x68(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <my_fread@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
cmp    -0x68(%rbp),%rax
je     137a <file_copy_bytes+0x21a>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x58(%rbp),%r8
add    -0x68(%rbp),%r8
lea    0xde7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <perror@plt>
mov    0x2c60(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    141b <file_copy_bytes+0x2bb>
mov    -0x68(%rbp),%rax
add    -0x58(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x68(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1050 <my_fwrite@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
cmp    -0x68(%rbp),%rax
je     13ef <file_copy_bytes+0x28f>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x58(%rbp),%r8
add    -0x68(%rbp),%r8
lea    0xdc2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <perror@plt>
mov    0x2beb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    141b <file_copy_bytes+0x2bb>
mov    -0x68(%rbp),%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x68(%rbp),%rcx
mov    -0x50(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x50(%rbp)
jmp    12db <file_copy_bytes+0x17b>
mov    0x2bb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_copy_bytes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r13
mov    %r8,%rbp
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,0x10(%rsp)
mov    %rdi,%r12
call   1060 <ftell@plt>
mov    %rax,%rbx
test   %rax,%rax
js     1246 <file_copy_bytes+0xe6>
cmp    %r14,%rbx
jne    125b <file_copy_bytes+0xfb>
mov    0x10(%rsp),%rdi
call   1060 <ftell@plt>
mov    %rax,%rbx
test   %rax,%rax
js     1286 <file_copy_bytes+0x126>
cmp    %r15,%rbx
jne    12a9 <file_copy_bytes+0x149>
mov    %rbp,0x8(%rsp)
test   %rbp,%rbp
je     122c <file_copy_bytes+0xcc>
mov    0x50(%rsp),%r14
xor    %ebx,%ebx
mov    0x8(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %r14,%r15
mov    %r14,%rbp
cmovb  %r15,%rbp
mov    %r13,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %r12,%rcx
call   1030 <my_fread@plt>
cmp    %rbp,%rax
jne    12e9 <file_copy_bytes+0x189>
add    %rbp,%rbx
mov    %r13,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    0x10(%rsp),%rcx
call   1050 <my_fwrite@plt>
cmp    %rbp,%rax
jne    12fe <file_copy_bytes+0x19e>
sub    %rbp,%r15
jne    11e0 <file_copy_bytes+0x80>
mov    0x2d95(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    0xdaa(%rip),%rsi
mov    %r14,%rdx
jmp    1299 <file_copy_bytes+0x139>
mov    0x2d76(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <fseek@plt>
mov    %eax,%ebx
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
lea    0xde7(%rip),%rsi
mov    %r14,%rdx
jmp    12d4 <file_copy_bytes+0x174>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
lea    0xe09(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1080 <perror@plt>
jmp    1235 <file_copy_bytes+0xd5>
mov    0x2d28(%rip),%rax
mov    (%rax),%edx
mov    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1070 <fseek@plt>
mov    %eax,%ebx
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1080 <perror@plt>
mov    %ebx,%eax
jmp    1237 <file_copy_bytes+0xd7>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
add    %rbx,%rbp
lea    0xe44(%rip),%rsi
jmp    1311 <file_copy_bytes+0x1b1>
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
add    %rbx,%rbp
lea    0xe7f(%rip),%rsi
mov    0x8(%rsp),%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1080 <perror@plt>
mov    0x2c9f(%rip),%rax
jmp    1233 <file_copy_bytes+0xd3>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [104 x i8] c"Error: Could not get file pointer position. Attempting to check if input file pointer is at %lld bytes\0A\00"
@SEEK_SET = global i32 0
@.str.1 = [55 x i8] c"Error:Could not seek to position = %lld in input file\0A\00"
@.str.2 = [105 x i8] c"Error: Could not get file pointer position. Attempting to check if output file pointer is at %lld bytes\0A\00"
@.str.3 = [56 x i8] c"Error:Could not seek to position = %lld in output file\0A\00"
@.str.4 = [80 x i8] c"Error: During read of %zu bytes, encountered while reading bytes [%zu -- %zu].\0A\00"
@EXIT_FAILURE = global i32 0
@.str.5 = [81 x i8] c"Error: During write of %zu bytes, encountered while writing bytes [%zu -- %zu].\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @file_copy_bytes(i32* %0, i32* %1, i64 %2, i64 %3, i64 %4, i8* %5, i64 %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i64
store i32* %0, i32** %9
store i32* %1, i32** %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i8* %5, i8** %14
store i64 %6, i64* %15
%25 = load i32*, i32** %9
%26 = call i64 @ftell(i32* %25)
store i64 %26, i64* %16
%27 = load i64, i64* %16
%28 = icmp slt i64 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %7
%30 = load i32, i32* @stderr
%31 = load i64, i64* %11
%32 = call i32 (i32, i8*, i64, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i64 %31)
%33 = call i32 @perror(i32* null)
%34 = load i64, i64* %16
%35 = trunc i64 %34 to i32
store i32 %35, i32* %8
br label %138
36: ; preds = %7
%37 = load i64, i64* %16
%38 = load i64, i64* %11
%39 = icmp ne i64 %37, %38
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = load i32*, i32** %9
%42 = load i64, i64* %11
%43 = load i32, i32* @SEEK_SET
%44 = call i32 @fseek(i32* %41, i64 %42, i32 %43)
store i32 %44, i32* %17
%45 = load i32, i32* @stderr
%46 = load i64, i64* %11
%47 = call i32 (i32, i8*, i64, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i64 %46)
%48 = call i32 @perror(i32* null)
%49 = load i32, i32* %17
store i32 %49, i32* %8
br label %138
50: ; preds = %36
%51 = load i32*, i32** %10
%52 = call i64 @ftell(i32* %51)
store i64 %52, i64* %16
%53 = load i64, i64* %16
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %62
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = load i64, i64* %12
%58 = call i32 (i32, i8*, i64, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.2, i64 0, i64 0), i64 %57)
%59 = call i32 @perror(i32* null)
%60 = load i64, i64* %16
%61 = trunc i64 %60 to i32
store i32 %61, i32* %8
br label %138
62: ; preds = %50
%63 = load i64, i64* %16
%64 = load i64, i64* %12
%65 = icmp ne i64 %63, %64
br i1 %65, label %66, label %76
66: ; preds = %62
%67 = load i32*, i32** %10
%68 = load i64, i64* %12
%69 = load i32, i32* @SEEK_SET
%70 = call i32 @fseek(i32* %67, i64 %68, i32 %69)
store i32 %70, i32* %18
%71 = load i32, i32* @stderr
%72 = load i64, i64* %12
%73 = call i32 (i32, i8*, i64, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i64 %72)
%74 = call i32 @perror(i32* null)
%75 = load i32, i32* %18
store i32 %75, i32* %8
br label %138
76: ; preds = %62
%77 = load i64, i64* %13
store i64 %77, i64* %19
store i64 0, i64* %20
store i64 0, i64* %21
br label %78
78: ; preds = %129, %76
%79 = load i64, i64* %19
%80 = icmp ugt i64 %79, 0
br i1 %80, label %81, label %136
81: ; preds = %78
%82 = load i64, i64* %15
%83 = load i64, i64* %19
%84 = icmp ugt i64 %82, %83
br i1 %84, label %85, label %87
85: ; preds = %81
%86 = load i64, i64* %19
br label %89
87: ; preds = %81
%88 = load i64, i64* %15
br label %89
89: ; preds = %87, %85
%90 = phi i64 [ %86, %85 ], [ %88, %87 ]
store i64 %90, i64* %22
%91 = load i8*, i8** %14
%92 = load i64, i64* %22
%93 = load i32*, i32** %9
%94 = call i64 @my_fread(i8* %91, i32 1, i64 %92, i32* %93)
store i64 %94, i64* %23
%95 = load i64, i64* %23
%96 = load i64, i64* %22
%97 = icmp ne i64 %95, %96
br i1 %97, label %98, label %108
98: ; preds = %89
%99 = load i32, i32* @stderr
%100 = load i64, i64* %13
%101 = load i64, i64* %20
%102 = load i64, i64* %20
%103 = load i64, i64* %22
%104 = add i64 %102, %103
%105 = call i32 (i32, i8*, i64, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.4, i64 0, i64 0), i64 %100, i64 %101, i64 %104)
%106 = call i32 @perror(i32* null)
%107 = load i32, i32* @EXIT_FAILURE
store i32 %107, i32* %8
br label %138
108: ; preds = %89
%109 = load i64, i64* %22
%110 = load i64, i64* %20
%111 = add i64 %110, %109
store i64 %111, i64* %20
%112 = load i8*, i8** %14
%113 = load i64, i64* %22
%114 = load i32*, i32** %10
%115 = call i64 @my_fwrite(i8* %112, i32 1, i64 %113, i32* %114)
store i64 %115, i64* %24
%116 = load i64, i64* %24
%117 = load i64, i64* %22
%118 = icmp ne i64 %116, %117
br i1 %118, label %119, label %129
119: ; preds = %108
%120 = load i32, i32* @stderr
%121 = load i64, i64* %13
%122 = load i64, i64* %20
%123 = load i64, i64* %20
%124 = load i64, i64* %22
%125 = add i64 %123, %124
%126 = call i32 (i32, i8*, i64, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.5, i64 0, i64 0), i64 %121, i64 %122, i64 %125)
%127 = call i32 @perror(i32* null)
%128 = load i32, i32* @EXIT_FAILURE
store i32 %128, i32* %8
br label %138
129: ; preds = %108
%130 = load i64, i64* %22
%131 = load i64, i64* %21
%132 = add i64 %131, %130
store i64 %132, i64* %21
%133 = load i64, i64* %22
%134 = load i64, i64* %19
%135 = sub i64 %134, %133
store i64 %135, i64* %19
br label %78
136: ; preds = %78
%137 = load i32, i32* @EXIT_SUCCESS
store i32 %137, i32* %8
br label %138
138: ; preds = %136, %119, %98, %66, %55, %40, %29
%139 = load i32, i32* %8
ret i32 %139
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [104 x i8] c"Error: Could not get file pointer position. Attempting to check if input file pointer is at %lld bytes\0A\00"
@SEEK_SET = global i32 0
@.str.1 = [55 x i8] c"Error:Could not seek to position = %lld in input file\0A\00"
@.str.2 = [105 x i8] c"Error: Could not get file pointer position. Attempting to check if output file pointer is at %lld bytes\0A\00"
@.str.3 = [56 x i8] c"Error:Could not seek to position = %lld in output file\0A\00"
@.str.4 = [80 x i8] c"Error: During read of %zu bytes, encountered while reading bytes [%zu -- %zu].\0A\00"
@EXIT_FAILURE = global i32 0
@.str.5 = [81 x i8] c"Error: During write of %zu bytes, encountered while writing bytes [%zu -- %zu].\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @file_copy_bytes(i32* %0, i32* %1, i64 %2, i64 %3, i64 %4, i8* %5, i64 %6) {
%8 = tail call i64 @ftell(i32* %0)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, i64, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i64 %2)
%13 = tail call i32 @perror(i32* null)
%14 = trunc i64 %8 to i32
br label %69
15: ; preds = %7
%16 = icmp eq i64 %8, %2
br i1 %16, label %23, label %17
17: ; preds = %15
%18 = load i32, i32* @SEEK_SET
%19 = tail call i32 @fseek(i32* %0, i64 %2, i32 %18)
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, i64, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i64 %2)
%22 = tail call i32 @perror(i32* null)
br label %69
23: ; preds = %15
%24 = tail call i64 @ftell(i32* %1)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, i64, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.2, i64 0, i64 0), i64 %3)
%29 = tail call i32 @perror(i32* null)
%30 = trunc i64 %24 to i32
br label %69
31: ; preds = %23
%32 = icmp eq i64 %24, %3
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = icmp eq i64 %4, 0
br i1 %34, label %67, label %43
35: ; preds = %31
%36 = load i32, i32* @SEEK_SET
%37 = tail call i32 @fseek(i32* %1, i64 %3, i32 %36)
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, i64, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i64 %3)
%40 = tail call i32 @perror(i32* null)
br label %69
41: ; preds = %56
%42 = icmp eq i64 %60, 0
br i1 %42, label %67, label %43
43: ; preds = %33, %41
%44 = phi i64 [ %57, %41 ], [ 0, %33 ]
%45 = phi i64 [ %60, %41 ], [ %4, %33 ]
%46 = icmp ult i64 %45, %6
%47 = select i1 %46, i64 %45, i64 %6
%48 = tail call i64 @my_fread(i8* %5, i32 1, i64 %47, i32* %0)
%49 = icmp eq i64 %48, %47
br i1 %49, label %56, label %50
50: ; preds = %43
%51 = load i32, i32* @stderr
%52 = add i64 %47, %44
%53 = tail call i32 (i32, i8*, i64, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.4, i64 0, i64 0), i64 %4, i64 %44, i64 %52)
%54 = tail call i32 @perror(i32* null)
%55 = load i32, i32* @EXIT_FAILURE
br label %69
56: ; preds = %43
%57 = add i64 %47, %44
%58 = tail call i64 @my_fwrite(i8* %5, i32 1, i64 %47, i32* %1)
%59 = icmp eq i64 %58, %47
%60 = sub i64 %45, %47
br i1 %59, label %41, label %61
61: ; preds = %56
%62 = load i32, i32* @stderr
%63 = add i64 %57, %47
%64 = tail call i32 (i32, i8*, i64, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.5, i64 0, i64 0), i64 %4, i64 %57, i64 %63)
%65 = tail call i32 @perror(i32* null)
%66 = load i32, i32* @EXIT_FAILURE
br label %69
67: ; preds = %41, %33
%68 = load i32, i32* @EXIT_SUCCESS
br label %69
69: ; preds = %61, %50, %67, %35, %26, %17, %10
%70 = phi i32 [ %14, %10 ], [ %19, %17 ], [ %30, %26 ], [ %37, %35 ], [ %68, %67 ], [ %66, %61 ], [ %55, %50 ]
ret i32 %70
}