#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*/ tv;
struct timeval {
  int tv_sec;
  int /*<<< orphan*/ tv_usec;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ *h_addr_list;
};
typedef int /*<<< orphan*/ server;
typedef int /*<<< orphan*/ key;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVTIMEO;
int /*<<< orphan*/ atoi(char *);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, int /*<<< orphan*/ *,
             int /*<<< orphan*/ *);
int send(int, char *, int, int /*<<< orphan*/);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, struct timeval *,
               int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int sock;
  struct sockaddr_in server;
  struct hostent *hp;
  char key[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
  char buf[8];
  int ret;
  struct timeval tv = {.tv_sec = 2, .tv_usec = 0};
  if (argc != 3) {
    printf("Usage: %s <server name> <port number> <msg>\n", argv[0]);
    exit(0);
  }
  if ((sock = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
    printf("Problem creating socket\n");
    exit(1);
  }
  server.sin_family = AF_INET;
  if ((hp = gethostbyname(argv[1])) == 0) {
    printf("Invalid or unknown host\n");
    exit(1);
  }
  memcpy(&server.sin_addr.s_addr, hp->h_addr_list[0], hp->h_length);
  server.sin_port = htons(atoi(argv[2]));
  ret = setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
  if (ret < 0) {
    perror("Problem setsockopt");
    exit(1);
  }
  ret = connect(sock, (struct sockaddr *)&server, sizeof(server));
  if (ret < 0) {
    perror("Problem connect");
    exit(1);
  }
  ret = send(sock, key, sizeof(key), 0);
  if (ret < 0) {
    perror("Problem sending data");
    exit(1);
  }
  ret = recvfrom(sock, buf, sizeof(buf), 0, NULL, NULL);
  if (ret < 0) {
    perror("Problem in recvfrom");
    exit(1);
  }
  printf("Got back %d bytes\n", ret);
  for (int i = 0; i < ret; i++) {
    printf("%02x", buf[i]);
  }
  printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe23(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe20(%rip),%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1212 <main+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    124f <main+0x8f>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <gethostbyname@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    128e <main+0xce>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    -0x20(%rbp),%rdi
add    $0x4,%rdi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
call   1080 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,%edi
call   1040 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
mov    0x2cf3(%rip),%rax
mov    (%rax),%edx
lea    -0x48(%rbp),%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    1309 <main+0x149>
lea    0xd75(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <connect@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    133d <main+0x17d>
lea    0xd54(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    1373 <main+0x1b3>
lea    0xd2e(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x8,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   1090 <recvfrom@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    13b1 <main+0x1f1>
lea    0xd05(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x3c(%rbp),%esi
lea    0xd00(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    13fa <main+0x23a>
movslq -0x4c(%rbp),%rax
movsbl -0x38(%rbp,%rax,1),%esi
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13c9 <main+0x209>
lea    0xc3a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r14
movabs $0x706050403020100,%rax
05 06 07
mov    %rax,0x20(%rsp)
movq   $0x2,0x18(%rsp)
cmp    $0x3,%edi
jne    134e <main+0x16e>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
mov    0x2dbb(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
test   %eax,%eax
js     1366 <main+0x186>
mov    %eax,%ebx
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    0x8(%r14),%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
je     136f <main+0x18f>
lea    0xc(%rsp),%rdi
mov    0x8(%rax),%rcx
mov    (%rcx),%esi
mov    (%rax),%edx
call   10a0 <memcpy@plt>
mov    0x10(%r14),%rdi
call   10d0 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %eax,0x8(%rsp)
mov    0x2d6c(%rip),%rax
mov    (%rax),%esi
mov    0x2d43(%rip),%rax
mov    (%rax),%edx
lea    0x18(%rsp),%rcx
mov    %ebx,%edi
mov    $0x8,%r8d
call   1050 <setsockopt@plt>
test   %eax,%eax
js     1385 <main+0x1a5>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   10f0 <connect@plt>
test   %eax,%eax
js     138e <main+0x1ae>
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %eax,%eax
js     1397 <main+0x1b7>
lea    0x28(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   10b0 <recvfrom@plt>
test   %eax,%eax
js     13a0 <main+0x1c0>
mov    %eax,%ebx
lea    0xd7a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %ebx,%ebx
je     1338 <main+0x158>
mov    %ebx,%r15d
lea    0xd76(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl 0x28(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1320 <main+0x140>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%r14),%rsi
lea    0xca8(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xd3c(%rip),%rdi
jmp    1376 <main+0x196>
lea    0xd1b(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xca1(%rip),%rdi
jmp    13a7 <main+0x1c7>
lea    0xcab(%rip),%rdi
jmp    13a7 <main+0x1c7>
lea    0xcb2(%rip),%rdi
jmp    13a7 <main+0x1c7>
lea    0xcbe(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@__const.main.key = [8 x i8] c"\00\01\02\03\04\05\06\07"
@__const.main.tv = %struct.timeval { i32 2, i32 0 }
@.str = [45 x i8] c"Usage: %s <server name> <port number> <msg>\0A\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [25 x i8] c"Problem creating socket\0A\00"
@AF_INET = global i32 0
@.str.2 = [25 x i8] c"Invalid or unknown host\0A\00"
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
@.str.3 = [19 x i8] c"Problem setsockopt\00"
@.str.4 = [16 x i8] c"Problem connect\00"
@.str.5 = [21 x i8] c"Problem sending data\00"
@.str.6 = [20 x i8] c"Problem in recvfrom\00"
@.str.7 = [19 x i8] c"Got back %d bytes\0A\00"
@.str.8 = [5 x i8] c"%02x\00"
@.str.9 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca %struct.hostent*
%9 = alloca [8 x i8]
%10 = alloca [8 x i8]
%11 = alloca i32
%12 = alloca %struct.timeval
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = bitcast [8 x i8]* %9 to i8*
%15 = bitcast %struct.timeval* %12 to i8*
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %2
%25 = load i32, i32* @PF_INET
%26 = load i32, i32* @SOCK_DGRAM
%27 = call i32 @socket(i32 %25, i32 %26, i32 0)
store i32 %27, i32* %6
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %24
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %33, i32* %34
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call %struct.hostent* @gethostbyname(i8* %37)
store %struct.hostent* %38, %struct.hostent** %8
%39 = icmp eq %struct.hostent* %38, null
br i1 %39, label %40, label %43
40: ; preds = %32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %32
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%45 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %44, i32 0, i32 0
%46 = load %struct.hostent*, %struct.hostent** %8
%47 = getelementptr inbounds %struct.hostent, %struct.hostent* %46, i32 0, i32 1
%48 = load i32*, i32** %47
%49 = getelementptr inbounds i32, i32* %48, i64 0
%50 = load i32, i32* %49
%51 = load %struct.hostent*, %struct.hostent** %8
%52 = getelementptr inbounds %struct.hostent, %struct.hostent* %51, i32 0, i32 0
%53 = load i32, i32* %52
%54 = call i32 @memcpy(i32* %45, i32 %50, i32 %53)
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = call i32 @atoi(i8* %57)
%59 = call i32 @htons(i32 %58)
%60 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
store i32 %59, i32* %60
%61 = load i32, i32* %6
%62 = load i32, i32* @SOL_SOCKET
%63 = load i32, i32* @SO_RCVTIMEO
%64 = call i32 @setsockopt(i32 %61, i32 %62, i32 %63, %struct.timeval* %12, i32 8)
store i32 %64, i32* %11
%65 = load i32, i32* %11
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %43
%68 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %43
%71 = load i32, i32* %6
%72 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%73 = call i32 @connect(i32 %71, %struct.sockaddr* %72, i32 12)
store i32 %73, i32* %11
%74 = load i32, i32* %11
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %70
%77 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %70
%80 = load i32, i32* %6
%81 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%82 = call i32 @send(i32 %80, i8* %81, i32 8, i32 0)
store i32 %82, i32* %11
%83 = load i32, i32* %11
%84 = icmp slt i32 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %79
%86 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %79
%89 = load i32, i32* %6
%90 = getelementptr inbounds [8 x i8], [8 x i8]* %10, i64 0, i64 0
%91 = call i32 @recvfrom(i32 %89, i8* %90, i32 8, i32 0, i32* null, i32* null)
store i32 %91, i32* %11
%92 = load i32, i32* %11
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %88
%95 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%96 = call i32 @exit(i32 1)
unreachable
97: ; preds = %88
%98 = load i32, i32* %11
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %98)
store i32 0, i32* %13
br label %100
100: ; preds = %111, %97
%101 = load i32, i32* %13
%102 = load i32, i32* %11
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %114
104: ; preds = %100
%105 = load i32, i32* %13
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [8 x i8], [8 x i8]* %10, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %109)
br label %111
111: ; preds = %104
%112 = load i32, i32* %13
%113 = add nsw i32 %112, 1
store i32 %113, i32* %13
br label %100
114: ; preds = %100
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { i32, i32 }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@.str = [45 x i8] c"Usage: %s <server name> <port number> <msg>\0A\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@AF_INET = global i32 0
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
@.str.3 = [19 x i8] c"Problem setsockopt\00"
@.str.4 = [16 x i8] c"Problem connect\00"
@.str.5 = [21 x i8] c"Problem sending data\00"
@.str.6 = [20 x i8] c"Problem in recvfrom\00"
@.str.7 = [19 x i8] c"Got back %d bytes\0A\00"
@.str.8 = [5 x i8] c"%02x\00"
@str = [24 x i8] c"Invalid or unknown host\00"
@str.10 = [24 x i8] c"Problem creating socket\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i64
%5 = alloca [8 x i8]
%6 = alloca i64
%7 = bitcast i64* %6 to %struct.timeval*
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = bitcast i64* %4 to i8*
store i64 506097522914230528, i64* %4
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%11 = bitcast i64* %6 to i8*
store i64 2, i64* %6
%12 = icmp eq i32 %0, 3
br i1 %12, label %17, label %13
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = tail call i32 @exit(i32 0)
unreachable
17: ; preds = %2
%18 = load i32, i32* @PF_INET
%19 = load i32, i32* @SOCK_DGRAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %17
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %26, i32* %27
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = tail call %struct.hostent* @gethostbyname(i8* %29)
%31 = icmp eq %struct.hostent* %30, null
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %25
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%37 = getelementptr inbounds %struct.hostent, %struct.hostent* %30, i64 0, i32 1
%38 = load i32*, i32** %37
%39 = load i32, i32* %38
%40 = getelementptr inbounds %struct.hostent, %struct.hostent* %30, i64 0, i32 0
%41 = load i32, i32* %40
%42 = call i32 @memcpy(i32* %36, i32 %39, i32 %41)
%43 = getelementptr inbounds i8*, i8** %1, i64 2
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
%46 = call i32 @htons(i32 %45)
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %46, i32* %47
%48 = load i32, i32* @SOL_SOCKET
%49 = load i32, i32* @SO_RCVTIMEO
%50 = call i32 @setsockopt(i32 %20, i32 %48, i32 %49, %struct.timeval* %7, i32 8)
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %35
%53 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %35
%56 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%57 = call i32 @connect(i32 %20, %struct.sockaddr* %56, i32 12)
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %55
%63 = call i32 @send(i32 %20, i8* %9, i32 8, i32 0)
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %62
%69 = call i32 @recvfrom(i32 %20, i8* %10, i32 8, i32 0, i32* null, i32* null)
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %68
%72 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %68
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %69)
%76 = icmp eq i32 %69, 0
br i1 %76, label %79, label %77
77: ; preds = %74
%78 = zext i32 %69 to i64
br label %81
79: ; preds = %81, %74
%80 = call i32 @putchar(i32 10)
ret i32 0
81: ; preds = %77, %81
%82 = phi i64 [ 0, %77 ], [ %87, %81 ]
%83 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 %82
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %85)
%87 = add nuw nsw i64 %82, 1
%88 = icmp eq i64 %87, %78
br i1 %88, label %79, label %81
}