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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ error_handling(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(void *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int htons(int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int serv_sd, clnt_sd;
  char buf[1024];
  int read_cnt, str_len;
  struct sockaddr_in serv_adr;
  struct sockaddr_in clnt_adr;
  socklen_t clnt_adr_sz;
  FILE *fp;
  if (argc != 2) {
    printf("Usage : %s <port>\n", argv[0]);
    exit(1);
  }
  fp = fopen("lec11.pdf", "rb");
  serv_sd = socket(PF_INET, SOCK_DGRAM, 0);
  if (serv_sd == -1)
    error_handling("socket() error");
  memset(&serv_adr, 0, sizeof(serv_adr));
  serv_adr.sin_family = AF_INET;
  serv_adr.sin_addr.s_addr = htonl(INADDR_ANY);
  serv_adr.sin_port = htons(atoi(argv[1]));
  if (bind(serv_sd, (struct sockaddr *)&serv_adr, sizeof(serv_adr)) == -1)
    error_handling("bind() error");
  clnt_adr_sz = sizeof(clnt_adr);
  str_len = recvfrom(serv_sd, buf, 1024, 0, (struct sockaddr *)&clnt_adr,
                     &clnt_adr_sz);
  printf("str_len : %d,     INIT HOST orderd port: %#x\n", str_len,
         clnt_adr.sin_port);
  if (str_len != -1) {
    printf("Recieve from init request(server) \n");
  } else {
    printf("init fail");
  }
  int order = 0;
  while (1) {
    read_cnt = fread((void *)buf, 1, 1024, fp);
    if (read_cnt < 1024) {
      sendto(serv_sd, buf, read_cnt, 0, (struct sockaddr *)&clnt_adr,
             clnt_adr_sz);
      printf("마지막 부분\n");
      break;
    }
    sendto(serv_sd, buf, 1024, 0, (struct sockaddr *)&clnt_adr, clnt_adr_sz);
    ++order;
    printf(" %d 보내는 단위 부분 Server, HOST orderd port: %#x\n", order,
           clnt_adr.sin_port);
  }
  printf(" server end\n");
  fclose(fp);
  close(serv_sd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1232 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xdda(%rip),%rdi
lea    0xddd(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x458(%rbp)
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
mov    0x2d7c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    127e <main+0x8e>
lea    0xda7(%rip),%rdi
call   10b0 <error_handling@plt>
lea    -0x438(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x430(%rbp)
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x434(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x438(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x438(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12f7 <main+0x107>
lea    0xd3d(%rip),%rdi
call   10b0 <error_handling@plt>
movl   $0xc,-0x44c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
lea    -0x448(%rbp),%r8
mov    $0x400,%edx
xor    %ecx,%ecx
lea    -0x44c(%rbp),%r9
call   10c0 <recvfrom@plt>
mov    %eax,-0x428(%rbp)
mov    -0x428(%rbp),%esi
mov    -0x448(%rbp),%edx
lea    0xcfe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0xffffffff,-0x428(%rbp)
je     1365 <main+0x175>
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1373 <main+0x183>
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x45c(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x458(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0x400,-0x424(%rbp)
jge    13e8 <main+0x1f8>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    -0x424(%rbp),%edx
lea    -0x448(%rbp),%r8
mov    -0x44c(%rbp),%r9d
xor    %ecx,%ecx
call   1090 <sendto@plt>
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    143a <main+0x24a>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
lea    -0x448(%rbp),%r8
mov    -0x44c(%rbp),%r9d
mov    $0x400,%edx
xor    %ecx,%ecx
call   1090 <sendto@plt>
mov    -0x45c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x45c(%rbp)
mov    -0x45c(%rbp),%esi
mov    -0x448(%rbp),%edx
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    137d <main+0x18d>
lea    0xca4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x458(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x14(%rbp),%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jne    1400 <main+0x200>
lea    0xdef(%rip),%rdi
lea    0xdf2(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%r15
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,%r12d
cmp    $0xffffffff,%eax
jne    1260 <main+0x60>
lea    0xdc5(%rip),%rdi
call   10c0 <error_handling@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x24(%rsp)
mov    0x8(%r14),%rdi
call   1100 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %eax,0x20(%rsp)
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12c8 <main+0xc8>
lea    0xd6c(%rip),%rdi
call   10c0 <error_handling@plt>
movl   $0xc,0xc(%rsp)
lea    0x30(%rsp),%rsi
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %r12d,%edi
mov    $0x400,%edx
xor    %ecx,%ecx
call   10d0 <recvfrom@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%edx
lea    0xd41(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    $0xffffffff,%ebx
je     1317 <main+0x117>
lea    0xdbc(%rip),%rdi
call   1030 <puts@plt>
jmp    1325 <main+0x125>
lea    0xd4c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jl     13a9 <main+0x1a9>
lea    0x30(%rsp),%rbp
lea    0x10(%rsp),%r14
lea    0xd1b(%rip),%r13
nopl   0x0(%rax)
mov    0xc(%rsp),%r9d
mov    %r12d,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
mov    %r14,%r8
call   10a0 <sendto@plt>
mov    0x10(%rsp),%edx
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
add    $0x1,%ebx
cmp    $0x400,%eax
jge    1360 <main+0x160>
mov    0xc(%rsp),%r9d
lea    0x30(%rsp),%rsi
lea    0x10(%rsp),%r8
mov    %r12d,%edi
mov    %eax,%edx
xor    %ecx,%ecx
call   10a0 <sendto@plt>
lea    0xce4(%rip),%rdi
call   1030 <puts@plt>
lea    0xce9(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %r12d,%edi
call   10b0 <close@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14),%rsi
lea    0xbf6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"Usage : %s <port>\0A\00"
@.str.1 = [10 x i8] c"lec11.pdf\00"
@.str.2 = [3 x i8] c"rb\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [15 x i8] c"socket() error\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind() error\00"
@.str.5 = [46 x i8] c"str_len : %d, INIT HOST orderd port: %#x\0A\00"
@.str.6 = [36 x i8] c"Recieve from init request(server) \0A\00"
@.str.7 = [10 x i8] c"init fail\00"
@.str.8 = [18 x i8] c"\EB\A7\88\EC\A7\80\EB\A7\89 \EB\B6\80\EB\B6\84\0A\00"
@.str.9 = [59 x i8] c" %d \EB\B3\B4\EB\82\B4\EB\8A\94 \EB\8B\A8\EC\9C\84 \EB\B6\80\EB\B6\84 Server, HOST orderd port: %#x\0A\00"
@.str.10 = [13 x i8] c" server end\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1024 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %25, i32** %14
%26 = load i32, i32* @PF_INET
%27 = load i32, i32* @SOCK_DGRAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %33
31: ; preds = %24
%32 = call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %24
%34 = call i32 @memset(%struct.sockaddr_in* %11, i32 0, i32 12)
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %35, i32* %36
%37 = load i32, i32* @INADDR_ANY
%38 = call i32 @htonl(i32 %37)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%40 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %39, i32 0, i32 0
store i32 %38, i32* %40
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
%45 = call i32 @htons(i32 %44)
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %45, i32* %46
%47 = load i32, i32* %6
%48 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%49 = call i32 @bind(i32 %47, %struct.sockaddr* %48, i32 12)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %53
51: ; preds = %33
%52 = call i32 @error_handling(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %51, %33
store i32 12, i32* %13
%54 = load i32, i32* %6
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%56 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%57 = call i32 @recvfrom(i32 %54, i8* %55, i32 1024, i32 0, %struct.sockaddr* %56, i32* %13)
store i32 %57, i32* %10
%58 = load i32, i32* %10
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 0
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i32 %58, i32 %60)
%62 = load i32, i32* %10
%63 = icmp ne i32 %62, -1
br i1 %63, label %64, label %66
64: ; preds = %53
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
br label %68
66: ; preds = %53
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %68
68: ; preds = %66, %64
store i32 0, i32* %15
br label %69
69: ; preds = %68, %83
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%71 = load i32*, i32** %14
%72 = call i32 @fread(i8* %70, i32 1, i32 1024, i32* %71)
store i32 %72, i32* %9
%73 = load i32, i32* %9
%74 = icmp slt i32 %73, 1024
br i1 %74, label %75, label %83
75: ; preds = %69
%76 = load i32, i32* %6
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%78 = load i32, i32* %9
%79 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%80 = load i32, i32* %13
%81 = call i32 @sendto(i32 %76, i8* %77, i32 %78, i32 0, %struct.sockaddr* %79, i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %95
83: ; preds = %69
%84 = load i32, i32* %6
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%86 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%87 = load i32, i32* %13
%88 = call i32 @sendto(i32 %84, i8* %85, i32 1024, i32 0, %struct.sockaddr* %86, i32 %87)
%89 = load i32, i32* %15
%90 = add nsw i32 %89, 1
store i32 %90, i32* %15
%91 = load i32, i32* %15
%92 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 0
%93 = load i32, i32* %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0), i32 %91, i32 %93)
br label %69
95: ; preds = %75
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%97 = load i32*, i32** %14
%98 = call i32 @fclose(i32* %97)
%99 = load i32, i32* %6
%100 = call i32 @close(i32 %99)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"Usage : %s <port>\0A\00"
@.str.1 = [10 x i8] c"lec11.pdf\00"
@.str.2 = [3 x i8] c"rb\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [15 x i8] c"socket() error\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind() error\00"
@.str.5 = [46 x i8] c"str_len : %d, INIT HOST orderd port: %#x\0A\00"
@.str.7 = [10 x i8] c"init fail\00"
@.str.9 = [59 x i8] c" %d \EB\B3\B4\EB\82\B4\EB\8A\94 \EB\8B\A8\EC\9C\84 \EB\B6\80\EB\B6\84 Server, HOST orderd port: %#x\0A\00"
@str = [17 x i8] c"\EB\A7\88\EC\A7\80\EB\A7\89 \EB\B6\80\EB\B6\84\00"
@str.11 = [12 x i8] c" server end\00"
@str.12 = [35 x i8] c"Recieve from init request(server) \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast %struct.sockaddr_in* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 2
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* @PF_INET
%19 = load i32, i32* @SOCK_DGRAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = tail call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %16
%25 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 12)
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %26, i32* %27
%28 = load i32, i32* @INADDR_ANY
%29 = call i32 @htonl(i32 %28)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %29, i32* %30
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = call i32 @htons(i32 %33)
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %34, i32* %35
%36 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%37 = call i32 @bind(i32 %20, %struct.sockaddr* %36, i32 12)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %24
%40 = call i32 @error_handling(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %39, %24
store i32 12, i32* %6
%42 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%43 = call i32 @recvfrom(i32 %20, i8* %7, i32 1024, i32 0, %struct.sockaddr* %42, i32* %6)
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i32 %43, i32 %45)
%47 = icmp eq i32 %43, -1
br i1 %47, label %50, label %48
48: ; preds = %41
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.12, i64 0, i64 0))
br label %52
50: ; preds = %41
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
%53 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %17)
%54 = icmp slt i32 %53, 1024
br i1 %54, label %55, label %63
55: ; preds = %63, %52
%56 = phi i32 [ %53, %52 ], [ %70, %63 ]
%57 = load i32, i32* %6
%58 = call i32 @sendto(i32 %20, i8* %7, i32 %56, i32 0, %struct.sockaddr* %42, i32 %57)
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
%61 = call i32 @fclose(i32* %17)
%62 = call i32 @close(i32 %20)
ret i32 0
63: ; preds = %52, %63
%64 = phi i32 [ %67, %63 ], [ 0, %52 ]
%65 = load i32, i32* %6
%66 = call i32 @sendto(i32 %20, i8* %7, i32 1024, i32 0, %struct.sockaddr* %42, i32 %65)
%67 = add nuw nsw i32 %64, 1
%68 = load i32, i32* %44
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0), i32 %67, i32 %68)
%70 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %17)
%71 = icmp slt i32 %70, 1024
br i1 %71, label %55, label %63
}