#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;
};
typedef int ssize_t;
typedef int /*<<< orphan*/ in_fsize;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int O_CREAT;
int O_RDONLY;
int O_WRONLY;
int S_IROTH;
int S_IRWXG;
int S_IRWXU;
int S_IXGRP;
int S_IXOTH;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int fstat(int, struct stat *);
int ftruncate(int, int);
char *malloc(int);
int open(char *, int, ...);
int /*<<< orphan*/ printf(char *, char *, int);
int read(int, char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int in_fd, out_fd, nr;
  struct stat st;
  ssize_t in_fsize, new_size;
  char *buf;
  int in_flags = O_RDONLY;
  int out_flags = O_WRONLY | O_CREAT;
  int out_mode = S_IRWXU | S_IXGRP | S_IRWXG | S_IROTH | S_IXOTH;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s <input file><output file>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  in_fd = open(argv[1], in_flags);
  if (in_fd == -1) {
    fprintf(stderr, "Err. open() input failed: %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  out_fd = open(argv[2], out_flags, out_mode);
  if (out_fd == -1) {
    fprintf(stderr, "Err. open() output failed: %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (fstat(in_fd, &st) == -1) {
    fprintf(stderr, "Err. fstat() inpput failed: %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  in_fsize = st.st_size;
  buf = malloc(sizeof(in_fsize));
  if ((nr = read(in_fd, buf, in_fsize)) != -1)
    write(out_fd, buf, in_fsize);
  close(in_fd);
  ((in_fsize % 2) == 0) ? (new_size = in_fsize / 2)
                        : (new_size = (in_fsize - 1) / 2);
  if (ftruncate(out_fd, new_size) == -1) {
    fprintf(stderr, "Err. truncate() failed: %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (fstat(out_fd, &st) == -1) {
    fprintf(stderr, "Err. fstat() inpput failed: %s.\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  printf("The original size of \'%s\': %d\n", argv[1], in_fsize);
  printf("The size after truncation of \'%s\': %d\n", argv[2], (int)st.st_size);
  close(out_fd);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    0x2e16(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x38(%rbp)
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
mov    0x2dc9(%rip),%rcx
or     (%rcx),%eax
mov    0x2dd0(%rip),%rcx
or     (%rcx),%eax
mov    0x2d97(%rip),%rcx
or     (%rcx),%eax
mov    0x2dc6(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     124b <main+0x9b>
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc8(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x34(%rbp),%esi
mov    $0x0,%al
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12a4 <main+0xf4>
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x40(%rbp),%edi
mov    %rax,%rdx
lea    0xd94(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    $0x0,%al
call   10a0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1300 <main+0x150>
mov    0x2ce3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rdx
lea    0xd57(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10d0 <fstat@plt>
cmp    $0xffffffff,%eax
jne    134f <main+0x19f>
mov    0x2c94(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2c80(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x48(%rbp),%edi
mov    %rax,%rdx
lea    0xd28(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x4,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1070 <read@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     138d <main+0x1dd>
mov    -0x18(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13bc <main+0x20c>
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
jmp    13cd <main+0x21d>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1050 <ftruncate@plt>
cmp    $0xffffffff,%eax
jne    141b <main+0x26b>
mov    0x2bc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2bb4(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    %rax,%rdx
lea    0xc7d(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2b84(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10d0 <fstat@plt>
cmp    $0xffffffff,%eax
jne    146a <main+0x2ba>
mov    0x2b79(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2b65(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x50(%rbp),%edi
mov    %rax,%rdx
lea    0xc0d(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2b35(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x24(%rbp),%edx
lea    0xc26(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x20(%rbp),%edx
lea    0xc2e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    0x2ae9(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    131b <main+0x16b>
mov    0x2db1(%rip),%rax
mov    0x2e22(%rip),%rcx
mov    (%rcx),%ebp
or     (%rax),%ebp
mov    0x2dff(%rip),%rax
mov    0x2dd8(%rip),%rcx
mov    (%rcx),%ebx
or     (%rax),%ebx
mov    0x2ddd(%rip),%rax
or     (%rax),%ebx
mov    0x2da4(%rip),%rax
or     (%rax),%ebx
mov    0x2dd3(%rip),%rax
or     (%rax),%ebx
mov    0x2dba(%rip),%rax
mov    (%rax),%esi
mov    0x8(%r14),%rdi
xor    %eax,%eax
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
je     1330 <main+0x180>
mov    %eax,%r12d
mov    0x10(%r14),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
je     1350 <main+0x1a0>
mov    %eax,%r15d
lea    0x8(%rsp),%rsi
mov    %r12d,%edi
call   10d0 <fstat@plt>
cmp    $0xffffffff,%eax
je     12fb <main+0x14b>
mov    0x8(%rsp),%ebp
mov    $0x4,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %r12d,%edi
mov    %rax,%rsi
mov    %ebp,%edx
call   1070 <read@plt>
cmp    $0xffffffff,%eax
je     1288 <main+0xd8>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <write@plt>
mov    %r12d,%edi
call   1060 <close@plt>
mov    %ebp,%esi
sar    %esi
mov    %r15d,%edi
call   1050 <ftruncate@plt>
cmp    $0xffffffff,%eax
je     1370 <main+0x1c0>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
call   10d0 <fstat@plt>
cmp    $0xffffffff,%eax
je     12fb <main+0x14b>
mov    0x8(%r14),%rsi
lea    0xde0(%rip),%rdi
mov    %ebp,%edx
call   1040 <printf@plt>
mov    0x10(%r14),%rsi
mov    0x8(%rsp),%edx
lea    0xde9(%rip),%rdi
call   1040 <printf@plt>
mov    %r15d,%edi
call   1060 <close@plt>
mov    0x2ca4(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cae(%rip),%rax
mov    (%rax),%ebx
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd4b(%rip),%rsi
jmp    138e <main+0x1de>
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xcd2(%rip),%rsi
jmp    1393 <main+0x1e3>
mov    0x2c79(%rip),%rax
mov    (%rax),%ebx
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcd7(%rip),%rsi
jmp    138e <main+0x1de>
mov    0x2c59(%rip),%rax
mov    (%rax),%ebx
mov    0x2c48(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcd6(%rip),%rsi
jmp    138e <main+0x1de>
mov    0x2c39(%rip),%rax
mov    (%rax),%ebx
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcf7(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1080 <fprintf@plt>
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@S_IXGRP = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <input file><output file>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"Err. open() input failed: %s.\0A\00"
@errno = global i32 0
@.str.2 = [32 x i8] c"Err. open() output failed: %s.\0A\00"
@.str.3 = [33 x i8] c"Err. fstat() inpput failed: %s.\0A\00"
@.str.4 = [29 x i8] c"Err. truncate() failed: %s.\0A\00"
@.str.5 = [31 x i8] c"The original size of '%s': %d\0A\00"
@.str.6 = [39 x i8] c"The size after truncation of '%s': %d\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 i32
%9 = alloca %struct.stat
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* @O_RDONLY
store i32 %16, i32* %13
%17 = load i32, i32* @O_WRONLY
%18 = load i32, i32* @O_CREAT
%19 = or i32 %17, %18
store i32 %19, i32* %14
%20 = load i32, i32* @S_IRWXU
%21 = load i32, i32* @S_IXGRP
%22 = or i32 %20, %21
%23 = load i32, i32* @S_IRWXG
%24 = or i32 %22, %23
%25 = load i32, i32* @S_IROTH
%26 = or i32 %24, %25
%27 = load i32, i32* @S_IXOTH
%28 = or i32 %26, %27
store i32 %28, i32* %15
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 3
br i1 %30, label %31, label %39
31: ; preds = %2
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %35)
%37 = load i32, i32* @EXIT_FAILURE
%38 = call i32 @exit(i32 %37)
unreachable
39: ; preds = %2
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = load i32, i32* %13
%44 = call i32 (i8*, i32, ...) @open(i8* %42, i32 %43)
store i32 %44, i32* %6
%45 = load i32, i32* %6
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %54
47: ; preds = %39
%48 = load i32, i32* @stderr
%49 = load i32, i32* @errno
%50 = call i8* @strerror(i32 %49)
%51 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %50)
%52 = load i32, i32* @EXIT_FAILURE
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %39
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = load i32, i32* %14
%59 = load i32, i32* %15
%60 = call i32 (i8*, i32, ...) @open(i8* %57, i32 %58, i32 %59)
store i32 %60, i32* %7
%61 = load i32, i32* %7
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %70
63: ; preds = %54
%64 = load i32, i32* @stderr
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %66)
%68 = load i32, i32* @EXIT_FAILURE
%69 = call i32 @exit(i32 %68)
unreachable
70: ; preds = %54
%71 = load i32, i32* %6
%72 = call i32 @fstat(i32 %71, %struct.stat* %9)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %81
74: ; preds = %70
%75 = load i32, i32* @stderr
%76 = load i32, i32* @errno
%77 = call i8* @strerror(i32 %76)
%78 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %77)
%79 = load i32, i32* @EXIT_FAILURE
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %70
%82 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%83 = load i32, i32* %82
store i32 %83, i32* %10
%84 = call i8* @malloc(i32 4)
store i8* %84, i8** %12
%85 = load i32, i32* %6
%86 = load i8*, i8** %12
%87 = load i32, i32* %10
%88 = call i32 @read(i32 %85, i8* %86, i32 %87)
store i32 %88, i32* %8
%89 = icmp ne i32 %88, -1
br i1 %89, label %90, label %95
90: ; preds = %81
%91 = load i32, i32* %7
%92 = load i8*, i8** %12
%93 = load i32, i32* %10
%94 = call i32 @write(i32 %91, i8* %92, i32 %93)
br label %95
95: ; preds = %90, %81
%96 = load i32, i32* %6
%97 = call i32 @close(i32 %96)
%98 = load i32, i32* %10
%99 = srem i32 %98, 2
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %104
101: ; preds = %95
%102 = load i32, i32* %10
%103 = sdiv i32 %102, 2
store i32 %103, i32* %11
br label %108
104: ; preds = %95
%105 = load i32, i32* %10
%106 = sub nsw i32 %105, 1
%107 = sdiv i32 %106, 2
store i32 %107, i32* %11
br label %108
108: ; preds = %104, %101
%109 = phi i32 [ %103, %101 ], [ %107, %104 ]
%110 = load i32, i32* %7
%111 = load i32, i32* %11
%112 = call i32 @ftruncate(i32 %110, i32 %111)
%113 = icmp eq i32 %112, -1
br i1 %113, label %114, label %121
114: ; preds = %108
%115 = load i32, i32* @stderr
%116 = load i32, i32* @errno
%117 = call i8* @strerror(i32 %116)
%118 = call i32 @fprintf(i32 %115, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %117)
%119 = load i32, i32* @EXIT_FAILURE
%120 = call i32 @exit(i32 %119)
unreachable
121: ; preds = %108
%122 = load i32, i32* %7
%123 = call i32 @fstat(i32 %122, %struct.stat* %9)
%124 = icmp eq i32 %123, -1
br i1 %124, label %125, label %132
125: ; preds = %121
%126 = load i32, i32* @stderr
%127 = load i32, i32* @errno
%128 = call i8* @strerror(i32 %127)
%129 = call i32 @fprintf(i32 %126, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %128)
%130 = load i32, i32* @EXIT_FAILURE
%131 = call i32 @exit(i32 %130)
unreachable
132: ; preds = %121
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 1
%135 = load i8*, i8** %134
%136 = load i32, i32* %10
%137 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %135, i32 %136)
%138 = load i8**, i8*** %5
%139 = getelementptr inbounds i8*, i8** %138, i64 2
%140 = load i8*, i8** %139
%141 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%142 = load i32, i32* %141
%143 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* %140, i32 %142)
%144 = load i32, i32* %7
%145 = call i32 @close(i32 %144)
%146 = load i32, i32* @EXIT_SUCCESS
ret i32 %146
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@S_IRWXU = global i32 0
@S_IXGRP = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <input file><output file>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"Err. open() input failed: %s.\0A\00"
@errno = global i32 0
@.str.2 = [32 x i8] c"Err. open() output failed: %s.\0A\00"
@.str.3 = [33 x i8] c"Err. fstat() inpput failed: %s.\0A\00"
@.str.4 = [29 x i8] c"Err. truncate() failed: %s.\0A\00"
@.str.5 = [31 x i8] c"The original size of '%s': %d\0A\00"
@.str.6 = [39 x i8] c"The size after truncation of '%s': %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = load i32, i32* @O_WRONLY
%6 = load i32, i32* @O_CREAT
%7 = or i32 %6, %5
%8 = load i32, i32* @S_IRWXU
%9 = load i32, i32* @S_IXGRP
%10 = or i32 %9, %8
%11 = load i32, i32* @S_IRWXG
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IROTH
%14 = or i32 %12, %13
%15 = load i32, i32* @S_IXOTH
%16 = or i32 %14, %15
%17 = icmp eq i32 %0, 3
br i1 %17, label %24, label %18
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = tail call i32 @exit(i32 %22)
unreachable
24: ; preds = %2
%25 = load i32, i32* @O_RDONLY
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = tail call i32 (i8*, i32, ...) @open(i8* %27, i32 %25)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %37
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = load i32, i32* @errno
%33 = tail call i8* @strerror(i32 %32)
%34 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
%36 = tail call i32 @exit(i32 %35)
unreachable
37: ; preds = %24
%38 = getelementptr inbounds i8*, i8** %1, i64 2
%39 = load i8*, i8** %38
%40 = tail call i32 (i8*, i32, ...) @open(i8* %39, i32 %7, i32 %16)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %49
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = load i32, i32* @errno
%45 = tail call i8* @strerror(i32 %44)
%46 = tail call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %45)
%47 = load i32, i32* @EXIT_FAILURE
%48 = tail call i32 @exit(i32 %47)
unreachable
49: ; preds = %37
%50 = call i32 @fstat(i32 %28, %struct.stat* %3)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %59
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = load i32, i32* @errno
%55 = tail call i8* @strerror(i32 %54)
%56 = tail call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%57 = load i32, i32* @EXIT_FAILURE
%58 = tail call i32 @exit(i32 %57)
unreachable
59: ; preds = %49
%60 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%61 = load i32, i32* %60
%62 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%63 = tail call i32 @read(i32 %28, i8* %62, i32 %61)
%64 = icmp eq i32 %63, -1
br i1 %64, label %67, label %65
65: ; preds = %59
%66 = tail call i32 @write(i32 %40, i8* %62, i32 %61)
br label %67
67: ; preds = %65, %59
%68 = tail call i32 @close(i32 %28)
%69 = and i32 %61, -2
%70 = sdiv i32 %69, 2
%71 = tail call i32 @ftruncate(i32 %40, i32 %70)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %80
73: ; preds = %67
%74 = load i32, i32* @stderr
%75 = load i32, i32* @errno
%76 = tail call i8* @strerror(i32 %75)
%77 = tail call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %76)
%78 = load i32, i32* @EXIT_FAILURE
%79 = tail call i32 @exit(i32 %78)
unreachable
80: ; preds = %67
%81 = call i32 @fstat(i32 %40, %struct.stat* %3)
%82 = icmp eq i32 %81, -1
br i1 %82, label %83, label %90
83: ; preds = %80
%84 = load i32, i32* @stderr
%85 = load i32, i32* @errno
%86 = tail call i8* @strerror(i32 %85)
%87 = tail call i32 @fprintf(i32 %84, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %86)
%88 = load i32, i32* @EXIT_FAILURE
%89 = tail call i32 @exit(i32 %88)
unreachable
90: ; preds = %80
%91 = load i8*, i8** %26
%92 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %91, i32 %61)
%93 = load i8*, i8** %38
%94 = load i32, i32* %60
%95 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* %93, i32 %94)
%96 = tail call i32 @close(i32 %40)
%97 = load i32, i32* @EXIT_SUCCESS
ret i32 %97
}