#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 */

/* Variables and functions */
int check_device();
int /*<<< orphan*/ error(char *);
scalar_t__ getenv(char *);
scalar_t__ getuid();
int main(int argc, char *argv[]) {
  if (argc != 1)
    error("Invalid args");
  if (getuid() != 0)
    error("Failed root test");
  if (getenv("PATH"))
    error("Failed env test");
  if (getenv("PATH"))
    error("Only run on ADD event");
  return check_device();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     116c <main+0x2c>
lea    0xe99(%rip),%rdi
call   1060 <error@plt>
mov    $0x0,%al
call   1040 <getuid@plt>
cmp    $0x0,%rax
je     1189 <main+0x49>
lea    0xe89(%rip),%rdi
call   1060 <error@plt>
lea    0xe8e(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11ab <main+0x6b>
lea    0xe7d(%rip),%rdi
call   1060 <error@plt>
lea    0xe6c(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11cd <main+0x8d>
lea    0xe6b(%rip),%rdi
call   1060 <error@plt>
mov    $0x0,%al
call   1050 <check_device@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
je     1152 <main+0x12>
lea    0xeb3(%rip),%rdi
call   1060 <error@plt>
xor    %eax,%eax
call   1040 <getuid@plt>
test   %rax,%rax
je     116a <main+0x2a>
lea    0xea8(%rip),%rdi
call   1060 <error@plt>
lea    0xead(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1187 <main+0x47>
lea    0xea1(%rip),%rdi
call   1060 <error@plt>
lea    0xe90(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11a4 <main+0x64>
lea    0xe94(%rip),%rdi
call   1060 <error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <check_device@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Invalid args\00"
@.str.1 = [17 x i8] c"Failed root test\00"
@.str.2 = [5 x i8] c"PATH\00"
@.str.3 = [16 x i8] c"Failed env test\00"
@.str.4 = [22 x i8] c"Only run on ADD event\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = call i64 (...) @getuid()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = call i64 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = call i64 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = call i32 (...) @check_device()
ret i32 %26
}

LLVM IR (-O2):
@.str = [13 x i8] c"Invalid args\00"
@.str.1 = [17 x i8] c"Failed root test\00"
@.str.2 = [5 x i8] c"PATH\00"
@.str.3 = [16 x i8] c"Failed env test\00"
@.str.4 = [22 x i8] c"Only run on ADD event\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = tail call i64 (...) @getuid()
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = tail call i64 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = tail call i64 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = tail call i32 (...) @check_device()
ret i32 %22
}