#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 /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(void *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(void *, int, int, int /*<<< orphan*/ *);
int fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
void *malloc(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
scalar_t__ strcmp(void *, char *);
int /*<<< orphan*/ strcpy(void *, char *);
int write(int, void *, int);
int main(int argc, char **argv) {
  int size;
  int start_offset;
  int offset;
  int status;
  FILE *input;
  int disk;
  if (argc < 3) {
    printf("copy2disk <offset> <file>\n");
    exit(-1);
  }
  offset = atoi(argv[1]);
  if (offset < 0) {
    printf("copy2disk <offset> <file>\n");
    exit(-1);
  }
  input = fopen(argv[2], "r");
  if (input == NULL) {
    printf("Unable to open %s\n", argv[2]);
    exit(-2);
  }
  disk = open("stackl.disk", O_RDWR);
  if (disk < 0) {
    printf("Unable to open disk\n");
    exit(-2);
  }
  size = fseek(input, 0, SEEK_END);
  if (size != 0) {
    printf("File IO failure\n");
    exit(-3);
  }
  size = ftell(input);
  void *buff = malloc(size);
  if (buff == NULL) {
    printf("Buffer allocation failed\n");
    exit(-3);
  }
  rewind(input);
  strcpy(buff, "");
  while ((strcmp(buff, "begindata\n") != 0) &&
         (fgets(buff, size, input) != NULL)) {
  }
  start_offset = ftell(input);
  size -= start_offset;
  status = fread(buff, size, 1, input);
  if (status != 1) {
    printf("File read failed\n");
    exit(-5);
  }
  lseek(disk, offset, SEEK_SET);
  status = write(disk, buff, size);
  if (status != size) {
    printf("File write failed\n");
    exit(-5);
  }
  printf("Write %d bytes starting at offset %d\n", size, offset);
  fclose(input);
  close(disk);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1248 <main+0x38>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    127a <main+0x6a>
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd92(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12bd <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xfffffffe,%edi
call   1130 <exit@plt>
mov    0x2d24(%rip),%rax
mov    (%rax),%esi
lea    0xd63(%rip),%rdi
call   1100 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    12f7 <main+0xe7>
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xfffffffe,%edi
call   1130 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    0x2cde(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10f0 <fseek@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1330 <main+0x120>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xfffffffd,%edi
call   1130 <exit@plt>
mov    -0x28(%rbp),%rdi
call   10d0 <ftell@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   10e0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    136b <main+0x15b>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xfffffffd,%edi
call   1130 <exit@plt>
mov    -0x28(%rbp),%rdi
call   1080 <rewind@plt>
mov    -0x38(%rbp),%rdi
lea    0xc9b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x38(%rbp),%rdi
lea    0xced(%rip),%rsi
call   10c0 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x39(%rbp)
je     13c0 <main+0x1b0>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   10b0 <fgets@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    13d0 <main+0x1c0>
jmp    13d5 <main+0x1c5>
jmp    1384 <main+0x174>
mov    -0x28(%rbp),%rdi
call   10d0 <ftell@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
je     1426 <main+0x216>
lea    0xc72(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xfffffffb,%edi
call   1130 <exit@plt>
mov    -0x2c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    0x2b9d(%rip),%rax
mov    (%rax),%edx
call   1090 <lseek@plt>
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <write@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1470 <main+0x260>
lea    0xc3a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xfffffffb,%edi
call   1130 <exit@plt>
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xc2f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jle    1384 <main+0x164>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1130 <atoi@plt>
test   %eax,%eax
js     1384 <main+0x164>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
lea    0xdaa(%rip),%rsi
call   1120 <fopen@plt>
test   %rax,%rax
je     139a <main+0x17a>
mov    %rax,%r12
mov    0x2d7a(%rip),%rax
mov    (%rax),%esi
lea    0xd9e(%rip),%rdi
call   1110 <open@plt>
test   %eax,%eax
js     13b6 <main+0x196>
mov    %eax,%r15d
mov    0x2d52(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1100 <fseek@plt>
test   %eax,%eax
jne    13cc <main+0x1ac>
mov    %r12,%rdi
call   10e0 <ftell@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   10f0 <malloc@plt>
test   %rax,%rax
je     13d5 <main+0x1b5>
mov    %rax,%rbx
mov    %r12,%rdi
call   1090 <rewind@plt>
lea    0xd5d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xd44(%rip),%r13
nopl   (%rax)
mov    %rbx,%rdi
mov    %r13,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1302 <main+0xe2>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r12,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
jne    12e0 <main+0xc0>
mov    %r12,%rdi
call   10e0 <ftell@plt>
sub    %eax,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    13eb <main+0x1cb>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %r14d,%esi
call   10a0 <lseek@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <write@plt>
cmp    %ebp,%eax
jne    13f4 <main+0x1d4>
lea    0xcd5(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
call   1070 <fclose@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd27(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1140 <exit@plt>
mov    0x10(%rbx),%rsi
lea    0xc5d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xfffffffe,%edi
call   1140 <exit@plt>
lea    0xce1(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfffffffe,%edi
call   1140 <exit@plt>
lea    0xcbb(%rip),%rdi
jmp    13dc <main+0x1bc>
lea    0xc99(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfffffffd,%edi
call   1140 <exit@plt>
lea    0xc72(%rip),%rdi
jmp    13fb <main+0x1db>
lea    0xc57(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfffffffb,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"copy2disk <offset> <file>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Unable to open %s\0A\00"
@.str.3 = [12 x i8] c"stackl.disk\00"
@O_RDWR = global i32 0
@.str.4 = [21 x i8] c"Unable to open disk\0A\00"
@SEEK_END = global i32 0
@.str.5 = [17 x i8] c"File IO failure\0A\00"
@.str.6 = [26 x i8] c"Buffer allocation failed\0A\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [11 x i8] c"begindata\0A\00"
@.str.9 = [18 x i8] c"File read failed\0A\00"
@SEEK_SET = global i32 0
@.str.10 = [19 x i8] c"File write failed\0A\00"
@.str.11 = [38 x i8] c"Write %d bytes starting at offset %d\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*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %18
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @exit(i32 -1)
unreachable
28: ; preds = %18
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %10
%33 = load i32*, i32** %10
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %41
35: ; preds = %28
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = call i32 @exit(i32 -2)
unreachable
41: ; preds = %28
%42 = load i32, i32* @O_RDWR
%43 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %42)
store i32 %43, i32* %11
%44 = load i32, i32* %11
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%48 = call i32 @exit(i32 -2)
unreachable
49: ; preds = %41
%50 = load i32*, i32** %10
%51 = load i32, i32* @SEEK_END
%52 = call i32 @fseek(i32* %50, i32 0, i32 %51)
store i32 %52, i32* %6
%53 = load i32, i32* %6
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @exit(i32 -3)
unreachable
58: ; preds = %49
%59 = load i32*, i32** %10
%60 = call i32 @ftell(i32* %59)
store i32 %60, i32* %6
%61 = load i32, i32* %6
%62 = call i8* @malloc(i32 %61)
store i8* %62, i8** %12
%63 = load i8*, i8** %12
%64 = icmp eq i8* %63, null
br i1 %64, label %65, label %68
65: ; preds = %58
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%67 = call i32 @exit(i32 -3)
unreachable
68: ; preds = %58
%69 = load i32*, i32** %10
%70 = call i32 @rewind(i32* %69)
%71 = load i8*, i8** %12
%72 = call i32 @strcpy(i8* %71, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0))
br label %73
73: ; preds = %85, %68
%74 = load i8*, i8** %12
%75 = call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %83
77: ; preds = %73
%78 = load i8*, i8** %12
%79 = load i32, i32* %6
%80 = load i32*, i32** %10
%81 = call i32* @fgets(i8* %78, i32 %79, i32* %80)
%82 = icmp ne i32* %81, null
br label %83
83: ; preds = %77, %73
%84 = phi i1 [ false, %73 ], [ %82, %77 ]
br i1 %84, label %85, label %86
85: ; preds = %83
br label %73
86: ; preds = %83
%87 = load i32*, i32** %10
%88 = call i32 @ftell(i32* %87)
store i32 %88, i32* %7
%89 = load i32, i32* %7
%90 = load i32, i32* %6
%91 = sub nsw i32 %90, %89
store i32 %91, i32* %6
%92 = load i8*, i8** %12
%93 = load i32, i32* %6
%94 = load i32*, i32** %10
%95 = call i32 @fread(i8* %92, i32 %93, i32 1, i32* %94)
store i32 %95, i32* %9
%96 = load i32, i32* %9
%97 = icmp ne i32 %96, 1
br i1 %97, label %98, label %101
98: ; preds = %86
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%100 = call i32 @exit(i32 -5)
unreachable
101: ; preds = %86
%102 = load i32, i32* %11
%103 = load i32, i32* %8
%104 = load i32, i32* @SEEK_SET
%105 = call i32 @lseek(i32 %102, i32 %103, i32 %104)
%106 = load i32, i32* %11
%107 = load i8*, i8** %12
%108 = load i32, i32* %6
%109 = call i32 @write(i32 %106, i8* %107, i32 %108)
store i32 %109, i32* %9
%110 = load i32, i32* %9
%111 = load i32, i32* %6
%112 = icmp ne i32 %110, %111
br i1 %112, label %113, label %116
113: ; preds = %101
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
%115 = call i32 @exit(i32 -5)
unreachable
116: ; preds = %101
%117 = load i32, i32* %6
%118 = load i32, i32* %8
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %117, i32 %118)
%120 = load i32*, i32** %10
%121 = call i32 @fclose(i32* %120)
%122 = load i32, i32* %11
%123 = call i32 @close(i32 %122)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Unable to open %s\0A\00"
@.str.3 = [12 x i8] c"stackl.disk\00"
@O_RDWR = global i32 0
@SEEK_END = global i32 0
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [11 x i8] c"begindata\0A\00"
@SEEK_SET = global i32 0
@.str.11 = [38 x i8] c"Write %d bytes starting at offset %d\0A\00"
@str = [18 x i8] c"File write failed\00"
@str.12 = [17 x i8] c"File read failed\00"
@str.13 = [25 x i8] c"Buffer allocation failed\00"
@str.14 = [16 x i8] c"File IO failure\00"
@str.15 = [20 x i8] c"Unable to open disk\00"
@str.17 = [26 x i8] c"copy2disk <offset> <file>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.17, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.17, i64 0, i64 0))
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %7
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i8*, i8** %16
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = tail call i32 @exit(i32 -2)
unreachable
24: ; preds = %15
%25 = load i32, i32* @O_RDWR
%26 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.15, i64 0, i64 0))
%30 = tail call i32 @exit(i32 -2)
unreachable
31: ; preds = %24
%32 = load i32, i32* @SEEK_END
%33 = tail call i32 @fseek(i32* %18, i32 0, i32 %32)
%34 = icmp eq i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %31
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.14, i64 0, i64 0))
%37 = tail call i32 @exit(i32 -3)
unreachable
38: ; preds = %31
%39 = tail call i32 @ftell(i32* %18)
%40 = tail call i8* @malloc(i32 %39)
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.13, i64 0, i64 0))
%44 = tail call i32 @exit(i32 -3)
unreachable
45: ; preds = %38
%46 = tail call i32 @rewind(i32* %18)
%47 = tail call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0))
br label %48
48: ; preds = %51, %45
%49 = tail call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %48
%52 = tail call i32* @fgets(i8* %40, i32 %39, i32* %18)
%53 = icmp eq i32* %52, null
br i1 %53, label %54, label %48
54: ; preds = %48, %51
%55 = tail call i32 @ftell(i32* %18)
%56 = sub nsw i32 %39, %55
%57 = tail call i32 @fread(i8* %40, i32 %56, i32 1, i32* %18)
%58 = icmp eq i32 %57, 1
br i1 %58, label %62, label %59
59: ; preds = %54
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
%61 = tail call i32 @exit(i32 -5)
unreachable
62: ; preds = %54
%63 = load i32, i32* @SEEK_SET
%64 = tail call i32 @lseek(i32 %26, i32 %10, i32 %63)
%65 = tail call i32 @write(i32 %26, i8* %40, i32 %56)
%66 = icmp eq i32 %65, %56
br i1 %66, label %70, label %67
67: ; preds = %62
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%69 = tail call i32 @exit(i32 -5)
unreachable
70: ; preds = %62
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %56, i32 %10)
%72 = tail call i32 @fclose(i32* %18)
%73 = tail call i32 @close(i32 %26)
ret i32 0
}