#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*/ error_exit(char *);
int load_users();
int make_socket(char *, int);
int /*<<< orphan*/ serve(int);
int main(int argc, char **argv) {
  if (load_users() == -1)
    error_exit("Error loading user file");
  char *port_str = (argc > 1) ? argv[1] : NULL;
  int sockfd = make_socket(port_str, 1);
  serve(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <load_users@plt>
cmp    $0xffffffff,%eax
jne    1172 <main+0x32>
lea    0xe93(%rip),%rdi
call   1030 <error_exit@plt>
cmpl   $0x1,-0x8(%rbp)
jle    118d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1198 <main+0x58>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1198 <main+0x58>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1060 <make_socket@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <serve@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <load_users@plt>
cmp    $0xffffffff,%eax
je     115f <main+0x1f>
cmp    $0x2,%ebp
jl     1170 <main+0x30>
mov    0x8(%rbx),%rdi
jmp    1172 <main+0x32>
lea    0xe9a(%rip),%rdi
call   1030 <error_exit@plt>
cmp    $0x2,%ebp
jge    1159 <main+0x19>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <make_socket@plt>
mov    %eax,%edi
call   1040 <serve@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Error loading user file\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @load_users()
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @error_exit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
br label %20
19: ; preds = %12
br label %20
20: ; preds = %19, %15
%21 = phi i8* [ %18, %15 ], [ null, %19 ]
store i8* %21, i8** %6
%22 = load i8*, i8** %6
%23 = call i32 @make_socket(i8* %22, i32 1)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = call i32 @serve(i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Error loading user file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @load_users()
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @error_exit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
br label %12
12: ; preds = %7, %9
%13 = phi i8* [ %11, %9 ], [ null, %7 ]
%14 = tail call i32 @make_socket(i8* %13, i32 1)
%15 = tail call i32 @serve(i32 %14)
ret i32 0
}