#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 tm_min;
  int tm_sec;
  int tm_mday;
  int /*<<< orphan*/ tm_mon;
  int /*<<< orphan*/ tm_year;
  int /*<<< orphan*/ tm_hour;
};
struct sockaddr_storage {
  int dummy;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  scalar_t__ ai_addr;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_flags;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ cli;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int NI_MAXHOST;
int NI_MAXSERV;
int /*<<< orphan*/ NI_NUMERICHOST;
int /*<<< orphan*/ SOCK_DGRAM;
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 /*<<< orphan*/);
struct tm *gmtime(int /*<<< orphan*/ *);
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 socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main(int args, char *argv[]) {
  struct addrinfo hints, *res;
  struct sockaddr_storage cli;
  char sbuf[81], rbuf[81], host[NI_MAXHOST], serv[NI_MAXSERV];
  hints.ai_flags = AI_PASSIVE;
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_protocol = 0;
  getaddrinfo(argv[1], argv[2], &hints, &res);
  int sd = socket(res->ai_family, res->ai_socktype, 0);
  bind(sd, (struct sockaddr *)res->ai_addr, res->ai_addrlen);
  freeaddrinfo(res);
  int stop = 0;
  while (!stop) {
    socklen_t clen = sizeof(cli);
    int c = recvfrom(sd, rbuf, 1, 0, (struct sockaddr *)&cli, &clen);
    getnameinfo((struct sockaddr *)&cli, clen, host, NI_MAXHOST, serv,
                NI_MAXSERV, NI_NUMERICHOST);
    printf("Message recieved from %s::%s\n", host, serv);
    printf("Length: %d Bytes\tMsg:%s\n", c, rbuf);
    time_t ti = time(NULL);
    struct tm *timeData = gmtime(&ti);
    switch (rbuf[0]) {
    case 't':
      sprintf(sbuf, "Hour:\t%02d:%02d:%02d", timeData->tm_hour + 2,
              timeData->tm_min, timeData->tm_sec);
      break;
    case 'd':
      sprintf(sbuf, "Year:20%02d\tMonth:%02d\tDay:%02d",
              timeData->tm_year - 100, timeData->tm_mon + 1, timeData->tm_mday);
      break;
    case 'q':
      sprintf(sbuf, "Goodbye client");
      stop = 1;
      break;
    }
    c = strlen(sbuf);
    sbuf[c] = '\0';
    sendto(sd, sbuf, c, 0, (struct sockaddr *)&cli, clen);
  }
  close(sd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dcf(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x108(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x148(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x110(%rbp)
mov    0x2dba(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x140(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x118(%rbp)
mov    0x2d9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    -0x40(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x11c(%rbp)
mov    -0x11c(%rbp),%edi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
call   10a0 <bind@plt>
mov    -0x40(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
movl   $0x0,-0x120(%rbp)
cmpl   $0x0,-0x120(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12eb <main+0x11b>
jmp    1510 <main+0x340>
movl   $0x4,-0x124(%rbp)
mov    -0x11c(%rbp),%edi
lea    -0x100(%rbp),%rsi
mov    %rsi,-0x160(%rbp)
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %ecx,-0x150(%rbp)
lea    -0x48(%rbp),%r8
mov    %r8,-0x168(%rbp)
lea    -0x124(%rbp),%r9
call   1090 <recvfrom@plt>
mov    -0x168(%rbp),%rdi
mov    -0x148(%rbp),%rdx
mov    -0x140(%rbp),%r8
mov    %eax,-0x128(%rbp)
mov    -0x124(%rbp),%esi
mov    0x2c63(%rip),%rax
mov    (%rax),%ecx
mov    0x2c7a(%rip),%rax
mov    (%rax),%r9d
mov    0x2c58(%rip),%rax
mov    (%rax),%r10d
sub    $0x10,%rsp
mov    %rsp,%rax
mov    %r10d,(%rax)
call   1070 <getnameinfo@plt>
mov    -0x148(%rbp),%rsi
mov    -0x140(%rbp),%rdx
add    $0x10,%rsp
mov    -0x150(%rbp),%eax
lea    0xc67(%rip),%rdi
mov    %al,-0x151(%rbp)
call   1040 <printf@plt>
mov    -0x160(%rbp),%rdx
mov    -0x151(%rbp),%al
mov    -0x128(%rbp),%esi
lea    0xc60(%rip),%rdi
call   1040 <printf@plt>
mov    -0x150(%rbp),%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0x12c(%rbp)
lea    -0x12c(%rbp),%rdi
call   10b0 <gmtime@plt>
mov    %rax,-0x138(%rbp)
movsbl -0x100(%rbp),%eax
mov    %eax,-0x14c(%rbp)
sub    $0x64,%eax
je     1467 <main+0x297>
jmp    1404 <main+0x234>
mov    -0x14c(%rbp),%eax
sub    $0x71,%eax
je     14a6 <main+0x2d6>
jmp    1418 <main+0x248>
mov    -0x14c(%rbp),%eax
sub    $0x74,%eax
jne    14c5 <main+0x2f5>
jmp    142c <main+0x25c>
lea    -0xa0(%rbp),%rdi
mov    -0x138(%rbp),%rax
mov    0x14(%rax),%edx
add    $0x2,%edx
mov    -0x138(%rbp),%rax
mov    (%rax),%ecx
mov    -0x138(%rbp),%rax
mov    0x4(%rax),%r8d
lea    0xbdc(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    14c5 <main+0x2f5>
lea    -0xa0(%rbp),%rdi
mov    -0x138(%rbp),%rax
mov    0x10(%rax),%edx
sub    $0x64,%edx
mov    -0x138(%rbp),%rax
mov    0xc(%rax),%ecx
add    $0x1,%ecx
mov    -0x138(%rbp),%rax
mov    0x8(%rax),%r8d
lea    0xbb2(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    14c5 <main+0x2f5>
lea    -0xa0(%rbp),%rdi
lea    0xbb8(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
movl   $0x1,-0x120(%rbp)
lea    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x128(%rbp)
movslq -0x128(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
mov    -0x11c(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0x128(%rbp),%edx
lea    -0x48(%rbp),%r8
mov    -0x124(%rbp),%r9d
xor    %ecx,%ecx
call   1050 <sendto@plt>
jmp    12d2 <main+0x102>
mov    -0x11c(%rbp),%edi
call   1060 <close@plt>
mov    -0x108(%rbp),%rax
mov    %rax,%rsp
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    $0x118,%rsp
mov    %rsp,-0x50(%rbp)
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
movq   $0x0,-0x70(%rbp)
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
lea    -0x88(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%esi
mov    0x14(%rax),%edi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,%r14d
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rsi
mov    (%rax),%edx
mov    %r14d,%edi
call   10a0 <bind@plt>
mov    -0x40(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
lea    -0x38(%rbp),%rbx
mov    %r14d,-0x30(%rbp)
mov    -0x60(%rbp),%r13
jmp    1302 <main+0x132>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x14(%rax),%edx
add    $0x2,%edx
mov    (%rax),%ecx
mov    0x4(%rax),%r8d
lea    -0xe0(%rbp),%r12
mov    %r12,%rdi
lea    0xd6a(%rip),%rsi
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    %r15,%rbx
mov    -0x30(%rbp),%r14d
mov    %r12,%rdi
call   1030 <strlen@plt>
movslq %eax,%rdx
movb   $0x0,-0xe0(%rbp,%rdx,1)
mov    -0x2c(%rbp),%r9d
mov    %r14d,%edi
mov    %r12,%rsi
xor    %ecx,%ecx
mov    %r15,%r8
call   1050 <sendto@plt>
movl   $0x4,-0x2c(%rbp)
mov    %r14d,%edi
lea    -0x140(%rbp),%r14
mov    %r14,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
lea    -0x2c(%rbp),%r9
call   1090 <recvfrom@plt>
mov    %eax,%r12d
mov    -0x2c(%rbp),%esi
mov    0x2c82(%rip),%rax
mov    (%rax),%ecx
mov    0x2c99(%rip),%rax
mov    (%rax),%r9d
mov    0x2c77(%rip),%rax
mov    (%rax),%eax
sub    $0x8,%rsp
mov    %rbx,%r15
mov    %rbx,%rdi
mov    %r13,%rdx
mov    -0x58(%rbp),%rbx
mov    %rbx,%r8
push   %rax
call   1070 <getnameinfo@plt>
add    $0x10,%rsp
lea    0xc90(%rip),%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc9a(%rip),%rdi
mov    %r12d,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x44(%rbp)
lea    -0x44(%rbp),%rdi
call   10b0 <gmtime@plt>
movsbl -0x140(%rbp),%ecx
cmp    $0x64,%ecx
je     13f0 <main+0x220>
cmp    $0x74,%ecx
je     12b0 <main+0xe0>
cmp    $0x71,%ecx
je     1416 <main+0x246>
lea    -0xe0(%rbp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
movslq %eax,%rdx
movb   $0x0,-0xe0(%rbp,%rdx,1)
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%r14d
mov    %r14d,%edi
mov    %rbx,%rsi
xor    %ecx,%ecx
mov    %r15,%rbx
jmp    12fa <main+0x12a>
mov    0x10(%rax),%edx
add    $0xffffff9c,%edx
mov    0x8(%rax),%r8d
mov    0xc(%rax),%ecx
add    $0x1,%ecx
lea    -0xe0(%rbp),%r12
mov    %r12,%rdi
lea    0xc3b(%rip),%rsi
jmp    12cd <main+0xfd>
movabs $0x746e65696c6320,%rax
mov    %rax,-0xd9(%rbp)
movabs $0x20657962646f6f47,%rax
79 65 20
mov    %rax,-0xe0(%rbp)
lea    -0xe0(%rbp),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
movslq %eax,%rdx
movb   $0x0,-0xe0(%rbp,%rdx,1)
mov    -0x2c(%rbp),%r9d
lea    -0x38(%rbp),%r8
mov    -0x30(%rbp),%ebx
mov    %ebx,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <sendto@plt>
mov    %ebx,%edi
call   1060 <close@plt>
mov    -0x50(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.addrinfo = type { i32, i64, i32, i32, i64, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@NI_NUMERICHOST = global i32 0
@.str = [30 x i8] c"Message recieved from %s::%s\0A\00"
@.str.1 = [25 x i8] c"Length: %d Bytes\09Msg:%s\0A\00"
@.str.2 = [21 x i8] c"Hour:\09%02d:%02d:%02d\00"
@.str.3 = [32 x i8] c"Year:20%02d\09Month:%02d\09Day:%02d\00"
@.str.4 = [15 x i8] c"Goodbye client\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.addrinfo
%6 = alloca %struct.addrinfo*
%7 = alloca %struct.sockaddr_storage
%8 = alloca [81 x i8]
%9 = alloca [81 x i8]
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.tm*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%19 = load i32, i32* @NI_MAXHOST
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %10
%22 = alloca i8, i64 %20
store i64 %20, i64* %11
%23 = load i32, i32* @NI_MAXSERV
%24 = zext i32 %23 to i64
%25 = alloca i8, i64 %24
store i64 %24, i64* %12
%26 = load i32, i32* @AI_PASSIVE
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 5
store i32 %26, i32* %27
%28 = load i32, i32* @AF_UNSPEC
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 3
store i32 %28, i32* %29
%30 = load i32, i32* @SOCK_DGRAM
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 2
store i32 %30, i32* %31
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i32 0, i32 4
store i64 0, i64* %32
%33 = load i8**, i8*** %4
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @getaddrinfo(i8* %35, i8* %38, %struct.addrinfo* %5, %struct.addrinfo** %6)
%40 = load %struct.addrinfo*, %struct.addrinfo** %6
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i32 0, i32 3
%42 = load i32, i32* %41
%43 = load %struct.addrinfo*, %struct.addrinfo** %6
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %43, i32 0, i32 2
%45 = load i32, i32* %44
%46 = call i32 @socket(i32 %42, i32 %45, i32 0)
store i32 %46, i32* %13
%47 = load i32, i32* %13
%48 = load %struct.addrinfo*, %struct.addrinfo** %6
%49 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %48, i32 0, i32 1
%50 = load i64, i64* %49
%51 = inttoptr i64 %50 to %struct.sockaddr*
%52 = load %struct.addrinfo*, %struct.addrinfo** %6
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %52, i32 0, i32 0
%54 = load i32, i32* %53
%55 = call i32 @bind(i32 %47, %struct.sockaddr* %51, i32 %54)
%56 = load %struct.addrinfo*, %struct.addrinfo** %6
%57 = call i32 @freeaddrinfo(%struct.addrinfo* %56)
store i32 0, i32* %14
br label %58
58: ; preds = %112, %2
%59 = load i32, i32* %14
%60 = icmp ne i32 %59, 0
%61 = xor i1 %60, true
br i1 %61, label %62, label %124
62: ; preds = %58
store i32 4, i32* %15
%63 = load i32, i32* %13
%64 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%65 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr*
%66 = call i32 @recvfrom(i32 %63, i8* %64, i32 1, i32 0, %struct.sockaddr* %65, i32* %15)
store i32 %66, i32* %16
%67 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr*
%68 = load i32, i32* %15
%69 = load i32, i32* @NI_MAXHOST
%70 = load i32, i32* @NI_MAXSERV
%71 = load i32, i32* @NI_NUMERICHOST
%72 = call i32 @getnameinfo(%struct.sockaddr* %67, i32 %68, i8* %22, i32 %69, i8* %25, i32 %70, i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %25)
%74 = load i32, i32* %16
%75 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %74, i8* %75)
%77 = call i32 @time(i32* null)
store i32 %77, i32* %17
%78 = call %struct.tm* @gmtime(i32* %17)
store %struct.tm* %78, %struct.tm** %18
%79 = getelementptr inbounds [81 x i8], [81 x i8]* %9, i64 0, i64 0
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
switch i32 %81, label %112 [
i32 116, label %82
i32 100, label %95
i32 113, label %109
]
82: ; preds = %62
%83 = getelementptr inbounds [81 x i8], [81 x i8]* %8, i64 0, i64 0
%84 = load %struct.tm*, %struct.tm** %18
%85 = getelementptr inbounds %struct.tm, %struct.tm* %84, i32 0, i32 5
%86 = load i32, i32* %85
%87 = add nsw i32 %86, 2
%88 = load %struct.tm*, %struct.tm** %18
%89 = getelementptr inbounds %struct.tm, %struct.tm* %88, i32 0, i32 0
%90 = load i32, i32* %89
%91 = load %struct.tm*, %struct.tm** %18
%92 = getelementptr inbounds %struct.tm, %struct.tm* %91, i32 0, i32 1
%93 = load i32, i32* %92
%94 = call i32 (i8*, i8*, ...) @sprintf(i8* %83, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %87, i32 %90, i32 %93)
br label %112
95: ; preds = %62
%96 = getelementptr inbounds [81 x i8], [81 x i8]* %8, i64 0, i64 0
%97 = load %struct.tm*, %struct.tm** %18
%98 = getelementptr inbounds %struct.tm, %struct.tm* %97, i32 0, i32 4
%99 = load i32, i32* %98
%100 = sub nsw i32 %99, 100
%101 = load %struct.tm*, %struct.tm** %18
%102 = getelementptr inbounds %struct.tm, %struct.tm* %101, i32 0, i32 3
%103 = load i32, i32* %102
%104 = add nsw i32 %103, 1
%105 = load %struct.tm*, %struct.tm** %18
%106 = getelementptr inbounds %struct.tm, %struct.tm* %105, i32 0, i32 2
%107 = load i32, i32* %106
%108 = call i32 (i8*, i8*, ...) @sprintf(i8* %96, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %100, i32 %104, i32 %107)
br label %112
109: ; preds = %62
%110 = getelementptr inbounds [81 x i8], [81 x i8]* %8, i64 0, i64 0
%111 = call i32 (i8*, i8*, ...) @sprintf(i8* %110, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %14
br label %112
112: ; preds = %62, %109, %95, %82
%113 = getelementptr inbounds [81 x i8], [81 x i8]* %8, i64 0, i64 0
%114 = call i32 @strlen(i8* %113)
store i32 %114, i32* %16
%115 = load i32, i32* %16
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [81 x i8], [81 x i8]* %8, i64 0, i64 %116
store i8 0, i8* %117
%118 = load i32, i32* %13
%119 = getelementptr inbounds [81 x i8], [81 x i8]* %8, i64 0, i64 0
%120 = load i32, i32* %16
%121 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr*
%122 = load i32, i32* %15
%123 = call i32 @sendto(i32 %118, i8* %119, i32 %120, i32 0, %struct.sockaddr* %121, i32 %122)
br label %58
124: ; preds = %58
%125 = load i32, i32* %13
%126 = call i32 @close(i32 %125)
%127 = load i8*, i8** %10
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i64, i32, i32, i64, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@NI_NUMERICHOST = global i32 0
@.str = [30 x i8] c"Message recieved from %s::%s\0A\00"
@.str.1 = [25 x i8] c"Length: %d Bytes\09Msg:%s\0A\00"
@.str.2 = [21 x i8] c"Hour:\09%02d:%02d:%02d\00"
@.str.3 = [32 x i8] c"Year:20%02d\09Month:%02d\09Day:%02d\00"
@.str.4 = [15 x i8] c"Goodbye client\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.sockaddr_storage
%6 = alloca [81 x i8]
%7 = alloca [81 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = bitcast %struct.addrinfo* %3 to i8*
%11 = bitcast %struct.addrinfo** %4 to i8*
%12 = bitcast %struct.sockaddr_storage* %5 to i8*
%13 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [81 x i8], [81 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* @NI_MAXHOST
%16 = zext i32 %15 to i64
%17 = tail call i8* @llvm.stacksave()
%18 = alloca i8, i64 %16
%19 = load i32, i32* @NI_MAXSERV
%20 = zext i32 %19 to i64
%21 = alloca i8, i64 %20
%22 = load i32, i32* @AI_PASSIVE
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %22, i32* %23
%24 = load i32, i32* @AF_UNSPEC
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %24, i32* %25
%26 = load i32, i32* @SOCK_DGRAM
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i32 %26, i32* %27
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i64 0, i64* %28
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8*, i8** %1, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @getaddrinfo(i8* %30, i8* %32, %struct.addrinfo* %3, %struct.addrinfo** %4)
%34 = load %struct.addrinfo*, %struct.addrinfo** %4
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 3
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 2
%38 = load i32, i32* %37
%39 = call i32 @socket(i32 %36, i32 %38, i32 0)
%40 = load %struct.addrinfo*, %struct.addrinfo** %4
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 1
%42 = load i64, i64* %41
%43 = inttoptr i64 %42 to %struct.sockaddr*
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 0
%45 = load i32, i32* %44
%46 = call i32 @bind(i32 %39, %struct.sockaddr* %43, i32 %45)
%47 = load %struct.addrinfo*, %struct.addrinfo** %4
%48 = call i32 @freeaddrinfo(%struct.addrinfo* %47)
%49 = bitcast i32* %8 to i8*
%50 = bitcast %struct.sockaddr_storage* %5 to %struct.sockaddr*
%51 = bitcast i32* %9 to i8*
br label %59
52: ; preds = %59
%53 = call i32 @strlen(i8* %13)
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 %54
store i8 0, i8* %55
%56 = load i32, i32* %8
%57 = call i32 @sendto(i32 %39, i8* %13, i32 %53, i32 0, %struct.sockaddr* %50, i32 %56)
br label %58
58: ; preds = %52, %98
br label %59
59: ; preds = %58, %2
store i32 4, i32* %8
%60 = call i32 @recvfrom(i32 %39, i8* %14, i32 1, i32 0, %struct.sockaddr* %50, i32* %8)
%61 = load i32, i32* %8
%62 = load i32, i32* @NI_MAXHOST
%63 = load i32, i32* @NI_MAXSERV
%64 = load i32, i32* @NI_NUMERICHOST
%65 = call i32 @getnameinfo(%struct.sockaddr* %50, i32 %61, i8* %18, i32 %62, i8* %21, i32 %63, i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %21)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %60, i8* %14)
%68 = call i32 @time(i32* null)
store i32 %68, i32* %9
%69 = call %struct.tm* @gmtime(i32* %9)
%70 = load i8, i8* %14
%71 = sext i8 %70 to i32
switch i32 %71, label %52 [
i32 116, label %72
i32 100, label %81
i32 113, label %91
]
72: ; preds = %59
%73 = getelementptr inbounds %struct.tm, %struct.tm* %69, i64 0, i32 5
%74 = load i32, i32* %73
%75 = add nsw i32 %74, 2
%76 = getelementptr inbounds %struct.tm, %struct.tm* %69, i64 0, i32 0
%77 = load i32, i32* %76
%78 = getelementptr inbounds %struct.tm, %struct.tm* %69, i64 0, i32 1
%79 = load i32, i32* %78
%80 = call i32 (i8*, i8*, ...) @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %75, i32 %77, i32 %79)
br label %98
81: ; preds = %59
%82 = getelementptr inbounds %struct.tm, %struct.tm* %69, i64 0, i32 4
%83 = load i32, i32* %82
%84 = add nsw i32 %83, -100
%85 = getelementptr inbounds %struct.tm, %struct.tm* %69, i64 0, i32 3
%86 = load i32, i32* %85
%87 = add nsw i32 %86, 1
%88 = getelementptr inbounds %struct.tm, %struct.tm* %69, i64 0, i32 2
%89 = load i32, i32* %88
%90 = call i32 (i8*, i8*, ...) @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %84, i32 %87, i32 %89)
br label %98
91: ; preds = %59
%92 = call i32 @strlen(i8* %13)
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 %93
store i8 0, i8* %94
%95 = load i32, i32* %8
%96 = call i32 @sendto(i32 %39, i8* %13, i32 %92, i32 0, %struct.sockaddr* %50, i32 %95)
%97 = call i32 @close(i32 %39)
ret void
98: ; preds = %81, %72
%99 = call i32 @strlen(i8* %13)
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 %100
store i8 0, i8* %101
%102 = load i32, i32* %8
%103 = call i32 @sendto(i32 %39, i8* %13, i32 %99, i32 0, %struct.sockaddr* %50, i32 %102)
br label %58
}