#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_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ ttl;
struct timeb {
  int /*<<< orphan*/ time;
};
struct sockaddr_un {
  int dummy;
};
struct TYPE_3__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ h_addr;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ sendbuf;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_TTL;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ close(int);
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ ftime(struct timeb *);
scalar_t__ gethostbyname(char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ inet_addr(char *);
char *inet_ntoa(TYPE_1__);
int /*<<< orphan*/ memcpy(TYPE_1__ *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int serverSocket, unixSocket, n, retread;
  struct sockaddr_in serv_addr;
  struct sockaddr_un unixAddr;
  char *data;
  char sendbuf[1500];
  struct timeb tp;
  struct hostent *hp;
  int ttl;
  socklen_t len = sizeof(serv_addr);
  if (argc != 3) {
    usage();
  }
  memset((char *)&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin_family = PF_INET;
  serv_addr.sin_addr.s_addr = inet_addr(argv[1]);
  serv_addr.sin_port = htons(atoi(argv[2]));
  hp = (struct hostent *)gethostbyname(argv[1]);
  if (hp == NULL) {
    fprintf(stderr, "%s: %s non trouve dans in /etc/hosts ou dans le DNS\n",
            argv[0], argv[1]);
    exit(1);
  }
  memcpy(&serv_addr.sin_addr, hp->h_addr, hp->h_length);
  printf("IP address: %s\n", inet_ntoa(serv_addr.sin_addr));
  if ((serverSocket = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("erreur socket");
    exit(1);
  }
  ttl = 1;
  if (setsockopt(serverSocket, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl)) < 0) {
    perror("setsockopt");
    exit(1);
  }
  ftime(&tp);
  data = ctime(&tp.time);
  if ((n = sendto(serverSocket, data, strlen(data), 0,
                  (struct sockaddr *)&serv_addr, sizeof(serv_addr))) !=
      strlen(data)) {
    perror("erreur sendto");
    exit(1);
  }
  if ((n = recvfrom(serverSocket, sendbuf, sizeof(sendbuf) - 1, 0,
                    (struct sockaddr *)&serv_addr, &len)) != strlen(data)) {
    printf("erreur sendto");
    exit(1);
  }
  sendbuf[n] = '\0';
  printf("Message reçu du serveur %s \n", sendbuf);
  close(serverSocket);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x650,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc,-0x638(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1274 <main+0x34>
mov    $0x0,%al
call   1110 <usage@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <inet_addr@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <gethostbyname@plt>
mov    %rax,-0x630(%rbp)
cmpq   $0x0,-0x630(%rbp)
jne    1307 <main+0xc7>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd08(%rip),%rsi
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
lea    -0x30(%rbp),%rdi
mov    -0x630(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x630(%rbp),%rax
mov    (%rax),%edx
call   10f0 <memcpy@plt>
mov    -0x30(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd00(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    0x2c85(%rip),%rax
mov    (%rax),%edi
mov    0x2c94(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1377 <main+0x137>
lea    0xcdd(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
movl   $0x1,-0x634(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2c5d(%rip),%rax
mov    (%rax),%esi
mov    0x2c24(%rip),%rax
mov    (%rax),%edx
lea    -0x634(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    13c8 <main+0x188>
lea    0xc9a(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
lea    -0x628(%rbp),%rdi
call   1150 <ftime@plt>
lea    -0x628(%rbp),%rdi
call   1050 <ctime@plt>
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x64c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x648(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x64c(%rbp),%edi
mov    -0x648(%rbp),%rsi
mov    %eax,%edx
lea    -0x30(%rbp),%r8
xor    %ecx,%ecx
mov    $0xc,%r9d
call   10a0 <sendto@plt>
mov    %eax,-0x63c(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x63c(%rbp),%eax
cmp    %ecx,%eax
je     1459 <main+0x219>
lea    0xc14(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x620(%rbp),%rsi
lea    -0x30(%rbp),%r8
mov    $0x5db,%edx
xor    %ecx,%ecx
lea    -0x638(%rbp),%r9
call   1100 <recvfrom@plt>
mov    %eax,-0x650(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x650(%rbp),%eax
cmp    %ecx,%eax
je     14b4 <main+0x274>
lea    0xbbb(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
movslq -0x1c(%rbp),%rax
movb   $0x0,-0x620(%rbp,%rax,1)
lea    -0x620(%rbp),%rsi
lea    0xb9e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x650,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x600,%rsp
mov    %rsi,%rbx
movl   $0xc,0x10(%rsp)
cmp    $0x3,%edi
je     1262 <main+0x22>
xor    %eax,%eax
call   1110 <usage@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d50(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    0x8(%rbx),%rdi
call   10c0 <inet_addr@plt>
mov    %eax,(%rsp)
mov    0x10(%rbx),%rdi
call   1130 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,0x4(%rsp)
mov    0x8(%rbx),%rdi
call   10d0 <gethostbyname@plt>
test   %rax,%rax
je     13d0 <main+0x190>
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %rsp,%rdi
call   10f0 <memcpy@plt>
mov    (%rsp),%edi
call   1040 <inet_ntoa@plt>
lea    0xd68(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x0(%rbp),%edi
mov    0x2cff(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
test   %eax,%eax
js     13f6 <main+0x1b6>
mov    %eax,%r14d
movl   $0x1,0x14(%rsp)
mov    0x2ce4(%rip),%rax
mov    (%rax),%esi
mov    0x2cab(%rip),%rax
mov    (%rax),%edx
lea    0x14(%rsp),%rcx
mov    %r14d,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     13ff <main+0x1bf>
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1150 <ftime@plt>
mov    %rbx,%rdi
call   1050 <ctime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <strlen@plt>
mov    %rsp,%r8
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0xc,%r9d
call   10a0 <sendto@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    %eax,%ebp
jne    1408 <main+0x1c8>
lea    0x20(%rsp),%rsi
mov    %rsp,%r8
lea    0x10(%rsp),%r9
mov    %r14d,%edi
mov    $0x5db,%edx
xor    %ecx,%ecx
call   1100 <recvfrom@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    %eax,%ebp
jne    141e <main+0x1de>
movslq %ebp,%rax
movb   $0x0,0x20(%rsp,%rax,1)
lea    0xcbe(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
xor    %eax,%eax
add    $0x600,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
mov    0x8(%rbx),%rcx
lea    0xc19(%rip),%rsi
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
lea    0xc48(%rip),%rdi
jmp    140f <main+0x1cf>
lea    0xc4d(%rip),%rdi
jmp    140f <main+0x1cf>
lea    0xc4f(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
lea    0xc39(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_3__, i32, i32 }
%struct.TYPE_3__ = type { i32 }
%struct.sockaddr_un = type { i32 }
%struct.timeb = type { i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"%s: %s non trouve dans in /etc/hosts ou dans le DNS\0A\00"
@.str.1 = [16 x i8] c"IP address: %s\0A\00"
@SOCK_DGRAM = global i32 0
@.str.2 = [14 x i8] c"erreur socket\00"
@IPPROTO_IP = global i32 0
@IP_TTL = global i32 0
@.str.3 = [11 x i8] c"setsockopt\00"
@.str.4 = [14 x i8] c"erreur sendto\00"
@.str.5 = [30 x i8] c"Message re\C3\A7u du serveur %s \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.sockaddr_un
%12 = alloca i8*
%13 = alloca [1500 x i8]
%14 = alloca %struct.timeb
%15 = alloca %struct.hostent*
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 12, i32* %17
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @usage()
br label %22
22: ; preds = %20, %2
%23 = bitcast %struct.sockaddr_in* %10 to i8*
%24 = call i32 @memset(i8* %23, i32 0, i32 12)
%25 = load i32, i32* @PF_INET
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %25, i32* %26
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @inet_addr(i8* %29)
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%32 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %31, i32 0, i32 0
store i32 %30, i32* %32
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
%37 = call i32 @htons(i32 %36)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %37, i32* %38
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i64 @gethostbyname(i8* %41)
%43 = inttoptr i64 %42 to %struct.hostent*
store %struct.hostent* %43, %struct.hostent** %15
%44 = load %struct.hostent*, %struct.hostent** %15
%45 = icmp eq %struct.hostent* %44, null
br i1 %45, label %46, label %56
46: ; preds = %22
%47 = load i32, i32* @stderr
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 0
%50 = load i8*, i8** %49
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %50, i8* %53)
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %22
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%58 = load %struct.hostent*, %struct.hostent** %15
%59 = getelementptr inbounds %struct.hostent, %struct.hostent* %58, i32 0, i32 1
%60 = load i32, i32* %59
%61 = load %struct.hostent*, %struct.hostent** %15
%62 = getelementptr inbounds %struct.hostent, %struct.hostent* %61, i32 0, i32 0
%63 = load i32, i32* %62
%64 = call i32 @memcpy(%struct.TYPE_3__* %57, i32 %60, i32 %63)
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%66 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %65, i32 0, i32 0
%67 = load i32, i32* %66
%68 = call i8* @inet_ntoa(i32 %67)
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %68)
%70 = load i32, i32* @PF_INET
%71 = load i32, i32* @SOCK_DGRAM
%72 = call i32 @socket(i32 %70, i32 %71, i32 0)
store i32 %72, i32* %6
%73 = icmp slt i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %56
%75 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %56
store i32 1, i32* %16
%78 = load i32, i32* %6
%79 = load i32, i32* @IPPROTO_IP
%80 = load i32, i32* @IP_TTL
%81 = call i64 @setsockopt(i32 %78, i32 %79, i32 %80, i32* %16, i32 4)
%82 = icmp slt i64 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %77
%84 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %77
%87 = call i32 @ftime(%struct.timeb* %14)
%88 = getelementptr inbounds %struct.timeb, %struct.timeb* %14, i32 0, i32 0
%89 = call i8* @ctime(i32* %88)
store i8* %89, i8** %12
%90 = load i32, i32* %6
%91 = load i8*, i8** %12
%92 = load i8*, i8** %12
%93 = call i32 @strlen(i8* %92)
%94 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%95 = call i32 @sendto(i32 %90, i8* %91, i32 %93, i32 0, %struct.sockaddr* %94, i32 12)
store i32 %95, i32* %8
%96 = load i8*, i8** %12
%97 = call i32 @strlen(i8* %96)
%98 = icmp ne i32 %95, %97
br i1 %98, label %99, label %102
99: ; preds = %86
%100 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %86
%103 = load i32, i32* %6
%104 = getelementptr inbounds [1500 x i8], [1500 x i8]* %13, i64 0, i64 0
%105 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%106 = call i32 @recvfrom(i32 %103, i8* %104, i32 1499, i32 0, %struct.sockaddr* %105, i32* %17)
store i32 %106, i32* %8
%107 = load i8*, i8** %12
%108 = call i32 @strlen(i8* %107)
%109 = icmp ne i32 %106, %108
br i1 %109, label %110, label %113
110: ; preds = %102
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %102
%114 = load i32, i32* %8
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [1500 x i8], [1500 x i8]* %13, i64 0, i64 %115
store i8 0, i8* %116
%117 = getelementptr inbounds [1500 x i8], [1500 x i8]* %13, i64 0, i64 0
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %117)
%119 = load i32, i32* %6
%120 = call i32 @close(i32 %119)
%121 = load i32, i32* %3
ret i32 %121
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_3__, i32, i32 }
%struct.TYPE_3__ = type { i32 }
%struct.timeb = type { i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"%s: %s non trouve dans in /etc/hosts ou dans le DNS\0A\00"
@.str.1 = [16 x i8] c"IP address: %s\0A\00"
@SOCK_DGRAM = global i32 0
@.str.2 = [14 x i8] c"erreur socket\00"
@IPPROTO_IP = global i32 0
@IP_TTL = global i32 0
@.str.3 = [11 x i8] c"setsockopt\00"
@.str.4 = [14 x i8] c"erreur sendto\00"
@.str.5 = [30 x i8] c"Message re\C3\A7u du serveur %s \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1500 x i8]
%5 = alloca %struct.timeb
%6 = alloca i32
%7 = alloca i32
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = getelementptr inbounds [1500 x i8], [1500 x i8]* %4, i64 0, i64 0
%10 = bitcast %struct.timeb* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
store i32 12, i32* %7
%13 = icmp eq i32 %0, 3
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = tail call i32 (...) @usage()
br label %16
16: ; preds = %14, %2
%17 = call i32 @memset(i8* %8, i32 0, i32 12)
%18 = load i32, i32* @PF_INET
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %18, i32* %19
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @inet_addr(i8* %21)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %22, i32* %23
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
%27 = call i32 @htons(i32 %26)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %27, i32* %28
%29 = load i8*, i8** %20
%30 = call i64 @gethostbyname(i8* %29)
%31 = inttoptr i64 %30 to %struct.hostent*
%32 = icmp eq i64 %30, 0
br i1 %32, label %33, label %39
33: ; preds = %16
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %1
%36 = load i8*, i8** %20
%37 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %35, i8* %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %16
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%41 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 1
%42 = load i32, i32* %41
%43 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 0
%44 = load i32, i32* %43
%45 = call i32 @memcpy(%struct.TYPE_3__* %40, i32 %42, i32 %44)
%46 = load i32, i32* %23
%47 = call i8* @inet_ntoa(i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %47)
%49 = load i32, i32* @PF_INET
%50 = load i32, i32* @SOCK_DGRAM
%51 = call i32 @socket(i32 %49, i32 %50, i32 0)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %39
%54 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %39
store i32 1, i32* %6
%57 = load i32, i32* @IPPROTO_IP
%58 = load i32, i32* @IP_TTL
%59 = call i64 @setsockopt(i32 %51, i32 %57, i32 %58, i32* %6, i32 4)
%60 = icmp slt i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %56
%62 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %56
%65 = call i32 @ftime(%struct.timeb* %5)
%66 = getelementptr inbounds %struct.timeb, %struct.timeb* %5, i64 0, i32 0
%67 = call i8* @ctime(i32* %66)
%68 = call i32 @strlen(i8* %67)
%69 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%70 = call i32 @sendto(i32 %51, i8* %67, i32 %68, i32 0, %struct.sockaddr* %69, i32 12)
%71 = call i32 @strlen(i8* %67)
%72 = icmp eq i32 %70, %71
br i1 %72, label %76, label %73
73: ; preds = %64
%74 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %64
%77 = call i32 @recvfrom(i32 %51, i8* %9, i32 1499, i32 0, %struct.sockaddr* %69, i32* %7)
%78 = call i32 @strlen(i8* %67)
%79 = icmp eq i32 %77, %78
br i1 %79, label %83, label %80
80: ; preds = %76
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %76
%84 = sext i32 %77 to i64
%85 = getelementptr inbounds [1500 x i8], [1500 x i8]* %4, i64 0, i64 %84
store i8 0, i8* %85
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%87 = call i32 @close(i32 %51)
ret i32 0
}