#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 */

/* Type definitions */
struct tcphdr {
  int check;
  int window;
  int fin;
  int syn;
  int rst;
  int psh;
  int ack;
  int urg;
  int /*<<< orphan*/ dest;
  int /*<<< orphan*/ source;
};
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};
struct iphdr {
  int ihl;
  int check;
  int version;
  int ttl;
  int /*<<< orphan*/ tot_len;
  int /*<<< orphan*/ daddr;
  int /*<<< orphan*/ saddr;
};
struct in_addr {
  int dummy;
};
typedef int /*<<< orphan*/ on;
typedef int /*<<< orphan*/ bypass_addr;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ IP_HDRINCL;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ exit(int);
char *inet_ntoa(struct in_addr);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recvUDP(int, char *, int, struct sockaddr_in *);
int /*<<< orphan*/ sendto(int, char **, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int socketUDP(int, struct sockaddr_in *);
int main(int argc, char **argv) {
  char bypass_buff[1024];
  struct iphdr *ip_header = (struct iphdr *)bypass_buff;
  struct tcphdr *tcp_header = 0;
  printf("\nStart Server\n\n");
  int send_socket = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);
  if (send_socket == -1) {
    perror("socket");
    exit(1);
  }
  int on = 1;
  if (setsockopt(send_socket, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)) < 0) {
    perror("setsockopt");
    exit(1);
  }
  printf("Create UDP Socket(Receive)\n");
  struct sockaddr_in bypass_addr;
  int bypass_socket = socketUDP(27000 + 5, &bypass_addr);
  printf("Enter Main Loop\n");
  int r;
  while (1) {
    recvUDP(bypass_socket, bypass_buff, 1024, &bypass_addr);
    printf("\nReceive UDP Packet\n");
    tcp_header = (struct tcphdr *)(bypass_buff + ip_header->ihl * 4);
    printf("-----------------------------------------\n");
    printf("[ 패킷을 받았습니다. ]\n");
    printf("Source IP : %s\n", inet_ntoa(*(struct in_addr *)&ip_header->saddr));
    printf("Source Port : %5u\n", ntohs(tcp_header->source));
    printf("Destination IP : %s\n",
           inet_ntoa(*(struct in_addr *)&ip_header->daddr));
    printf("Destination Port : %5u\n", ntohs(tcp_header->dest));
    printf("IP packet size : %d\n", ntohs(ip_header->tot_len));
    printf("IP check : %d\n", ip_header->check);
    printf("TCP check : %d\n", (tcp_header->check));
    printf("IP Version : %d\n", ip_header->version);
    printf("Time To Live : %d\n", ip_header->ttl);
    printf("Window Size : %d\n", tcp_header->window);
    printf("Flags : ");
    if (tcp_header->fin == 1)
      printf("[FIN]\n");
    if (tcp_header->syn == 1)
      printf("[SYN]\n");
    if (tcp_header->rst == 1)
      printf("[RST]\n");
    if (tcp_header->psh == 1)
      printf("[PSH]\n");
    if (tcp_header->ack == 1)
      printf("[ACK]\n");
    if (tcp_header->urg == 1)
      printf("[URG]\n");
    printf("-----------------------------------------\n");
    printf("Send Packet to Server\n");
    sendto(send_socket, &bypass_buff, ntohs(ip_header->tot_len), 0,
           (struct sockaddr *)&bypass_addr, sizeof(bypass_addr));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x418(%rbp)
movq   $0x0,-0x420(%rbp)
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
mov    0x2dd7(%rip),%rax
mov    (%rax),%edx
call   10c0 <socket@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0xffffffff,-0x424(%rbp)
jne    1229 <main+0x89>
lea    0xdf6(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x1,-0x428(%rbp)
mov    -0x424(%rbp),%edi
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
mov    0x2da7(%rip),%rax
mov    (%rax),%edx
lea    -0x428(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    127d <main+0xdd>
lea    0xda9(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x697d,%edi
lea    -0x430(%rbp),%rsi
call   1080 <socketUDP@plt>
mov    %eax,-0x434(%rbp)
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x434(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
lea    -0x430(%rbp),%rcx
call   1060 <recvUDP@plt>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x410(%rbp),%rax
mov    -0x418(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x420(%rbp)
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x418(%rbp),%rax
mov    0x18(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
mov    0x24(%rax),%edi
call   1090 <ntohs@plt>
mov    %eax,%esi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x418(%rbp),%rax
mov    0x14(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
mov    0x20(%rax),%edi
call   1090 <ntohs@plt>
mov    %eax,%esi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x418(%rbp),%rax
mov    0x10(%rax),%edi
call   1090 <ntohs@plt>
mov    %eax,%esi
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x418(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
mov    (%rax),%esi
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x418(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x418(%rbp),%rax
mov    0xc(%rax),%esi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
cmpl   $0x1,0x8(%rax)
jne    1459 <main+0x2b9>
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
cmpl   $0x1,0xc(%rax)
jne    1478 <main+0x2d8>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
cmpl   $0x1,0x10(%rax)
jne    1497 <main+0x2f7>
lea    0xcf0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
cmpl   $0x1,0x14(%rax)
jne    14b6 <main+0x316>
lea    0xcd8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
cmpl   $0x1,0x18(%rax)
jne    14d5 <main+0x335>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x420(%rbp),%rax
cmpl   $0x1,0x1c(%rax)
jne    14f4 <main+0x354>
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xb69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x424(%rbp),%eax
mov    %eax,-0x444(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x440(%rbp)
mov    -0x418(%rbp),%rax
mov    0x10(%rax),%edi
call   1090 <ntohs@plt>
mov    -0x444(%rbp),%edi
mov    -0x440(%rbp),%rsi
mov    %eax,%edx
lea    -0x430(%rbp),%r8
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1070 <sendto@plt>
jmp    12b0 <main+0x110>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    0x2e03(%rip),%rax
mov    (%rax),%esi
mov    0x2dea(%rip),%rax
mov    (%rax),%edx
call   10d0 <socket@plt>
cmp    $0xffffffff,%eax
je     1475 <main+0x2c5>
mov    %eax,%r14d
movl   $0x1,0x4(%rsp)
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
mov    0x2ddf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    %r14d,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
test   %rax,%rax
js     147e <main+0x2ce>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%r15
mov    $0x697d,%edi
mov    %r15,%rsi
call   1090 <socketUDP@plt>
mov    %eax,%r13d
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
lea    0xeda(%rip),%rbp
jmp    12a5 <main+0xf5>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
mov    0x20(%rsp),%edi
call   10a0 <ntohs@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r15,%r8
mov    $0x4,%r9d
call   1080 <sendto@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
mov    %r15,%rcx
call   1070 <recvUDP@plt>
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
movslq 0x10(%rsp),%r12
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
mov    0x28(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xd25(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x34(%rsp,%r12,4),%edi
call   10a0 <ntohs@plt>
lea    0xd1a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x24(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xd14(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x30(%rsp,%r12,4),%edi
call   10a0 <ntohs@plt>
lea    0xd0e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x20(%rsp),%edi
call   10a0 <ntohs@plt>
lea    0xd0d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xd0e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp,%r12,4),%esi
lea    0xd0a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xd08(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xd07(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%rsp,%r12,4),%esi
lea    0xd07(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd0b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x1,0x18(%rsp,%r12,4)
jne    13dc <main+0x22c>
lea    0xdc9(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x1,0x1c(%rsp,%r12,4)
je     1410 <main+0x260>
cmpl   $0x1,0x20(%rsp,%r12,4)
je     1424 <main+0x274>
cmpl   $0x1,0x24(%rsp,%r12,4)
je     1438 <main+0x288>
cmpl   $0x1,0x28(%rsp,%r12,4)
je     144c <main+0x29c>
cmpl   $0x1,0x2c(%rsp,%r12,4)
jne    1270 <main+0xc0>
jmp    1464 <main+0x2b4>
nopw   0x0(%rax,%rax,1)
lea    0xd83(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x1,0x20(%rsp,%r12,4)
jne    13ec <main+0x23c>
lea    0xd69(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x1,0x24(%rsp,%r12,4)
jne    13f4 <main+0x244>
lea    0xd4f(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x1,0x28(%rsp,%r12,4)
jne    13fc <main+0x24c>
lea    0xd35(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x1,0x2c(%rsp,%r12,4)
jne    1270 <main+0xc0>
lea    0xd17(%rip),%rdi
call   1030 <puts@plt>
jmp    1270 <main+0xc0>
lea    0xb84(%rip),%rdi
jmp    1485 <main+0x2d5>
lea    0xb82(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.iphdr = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.tcphdr = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.sockaddr_in = type { i32 }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [16 x i8] c"\0AStart Server\0A\0A\00"
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_TCP = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@IPPROTO_IP = global i32 0
@IP_HDRINCL = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@.str.3 = [28 x i8] c"Create UDP Socket(Receive)\0A\00"
@.str.4 = [17 x i8] c"Enter Main Loop\0A\00"
@.str.5 = [21 x i8] c"\0AReceive UDP Packet\0A\00"
@.str.6 = [43 x i8] c"-----------------------------------------\0A\00"
@.str.7 = [32 x i8] c"[ \ED\8C\A8\ED\82\B7\EC\9D\84 \EB\B0\9B\EC\95\98\EC\8A\B5\EB\8B\88\EB\8B\A4. ]\0A\00"
@.str.8 = [16 x i8] c"Source IP : %s\0A\00"
@.str.9 = [19 x i8] c"Source Port : %5u\0A\00"
@.str.10 = [21 x i8] c"Destination IP : %s\0A\00"
@.str.11 = [24 x i8] c"Destination Port : %5u\0A\00"
@.str.12 = [21 x i8] c"IP packet size : %d\0A\00"
@.str.13 = [15 x i8] c"IP check : %d\0A\00"
@.str.14 = [16 x i8] c"TCP check : %d\0A\00"
@.str.15 = [17 x i8] c"IP Version : %d\0A\00"
@.str.16 = [19 x i8] c"Time To Live : %d\0A\00"
@.str.17 = [18 x i8] c"Window Size : %d\0A\00"
@.str.18 = [9 x i8] c"Flags : \00"
@.str.19 = [7 x i8] c"[FIN]\0A\00"
@.str.20 = [7 x i8] c"[SYN]\0A\00"
@.str.21 = [7 x i8] c"[RST]\0A\00"
@.str.22 = [7 x i8] c"[PSH]\0A\00"
@.str.23 = [7 x i8] c"[ACK]\0A\00"
@.str.24 = [7 x i8] c"[URG]\0A\00"
@.str.25 = [23 x i8] c"Send Packet to Server\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca %struct.iphdr*
%8 = alloca %struct.tcphdr*
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%15 = bitcast i8* %14 to %struct.iphdr*
store %struct.iphdr* %15, %struct.iphdr** %7
store %struct.tcphdr* null, %struct.tcphdr** %8
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @PF_INET
%18 = load i32, i32* @SOCK_RAW
%19 = load i32, i32* @IPPROTO_TCP
%20 = call i32 @socket(i32 %17, i32 %18, i32 %19)
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %26
23: ; preds = %2
%24 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %2
store i32 1, i32* %10
%27 = load i32, i32* %9
%28 = load i32, i32* @IPPROTO_IP
%29 = load i32, i32* @IP_HDRINCL
%30 = call i64 @setsockopt(i32 %27, i32 %28, i32 %29, i32* %10, i32 4)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %26
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @socketUDP(i32 27005, %struct.sockaddr_in* %11)
store i32 %37, i32* %12
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %35, %145
%40 = load i32, i32* %12
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%42 = call i32 @recvUDP(i32 %40, i8* %41, i32 1024, %struct.sockaddr_in* %11)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%45 = load %struct.iphdr*, %struct.iphdr** %7
%46 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %45, i32 0, i32 0
%47 = load i32, i32* %46
%48 = mul nsw i32 %47, 4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %44, i64 %49
%51 = bitcast i8* %50 to %struct.tcphdr*
store %struct.tcphdr* %51, %struct.tcphdr** %8
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%54 = load %struct.iphdr*, %struct.iphdr** %7
%55 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %54, i32 0, i32 6
%56 = bitcast i32* %55 to %struct.in_addr*
%57 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %56, i32 0, i32 0
%58 = load i32, i32* %57
%59 = call i8* @inet_ntoa(i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* %59)
%61 = load %struct.tcphdr*, %struct.tcphdr** %8
%62 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %61, i32 0, i32 9
%63 = load i32, i32* %62
%64 = call i32 @ntohs(i32 %63)
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %64)
%66 = load %struct.iphdr*, %struct.iphdr** %7
%67 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %66, i32 0, i32 5
%68 = bitcast i32* %67 to %struct.in_addr*
%69 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %68, i32 0, i32 0
%70 = load i32, i32* %69
%71 = call i8* @inet_ntoa(i32 %70)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %71)
%73 = load %struct.tcphdr*, %struct.tcphdr** %8
%74 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %73, i32 0, i32 8
%75 = load i32, i32* %74
%76 = call i32 @ntohs(i32 %75)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %76)
%78 = load %struct.iphdr*, %struct.iphdr** %7
%79 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %78, i32 0, i32 4
%80 = load i32, i32* %79
%81 = call i32 @ntohs(i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i32 %81)
%83 = load %struct.iphdr*, %struct.iphdr** %7
%84 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %83, i32 0, i32 1
%85 = load i32, i32* %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i32 %85)
%87 = load %struct.tcphdr*, %struct.tcphdr** %8
%88 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %87, i32 0, i32 0
%89 = load i32, i32* %88
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %89)
%91 = load %struct.iphdr*, %struct.iphdr** %7
%92 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %91, i32 0, i32 2
%93 = load i32, i32* %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 %93)
%95 = load %struct.iphdr*, %struct.iphdr** %7
%96 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %95, i32 0, i32 3
%97 = load i32, i32* %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i32 %97)
%99 = load %struct.tcphdr*, %struct.tcphdr** %8
%100 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %99, i32 0, i32 1
%101 = load i32, i32* %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i32 %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%104 = load %struct.tcphdr*, %struct.tcphdr** %8
%105 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %104, i32 0, i32 2
%106 = load i32, i32* %105
%107 = icmp eq i32 %106, 1
br i1 %107, label %108, label %110
108: ; preds = %39
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
br label %110
110: ; preds = %108, %39
%111 = load %struct.tcphdr*, %struct.tcphdr** %8
%112 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %111, i32 0, i32 3
%113 = load i32, i32* %112
%114 = icmp eq i32 %113, 1
br i1 %114, label %115, label %117
115: ; preds = %110
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i64 0, i64 0))
br label %117
117: ; preds = %115, %110
%118 = load %struct.tcphdr*, %struct.tcphdr** %8
%119 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %118, i32 0, i32 4
%120 = load i32, i32* %119
%121 = icmp eq i32 %120, 1
br i1 %121, label %122, label %124
122: ; preds = %117
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
br label %124
124: ; preds = %122, %117
%125 = load %struct.tcphdr*, %struct.tcphdr** %8
%126 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %125, i32 0, i32 5
%127 = load i32, i32* %126
%128 = icmp eq i32 %127, 1
br i1 %128, label %129, label %131
129: ; preds = %124
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0))
br label %131
131: ; preds = %129, %124
%132 = load %struct.tcphdr*, %struct.tcphdr** %8
%133 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %132, i32 0, i32 6
%134 = load i32, i32* %133
%135 = icmp eq i32 %134, 1
br i1 %135, label %136, label %138
136: ; preds = %131
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.23, i64 0, i64 0))
br label %138
138: ; preds = %136, %131
%139 = load %struct.tcphdr*, %struct.tcphdr** %8
%140 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %139, i32 0, i32 7
%141 = load i32, i32* %140
%142 = icmp eq i32 %141, 1
br i1 %142, label %143, label %145
143: ; preds = %138
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0))
br label %145
145: ; preds = %143, %138
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.25, i64 0, i64 0))
%148 = load i32, i32* %9
%149 = bitcast [1024 x i8]* %6 to i8**
%150 = load %struct.iphdr*, %struct.iphdr** %7
%151 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %150, i32 0, i32 4
%152 = load i32, i32* %151
%153 = call i32 @ntohs(i32 %152)
%154 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%155 = call i32 @sendto(i32 %148, i8** %149, i32 %153, i32 0, %struct.sockaddr* %154, i32 4)
br label %39
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.tcphdr = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_TCP = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@IPPROTO_IP = global i32 0
@IP_HDRINCL = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@.str.8 = [16 x i8] c"Source IP : %s\0A\00"
@.str.9 = [19 x i8] c"Source Port : %5u\0A\00"
@.str.10 = [21 x i8] c"Destination IP : %s\0A\00"
@.str.11 = [24 x i8] c"Destination Port : %5u\0A\00"
@.str.12 = [21 x i8] c"IP packet size : %d\0A\00"
@.str.13 = [15 x i8] c"IP check : %d\0A\00"
@.str.14 = [16 x i8] c"TCP check : %d\0A\00"
@.str.15 = [17 x i8] c"IP Version : %d\0A\00"
@.str.16 = [19 x i8] c"Time To Live : %d\0A\00"
@.str.17 = [18 x i8] c"Window Size : %d\0A\00"
@.str.18 = [9 x i8] c"Flags : \00"
@str = [15 x i8] c"\0AStart Server\0A\00"
@str.26 = [27 x i8] c"Create UDP Socket(Receive)\00"
@str.27 = [16 x i8] c"Enter Main Loop\00"
@str.28 = [20 x i8] c"\0AReceive UDP Packet\00"
@str.30 = [31 x i8] c"[ \ED\8C\A8\ED\82\B7\EC\9D\84 \EB\B0\9B\EC\95\98\EC\8A\B5\EB\8B\88\EB\8B\A4. ]\00"
@str.31 = [42 x i8] c"-----------------------------------------\00"
@str.32 = [22 x i8] c"Send Packet to Server\00"
@str.33 = [6 x i8] c"[URG]\00"
@str.34 = [6 x i8] c"[ACK]\00"
@str.35 = [6 x i8] c"[PSH]\00"
@str.36 = [6 x i8] c"[RST]\00"
@str.37 = [6 x i8] c"[SYN]\00"
@str.38 = [6 x i8] c"[FIN]\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = alloca i32
%5 = alloca %struct.sockaddr_in
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @PF_INET
%9 = load i32, i32* @SOCK_RAW
%10 = load i32, i32* @IPPROTO_TCP
%11 = tail call i32 @socket(i32 %8, i32 %9, i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%18 = load i32, i32* @IPPROTO_IP
%19 = load i32, i32* @IP_HDRINCL
%20 = call i64 @setsockopt(i32 %11, i32 %18, i32 %19, i32* %4, i32 4)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %16
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.26, i64 0, i64 0))
%27 = bitcast %struct.sockaddr_in* %5 to i8*
%28 = call i32 @socketUDP(i32 27005, %struct.sockaddr_in* %5)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.27, i64 0, i64 0))
%30 = bitcast [1024 x i8]* %3 to i32*
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 24
%32 = bitcast i8* %31 to i32*
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 20
%34 = bitcast i8* %33 to i32*
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 16
%36 = bitcast i8* %35 to i32*
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 4
%38 = bitcast i8* %37 to i32*
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 8
%40 = bitcast i8* %39 to i32*
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 12
%42 = bitcast i8* %41 to i32*
%43 = bitcast [1024 x i8]* %3 to i8**
%44 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
br label %45
45: ; preds = %128, %25
%46 = call i32 @recvUDP(i32 %28, i8* %6, i32 1024, %struct.sockaddr_in* %5)
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.28, i64 0, i64 0))
%48 = load i32, i32* %30
%49 = shl nsw i32 %48, 2
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %50
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.31, i64 0, i64 0))
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.30, i64 0, i64 0))
%54 = load i32, i32* %32
%55 = call i8* @inet_ntoa(i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* %55)
%57 = getelementptr inbounds i8, i8* %51, i64 36
%58 = bitcast i8* %57 to i32*
%59 = load i32, i32* %58
%60 = call i32 @ntohs(i32 %59)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %34
%63 = call i8* @inet_ntoa(i32 %62)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %63)
%65 = getelementptr inbounds i8, i8* %51, i64 32
%66 = bitcast i8* %65 to i32*
%67 = load i32, i32* %66
%68 = call i32 @ntohs(i32 %67)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %36
%71 = call i32 @ntohs(i32 %70)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %38
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i32 %73)
%75 = bitcast i8* %51 to i32*
%76 = load i32, i32* %75
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %40
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %42
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i32 %80)
%82 = getelementptr inbounds i8, i8* %51, i64 4
%83 = bitcast i8* %82 to i32*
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0), i32 %84)
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%87 = getelementptr inbounds i8, i8* %51, i64 8
%88 = bitcast i8* %87 to i32*
%89 = load i32, i32* %88
%90 = icmp eq i32 %89, 1
br i1 %90, label %91, label %93
91: ; preds = %45
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.38, i64 0, i64 0))
br label %93
93: ; preds = %91, %45
%94 = getelementptr inbounds i8, i8* %51, i64 12
%95 = bitcast i8* %94 to i32*
%96 = load i32, i32* %95
%97 = icmp eq i32 %96, 1
br i1 %97, label %98, label %100
98: ; preds = %93
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.37, i64 0, i64 0))
br label %100
100: ; preds = %98, %93
%101 = getelementptr inbounds i8, i8* %51, i64 16
%102 = bitcast i8* %101 to i32*
%103 = load i32, i32* %102
%104 = icmp eq i32 %103, 1
br i1 %104, label %105, label %107
105: ; preds = %100
%106 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.36, i64 0, i64 0))
br label %107
107: ; preds = %105, %100
%108 = getelementptr inbounds i8, i8* %51, i64 20
%109 = bitcast i8* %108 to i32*
%110 = load i32, i32* %109
%111 = icmp eq i32 %110, 1
br i1 %111, label %112, label %114
112: ; preds = %107
%113 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.35, i64 0, i64 0))
br label %114
114: ; preds = %112, %107
%115 = getelementptr inbounds i8, i8* %51, i64 24
%116 = bitcast i8* %115 to i32*
%117 = load i32, i32* %116
%118 = icmp eq i32 %117, 1
br i1 %118, label %119, label %121
119: ; preds = %114
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.34, i64 0, i64 0))
br label %121
121: ; preds = %119, %114
%122 = getelementptr inbounds i8, i8* %51, i64 28
%123 = bitcast i8* %122 to i32*
%124 = load i32, i32* %123
%125 = icmp eq i32 %124, 1
br i1 %125, label %126, label %128
126: ; preds = %121
%127 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.33, i64 0, i64 0))
br label %128
128: ; preds = %126, %121
%129 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.31, i64 0, i64 0))
%130 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.32, i64 0, i64 0))
%131 = load i32, i32* %36
%132 = call i32 @ntohs(i32 %131)
%133 = call i32 @sendto(i32 %11, i8** %43, i32 %132, i32 0, %struct.sockaddr* %44, i32 4)
br label %45
}