#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_join();
int server_prepare(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_prepare(argv[1], argv[2])) {
    logger_log("[main] starting the server...\n");
    server_run();
    server_join();
  } else {
    logger_log("[main] server has not started\n");
  }
  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   1060 <logger_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1070 <server_prepare@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11fd <main+0x8d>
lea    0xe30(%rip),%rdi
call   1090 <logger_log@plt>
mov    $0x0,%al
call   1040 <server_run@plt>
mov    $0x0,%al
call   1080 <server_join@plt>
jmp    1209 <main+0x99>
lea    0xe30(%rip),%rdi
call   1090 <logger_log@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    11ae <main+0x3e>
xor    %eax,%eax
call   1060 <logger_init@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1070 <server_prepare@plt>
cmp    $0xffffffff,%eax
je     11c4 <main+0x54>
lea    0xe7c(%rip),%rdi
call   1090 <logger_log@plt>
xor    %eax,%eax
call   1040 <server_run@plt>
xor    %eax,%eax
call   1080 <server_join@plt>
jmp    11d0 <main+0x60>
mov    (%rbx),%rsi
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%ebx
jmp    11e5 <main+0x75>
lea    0xe69(%rip),%rdi
call   1090 <logger_log@plt>
lea    0xe7c(%rip),%rdi
call   1090 <logger_log@plt>
xor    %ebx,%ebx
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_prepare(i8* %17, i8* %20)
%22 = icmp ne i32 -1, %21
br i1 %22, label %23, label %27
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()
%26 = call i32 (...) @server_join()
br label %29
27: ; preds = %13
%28 = call i32 @logger_log(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %23
%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 = %29, %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_prepare(i8* %10, i8* %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %19, 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()
%18 = tail call i32 (...) @server_join()
br label %21
19: ; preds = %7
%20 = tail call i32 @logger_log(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%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 = %21, %4
%25 = phi i32 [ 1, %4 ], [ 0, %21 ]
ret i32 %25
}