#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*/ logger_destroy();
int /*<<< orphan*/ logger_init();
int /*<<< orphan*/ logger_log(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ server_destroy();
int server_init(char *, char *);
int /*<<< orphan*/ server_run();
int main(int argc, char **argv) {
  if (3 != argc) {
    printf("Usage: %s host port\n", argv[0]);
    return 1;
  }
  logger_init();
  if (-1 != server_init(argv[1], argv[2])) {
    logger_log("[main] starting the server...\n");
    server_run();
  } else {
    logger_log("[main] server has not started\n");
  }
  server_destroy();
  logger_log("[main] server has shut down\n");
  logger_destroy();
  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)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
je     11b3 <main+0x43>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1223 <main+0xb3>
mov    $0x0,%al
call   1070 <logger_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1080 <server_init@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11f6 <main+0x86>
lea    0xe30(%rip),%rdi
call   1090 <logger_log@plt>
mov    $0x0,%al
call   1040 <server_run@plt>
jmp    1202 <main+0x92>
lea    0xe37(%rip),%rdi
call   1090 <logger_log@plt>
mov    $0x0,%al
call   1060 <server_destroy@plt>
lea    0xe43(%rip),%rdi
call   1090 <logger_log@plt>
mov    $0x0,%al
call   1050 <logger_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11a7 <main+0x37>
xor    %eax,%eax
call   1070 <logger_init@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1080 <server_init@plt>
cmp    $0xffffffff,%eax
je     11bd <main+0x4d>
lea    0xe7c(%rip),%rdi
call   1090 <logger_log@plt>
xor    %eax,%eax
call   1040 <server_run@plt>
jmp    11c9 <main+0x59>
mov    (%rbx),%rsi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%ebx
jmp    11e5 <main+0x75>
lea    0xe70(%rip),%rdi
call   1090 <logger_log@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <server_destroy@plt>
lea    0xe7a(%rip),%rdi
call   1090 <logger_log@plt>
xor    %eax,%eax
call   1050 <logger_destroy@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Usage: %s host port\0A\00"
@.str.1 = [31 x i8] c"[main] starting the server...\0A\00"
@.str.2 = [31 x i8] c"[main] server has not started\0A\00"
@.str.3 = [29 x i8] c"[main] server has shut down\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 3, %6
br i1 %7, label %8, label %13
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 ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 1, i32* %3
br label %32
13: ; preds = %2
%14 = call i32 (...) @logger_init()
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @server_init(i8* %17, i8* %20)
%22 = icmp ne i32 -1, %21
br i1 %22, label %23, label %26
23: ; preds = %13
%24 = call i32 @logger_log(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 (...) @server_run()
br label %28
26: ; preds = %13
%27 = call i32 @logger_log(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = call i32 (...) @server_destroy()
%30 = call i32 @logger_log(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 (...) @logger_destroy()
store i32 0, i32* %3
br label %32
32: ; preds = %28, %8
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str = [21 x i8] c"Usage: %s host port\0A\00"
@.str.1 = [31 x i8] c"[main] starting the server...\0A\00"
@.str.2 = [31 x i8] c"[main] server has not started\0A\00"
@.str.3 = [29 x i8] c"[main] server has shut down\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %24
7: ; preds = %2
%8 = tail call i32 (...) @logger_init()
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @server_init(i8* %10, i8* %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %18, label %15
15: ; preds = %7
%16 = tail call i32 @logger_log(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 (...) @server_run()
br label %20
18: ; preds = %7
%19 = tail call i32 @logger_log(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = tail call i32 (...) @server_destroy()
%22 = tail call i32 @logger_log(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%23 = tail call i32 (...) @logger_destroy()
br label %24
24: ; preds = %20, %4
%25 = phi i32 [ 1, %4 ], [ 0, %20 ]
ret i32 %25
}