#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  char *tm_zone;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_zero;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EACCES;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int sendto(int, char *, int /*<<< orphan*/, int /*<<< orphan*/,
           struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  register int sfd;
  int addr_len;
  struct sockaddr_in server_addr;
  struct sockaddr_in client_addr;
  time_t t;
  struct tm *tm;
  int numbytes;
  char usage[100];
  char timemsg[100];
  char buf[100];
  int portnumber;
  const int portnumberdefault = 13;
  sprintf(
      usage,
      "Usage: %s [portnumber] (0 <= port_number <= 65535)\nExample: %s 1024\n",
      argv[0], argv[0]);
  switch (argc) {
  case 1:
    portnumber = portnumberdefault;
    break;
  case 2:
    if (sscanf(argv[1], "%d", &portnumber) == 0)
      return 2;
    if (!((portnumber > 0) && (portnumber < 65535)))
      return 3;
    break;
  default:
    printf("%s", usage);
    return 1;
  }
  if ((sfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("socket");
    return 1;
  }
  server_addr.sin_family = AF_INET;
  server_addr.sin_port = htons(portnumber);
  server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  memset(&(server_addr.sin_zero), '\0', 8);
  if (bind(sfd, (struct sockaddr *)&server_addr, sizeof server_addr) < 0) {
    perror("bind");
    if (errno == EACCES) {
      if (portnumber == portnumberdefault) {
        printf("Error: This server listens to port %d by default.\nYou must "
               "have root access to run servers which listen to port numbers "
               "below 1024.\n",
               portnumberdefault);
        printf("%s", usage);
      }
    }
    return 2;
  }
  addr_len = sizeof(struct sockaddr);
  for (;;) {
    if ((numbytes = recvfrom(sfd, buf, 100 - 1, 0,
                             (struct sockaddr *)&client_addr, &addr_len)) < 0) {
      perror("recvfrom");
      exit(1);
    }
    printf("3-Un client demande depuis %s\n", inet_ntoa(server_addr.sin_addr));
    if ((t = time(NULL)) < 0) {
      perror("daytimed-udp time");
      return 6;
    }
    tm = localtime(&t);
    sprintf(timemsg, "%.4i-%.2i-%.2i %.2i:%.2i:%.2i %s\n", tm->tm_year + 1900,
            tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
            tm->tm_zone);
    if ((numbytes = sendto(sfd, timemsg, strlen(timemsg), 0,
                           (struct sockaddr *)&client_addr, addr_len)) < 0) {
      perror("daytimed-udp send");
      exit(5);
    }
    printf("4-Revoyé %s", timemsg);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xd,-0x198(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xdcf(%rip),%rsi
xor    %eax,%eax
lea    -0xb0(%rbp),%rdi
mov    %rcx,%rdx
call   1100 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x19c(%rbp)
sub    $0x1,%eax
je     126d <main+0x6d>
jmp    1259 <main+0x59>
mov    -0x19c(%rbp),%eax
sub    $0x2,%eax
je     127c <main+0x7c>
jmp    12da <main+0xda>
movl   $0xd,-0x194(%rbp)
jmp    12fb <main+0xfb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdba(%rip),%rsi
lea    -0x194(%rbp),%rdx
call   10d0 <sscanf@plt>
cmp    $0x0,%eax
jne    12ac <main+0xac>
movl   $0x2,-0x4(%rbp)
jmp    1576 <main+0x376>
cmpl   $0x0,-0x194(%rbp)
jle    12c9 <main+0xc9>
cmpl   $0xffff,-0x194(%rbp)
jl     12d5 <main+0xd5>
movl   $0x3,-0x4(%rbp)
jmp    1576 <main+0x376>
jmp    12fb <main+0xfb>
lea    -0xb0(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1576 <main+0x376>
mov    0x2cb6(%rip),%rax
mov    (%rax),%edi
mov    0x2ccd(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1338 <main+0x138>
lea    0xd21(%rip),%rdi
call   10f0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1576 <main+0x376>
mov    0x2ca9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x194(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    0x2c87(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
add    $0x4,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   10e0 <bind@plt>
cmp    $0x0,%rax
jge    13fe <main+0x1fe>
lea    0xcb6(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2c1b(%rip),%rax
mov    (%rax),%rax
mov    0x2c21(%rip),%rcx
cmp    (%rcx),%rax
jne    13f2 <main+0x1f2>
cmpl   $0xd,-0x194(%rbp)
jne    13ed <main+0x1ed>
lea    0xc88(%rip),%rdi
mov    $0xd,%esi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0xb0(%rbp),%rsi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    13f2 <main+0x1f2>
movl   $0x2,-0x4(%rbp)
jmp    1576 <main+0x376>
movl   $0x4,-0x18(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x190(%rbp),%rsi
lea    -0x38(%rbp),%r8
mov    $0x63,%edx
xor    %ecx,%ecx
lea    -0x18(%rbp),%r9
call   10c0 <recvfrom@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
jge    1445 <main+0x245>
lea    0xca3(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x28(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xc8b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jge    148b <main+0x28b>
lea    0xc87(%rip),%rdi
call   10f0 <perror@plt>
movl   $0x6,-0x4(%rbp)
jmp    1576 <main+0x376>
lea    -0x3c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x48(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x48(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x48(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%r11d
mov    -0x48(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%rax
lea    0xc2f(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1100 <sprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1ac(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
lea    -0x120(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1ac(%rbp),%edi
mov    -0x1a8(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%r8
mov    -0x18(%rbp),%r9d
xor    %ecx,%ecx
call   10a0 <sendto@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
jge    155c <main+0x35c>
lea    0xbe8(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x5,%edi
call   1110 <exit@plt>
lea    -0x120(%rbp),%rsi
lea    0xbdd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1405 <main+0x205>
mov    -0x4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x178,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rcx
lea    0xde0(%rip),%rsi
lea    0x30(%rsp),%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   1100 <sprintf@plt>
cmp    $0x2,%ebp
je     1253 <main+0x53>
cmp    $0x1,%ebp
je     129a <main+0x9a>
lea    0xf11(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebx
jmp    1286 <main+0x86>
mov    0x8(%rbx),%rdi
lea    0xde7(%rip),%rsi
lea    0x4(%rsp),%rdx
call   10d0 <sscanf@plt>
test   %eax,%eax
je     1281 <main+0x81>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
mov    $0x3,%ebx
cmp    $0xfffe,%eax
jae    1286 <main+0x86>
jmp    12a2 <main+0xa2>
mov    $0x2,%ebx
mov    %ebx,%eax
add    $0x178,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movl   $0xd,0x4(%rsp)
mov    0x2d0f(%rip),%rax
mov    (%rax),%edi
mov    0x2d26(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
jns    12d2 <main+0xd2>
lea    0xd82(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%ebx
jmp    1286 <main+0x86>
mov    %eax,%r14d
mov    0x2d0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x4(%rsp),%edi
call   1060 <htons@plt>
mov    %eax,0x18(%rsp)
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x10(%rsp)
lea    0x14(%rsp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x10,%edx
call   10e0 <bind@plt>
test   %rax,%rax
jns    138a <main+0x18a>
lea    0xd1f(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2c84(%rip),%rax
mov    (%rax),%rax
mov    0x2c8a(%rip),%rcx
mov    $0x2,%ebx
cmp    (%rcx),%rax
jne    1286 <main+0x86>
cmpl   $0xd,0x4(%rsp)
jne    1286 <main+0x86>
lea    0xcee(%rip),%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdd8(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1286 <main+0x86>
movl   $0x4,0x8(%rsp)
lea    0xa0(%rsp),%rsi
lea    0x20(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %r14d,%edi
mov    $0x63,%edx
xor    %ecx,%ecx
call   10c0 <recvfrom@plt>
test   %eax,%eax
js     14a0 <main+0x2a0>
lea    0x110(%rsp),%r15
lea    0x20(%rsp),%r13
lea    0x8(%rsp),%r12
nopl   (%rax)
mov    0x10(%rsp),%edi
call   1040 <inet_ntoa@plt>
lea    0xd02(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
js     14b6 <main+0x2b6>
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbp
mov    (%rax),%edx
mov    $0x76c,%eax
add    %eax,%edx
mov    0x4(%rbp),%ecx
mov    0x8(%rbp),%r8d
add    $0x1,%ecx
mov    0xc(%rbp),%r9d
mov    0x10(%rbp),%r10d
mov    0x14(%rbp),%ebx
sub    $0x8,%rsp
mov    %r15,%rdi
lea    0xcdd(%rip),%rsi
xor    %eax,%eax
push   0x18(%rbp)
push   %rbx
push   %r10
call   1100 <sprintf@plt>
add    $0x20,%rsp
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    0x8(%rsp),%r9d
mov    %r14d,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r13,%r8
call   10a0 <sendto@plt>
test   %eax,%eax
js     14cc <main+0x2cc>
lea    0xcd6(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%edi
lea    0xa0(%rsp),%rsi
mov    $0x63,%edx
xor    %ecx,%ecx
mov    %r13,%r8
mov    %r12,%r9
call   10c0 <recvfrom@plt>
test   %eax,%eax
jns    13d0 <main+0x1d0>
lea    0xc32(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xc44(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x6,%ebx
jmp    1286 <main+0x86>
lea    0xc62(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x5,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32, i8* }
%struct.sockaddr = type { i32 }
@.str = [69 x i8] c"Usage: %s [portnumber] (0 <= port_number <= 65535)\0AExample: %s 1024\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%s\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [5 x i8] c"bind\00"
@errno = global i64 0
@EACCES = global i64 0
@.str.5 = [133 x i8] c"Error: This server listens to port %d by default.\0AYou must have root access to run servers which listen to port numbers below 1024.\0A\00"
@.str.6 = [9 x i8] c"recvfrom\00"
@.str.7 = [31 x i8] c"3-Un client demande depuis %s\0A\00"
@.str.8 = [18 x i8] c"daytimed-udp time\00"
@.str.9 = [34 x i8] c"%.4i-%.2i-%.2i %.2i:%.2i:%.2i %s\0A\00"
@.str.10 = [18 x i8] c"daytimed-udp send\00"
@.str.11 = [13 x i8] c"4-Revoy\C3\A9 %s\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.sockaddr_in
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
%11 = alloca %struct.tm*
%12 = alloca i32
%13 = alloca [100 x i8]
%14 = alloca [100 x i8]
%15 = alloca [100 x i8]
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 13, i32* %17
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %24)
%26 = load i32, i32* %4
switch i32 %26, label %43 [
i32 1, label %27
i32 2, label %28
]
27: ; preds = %2
store i32 13, i32* %16
br label %46
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @sscanf(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %28
store i32 2, i32* %3
br label %144
35: ; preds = %28
%36 = load i32, i32* %16
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* %16
%40 = icmp slt i32 %39, 65535
br i1 %40, label %42, label %41
41: ; preds = %38, %35
store i32 3, i32* %3
br label %144
42: ; preds = %38
br label %46
43: ; preds = %2
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %44)
store i32 1, i32* %3
br label %144
46: ; preds = %42, %27
%47 = load i32, i32* @PF_INET
%48 = load i32, i32* @SOCK_DGRAM
%49 = call i32 @socket(i32 %47, i32 %48, i32 0)
store i32 %49, i32* %6
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %144
53: ; preds = %46
%54 = load i32, i32* @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 3
store i32 %54, i32* %55
%56 = load i32, i32* %16
%57 = call i32 @htons(i32 %56)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %57, i32* %58
%59 = load i32, i32* @INADDR_ANY
%60 = call i32 @htonl(i32 %59)
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%62 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %61, i32 0, i32 0
store i32 %60, i32* %62
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%64 = call i32 @memset(i32* %63, i8 signext 0, i32 8)
%65 = load i32, i32* %6
%66 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%67 = call i64 @bind(i32 %65, %struct.sockaddr* %66, i32 16)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %83
69: ; preds = %53
%70 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%71 = load i64, i64* @errno
%72 = load i64, i64* @EACCES
%73 = icmp eq i64 %71, %72
br i1 %73, label %74, label %82
74: ; preds = %69
%75 = load i32, i32* %16
%76 = icmp eq i32 %75, 13
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.5, i64 0, i64 0), i32 13)
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %79)
br label %81
81: ; preds = %77, %74
br label %82
82: ; preds = %81, %69
store i32 2, i32* %3
br label %144
83: ; preds = %53
store i32 4, i32* %7
br label %84
84: ; preds = %141, %83
%85 = load i32, i32* %6
%86 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%87 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%88 = call i32 @recvfrom(i32 %85, i8* %86, i32 99, i32 0, %struct.sockaddr* %87, i32* %7)
store i32 %88, i32* %12
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %84
%91 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %84
%94 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%95 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %94, i32 0, i32 0
%96 = load i32, i32* %95
%97 = call i8* @inet_ntoa(i32 %96)
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %97)
%99 = call i32 @time(i32* null)
store i32 %99, i32* %10
%100 = icmp slt i32 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %93
%102 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
store i32 6, i32* %3
br label %144
103: ; preds = %93
%104 = call %struct.tm* @localtime(i32* %10)
store %struct.tm* %104, %struct.tm** %11
%105 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%106 = load %struct.tm*, %struct.tm** %11
%107 = getelementptr inbounds %struct.tm, %struct.tm* %106, i32 0, i32 0
%108 = load i32, i32* %107
%109 = add nsw i32 %108, 1900
%110 = load %struct.tm*, %struct.tm** %11
%111 = getelementptr inbounds %struct.tm, %struct.tm* %110, i32 0, i32 1
%112 = load i32, i32* %111
%113 = add nsw i32 %112, 1
%114 = load %struct.tm*, %struct.tm** %11
%115 = getelementptr inbounds %struct.tm, %struct.tm* %114, i32 0, i32 2
%116 = load i32, i32* %115
%117 = load %struct.tm*, %struct.tm** %11
%118 = getelementptr inbounds %struct.tm, %struct.tm* %117, i32 0, i32 3
%119 = load i32, i32* %118
%120 = load %struct.tm*, %struct.tm** %11
%121 = getelementptr inbounds %struct.tm, %struct.tm* %120, i32 0, i32 4
%122 = load i32, i32* %121
%123 = load %struct.tm*, %struct.tm** %11
%124 = getelementptr inbounds %struct.tm, %struct.tm* %123, i32 0, i32 5
%125 = load i32, i32* %124
%126 = load %struct.tm*, %struct.tm** %11
%127 = getelementptr inbounds %struct.tm, %struct.tm* %126, i32 0, i32 6
%128 = load i8*, i8** %127
%129 = call i32 (i8*, i8*, ...) @sprintf(i8* %105, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %109, i32 %113, i32 %116, i32 %119, i32 %122, i32 %125, i8* %128)
%130 = load i32, i32* %6
%131 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%132 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%133 = call i32 @strlen(i8* %132)
%134 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%135 = load i32, i32* %7
%136 = call i32 @sendto(i32 %130, i8* %131, i32 %133, i32 0, %struct.sockaddr* %134, i32 %135)
store i32 %136, i32* %12
%137 = icmp slt i32 %136, 0
br i1 %137, label %138, label %141
138: ; preds = %103
%139 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%140 = call i32 @exit(i32 5)
unreachable
141: ; preds = %103
%142 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %142)
br label %84
144: ; preds = %101, %82, %51, %43, %41, %34
%145 = load i32, i32* %3
ret i32 %145
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32, i8* }
@.str = [69 x i8] c"Usage: %s [portnumber] (0 <= port_number <= 65535)\0AExample: %s 1024\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%s\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [5 x i8] c"bind\00"
@errno = global i64 0
@EACCES = global i64 0
@.str.5 = [133 x i8] c"Error: This server listens to port %d by default.\0AYou must have root access to run servers which listen to port numbers below 1024.\0A\00"
@.str.6 = [9 x i8] c"recvfrom\00"
@.str.7 = [31 x i8] c"3-Un client demande depuis %s\0A\00"
@.str.8 = [18 x i8] c"daytimed-udp time\00"
@.str.9 = [34 x i8] c"%.4i-%.2i-%.2i %.2i:%.2i:%.2i %s\0A\00"
@.str.10 = [18 x i8] c"daytimed-udp send\00"
@.str.11 = [13 x i8] c"4-Revoy\C3\A9 %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca i32
%11 = bitcast i32* %3 to i8*
%12 = bitcast %struct.sockaddr_in* %4 to i8*
%13 = bitcast %struct.sockaddr_in* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%18 = bitcast i32* %10 to i8*
%19 = load i8*, i8** %1
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %19)
switch i32 %0, label %31 [
i32 1, label %21
i32 2, label %22
]
21: ; preds = %2
store i32 13, i32* %10
br label %33
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%26 = icmp eq i32 %25, 0
br i1 %26, label %110, label %27
27: ; preds = %22
%28 = load i32, i32* %10
%29 = add i32 %28, -1
%30 = icmp ult i32 %29, 65534
br i1 %30, label %33, label %110
31: ; preds = %2
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %110
33: ; preds = %27, %21
%34 = load i32, i32* @PF_INET
%35 = load i32, i32* @SOCK_DGRAM
%36 = call i32 @socket(i32 %34, i32 %35, i32 0)
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %110
40: ; preds = %33
%41 = load i32, i32* @AF_INET
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 3
store i32 %41, i32* %42
%43 = load i32, i32* %10
%44 = call i32 @htons(i32 %43)
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %44, i32* %45
%46 = load i32, i32* @INADDR_ANY
%47 = call i32 @htonl(i32 %46)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
store i32 %47, i32* %48
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
%50 = call i32 @memset(i32* %49, i8 signext 0, i32 8)
%51 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%52 = call i64 @bind(i32 %36, %struct.sockaddr* %51, i32 16)
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %65
54: ; preds = %40
%55 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%56 = load i64, i64* @errno
%57 = load i64, i64* @EACCES
%58 = icmp eq i64 %56, %57
%59 = load i32, i32* %10
%60 = icmp eq i32 %59, 13
%61 = select i1 %58, i1 %60, i1 false
br i1 %61, label %62, label %110
62: ; preds = %54
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([133 x i8], [133 x i8]* @.str.5, i64 0, i64 0), i32 13)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %110
65: ; preds = %40
store i32 4, i32* %3
%66 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%67 = call i32 @recvfrom(i32 %36, i8* %17, i32 99, i32 0, %struct.sockaddr* %66, i32* %3)
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %106, %65
%70 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %65, %106
%73 = load i32, i32* %48
%74 = call i8* @inet_ntoa(i32 %73)
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %74)
%76 = call i32 @time(i32* null)
store i32 %76, i32* %6
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %72
%79 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %110
80: ; preds = %72
%81 = call %struct.tm* @localtime(i32* %6)
%82 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 0
%83 = load i32, i32* %82
%84 = add nsw i32 %83, 1900
%85 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 1
%86 = load i32, i32* %85
%87 = add nsw i32 %86, 1
%88 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 2
%89 = load i32, i32* %88
%90 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 3
%91 = load i32, i32* %90
%92 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 4
%93 = load i32, i32* %92
%94 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 5
%95 = load i32, i32* %94
%96 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 6
%97 = load i8*, i8** %96
%98 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %84, i32 %87, i32 %89, i32 %91, i32 %93, i32 %95, i8* %97)
%99 = call i32 @strlen(i8* %16)
%100 = load i32, i32* %3
%101 = call i32 @sendto(i32 %36, i8* %16, i32 %99, i32 0, %struct.sockaddr* %66, i32 %100)
%102 = icmp slt i32 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %80
%104 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%105 = call i32 @exit(i32 5)
unreachable
106: ; preds = %80
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %16)
%108 = call i32 @recvfrom(i32 %36, i8* %17, i32 99, i32 0, %struct.sockaddr* %66, i32* %3)
%109 = icmp slt i32 %108, 0
br i1 %109, label %69, label %72
110: ; preds = %54, %62, %27, %22, %78, %38, %31
%111 = phi i32 [ 1, %31 ], [ 1, %38 ], [ 6, %78 ], [ 2, %22 ], [ 3, %27 ], [ 2, %62 ], [ 2, %54 ]
ret i32 %111
}