#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;
  void *sin_port;
  void *sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ remaddr;
typedef int /*<<< orphan*/ myaddr;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void *htons(int);
scalar_t__ inet_aton(char *, TYPE_1__ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
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(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int main(void) {
  int fd, i;
  struct sockaddr_in myaddr, remaddr;
  socklen_t slen = sizeof(remaddr);
  char buf[2048];
  int recvlen;
  char *server = "127.0.0.1";
  if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
    printf("create socket fail\n");
    return 0;
  }
  memset((char *)&myaddr, 0, sizeof(myaddr));
  myaddr.sin_family = AF_INET;
  myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  myaddr.sin_port = htons(0);
  if (bind(fd, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
    printf("bind error\n");
    close(fd);
    return 0;
  }
  memset((char *)&remaddr, 0, sizeof(remaddr));
  remaddr.sin_family = AF_INET;
  remaddr.sin_port = htons(11111);
  if (inet_aton(server, &remaddr.sin_addr) == 0) {
    fprintf(stderr, "inet_aton() fail\n");
    close(fd);
    return 0;
  }
  for (i = 0; i < 5; i++) {
    printf("sending packet %d to %s port %d\n", i, server, 11111);
    sprintf(buf, "This is packet %d", i);
    if (sendto(fd, buf, strlen(buf), 0, (struct sockaddr *)&remaddr, slen) ==
        -1) {
      printf("sendto error\n");
      close(fd);
      return 0;
    }
    recvlen = recvfrom(fd, buf, 2048, 0, (struct sockaddr *)&remaddr, &slen);
    if (recvlen >= 0) {
      buf[recvlen] = 0;
      printf("received message: \%s\"\n", buf);
    }
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x870,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x18,-0x44(%rbp)
lea    0xe10(%rip),%rax
mov    %rax,-0x860(%rbp)
mov    0x2dea(%rip),%rax
mov    (%rax),%rdi
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    1237 <main+0x67>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1444 <main+0x274>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x2d9a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x28(%rbp)
xor    %edi,%edi
call   1040 <htons@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x18,%edx
call   10d0 <bind@plt>
cmp    $0x0,%rax
jge    12ae <main+0xde>
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    1444 <main+0x274>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x2d23(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    $0x2b67,%edi
call   1040 <htons@plt>
mov    %rax,-0x38(%rbp)
mov    -0x860(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   10b0 <inet_aton@plt>
cmp    $0x0,%rax
jne    131d <main+0x14d>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
lea    0xd26(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    1444 <main+0x274>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1435 <main+0x265>
mov    -0xc(%rbp),%esi
mov    -0x860(%rbp),%rdx
lea    0xcfd(%rip),%rdi
mov    $0x2b67,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x850(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xd01(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x86c(%rbp)
lea    -0x850(%rbp),%rax
mov    %rax,-0x868(%rbp)
lea    -0x850(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x86c(%rbp),%edi
mov    -0x868(%rbp),%rsi
mov    %eax,%edx
lea    -0x40(%rbp),%r8
mov    -0x44(%rbp),%r9d
xor    %ecx,%ecx
call   1080 <sendto@plt>
cmp    $0xffffffff,%eax
jne    13cd <main+0x1fd>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    1444 <main+0x274>
mov    -0x8(%rbp),%edi
lea    -0x850(%rbp),%rsi
lea    -0x40(%rbp),%r8
mov    $0x800,%edx
xor    %ecx,%ecx
lea    -0x44(%rbp),%r9
call   10c0 <recvfrom@plt>
mov    %eax,-0x854(%rbp)
cmpl   $0x0,-0x854(%rbp)
jl     1422 <main+0x252>
movslq -0x854(%rbp),%rax
movb   $0x0,-0x850(%rbp,%rax,1)
lea    -0x850(%rbp),%rsi
lea    0xc62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1427 <main+0x257>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1324 <main+0x154>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x848,%rsp
movl   $0x18,0xc(%rsp)
mov    0x2de8(%rip),%r14
mov    (%r14),%rdi
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     1364 <main+0x184>
mov    %eax,%ebp
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    (%r14),%rax
mov    %rax,0x38(%rsp)
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,0x28(%rsp)
xor    %edi,%edi
call   1050 <htons@plt>
mov    %rax,0x30(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x18,%edx
call   10e0 <bind@plt>
test   %rax,%rax
js     1372 <main+0x192>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    (%r14),%rax
mov    %rax,0x20(%rsp)
mov    $0x2b67,%edi
call   1050 <htons@plt>
mov    %rax,0x18(%rsp)
lea    0xd5e(%rip),%rdi
mov    %rbx,%rsi
call   10c0 <inet_aton@plt>
test   %rax,%rax
je     137b <main+0x19b>
lea    0xd83(%rip),%r12
lea    0x40(%rsp),%rbx
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%r14
xor    %r15d,%r15d
jmp    12de <main+0xfe>
xchg   %ax,%ax
add    $0x1,%r15d
cmp    $0x5,%r15d
je     139e <main+0x1be>
lea    0xd37(%rip),%rdi
mov    %r15d,%esi
lea    0xd11(%rip),%rdx
mov    $0x2b67,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15d,%edx
call   10f0 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    0xc(%rsp),%r9d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r13,%r8
call   1090 <sendto@plt>
cmp    $0xffffffff,%eax
je     1392 <main+0x1b2>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
xor    %ecx,%ecx
mov    %r13,%r8
mov    %r14,%r9
call   10d0 <recvfrom@plt>
test   %eax,%eax
js     12d0 <main+0xf0>
mov    %eax,%eax
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xcfa(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12d0 <main+0xf0>
lea    0xd13(%rip),%rdi
call   1030 <puts@plt>
jmp    13a5 <main+0x1c5>
lea    0xcfa(%rip),%rdi
jmp    1399 <main+0x1b9>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
lea    0xc7f(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    139e <main+0x1be>
lea    0xccd(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x848,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"127.0.0.1\00"
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@.str.1 = [20 x i8] c"create socket fail\0A\00"
@INADDR_ANY = global i32 0
@.str.2 = [12 x i8] c"bind error\0A\00"
@stderr = global i32 0
@.str.3 = [18 x i8] c"inet_aton() fail\0A\00"
@.str.4 = [33 x i8] c"sending packet %d to %s port %d\0A\00"
@.str.5 = [18 x i8] c"This is packet %d\00"
@.str.6 = [14 x i8] c"sendto error\0A\00"
@.str.7 = [23 x i8] c"received message: %s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca [2048 x i8]
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %1
store i32 24, i32* %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = load i8*, i8** @AF_INET
%11 = load i32, i32* @SOCK_DGRAM
%12 = call i32 @socket(i8* %10, i32 %11, i32 0)
store i32 %12, i32* %2
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %94
16: ; preds = %0
%17 = bitcast %struct.sockaddr_in* %4 to i8*
%18 = call i32 @memset(i8* %17, i32 0, i32 24)
%19 = load i8*, i8** @AF_INET
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i8* %19, i8** %20
%21 = load i32, i32* @INADDR_ANY
%22 = call i32 @htonl(i32 %21)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%24 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %23, i32 0, i32 0
store i32 %22, i32* %24
%25 = call i8* @htons(i32 0)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
store i8* %25, i8** %26
%27 = load i32, i32* %2
%28 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%29 = call i64 @bind(i32 %27, %struct.sockaddr* %28, i32 24)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %16
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%33 = load i32, i32* %2
%34 = call i32 @close(i32 %33)
store i32 0, i32* %1
br label %94
35: ; preds = %16
%36 = bitcast %struct.sockaddr_in* %5 to i8*
%37 = call i32 @memset(i8* %36, i32 0, i32 24)
%38 = load i8*, i8** @AF_INET
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 2
store i8* %38, i8** %39
%40 = call i8* @htons(i32 11111)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 1
store i8* %40, i8** %41
%42 = load i8*, i8** %9
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 0
%44 = call i64 @inet_aton(i8* %42, %struct.TYPE_2__* %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %51
46: ; preds = %35
%47 = load i32, i32* @stderr
%48 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%49 = load i32, i32* %2
%50 = call i32 @close(i32 %49)
store i32 0, i32* %1
br label %94
51: ; preds = %35
store i32 0, i32* %3
br label %52
52: ; preds = %88, %51
%53 = load i32, i32* %3
%54 = icmp slt i32 %53, 5
br i1 %54, label %55, label %91
55: ; preds = %52
%56 = load i32, i32* %3
%57 = load i8*, i8** %9
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %56, i8* %57, i32 11111)
%59 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%60 = load i32, i32* %3
%61 = call i32 @sprintf(i8* %59, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %2
%63 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%64 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%65 = call i32 @strlen(i8* %64)
%66 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%67 = load i32, i32* %6
%68 = call i32 @sendto(i32 %62, i8* %63, i32 %65, i32 0, %struct.sockaddr* %66, i32 %67)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %74
70: ; preds = %55
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%72 = load i32, i32* %2
%73 = call i32 @close(i32 %72)
store i32 0, i32* %1
br label %94
74: ; preds = %55
%75 = load i32, i32* %2
%76 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%77 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%78 = call i32 @recvfrom(i32 %75, i8* %76, i32 2048, i32 0, %struct.sockaddr* %77, i32* %6)
store i32 %78, i32* %8
%79 = load i32, i32* %8
%80 = icmp sge i32 %79, 0
br i1 %80, label %81, label %87
81: ; preds = %74
%82 = load i32, i32* %8
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 %83
store i8 0, i8* %84
%85 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %85)
br label %87
87: ; preds = %81, %74
br label %88
88: ; preds = %87
%89 = load i32, i32* %3
%90 = add nsw i32 %89, 1
store i32 %90, i32* %3
br label %52
91: ; preds = %52
%92 = load i32, i32* %2
%93 = call i32 @close(i32 %92)
store i32 0, i32* %1
br label %94
94: ; preds = %91, %70, %46, %31, %14
%95 = load i32, i32* %1
ret i32 %95
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"127.0.0.1\00"
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@INADDR_ANY = global i32 0
@stderr = global i32 0
@.str.3 = [18 x i8] c"inet_aton() fail\0A\00"
@.str.4 = [33 x i8] c"sending packet %d to %s port %d\0A\00"
@.str.5 = [18 x i8] c"This is packet %d\00"
@.str.7 = [23 x i8] c"received message: %s\22\0A\00"
@str = [13 x i8] c"sendto error\00"
@str.8 = [11 x i8] c"bind error\00"
@str.9 = [19 x i8] c"create socket fail\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [2048 x i8]
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = bitcast %struct.sockaddr_in* %2 to i8*
%7 = bitcast i32* %3 to i8*
store i32 24, i32* %3
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%9 = load i8*, i8** @AF_INET
%10 = load i32, i32* @SOCK_DGRAM
%11 = tail call i32 @socket(i8* %9, i32 %10, i32 0)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
br label %68
15: ; preds = %0
%16 = call i32 @memset(i8* %5, i32 0, i32 24)
%17 = load i8*, i8** @AF_INET
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i8* %17, i8** %18
%19 = load i32, i32* @INADDR_ANY
%20 = call i32 @htonl(i32 %19)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0, i32 0
store i32 %20, i32* %21
%22 = call i8* @htons(i32 0)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
store i8* %22, i8** %23
%24 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%25 = call i64 @bind(i32 %11, %struct.sockaddr* %24, i32 24)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %15
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0))
%29 = call i32 @close(i32 %11)
br label %68
30: ; preds = %15
%31 = call i32 @memset(i8* %6, i32 0, i32 24)
%32 = load i8*, i8** @AF_INET
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i8* %32, i8** %33
%34 = call i8* @htons(i32 11111)
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
store i8* %34, i8** %35
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%37 = call i64 @inet_aton(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.TYPE_2__* %36)
%38 = icmp eq i64 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %30
%40 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
br label %45
41: ; preds = %30
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @close(i32 %11)
br label %68
45: ; preds = %39, %63
%46 = phi i32 [ 0, %39 ], [ %64, %63 ]
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %46, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 11111)
%48 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %46)
%49 = call i32 @strlen(i8* %8)
%50 = load i32, i32* %3
%51 = call i32 @sendto(i32 %11, i8* %8, i32 %49, i32 0, %struct.sockaddr* %40, i32 %50)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %56
53: ; preds = %45
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%55 = call i32 @close(i32 %11)
br label %68
56: ; preds = %45
%57 = call i32 @recvfrom(i32 %11, i8* %8, i32 2048, i32 0, %struct.sockaddr* %40, i32* %3)
%58 = icmp sgt i32 %57, -1
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = zext i32 %57 to i64
%61 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %60
store i8 0, i8* %61
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %8)
br label %63
63: ; preds = %56, %59
%64 = add nuw nsw i32 %46, 1
%65 = icmp eq i32 %64, 5
br i1 %65, label %66, label %45
66: ; preds = %63
%67 = call i32 @close(i32 %11)
br label %68
68: ; preds = %66, %53, %41, %27, %13
ret i32 0
}