#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
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_DGRAM;
int /*<<< orphan*/ _exit(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);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int udp_socket;
  struct addrinfo hints;
  struct addrinfo *res;
  char buffer[80];
  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");
  }
  getaddrinfo(argv[1], argv[2], &hints, &res);
  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];
    printf("Recibiendo mensajes.\n");
    int recv = recvfrom(udp_socket, buffer, 80, 0, (struct sockaddr *)&cliente,
                        &cliente_len);
    buffer[recv] = '\0';
    if (strcmp(buffer, "t") == 0 || strcmp(buffer, "t\n") == 0) {
      time_t t = time(NULL);
      struct tm *lc;
      lc = localtime(&t);
      strftime(buffer, 50, "%H:%M:%S %P", lc);
      sendto(udp_socket, buffer, strlen(buffer), 0, (struct sockaddr *)&cliente,
             cliente_len);
    } else if (strcmp(buffer, "d") == 0 || strcmp(buffer, "d\n") == 0) {
      time_t t = time(NULL);
      struct tm *lc;
      lc = localtime(&t);
      strftime(buffer, 50, "Hoy es %A", lc);
      sendto(udp_socket, buffer, strlen(buffer), 0, (struct sockaddr *)&cliente,
             cliente_len);
    } else if (strcmp(buffer, "q") == 0 || strcmp(buffer, "q\n") == 0) {
      sendto(udp_socket, "CERRANDO CONEXION..", 20, 0,
             (struct sockaddr *)&cliente, cliente_len);
      freeaddrinfo(res);
      close(udp_socket);
      _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", recv, buffer);
    sleep(5);
  }
  freeaddrinfo(res);
  close(udp_socket);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    126b <main+0x5b>
lea    0xd9a(%rip),%rdi
call   10f0 <perror@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1100 <getaddrinfo@plt>
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   1130 <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   10d0 <bind@plt>
movl   $0x4,-0xac(%rbp)
mov    0x2ce3(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc0(%rbp)
mov    0x2cce(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc8(%rbp)
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0xa0(%rbp),%rsi
lea    -0xa8(%rbp),%r8
mov    $0x50,%edx
xor    %ecx,%ecx
lea    -0xac(%rbp),%r9
call   10c0 <recvfrom@plt>
mov    %eax,-0xcc(%rbp)
movslq -0xcc(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    -0xa0(%rbp),%rdi
lea    0xcb1(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     13a7 <main+0x197>
lea    -0xa0(%rbp),%rdi
lea    0xc96(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1434 <main+0x224>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0xd0(%rbp)
lea    -0xd0(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0xd8(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xd8(%rbp),%rcx
mov    $0x32,%esi
lea    0xc4e(%rip),%rdx
call   10e0 <strftime@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x104(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0x100(%rbp)
lea    -0xa0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x104(%rbp),%edi
mov    -0x100(%rbp),%rsi
mov    %eax,%edx
lea    -0xa8(%rbp),%r8
mov    -0xac(%rbp),%r9d
xor    %ecx,%ecx
call   1070 <sendto@plt>
jmp    157e <main+0x36e>
lea    -0xa0(%rbp),%rdi
lea    0xbfb(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     146e <main+0x25e>
lea    -0xa0(%rbp),%rdi
lea    0xbe0(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    14fb <main+0x2eb>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0xdc(%rbp)
lea    -0xdc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0xe8(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xe8(%rbp),%rcx
mov    $0x32,%esi
lea    0xb98(%rip),%rdx
call   10e0 <strftime@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x114(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0x110(%rbp)
lea    -0xa0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x114(%rbp),%edi
mov    -0x110(%rbp),%rsi
mov    %eax,%edx
lea    -0xa8(%rbp),%r8
mov    -0xac(%rbp),%r9d
xor    %ecx,%ecx
call   1070 <sendto@plt>
jmp    1579 <main+0x369>
lea    -0xa0(%rbp),%rdi
lea    0xb43(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1535 <main+0x325>
lea    -0xa0(%rbp),%rdi
lea    0xb28(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1574 <main+0x364>
mov    -0x14(%rbp),%edi
lea    -0xa8(%rbp),%r8
mov    -0xac(%rbp),%r9d
lea    0xb04(%rip),%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1070 <sendto@plt>
mov    -0x48(%rbp),%rdi
call   1120 <freeaddrinfo@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
mov    $0x1,%edi
call   1040 <_exit@plt>
jmp    1579 <main+0x369>
jmp    157e <main+0x36e>
mov    -0xf0(%rbp),%r8
mov    -0xf8(%rbp),%rdx
lea    -0xa8(%rbp),%rdi
mov    -0xac(%rbp),%esi
mov    0x2a10(%rip),%rax
mov    (%rax),%ecx
mov    0x2a27(%rip),%rax
mov    (%rax),%r9d
mov    0x2a05(%rip),%rax
mov    (%rax),%eax
mov    0x2a2c(%rip),%r10
or     (%r10),%eax
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1090 <getnameinfo@plt>
mov    -0xf8(%rbp),%rsi
mov    -0xf0(%rbp),%rdx
add    $0x10,%rsp
lea    0xa81(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xcc(%rbp),%esi
lea    -0xa0(%rbp),%rdx
lea    0xa7c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x5,%edi
call   1110 <sleep@plt>
mov    -0xb8(%rbp),%rax
mov    %rax,%rsp
jmp    12bc <main+0xac>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%rbx
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2d8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2d72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
cmp    $0x1,%edi
jg     1274 <main+0x54>
lea    0xd91(%rip),%rdi
call   1100 <perror@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
lea    -0x78(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1110 <getaddrinfo@plt>
mov    -0x40(%rbp),%rax
mov    0x1c(%rax),%edi
mov    0x18(%rax),%esi
mov    0x10(%rax),%rdx
call   1140 <socket@plt>
mov    %eax,%edi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rsi
mov    (%rax),%edx
mov    %edi,-0x30(%rbp)
call   10e0 <bind@plt>
mov    0x2cf9(%rip),%rax
mov    0x2d12(%rip),%rcx
lea    -0xd0(%rbp),%rbx
lea    -0x38(%rbp),%r12
jmp    139d <main+0x17d>
xchg   %ax,%ax
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,-0x34(%rbp)
lea    -0x34(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
lea    0xd29(%rip),%rdx
mov    %rax,%rcx
call   10f0 <strftime@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r12,%r8
call   1080 <sendto@plt>
mov    -0x2c(%rbp),%esi
mov    (%r15),%ecx
mov    %r12,%r15
mov    %rbx,%r12
mov    0x2ca5(%rip),%rbx
mov    (%rbx),%r9d
mov    0x2cb3(%rip),%rax
mov    (%rax),%eax
mov    0x2c7a(%rip),%rdx
or     (%rdx),%eax
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %r14,%rdx
mov    %r13,%r8
push   %rax
call   10a0 <getnameinfo@plt>
add    $0x10,%rsp
lea    0xcf1(%rip),%rdi
mov    %r14,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xcf3(%rip),%rdi
mov    -0x44(%rbp),%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x5,%edi
call   1120 <sleep@plt>
mov    %rbx,%rcx
mov    %r12,%rbx
mov    %r15,%r12
mov    0x2c17(%rip),%rax
mov    -0x50(%rbp),%rsp
mov    %rsp,-0x50(%rbp)
movl   $0x4,-0x2c(%rbp)
mov    %rax,%r15
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    (%rcx),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,%r13
mov    %rcx,%rsp
lea    0xc9c(%rip),%rdi
call   1050 <puts@plt>
mov    -0x30(%rbp),%edi
mov    %rbx,%rsi
mov    $0x50,%edx
xor    %ecx,%ecx
mov    %r12,%r8
lea    -0x2c(%rbp),%r9
call   10d0 <recvfrom@plt>
mov    %eax,-0x44(%rbp)
cltq
movb   $0x0,-0xd0(%rbp,%rax,1)
mov    %rbx,%rdi
lea    0xc06(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12d0 <main+0xb0>
mov    %rbx,%rdi
lea    0xbf0(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12d0 <main+0xb0>
mov    %rbx,%rdi
lea    0xbe7(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1490 <main+0x270>
mov    %rbx,%rdi
lea    0xbd5(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1490 <main+0x270>
mov    %rbx,%rdi
lea    0xbce(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     14b7 <main+0x297>
mov    %rbx,%rdi
lea    0xbbc(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    1318 <main+0xf8>
jmp    14b7 <main+0x297>
nopl   0x0(%rax)
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,-0x34(%rbp)
lea    -0x34(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
lea    0xb7a(%rip),%rdx
jmp    12f2 <main+0xd2>
mov    -0x2c(%rbp),%r9d
lea    0xb79(%rip),%rsi
lea    -0x38(%rbp),%r8
mov    -0x30(%rbp),%ebx
mov    %ebx,%edi
mov    $0x14,%edx
xor    %ecx,%ecx
call   1080 <sendto@plt>
mov    -0x40(%rbp),%rdi
call   1130 <freeaddrinfo@plt>
mov    %ebx,%edi
call   1090 <close@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.tm = type { 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"
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@.str.1 = [22 x i8] c"Recibiendo mensajes.\0A\00"
@.str.2 = [2 x i8] c"t\00"
@.str.3 = [3 x i8] c"t\0A\00"
@.str.4 = [12 x i8] c"%H:%M:%S %P\00"
@.str.5 = [2 x i8] c"d\00"
@.str.6 = [3 x i8] c"d\0A\00"
@.str.7 = [10 x i8] c"Hoy es %A\00"
@.str.8 = [2 x i8] c"q\00"
@.str.9 = [3 x i8] c"q\0A\00"
@.str.10 = [20 x i8] c"CERRANDO CONEXION..\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 %struct.addrinfo
%8 = alloca %struct.addrinfo*
%9 = alloca [80 x i8]
%10 = alloca %struct.sockaddr_storage
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
%17 = alloca %struct.tm*
%18 = alloca i32
%19 = alloca %struct.tm*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* @AI_PASSIVE
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %7, i32 0, i32 5
store i32 %20, i32* %21
%22 = load i32, i32* @AF_UNSPEC
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %7, i32 0, i32 4
store i32 %22, i32* %23
%24 = load i32, i32* @SOCK_DGRAM
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %7, i32 0, i32 3
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %7, i32 0, i32 2
store i64 0, i64* %26
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 2
br i1 %28, label %29, label %31
29: ; preds = %2
%30 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @getaddrinfo(i8* %34, i8* %37, %struct.addrinfo* %7, %struct.addrinfo** %8)
%39 = load %struct.addrinfo*, %struct.addrinfo** %8
%40 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i32 0, i32 4
%41 = load i32, i32* %40
%42 = load %struct.addrinfo*, %struct.addrinfo** %8
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i32 0, i32 3
%44 = load i32, i32* %43
%45 = load %struct.addrinfo*, %struct.addrinfo** %8
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i32 0, i32 2
%47 = load i64, i64* %46
%48 = call i32 @socket(i32 %41, i32 %44, i64 %47)
store i32 %48, i32* %6
%49 = load i32, i32* %6
%50 = load %struct.addrinfo*, %struct.addrinfo** %8
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %50, i32 0, i32 1
%52 = load i64, i64* %51
%53 = inttoptr i64 %52 to %struct.sockaddr*
%54 = load %struct.addrinfo*, %struct.addrinfo** %8
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 0
%56 = load i32, i32* %55
%57 = call i32 @bind(i32 %49, %struct.sockaddr* %53, i32 %56)
br label %58
58: ; preds = %31, %135
store i32 4, i32* %11
%59 = load i32, i32* @NI_MAXHOST
%60 = zext i32 %59 to i64
%61 = call i8* @llvm.stacksave()
store i8* %61, i8** %12
%62 = alloca i8, i64 %60
store i64 %60, i64* %13
%63 = load i32, i32* @NI_MAXSERV
%64 = zext i32 %63 to i64
%65 = alloca i8, i64 %64
store i64 %64, i64* %14
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%67 = load i32, i32* %6
%68 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%69 = bitcast %struct.sockaddr_storage* %10 to %struct.sockaddr*
%70 = call i32 @recvfrom(i32 %67, i8* %68, i32 80, i32 0, %struct.sockaddr* %69, i32* %11)
store i32 %70, i32* %15
%71 = load i32, i32* %15
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 %72
store i8 0, i8* %73
%74 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%75 = call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %81, label %77
77: ; preds = %58
%78 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%79 = call i64 @strcmp(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %94
81: ; preds = %77, %58
%82 = call i32 @time(i32* null)
store i32 %82, i32* %16
%83 = call %struct.tm* @localtime(i32* %16)
store %struct.tm* %83, %struct.tm** %17
%84 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%85 = load %struct.tm*, %struct.tm** %17
%86 = call i32 @strftime(i8* %84, i32 50, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %85)
%87 = load i32, i32* %6
%88 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%89 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%90 = call i32 @strlen(i8* %89)
%91 = bitcast %struct.sockaddr_storage* %10 to %struct.sockaddr*
%92 = load i32, i32* %11
%93 = call i32 @sendto(i32 %87, i8* %88, i32 %90, i32 0, %struct.sockaddr* %91, i32 %92)
br label %135
94: ; preds = %77
%95 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%96 = call i64 @strcmp(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%97 = icmp eq i64 %96, 0
br i1 %97, label %102, label %98
98: ; preds = %94
%99 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%100 = call i64 @strcmp(i8* %99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %115
102: ; preds = %98, %94
%103 = call i32 @time(i32* null)
store i32 %103, i32* %18
%104 = call %struct.tm* @localtime(i32* %18)
store %struct.tm* %104, %struct.tm** %19
%105 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%106 = load %struct.tm*, %struct.tm** %19
%107 = call i32 @strftime(i8* %105, i32 50, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %struct.tm* %106)
%108 = load i32, i32* %6
%109 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%110 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%111 = call i32 @strlen(i8* %110)
%112 = bitcast %struct.sockaddr_storage* %10 to %struct.sockaddr*
%113 = load i32, i32* %11
%114 = call i32 @sendto(i32 %108, i8* %109, i32 %111, i32 0, %struct.sockaddr* %112, i32 %113)
br label %134
115: ; preds = %98
%116 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%117 = call i64 @strcmp(i8* %116, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%118 = icmp eq i64 %117, 0
br i1 %118, label %123, label %119
119: ; preds = %115
%120 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%121 = call i64 @strcmp(i8* %120, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %133
123: ; preds = %119, %115
%124 = load i32, i32* %6
%125 = bitcast %struct.sockaddr_storage* %10 to %struct.sockaddr*
%126 = load i32, i32* %11
%127 = call i32 @sendto(i32 %124, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 20, i32 0, %struct.sockaddr* %125, i32 %126)
%128 = load %struct.addrinfo*, %struct.addrinfo** %8
%129 = call i32 @freeaddrinfo(%struct.addrinfo* %128)
%130 = load i32, i32* %6
%131 = call i32 @close(i32 %130)
%132 = call i32 @_exit(i32 1)
unreachable
133: ; preds = %119
br label %134
134: ; preds = %133, %102
br label %135
135: ; preds = %134, %81
%136 = bitcast %struct.sockaddr_storage* %10 to %struct.sockaddr*
%137 = load i32, i32* %11
%138 = load i32, i32* @NI_MAXHOST
%139 = load i32, i32* @NI_MAXSERV
%140 = load i32, i32* @NI_NUMERICHOST
%141 = load i32, i32* @NI_NUMERICSERV
%142 = or i32 %140, %141
%143 = call i32 @getnameinfo(%struct.sockaddr* %136, i32 %137, i8* %62, i32 %138, i8* %65, i32 %139, i32 %142)
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %62, i8* %65)
%145 = load i32, i32* %15
%146 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %145, i8* %146)
%148 = call i32 @sleep(i32 5)
%149 = load i8*, i8** %12
br label %58
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i64, i64, i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
%struct.tm = 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"
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@.str.2 = [2 x i8] c"t\00"
@.str.3 = [3 x i8] c"t\0A\00"
@.str.4 = [12 x i8] c"%H:%M:%S %P\00"
@.str.5 = [2 x i8] c"d\00"
@.str.6 = [3 x i8] c"d\0A\00"
@.str.7 = [10 x i8] c"Hoy es %A\00"
@.str.8 = [2 x i8] c"q\00"
@.str.9 = [3 x i8] c"q\0A\00"
@.str.10 = [20 x i8] c"CERRANDO CONEXION..\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 = [21 x i8] c"Recibiendo mensajes.\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 i32
%9 = alloca i32
%10 = bitcast %struct.addrinfo* %3 to i8*
%11 = bitcast %struct.addrinfo** %4 to i8*
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%13 = load i32, i32* @AI_PASSIVE
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %13, i32* %14
%15 = load i32, i32* @AF_UNSPEC
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %15, i32* %16
%17 = load i32, i32* @SOCK_DGRAM
%18 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %17, i32* %18
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i64 0, i64* %19
%20 = icmp slt i32 %0, 2
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %2
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @getaddrinfo(i8* %25, i8* %27, %struct.addrinfo* %3, %struct.addrinfo** %4)
%29 = load %struct.addrinfo*, %struct.addrinfo** %4
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %29, i64 0, i32 4
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %29, i64 0, i32 3
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %29, i64 0, i32 2
%35 = load i64, i64* %34
%36 = call i32 @socket(i32 %31, i32 %33, i64 %35)
%37 = load %struct.addrinfo*, %struct.addrinfo** %4
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %37, i64 0, i32 1
%39 = load i64, i64* %38
%40 = inttoptr i64 %39 to %struct.sockaddr*
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %37, i64 0, i32 0
%42 = load i32, i32* %41
%43 = call i32 @bind(i32 %36, %struct.sockaddr* %40, i32 %42)
%44 = bitcast %struct.sockaddr_storage* %6 to i8*
%45 = bitcast i32* %7 to i8*
%46 = bitcast %struct.sockaddr_storage* %6 to %struct.sockaddr*
%47 = bitcast i32* %9 to i8*
%48 = bitcast i32* %8 to i8*
br label %49
49: ; preds = %99, %23
store i32 4, i32* %7
%50 = load i32, i32* @NI_MAXHOST
%51 = zext i32 %50 to i64
%52 = call i8* @llvm.stacksave()
%53 = alloca i8, i64 %51
%54 = load i32, i32* @NI_MAXSERV
%55 = zext i32 %54 to i64
%56 = alloca i8, i64 %55
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%58 = call i32 @recvfrom(i32 %36, i8* %12, i32 80, i32 0, %struct.sockaddr* %46, i32* %7)
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 %59
store i8 0, i8* %60
%61 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %49
%64 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %73
66: ; preds = %63, %49
%67 = call i32 @time(i32* null)
store i32 %67, i32* %8
%68 = call %struct.tm* @localtime(i32* %8)
%69 = call i32 @strftime(i8* %12, i32 50, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %68)
%70 = call i32 @strlen(i8* %12)
%71 = load i32, i32* %7
%72 = call i32 @sendto(i32 %36, i8* %12, i32 %70, i32 0, %struct.sockaddr* %46, i32 %71)
br label %99
73: ; preds = %63
%74 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %79, label %76
76: ; preds = %73
%77 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %86
79: ; preds = %76, %73
%80 = call i32 @time(i32* null)
store i32 %80, i32* %9
%81 = call %struct.tm* @localtime(i32* %9)
%82 = call i32 @strftime(i8* %12, i32 50, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %struct.tm* %81)
%83 = call i32 @strlen(i8* %12)
%84 = load i32, i32* %7
%85 = call i32 @sendto(i32 %36, i8* %12, i32 %83, i32 0, %struct.sockaddr* %46, i32 %84)
br label %99
86: ; preds = %76
%87 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%88 = icmp eq i64 %87, 0
br i1 %88, label %92, label %89
89: ; preds = %86
%90 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %99
92: ; preds = %89, %86
%93 = load i32, i32* %7
%94 = call i32 @sendto(i32 %36, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 20, i32 0, %struct.sockaddr* %46, i32 %93)
%95 = load %struct.addrinfo*, %struct.addrinfo** %4
%96 = call i32 @freeaddrinfo(%struct.addrinfo* %95)
%97 = call i32 @close(i32 %36)
%98 = call i32 @_exit(i32 1)
unreachable
99: ; preds = %79, %89, %66
%100 = load i32, i32* %7
%101 = load i32, i32* @NI_MAXHOST
%102 = load i32, i32* @NI_MAXSERV
%103 = load i32, i32* @NI_NUMERICHOST
%104 = load i32, i32* @NI_NUMERICSERV
%105 = or i32 %104, %103
%106 = call i32 @getnameinfo(%struct.sockaddr* %46, i32 %100, i8* %53, i32 %101, i8* %56, i32 %102, i32 %105)
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %53, i8* %56)
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %58, i8* %12)
%109 = call i32 @sleep(i32 5)
br label %49
}