#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 {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ server;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_DGRAM;
int atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int recvfrom(int, char *, int, int, struct sockaddr *, int *);
int /*<<< orphan*/ sendto(int, char *, int, int, struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  struct sockaddr_in addr, server;
  char msg[512];
  if (argc != 5) {
    usage(argv[0]);
    return 1;
  }
  int ip1 = atoi(argv[1]);
  int ip2 = atoi(argv[2]);
  int ip3 = atoi(argv[3]);
  int ip4 = atoi(argv[4]);
  if (ip1 < 0 || ip1 > 255 || ip2 < 0 || ip2 > 255 || ip3 < 0 || ip3 > 255 ||
      ip4 < 0 || ip4 > 255) {
    usage(argv[0]);
    return 1;
  }
  int sd = socket(AF_INET, SOCK_DGRAM, 0);
  if (sd < 0) {
    fprintf(stderr, "%s: cannot open socket \n", argv[0]);
    return 1;
  }
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = htonl(INADDR_ANY);
  server.sin_port = htons(53);
  int rc = bind(sd, (struct sockaddr *)&server, sizeof(server));
  if (rc < 0) {
    fprintf(stderr, "%s: cannot bind port number %d \n", argv[0], 53);
    return 1;
  }
  int len = sizeof(addr);
  int flags = 0;
  while (1) {
    int n = recvfrom(sd, msg, 512, flags, (struct sockaddr *)&addr, &len);
    if (n < 0) {
      continue;
    }
    msg[2] = 0x81;
    msg[3] = 0x80;
    msg[6] = 0;
    msg[7] = 1;
    msg[8] = 0;
    msg[9] = 0;
    msg[10] = 0;
    msg[11] = 0;
    msg[n++] = 0xC0;
    msg[n++] = 0x0C;
    msg[n++] = 0x00;
    msg[n++] = 0x01;
    msg[n++] = 0x00;
    msg[n++] = 0x01;
    msg[n++] = 0x00;
    msg[n++] = 0x00;
    msg[n++] = 0x00;
    msg[n++] = 0x3c;
    msg[n++] = 0x00;
    msg[n++] = 0x04;
    msg[n++] = ip1;
    msg[n++] = ip2;
    msg[n++] = ip3;
    msg[n++] = ip4;
    sendto(sd, msg, n, flags, (struct sockaddr *)&addr, len);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     11cb <main+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    15ff <main+0x46f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x234(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x238(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x23c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x240(%rbp)
cmpl   $0x0,-0x234(%rbp)
jl     128b <main+0xfb>
cmpl   $0xff,-0x234(%rbp)
jg     128b <main+0xfb>
cmpl   $0x0,-0x238(%rbp)
jl     128b <main+0xfb>
cmpl   $0xff,-0x238(%rbp)
jg     128b <main+0xfb>
cmpl   $0x0,-0x23c(%rbp)
jl     128b <main+0xfb>
cmpl   $0xff,-0x23c(%rbp)
jg     128b <main+0xfb>
cmpl   $0x0,-0x240(%rbp)
jl     128b <main+0xfb>
cmpl   $0xff,-0x240(%rbp)
jle    12a3 <main+0x113>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    15ff <main+0x46f>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
mov    %eax,-0x244(%rbp)
cmpl   $0x0,-0x244(%rbp)
jge    12f9 <main+0x169>
mov    0x2cf2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd1a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15ff <main+0x46f>
mov    0x2ce8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2cd4(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x35,%edi
call   1030 <htons@plt>
mov    %eax,-0x30(%rbp)
mov    -0x244(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   1090 <bind@plt>
mov    %eax,-0x248(%rbp)
cmpl   $0x0,-0x248(%rbp)
jge    1379 <main+0x1e9>
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xcb8(%rip),%rsi
mov    $0x35,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    15ff <main+0x46f>
movl   $0xc,-0x24c(%rbp)
movl   $0x0,-0x250(%rbp)
mov    -0x244(%rbp),%edi
lea    -0x230(%rbp),%rsi
mov    -0x250(%rbp),%ecx
lea    -0x20(%rbp),%r8
mov    $0x200,%edx
lea    -0x24c(%rbp),%r9
call   1070 <recvfrom@plt>
mov    %eax,-0x254(%rbp)
cmpl   $0x0,-0x254(%rbp)
jge    13cd <main+0x23d>
jmp    138d <main+0x1fd>
movb   $0x81,-0x22e(%rbp)
movb   $0x80,-0x22d(%rbp)
movb   $0x0,-0x22a(%rbp)
movb   $0x1,-0x229(%rbp)
movb   $0x0,-0x228(%rbp)
movb   $0x0,-0x227(%rbp)
movb   $0x0,-0x226(%rbp)
movb   $0x0,-0x225(%rbp)
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0xc0,-0x230(%rbp,%rax,1)
c0
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0xc,-0x230(%rbp,%rax,1)
0c
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x0,-0x230(%rbp,%rax,1)
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x1,-0x230(%rbp,%rax,1)
01
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x0,-0x230(%rbp,%rax,1)
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x1,-0x230(%rbp,%rax,1)
01
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x0,-0x230(%rbp,%rax,1)
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x0,-0x230(%rbp,%rax,1)
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x0,-0x230(%rbp,%rax,1)
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x3c,-0x230(%rbp,%rax,1)
3c
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x0,-0x230(%rbp,%rax,1)
mov    -0x254(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x254(%rbp)
cltq
movb   $0x4,-0x230(%rbp,%rax,1)
04
mov    -0x234(%rbp),%eax
mov    %al,%cl
mov    -0x254(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x254(%rbp)
cltq
mov    %cl,-0x230(%rbp,%rax,1)
mov    -0x238(%rbp),%eax
mov    %al,%cl
mov    -0x254(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x254(%rbp)
cltq
mov    %cl,-0x230(%rbp,%rax,1)
mov    -0x23c(%rbp),%eax
mov    %al,%cl
mov    -0x254(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x254(%rbp)
cltq
mov    %cl,-0x230(%rbp,%rax,1)
mov    -0x240(%rbp),%eax
mov    %al,%cl
mov    -0x254(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x254(%rbp)
cltq
mov    %cl,-0x230(%rbp,%rax,1)
mov    -0x244(%rbp),%edi
lea    -0x230(%rbp),%rsi
mov    -0x254(%rbp),%edx
mov    -0x250(%rbp),%ecx
lea    -0x20(%rbp),%r8
mov    -0x24c(%rbp),%r9d
call   1050 <sendto@plt>
jmp    138d <main+0x1fd>
mov    -0x4(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rsi,%rbp
cmp    $0x5,%edi
jne    1337 <main+0x1a7>
mov    0x8(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x8(%rsp)
mov    0x18(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x20(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,(%rsp)
cmp    $0xff,%ebx
ja     1337 <main+0x1a7>
cmpl   $0x0,0x8(%rsp)
js     1337 <main+0x1a7>
cmpl   $0xff,0x8(%rsp)
jg     1337 <main+0x1a7>
cmpl   $0x0,0x4(%rsp)
js     1337 <main+0x1a7>
cmpl   $0xff,0x4(%rsp)
jg     1337 <main+0x1a7>
cmpl   $0x0,(%rsp)
js     1337 <main+0x1a7>
cmpl   $0x100,(%rsp)
jge    1337 <main+0x1a7>
mov    %ebx,%r12d
mov    0x2dab(%rip),%r14
mov    (%r14),%edi
mov    0x2d91(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
test   %eax,%eax
js     1357 <main+0x1c7>
mov    %eax,%ebx
mov    (%r14),%eax
mov    %eax,0x18(%rsp)
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,0x14(%rsp)
mov    $0x35,%edi
call   1030 <htons@plt>
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   1090 <bind@plt>
test   %eax,%eax
js     1374 <main+0x1e4>
movl   $0xc,0xc(%rsp)
lea    0x30(%rsp),%rbp
lea    0x20(%rsp),%r14
lea    0xc(%rsp),%r15
movabs $0x10001000cc0,%r13
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x200,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    %r15,%r9
call   1070 <recvfrom@plt>
test   %eax,%eax
js     12c0 <main+0x130>
movw   $0x8081,0x32(%rsp)
movw   $0x100,0x36(%rsp)
mov    %eax,%ecx
movl   $0x0,0x38(%rsp)
mov    %r13,0x30(%rsp,%rcx,1)
movl   $0x4003c00,0x38(%rsp,%rcx,1)
04
mov    %r12b,0x3c(%rsp,%rcx,1)
mov    0x8(%rsp),%edx
mov    %dl,0x3d(%rsp,%rcx,1)
mov    0x4(%rsp),%edx
mov    %dl,0x3e(%rsp,%rcx,1)
add    $0x10,%eax
mov    (%rsp),%edx
mov    %dl,0x3f(%rsp,%rcx,1)
mov    0xc(%rsp),%r9d
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r14,%r8
call   1050 <sendto@plt>
jmp    12c0 <main+0x130>
mov    0x0(%rbp),%rdi
call   1080 <usage@plt>
mov    $0x1,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xc95(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1340 <main+0x1b0>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xc91(%rip),%rsi
mov    $0x35,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1340 <main+0x1b0>

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 = [25 x i8] c"%s: cannot open socket \0A\00"
@INADDR_ANY = global i32 0
@.str.1 = [33 x i8] c"%s: cannot bind port number %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in
%8 = alloca [512 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 5
br i1 %19, label %20, label %25
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @usage(i8* %23)
store i32 1, i32* %3
br label %200
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %9
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %10
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %11
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %12
%42 = load i32, i32* %9
%43 = icmp slt i32 %42, 0
br i1 %43, label %65, label %44
44: ; preds = %25
%45 = load i32, i32* %9
%46 = icmp sgt i32 %45, 255
br i1 %46, label %65, label %47
47: ; preds = %44
%48 = load i32, i32* %10
%49 = icmp slt i32 %48, 0
br i1 %49, label %65, label %50
50: ; preds = %47
%51 = load i32, i32* %10
%52 = icmp sgt i32 %51, 255
br i1 %52, label %65, label %53
53: ; preds = %50
%54 = load i32, i32* %11
%55 = icmp slt i32 %54, 0
br i1 %55, label %65, label %56
56: ; preds = %53
%57 = load i32, i32* %11
%58 = icmp sgt i32 %57, 255
br i1 %58, label %65, label %59
59: ; preds = %56
%60 = load i32, i32* %12
%61 = icmp slt i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %59
%63 = load i32, i32* %12
%64 = icmp sgt i32 %63, 255
br i1 %64, label %65, label %70
65: ; preds = %62, %59, %56, %53, %50, %47, %44, %25
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 0
%68 = load i8*, i8** %67
%69 = call i32 @usage(i8* %68)
store i32 1, i32* %3
br label %200
70: ; preds = %62
%71 = load i32, i32* @AF_INET
%72 = load i32, i32* @SOCK_DGRAM
%73 = call i32 @socket(i32 %71, i32 %72, i32 0)
store i32 %73, i32* %13
%74 = load i32, i32* %13
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %82
76: ; preds = %70
%77 = load i32, i32* @stderr
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 0
%80 = load i8*, i8** %79
%81 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %80)
store i32 1, i32* %3
br label %200
82: ; preds = %70
%83 = load i32, i32* @AF_INET
%84 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %83, i32* %84
%85 = load i32, i32* @INADDR_ANY
%86 = call i32 @htonl(i32 %85)
%87 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%88 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %87, i32 0, i32 0
store i32 %86, i32* %88
%89 = call i32 @htons(i32 53)
%90 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
store i32 %89, i32* %90
%91 = load i32, i32* %13
%92 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%93 = call i32 @bind(i32 %91, %struct.sockaddr* %92, i32 12)
store i32 %93, i32* %14
%94 = load i32, i32* %14
%95 = icmp slt i32 %94, 0
br i1 %95, label %96, label %102
96: ; preds = %82
%97 = load i32, i32* @stderr
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 0
%100 = load i8*, i8** %99
%101 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %100, i32 53)
store i32 1, i32* %3
br label %200
102: ; preds = %82
store i32 12, i32* %15
store i32 0, i32* %16
br label %103
103: ; preds = %102, %111, %112
%104 = load i32, i32* %13
%105 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%106 = load i32, i32* %16
%107 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%108 = call i32 @recvfrom(i32 %104, i8* %105, i32 512, i32 %106, %struct.sockaddr* %107, i32* %15)
store i32 %108, i32* %17
%109 = load i32, i32* %17
%110 = icmp slt i32 %109, 0
br i1 %110, label %111, label %112
111: ; preds = %103
br label %103
112: ; preds = %103
%113 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 2
store i8 -127, i8* %113
%114 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 3
store i8 -128, i8* %114
%115 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 6
store i8 0, i8* %115
%116 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 7
store i8 1, i8* %116
%117 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 8
store i8 0, i8* %117
%118 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 9
store i8 0, i8* %118
%119 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 10
store i8 0, i8* %119
%120 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 11
store i8 0, i8* %120
%121 = load i32, i32* %17
%122 = add nsw i32 %121, 1
store i32 %122, i32* %17
%123 = sext i32 %121 to i64
%124 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %123
store i8 -64, i8* %124
%125 = load i32, i32* %17
%126 = add nsw i32 %125, 1
store i32 %126, i32* %17
%127 = sext i32 %125 to i64
%128 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %127
store i8 12, i8* %128
%129 = load i32, i32* %17
%130 = add nsw i32 %129, 1
store i32 %130, i32* %17
%131 = sext i32 %129 to i64
%132 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %131
store i8 0, i8* %132
%133 = load i32, i32* %17
%134 = add nsw i32 %133, 1
store i32 %134, i32* %17
%135 = sext i32 %133 to i64
%136 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %135
store i8 1, i8* %136
%137 = load i32, i32* %17
%138 = add nsw i32 %137, 1
store i32 %138, i32* %17
%139 = sext i32 %137 to i64
%140 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %139
store i8 0, i8* %140
%141 = load i32, i32* %17
%142 = add nsw i32 %141, 1
store i32 %142, i32* %17
%143 = sext i32 %141 to i64
%144 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %143
store i8 1, i8* %144
%145 = load i32, i32* %17
%146 = add nsw i32 %145, 1
store i32 %146, i32* %17
%147 = sext i32 %145 to i64
%148 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %147
store i8 0, i8* %148
%149 = load i32, i32* %17
%150 = add nsw i32 %149, 1
store i32 %150, i32* %17
%151 = sext i32 %149 to i64
%152 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %151
store i8 0, i8* %152
%153 = load i32, i32* %17
%154 = add nsw i32 %153, 1
store i32 %154, i32* %17
%155 = sext i32 %153 to i64
%156 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %155
store i8 0, i8* %156
%157 = load i32, i32* %17
%158 = add nsw i32 %157, 1
store i32 %158, i32* %17
%159 = sext i32 %157 to i64
%160 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %159
store i8 60, i8* %160
%161 = load i32, i32* %17
%162 = add nsw i32 %161, 1
store i32 %162, i32* %17
%163 = sext i32 %161 to i64
%164 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %163
store i8 0, i8* %164
%165 = load i32, i32* %17
%166 = add nsw i32 %165, 1
store i32 %166, i32* %17
%167 = sext i32 %165 to i64
%168 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %167
store i8 4, i8* %168
%169 = load i32, i32* %9
%170 = trunc i32 %169 to i8
%171 = load i32, i32* %17
%172 = add nsw i32 %171, 1
store i32 %172, i32* %17
%173 = sext i32 %171 to i64
%174 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %173
store i8 %170, i8* %174
%175 = load i32, i32* %10
%176 = trunc i32 %175 to i8
%177 = load i32, i32* %17
%178 = add nsw i32 %177, 1
store i32 %178, i32* %17
%179 = sext i32 %177 to i64
%180 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %179
store i8 %176, i8* %180
%181 = load i32, i32* %11
%182 = trunc i32 %181 to i8
%183 = load i32, i32* %17
%184 = add nsw i32 %183, 1
store i32 %184, i32* %17
%185 = sext i32 %183 to i64
%186 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %185
store i8 %182, i8* %186
%187 = load i32, i32* %12
%188 = trunc i32 %187 to i8
%189 = load i32, i32* %17
%190 = add nsw i32 %189, 1
store i32 %190, i32* %17
%191 = sext i32 %189 to i64
%192 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %191
store i8 %188, i8* %192
%193 = load i32, i32* %13
%194 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%195 = load i32, i32* %17
%196 = load i32, i32* %16
%197 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%198 = load i32, i32* %15
%199 = call i32 @sendto(i32 %193, i8* %194, i32 %195, i32 %196, %struct.sockaddr* %197, i32 %198)
br label %103
200: ; preds = %96, %76, %65, %20
%201 = load i32, i32* %3
ret i32 %201
}

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 = [25 x i8] c"%s: cannot open socket \0A\00"
@INADDR_ANY = global i32 0
@.str.1 = [33 x i8] c"%s: cannot bind port number %d \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca [512 x i8]
%6 = alloca i32
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = icmp eq i32 %0, 5
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = tail call i32 @usage(i8* %12)
br label %135
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
%24 = getelementptr inbounds i8*, i8** %1, i64 4
%25 = load i8*, i8** %24
%26 = tail call i32 @atoi(i8* %25)
%27 = icmp ugt i32 %17, 255
%28 = icmp slt i32 %20, 0
%29 = select i1 %27, i1 true, i1 %28
%30 = icmp sgt i32 %20, 255
%31 = select i1 %29, i1 true, i1 %30
%32 = icmp slt i32 %23, 0
%33 = select i1 %31, i1 true, i1 %32
%34 = icmp sgt i32 %23, 255
%35 = select i1 %33, i1 true, i1 %34
%36 = icmp slt i32 %26, 0
%37 = select i1 %35, i1 true, i1 %36
%38 = icmp sgt i32 %26, 255
%39 = select i1 %37, i1 true, i1 %38
br i1 %39, label %40, label %43
40: ; preds = %14
%41 = load i8*, i8** %1
%42 = tail call i32 @usage(i8* %41)
br label %135
43: ; preds = %14
%44 = load i32, i32* @AF_INET
%45 = load i32, i32* @SOCK_DGRAM
%46 = tail call i32 @socket(i32 %44, i32 %45, i32 0)
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = load i8*, i8** %1
%51 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %50)
br label %135
52: ; preds = %43
%53 = load i32, i32* @AF_INET
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %53, i32* %54
%55 = load i32, i32* @INADDR_ANY
%56 = tail call i32 @htonl(i32 %55)
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %56, i32* %57
%58 = tail call i32 @htons(i32 53)
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %58, i32* %59
%60 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%61 = call i32 @bind(i32 %46, %struct.sockaddr* %60, i32 12)
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %52
%64 = load i32, i32* @stderr
%65 = load i8*, i8** %1
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %65, i32 53)
br label %135
67: ; preds = %52
%68 = bitcast i32* %6 to i8*
store i32 12, i32* %6
%69 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%70 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 2
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 3
%72 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 6
%73 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 7
%74 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 8
%75 = trunc i32 %17 to i8
%76 = trunc i32 %20 to i8
%77 = trunc i32 %23 to i8
%78 = trunc i32 %26 to i8
%79 = bitcast i8* %74 to i32*
br label %80
80: ; preds = %83, %67
%81 = call i32 @recvfrom(i32 %46, i8* %9, i32 512, i32 0, %struct.sockaddr* %69, i32* %6)
%82 = icmp slt i32 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %80, %84
br label %80
84: ; preds = %80
store i8 -127, i8* %70
store i8 -128, i8* %71
store i8 0, i8* %72
store i8 1, i8* %73
%85 = add nuw nsw i32 %81, 1
%86 = zext i32 %81 to i64
%87 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %86
store i32 0, i32* %79
store i8 -64, i8* %87
%88 = add nuw nsw i32 %81, 2
%89 = zext i32 %85 to i64
%90 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %89
store i8 12, i8* %90
%91 = add nuw nsw i32 %81, 3
%92 = zext i32 %88 to i64
%93 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %92
store i8 0, i8* %93
%94 = add nuw nsw i32 %81, 4
%95 = zext i32 %91 to i64
%96 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %95
store i8 1, i8* %96
%97 = add nuw nsw i32 %81, 5
%98 = zext i32 %94 to i64
%99 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %98
store i8 0, i8* %99
%100 = add nuw nsw i32 %81, 6
%101 = zext i32 %97 to i64
%102 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %101
store i8 1, i8* %102
%103 = add nuw nsw i32 %81, 7
%104 = zext i32 %100 to i64
%105 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %104
store i8 0, i8* %105
%106 = add nuw nsw i32 %81, 8
%107 = zext i32 %103 to i64
%108 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %107
store i8 0, i8* %108
%109 = add nuw nsw i32 %81, 9
%110 = zext i32 %106 to i64
%111 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %110
store i8 0, i8* %111
%112 = add nuw nsw i32 %81, 10
%113 = zext i32 %109 to i64
%114 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %113
store i8 60, i8* %114
%115 = add nuw nsw i32 %81, 11
%116 = zext i32 %112 to i64
%117 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %116
store i8 0, i8* %117
%118 = add nuw nsw i32 %81, 12
%119 = zext i32 %115 to i64
%120 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %119
store i8 4, i8* %120
%121 = add nuw nsw i32 %81, 13
%122 = zext i32 %118 to i64
%123 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %122
store i8 %75, i8* %123
%124 = add nuw nsw i32 %81, 14
%125 = zext i32 %121 to i64
%126 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %125
store i8 %76, i8* %126
%127 = add nuw nsw i32 %81, 15
%128 = zext i32 %124 to i64
%129 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %128
store i8 %77, i8* %129
%130 = add nuw nsw i32 %81, 16
%131 = zext i32 %127 to i64
%132 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %131
store i8 %78, i8* %132
%133 = load i32, i32* %6
%134 = call i32 @sendto(i32 %46, i8* %9, i32 %130, i32 0, %struct.sockaddr* %69, i32 %133)
br label %83
135: ; preds = %40, %63, %48, %11
ret i32 1
}