#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*/ serverData;
typedef int /*<<< orphan*/ clientData;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ assert(int);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
scalar_t__ listen(int, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int serverSocket;
  int clientSocket;
  struct sockaddr_in serverData;
  struct sockaddr_in clientData;
  int clientDataLength;
  char buffer[1024];
  bool isServing;
  bool isConnectedToClient;
  int bytesReceived;
  int pid;
  bzero(&serverData, sizeof(serverData));
  serverData.sin_family = AF_INET;
  serverData.sin_addr.s_addr = htonl(INADDR_ANY);
  serverData.sin_port = htons(1234);
  serverSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  int bindResult =
      bind(serverSocket, (struct sockaddr *)&serverData, sizeof(serverData));
  if (bindResult < 0) {
    printf("Error: Unable to bind socket");
    close(serverSocket);
  } else if (listen(serverSocket, 10) < 0) {
    printf("Error: Unable to listen");
    close(serverSocket);
  } else {
    clientDataLength = sizeof(clientData);
    isServing = true;
    while (isServing) {
      clientSocket = accept(serverSocket, (struct sockaddr *)&clientData,
                            &clientDataLength);
      assert(clientSocket > 0);
      char *clientAddress = inet_ntoa(clientData.sin_addr);
      int clientPort = ntohs(clientData.sin_port);
      printf("Accepted Connection from: %s:%d\n", clientAddress, clientPort);
      pid = fork();
      if (pid == 0) {
        close(serverSocket);
        isConnectedToClient = true;
        while (isConnectedToClient) {
          bytesReceived = recv(clientSocket, buffer, 1024, 0);
          buffer[bytesReceived] = '\0';
          printf("Received:\n%s\n", buffer);
          char replyText[] = "Packet received!";
          strncpy(buffer, replyText, strlen(replyText));
          printf("Replying with: %s\n", buffer);
          send(clientSocket, buffer, strlen(replyText), 0);
        }
        close(clientSocket);
        exit(EXIT_SUCCESS);
      } else {
        close(clientSocket);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    0x2d9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,-0x24(%rbp)
mov    $0x4d2,%edi
call   1070 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    0x2d47(%rip),%rax
mov    (%rax),%esi
mov    0x2d4e(%rip),%rax
mov    (%rax),%edx
call   1140 <socket@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
mov    %eax,-0x454(%rbp)
cmpl   $0x0,-0x454(%rbp)
jge    12d3 <main+0xb3>
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
jmp    14dd <main+0x2bd>
mov    -0x14(%rbp),%edi
mov    $0xa,%esi
call   10d0 <listen@plt>
cmp    $0x0,%rax
jge    1305 <main+0xe5>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
jmp    14d8 <main+0x2b8>
movl   $0xc,-0x3c(%rbp)
movl   $0x1,-0x444(%rbp)
cmpl   $0x0,-0x444(%rbp)
je     14d3 <main+0x2b3>
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   1110 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   10c0 <assert@plt>
mov    -0x34(%rbp),%edi
call   1050 <inet_ntoa@plt>
mov    %rax,-0x460(%rbp)
mov    -0x38(%rbp),%edi
call   10e0 <ntohs@plt>
mov    %eax,-0x464(%rbp)
mov    -0x460(%rbp),%rsi
mov    -0x464(%rbp),%edx
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x0,%al
call   1130 <fork@plt>
mov    %eax,-0x450(%rbp)
cmpl   $0x0,-0x450(%rbp)
jne    14c6 <main+0x2a6>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
movl   $0x1,-0x448(%rbp)
cmpl   $0x0,-0x448(%rbp)
je     14b0 <main+0x290>
mov    -0x18(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x44c(%rbp)
movslq -0x44c(%rbp),%rax
movb   $0x0,-0x440(%rbp,%rax,1)
lea    -0x440(%rbp),%rsi
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0xc81(%rip),%rax
mov    %rax,-0x480(%rbp)
mov    0xc7b(%rip),%rax
mov    %rax,-0x478(%rbp)
mov    0xc76(%rip),%al
mov    %al,-0x470(%rbp)
lea    -0x440(%rbp),%rax
mov    %rax,-0x4a0(%rbp)
lea    -0x480(%rbp),%rax
mov    %rax,-0x498(%rbp)
lea    -0x480(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x4a0(%rbp),%rdi
mov    -0x498(%rbp),%rsi
mov    %eax,%edx
call   1040 <strncpy@plt>
lea    -0x440(%rbp),%rsi
lea    0xbf9(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x48c(%rbp)
lea    -0x440(%rbp),%rax
mov    %rax,-0x488(%rbp)
lea    -0x480(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x48c(%rbp),%edi
mov    -0x488(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
jmp    13ab <main+0x18b>
mov    -0x18(%rbp),%edi
call   10b0 <close@plt>
mov    0x2af9(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    -0x18(%rbp),%edi
call   10b0 <close@plt>
jmp    1316 <main+0xf6>
jmp    14d8 <main+0x2b8>
jmp    14dd <main+0x2bd>
xor    %eax,%eax
add    $0x4a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    0x2dae(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,0x14(%rsp)
mov    $0x4d2,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
mov    0x2d58(%rip),%rax
mov    (%rax),%esi
mov    0x2d5f(%rip),%rax
mov    (%rax),%edx
call   1130 <socket@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
test   %eax,%eax
js     13c2 <main+0x1b2>
mov    %ebp,%edi
mov    $0xa,%esi
call   10d0 <listen@plt>
test   %rax,%rax
js     13cb <main+0x1bb>
movl   $0xc,0xc(%rsp)
lea    0x20(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0xd6e(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1110 <accept@plt>
mov    %eax,%r13d
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   10c0 <assert@plt>
mov    0x24(%rsp),%edi
call   1050 <inet_ntoa@plt>
mov    %rax,%rbx
mov    0x20(%rsp),%edi
call   10e0 <ntohs@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
call   1120 <fork@plt>
test   %eax,%eax
je     1326 <main+0x116>
mov    %r13d,%edi
call   10b0 <close@plt>
jmp    12d0 <main+0xc0>
mov    %ebp,%edi
call   10b0 <close@plt>
lea    0x50(%rsp),%rbp
lea    0xd1d(%rip),%r14
lea    0x30(%rsp),%rbx
lea    0xd1f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,0x50(%rsp,%rax,1)
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
movaps 0xd03(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movb   $0x0,0x40(%rsp)
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <strncpy@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
jmp    1350 <main+0x140>
lea    0xc37(%rip),%rdi
jmp    13d2 <main+0x1c2>
lea    0xc4b(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
xor    %eax,%eax
add    $0x458,%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
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [29 x i8] c"Error: Unable to bind socket\00"
@.str.1 = [24 x i8] c"Error: Unable to listen\00"
@.str.2 = [33 x i8] c"Accepted Connection from: %s:%d\0A\00"
@.str.3 = [14 x i8] c"Received:\0A%s\0A\00"
@__const.main.replyText = [17 x i8] c"Packet received!\00"
@.str.4 = [19 x i8] c"Replying with: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
%11 = alloca [1024 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32
%19 = alloca [17 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = call i32 @bzero(%struct.sockaddr_in* %8, i32 12)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %21, i32* %22
%23 = load i32, i32* @INADDR_ANY
%24 = call i32 @htonl(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%26 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %25, i32 0, i32 0
store i32 %24, i32* %26
%27 = call i32 @htons(i32 1234)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i32 %27, i32* %28
%29 = load i32, i32* @PF_INET
%30 = load i32, i32* @SOCK_STREAM
%31 = load i32, i32* @IPPROTO_TCP
%32 = call i32 @socket(i32 %29, i32 %30, i32 %31)
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%35 = call i32 @bind(i32 %33, %struct.sockaddr* %34, i32 12)
store i32 %35, i32* %16
%36 = load i32, i32* %16
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%40 = load i32, i32* %6
%41 = call i32 @close(i32 %40)
br label %114
42: ; preds = %2
%43 = load i32, i32* %6
%44 = call i64 @listen(i32 %43, i32 10)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* %6
%49 = call i32 @close(i32 %48)
br label %113
50: ; preds = %42
store i32 12, i32* %10
store i32 1, i32* %12
br label %51
51: ; preds = %111, %50
%52 = load i32, i32* %12
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %112
54: ; preds = %51
%55 = load i32, i32* %6
%56 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%57 = call i32 @accept(i32 %55, %struct.sockaddr* %56, i32* %10)
store i32 %57, i32* %7
%58 = load i32, i32* %7
%59 = icmp sgt i32 %58, 0
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%63 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %62, i32 0, i32 0
%64 = load i32, i32* %63
%65 = call i8* @inet_ntoa(i32 %64)
store i8* %65, i8** %17
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%67 = load i32, i32* %66
%68 = call i32 @ntohs(i32 %67)
store i32 %68, i32* %18
%69 = load i8*, i8** %17
%70 = load i32, i32* %18
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %69, i32 %70)
%72 = call i32 (...) @fork()
store i32 %72, i32* %15
%73 = load i32, i32* %15
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %108
75: ; preds = %54
%76 = load i32, i32* %6
%77 = call i32 @close(i32 %76)
store i32 1, i32* %13
br label %78
78: ; preds = %81, %75
%79 = load i32, i32* %13
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %103
81: ; preds = %78
%82 = load i32, i32* %7
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%84 = call i32 @recv(i32 %82, i8* %83, i32 1024, i32 0)
store i32 %84, i32* %14
%85 = load i32, i32* %14
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 %86
store i8 0, i8* %87
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %88)
%90 = bitcast [17 x i8]* %19 to i8*
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%92 = getelementptr inbounds [17 x i8], [17 x i8]* %19, i64 0, i64 0
%93 = getelementptr inbounds [17 x i8], [17 x i8]* %19, i64 0, i64 0
%94 = call i32 @strlen(i8* %93)
%95 = call i32 @strncpy(i8* %91, i8* %92, i32 %94)
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %96)
%98 = load i32, i32* %7
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%100 = getelementptr inbounds [17 x i8], [17 x i8]* %19, i64 0, i64 0
%101 = call i32 @strlen(i8* %100)
%102 = call i32 @send(i32 %98, i8* %99, i32 %101, i32 0)
br label %78
103: ; preds = %78
%104 = load i32, i32* %7
%105 = call i32 @close(i32 %104)
%106 = load i32, i32* @EXIT_SUCCESS
%107 = call i32 @exit(i32 %106)
unreachable
108: ; preds = %54
%109 = load i32, i32* %7
%110 = call i32 @close(i32 %109)
br label %111
111: ; preds = %108
br label %51
112: ; preds = %51
br label %113
113: ; preds = %112, %46
br label %114
114: ; preds = %113, %38
ret i32 0
}

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
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [29 x i8] c"Error: Unable to bind socket\00"
@.str.1 = [24 x i8] c"Error: Unable to listen\00"
@.str.2 = [33 x i8] c"Accepted Connection from: %s:%d\0A\00"
@.str.3 = [14 x i8] c"Received:\0A%s\0A\00"
@__const.main.replyText = [17 x i8] c"Packet received!\00"
@.str.4 = [19 x i8] c"Replying with: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = alloca [17 x i8]
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = bitcast %struct.sockaddr_in* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%12 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%13 = load i32, i32* @AF_INET
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %13, i32* %14
%15 = load i32, i32* @INADDR_ANY
%16 = tail call i32 @htonl(i32 %15)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %16, i32* %17
%18 = tail call i32 @htons(i32 1234)
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %18, i32* %19
%20 = load i32, i32* @PF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = load i32, i32* @IPPROTO_TCP
%23 = tail call i32 @socket(i32 %20, i32 %21, i32 %22)
%24 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%25 = call i32 @bind(i32 %23, %struct.sockaddr* %24, i32 12)
%26 = icmp slt i32 %25, 0
br i1 %26, label %61, label %27
27: ; preds = %2
%28 = call i64 @listen(i32 %23, i32 10)
%29 = icmp slt i64 %28, 0
br i1 %29, label %61, label %30
30: ; preds = %27
store i32 12, i32* %5
%31 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
br label %34
34: ; preds = %59, %30
%35 = call i32 @accept(i32 %23, %struct.sockaddr* %31, i32* %5)
%36 = icmp sgt i32 %35, 0
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = load i32, i32* %32
%40 = call i8* @inet_ntoa(i32 %39)
%41 = load i32, i32* %33
%42 = call i32 @ntohs(i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %40, i32 %42)
%44 = call i32 (...) @fork()
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %59
46: ; preds = %34
%47 = call i32 @close(i32 %23)
%48 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
br label %49
49: ; preds = %49, %46
%50 = call i32 @recv(i32 %35, i8* %11, i32 1024, i32 0)
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %51
store i8 0, i8* %52
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%54 = call i32 @strlen(i8* %48)
%55 = call i32 @strncpy(i8* %11, i8* %48, i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%57 = call i32 @strlen(i8* %48)
%58 = call i32 @send(i32 %35, i8* %11, i32 %57, i32 0)
br label %49
59: ; preds = %34
%60 = call i32 @close(i32 %35)
br label %34
61: ; preds = %27, %2
%62 = phi i8* [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %27 ]
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %62)
%64 = call i32 @close(i32 %23)
ret i32 0
}