#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 /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int S_IXGRP;
int S_IXUSR;
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ err(int, char *, ...);
int getopt(int, char **, char *);
scalar_t__ optind;
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ stat(char *, struct stat *);
char *ttyname(int /*<<< orphan*/);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  struct stat sb;
  int ch;
  char *name;
  while ((ch = getopt(argc, argv, "")) != -1)
    switch (ch) {
    case '?':
    default:
      usage();
    }
  argc -= optind;
  argv += optind;
  if ((name = ttyname(STDIN_FILENO)) == NULL &&
      (name = ttyname(STDOUT_FILENO)) == NULL &&
      (name = ttyname(STDERR_FILENO)) == NULL)
    err(2, "unknown tty");
  if (stat(name, &sb))
    err(2, "stat");
  if (*argv == NULL) {
    (void)printf("is %s\n", sb.st_mode & S_IXUSR   ? "y"
                            : sb.st_mode & S_IXGRP ? "b"
                                                   : "n");
    return (sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1);
  }
  switch (argv[0][0]) {
  case 'n':
    if (chmod(name, sb.st_mode & ~(S_IXUSR | S_IXGRP)) < 0)
      err(2, "%s", name);
    break;
  case 'y':
    if (chmod(name, (sb.st_mode & ~(S_IXUSR | S_IXGRP)) | S_IXUSR) < 0)
      err(2, "%s", name);
    break;
  case 'b':
    if (chmod(name, (sb.st_mode & ~(S_IXUSR | S_IXGRP)) | S_IXGRP) < 0)
      err(2, "%s", name);
    break;
  default:
    usage();
  }
  return (sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe83(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     11c7 <main+0x57>
mov    -0x1c(%rbp),%eax
sub    $0x3f,%eax
jne    11bb <main+0x4b>
jmp    11b6 <main+0x46>
jmp    11bb <main+0x4b>
mov    $0x0,%al
call   1070 <usage@plt>
jmp    1186 <main+0x16>
mov    0x2e0a(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2df6(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
call   1060 <ttyname@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1258 <main+0xe8>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
call   1060 <ttyname@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1258 <main+0xe8>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
call   1060 <ttyname@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1258 <main+0xe8>
mov    $0x2,%edi
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   1050 <err@plt>
mov    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     1282 <main+0x112>
mov    $0x2,%edi
lea    0xd91(%rip),%rsi
mov    $0x0,%al
call   1050 <err@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1316 <main+0x1a6>
mov    -0x18(%rbp),%eax
mov    0x2d46(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12b5 <main+0x145>
lea    0xd5e(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    12da <main+0x16a>
mov    -0x18(%rbp),%edx
mov    0x2d11(%rip),%rax
and    (%rax),%edx
lea    0xd52(%rip),%rax
lea    0xd49(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xd2c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%edx
mov    0x2cec(%rip),%rax
mov    (%rax),%eax
mov    0x2cd3(%rip),%rcx
or     (%rcx),%eax
and    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    146b <main+0x2fb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x34(%rbp)
sub    $0x62,%eax
je     13ec <main+0x27c>
jmp    1331 <main+0x1c1>
mov    -0x34(%rbp),%eax
sub    $0x6e,%eax
je     1353 <main+0x1e3>
jmp    1342 <main+0x1d2>
mov    -0x34(%rbp),%eax
sub    $0x79,%eax
je     139b <main+0x22b>
jmp    143d <main+0x2cd>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    0x2c7f(%rip),%rax
mov    (%rax),%eax
mov    0x2c66(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    %eax,%esi
call   1080 <chmod@plt>
cmp    $0x0,%eax
jge    1396 <main+0x226>
mov    -0x28(%rbp),%rdx
mov    $0x2,%edi
lea    0xc8d(%rip),%rsi
mov    $0x0,%al
call   1050 <err@plt>
jmp    1444 <main+0x2d4>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    0x2c37(%rip),%rax
mov    (%rax),%eax
mov    0x2c1e(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    %eax,%esi
mov    0x2c20(%rip),%rax
or     (%rax),%esi
call   1080 <chmod@plt>
cmp    $0x0,%eax
jge    13e7 <main+0x277>
mov    -0x28(%rbp),%rdx
mov    $0x2,%edi
lea    0xc3c(%rip),%rsi
mov    $0x0,%al
call   1050 <err@plt>
jmp    1444 <main+0x2d4>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    0x2be6(%rip),%rax
mov    (%rax),%eax
mov    0x2bcd(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    %eax,%esi
mov    0x2bbf(%rip),%rax
or     (%rax),%esi
call   1080 <chmod@plt>
cmp    $0x0,%eax
jge    1438 <main+0x2c8>
mov    -0x28(%rbp),%rdx
mov    $0x2,%edi
lea    0xbeb(%rip),%rsi
mov    $0x0,%al
call   1050 <err@plt>
jmp    1444 <main+0x2d4>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x18(%rbp),%edx
mov    0x2b92(%rip),%rax
mov    (%rax),%eax
mov    0x2b79(%rip),%rcx
or     (%rcx),%eax
and    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xe94(%rip),%rdx
call   1090 <getopt@plt>
cmp    $0xffffffff,%eax
je     11b9 <main+0x49>
lea    0xe83(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <usage@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1090 <getopt@plt>
cmp    $0xffffffff,%eax
jne    11a0 <main+0x30>
mov    0x2e18(%rip),%rax
mov    (%rax),%rbx
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
call   1060 <ttyname@plt>
mov    %rax,%r14
test   %rax,%rax
jne    121b <main+0xab>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
call   1060 <ttyname@plt>
mov    %rax,%r14
test   %rax,%rax
jne    121b <main+0xab>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1060 <ttyname@plt>
mov    %rax,%r14
test   %rax,%rax
jne    121b <main+0xab>
lea    0xdf4(%rip),%rsi
xor    %r14d,%r14d
mov    $0x2,%edi
xor    %eax,%eax
call   1050 <err@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <stat@plt>
test   %rax,%rax
je     123e <main+0xce>
lea    0xdda(%rip),%rsi
mov    $0x2,%edi
xor    %eax,%eax
call   1050 <err@plt>
mov    (%r15,%rbx,8),%rax
test   %rax,%rax
je     127a <main+0x10a>
movsbl (%rax),%eax
cmp    $0x62,%eax
je     12be <main+0x14e>
cmp    $0x79,%eax
je     12db <main+0x16b>
cmp    $0x6e,%eax
jne    131a <main+0x1aa>
mov    0x2d78(%rip),%rax
mov    0x2d61(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
not    %esi
and    (%rsp),%esi
jmp    12f6 <main+0x186>
mov    (%rsp),%eax
mov    0x2d5c(%rip),%rcx
mov    (%rcx),%ecx
and    %eax,%ecx
mov    0x2d41(%rip),%rdx
and    (%rdx),%eax
lea    0xd82(%rip),%rax
lea    0xd79(%rip),%rdx
cmove  %rax,%rdx
test   %ecx,%ecx
lea    0xd5e(%rip),%rsi
cmove  %rdx,%rsi
lea    0xd5a(%rip),%rdi
call   1030 <printf@plt>
jmp    1321 <main+0x1b1>
mov    0x2d1b(%rip),%rax
mov    0x2d04(%rip),%rcx
mov    (%rcx),%ecx
mov    (%rax),%esi
or     %ecx,%esi
not    %esi
and    (%rsp),%esi
or     %ecx,%esi
jmp    12f6 <main+0x186>
mov    0x2cfe(%rip),%rax
mov    (%rax),%eax
mov    0x2ce5(%rip),%rcx
mov    (%rcx),%esi
or     %eax,%esi
not    %esi
and    (%rsp),%esi
or     %eax,%esi
mov    %r14,%rdi
call   1080 <chmod@plt>
test   %eax,%eax
jns    1321 <main+0x1b1>
lea    0xd13(%rip),%rsi
mov    $0x2,%edi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <err@plt>
jmp    1321 <main+0x1b1>
xor    %eax,%eax
call   1070 <usage@plt>
mov    (%rsp),%ecx
mov    0x2cb5(%rip),%rax
mov    0x2c9e(%rip),%rdx
mov    (%rdx),%edx
or     (%rax),%edx
xor    %eax,%eax
test   %ecx,%edx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [1 x i8] zeroinitializer
@optind = global i64 0
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@.str.1 = [12 x i8] c"unknown tty\00"
@.str.2 = [5 x i8] c"stat\00"
@.str.3 = [7 x i8] c"is %s\0A\00"
@S_IXUSR = global i32 0
@.str.4 = [2 x i8] c"y\00"
@S_IXGRP = global i32 0
@.str.5 = [2 x i8] c"b\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, -1
br i1 %6, label %11, label %7
7: ; preds = %2, %7
%8 = tail call i32 (...) @usage()
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %7
11: ; preds = %7, %2
%12 = load i64, i64* @optind
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i32, i32* @STDIN_FILENO
%15 = tail call i8* @ttyname(i32 %14)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %27
17: ; preds = %11
%18 = load i32, i32* @STDOUT_FILENO
%19 = tail call i8* @ttyname(i32 %18)
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load i32, i32* @STDERR_FILENO
%23 = tail call i8* @ttyname(i32 %22)
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = tail call i32 (i32, i8*, ...) @err(i32 2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %21, %17, %11
%28 = phi i8* [ null, %25 ], [ %23, %21 ], [ %19, %17 ], [ %15, %11 ]
%29 = call i64 @stat(i8* %28, %struct.stat* %3)
%30 = icmp eq i64 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %27
%32 = call i32 (i32, i8*, ...) @err(i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = load i8*, i8** %13
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %49
36: ; preds = %33
%37 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%38 = load i32, i32* %37
%39 = load i32, i32* @S_IXUSR
%40 = and i32 %39, %38
%41 = icmp eq i32 %40, 0
%42 = load i32, i32* @S_IXGRP
%43 = and i32 %42, %38
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%46 = select i1 %41, i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
%47 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %46)
%48 = load i32, i32* %37
br label %95
49: ; preds = %33
%50 = load i8, i8* %34
%51 = sext i8 %50 to i32
switch i32 %51, label %90 [
i32 110, label %52
i32 121, label %64
i32 98, label %77
]
52: ; preds = %49
%53 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%54 = load i32, i32* %53
%55 = load i32, i32* @S_IXUSR
%56 = load i32, i32* @S_IXGRP
%57 = or i32 %56, %55
%58 = xor i32 %57, -1
%59 = and i32 %54, %58
%60 = call i32 @chmod(i8* %28, i32 %59)
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %92
62: ; preds = %52
%63 = call i32 (i32, i8*, ...) @err(i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %28)
br label %92
64: ; preds = %49
%65 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%66 = load i32, i32* %65
%67 = load i32, i32* @S_IXUSR
%68 = load i32, i32* @S_IXGRP
%69 = or i32 %68, %67
%70 = xor i32 %69, -1
%71 = and i32 %66, %70
%72 = or i32 %71, %67
%73 = call i32 @chmod(i8* %28, i32 %72)
%74 = icmp slt i32 %73, 0
br i1 %74, label %75, label %92
75: ; preds = %64
%76 = call i32 (i32, i8*, ...) @err(i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %28)
br label %92
77: ; preds = %49
%78 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%79 = load i32, i32* %78
%80 = load i32, i32* @S_IXUSR
%81 = load i32, i32* @S_IXGRP
%82 = or i32 %81, %80
%83 = xor i32 %82, -1
%84 = and i32 %79, %83
%85 = or i32 %84, %81
%86 = call i32 @chmod(i8* %28, i32 %85)
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %92
88: ; preds = %77
%89 = call i32 (i32, i8*, ...) @err(i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %28)
br label %92
90: ; preds = %49
%91 = call i32 (...) @usage()
br label %92
92: ; preds = %77, %88, %64, %75, %52, %62, %90
%93 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%94 = load i32, i32* %93
br label %95
95: ; preds = %92, %36
%96 = phi i32 [ %94, %92 ], [ %48, %36 ]
%97 = load i32, i32* @S_IXUSR
%98 = load i32, i32* @S_IXGRP
%99 = or i32 %98, %97
%100 = and i32 %99, %96
%101 = icmp eq i32 %100, 0
%102 = zext i1 %101 to i32
ret i32 %102
}