#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
char *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int PROT_READ;
int PROT_WRITE;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
int close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ ftruncate(int, int);
char *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
int open(char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int fd, i;
  char *ptr;
  if ((fd = open("mmap_test", O_RDWR | O_TRUNC | O_CREAT,
                 (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) == -1) {
    printf("open error: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if ((ptr = mmap(NULL, (32768), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) ==
      MAP_FAILED) {
    printf("mmap error: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  for (i = 0; i <= (32768); i += 4096) {
    printf("setting file size to %d\n", i);
    ftruncate(fd, i);
    printf("ptr[%d] = %d\n", i - 1, ptr[i - 1]);
  }
  if (close(fd) == -1) {
    printf("close error: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  printf("done\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%esi
mov    0x2e5a(%rip),%rax
or     (%rax),%esi
mov    0x2e59(%rip),%rax
or     (%rax),%esi
mov    0x2de0(%rip),%rax
mov    (%rax),%edx
mov    0x2e0f(%rip),%rax
or     (%rax),%edx
mov    0x2dee(%rip),%rax
or     (%rax),%edx
mov    0x2ddd(%rip),%rax
or     (%rax),%edx
lea    0xe34(%rip),%rdi
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    120a <main+0x9a>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    %rax,%rsi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edx
mov    0x2d76(%rip),%rax
or     (%rax),%edx
mov    0x2db5(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x8000,%esi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    0x2d33(%rip),%rcx
cmp    (%rcx),%rax
jne    127b <main+0x10b>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    %rax,%rsi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d24(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8000,-0x18(%rbp)
jg     12e0 <main+0x170>
mov    -0x18(%rbp),%esi
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <ftruncate@plt>
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x18(%rbp)
jmp    1282 <main+0x112>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
cmp    $0xffffffff,%eax
jne    131e <main+0x1ae>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    %rax,%rsi
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c81(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2e39(%rip),%rax
mov    0x2e5a(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e57(%rip),%rax
or     (%rax),%esi
mov    0x2dde(%rip),%rax
mov    0x2e0f(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2dec(%rip),%rax
or     (%rax),%edx
mov    0x2ddb(%rip),%rax
or     (%rax),%edx
lea    0xe32(%rip),%rdi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
jne    11f2 <main+0x72>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xe1d(%rip),%rdi
jmp    1432 <main+0x2b2>
mov    %eax,%ebx
mov    0x2ded(%rip),%rax
mov    0x2d8e(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2dcb(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    $0x8000,%esi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%r14
mov    0x2d4d(%rip),%rax
cmp    (%rax),%r14
jne    124a <main+0xca>
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xdd5(%rip),%rdi
jmp    1432 <main+0x2b2>
lea    0xdd9(%rip),%r15
mov    %r15,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1060 <ftruncate@plt>
movsbl -0x1(%r14),%edx
lea    0xdd1(%rip),%r12
mov    %r12,%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x1000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x1000,%esi
call   1060 <ftruncate@plt>
movsbl 0xfff(%r14),%edx
mov    %r12,%rdi
mov    $0xfff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x2000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x2000,%esi
call   1060 <ftruncate@plt>
movsbl 0x1fff(%r14),%edx
mov    %r12,%rdi
mov    $0x1fff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x3000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x3000,%esi
call   1060 <ftruncate@plt>
movsbl 0x2fff(%r14),%edx
mov    %r12,%rdi
mov    $0x2fff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x4000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x4000,%esi
call   1060 <ftruncate@plt>
movsbl 0x3fff(%r14),%edx
mov    %r12,%rdi
mov    $0x3fff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x5000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x5000,%esi
call   1060 <ftruncate@plt>
movsbl 0x4fff(%r14),%edx
mov    %r12,%rdi
mov    $0x4fff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x6000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x6000,%esi
call   1060 <ftruncate@plt>
movsbl 0x5fff(%r14),%edx
mov    %r12,%rdi
mov    $0x5fff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x7000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x7000,%esi
call   1060 <ftruncate@plt>
movsbl 0x6fff(%r14),%edx
mov    %r12,%rdi
mov    $0x6fff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x8000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
mov    $0x8000,%esi
call   1060 <ftruncate@plt>
movsbl 0x7fff(%r14),%edx
mov    %r12,%rdi
mov    $0x7fff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    144a <main+0x2ca>
mov    0x2b8c(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xc1f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2b55(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
lea    0xc11(%rip),%rdi
call   1030 <puts@plt>
mov    0x2b23(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"mmap_test\00"
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [16 x i8] c"open error: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [16 x i8] c"mmap error: %s\0A\00"
@.str.3 = [25 x i8] c"setting file size to %d\0A\00"
@.str.4 = [14 x i8] c"ptr[%d] = %d\0A\00"
@.str.5 = [17 x i8] c"close error: %s\0A\00"
@.str.6 = [6 x i8] c"done\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @O_RDWR
%10 = load i32, i32* @O_TRUNC
%11 = or i32 %9, %10
%12 = load i32, i32* @O_CREAT
%13 = or i32 %11, %12
%14 = load i32, i32* @S_IRUSR
%15 = load i32, i32* @S_IWUSR
%16 = or i32 %14, %15
%17 = load i32, i32* @S_IRGRP
%18 = or i32 %16, %17
%19 = load i32, i32* @S_IROTH
%20 = or i32 %18, %19
%21 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %20)
store i32 %21, i32* %6
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %29
23: ; preds = %2
%24 = load i32, i32* @errno
%25 = call i8* @strerror(i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %2
%30 = load i32, i32* @PROT_READ
%31 = load i32, i32* @PROT_WRITE
%32 = or i32 %30, %31
%33 = load i32, i32* @MAP_SHARED
%34 = load i32, i32* %6
%35 = call i8* @mmap(i32* null, i32 32768, i32 %32, i32 %33, i32 %34, i32 0)
store i8* %35, i8** %8
%36 = load i8*, i8** @MAP_FAILED
%37 = icmp eq i8* %35, %36
br i1 %37, label %38, label %44
38: ; preds = %29
%39 = load i32, i32* @errno
%40 = call i8* @strerror(i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %40)
%42 = load i32, i32* @EXIT_FAILURE
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %29
store i32 0, i32* %7
br label %45
45: ; preds = %64, %44
%46 = load i32, i32* %7
%47 = icmp sle i32 %46, 32768
br i1 %47, label %48, label %67
48: ; preds = %45
%49 = load i32, i32* %7
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %6
%52 = load i32, i32* %7
%53 = call i32 @ftruncate(i32 %51, i32 %52)
%54 = load i32, i32* %7
%55 = sub nsw i32 %54, 1
%56 = load i8*, i8** %8
%57 = load i32, i32* %7
%58 = sub nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %55, i32 %62)
br label %64
64: ; preds = %48
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 4096
store i32 %66, i32* %7
br label %45
67: ; preds = %45
%68 = load i32, i32* %6
%69 = call i32 @close(i32 %68)
%70 = icmp eq i32 %69, -1
br i1 %70, label %71, label %77
71: ; preds = %67
%72 = load i32, i32* @errno
%73 = call i8* @strerror(i32 %72)
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %73)
%75 = load i32, i32* @EXIT_FAILURE
%76 = call i32 @exit(i32 %75)
unreachable
77: ; preds = %67
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%79 = load i32, i32* @EXIT_SUCCESS
%80 = call i32 @exit(i32 %79)
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"mmap_test\00"
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [16 x i8] c"open error: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [16 x i8] c"mmap error: %s\0A\00"
@.str.3 = [25 x i8] c"setting file size to %d\0A\00"
@.str.4 = [14 x i8] c"ptr[%d] = %d\0A\00"
@.str.5 = [17 x i8] c"close error: %s\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [5 x i8] c"done\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @O_RDWR
%4 = load i32, i32* @O_TRUNC
%5 = or i32 %4, %3
%6 = load i32, i32* @O_CREAT
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IRUSR
%9 = load i32, i32* @S_IWUSR
%10 = or i32 %9, %8
%11 = load i32, i32* @S_IRGRP
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IROTH
%14 = or i32 %12, %13
%15 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i32, i32* @errno
%19 = tail call i8* @strerror(i32 %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %2
%24 = load i32, i32* @PROT_READ
%25 = load i32, i32* @PROT_WRITE
%26 = or i32 %25, %24
%27 = load i32, i32* @MAP_SHARED
%28 = tail call i8* @mmap(i32* null, i32 32768, i32 %26, i32 %27, i32 %15, i32 0)
%29 = load i8*, i8** @MAP_FAILED
%30 = icmp eq i8* %28, %29
br i1 %30, label %88, label %31
31: ; preds = %23
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 0)
%33 = tail call i32 @ftruncate(i32 %15, i32 0)
%34 = getelementptr inbounds i8, i8* %28, i64 -1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 -1, i32 %36)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 4096)
%39 = tail call i32 @ftruncate(i32 %15, i32 4096)
%40 = getelementptr inbounds i8, i8* %28, i64 4095
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 4095, i32 %42)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 8192)
%45 = tail call i32 @ftruncate(i32 %15, i32 8192)
%46 = getelementptr inbounds i8, i8* %28, i64 8191
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 8191, i32 %48)
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 12288)
%51 = tail call i32 @ftruncate(i32 %15, i32 12288)
%52 = getelementptr inbounds i8, i8* %28, i64 12287
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 12287, i32 %54)
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 16384)
%57 = tail call i32 @ftruncate(i32 %15, i32 16384)
%58 = getelementptr inbounds i8, i8* %28, i64 16383
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 16383, i32 %60)
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 20480)
%63 = tail call i32 @ftruncate(i32 %15, i32 20480)
%64 = getelementptr inbounds i8, i8* %28, i64 20479
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 20479, i32 %66)
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 24576)
%69 = tail call i32 @ftruncate(i32 %15, i32 24576)
%70 = getelementptr inbounds i8, i8* %28, i64 24575
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 24575, i32 %72)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 28672)
%75 = tail call i32 @ftruncate(i32 %15, i32 28672)
%76 = getelementptr inbounds i8, i8* %28, i64 28671
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 28671, i32 %78)
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 32768)
%81 = tail call i32 @ftruncate(i32 %15, i32 32768)
%82 = getelementptr inbounds i8, i8* %28, i64 32767
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 32767, i32 %84)
%86 = tail call i32 @close(i32 %15)
%87 = icmp eq i32 %86, -1
br i1 %87, label %94, label %100
88: ; preds = %23
%89 = load i32, i32* @errno
%90 = tail call i8* @strerror(i32 %89)
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %90)
%92 = load i32, i32* @EXIT_FAILURE
%93 = tail call i32 @exit(i32 %92)
unreachable
94: ; preds = %31
%95 = load i32, i32* @errno
%96 = tail call i8* @strerror(i32 %95)
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %96)
%98 = load i32, i32* @EXIT_FAILURE
%99 = tail call i32 @exit(i32 %98)
unreachable
100: ; preds = %31
%101 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%102 = load i32, i32* @EXIT_SUCCESS
%103 = tail call i32 @exit(i32 %102)
unreachable
}