#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*/ do_epoll(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ printf(char *, ...);
int socket_bind(char *, int);
int main(int argc, char *argv[]) {
  int listenfd;
  printf("Creating socket!\n");
  listenfd = socket_bind("127.0.0.1", 60002);
  printf("Socket %d created and binded!\n", listenfd);
  listen(listenfd, 5);
  printf("Listening %s:%d\n", "127.0.0.1", 60002);
  do_epoll(listenfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0xea62,%esi
call   1040 <socket_bind@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   1060 <listen@plt>
lea    0xe9e(%rip),%rdi
lea    0xe6e(%rip),%rsi
mov    $0xea62,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <do_epoll@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xee0(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9a(%rip),%rbx
mov    %rbx,%rdi
mov    $0xea62,%esi
call   1050 <socket_bind@plt>
mov    %eax,%ebp
lea    0xe8e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1070 <listen@plt>
lea    0xe91(%rip),%rdi
mov    %rbx,%rsi
mov    $0xea62,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
call   1030 <do_epoll@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Creating socket!\0A\00"
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [31 x i8] c"Socket %d created and binded!\0A\00"
@.str.3 = [17 x i8] c"Listening %s:%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @socket_bind(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 60002)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %6
%12 = call i32 @listen(i32 %11, i32 5)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 60002)
%14 = load i32, i32* %6
%15 = call i32 @do_epoll(i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [31 x i8] c"Socket %d created and binded!\0A\00"
@.str.3 = [17 x i8] c"Listening %s:%d\0A\00"
@str = [17 x i8] c"Creating socket!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @socket_bind(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 60002)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 @listen(i32 %4, i32 5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 60002)
%8 = tail call i32 @do_epoll(i32 %4)
ret i32 0
}