#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_mode;
};

/* Variables and functions */
int O_CREAT;
int O_RDONLY;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int fchmod(int, int);
int fstat(int, struct stat *);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int stat(char *, struct stat *);
int main(void) {
  int fd;
  struct stat statbuf;
  if ((fd = open("test.txt", O_RDONLY | O_CREAT,
                 S_IRUSR | S_IRGRP | S_IROTH)) == -1) {
    perror("fail to open");
    exit(1);
  }
  printf("before changing model\n");
  if (fstat(fd, &statbuf) == -1) {
    perror("fail to get status");
    exit(1);
  }
  if (statbuf.st_mode & S_IRUSR)
    printf("user can read\n");
  if (statbuf.st_mode & S_IRGRP)
    printf("group user can read\n");
  if (statbuf.st_mode & S_IROTH)
    printf("other user can read\n");
  printf("\n");
  if (fchmod(fd, S_IWUSR | S_IWGRP | S_IWOTH) == -1) {
    perror("fail to change model");
    exit(1);
  }
  printf("after changing model\n");
  if (fstat(fd, &statbuf) == -1) {
    perror("fail to get status");
    exit(1);
  }
  printf("check the file by file-descriptor\n");
  if (statbuf.st_mode & S_IWUSR)
    printf("user can write\n");
  if (statbuf.st_mode & S_IWGRP)
    printf("group user can write\n");
  if (statbuf.st_mode & S_IWOTH)
    printf("other user can write\n");
  printf("\n");
  if (stat("test.txt", &statbuf) == -1) {
    perror("fail to get status");
    exit(1);
  }
  printf("check the file in the disk\n");
  if (statbuf.st_mode & S_IWUSR)
    printf("user can write\n");
  if (statbuf.st_mode & S_IWGRP)
    printf("group user can write\n");
  if (statbuf.st_mode & S_IWOTH)
    printf("other user can write\n");
  printf("\n");
  sleep(10);
  printf("done\n");
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
mov    0x2e49(%rip),%rax
or     (%rax),%esi
mov    0x2df8(%rip),%rax
mov    (%rax),%edx
mov    0x2dff(%rip),%rax
or     (%rax),%edx
mov    0x2dee(%rip),%rax
or     (%rax),%edx
lea    0xe2d(%rip),%rdi
call   1070 <open@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    11fa <main+0x6a>
lea    0xe1e(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   10b0 <fstat@plt>
cmp    $0xffffffff,%eax
jne    1231 <main+0xa1>
lea    0xe0b(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%eax
mov    0x2d75(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1252 <main+0xc2>
lea    0xdf9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2d64(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1273 <main+0xe3>
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2d3b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1294 <main+0x104>
lea    0xdc6(%rip),%rdi
call   1030 <printf@plt>
lea    0xdb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2d26(%rip),%rax
mov    (%rax),%esi
mov    0x2d25(%rip),%rax
or     (%rax),%esi
mov    0x2ce4(%rip),%rax
or     (%rax),%esi
call   1060 <fchmod@plt>
cmp    $0xffffffff,%eax
jne    12e2 <main+0x152>
lea    0xd97(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xd96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   10b0 <fstat@plt>
cmp    $0xffffffff,%eax
jne    1319 <main+0x189>
lea    0xd23(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xd75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2ca1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1346 <main+0x1b6>
lea    0xd7d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2c88(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1367 <main+0x1d7>
lea    0xd56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2c2f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1388 <main+0x1f8>
lea    0xd4b(%rip),%rdi
call   1030 <printf@plt>
lea    0xcc4(%rip),%rdi
call   1030 <printf@plt>
lea    0xc65(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0xffffffff,%eax
jne    13c3 <main+0x233>
lea    0xc79(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xd1a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2bf7(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13f0 <main+0x260>
lea    0xcd3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2bde(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1411 <main+0x281>
lea    0xcac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    0x2b85(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1432 <main+0x2a2>
lea    0xca1(%rip),%rdi
call   1030 <printf@plt>
lea    0xc1a(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
call   10a0 <sleep@plt>
lea    0xcb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e2d(%rip),%rax
mov    0x2e3e(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2deb(%rip),%r12
mov    0x2df4(%rip),%r15
mov    (%r15),%edx
or     (%r12),%edx
mov    0x2dde(%rip),%r14
or     (%r14),%edx
lea    0xe1c(%rip),%rdi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     138e <main+0x1ee>
mov    %eax,%ebx
lea    0xe43(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10c0 <fstat@plt>
cmp    $0xffffffff,%eax
je     1385 <main+0x1e5>
mov    0x8(%rsp),%ebp
test   %ebp,(%r12)
je     122b <main+0x8b>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,(%r15)
je     123c <main+0x9c>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,(%r14)
je     124d <main+0xad>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2d72(%rip),%r12
mov    0x2d73(%rip),%r15
mov    (%r15),%esi
or     (%r12),%esi
mov    0x2d2d(%rip),%r14
or     (%r14),%esi
mov    %ebx,%edi
call   1070 <fchmod@plt>
cmp    $0xffffffff,%eax
je     1397 <main+0x1f7>
lea    0xdc7(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10c0 <fstat@plt>
cmp    $0xffffffff,%eax
je     1385 <main+0x1e5>
lea    0xdbb(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%ebp
test   %ebp,(%r12)
je     12c9 <main+0x129>
lea    0xe02(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,(%r15)
je     12da <main+0x13a>
lea    0xdeb(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,(%r14)
je     12eb <main+0x14b>
lea    0xdc5(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd04(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <stat@plt>
cmp    $0xffffffff,%eax
je     1385 <main+0x1e5>
lea    0xd79(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%ebp
test   %ebp,(%r12)
je     132d <main+0x18d>
lea    0xd9e(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,(%r15)
je     133e <main+0x19e>
lea    0xd87(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,(%r14)
je     134f <main+0x1af>
lea    0xd61(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   10b0 <sleep@plt>
lea    0xd3c(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
call   1050 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc8a(%rip),%rdi
jmp    139e <main+0x1fe>
lea    0xc74(%rip),%rdi
jmp    139e <main+0x1fe>
lea    0xc8b(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [9 x i8] c"test.txt\00"
@O_RDONLY = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [13 x i8] c"fail to open\00"
@.str.2 = [23 x i8] c"before changing model\0A\00"
@.str.3 = [19 x i8] c"fail to get status\00"
@.str.4 = [15 x i8] c"user can read\0A\00"
@.str.5 = [21 x i8] c"group user can read\0A\00"
@.str.6 = [21 x i8] c"other user can read\0A\00"
@.str.7 = [2 x i8] c"\0A\00"
@S_IWUSR = global i32 0
@S_IWGRP = global i32 0
@S_IWOTH = global i32 0
@.str.8 = [21 x i8] c"fail to change model\00"
@.str.9 = [22 x i8] c"after changing model\0A\00"
@.str.10 = [35 x i8] c"check the file by file-descriptor\0A\00"
@.str.11 = [16 x i8] c"user can write\0A\00"
@.str.12 = [22 x i8] c"group user can write\0A\00"
@.str.13 = [22 x i8] c"other user can write\0A\00"
@.str.14 = [28 x i8] c"check the file in the disk\0A\00"
@.str.15 = [6 x i8] c"done\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.stat
store i32 0, i32* %1
%4 = load i32, i32* @O_RDONLY
%5 = load i32, i32* @O_CREAT
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IRUSR
%8 = load i32, i32* @S_IRGRP
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IROTH
%11 = or i32 %9, %10
%12 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %11)
store i32 %12, i32* %2
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* %2
%20 = call i32 @fstat(i32 %19, %struct.stat* %3)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %17
%26 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%27 = load i32, i32* %26
%28 = load i32, i32* @S_IRUSR
%29 = and i32 %27, %28
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31, %25
%34 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%35 = load i32, i32* %34
%36 = load i32, i32* @S_IRGRP
%37 = and i32 %35, %36
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %33
%42 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%43 = load i32, i32* %42
%44 = load i32, i32* @S_IROTH
%45 = and i32 %43, %44
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%51 = load i32, i32* %2
%52 = load i32, i32* @S_IWUSR
%53 = load i32, i32* @S_IWGRP
%54 = or i32 %52, %53
%55 = load i32, i32* @S_IWOTH
%56 = or i32 %54, %55
%57 = call i32 @fchmod(i32 %51, i32 %56)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %62
59: ; preds = %49
%60 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %49
%63 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%64 = load i32, i32* %2
%65 = call i32 @fstat(i32 %64, %struct.stat* %3)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %70
67: ; preds = %62
%68 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %62
%71 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
%72 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%73 = load i32, i32* %72
%74 = load i32, i32* @S_IWUSR
%75 = and i32 %73, %74
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %70
%78 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %79
79: ; preds = %77, %70
%80 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%81 = load i32, i32* %80
%82 = load i32, i32* @S_IWGRP
%83 = and i32 %81, %82
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %79
%86 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %87
87: ; preds = %85, %79
%88 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%89 = load i32, i32* %88
%90 = load i32, i32* @S_IWOTH
%91 = and i32 %89, %90
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %87
%94 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %95
95: ; preds = %93, %87
%96 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%97 = call i32 @stat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
%98 = icmp eq i32 %97, -1
br i1 %98, label %99, label %102
99: ; preds = %95
%100 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %95
%103 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0))
%104 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%105 = load i32, i32* %104
%106 = load i32, i32* @S_IWUSR
%107 = and i32 %105, %106
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %111
109: ; preds = %102
%110 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %111
111: ; preds = %109, %102
%112 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%113 = load i32, i32* %112
%114 = load i32, i32* @S_IWGRP
%115 = and i32 %113, %114
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %119
117: ; preds = %111
%118 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %119
119: ; preds = %117, %111
%120 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%121 = load i32, i32* %120
%122 = load i32, i32* @S_IWOTH
%123 = and i32 %121, %122
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %127
125: ; preds = %119
%126 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %127
127: ; preds = %125, %119
%128 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%129 = call i32 @sleep(i32 10)
%130 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%131 = load i32, i32* %2
%132 = call i32 @close(i32 %131)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [9 x i8] c"test.txt\00"
@O_RDONLY = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [13 x i8] c"fail to open\00"
@.str.3 = [19 x i8] c"fail to get status\00"
@S_IWUSR = global i32 0
@S_IWGRP = global i32 0
@S_IWOTH = global i32 0
@.str.8 = [21 x i8] c"fail to change model\00"
@str = [22 x i8] c"before changing model\00"
@str.16 = [21 x i8] c"after changing model\00"
@str.17 = [34 x i8] c"check the file by file-descriptor\00"
@str.18 = [27 x i8] c"check the file in the disk\00"
@str.19 = [5 x i8] c"done\00"
@str.23 = [21 x i8] c"other user can write\00"
@str.24 = [21 x i8] c"group user can write\00"
@str.25 = [15 x i8] c"user can write\00"
@str.26 = [20 x i8] c"other user can read\00"
@str.27 = [20 x i8] c"group user can read\00"
@str.28 = [14 x i8] c"user can read\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = load i32, i32* @O_RDONLY
%4 = load i32, i32* @O_CREAT
%5 = or i32 %4, %3
%6 = load i32, i32* @S_IRUSR
%7 = load i32, i32* @S_IRGRP
%8 = or i32 %7, %6
%9 = load i32, i32* @S_IROTH
%10 = or i32 %8, %9
%11 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %0
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%18 = call i32 @fstat(i32 %11, %struct.stat* %1)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %16
%24 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%25 = load i32, i32* %24
%26 = load i32, i32* @S_IRUSR
%27 = and i32 %26, %25
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %23
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.28, i64 0, i64 0))
br label %31
31: ; preds = %29, %23
%32 = load i32, i32* @S_IRGRP
%33 = and i32 %32, %25
%34 = icmp eq i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.27, i64 0, i64 0))
br label %37
37: ; preds = %35, %31
%38 = load i32, i32* @S_IROTH
%39 = and i32 %38, %25
%40 = icmp eq i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %37
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.26, i64 0, i64 0))
br label %43
43: ; preds = %41, %37
%44 = tail call i32 @putchar(i32 10)
%45 = load i32, i32* @S_IWUSR
%46 = load i32, i32* @S_IWGRP
%47 = or i32 %46, %45
%48 = load i32, i32* @S_IWOTH
%49 = or i32 %47, %48
%50 = tail call i32 @fchmod(i32 %11, i32 %49)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %55
52: ; preds = %43
%53 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%54 = tail call i32 @exit(i32 1)
unreachable
55: ; preds = %43
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.16, i64 0, i64 0))
%57 = call i32 @fstat(i32 %11, %struct.stat* %1)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%61 = tail call i32 @exit(i32 1)
unreachable
62: ; preds = %55
%63 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.17, i64 0, i64 0))
%64 = load i32, i32* %24
%65 = load i32, i32* @S_IWUSR
%66 = and i32 %65, %64
%67 = icmp eq i32 %66, 0
br i1 %67, label %70, label %68
68: ; preds = %62
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.25, i64 0, i64 0))
br label %70
70: ; preds = %68, %62
%71 = load i32, i32* @S_IWGRP
%72 = and i32 %71, %64
%73 = icmp eq i32 %72, 0
br i1 %73, label %76, label %74
74: ; preds = %70
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.24, i64 0, i64 0))
br label %76
76: ; preds = %74, %70
%77 = load i32, i32* @S_IWOTH
%78 = and i32 %77, %64
%79 = icmp eq i32 %78, 0
br i1 %79, label %82, label %80
80: ; preds = %76
%81 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
br label %82
82: ; preds = %80, %76
%83 = tail call i32 @putchar(i32 10)
%84 = call i32 @stat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %89
86: ; preds = %82
%87 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%88 = tail call i32 @exit(i32 1)
unreachable
89: ; preds = %82
%90 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.18, i64 0, i64 0))
%91 = load i32, i32* %24
%92 = load i32, i32* @S_IWUSR
%93 = and i32 %92, %91
%94 = icmp eq i32 %93, 0
br i1 %94, label %97, label %95
95: ; preds = %89
%96 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.25, i64 0, i64 0))
br label %97
97: ; preds = %95, %89
%98 = load i32, i32* @S_IWGRP
%99 = and i32 %98, %91
%100 = icmp eq i32 %99, 0
br i1 %100, label %103, label %101
101: ; preds = %97
%102 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.24, i64 0, i64 0))
br label %103
103: ; preds = %101, %97
%104 = load i32, i32* @S_IWOTH
%105 = and i32 %104, %91
%106 = icmp eq i32 %105, 0
br i1 %106, label %109, label %107
107: ; preds = %103
%108 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
br label %109
109: ; preds = %107, %103
%110 = tail call i32 @putchar(i32 10)
%111 = tail call i32 @sleep(i32 10)
%112 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.19, i64 0, i64 0))
%113 = tail call i32 @close(i32 %11)
ret i32 0
}