#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*/ SIGCHLD;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ je_dbus_fini();
int /*<<< orphan*/ je_dbus_init();
int /*<<< orphan*/ je_dbus_listen_events();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read_config();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 1) {
    printf("Usage: %s\n", argv[0]);
    exit(254);
  }
  if (!read_config()) {
    fprintf(stderr, "Unable to read config\n");
    exit(16);
  }
  signal(SIGCHLD, SIG_IGN);
  if (!je_dbus_init()) {
    fprintf(stderr, "Unable to initialize D-Bus\n");
    exit(1);
  }
  je_dbus_listen_events();
  je_dbus_fini();
  return 0;
}


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     11bd <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
mov    $0xfe,%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   1070 <read_config@plt>
cmp    $0x0,%eax
jne    11ec <main+0x6c>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
lea    0xe2e(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x10,%edi
call   1090 <exit@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
mov    0x2de4(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
mov    $0x0,%al
call   1080 <je_dbus_init@plt>
cmp    $0x0,%eax
jne    1232 <main+0xb2>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
lea    0xdff(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   10a0 <je_dbus_listen_events@plt>
mov    $0x0,%al
call   1030 <je_dbus_fini@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jne    11c5 <main+0x45>
xor    %eax,%eax
call   1070 <read_config@plt>
test   %eax,%eax
je     11de <main+0x5e>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    0x2e3f(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
xor    %eax,%eax
call   1080 <je_dbus_init@plt>
test   %eax,%eax
je     11fd <main+0x7d>
xor    %eax,%eax
call   10a0 <je_dbus_listen_events@plt>
xor    %eax,%eax
call   1030 <je_dbus_fini@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    (%rsi),%rsi
lea    0xe31(%rip),%rdi
call   1040 <printf@plt>
mov    $0xfe,%edi
call   1090 <exit@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x10,%edi
call   1090 <exit@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Usage: %s\0A\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unable to read config\0A\00"
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
@.str.2 = [28 x i8] c"Unable to initialize D-Bus\0A\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 %14
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 254)
unreachable
14: ; preds = %2
%15 = call i32 (...) @read_config()
%16 = icmp ne i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @exit(i32 16)
unreachable
21: ; preds = %14
%22 = load i32, i32* @SIGCHLD
%23 = load i32, i32* @SIG_IGN
%24 = call i32 @signal(i32 %22, i32 %23)
%25 = call i32 (...) @je_dbus_init()
%26 = icmp ne i32 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %21
%32 = call i32 (...) @je_dbus_listen_events()
%33 = call i32 (...) @je_dbus_fini()
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Usage: %s\0A\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unable to read config\0A\00"
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
@.str.2 = [28 x i8] c"Unable to initialize D-Bus\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 254)
unreachable
8: ; preds = %2
%9 = tail call i32 (...) @read_config()
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @exit(i32 16)
unreachable
15: ; preds = %8
%16 = load i32, i32* @SIGCHLD
%17 = load i32, i32* @SIG_IGN
%18 = tail call i32 @signal(i32 %16, i32 %17)
%19 = tail call i32 (...) @je_dbus_init()
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %15
%26 = tail call i32 (...) @je_dbus_listen_events()
%27 = tail call i32 (...) @je_dbus_fini()
ret i32 0
}