#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 */
struct sockaddr_storage {
  int dummy;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  scalar_t__ ai_addr;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  int /*<<< orphan*/ ai_flags;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ cliente;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int NI_MAXHOST;
int NI_MAXSERV;
int NI_NUMERICHOST;
int NI_NUMERICSERV;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ _exit(int);
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ getaddrinfo(char *, char *, struct addrinfo *,
                               struct addrinfo **);
int /*<<< orphan*/ getnameinfo(struct sockaddr *, int, char *, int, char *, int,
                               int);
scalar_t__ listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int sd, info;
  struct addrinfo hints;
  struct addrinfo *res;
  char buffer[80];
  int sdC = 0;
  int r = 0;
  hints.ai_flags = AI_PASSIVE;
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = 0;
  if (argc < 2) {
    perror("Error de argumentos.\n");
  }
  getaddrinfo("::1", argv[1], &hints, &res);
  printf("Creando socket.\n");
  sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
  printf("Bind\n");
  bind(sd, (struct sockaddr *)res->ai_addr, res->ai_addrlen);
  struct sockaddr_storage cliente;
  socklen_t cliente_len = sizeof(cliente);
  char host[NI_MAXHOST];
  char serv[NI_MAXSERV];
  printf("Listen\n");
  if (listen(sd, 10)) {
    return -1;
  }
  printf("Accept\n");
  sdC = accept(sd, (struct sockaddr *)&cliente, &cliente_len);
  while (1) {
    printf("Recibiendo.\n");
    r = recv(sdC, buffer, 80, 0);
    buffer[r] = '\0';
    if (strcmp(buffer, "q") == 0 || strcmp(buffer, "q\n") == 0) {
      send(sdC, "ADIÓS..\n", 9, 0);
      freeaddrinfo(res);
      close(sd);
      printf("Conexión terminada\n");
      _exit(1);
    }
    getnameinfo((struct sockaddr *)&cliente, cliente_len, host, NI_MAXHOST,
                serv, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV);
    printf("Host: %s, Puerto: %s\n", host, serv);
    printf("Mensaje (%i): %s\n", r, buffer);
    send(sdC, buffer, r, 0);
    sleep(5);
  }
  freeaddrinfo(res);
  close(sdC);
  close(sd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
mov    0x2dbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    125f <main+0x6f>
lea    0xda6(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xda8(%rip),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10e0 <getaddrinfo@plt>
lea    0xd98(%rip),%rdi
xor    %eax,%eax
mov    %al,-0xe1(%rbp)
call   1060 <printf@plt>
mov    -0x48(%rbp),%rax
mov    0x1c(%rax),%edi
mov    0x18(%rax),%esi
mov    0x10(%rax),%rdx
call   1110 <socket@plt>
mov    %eax,%ecx
mov    -0xe1(%rbp),%al
mov    %ecx,-0x14(%rbp)
lea    0xd77(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rsi
mov    (%rax),%edx
call   10b0 <bind@plt>
movl   $0x4,-0xb4(%rbp)
mov    0x2cd4(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0xc0(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xe0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc8(%rbp)
mov    0x2cbf(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xd8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xd0(%rbp)
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0xa,%esi
call   10a0 <listen@plt>
cmp    $0x0,%rax
je     1373 <main+0x183>
movl   $0xffffffff,-0x4(%rbp)
mov    -0xc0(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret
lea    0xcbf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0xb0(%rbp),%rsi
lea    -0xb4(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,-0xa4(%rbp)
jmp    13a2 <main+0x1b2>
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xa4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0xa8(%rbp)
movslq -0xa8(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    -0xa0(%rbp),%rdi
lea    0xc62(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1418 <main+0x228>
lea    -0xa0(%rbp),%rdi
lea    0xc47(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    145a <main+0x26a>
mov    -0xa4(%rbp),%edi
lea    0xc2e(%rip),%rsi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    -0x48(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    0xc14(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1040 <_exit@plt>
mov    -0xd8(%rbp),%r8
mov    -0xe0(%rbp),%rdx
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
mov    0x2b34(%rip),%rax
mov    (%rax),%ecx
mov    0x2b4b(%rip),%rax
mov    (%rax),%r9d
mov    0x2b29(%rip),%rax
mov    (%rax),%eax
mov    0x2b50(%rip),%r10
or     (%r10),%eax
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1080 <getnameinfo@plt>
mov    -0xe0(%rbp),%rsi
mov    -0xd8(%rbp),%rdx
add    $0x10,%rsp
lea    0xbb2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xa8(%rbp),%esi
lea    -0xa0(%rbp),%rdx
lea    0xbad(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xa4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0xa8(%rbp),%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    $0x5,%edi
call   10f0 <sleep@plt>
jmp    139d <main+0x1ad>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rbx
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2dae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
cmp    $0x1,%edi
jle    1314 <main+0x114>
mov    0x8(%rbx),%rsi
lea    0xdbf(%rip),%rdi
lea    -0x70(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10f0 <getaddrinfo@plt>
lea    0xde6(%rip),%rdi
call   1050 <puts@plt>
mov    -0x40(%rbp),%rax
mov    0x1c(%rax),%edi
mov    0x18(%rax),%esi
mov    0x10(%rax),%rdx
call   1120 <socket@plt>
mov    %eax,%ebx
lea    0xdd5(%rip),%rdi
call   1050 <puts@plt>
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rsi
mov    (%rax),%edx
mov    %ebx,%edi
call   10c0 <bind@plt>
mov    %rsp,%r14
movl   $0x4,-0x30(%rbp)
mov    0x2cfd(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x2d03(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    0xd7f(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
mov    $0xa,%esi
call   10b0 <listen@plt>
test   %rax,%rax
je     1325 <main+0x125>
mov    %r14,%rsp
mov    $0xffffffff,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xce5(%rip),%rdi
call   10d0 <perror@plt>
jmp    124c <main+0x4c>
lea    0xd41(%rip),%rdi
call   1050 <puts@plt>
lea    -0x38(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    %ebx,-0x44(%rbp)
mov    %ebx,%edi
call   10e0 <accept@plt>
mov    %eax,%r12d
lea    0xd27(%rip),%rdi
call   1050 <puts@plt>
lea    -0xc0(%rbp),%rbx
mov    %r12d,-0x2c(%rbp)
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%r12d
cltq
movb   $0x0,-0xc0(%rbp,%rax,1)
lea    0xc97(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     147b <main+0x27b>
lea    -0xc0(%rbp),%r14
mov    -0x2c(%rbp),%ebx
xchg   %ax,%ax
mov    %r14,%rdi
lea    0xc72(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     147b <main+0x27b>
mov    -0x30(%rbp),%esi
mov    0x2bee(%rip),%rax
mov    (%rax),%ecx
mov    0x2c05(%rip),%rax
mov    (%rax),%r9d
mov    0x2c13(%rip),%rax
mov    (%rax),%eax
mov    0x2bda(%rip),%rdx
or     (%rdx),%eax
sub    $0x8,%rsp
lea    -0x38(%rbp),%rdi
mov    %r15,%rdx
mov    %r13,%r8
push   %rax
call   1090 <getnameinfo@plt>
add    $0x10,%rsp
lea    0xc2a(%rip),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc2c(%rip),%rdi
mov    %r12d,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r12d,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    $0x5,%edi
call   1100 <sleep@plt>
lea    0xc34(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%r12d
cltq
movb   $0x0,-0xc0(%rbp,%rax,1)
mov    %r14,%rdi
lea    0xbad(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    13a0 <main+0x1a0>
lea    0xb9d(%rip),%rsi
mov    -0x2c(%rbp),%edi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0x40(%rbp),%rdi
call   1110 <freeaddrinfo@plt>
mov    -0x44(%rbp),%edi
call   1080 <close@plt>
lea    0xbd7(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i64, i64, i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"Error de argumentos.\0A\00"
@.str.1 = [4 x i8] c"::1\00"
@.str.2 = [17 x i8] c"Creando socket.\0A\00"
@.str.3 = [6 x i8] c"Bind\0A\00"
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@.str.4 = [8 x i8] c"Listen\0A\00"
@.str.5 = [8 x i8] c"Accept\0A\00"
@.str.6 = [13 x i8] c"Recibiendo.\0A\00"
@.str.7 = [2 x i8] c"q\00"
@.str.8 = [3 x i8] c"q\0A\00"
@.str.9 = [10 x i8] c"ADI\C3\93S..\0A\00"
@.str.10 = [21 x i8] c"Conexi\C3\B3n terminada\0A\00"
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.11 = [22 x i8] c"Host: %s, Puerto: %s\0A\00"
@.str.12 = [18 x i8] c"Mensaje (%i): %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.addrinfo
%9 = alloca %struct.addrinfo*
%10 = alloca [80 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.sockaddr_storage
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
store i32 0, i32* %12
%18 = load i32, i32* @AI_PASSIVE
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 5
store i32 %18, i32* %19
%20 = load i32, i32* @AF_UNSPEC
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 4
store i32 %20, i32* %21
%22 = load i32, i32* @SOCK_STREAM
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 3
store i32 %22, i32* %23
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 2
store i64 0, i64* %24
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 2
br i1 %26, label %27, label %29
27: ; preds = %2
%28 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %29
29: ; preds = %27, %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @getaddrinfo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %32, %struct.addrinfo* %8, %struct.addrinfo** %9)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%35 = load %struct.addrinfo*, %struct.addrinfo** %9
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %35, i32 0, i32 4
%37 = load i32, i32* %36
%38 = load %struct.addrinfo*, %struct.addrinfo** %9
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %38, i32 0, i32 3
%40 = load i32, i32* %39
%41 = load %struct.addrinfo*, %struct.addrinfo** %9
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i32 0, i32 2
%43 = load i64, i64* %42
%44 = call i32 @socket(i32 %37, i32 %40, i64 %43)
store i32 %44, i32* %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%46 = load i32, i32* %6
%47 = load %struct.addrinfo*, %struct.addrinfo** %9
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %47, i32 0, i32 1
%49 = load i64, i64* %48
%50 = inttoptr i64 %49 to %struct.sockaddr*
%51 = load %struct.addrinfo*, %struct.addrinfo** %9
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i32 0, i32 0
%53 = load i32, i32* %52
%54 = call i32 @bind(i32 %46, %struct.sockaddr* %50, i32 %53)
store i32 4, i32* %14
%55 = load i32, i32* @NI_MAXHOST
%56 = zext i32 %55 to i64
%57 = call i8* @llvm.stacksave()
store i8* %57, i8** %15
%58 = alloca i8, i64 %56
store i64 %56, i64* %16
%59 = load i32, i32* @NI_MAXSERV
%60 = zext i32 %59 to i64
%61 = alloca i8, i64 %60
store i64 %60, i64* %17
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%63 = load i32, i32* %6
%64 = call i64 @listen(i32 %63, i32 10)
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %29
store i32 -1, i32* %3
%67 = load i8*, i8** %15
%68 = load i32, i32* %3
ret i32 %68
69: ; preds = %29
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%71 = load i32, i32* %6
%72 = bitcast %struct.sockaddr_storage* %13 to %struct.sockaddr*
%73 = call i32 @accept(i32 %71, %struct.sockaddr* %72, i32* %14)
store i32 %73, i32* %11
br label %74
74: ; preds = %99, %69
br label %75
75: ; preds = %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%77 = load i32, i32* %11
%78 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%79 = call i32 @recv(i32 %77, i8* %78, i32 80, i32 0)
store i32 %79, i32* %12
%80 = load i32, i32* %12
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 %81
store i8 0, i8* %82
%83 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%84 = call i64 @strcmp(i8* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %90, label %86
86: ; preds = %75
%87 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%88 = call i64 @strcmp(i8* %87, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %99
90: ; preds = %86, %75
%91 = load i32, i32* %11
%92 = call i32 @send(i32 %91, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 9, i32 0)
%93 = load %struct.addrinfo*, %struct.addrinfo** %9
%94 = call i32 @freeaddrinfo(%struct.addrinfo* %93)
%95 = load i32, i32* %6
%96 = call i32 @close(i32 %95)
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
%98 = call i32 @_exit(i32 1)
unreachable
99: ; preds = %86
%100 = bitcast %struct.sockaddr_storage* %13 to %struct.sockaddr*
%101 = load i32, i32* %14
%102 = load i32, i32* @NI_MAXHOST
%103 = load i32, i32* @NI_MAXSERV
%104 = load i32, i32* @NI_NUMERICHOST
%105 = load i32, i32* @NI_NUMERICSERV
%106 = or i32 %104, %105
%107 = call i32 @getnameinfo(%struct.sockaddr* %100, i32 %101, i8* %58, i32 %102, i8* %61, i32 %103, i32 %106)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %58, i8* %61)
%109 = load i32, i32* %12
%110 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %109, i8* %110)
%112 = load i32, i32* %11
%113 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%114 = load i32, i32* %12
%115 = call i32 @send(i32 %112, i8* %113, i32 %114, i32 0)
%116 = call i32 @sleep(i32 5)
br label %74
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i64, i64, i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"Error de argumentos.\0A\00"
@.str.1 = [4 x i8] c"::1\00"
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@.str.7 = [2 x i8] c"q\00"
@.str.8 = [3 x i8] c"q\0A\00"
@.str.9 = [10 x i8] c"ADI\C3\93S..\0A\00"
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.11 = [22 x i8] c"Host: %s, Puerto: %s\0A\00"
@.str.12 = [18 x i8] c"Mensaje (%i): %s\0A\00"
@str = [16 x i8] c"Creando socket.\00"
@str.13 = [5 x i8] c"Bind\00"
@str.14 = [7 x i8] c"Listen\00"
@str.15 = [7 x i8] c"Accept\00"
@str.16 = [12 x i8] c"Recibiendo.\00"
@str.17 = [20 x i8] c"Conexi\C3\B3n terminada\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca [80 x i8]
%6 = alloca %struct.sockaddr_storage
%7 = alloca i32
%8 = bitcast %struct.addrinfo* %3 to i8*
%9 = bitcast %struct.addrinfo** %4 to i8*
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%11 = load i32, i32* @AI_PASSIVE
%12 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %11, i32* %12
%13 = load i32, i32* @AF_UNSPEC
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %13, i32* %14
%15 = load i32, i32* @SOCK_STREAM
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %15, i32* %16
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i64 0, i64* %17
%18 = icmp slt i32 %0, 2
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %2
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @getaddrinfo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %23, %struct.addrinfo* %3, %struct.addrinfo** %4)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%26 = load %struct.addrinfo*, %struct.addrinfo** %4
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %26, i64 0, i32 4
%28 = load i32, i32* %27
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %26, i64 0, i32 3
%30 = load i32, i32* %29
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %26, i64 0, i32 2
%32 = load i64, i64* %31
%33 = call i32 @socket(i32 %28, i32 %30, i64 %32)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.13, i64 0, i64 0))
%35 = load %struct.addrinfo*, %struct.addrinfo** %4
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %35, i64 0, i32 1
%37 = load i64, i64* %36
%38 = inttoptr i64 %37 to %struct.sockaddr*
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %35, i64 0, i32 0
%40 = load i32, i32* %39
%41 = call i32 @bind(i32 %33, %struct.sockaddr* %38, i32 %40)
%42 = bitcast %struct.sockaddr_storage* %6 to i8*
%43 = bitcast i32* %7 to i8*
store i32 4, i32* %7
%44 = load i32, i32* @NI_MAXHOST
%45 = zext i32 %44 to i64
%46 = call i8* @llvm.stacksave()
%47 = alloca i8, i64 %45
%48 = load i32, i32* @NI_MAXSERV
%49 = zext i32 %48 to i64
%50 = alloca i8, i64 %49
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.14, i64 0, i64 0))
%52 = call i64 @listen(i32 %33, i32 10)
%53 = icmp eq i64 %52, 0
br i1 %53, label %55, label %54
54: ; preds = %21
ret i32 -1
55: ; preds = %21
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.15, i64 0, i64 0))
%57 = bitcast %struct.sockaddr_storage* %6 to %struct.sockaddr*
%58 = call i32 @accept(i32 %33, %struct.sockaddr* %57, i32* %7)
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.16, i64 0, i64 0))
%60 = call i32 @recv(i32 %58, i8* %10, i32 80, i32 0)
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 %61
store i8 0, i8* %62
%63 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %69, label %65
65: ; preds = %55, %76
%66 = phi i32 [ %89, %76 ], [ %60, %55 ]
%67 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %76, %65, %55
%70 = call i32 @send(i32 %58, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 9, i32 0)
%71 = load %struct.addrinfo*, %struct.addrinfo** %4
%72 = call i32 @freeaddrinfo(%struct.addrinfo* %71)
%73 = call i32 @close(i32 %33)
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.17, i64 0, i64 0))
%75 = call i32 @_exit(i32 1)
unreachable
76: ; preds = %65
%77 = load i32, i32* %7
%78 = load i32, i32* @NI_MAXHOST
%79 = load i32, i32* @NI_MAXSERV
%80 = load i32, i32* @NI_NUMERICHOST
%81 = load i32, i32* @NI_NUMERICSERV
%82 = or i32 %81, %80
%83 = call i32 @getnameinfo(%struct.sockaddr* %57, i32 %77, i8* %47, i32 %78, i8* %50, i32 %79, i32 %82)
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %47, i8* %50)
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %66, i8* %10)
%86 = call i32 @send(i32 %58, i8* %10, i32 %66, i32 0)
%87 = call i32 @sleep(i32 5)
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.16, i64 0, i64 0))
%89 = call i32 @recv(i32 %58, i8* %10, i32 80, i32 0)
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 %90
store i8 0, i8* %91
%92 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%93 = icmp eq i64 %92, 0
br i1 %93, label %69, label %65
}