#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 stat {
  int st_uid;
  int st_gid;
  int st_ino;
};
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 EINVAL;
int NI_MAXHOST;
int NI_MAXSERV;
int NI_NUMERICHOST;
int NI_NUMERICSERV;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ bind(int, struct sockaddr *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ getnameinfo(struct sockaddr *, int, char *, int, char *, int,
                               int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int stat(char *, struct stat *);
int strlen(char *);
int main(int argc, char **argv) {
  int udp_socket, info;
  struct addrinfo hints;
  struct addrinfo *res;
  char buffer[80];
  int uid = 0, gid = 0, ino = 0;
  hints.ai_flags = AI_PASSIVE;
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_protocol = 0;
  if (argc < 2) {
    perror("Error de argumentos.\n");
  }
  info = getaddrinfo("::", argv[1], &hints, &res);
  if (info < 0)
    return -EINVAL;
  udp_socket = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
  bind(udp_socket, (struct sockaddr *)res->ai_addr, res->ai_addrlen);
  while (1) {
    struct sockaddr_storage cliente;
    socklen_t cliente_len = sizeof(cliente);
    char host[NI_MAXHOST];
    char serv[NI_MAXSERV];
    int recv = recvfrom(udp_socket, buffer, 80, 0, (struct sockaddr *)&cliente,
                        &cliente_len);
    buffer[recv] = '\0';
    getnameinfo((struct sockaddr *)&cliente, cliente_len, host, NI_MAXHOST,
                serv, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV);
    printf("Host: %s,  Puerto: %s\n", host, serv);
    if (buffer[0] == 'i') {
      char ruta[80];
      char msg[80];
      sscanf(&buffer[2], "%s", ruta);
      struct stat sb;
      if (stat(ruta, &sb) == -1) {
        perror("Error de stat.\n");
      } else {
        uid = sb.st_uid;
        gid = sb.st_gid;
        ino = sb.st_ino;
        sprintf(msg, "UID: %i, GID: %i, INO: %i\n", uid, gid, ino);
        sendto(udp_socket, msg, strlen(msg), 0, (struct sockaddr *)&cliente,
               cliente_len);
      }
    } else if (buffer[0] == 'q') {
      sendto(udp_socket, "CERRANDO CONEXION..\n", 20, 0,
             (struct sockaddr *)&cliente, cliente_len);
      freeaddrinfo(res);
      close(udp_socket);
      return 0;
    }
  }
  freeaddrinfo(res);
  close(udp_socket);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2dae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1259 <main+0x79>
lea    0xdac(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdae(%rip),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10e0 <getaddrinfo@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1295 <main+0xb5>
xor    %eax,%eax
mov    0x2d25(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1559 <main+0x379>
mov    -0x48(%rbp),%rax
mov    0x1c(%rax),%edi
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%rdx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
call   10b0 <bind@plt>
movl   $0x4,-0xb4(%rbp)
mov    0x2cce(%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,-0x1a8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc8(%rbp)
mov    0x2cc1(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1a0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xd0(%rbp)
mov    -0x14(%rbp),%edi
lea    -0xa0(%rbp),%rsi
lea    -0xb0(%rbp),%r8
mov    $0x50,%edx
xor    %ecx,%ecx
lea    -0xb4(%rbp),%r9
call   1090 <recvfrom@plt>
mov    -0x1a8(%rbp),%rdx
mov    -0x1a0(%rbp),%r8
mov    %eax,-0xd4(%rbp)
movslq -0xd4(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
mov    0x2c1a(%rip),%rax
mov    (%rax),%ecx
mov    0x2c39(%rip),%rax
mov    (%rax),%r9d
mov    0x2c17(%rip),%rax
mov    (%rax),%eax
mov    0x2c3e(%rip),%r10
or     (%r10),%eax
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1070 <getnameinfo@plt>
mov    -0x1a8(%rbp),%rsi
mov    -0x1a0(%rbp),%rdx
add    $0x10,%rsp
lea    0xc47(%rip),%rdi
call   1040 <printf@plt>
movsbl -0xa0(%rbp),%eax
cmp    $0x69,%eax
jne    14c8 <main+0x2e8>
lea    -0xa0(%rbp),%rdi
add    $0x2,%rdi
lea    -0x130(%rbp),%rdx
lea    0xc30(%rip),%rsi
call   10a0 <sscanf@plt>
lea    -0x130(%rbp),%rdi
lea    -0x190(%rbp),%rsi
call   1080 <stat@plt>
cmp    $0xffffffff,%eax
jne    1432 <main+0x252>
lea    0xc0b(%rip),%rdi
call   10c0 <perror@plt>
jmp    14c3 <main+0x2e3>
mov    -0x190(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x18c(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x188(%rbp),%eax
mov    %eax,-0xac(%rbp)
lea    -0x180(%rbp),%rdi
mov    -0xa4(%rbp),%edx
mov    -0xa8(%rbp),%ecx
mov    -0xac(%rbp),%r8d
lea    0xbcc(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1b4(%rbp)
lea    -0x180(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
lea    -0x180(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1b4(%rbp),%edi
mov    -0x1b0(%rbp),%rsi
mov    %eax,%edx
lea    -0xb0(%rbp),%r8
mov    -0xb4(%rbp),%r9d
xor    %ecx,%ecx
call   1050 <sendto@plt>
jmp    1528 <main+0x348>
movsbl -0xa0(%rbp),%eax
cmp    $0x71,%eax
jne    1523 <main+0x343>
mov    -0x14(%rbp),%edi
lea    -0xb0(%rbp),%r8
mov    -0xb4(%rbp),%r9d
lea    0xb6e(%rip),%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1050 <sendto@plt>
mov    -0x48(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x194(%rbp)
jmp    1532 <main+0x352>
jmp    1528 <main+0x348>
movl   $0x0,-0x194(%rbp)
mov    -0xc0(%rbp),%rax
mov    %rax,%rsp
mov    -0x194(%rbp),%eax
test   %eax,%eax
je     1554 <main+0x374>
jmp    154f <main+0x36f>
jmp    1559 <main+0x379>
jmp    12c9 <main+0xe9>
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rsi,%rbx
mov    0x2de2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2dce(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2db2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
cmp    $0x1,%edi
jle    142b <main+0x24b>
mov    0x8(%rbx),%rsi
lea    0xddf(%rip),%rdi
lea    -0x80(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10e0 <getaddrinfo@plt>
test   %eax,%eax
js     140c <main+0x22c>
mov    -0x40(%rbp),%rax
mov    0x1c(%rax),%edi
mov    0x18(%rax),%esi
mov    0x10(%rax),%rdx
call   1100 <socket@plt>
mov    %eax,%edi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rsi
mov    (%rax),%edx
mov    %edi,-0x30(%rbp)
call   10b0 <bind@plt>
jmp    128c <main+0xac>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x71,%al
je     13d3 <main+0x1f3>
mov    -0x48(%rbp),%rsp
mov    %rsp,-0x48(%rbp)
movl   $0x4,-0x2c(%rbp)
mov    0x2d0a(%rip),%r12
mov    (%r12),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x2d16(%rip),%rbx
mov    (%rbx),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x30(%rbp),%edi
lea    -0xd0(%rbp),%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
lea    -0x38(%rbp),%r13
mov    %r13,%r8
lea    -0x2c(%rbp),%r9
call   1090 <recvfrom@plt>
cltq
movb   $0x0,-0xd0(%rbp,%rax,1)
mov    -0x2c(%rbp),%esi
mov    (%r12),%ecx
mov    (%rbx),%r9d
mov    0x2cdf(%rip),%rax
mov    (%rax),%eax
mov    0x2ca6(%rip),%rdx
or     (%rdx),%eax
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r15,%rdx
mov    %r14,%r8
push   %rax
call   1070 <getnameinfo@plt>
add    $0x10,%rsp
lea    0xce7(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
movzbl -0xd0(%rbp),%eax
cmp    $0x69,%al
jne    1280 <main+0xa0>
lea    -0xce(%rbp),%rdi
lea    0xcd6(%rip),%rsi
lea    -0x170(%rbp),%rbx
mov    %rbx,%rdx
call   10a0 <sscanf@plt>
mov    %rbx,%rdi
lea    -0x58(%rbp),%rsi
call   1080 <stat@plt>
cmp    $0xffffffff,%eax
je     13be <main+0x1de>
mov    -0x58(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x50(%rbp),%r8d
lea    -0x120(%rbp),%rbx
mov    %rbx,%rdi
lea    0xcae(%rip),%rsi
call   10d0 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
lea    -0x38(%rbp),%r8
call   1050 <sendto@plt>
jmp    1288 <main+0xa8>
lea    0xc6e(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x48(%rbp),%rsp
jmp    128c <main+0xac>
mov    -0x2c(%rbp),%r9d
lea    0xc80(%rip),%rsi
xor    %r14d,%r14d
lea    -0x38(%rbp),%r8
mov    -0x30(%rbp),%ebx
mov    %ebx,%edi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1050 <sendto@plt>
mov    -0x40(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    %ebx,%edi
call   1060 <close@plt>
mov    -0x48(%rbp),%rsp
jmp    1419 <main+0x239>
mov    0x2b9d(%rip),%rax
xor    %r14d,%r14d
sub    (%rax),%r14d
mov    %r14d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbce(%rip),%rdi
call   10c0 <perror@plt>
jmp    122c <main+0x4c>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i64, i64, i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.stat = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [22 x i8] c"Error de argumentos.\0A\00"
@.str.1 = [3 x i8] c"::\00"
@EINVAL = global i32 0
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.2 = [23 x i8] c"Host: %s, Puerto: %s\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [16 x i8] c"Error de stat.\0A\00"
@.str.5 = [27 x i8] c"UID: %i, GID: %i, INO: %i\0A\00"
@.str.6 = [21 x i8] c"CERRANDO CONEXION..\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 i32
%14 = alloca %struct.sockaddr_storage
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i64
%18 = alloca i64
%19 = alloca i32
%20 = alloca [80 x i8]
%21 = alloca [80 x i8]
%22 = alloca %struct.stat
%23 = alloca i32
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
store i32 0, i32* %13
%24 = load i32, i32* @AI_PASSIVE
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 5
store i32 %24, i32* %25
%26 = load i32, i32* @AF_UNSPEC
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 4
store i32 %26, i32* %27
%28 = load i32, i32* @SOCK_DGRAM
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 3
store i32 %28, i32* %29
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 2
store i64 0, i64* %30
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 2
br i1 %32, label %33, label %35
33: ; preds = %2
%34 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %35
35: ; preds = %33, %2
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @getaddrinfo(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %38, %struct.addrinfo* %8, %struct.addrinfo** %9)
store i32 %39, i32* %7
%40 = load i32, i32* %7
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %35
%43 = load i32, i32* @EINVAL
%44 = sub nsw i32 0, %43
store i32 %44, i32* %3
br label %142
45: ; preds = %35
%46 = load %struct.addrinfo*, %struct.addrinfo** %9
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %46, i32 0, i32 4
%48 = load i32, i32* %47
%49 = load %struct.addrinfo*, %struct.addrinfo** %9
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i32 0, i32 3
%51 = load i32, i32* %50
%52 = load %struct.addrinfo*, %struct.addrinfo** %9
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %52, i32 0, i32 2
%54 = load i64, i64* %53
%55 = call i32 @socket(i32 %48, i32 %51, i64 %54)
store i32 %55, i32* %6
%56 = load i32, i32* %6
%57 = load %struct.addrinfo*, %struct.addrinfo** %9
%58 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %57, i32 0, i32 1
%59 = load i64, i64* %58
%60 = inttoptr i64 %59 to %struct.sockaddr*
%61 = load %struct.addrinfo*, %struct.addrinfo** %9
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %61, i32 0, i32 0
%63 = load i32, i32* %62
%64 = call i32 @bind(i32 %56, %struct.sockaddr* %60, i32 %63)
br label %65
65: ; preds = %45, %141
store i32 4, i32* %15
%66 = load i32, i32* @NI_MAXHOST
%67 = zext i32 %66 to i64
%68 = call i8* @llvm.stacksave()
store i8* %68, i8** %16
%69 = alloca i8, i64 %67
store i64 %67, i64* %17
%70 = load i32, i32* @NI_MAXSERV
%71 = zext i32 %70 to i64
%72 = alloca i8, i64 %71
store i64 %71, i64* %18
%73 = load i32, i32* %6
%74 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%75 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr*
%76 = call i32 @recvfrom(i32 %73, i8* %74, i32 80, i32 0, %struct.sockaddr* %75, i32* %15)
store i32 %76, i32* %19
%77 = load i32, i32* %19
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 %78
store i8 0, i8* %79
%80 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr*
%81 = load i32, i32* %15
%82 = load i32, i32* @NI_MAXHOST
%83 = load i32, i32* @NI_MAXSERV
%84 = load i32, i32* @NI_NUMERICHOST
%85 = load i32, i32* @NI_NUMERICSERV
%86 = or i32 %84, %85
%87 = call i32 @getnameinfo(%struct.sockaddr* %80, i32 %81, i8* %69, i32 %82, i8* %72, i32 %83, i32 %86)
%88 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %69, i8* %72)
%89 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp eq i32 %91, 105
br i1 %92, label %93, label %122
93: ; preds = %65
%94 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 2
%95 = getelementptr inbounds [80 x i8], [80 x i8]* %20, i64 0, i64 0
%96 = call i32 @sscanf(i8* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %95)
%97 = getelementptr inbounds [80 x i8], [80 x i8]* %20, i64 0, i64 0
%98 = call i32 @stat(i8* %97, %struct.stat* %22)
%99 = icmp eq i32 %98, -1
br i1 %99, label %100, label %102
100: ; preds = %93
%101 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %121
102: ; preds = %93
%103 = getelementptr inbounds %struct.stat, %struct.stat* %22, i32 0, i32 0
%104 = load i32, i32* %103
store i32 %104, i32* %11
%105 = getelementptr inbounds %struct.stat, %struct.stat* %22, i32 0, i32 1
%106 = load i32, i32* %105
store i32 %106, i32* %12
%107 = getelementptr inbounds %struct.stat, %struct.stat* %22, i32 0, i32 2
%108 = load i32, i32* %107
store i32 %108, i32* %13
%109 = getelementptr inbounds [80 x i8], [80 x i8]* %21, i64 0, i64 0
%110 = load i32, i32* %11
%111 = load i32, i32* %12
%112 = load i32, i32* %13
%113 = call i32 @sprintf(i8* %109, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %110, i32 %111, i32 %112)
%114 = load i32, i32* %6
%115 = getelementptr inbounds [80 x i8], [80 x i8]* %21, i64 0, i64 0
%116 = getelementptr inbounds [80 x i8], [80 x i8]* %21, i64 0, i64 0
%117 = call i32 @strlen(i8* %116)
%118 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr*
%119 = load i32, i32* %15
%120 = call i32 @sendto(i32 %114, i8* %115, i32 %117, i32 0, %struct.sockaddr* %118, i32 %119)
br label %121
121: ; preds = %102, %100
br label %137
122: ; preds = %65
%123 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp eq i32 %125, 113
br i1 %126, label %127, label %136
127: ; preds = %122
%128 = load i32, i32* %6
%129 = bitcast %struct.sockaddr_storage* %14 to %struct.sockaddr*
%130 = load i32, i32* %15
%131 = call i32 @sendto(i32 %128, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 20, i32 0, %struct.sockaddr* %129, i32 %130)
%132 = load %struct.addrinfo*, %struct.addrinfo** %9
%133 = call i32 @freeaddrinfo(%struct.addrinfo* %132)
%134 = load i32, i32* %6
%135 = call i32 @close(i32 %134)
store i32 0, i32* %3
store i32 1, i32* %23
br label %138
136: ; preds = %122
br label %137
137: ; preds = %136, %121
store i32 0, i32* %23
br label %138
138: ; preds = %137, %127
%139 = load i8*, i8** %16
%140 = load i32, i32* %23
switch i32 %140, label %144 [
i32 0, label %141
i32 1, label %142
]
141: ; preds = %138
br label %65
142: ; preds = %138, %42
%143 = load i32, i32* %3
ret i32 %143
144: ; preds = %138
unreachable
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i64, i64, i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.stat = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [22 x i8] c"Error de argumentos.\0A\00"
@.str.1 = [3 x i8] c"::\00"
@EINVAL = global i32 0
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.2 = [23 x i8] c"Host: %s, Puerto: %s\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [16 x i8] c"Error de stat.\0A\00"
@.str.5 = [27 x i8] c"UID: %i, GID: %i, INO: %i\0A\00"
@.str.6 = [21 x i8] c"CERRANDO CONEXION..\0A\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 = alloca [80 x i8]
%9 = alloca [80 x i8]
%10 = alloca %struct.stat
%11 = bitcast %struct.addrinfo* %3 to i8*
%12 = bitcast %struct.addrinfo** %4 to i8*
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%14 = load i32, i32* @AI_PASSIVE
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %14, i32* %15
%16 = load i32, i32* @AF_UNSPEC
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %16, i32* %17
%18 = load i32, i32* @SOCK_DGRAM
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %18, i32* %19
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i64 0, i64* %20
%21 = icmp slt i32 %0, 2
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %2
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @getaddrinfo(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %26, %struct.addrinfo* %3, %struct.addrinfo** %4)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = load i32, i32* @EINVAL
%31 = sub nsw i32 0, %30
br label %100
32: ; preds = %24
%33 = load %struct.addrinfo*, %struct.addrinfo** %4
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 4
%35 = load i32, i32* %34
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 3
%37 = load i32, i32* %36
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 2
%39 = load i64, i64* %38
%40 = call i32 @socket(i32 %35, i32 %37, i64 %39)
%41 = load %struct.addrinfo*, %struct.addrinfo** %4
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i64 0, i32 1
%43 = load i64, i64* %42
%44 = inttoptr i64 %43 to %struct.sockaddr*
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i64 0, i32 0
%46 = load i32, i32* %45
%47 = call i32 @bind(i32 %40, %struct.sockaddr* %44, i32 %46)
%48 = bitcast %struct.sockaddr_storage* %6 to i8*
%49 = bitcast i32* %7 to i8*
%50 = bitcast %struct.sockaddr_storage* %6 to %struct.sockaddr*
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%53 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 2
%54 = bitcast %struct.stat* %10 to i8*
%55 = getelementptr inbounds %struct.stat, %struct.stat* %10, i64 0, i32 0
%56 = getelementptr inbounds %struct.stat, %struct.stat* %10, i64 0, i32 1
%57 = getelementptr inbounds %struct.stat, %struct.stat* %10, i64 0, i32 2
br label %58
58: ; preds = %99, %32
store i32 4, i32* %7
%59 = load i32, i32* @NI_MAXHOST
%60 = zext i32 %59 to i64
%61 = call i8* @llvm.stacksave()
%62 = alloca i8, i64 %60
%63 = load i32, i32* @NI_MAXSERV
%64 = zext i32 %63 to i64
%65 = alloca i8, i64 %64
%66 = call i32 @recvfrom(i32 %40, i8* %13, i32 80, i32 0, %struct.sockaddr* %50, i32* %7)
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 %67
store i8 0, i8* %68
%69 = load i32, i32* %7
%70 = load i32, i32* @NI_MAXHOST
%71 = load i32, i32* @NI_MAXSERV
%72 = load i32, i32* @NI_NUMERICHOST
%73 = load i32, i32* @NI_NUMERICSERV
%74 = or i32 %73, %72
%75 = call i32 @getnameinfo(%struct.sockaddr* %50, i32 %69, i8* %62, i32 %70, i8* %65, i32 %71, i32 %74)
%76 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %62, i8* %65)
%77 = load i8, i8* %13
switch i8 %77, label %99 [
i8 105, label %78
i8 113, label %93
]
78: ; preds = %58
%79 = call i32 @sscanf(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%80 = call i32 @stat(i8* %51, %struct.stat* %10)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %92
84: ; preds = %78
%85 = load i32, i32* %55
%86 = load i32, i32* %56
%87 = load i32, i32* %57
%88 = call i32 @sprintf(i8* %52, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %85, i32 %86, i32 %87)
%89 = call i32 @strlen(i8* %52)
%90 = load i32, i32* %7
%91 = call i32 @sendto(i32 %40, i8* %52, i32 %89, i32 0, %struct.sockaddr* %50, i32 %90)
br label %92
92: ; preds = %84, %82
br label %99
93: ; preds = %58
%94 = load i32, i32* %7
%95 = call i32 @sendto(i32 %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 20, i32 0, %struct.sockaddr* %50, i32 %94)
%96 = load %struct.addrinfo*, %struct.addrinfo** %4
%97 = call i32 @freeaddrinfo(%struct.addrinfo* %96)
%98 = call i32 @close(i32 %40)
br label %100
99: ; preds = %92, %58
br label %58
100: ; preds = %93, %29
%101 = phi i32 [ %31, %29 ], [ 0, %93 ]
ret i32 %101
}