#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 /*<<< orphan*/ daemon(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ geteuid();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ run();
int main(int argc, char **argv) {
  if (geteuid() != 0) {
    printf("Error : Cpu auto hotplug must be run as root !\n");
    return 0;
  }
  if (!daemon(0, 0)) {
    run();
  } else {
    printf("Failed to start daemon");
  }
  return 1;
}


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)
mov    $0x0,%al
call   1050 <geteuid@plt>
cmp    $0x0,%rax
je     117f <main+0x3f>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <main+0x70>
xor    %esi,%esi
mov    %esi,%edi
call   1060 <daemon@plt>
cmp    $0x0,%eax
jne    119d <main+0x5d>
mov    $0x0,%al
call   1030 <run@plt>
jmp    11a9 <main+0x69>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <geteuid@plt>
test   %rax,%rax
je     116d <main+0x1d>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
jmp    1194 <main+0x44>
xor    %edi,%edi
xor    %esi,%esi
call   1070 <daemon@plt>
test   %eax,%eax
je     1188 <main+0x38>
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
jmp    118f <main+0x3f>
xor    %eax,%eax
call   1040 <run@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Error : Cpu auto hotplug must be run as root !\0A\00"
@.str.1 = [23 x i8] c"Failed to start daemon\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 = call i64 (...) @geteuid()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %18
10: ; preds = %2
%11 = call i32 @daemon(i32 0, i32 0)
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 (...) @run()
br label %17
15: ; preds = %10
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
store i32 1, i32* %3
br label %18
18: ; preds = %17, %8
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"Failed to start daemon\00"
@str = [47 x i8] c"Error : Cpu auto hotplug must be run as root !\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @geteuid()
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
br label %14
7: ; preds = %2
%8 = tail call i32 @daemon(i32 0, i32 0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 (...) @run()
br label %14
12: ; preds = %7
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %10, %12, %5
%15 = phi i32 [ 0, %5 ], [ 1, %12 ], [ 1, %10 ]
ret i32 %15
}