#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 /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ ext_fail(char *, char *);
scalar_t__ fchmod(int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char getchar();
int open(char *, int, ...);
int /*<<< orphan*/ print_access(struct stat *, char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
scalar_t__ write(int, char *, int);
int main(int argc, char *argv[]) {
  int i = 0;
  struct stat s_s, s_d;
  int fd_s, fd_d;
  char buff[1024];
  if (argc != 3) {
    fprintf(stderr, "Syntax: auf2 Quelldatei Zieldatei\n");
    exit(1);
  }
  if (stat(argv[1], &s_s) != 0) {
    ext_fail("Quell", argv[1]);
  }
  if ((fd_s = open(argv[1], O_RDONLY)) < 0) {
    ext_fail("Quell", argv[1]);
  }
  print_access(&s_s, argv[1]);
  if (stat(argv[2], &s_d) == 0) {
    printf("Datei '%s' existiert bereits .. überschreiben? (y/N) ", argv[2]);
    if (getchar() != 'y') {
      printf("Überschreibe NICHT!\nBeende..\n");
      exit(0);
    }
    printf("ÜBERSCHREIBE!\n");
  }
  if ((fd_d = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, s_s.st_mode)) < 0) {
    ext_fail("Ziel", argv[2]);
  }
  while ((i = read(fd_s, buff, 1024)) > 0) {
    if (write(fd_d, buff, i) < 0) {
      ext_fail("Ziel", argv[2]);
    }
  }
  if (fchmod(fd_d, s_s.st_mode) != 0) {
    ext_fail("Ziel", argv[2]);
  }
  close(fd_s);
  close(fd_d);
  if (i == 0) {
    printf("Datei '%s' erfolgreich nach '%s' kopiert\n", argv[1], argv[2]);
    if (stat(argv[2], &s_d) == 0) {
      print_access(&s_d, argv[2]);
    }
  } else {
    ext_fail("Quell", argv[1]);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1209 <main+0x49>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xe06(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
je     1238 <main+0x78>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdf0(%rip),%rdi
call   1050 <ext_fail@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d91(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10c0 <open@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    1270 <main+0xb0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdb8(%rip),%rdi
call   1050 <ext_fail@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x18(%rbp),%rdi
call   10e0 <print_access@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
jne    12e8 <main+0x128>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
movsbl %al,%eax
cmp    $0x79,%eax
je     12da <main+0x11a>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2cc1(%rip),%rax
mov    (%rax),%esi
mov    0x2cf8(%rip),%rax
or     (%rax),%esi
mov    0x2ce7(%rip),%rax
or     (%rax),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   10c0 <open@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jge    1335 <main+0x175>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd5f(%rip),%rdi
call   1050 <ext_fail@plt>
jmp    133a <main+0x17a>
mov    -0x24(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    138f <main+0x1cf>
mov    -0x28(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jge    138a <main+0x1ca>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd0a(%rip),%rdi
call   1050 <ext_fail@plt>
jmp    133a <main+0x17a>
mov    -0x28(%rbp),%edi
mov    -0x18(%rbp),%esi
call   10b0 <fchmod@plt>
cmp    $0x0,%rax
je     13b8 <main+0x1f8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xcdc(%rip),%rdi
call   1050 <ext_fail@plt>
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x28(%rbp),%edi
call   1060 <close@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1421 <main+0x261>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xcab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
jne    141c <main+0x25c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x20(%rbp),%rdi
call   10e0 <print_access@plt>
jmp    1435 <main+0x275>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xbf3(%rip),%rdi
call   1050 <ext_fail@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
cmp    $0x3,%edi
jne    1326 <main+0x156>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
call   10b0 <stat@plt>
test   %rax,%rax
je     120e <main+0x3e>
mov    0x8(%r14),%rsi
lea    0xe1a(%rip),%rdi
call   1060 <ext_fail@plt>
mov    0x8(%r14),%rdi
mov    0x2dbf(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   10d0 <open@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    1239 <main+0x69>
mov    0x8(%r14),%rsi
lea    0xdef(%rip),%rdi
call   1060 <ext_fail@plt>
mov    0x8(%r14),%rsi
mov    %rsp,%rdi
call   10f0 <print_access@plt>
mov    0x10(%r14),%rdi
lea    0x8(%rsp),%rsi
call   10b0 <stat@plt>
test   %rax,%rax
jne    1285 <main+0xb5>
mov    0x10(%r14),%rsi
lea    0xdc6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0x79,%al
jne    13ca <main+0x1fa>
lea    0xe0f(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%r14),%rdi
mov    0x2d28(%rip),%rax
mov    0x2d61(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d4e(%rip),%rax
or     (%rax),%esi
mov    (%rsp),%edx
xor    %eax,%eax
call   10d0 <open@plt>
mov    %eax,%r12d
test   %eax,%eax
jns    12c5 <main+0xf5>
mov    0x10(%r14),%rsi
lea    0xda0(%rip),%rdi
call   1060 <ext_fail@plt>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x400,%edx
call   1080 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1345 <main+0x175>
lea    0x10(%rsp),%rbx
lea    0xd77(%rip),%r13
jmp    1306 <main+0x136>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1080 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1345 <main+0x175>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <write@plt>
test   %rax,%rax
jns    12f0 <main+0x120>
mov    0x10(%r14),%rsi
mov    %r13,%rdi
call   1060 <ext_fail@plt>
jmp    12f0 <main+0x120>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
lea    0xcca(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    (%rsp),%esi
mov    %r12d,%edi
call   10c0 <fchmod@plt>
test   %rax,%rax
je     1365 <main+0x195>
mov    0x10(%r14),%rsi
lea    0xd00(%rip),%rdi
call   1060 <ext_fail@plt>
mov    %r15d,%edi
call   1070 <close@plt>
mov    %r12d,%edi
call   1070 <close@plt>
mov    0x8(%r14),%rsi
test   %ebp,%ebp
jne    13b7 <main+0x1e7>
mov    0x10(%r14),%rdx
lea    0xcdd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%r14),%rdi
lea    0x8(%rsp),%rsi
call   10b0 <stat@plt>
test   %rax,%rax
jne    13c3 <main+0x1f3>
mov    0x10(%r14),%rsi
lea    0x8(%rsp),%rdi
call   10f0 <print_access@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xc65(%rip),%rdi
call   1060 <ext_fail@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xccd(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"Syntax: auf2 Quelldatei Zieldatei\0A\00"
@.str.1 = [6 x i8] c"Quell\00"
@O_RDONLY = global i32 0
@.str.2 = [55 x i8] c"Datei '%s' existiert bereits .. \C3\BCberschreiben? (y/N) \00"
@.str.3 = [31 x i8] c"\C3\9Cberschreibe NICHT!\0ABeende..\0A\00"
@.str.4 = [16 x i8] c"\C3\9CBERSCHREIBE!\0A\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.5 = [5 x i8] c"Ziel\00"
@.str.6 = [42 x i8] c"Datei '%s' erfolgreich nach '%s' kopiert\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.stat
%8 = alloca %struct.stat
%9 = alloca i32
%10 = alloca i32
%11 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([35 x i8], [35 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 i64 @stat(i8* %21, %struct.stat* %7)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %18
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @ext_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %24, %18
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = load i32, i32* @O_RDONLY
%34 = call i32 (i8*, i32, ...) @open(i8* %32, i32 %33)
store i32 %34, i32* %9
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %29
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @ext_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %36, %29
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @print_access(%struct.stat* %7, i8* %44)
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i64 @stat(i8* %48, %struct.stat* %8)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %64
51: ; preds = %41
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i8* %54)
%56 = call signext i8 (...) @getchar()
%57 = sext i8 %56 to i32
%58 = icmp ne i32 %57, 121
br i1 %58, label %59, label %62
59: ; preds = %51
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%61 = call i32 @exit(i32 0)
unreachable
62: ; preds = %51
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %64
64: ; preds = %62, %41
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = load i32, i32* @O_WRONLY
%69 = load i32, i32* @O_CREAT
%70 = or i32 %68, %69
%71 = load i32, i32* @O_TRUNC
%72 = or i32 %70, %71
%73 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%74 = load i32, i32* %73
%75 = call i32 (i8*, i32, ...) @open(i8* %67, i32 %72, i32 %74)
store i32 %75, i32* %10
%76 = icmp slt i32 %75, 0
br i1 %76, label %77, label %82
77: ; preds = %64
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 2
%80 = load i8*, i8** %79
%81 = call i32 @ext_fail(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %80)
br label %82
82: ; preds = %77, %64
br label %83
83: ; preds = %99, %82
%84 = load i32, i32* %9
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%86 = call i32 @read(i32 %84, i8* %85, i32 1024)
store i32 %86, i32* %6
%87 = icmp sgt i32 %86, 0
br i1 %87, label %88, label %100
88: ; preds = %83
%89 = load i32, i32* %10
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%91 = load i32, i32* %6
%92 = call i64 @write(i32 %89, i8* %90, i32 %91)
%93 = icmp slt i64 %92, 0
br i1 %93, label %94, label %99
94: ; preds = %88
%95 = load i8**, i8*** %5
%96 = getelementptr inbounds i8*, i8** %95, i64 2
%97 = load i8*, i8** %96
%98 = call i32 @ext_fail(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %97)
br label %99
99: ; preds = %94, %88
br label %83
100: ; preds = %83
%101 = load i32, i32* %10
%102 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%103 = load i32, i32* %102
%104 = call i64 @fchmod(i32 %101, i32 %103)
%105 = icmp ne i64 %104, 0
br i1 %105, label %106, label %111
106: ; preds = %100
%107 = load i8**, i8*** %5
%108 = getelementptr inbounds i8*, i8** %107, i64 2
%109 = load i8*, i8** %108
%110 = call i32 @ext_fail(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %109)
br label %111
111: ; preds = %106, %100
%112 = load i32, i32* %9
%113 = call i32 @close(i32 %112)
%114 = load i32, i32* %10
%115 = call i32 @close(i32 %114)
%116 = load i32, i32* %6
%117 = icmp eq i32 %116, 0
br i1 %117, label %118, label %137
118: ; preds = %111
%119 = load i8**, i8*** %5
%120 = getelementptr inbounds i8*, i8** %119, i64 1
%121 = load i8*, i8** %120
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 2
%124 = load i8*, i8** %123
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %121, i8* %124)
%126 = load i8**, i8*** %5
%127 = getelementptr inbounds i8*, i8** %126, i64 2
%128 = load i8*, i8** %127
%129 = call i64 @stat(i8* %128, %struct.stat* %8)
%130 = icmp eq i64 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %118
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 2
%134 = load i8*, i8** %133
%135 = call i32 @print_access(%struct.stat* %8, i8* %134)
br label %136
136: ; preds = %131, %118
br label %142
137: ; preds = %111
%138 = load i8**, i8*** %5
%139 = getelementptr inbounds i8*, i8** %138, i64 1
%140 = load i8*, i8** %139
%141 = call i32 @ext_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %140)
br label %142
142: ; preds = %137, %136
%143 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"Syntax: auf2 Quelldatei Zieldatei\0A\00"
@.str.1 = [6 x i8] c"Quell\00"
@O_RDONLY = global i32 0
@.str.2 = [55 x i8] c"Datei '%s' existiert bereits .. \C3\BCberschreiben? (y/N) \00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.5 = [5 x i8] c"Ziel\00"
@.str.6 = [42 x i8] c"Datei '%s' erfolgreich nach '%s' kopiert\0A\00"
@str = [15 x i8] c"\C3\9CBERSCHREIBE!\00"
@str.7 = [30 x i8] c"\C3\9Cberschreibe NICHT!\0ABeende..\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = alloca [1024 x i8]
%6 = bitcast %struct.stat* %3 to i8*
%7 = bitcast %struct.stat* %4 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 3
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @stat(i8* %16, %struct.stat* %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %14
%20 = load i8*, i8** %15
%21 = call i32 @ext_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %19, %14
%23 = load i8*, i8** %15
%24 = load i32, i32* @O_RDONLY
%25 = call i32 (i8*, i32, ...) @open(i8* %23, i32 %24)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i8*, i8** %15
%29 = call i32 @ext_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %27, %22
%31 = load i8*, i8** %15
%32 = call i32 @print_access(%struct.stat* %3, i8* %31)
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = call i64 @stat(i8* %34, %struct.stat* %4)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %47
37: ; preds = %30
%38 = load i8*, i8** %33
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = call signext i8 (...) @getchar()
%41 = icmp eq i8 %40, 121
br i1 %41, label %45, label %42
42: ; preds = %37
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.7, i64 0, i64 0))
%44 = call i32 @exit(i32 0)
unreachable
45: ; preds = %37
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %47
47: ; preds = %45, %30
%48 = load i8*, i8** %33
%49 = load i32, i32* @O_WRONLY
%50 = load i32, i32* @O_CREAT
%51 = or i32 %50, %49
%52 = load i32, i32* @O_TRUNC
%53 = or i32 %51, %52
%54 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%55 = load i32, i32* %54
%56 = call i32 (i8*, i32, ...) @open(i8* %48, i32 %53, i32 %55)
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %47
%59 = load i8*, i8** %33
%60 = call i32 @ext_fail(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %59)
br label %61
61: ; preds = %58, %47
%62 = call i32 @read(i32 %25, i8* %8, i32 1024)
%63 = icmp sgt i32 %62, 0
br i1 %63, label %64, label %74
64: ; preds = %61, %71
%65 = phi i32 [ %72, %71 ], [ %62, %61 ]
%66 = call i64 @write(i32 %56, i8* %8, i32 %65)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = load i8*, i8** %33
%70 = call i32 @ext_fail(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %69)
br label %71
71: ; preds = %68, %64
%72 = call i32 @read(i32 %25, i8* %8, i32 1024)
%73 = icmp sgt i32 %72, 0
br i1 %73, label %64, label %74
74: ; preds = %71, %61
%75 = phi i32 [ %62, %61 ], [ %72, %71 ]
%76 = load i32, i32* %54
%77 = call i64 @fchmod(i32 %56, i32 %76)
%78 = icmp eq i64 %77, 0
br i1 %78, label %82, label %79
79: ; preds = %74
%80 = load i8*, i8** %33
%81 = call i32 @ext_fail(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %80)
br label %82
82: ; preds = %79, %74
%83 = call i32 @close(i32 %25)
%84 = call i32 @close(i32 %56)
%85 = icmp eq i32 %75, 0
%86 = load i8*, i8** %15
br i1 %85, label %87, label %96
87: ; preds = %82
%88 = load i8*, i8** %33
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %86, i8* %88)
%90 = load i8*, i8** %33
%91 = call i64 @stat(i8* %90, %struct.stat* %4)
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %98
93: ; preds = %87
%94 = load i8*, i8** %33
%95 = call i32 @print_access(%struct.stat* %4, i8* %94)
br label %98
96: ; preds = %82
%97 = call i32 @ext_fail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %86)
br label %98
98: ; preds = %87, %93, %96
%99 = call i32 @exit(i32 0)
unreachable
}