#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 scalar_t__ u_int8_t;
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;
};
typedef size_t ssize_t;
typedef int socklen_t;
typedef int /*<<< orphan*/ server_address;
typedef int /*<<< orphan*/ sender_ip_str;
typedef int /*<<< orphan*/ sender;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IP_MAXPACKET;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, TYPE_1__ *, char *, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
size_t recvfrom(int, scalar_t__ *, int /*<<< orphan*/, int /*<<< orphan*/,
                struct sockaddr *, int *);
size_t sendto(int, char *, size_t, int /*<<< orphan*/, struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
size_t strlen(char *);
int main() {
  int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  if (sockfd < 0) {
    fprintf(stderr, "socket error: %s\n", strerror(errno));
    return EXIT_FAILURE;
  }
  struct sockaddr_in server_address;
  bzero(&server_address, sizeof(server_address));
  server_address.sin_family = AF_INET;
  server_address.sin_port = htons(12345);
  server_address.sin_addr.s_addr = htonl(INADDR_ANY);
  if (bind(sockfd, (struct sockaddr *)&server_address, sizeof(server_address)) <
      0) {
    fprintf(stderr, "bind error: %s\n", strerror(errno));
    return EXIT_FAILURE;
  }
  for (;;) {
    struct sockaddr_in sender;
    socklen_t sender_len = sizeof(sender);
    u_int8_t buffer[IP_MAXPACKET + 1];
    ssize_t datagram_len = recvfrom(sockfd, buffer, IP_MAXPACKET, 0,
                                    (struct sockaddr *)&sender, &sender_len);
    if (datagram_len < 0) {
      fprintf(stderr, "recvfrom error: %s\n", strerror(errno));
      return EXIT_FAILURE;
    }
    char sender_ip_str[20];
    inet_ntop(AF_INET, &(sender.sin_addr), sender_ip_str,
              sizeof(sender_ip_str));
    printf("Received UDP packet from IP address: %s, port: %d\n", sender_ip_str,
           ntohs(sender.sin_port));
    buffer[datagram_len] = 0;
    printf("%ld-byte message: +%s+\n", datagram_len, buffer);
    char *reply = "Thank you!";
    ssize_t reply_len = strlen(reply);
    if (sendto(sockfd, reply, reply_len, 0, (struct sockaddr *)&sender,
               sender_len) != reply_len) {
      fprintf(stderr, "sendto error: %s\n", strerror(errno));
      return EXIT_FAILURE;
    }
    fflush(stdout);
  }
  close(sockfd);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1255 <main+0x75>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    %rax,%rdx
lea    0xdc1(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2d65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14bc <main+0x2dc>
lea    -0x18(%rbp),%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    0x2d76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x3039,%edi
call   1050 <htons@plt>
mov    %eax,-0x18(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0x0,%rax
jge    12e5 <main+0x105>
mov    0x2d11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x78(%rbp),%edi
mov    %rax,%rdx
lea    0xd43(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2cd5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14bc <main+0x2dc>
jmp    12ea <main+0x10a>
movl   $0xc,-0x2c(%rbp)
mov    0x2d00(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x80(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ccd(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%r8
xor    %ecx,%ecx
lea    -0x2c(%rbp),%r9
call   10b0 <recvfrom@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jae    1395 <main+0x1b5>
mov    0x2c6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    %rax,%rdx
lea    0xcaa(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2c2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    149b <main+0x2bb>
mov    0x2c44(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
add    $0x4,%rsi
lea    -0x60(%rbp),%rdx
mov    $0x14,%ecx
call   1030 <inet_ntop@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x28(%rbp),%edi
call   10c0 <ntohs@plt>
mov    -0x90(%rbp),%rsi
mov    %eax,%edx
lea    0xc5f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x80(%rbp),%rdx
mov    -0x48(%rbp),%rax
movq   $0x0,(%rdx,%rax,8)
mov    -0x48(%rbp),%rsi
lea    0xc70(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xc7a(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    -0x28(%rbp),%r8
mov    -0x2c(%rbp),%r9d
xor    %ecx,%ecx
call   1080 <sendto@plt>
cmp    -0x70(%rbp),%rax
je     1486 <main+0x2a6>
mov    0x2b7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    %rax,%rdx
lea    0xc23(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2b3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    149b <main+0x2bb>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4c(%rbp),%eax
test   %eax,%eax
je     14b7 <main+0x2d7>
jmp    14b2 <main+0x2d2>
jmp    14bc <main+0x2dc>
jmp    12ea <main+0x10a>
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0x2df8(%rip),%r15
mov    (%r15),%edi
mov    0x2dde(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
test   %eax,%eax
js     136f <main+0x19f>
mov    %eax,%ebx
lea    -0x48(%rbp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   10d0 <bzero@plt>
mov    (%r15),%eax
mov    %eax,-0x40(%rbp)
mov    $0x3039,%edi
call   1040 <htons@plt>
mov    %eax,-0x48(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x44(%rbp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
test   %rax,%rax
js     138f <main+0x1bf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rsp,%r15
movl   $0xc,-0x2c(%rbp)
mov    0x2d87(%rip),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %rsp,%r12
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    (%rcx),%edx
mov    %ebx,%edi
mov    %r12,%rsi
xor    %ecx,%ecx
lea    -0x38(%rbp),%r8
lea    -0x2c(%rbp),%r9
call   10a0 <recvfrom@plt>
mov    %rax,%r14
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
lea    -0x34(%rbp),%rsi
mov    %ebx,%r13d
lea    -0x60(%rbp),%rbx
mov    %rbx,%rdx
mov    $0x14,%ecx
call   1030 <inet_ntop@plt>
mov    -0x38(%rbp),%edi
call   10b0 <ntohs@plt>
lea    0xd4e(%rip),%rdi
mov    %rbx,%rsi
mov    %r13d,%ebx
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
movq   $0x0,(%r12,%r14,8)
lea    0xd63(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x2c(%rbp),%r9d
mov    $0xa,%edx
mov    %r13d,%edi
lea    0xd5b(%rip),%rsi
xor    %ecx,%ecx
lea    -0x38(%rbp),%r8
call   1070 <sendto@plt>
cmp    $0xa,%rax
jne    1339 <main+0x169>
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    %r15,%rsp
jmp    1260 <main+0x90>
mov    0x2c80(%rip),%rax
mov    (%rax),%ebx
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd21(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1080 <fprintf@plt>
mov    0x2c48(%rip),%rax
mov    (%rax),%eax
mov    %r15,%rsp
jmp    13c0 <main+0x1f0>
mov    0x2c4a(%rip),%rax
mov    (%rax),%ebx
mov    0x2c39(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc73(%rip),%rsi
jmp    13ad <main+0x1dd>
mov    0x2c2a(%rip),%rax
mov    (%rax),%ebx
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc65(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1080 <fprintf@plt>
mov    0x2bf2(%rip),%rax
mov    (%rax),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@stderr = global i32 0
@.str = [18 x i8] c"socket error: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@INADDR_ANY = global i32 0
@.str.1 = [16 x i8] c"bind error: %s\0A\00"
@IP_MAXPACKET = global i32 0
@.str.2 = [20 x i8] c"recvfrom error: %s\0A\00"
@.str.3 = [51 x i8] c"Received UDP packet from IP address: %s, port: %d\0A\00"
@.str.4 = [24 x i8] c"%ld-byte message: +%s+\0A\00"
@.str.5 = [11 x i8] c"Thank you!\00"
@.str.6 = [18 x i8] c"sendto error: %s\0A\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
%10 = alloca [20 x i8]
%11 = alloca i8*
%12 = alloca i64
store i32 0, i32* %1
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_DGRAM
%15 = call i32 @socket(i32 %13, i32 %14, i32 0)
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %0
%19 = load i32, i32* @stderr
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %1
br label %100
24: ; preds = %0
%25 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 2
store i32 %26, i32* %27
%28 = call i32 @htons(i32 12345)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
store i32 %28, i32* %29
%30 = load i32, i32* @INADDR_ANY
%31 = call i32 @htonl(i32 %30)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%33 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %32, i32 0, i32 0
store i32 %31, i32* %33
%34 = load i32, i32* %2
%35 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%36 = call i64 @bind(i32 %34, %struct.sockaddr* %35, i32 12)
%37 = icmp slt i64 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %24
%39 = load i32, i32* @stderr
%40 = load i32, i32* @errno
%41 = call i8* @strerror(i32 %40)
%42 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = load i32, i32* @EXIT_FAILURE
store i32 %43, i32* %1
br label %100
44: ; preds = %24
br label %45
45: ; preds = %99, %44
store i32 12, i32* %5
%46 = load i32, i32* @IP_MAXPACKET
%47 = add nsw i32 %46, 1
%48 = zext i32 %47 to i64
%49 = call i8* @llvm.stacksave()
store i8* %49, i8** %6
%50 = alloca i64, i64 %48
store i64 %48, i64* %7
%51 = load i32, i32* %2
%52 = load i32, i32* @IP_MAXPACKET
%53 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%54 = call i64 @recvfrom(i32 %51, i64* %50, i32 %52, i32 0, %struct.sockaddr* %53, i32* %5)
store i64 %54, i64* %8
%55 = load i64, i64* %8
%56 = icmp ult i64 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %45
%58 = load i32, i32* @stderr
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %60)
%62 = load i32, i32* @EXIT_FAILURE
store i32 %62, i32* %1
store i32 1, i32* %9
br label %96
63: ; preds = %45
%64 = load i32, i32* @AF_INET
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
%66 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%67 = call i32 @inet_ntop(i32 %64, %struct.TYPE_2__* %65, i8* %66, i32 20)
%68 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%69 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%70 = load i32, i32* %69
%71 = call i32 @ntohs(i32 %70)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %68, i32 %71)
%73 = load i64, i64* %8
%74 = getelementptr inbounds i64, i64* %50, i64 %73
store i64 0, i64* %74
%75 = load i64, i64* %8
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %75, i64* %50)
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8** %11
%77 = load i8*, i8** %11
%78 = call i64 @strlen(i8* %77)
store i64 %78, i64* %12
%79 = load i32, i32* %2
%80 = load i8*, i8** %11
%81 = load i64, i64* %12
%82 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%83 = load i32, i32* %5
%84 = call i64 @sendto(i32 %79, i8* %80, i64 %81, i32 0, %struct.sockaddr* %82, i32 %83)
%85 = load i64, i64* %12
%86 = icmp ne i64 %84, %85
br i1 %86, label %87, label %93
87: ; preds = %63
%88 = load i32, i32* @stderr
%89 = load i32, i32* @errno
%90 = call i8* @strerror(i32 %89)
%91 = call i32 @fprintf(i32 %88, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %90)
%92 = load i32, i32* @EXIT_FAILURE
store i32 %92, i32* %1
store i32 1, i32* %9
br label %96
93: ; preds = %63
%94 = load i32, i32* @stdout
%95 = call i32 @fflush(i32 %94)
store i32 0, i32* %9
br label %96
96: ; preds = %93, %87, %57
%97 = load i8*, i8** %6
%98 = load i32, i32* %9
switch i32 %98, label %102 [
i32 0, label %99
i32 1, label %100
]
99: ; preds = %96
br label %45
100: ; preds = %96, %38, %18
%101 = load i32, i32* %1
ret i32 %101
102: ; preds = %96
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@stderr = global i32 0
@.str = [18 x i8] c"socket error: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@INADDR_ANY = global i32 0
@.str.1 = [16 x i8] c"bind error: %s\0A\00"
@IP_MAXPACKET = global i32 0
@.str.3 = [51 x i8] c"Received UDP packet from IP address: %s, port: %d\0A\00"
@.str.4 = [24 x i8] c"%ld-byte message: +%s+\0A\00"
@.str.5 = [11 x i8] c"Thank you!\00"
@.str.6 = [18 x i8] c"sendto error: %s\0A\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = load i32, i32* @AF_INET
%6 = load i32, i32* @SOCK_DGRAM
%7 = tail call i32 @socket(i32 %5, i32 %6, i32 0)
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = load i32, i32* @errno
%12 = tail call i8* @strerror(i32 %11)
%13 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @EXIT_FAILURE
br label %70
15: ; preds = %0
%16 = bitcast %struct.sockaddr_in* %1 to i8*
%17 = call i32 @bzero(%struct.sockaddr_in* %1, i32 12)
%18 = load i32, i32* @AF_INET
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %18, i32* %19
%20 = tail call i32 @htons(i32 12345)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i32 %20, i32* %21
%22 = load i32, i32* @INADDR_ANY
%23 = tail call i32 @htonl(i32 %22)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i32 %23, i32* %24
%25 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%26 = call i64 @bind(i32 %7, %struct.sockaddr* %25, i32 12)
%27 = icmp slt i64 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %15
%29 = bitcast %struct.sockaddr_in* %2 to i8*
%30 = bitcast i32* %3 to i8*
%31 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
br label %41
35: ; preds = %15
%36 = load i32, i32* @stderr
%37 = load i32, i32* @errno
%38 = call i8* @strerror(i32 %37)
%39 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %38)
%40 = load i32, i32* @EXIT_FAILURE
br label %68
41: ; preds = %28, %65
store i32 12, i32* %3
%42 = load i32, i32* @IP_MAXPACKET
%43 = add nsw i32 %42, 1
%44 = zext i32 %43 to i64
%45 = call i8* @llvm.stacksave()
%46 = alloca i64, i64 %44
%47 = load i32, i32* @IP_MAXPACKET
%48 = call i64 @recvfrom(i32 %7, i64* %46, i32 %47, i32 0, %struct.sockaddr* %31, i32* %3)
%49 = load i32, i32* @AF_INET
%50 = call i32 @inet_ntop(i32 %49, %struct.TYPE_2__* %33, i8* %32, i32 20)
%51 = load i32, i32* %34
%52 = call i32 @ntohs(i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %32, i32 %52)
%54 = getelementptr inbounds i64, i64* %46, i64 %48
store i64 0, i64* %54
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 %48, i64* %46)
%56 = load i32, i32* %3
%57 = call i64 @sendto(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i64 10, i32 0, %struct.sockaddr* %31, i32 %56)
%58 = icmp eq i64 %57, 10
br i1 %58, label %65, label %59
59: ; preds = %41
%60 = load i32, i32* @stderr
%61 = load i32, i32* @errno
%62 = call i8* @strerror(i32 %61)
%63 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %62)
%64 = load i32, i32* @EXIT_FAILURE
br label %68
65: ; preds = %41
%66 = load i32, i32* @stdout
%67 = call i32 @fflush(i32 %66)
br label %41
68: ; preds = %59, %35
%69 = phi i32 [ %40, %35 ], [ %64, %59 ]
br label %70
70: ; preds = %68, %9
%71 = phi i32 [ %14, %9 ], [ %69, %68 ]
ret i32 %71
}