#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__ {
  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 dummy;
};
typedef int /*<<< orphan*/ serveraddr;
typedef int /*<<< orphan*/ clientaddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(unsigned short);
char *inet_ntoa(TYPE_1__);
int /*<<< orphan*/ print_time();
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              void const *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char **argv) {
  int sockfd;
  int portno;
  int clientlen;
  struct sockaddr_in serveraddr;
  struct sockaddr_in clientaddr;
  struct hostent *hostp;
  char buf[1024];
  char *hostaddrp;
  int optval;
  int n;
  int numExpectedPings;
  if (argc != 3) {
    fprintf(stderr, "usage: %s <port> <numPings>\n", argv[0]);
    exit(1);
  }
  numExpectedPings = atoi(argv[2]);
  portno = atoi(argv[1]);
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  if (sockfd < 0)
    error("ERROR opening socket");
  optval = 1;
  setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (const void *)&optval,
             sizeof(int));
  bzero((char *)&serveraddr, sizeof(serveraddr));
  serveraddr.sin_family = AF_INET;
  serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
  serveraddr.sin_port = htons((unsigned short)portno);
  char *s = inet_ntoa(serveraddr.sin_addr);
  printf("My IP address : %s\n", s);
  if (bind(sockfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0)
    error("ERROR on binding");
  int numReceived = 0;
  clientlen = sizeof(clientaddr);
  while (1) {
    bzero(buf, 1024);
    n = recvfrom(sockfd, buf, 1024, 0, (struct sockaddr *)&clientaddr,
                 &clientlen);
    if (n < 0)
      error("ERROR in recvfrom");
    numReceived++;
    hostaddrp = inet_ntoa(clientaddr.sin_addr);
    if (hostaddrp == NULL)
      error("ERROR on inet_ntoa\n");
    printf("server received %d/%d bytes: %s\n", strlen(buf), n, buf);
    printf("Recv Time : \n");
    print_time();
    n = sendto(sockfd, buf, strlen(buf), 0, (struct sockaddr *)&clientaddr,
               clientlen);
    if (n < 0)
      error("ERROR in sendto");
    if (numExpectedPings == numReceived)
      break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1249 <main+0x49>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc6(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x454(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
mov    0x2d54(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    129e <main+0x9e>
lea    0xd84(%rip),%rdi
call   10d0 <error@plt>
movl   $0x1,-0x44c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d36(%rip),%rax
mov    (%rax),%esi
mov    0x2cfd(%rip),%rax
mov    (%rax),%edx
lea    -0x44c(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   10f0 <bzero@plt>
mov    0x2cfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2ce8(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
movzwl %ax,%edi
call   1060 <htons@plt>
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x460(%rbp)
mov    -0x460(%rbp),%rsi
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    1353 <main+0x153>
lea    0xcf8(%rip),%rdi
call   10d0 <error@plt>
movl   $0x0,-0x464(%rbp)
movl   $0xc,-0x1c(%rbp)
lea    -0x440(%rbp),%rdi
mov    $0x400,%esi
call   10f0 <bzero@plt>
mov    -0x14(%rbp),%edi
lea    -0x440(%rbp),%rsi
lea    -0x38(%rbp),%r8
mov    $0x400,%edx
xor    %ecx,%ecx
lea    -0x1c(%rbp),%r9
call   10b0 <recvfrom@plt>
mov    %eax,-0x450(%rbp)
cmpl   $0x0,-0x450(%rbp)
jge    13b2 <main+0x1b2>
lea    0xcaa(%rip),%rdi
call   10d0 <error@plt>
mov    -0x464(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x464(%rbp)
mov    -0x38(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x448(%rbp)
jne    13ea <main+0x1ea>
lea    0xc84(%rip),%rdi
call   10d0 <error@plt>
lea    -0x440(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%esi
mov    -0x450(%rbp),%edx
lea    -0x440(%rbp),%rcx
lea    0xc71(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc84(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   10e0 <print_time@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x474(%rbp)
lea    -0x440(%rbp),%rax
mov    %rax,-0x470(%rbp)
lea    -0x440(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x474(%rbp),%edi
mov    -0x470(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%r8
mov    -0x1c(%rbp),%r9d
xor    %ecx,%ecx
call   1090 <sendto@plt>
mov    %eax,-0x450(%rbp)
cmpl   $0x0,-0x450(%rbp)
jge    1488 <main+0x288>
lea    0xc29(%rip),%rdi
call   10d0 <error@plt>
mov    -0x454(%rbp),%eax
cmp    -0x464(%rbp),%eax
jne    149f <main+0x29f>
jmp    14a4 <main+0x2a4>
jmp    1364 <main+0x164>
mov    -0x4(%rbp),%eax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    1406 <main+0x1f6>
mov    0x10(%rbp),%rdi
call   1110 <atoi@plt>
mov    %eax,%ebx
mov    0x8(%rbp),%rdi
call   1110 <atoi@plt>
mov    %eax,%r12d
mov    0x2d95(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d7b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,%r14d
test   %eax,%eax
jns    1271 <main+0x61>
lea    0xdb1(%rip),%rdi
call   10e0 <error@plt>
movl   $0x1,0xc(%rsp)
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
mov    0x2d2f(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    %r14d,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,%ebp
mov    %eax,0x10(%rsp)
movzwl %r12w,%edi
call   1070 <htons@plt>
mov    %eax,0x14(%rsp)
mov    %ebp,%edi
call   1050 <inet_ntoa@plt>
lea    0xd4c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
test   %rax,%rax
jns    1311 <main+0x101>
lea    0xd3a(%rip),%rdi
call   10e0 <error@plt>
movl   $0xc,0x8(%rsp)
lea    0x30(%rsp),%rbp
lea    0x20(%rsp),%r15
lea    0xd84(%rip),%r12
jmp    1339 <main+0x129>
nopl   0x0(%rax)
add    $0xffffffff,%ebx
je     13f2 <main+0x1e2>
mov    %rbp,%rdi
mov    $0x400,%esi
call   1100 <bzero@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
mov    %r15,%r8
lea    0x8(%rsp),%r9
call   10c0 <recvfrom@plt>
mov    %eax,%r13d
test   %eax,%eax
jns    1373 <main+0x163>
lea    0xce9(%rip),%rdi
call   10e0 <error@plt>
mov    0x20(%rsp),%edi
call   1050 <inet_ntoa@plt>
test   %rax,%rax
jne    138d <main+0x17d>
lea    0xce1(%rip),%rdi
call   10e0 <error@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
lea    0xce1(%rip),%rdi
mov    %eax,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10f0 <print_time@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    0x8(%rsp),%r9d
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r15,%r8
call   10a0 <sendto@plt>
test   %eax,%eax
jns    1330 <main+0x120>
lea    0xcb6(%rip),%rdi
call   10e0 <error@plt>
jmp    1330 <main+0x120>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bb3(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xbe6(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s <port> <numPings>\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [20 x i8] c"My IP address : %s\0A\00"
@.str.3 = [17 x i8] c"ERROR on binding\00"
@.str.4 = [18 x i8] c"ERROR in recvfrom\00"
@.str.5 = [20 x i8] c"ERROR on inet_ntoa\0A\00"
@.str.6 = [33 x i8] c"server received %d/%d bytes: %s\0A\00"
@.str.7 = [14 x i8] c"Recv Time : \0A\00"
@.str.8 = [16 x i8] c"ERROR in sendto\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 %struct.sockaddr_in
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.hostent*
%12 = alloca [1024 x i8]
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 3
br i1 %20, label %21, label %28
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %16
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %7
%37 = load i32, i32* @AF_INET
%38 = load i32, i32* @SOCK_DGRAM
%39 = call i32 @socket(i32 %37, i32 %38, i32 0)
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %28
%43 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %44
44: ; preds = %42, %28
store i32 1, i32* %14
%45 = load i32, i32* %6
%46 = load i32, i32* @SOL_SOCKET
%47 = load i32, i32* @SO_REUSEADDR
%48 = bitcast i32* %14 to i8*
%49 = call i32 @setsockopt(i32 %45, i32 %46, i32 %47, i8* %48, i32 4)
%50 = bitcast %struct.sockaddr_in* %9 to i8*
%51 = call i32 @bzero(i8* %50, i32 12)
%52 = load i32, i32* @AF_INET
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %52, i32* %53
%54 = load i32, i32* @INADDR_ANY
%55 = call i32 @htonl(i32 %54)
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%57 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %56, i32 0, i32 0
store i32 %55, i32* %57
%58 = load i32, i32* %7
%59 = trunc i32 %58 to i16
%60 = call i32 @htons(i16 zeroext %59)
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
store i32 %60, i32* %61
%62 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%63 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %62, i32 0, i32 0
%64 = load i32, i32* %63
%65 = call i8* @inet_ntoa(i32 %64)
store i8* %65, i8** %17
%66 = load i8*, i8** %17
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %66)
%68 = load i32, i32* %6
%69 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%70 = call i64 @bind(i32 %68, %struct.sockaddr* %69, i32 12)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %44
%73 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %74
74: ; preds = %72, %44
store i32 0, i32* %18
store i32 12, i32* %8
br label %75
75: ; preds = %74, %121
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%77 = call i32 @bzero(i8* %76, i32 1024)
%78 = load i32, i32* %6
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%80 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%81 = call i32 @recvfrom(i32 %78, i8* %79, i32 1024, i32 0, %struct.sockaddr* %80, i32* %8)
store i32 %81, i32* %15
%82 = load i32, i32* %15
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %75
%85 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %86
86: ; preds = %84, %75
%87 = load i32, i32* %18
%88 = add nsw i32 %87, 1
store i32 %88, i32* %18
%89 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%90 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %89, i32 0, i32 0
%91 = load i32, i32* %90
%92 = call i8* @inet_ntoa(i32 %91)
store i8* %92, i8** %13
%93 = load i8*, i8** %13
%94 = icmp eq i8* %93, null
br i1 %94, label %95, label %97
95: ; preds = %86
%96 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %97
97: ; preds = %95, %86
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%99 = call i32 @strlen(i8* %98)
%100 = load i32, i32* %15
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %99, i32 %100, i8* %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%104 = call i32 (...) @print_time()
%105 = load i32, i32* %6
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%108 = call i32 @strlen(i8* %107)
%109 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%110 = load i32, i32* %8
%111 = call i32 @sendto(i32 %105, i8* %106, i32 %108, i32 0, %struct.sockaddr* %109, i32 %110)
store i32 %111, i32* %15
%112 = load i32, i32* %15
%113 = icmp slt i32 %112, 0
br i1 %113, label %114, label %116
114: ; preds = %97
%115 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %116
116: ; preds = %114, %97
%117 = load i32, i32* %16
%118 = load i32, i32* %18
%119 = icmp eq i32 %117, %118
br i1 %119, label %120, label %121
120: ; preds = %116
br label %122
121: ; preds = %116
br label %75
122: ; preds = %120
%123 = load i32, i32* %3
ret i32 %123
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s <port> <numPings>\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [20 x i8] c"My IP address : %s\0A\00"
@.str.3 = [17 x i8] c"ERROR on binding\00"
@.str.4 = [18 x i8] c"ERROR in recvfrom\00"
@.str.5 = [20 x i8] c"ERROR on inet_ntoa\0A\00"
@.str.6 = [33 x i8] c"server received %d/%d bytes: %s\0A\00"
@.str.8 = [16 x i8] c"ERROR in sendto\00"
@str = [13 x i8] c"Recv Time : \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = bitcast i32* %3 to i8*
%9 = bitcast %struct.sockaddr_in* %4 to i8*
%10 = bitcast %struct.sockaddr_in* %5 to i8*
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%12 = bitcast i32* %7 to i8*
%13 = icmp eq i32 %0, 3
br i1 %13, label %19, label %14
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_DGRAM
%28 = tail call i32 @socket(i32 %26, i32 %27, i32 0)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %19
%31 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %19
store i32 1, i32* %7
%33 = load i32, i32* @SOL_SOCKET
%34 = load i32, i32* @SO_REUSEADDR
%35 = call i32 @setsockopt(i32 %28, i32 %33, i32 %34, i8* %12, i32 4)
%36 = call i32 @bzero(i8* %9, i32 12)
%37 = load i32, i32* @AF_INET
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %37, i32* %38
%39 = load i32, i32* @INADDR_ANY
%40 = call i32 @htonl(i32 %39)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
store i32 %40, i32* %41
%42 = trunc i32 %25 to i16
%43 = call i32 @htons(i16 zeroext %42)
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %43, i32* %44
%45 = call i8* @inet_ntoa(i32 %40)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %45)
%47 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%48 = call i64 @bind(i32 %28, %struct.sockaddr* %47, i32 12)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %32
%51 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50, %32
store i32 12, i32* %3
%53 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
br label %55
55: ; preds = %80, %52
%56 = phi i32 [ 0, %52 ], [ %63, %80 ]
%57 = call i32 @bzero(i8* %11, i32 1024)
%58 = call i32 @recvfrom(i32 %28, i8* %11, i32 1024, i32 0, %struct.sockaddr* %53, i32* %3)
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %62
62: ; preds = %60, %55
%63 = add nuw nsw i32 %56, 1
%64 = load i32, i32* %54
%65 = call i8* @inet_ntoa(i32 %64)
%66 = icmp eq i8* %65, null
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %69
69: ; preds = %67, %62
%70 = call i32 @strlen(i8* %11)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %70, i32 %58, i8* %11)
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%73 = call i32 (...) @print_time()
%74 = call i32 @strlen(i8* %11)
%75 = load i32, i32* %3
%76 = call i32 @sendto(i32 %28, i8* %11, i32 %74, i32 0, %struct.sockaddr* %53, i32 %75)
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %69
%79 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %80
80: ; preds = %78, %69
%81 = icmp eq i32 %22, %63
br i1 %81, label %82, label %55
82: ; preds = %80
ret i32 0
}