#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 */
struct stat {
  int st_size;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
void *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
scalar_t__ fstat(int, struct stat *);
scalar_t__ ftruncate(int, int);
char *memchr(char *, char, int);
int /*<<< orphan*/ memmove(char *, char *, int);
void *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
scalar_t__ munmap(void *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int removeline(int fd, int line) {
  if (fd < 0) {
    return EXIT_FAILURE;
  }
  struct stat stat_buf;
  if (fstat(fd, &stat_buf) < 0) {
    perror("fstat");
    return EXIT_FAILURE;
  }
  void *map =
      mmap(NULL, stat_buf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  if (map == MAP_FAILED) {
    perror("mmap");
    return EXIT_FAILURE;
  }
  char *linen = map;
  int i;
  for (i = 1; i < line; ++i) {
    linen = memchr(linen, '\n', stat_buf.st_size - (linen - (char *)map));
    if (!linen) {
      fprintf(stderr, "Line %d is past EOF.\n", line);
      return EXIT_FAILURE;
    }
    ++linen;
  }
  char *linen1 = memchr(linen, '\n', stat_buf.st_size - (linen - (char *)map));
  if (linen1) {
    ++linen1;
    memmove(linen, linen1, stat_buf.st_size - (linen1 - (char *)map));
    if (munmap(map, stat_buf.st_size) < 0) {
      perror("munmap");
      return EXIT_FAILURE;
    }
    if (ftruncate(fd, stat_buf.st_size - (linen1 - linen)) < 0) {
      perror("ftruncate");
      return EXIT_FAILURE;
    }
  } else {
    munmap(map, stat_buf.st_size);
    if (ftruncate(fd, linen - (char *)map) < 0) {
      perror("ftruncate");
      return EXIT_FAILURE;
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<removeline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11a9 <removeline+0x29>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1400 <removeline+0x280>
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   10a0 <fstat@plt>
cmp    $0x0,%rax
jge    11dc <removeline+0x5c>
lea    0xe3a(%rip),%rdi
call   1090 <perror@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1400 <removeline+0x280>
mov    -0x10(%rbp),%esi
mov    0x2e12(%rip),%rax
mov    (%rax),%edx
mov    0x2dd1(%rip),%rax
or     (%rax),%edx
mov    0x2df0(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2d97(%rip),%rcx
cmp    (%rcx),%rax
jne    123f <removeline+0xbf>
lea    0xddd(%rip),%rdi
call   1090 <perror@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1400 <removeline+0x280>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12ce <removeline+0x14e>
mov    -0x20(%rbp),%rdi
movslq -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0xa,%esi
call   1050 <memchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12b4 <removeline+0x134>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xd6d(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1400 <removeline+0x280>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    124e <removeline+0xce>
mov    -0x20(%rbp),%rdi
movslq -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0xa,%esi
call   1050 <memchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     13a7 <removeline+0x227>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1080 <memmove@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1070 <munmap@plt>
cmp    $0x0,%rax
jge    135f <removeline+0x1df>
lea    0xcd8(%rip),%rdi
call   1090 <perror@plt>
mov    0x2c73(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1400 <removeline+0x280>
mov    -0x8(%rbp),%edi
movslq -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   1040 <ftruncate@plt>
cmp    $0x0,%rax
jge    13a2 <removeline+0x222>
lea    0xc9c(%rip),%rdi
call   1090 <perror@plt>
mov    0x2c30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1400 <removeline+0x280>
jmp    13f4 <removeline+0x274>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1070 <munmap@plt>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   1040 <ftruncate@plt>
cmp    $0x0,%rax
jge    13ef <removeline+0x26f>
lea    0xc4f(%rip),%rdi
call   1090 <perror@plt>
mov    0x2be3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1400 <removeline+0x280>
jmp    13f4 <removeline+0x274>
mov    0x2bbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
js     12ea <removeline+0x16a>
mov    %esi,%r12d
mov    %edi,%ebx
mov    %rsp,%rsi
call   10a0 <fstat@plt>
test   %rax,%rax
js     12c3 <removeline+0x143>
mov    (%rsp),%r15d
mov    0x2e44(%rip),%rax
mov    0x2e05(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e22(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r15d,%esi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,%r14
mov    0x2dce(%rip),%rax
cmp    (%rax),%r14
je     12cc <removeline+0x14c>
mov    %r14,%rbp
cmp    $0x2,%r12d
jl     1230 <removeline+0xb0>
mov    %ebx,%r13d
mov    $0x1,%ebx
mov    %r14,%rbp
nop
mov    %r14d,%edx
sub    %ebp,%edx
add    %r15d,%edx
mov    %rbp,%rdi
mov    $0xa,%esi
call   1050 <memchr@plt>
test   %rax,%rax
je     12a9 <removeline+0x129>
mov    %rax,%rbp
add    $0x1,%rbp
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    1200 <removeline+0x80>
mov    %r13d,%ebx
mov    %ebp,%r13d
sub    %r14d,%r13d
mov    %r15d,%edx
sub    %r13d,%edx
mov    %rbp,%rdi
mov    $0xa,%esi
call   1050 <memchr@plt>
test   %rax,%rax
je     1286 <removeline+0x106>
mov    %rax,%r12
add    $0x1,%r12
mov    %r14d,%edx
sub    %r12d,%edx
add    %r15d,%edx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <memmove@plt>
mov    %r14,%rdi
mov    %r15d,%esi
call   1070 <munmap@plt>
test   %rax,%rax
js     12de <removeline+0x15e>
sub    %r12d,%ebp
add    %ebp,%r15d
mov    %ebx,%edi
mov    %r15d,%esi
jmp    1296 <removeline+0x116>
mov    %r14,%rdi
mov    %r15d,%esi
call   1070 <munmap@plt>
mov    %ebx,%edi
mov    %r13d,%esi
call   1040 <ftruncate@plt>
test   %rax,%rax
js     12d5 <removeline+0x155>
mov    0x2d11(%rip),%rax
jmp    12f1 <removeline+0x171>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
lea    0xd52(%rip),%rsi
mov    %r12d,%edx
call   1060 <fprintf@plt>
jmp    12ea <removeline+0x16a>
lea    0xd36(%rip),%rdi
jmp    12e5 <removeline+0x165>
lea    0xd33(%rip),%rdi
jmp    12e5 <removeline+0x165>
lea    0xd4c(%rip),%rdi
jmp    12e5 <removeline+0x165>
lea    0xd3c(%rip),%rdi
call   1090 <perror@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
@.str = [6 x i8] c"fstat\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.1 = [5 x i8] c"mmap\00"
@stderr = global i32 0
@.str.2 = [22 x i8] c"Line %d is past EOF.\0A\00"
@.str.3 = [7 x i8] c"munmap\00"
@.str.4 = [10 x i8] c"ftruncate\00"
@EXIT_SUCCESS = global i32 0
define i32 @removeline(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.stat
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* @EXIT_FAILURE
store i32 %14, i32* %3
br label %146
15: ; preds = %2
%16 = load i32, i32* %4
%17 = call i64 @fstat(i32 %16, %struct.stat* %6)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
store i32 %21, i32* %3
br label %146
22: ; preds = %15
%23 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%24 = load i32, i32* %23
%25 = load i32, i32* @PROT_READ
%26 = load i32, i32* @PROT_WRITE
%27 = or i32 %25, %26
%28 = load i32, i32* @MAP_SHARED
%29 = load i32, i32* %4
%30 = call i8* @mmap(i32* null, i32 %24, i32 %27, i32 %28, i32 %29, i32 0)
store i8* %30, i8** %7
%31 = load i8*, i8** %7
%32 = load i8*, i8** @MAP_FAILED
%33 = icmp eq i8* %31, %32
br i1 %33, label %34, label %37
34: ; preds = %22
%35 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* @EXIT_FAILURE
store i32 %36, i32* %3
br label %146
37: ; preds = %22
%38 = load i8*, i8** %7
store i8* %38, i8** %8
store i32 1, i32* %9
br label %39
39: ; preds = %66, %37
%40 = load i32, i32* %9
%41 = load i32, i32* %5
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %69
43: ; preds = %39
%44 = load i8*, i8** %8
%45 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%46 = load i32, i32* %45
%47 = sext i32 %46 to i64
%48 = load i8*, i8** %8
%49 = load i8*, i8** %7
%50 = ptrtoint i8* %48 to i64
%51 = ptrtoint i8* %49 to i64
%52 = sub i64 %50, %51
%53 = sub nsw i64 %47, %52
%54 = trunc i64 %53 to i32
%55 = call i8* @memchr(i8* %44, i8 signext 10, i32 %54)
store i8* %55, i8** %8
%56 = load i8*, i8** %8
%57 = icmp ne i8* %56, null
br i1 %57, label %63, label %58
58: ; preds = %43
%59 = load i32, i32* @stderr
%60 = load i32, i32* %5
%61 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %60)
%62 = load i32, i32* @EXIT_FAILURE
store i32 %62, i32* %3
br label %146
63: ; preds = %43
%64 = load i8*, i8** %8
%65 = getelementptr inbounds i8, i8* %64, i32 1
store i8* %65, i8** %8
br label %66
66: ; preds = %63
%67 = load i32, i32* %9
%68 = add nsw i32 %67, 1
store i32 %68, i32* %9
br label %39
69: ; preds = %39
%70 = load i8*, i8** %8
%71 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%72 = load i32, i32* %71
%73 = sext i32 %72 to i64
%74 = load i8*, i8** %8
%75 = load i8*, i8** %7
%76 = ptrtoint i8* %74 to i64
%77 = ptrtoint i8* %75 to i64
%78 = sub i64 %76, %77
%79 = sub nsw i64 %73, %78
%80 = trunc i64 %79 to i32
%81 = call i8* @memchr(i8* %70, i8 signext 10, i32 %80)
store i8* %81, i8** %10
%82 = load i8*, i8** %10
%83 = icmp ne i8* %82, null
br i1 %83, label %84, label %126
84: ; preds = %69
%85 = load i8*, i8** %10
%86 = getelementptr inbounds i8, i8* %85, i32 1
store i8* %86, i8** %10
%87 = load i8*, i8** %8
%88 = load i8*, i8** %10
%89 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%90 = load i32, i32* %89
%91 = sext i32 %90 to i64
%92 = load i8*, i8** %10
%93 = load i8*, i8** %7
%94 = ptrtoint i8* %92 to i64
%95 = ptrtoint i8* %93 to i64
%96 = sub i64 %94, %95
%97 = sub nsw i64 %91, %96
%98 = trunc i64 %97 to i32
%99 = call i32 @memmove(i8* %87, i8* %88, i32 %98)
%100 = load i8*, i8** %7
%101 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%102 = load i32, i32* %101
%103 = call i64 @munmap(i8* %100, i32 %102)
%104 = icmp slt i64 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %84
%106 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%107 = load i32, i32* @EXIT_FAILURE
store i32 %107, i32* %3
br label %146
108: ; preds = %84
%109 = load i32, i32* %4
%110 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%111 = load i32, i32* %110
%112 = sext i32 %111 to i64
%113 = load i8*, i8** %10
%114 = load i8*, i8** %8
%115 = ptrtoint i8* %113 to i64
%116 = ptrtoint i8* %114 to i64
%117 = sub i64 %115, %116
%118 = sub nsw i64 %112, %117
%119 = trunc i64 %118 to i32
%120 = call i64 @ftruncate(i32 %109, i32 %119)
%121 = icmp slt i64 %120, 0
br i1 %121, label %122, label %125
122: ; preds = %108
%123 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%124 = load i32, i32* @EXIT_FAILURE
store i32 %124, i32* %3
br label %146
125: ; preds = %108
br label %144
126: ; preds = %69
%127 = load i8*, i8** %7
%128 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%129 = load i32, i32* %128
%130 = call i64 @munmap(i8* %127, i32 %129)
%131 = load i32, i32* %4
%132 = load i8*, i8** %8
%133 = load i8*, i8** %7
%134 = ptrtoint i8* %132 to i64
%135 = ptrtoint i8* %133 to i64
%136 = sub i64 %134, %135
%137 = trunc i64 %136 to i32
%138 = call i64 @ftruncate(i32 %131, i32 %137)
%139 = icmp slt i64 %138, 0
br i1 %139, label %140, label %143
140: ; preds = %126
%141 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%142 = load i32, i32* @EXIT_FAILURE
store i32 %142, i32* %3
br label %146
143: ; preds = %126
br label %144
144: ; preds = %143, %125
%145 = load i32, i32* @EXIT_SUCCESS
store i32 %145, i32* %3
br label %146
146: ; preds = %144, %140, %122, %105, %58, %34, %19, %13
%147 = load i32, i32* %3
ret i32 %147
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
@.str = [6 x i8] c"fstat\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.1 = [5 x i8] c"mmap\00"
@stderr = global i32 0
@.str.2 = [22 x i8] c"Line %d is past EOF.\0A\00"
@.str.3 = [7 x i8] c"munmap\00"
@.str.4 = [10 x i8] c"ftruncate\00"
@EXIT_SUCCESS = global i32 0
define i32 @removeline(i32 %0, i32 %1) {
%3 = alloca %struct.stat
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = load i32, i32* @EXIT_FAILURE
br label %82
7: ; preds = %2
%8 = bitcast %struct.stat* %3 to i8*
%9 = call i64 @fstat(i32 %0, %struct.stat* %3)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %79
13: ; preds = %7
%14 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%15 = load i32, i32* %14
%16 = load i32, i32* @PROT_READ
%17 = load i32, i32* @PROT_WRITE
%18 = or i32 %17, %16
%19 = load i32, i32* @MAP_SHARED
%20 = tail call i8* @mmap(i32* null, i32 %15, i32 %18, i32 %19, i32 %0, i32 0)
%21 = load i8*, i8** @MAP_FAILED
%22 = icmp eq i8* %20, %21
br i1 %22, label %26, label %23
23: ; preds = %13
%24 = icmp sgt i32 %1, 1
%25 = ptrtoint i8* %20 to i64
br i1 %24, label %28, label %46
26: ; preds = %13
%27 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %79
28: ; preds = %23, %40
%29 = phi i32 [ %42, %40 ], [ 1, %23 ]
%30 = phi i8* [ %41, %40 ], [ %20, %23 ]
%31 = ptrtoint i8* %30 to i64
%32 = sub i64 %25, %31
%33 = trunc i64 %32 to i32
%34 = add i32 %15, %33
%35 = tail call i8* @memchr(i8* %30, i8 signext 10, i32 %34)
%36 = icmp eq i8* %35, null
br i1 %36, label %37, label %40
37: ; preds = %28
%38 = load i32, i32* @stderr
%39 = tail call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %79
40: ; preds = %28
%41 = getelementptr inbounds i8, i8* %35, i64 1
%42 = add nuw nsw i32 %29, 1
%43 = icmp eq i32 %42, %1
br i1 %43, label %44, label %28
44: ; preds = %40
%45 = ptrtoint i8* %41 to i64
br label %46
46: ; preds = %23, %44
%47 = phi i64 [ %45, %44 ], [ %25, %23 ]
%48 = phi i8* [ %41, %44 ], [ %20, %23 ]
%49 = sub i64 %47, %25
%50 = trunc i64 %49 to i32
%51 = sub i32 %15, %50
%52 = tail call i8* @memchr(i8* %48, i8 signext 10, i32 %51)
%53 = icmp eq i8* %52, null
br i1 %53, label %73, label %54
54: ; preds = %46
%55 = getelementptr inbounds i8, i8* %52, i64 1
%56 = ptrtoint i8* %55 to i64
%57 = sub i64 %25, %56
%58 = trunc i64 %57 to i32
%59 = add i32 %15, %58
%60 = tail call i32 @memmove(i8* %48, i8* %55, i32 %59)
%61 = tail call i64 @munmap(i8* %20, i32 %15)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %54
%64 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %79
65: ; preds = %54
%66 = sub i64 %47, %56
%67 = trunc i64 %66 to i32
%68 = add i32 %15, %67
%69 = tail call i64 @ftruncate(i32 %0, i32 %68)
%70 = icmp slt i64 %69, 0
br i1 %70, label %71, label %79
71: ; preds = %65
%72 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %79
73: ; preds = %46
%74 = tail call i64 @munmap(i8* %20, i32 %15)
%75 = tail call i64 @ftruncate(i32 %0, i32 %50)
%76 = icmp slt i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %79
79: ; preds = %26, %63, %71, %77, %73, %65, %37, %11
%80 = phi i32* [ @EXIT_FAILURE, %11 ], [ @EXIT_FAILURE, %26 ], [ @EXIT_FAILURE, %37 ], [ @EXIT_FAILURE, %63 ], [ @EXIT_FAILURE, %71 ], [ @EXIT_FAILURE, %77 ], [ @EXIT_SUCCESS, %73 ], [ @EXIT_SUCCESS, %65 ]
%81 = load i32, i32* %80
br label %82
82: ; preds = %79, %5
%83 = phi i32 [ %6, %5 ], [ %81, %79 ]
ret i32 %83
}