#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 daemon_main(int, char **);
int interface_help(char *);
int interface_main(int, char **);
int list_daemons(char *);
int /*<<< orphan*/ set_command_name(char *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  set_command_name(argv[0]);
  if (argc == 1)
    return list_daemons(argv[0]);
  if (argc > 1 && strncmp(argv[1], "-d", 2) == 0)
    return daemon_main(argc, argv);
  else if (argc > 1 && strcmp(argv[1], "-h") == 0)
    return interface_help(argv[0]);
  else
    return interface_main(argc, argv);
}


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    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <set_command_name@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11b0 <main+0x40>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <list_daemons@plt>
mov    %eax,-0x4(%rbp)
jmp    123c <main+0xcc>
cmpl   $0x1,-0x8(%rbp)
jle    11f1 <main+0x81>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe37(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11f1 <main+0x81>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <daemon_main@plt>
mov    %eax,-0x4(%rbp)
jmp    123c <main+0xcc>
cmpl   $0x1,-0x8(%rbp)
jle    122d <main+0xbd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf9(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    122d <main+0xbd>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <interface_help@plt>
mov    %eax,-0x4(%rbp)
jmp    123c <main+0xcc>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <interface_main@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
call   1060 <set_command_name@plt>
cmp    $0x1,%ebp
jne    1193 <main+0x23>
mov    (%rbx),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1090 <list_daemons@plt>
jle    11c4 <main+0x54>
mov    0x8(%rbx),%rdi
lea    0xe60(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d4 <main+0x64>
mov    0x8(%rbx),%rdi
lea    0xe49(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11e4 <main+0x74>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <interface_main@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1080 <daemon_main@plt>
mov    (%rbx),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <interface_help@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-d\00"
@.str.1 = [3 x i8] c"-h\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 i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @set_command_name(i8* %8)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @list_daemons(i8* %15)
store i32 %16, i32* %3
br label %48
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = load i32, i32* %4
%28 = load i8**, i8*** %5
%29 = call i32 @daemon_main(i32 %27, i8** %28)
store i32 %29, i32* %3
br label %48
30: ; preds = %20, %17
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 1
br i1 %32, label %33, label %44
33: ; preds = %30
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %33
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 0
%42 = load i8*, i8** %41
%43 = call i32 @interface_help(i8* %42)
store i32 %43, i32* %3
br label %48
44: ; preds = %33, %30
%45 = load i32, i32* %4
%46 = load i8**, i8*** %5
%47 = call i32 @interface_main(i32 %45, i8** %46)
store i32 %47, i32* %3
br label %48
48: ; preds = %44, %39, %26, %12
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [3 x i8] c"-d\00"
@.str.1 = [3 x i8] c"-h\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @set_command_name(i8* %3)
%5 = icmp eq i32 %0, 1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @list_daemons(i8* %7)
br label %27
9: ; preds = %2
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %25
11: ; preds = %9
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 @daemon_main(i32 %0, i8** %1)
br label %27
18: ; preds = %11
%19 = load i8*, i8** %12
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i8*, i8** %1
%24 = tail call i32 @interface_help(i8* %23)
br label %27
25: ; preds = %9, %18
%26 = tail call i32 @interface_main(i32 %0, i8** %1)
br label %27
27: ; preds = %25, %22, %16, %6
%28 = phi i32 [ %8, %6 ], [ %17, %16 ], [ %24, %22 ], [ %26, %25 ]
ret i32 %28
}