#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 */
struct TYPE_2__ {
  scalar_t__ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ servAddr;
typedef int /*<<< orphan*/ fromAddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
unsigned short atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ htons(unsigned short);
scalar_t__ inet_addr(char *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *,
             unsigned int *);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char *argv[]) {
  char *servIP;
  char *echoString;
  int echoStringLen;
  unsigned short servPort;
  int sock;
  struct sockaddr_in servAddr;
  int sendMsgLen;
  struct sockaddr_in fromAddr;
  unsigned int fromAddrLen;
  char msgBuffer[(512) + 1];
  int recvMsgLen;
  if ((argc < 3) || (argc > 4)) {
    fprintf(stderr, "Usage: %s <Server IP> <Echo Word> [<Echo Port>]\n",
            argv[0]);
    exit(1);
  }
  servIP = argv[1];
  echoString = argv[2];
  echoStringLen = strlen(echoString);
  if (echoStringLen > (512)) {
    fprintf(stderr, "Echo word too loong\n");
    exit(1);
  }
  if (argc == 4) {
    servPort = atoi(argv[3]);
  } else {
    servPort = 7;
  }
  sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
  if (sock < 0) {
    fprintf(stderr, "socket() failed\n");
    exit(1);
  }
  memset(&servAddr, 0, sizeof(servAddr));
  servAddr.sin_family = AF_INET;
  servAddr.sin_addr.s_addr = inet_addr(servIP);
  servAddr.sin_port = htons(servPort);
  sendMsgLen = sendto(sock, echoString, echoStringLen, 0,
                      (struct sockaddr *)&servAddr, sizeof(servAddr));
  if (echoStringLen != sendMsgLen) {
    fprintf(stderr,
            "sendto() sent a different number of bytes than expected\n");
    exit(1);
  }
  fromAddrLen = sizeof(fromAddr);
  recvMsgLen = recvfrom(sock, msgBuffer, (512), 0, (struct sockaddr *)&fromAddr,
                        &fromAddrLen);
  if (recvMsgLen != echoStringLen) {
    fprintf(stderr, "recvfrom() failed\n");
    exit(1);
  }
  if (fromAddr.sin_addr.s_addr != servAddr.sin_addr.s_addr) {
    fprintf(stderr, "Error: recevied a packet from unknown source.\n");
    exit(1);
  }
  msgBuffer[recvMsgLen] = '\0';
  printf("Received: %s\n", msgBuffer);
  close(sock);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     11ed <main+0x2d>
cmpl   $0x4,-0x8(%rbp)
jle    1215 <main+0x55>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x200,-0x24(%rbp)
jle    1267 <main+0xa7>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x4,-0x8(%rbp)
jne    1287 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10c0 <atoi@plt>
mov    %ax,-0x26(%rbp)
jmp    128d <main+0xcd>
movw   $0x7,-0x26(%rbp)
mov    0x2d34(%rip),%rax
mov    (%rax),%edi
mov    0x2d43(%rip),%rax
mov    (%rax),%esi
mov    0x2d12(%rip),%rax
mov    (%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    12db <main+0x11b>
mov    0x2d0f(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <inet_addr@plt>
mov    %rax,-0x40(%rbp)
movzwl -0x26(%rbp),%edi
call   1040 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
lea    -0x40(%rbp),%r8
xor    %ecx,%ecx
mov    $0x10,%r9d
call   1070 <sendto@plt>
mov    %eax,-0x44(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x44(%rbp),%eax
je     135b <main+0x19b>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
lea    0xd0d(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movl   $0x10,-0x5c(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0x260(%rbp),%rsi
lea    -0x58(%rbp),%r8
mov    $0x200,%edx
xor    %ecx,%ecx
lea    -0x5c(%rbp),%r9
call   10b0 <recvfrom@plt>
mov    %eax,-0x264(%rbp)
mov    -0x264(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     13b6 <main+0x1f6>
mov    0x2c34(%rip),%rax
mov    (%rax),%edi
lea    0xceb(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x58(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     13e5 <main+0x225>
mov    0x2c05(%rip),%rax
mov    (%rax),%edi
lea    0xccf(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movslq -0x264(%rbp),%rax
movb   $0x0,-0x260(%rbp,%rax,1)
lea    -0x260(%rbp),%rsi
lea    0xcd0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    -0x5(%rbp),%eax
cmp    $0xfffffffd,%eax
ja     1202 <main+0x42>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe0f(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x8(%rbx),%r15
mov    0x10(%rbx),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    $0x201,%eax
jl     122e <main+0x6e>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xe08(%rip),%rsi
jmp    136b <main+0x1ab>
mov    %eax,%r13d
mov    $0x7,%r12w
cmp    $0x4,%ebp
jne    1247 <main+0x87>
mov    0x18(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r12d
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
mov    0x2d89(%rip),%rax
mov    (%rax),%esi
mov    0x2d58(%rip),%rax
mov    (%rax),%edx
call   10e0 <socket@plt>
test   %eax,%eax
jns    1280 <main+0xc0>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
lea    0xdcb(%rip),%rsi
jmp    136b <main+0x1ab>
mov    %eax,%ebx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    %r15,%rdi
call   1090 <inet_addr@plt>
mov    %rax,0x10(%rsp)
movzwl %r12w,%edi
call   1040 <htons@plt>
mov    %eax,0x18(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r13d,%edx
xor    %ecx,%ecx
mov    %rbp,%r8
mov    $0x10,%r9d
call   1070 <sendto@plt>
cmp    %eax,%r13d
jne    1337 <main+0x177>
movl   $0x10,0xc(%rsp)
lea    0x30(%rsp),%rsi
lea    0x20(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %ebx,%edi
mov    $0x200,%edx
xor    %ecx,%ecx
call   10b0 <recvfrom@plt>
cmp    %r13d,%eax
jne    1349 <main+0x189>
mov    0x20(%rsp),%rax
cmp    0x10(%rsp),%rax
jne    135b <main+0x19b>
movslq %r13d,%rax
movb   $0x0,0x30(%rsp,%rax,1)
lea    0xdb3(%rip),%rdi
lea    0x30(%rsp),%rsi
call   1050 <printf@plt>
mov    %ebx,%edi
call   1080 <close@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
lea    0xd10(%rip),%rsi
jmp    136b <main+0x1ab>
mov    0x2c80(%rip),%rax
mov    (%rax),%edi
lea    0xd37(%rip),%rsi
jmp    136b <main+0x1ab>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
lea    0xd38(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [49 x i8] c"Usage: %s <Server IP> <Echo Word> [<Echo Port>]\0A\00"
@.str.1 = [21 x i8] c"Echo word too loong\0A\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@.str.2 = [17 x i8] c"socket() failed\0A\00"
@AF_INET = global i32 0
@.str.3 = [57 x i8] c"sendto() sent a different number of bytes than expected\0A\00"
@.str.4 = [19 x i8] c"recvfrom() failed\0A\00"
@.str.5 = [47 x i8] c"Error: recevied a packet from unknown source.\0A\00"
@.str.6 = [14 x i8] c"Received: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i16
%10 = alloca i32
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca %struct.sockaddr_in
%14 = alloca i32
%15 = alloca [513 x i8]
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 3
br i1 %18, label %22, label %19
19: ; preds = %2
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 4
br i1 %21, label %22, label %29
22: ; preds = %19, %2
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %19
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
store i8* %32, i8** %6
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
store i8* %35, i8** %7
%36 = load i8*, i8** %7
%37 = call i32 @strlen(i8* %36)
store i32 %37, i32* %8
%38 = load i32, i32* %8
%39 = icmp sgt i32 %38, 512
br i1 %39, label %40, label %44
40: ; preds = %29
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %29
%45 = load i32, i32* %4
%46 = icmp eq i32 %45, 4
br i1 %46, label %47, label %52
47: ; preds = %44
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 3
%50 = load i8*, i8** %49
%51 = call zeroext i16 @atoi(i8* %50)
store i16 %51, i16* %9
br label %53
52: ; preds = %44
store i16 7, i16* %9
br label %53
53: ; preds = %52, %47
%54 = load i32, i32* @PF_INET
%55 = load i32, i32* @SOCK_DGRAM
%56 = load i32, i32* @IPPROTO_UDP
%57 = call i32 @socket(i32 %54, i32 %55, i32 %56)
store i32 %57, i32* %10
%58 = load i32, i32* %10
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %53
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %53
%65 = call i32 @memset(%struct.sockaddr_in* %11, i32 0, i32 16)
%66 = load i32, i32* @AF_INET
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %66, i32* %67
%68 = load i8*, i8** %6
%69 = call i64 @inet_addr(i8* %68)
%70 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%71 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %70, i32 0, i32 0
store i64 %69, i64* %71
%72 = load i16, i16* %9
%73 = call i32 @htons(i16 zeroext %72)
%74 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
store i32 %73, i32* %74
%75 = load i32, i32* %10
%76 = load i8*, i8** %7
%77 = load i32, i32* %8
%78 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%79 = call i32 @sendto(i32 %75, i8* %76, i32 %77, i32 0, %struct.sockaddr* %78, i32 16)
store i32 %79, i32* %12
%80 = load i32, i32* %8
%81 = load i32, i32* %12
%82 = icmp ne i32 %80, %81
br i1 %82, label %83, label %87
83: ; preds = %64
%84 = load i32, i32* @stderr
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%86 = call i32 @exit(i32 1)
unreachable
87: ; preds = %64
store i32 16, i32* %14
%88 = load i32, i32* %10
%89 = getelementptr inbounds [513 x i8], [513 x i8]* %15, i64 0, i64 0
%90 = bitcast %struct.sockaddr_in* %13 to %struct.sockaddr*
%91 = call i32 @recvfrom(i32 %88, i8* %89, i32 512, i32 0, %struct.sockaddr* %90, i32* %14)
store i32 %91, i32* %16
%92 = load i32, i32* %16
%93 = load i32, i32* %8
%94 = icmp ne i32 %92, %93
br i1 %94, label %95, label %99
95: ; preds = %87
%96 = load i32, i32* @stderr
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%98 = call i32 @exit(i32 1)
unreachable
99: ; preds = %87
%100 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 0
%101 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %100, i32 0, i32 0
%102 = load i64, i64* %101
%103 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%104 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %103, i32 0, i32 0
%105 = load i64, i64* %104
%106 = icmp ne i64 %102, %105
br i1 %106, label %107, label %111
107: ; preds = %99
%108 = load i32, i32* @stderr
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
%110 = call i32 @exit(i32 1)
unreachable
111: ; preds = %99
%112 = load i32, i32* %16
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [513 x i8], [513 x i8]* %15, i64 0, i64 %113
store i8 0, i8* %114
%115 = getelementptr inbounds [513 x i8], [513 x i8]* %15, i64 0, i64 0
%116 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %115)
%117 = load i32, i32* %10
%118 = call i32 @close(i32 %117)
%119 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [49 x i8] c"Usage: %s <Server IP> <Echo Word> [<Echo Port>]\0A\00"
@.str.1 = [21 x i8] c"Echo word too loong\0A\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@.str.2 = [17 x i8] c"socket() failed\0A\00"
@AF_INET = global i32 0
@.str.3 = [57 x i8] c"sendto() sent a different number of bytes than expected\0A\00"
@.str.4 = [19 x i8] c"recvfrom() failed\0A\00"
@.str.5 = [47 x i8] c"Error: recevied a packet from unknown source.\0A\00"
@.str.6 = [14 x i8] c"Received: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [513 x i8]
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = getelementptr inbounds [513 x i8], [513 x i8]* %6, i64 0, i64 0
%11 = add i32 %0, -5
%12 = icmp ult i32 %11, -2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %1
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32 @strlen(i8* %22)
%24 = icmp sgt i32 %23, 512
br i1 %24, label %25, label %29
25: ; preds = %18
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%28 = tail call i32 @exit(i32 1)
unreachable
29: ; preds = %18
%30 = icmp eq i32 %0, 4
br i1 %30, label %31, label %35
31: ; preds = %29
%32 = getelementptr inbounds i8*, i8** %1, i64 3
%33 = load i8*, i8** %32
%34 = tail call zeroext i16 @atoi(i8* %33)
br label %35
35: ; preds = %29, %31
%36 = phi i16 [ %34, %31 ], [ 7, %29 ]
%37 = load i32, i32* @PF_INET
%38 = load i32, i32* @SOCK_DGRAM
%39 = load i32, i32* @IPPROTO_UDP
%40 = tail call i32 @socket(i32 %37, i32 %38, i32 %39)
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %35
%43 = load i32, i32* @stderr
%44 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%45 = tail call i32 @exit(i32 1)
unreachable
46: ; preds = %35
%47 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 16)
%48 = load i32, i32* @AF_INET
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %48, i32* %49
%50 = call i64 @inet_addr(i8* %20)
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i64 %50, i64* %51
%52 = call i32 @htons(i16 zeroext %36)
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %52, i32* %53
%54 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%55 = call i32 @sendto(i32 %40, i8* %22, i32 %23, i32 0, %struct.sockaddr* %54, i32 16)
%56 = icmp eq i32 %23, %55
br i1 %56, label %61, label %57
57: ; preds = %46
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %46
store i32 16, i32* %5
%62 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%63 = call i32 @recvfrom(i32 %40, i8* %10, i32 512, i32 0, %struct.sockaddr* %62, i32* %5)
%64 = icmp eq i32 %63, %23
br i1 %64, label %69, label %65
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %61
%70 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
%71 = load i64, i64* %70
%72 = load i64, i64* %51
%73 = icmp eq i64 %71, %72
br i1 %73, label %78, label %74
74: ; preds = %69
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %69
%79 = sext i32 %23 to i64
%80 = getelementptr inbounds [513 x i8], [513 x i8]* %6, i64 0, i64 %79
store i8 0, i8* %80
%81 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %10)
%82 = call i32 @close(i32 %40)
%83 = call i32 @exit(i32 0)
unreachable
}