#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 option {
  char *member_0;
  float member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt_long(int, char **, char *, struct option *, int *);
int ischroot();
scalar_t__ isfakechroot();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  int default_false = 0;
  int default_true = 0;
  int exit_status;
  for (;;) {
    int c;
    int option_index = 0;
    static struct option long_options[] = {{"default-false", 0, 0, 'f'},
                                           {"default-true", 0, 0, 't'},
                                           {"help", 0, 0, 'h'},
                                           {"version", 0, 0, 'V'},
                                           {0, 0, 0, 0}};
    c = getopt_long(argc, argv, "fthV", long_options, &option_index);
    if (c == EOF)
      break;
    switch (c) {
    case 'f':
      default_false = 1;
      break;
    case 't':
      default_true = 1;
      break;
    case 'h':
      usage();
      break;
    case 'V':
      version();
      break;
    default:
      fprintf(stderr, "Try `ischroot --help' for more information.\n");
      exit(1);
    }
  }
  if (default_false && default_true) {
    fprintf(stderr, "Can't default to both true and false!\n");
    fprintf(stderr, "Try `ischroot --help' for more information.\n");
    exit(1);
  }
  if (isfakechroot())
    exit_status = 0;
  else
    exit_status = ischroot();
  if (exit_status == 2) {
    if (default_true)
      exit_status = 0;
    if (default_false)
      exit_status = 1;
  }
  return exit_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xefb(%rip),%rdx
lea    0x2eb0(%rip),%rcx
lea    -0x24(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    0x2e22(%rip),%rcx
cmp    (%rcx),%eax
jne    11d3 <main+0x63>
jmp    1250 <main+0xe0>
mov    -0x20(%rbp),%eax
add    $0xffffffaa,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x1e,%eax
ja     122c <main+0xbc>
mov    -0x30(%rbp),%rax
lea    0xe0d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x14(%rbp)
jmp    124b <main+0xdb>
movl   $0x1,-0x18(%rbp)
jmp    124b <main+0xdb>
mov    $0x0,%al
call   1080 <usage@plt>
jmp    124b <main+0xdb>
mov    $0x0,%al
call   1060 <version@plt>
jmp    124b <main+0xdb>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1194 <main+0x24>
cmpl   $0x0,-0x14(%rbp)
je     1298 <main+0x128>
cmpl   $0x0,-0x18(%rbp)
je     1298 <main+0x128>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   1040 <isfakechroot@plt>
cmp    $0x0,%rax
je     12b5 <main+0x145>
movl   $0x0,-0x1c(%rbp)
jmp    12bf <main+0x14f>
mov    $0x0,%al
call   1070 <ischroot@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jne    12f0 <main+0x180>
cmpl   $0x0,-0x18(%rbp)
je     12da <main+0x16a>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12eb <main+0x17b>
movl   $0x1,-0x1c(%rbp)
jmp    12f0 <main+0x180>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,(%rsp)
lea    0xf16(%rip),%rdx
lea    0x2ecb(%rip),%rcx
mov    %rsp,%r8
call   1030 <getopt_long@plt>
mov    0x2e44(%rip),%rcx
cmp    (%rcx),%eax
jne    11b2 <main+0x42>
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    1250 <main+0xe0>
lea    0xe47(%rip),%r13
mov    %rsp,%r12
movl   $0x0,0x4(%rsp)
xor    %r14d,%r14d
jmp    1208 <main+0x98>
nopl   0x0(%rax)
movl   $0x1,0x4(%rsp)
mov    %r15d,%r14d
movl   $0x0,(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
lea    0xeb6(%rip),%rdx
lea    0x2e6b(%rip),%rcx
mov    %r12,%r8
call   1030 <getopt_long@plt>
mov    0x2de4(%rip),%rcx
cmp    (%rcx),%eax
je     1239 <main+0xc9>
add    $0xffffffaa,%eax
cmp    $0x1e,%eax
ja     1291 <main+0x121>
mov    %r14d,%r15d
mov    $0x1,%r14d
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <version@plt>
jmp    11d8 <main+0x68>
xor    %eax,%eax
call   1080 <usage@plt>
jmp    11d8 <main+0x68>
mov    0x4(%rsp),%eax
test   %eax,%eax
setne  %bpl
test   %r14d,%r14d
setne  %r14b
je     1250 <main+0xe0>
test   %eax,%eax
jne    12b0 <main+0x140>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <isfakechroot@plt>
test   %rax,%rax
jne    1280 <main+0x110>
xor    %eax,%eax
call   1070 <ischroot@plt>
xor    $0x1,%bpl
movzbl %bpl,%ecx
add    %ecx,%ecx
test   %r14b,%r14b
mov    $0x1,%ebx
cmove  %ecx,%ebx
cmp    $0x2,%eax
cmovne %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
lea    0xe08(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2d21(%rip),%rbx
mov    (%rbx),%edi
lea    0xe16(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
jmp    129a <main+0x12a>

LLVM IR (-O0):
%struct.option = type { i8*, float, i32, i32 }
@main.long_options = internal global [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0), float 0.000000e+00, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), float 0.000000e+00, i32 0, i32 116 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), float 0.000000e+00, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), float 0.000000e+00, i32 0, i32 86 }, %struct.option zeroinitializer]
@.str = [14 x i8] c"default-false\00"
@.str.1 = [13 x i8] c"default-true\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [8 x i8] c"version\00"
@.str.4 = [5 x i8] c"fthV\00"
@EOF = global i32 0
@stderr = global i32 0
@.str.5 = [45 x i8] c"Try `ischroot --help' for more information.\0A\00"
@.str.6 = [39 x i8] c"Can't default to both true and false!\0A\00"
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 i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %11
11: ; preds = %31, %2
store i32 0, i32* %10
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt_long(i32 %12, i8** %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %struct.option* getelementptr inbounds ([5 x %struct.option], [5 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %10)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %11
br label %32
19: ; preds = %11
%20 = load i32, i32* %9
switch i32 %20, label %27 [
i32 102, label %21
i32 116, label %22
i32 104, label %23
i32 86, label %25
]
21: ; preds = %19
store i32 1, i32* %6
br label %31
22: ; preds = %19
store i32 1, i32* %7
br label %31
23: ; preds = %19
%24 = call i32 (...) @usage()
br label %31
25: ; preds = %19
%26 = call i32 (...) @version()
br label %31
27: ; preds = %19
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %25, %23, %22, %21
br label %11
32: ; preds = %18
%33 = load i32, i32* %6
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %44
35: ; preds = %32
%36 = load i32, i32* %7
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %35, %32
%45 = call i64 (...) @isfakechroot()
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %44
store i32 0, i32* %8
br label %50
48: ; preds = %44
%49 = call i32 (...) @ischroot()
store i32 %49, i32* %8
br label %50
50: ; preds = %48, %47
%51 = load i32, i32* %8
%52 = icmp eq i32 %51, 2
br i1 %52, label %53, label %62
53: ; preds = %50
%54 = load i32, i32* %7
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %53
store i32 0, i32* %8
br label %57
57: ; preds = %56, %53
%58 = load i32, i32* %6
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %57
store i32 1, i32* %8
br label %61
61: ; preds = %60, %57
br label %62
62: ; preds = %61, %50
%63 = load i32, i32* %8
ret i32 %63
}

LLVM IR (-O2):
%struct.option = type { i8*, float, i32, i32 }
@main.long_options = internal global [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0), float 0.000000e+00, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), float 0.000000e+00, i32 0, i32 116 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), float 0.000000e+00, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), float 0.000000e+00, i32 0, i32 86 }, %struct.option zeroinitializer]
@.str = [14 x i8] c"default-false\00"
@.str.1 = [13 x i8] c"default-true\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [8 x i8] c"version\00"
@.str.4 = [5 x i8] c"fthV\00"
@EOF = global i32 0
@stderr = global i32 0
@.str.5 = [45 x i8] c"Try `ischroot --help' for more information.\0A\00"
@.str.6 = [39 x i8] c"Can't default to both true and false!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %struct.option* getelementptr inbounds ([5 x %struct.option], [5 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %3)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %38
9: ; preds = %2, %22
%10 = phi i32 [ %25, %22 ], [ %5, %2 ]
%11 = phi i32 [ %24, %22 ], [ 0, %2 ]
%12 = phi i32 [ %23, %22 ], [ 0, %2 ]
switch i32 %10, label %18 [
i32 102, label %22
i32 116, label %13
i32 104, label %14
i32 86, label %16
]
13: ; preds = %9
br label %22
14: ; preds = %9
%15 = call i32 (...) @usage()
br label %22
16: ; preds = %9
%17 = call i32 (...) @version()
br label %22
18: ; preds = %9
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %13, %14, %16, %9
%23 = phi i32 [ %12, %16 ], [ %12, %14 ], [ %12, %13 ], [ 1, %9 ]
%24 = phi i32 [ %11, %16 ], [ %11, %14 ], [ 1, %13 ], [ %11, %9 ]
store i32 0, i32* %3
%25 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %struct.option* getelementptr inbounds ([5 x %struct.option], [5 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %3)
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %9
28: ; preds = %22
%29 = icmp ne i32 %23, 0
%30 = icmp ne i32 %24, 0
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %8, %28
%39 = phi i1 [ false, %8 ], [ %30, %28 ]
%40 = phi i1 [ false, %8 ], [ %29, %28 ]
%41 = call i64 (...) @isfakechroot()
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %38
%44 = call i32 (...) @ischroot()
%45 = icmp eq i32 %44, 2
%46 = select i1 %39, i32 0, i32 2
%47 = select i1 %40, i32 1, i32 %46
%48 = select i1 %45, i32 %47, i32 %44
br label %49
49: ; preds = %43, %38
%50 = phi i32 [ 0, %38 ], [ %48, %43 ]
ret i32 %50
}