#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 */
typedef int time_t;
struct sockaddr {
  int dummy;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ socklen_t;
typedef int pid_t;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ _exit(int);
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ close(int);
int fork();
int getpid();
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void handle_new_connection(int socket_desc) {
  struct sockaddr client;
  socklen_t length;
  int ack = accept(socket_desc, &client, &length);
  if (ack < 0) {
    handle_new_connection(socket_desc);
  }
  pid_t pid = fork();
  if (pid == -1) {
    _exit(4);
  } else if (pid == 0) {
    printf("Hello from the child process (%d)!\n", getpid());
    fd_set local;
    time_t start_time = time(NULL);
    time_t last_message_time = time(NULL);
    bool not_closed = true;
    while (not_closed) {
      char buffer[255];
      int counter;
      for (counter = 0; counter < 255; counter++)
        buffer[counter] = 0;
      int i = 0;
      bool reading = true;
      start_time = time(NULL);
      printf("%d: Waiting a message\n", getpid());
      select(1, (fd_set *)&ack, 0, 0, 0);
      do {
        char c;
        ssize_t x = recv(ack, &c, 1, 0);
        if (x > 0) {
          buffer[i] = c;
          if (buffer[i] == '.') {
            i++;
            buffer[i] = '\0';
            reading = false;
          }
          i++;
        } else {
          if (time(NULL) - last_message_time > 15) {
            reading = false;
            printf("%d: Client has closed connection !\n", getpid());
            not_closed = false;
          }
          usleep(500000);
        }
      } while (reading);
      if (i > 0) {
        printf("%d: Recieve message : %s\n", getpid(), buffer);
        last_message_time = time(NULL);
      }
      usleep(500);
      if (not_closed && i > 0) {
        printf("%d: Respond on socket descriptor %d.\n", getpid(), ack);
        char *message = "Welcome to you, but I can't talk more.";
        write(ack, message, strlen(message));
      }
    }
    printf("End of world for %d\n", getpid());
    close(ack);
    _exit(EXIT_SUCCESS);
  } else {
    handle_new_connection(socket_desc);
  }
}


x86 assembly (clang, -O0):
<handle_new_connection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1203 <handle_new_connection+0x33>
mov    -0x4(%rbp),%edi
call   1070 <handle_new_connection@plt>
mov    $0x0,%al
call   10e0 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1221 <handle_new_connection+0x51>
mov    $0x4,%edi
call   1040 <_exit@plt>
cmpl   $0x0,-0x14(%rbp)
jne    14cb <handle_new_connection+0x2fb>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     149e <handle_new_connection+0x2ce>
movl   $0x0,-0x134(%rbp)
cmpl   $0xff,-0x134(%rbp)
jge    12a8 <handle_new_connection+0xd8>
movslq -0x134(%rbp),%rax
movb   $0x0,-0x130(%rbp,%rax,1)
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1275 <handle_new_connection+0xa5>
movl   $0x0,-0x138(%rbp)
movl   $0x1,-0x13c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
lea    -0x10(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   10c0 <select@plt>
mov    -0x10(%rbp),%edi
lea    -0x13d(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %rax,-0x148(%rbp)
cmpq   $0x0,-0x148(%rbp)
jle    1389 <handle_new_connection+0x1b9>
mov    -0x13d(%rbp),%cl
movslq -0x138(%rbp),%rax
mov    %cl,-0x130(%rbp,%rax,1)
movslq -0x138(%rbp),%rax
movsbl -0x130(%rbp,%rax,1),%eax
ff
cmp    $0x2e,%eax
jne    1375 <handle_new_connection+0x1a5>
mov    -0x138(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x138(%rbp)
movslq -0x138(%rbp),%rax
movb   $0x0,-0x130(%rbp,%rax,1)
movl   $0x0,-0x13c(%rbp)
mov    -0x138(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x138(%rbp)
jmp    13d0 <handle_new_connection+0x200>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
sub    -0x20(%rbp),%eax
cmp    $0xf,%eax
jle    13c6 <handle_new_connection+0x1f6>
movl   $0x0,-0x13c(%rbp)
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    $0x7a120,%edi
call   10f0 <usleep@plt>
jmp    13d5 <handle_new_connection+0x205>
cmpl   $0x0,-0x13c(%rbp)
jne    12f6 <handle_new_connection+0x126>
cmpl   $0x0,-0x138(%rbp)
jle    1419 <handle_new_connection+0x249>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
lea    -0x130(%rbp),%rdx
lea    0xc59(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x20(%rbp)
mov    $0x1f4,%edi
call   10f0 <usleep@plt>
cmpl   $0x0,-0x24(%rbp)
je     1499 <handle_new_connection+0x2c9>
cmpl   $0x0,-0x138(%rbp)
jle    1499 <handle_new_connection+0x2c9>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
mov    -0x10(%rbp),%edx
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xc44(%rip),%rax
mov    %rax,-0x150(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x15c(%rbp)
mov    -0x150(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0x150(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x15c(%rbp),%edi
mov    -0x158(%rbp),%rsi
mov    %eax,%edx
call   1050 <write@plt>
jmp    1261 <handle_new_connection+0x91>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%edi
call   10a0 <close@plt>
mov    0x2b1c(%rip),%rax
mov    (%rax),%edi
call   1040 <_exit@plt>
mov    -0x4(%rbp),%edi
call   1070 <handle_new_connection@plt>
jmp    14d8 <handle_new_connection+0x308>
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_new_connection>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   10d0 <accept@plt>
mov    %eax,0x4(%rsp)
test   %eax,%eax
jns    1201 <handle_new_connection+0x31>
mov    %ebx,%edi
call   1070 <handle_new_connection@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
je     122e <handle_new_connection+0x5e>
cmp    $0xffffffff,%eax
je     1474 <handle_new_connection+0x2a4>
mov    %ebx,%edi
call   1070 <handle_new_connection@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xdc4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %edi,%edi
call   10b0 <time@plt>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%r12d
lea    0x3(%rsp),%r13
lea    0xdd9(%rip),%r14
jmp    1283 <handle_new_connection+0xb3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1f4,%edi
call   10f0 <usleep@plt>
test   %r15d,%r15d
je     1446 <handle_new_connection+0x276>
xorps  %xmm0,%xmm0
movups %xmm0,0xff(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
xor    %edi,%edi
call   10b0 <time@plt>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xd1e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%edi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10c0 <select@plt>
mov    $0x1,%r15d
xor    %ebp,%ebp
jmp    133b <handle_new_connection+0x16b>
nop
add    $0x1,%ebp
test   %ebx,%ebx
je     13be <handle_new_connection+0x1ee>
mov    0x4(%rsp),%edi
mov    %r13,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
jle    1380 <handle_new_connection+0x1b0>
movzbl 0x3(%rsp),%ecx
movslq %ebp,%rax
mov    %cl,0x10(%rsp,%rax,1)
mov    $0x1,%ebx
cmp    $0x2e,%cl
jne    1330 <handle_new_connection+0x160>
movb   $0x0,0x11(%rsp,%rax,1)
add    $0x1,%rax
xor    %ebx,%ebx
mov    %eax,%ebp
jmp    1330 <handle_new_connection+0x160>
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   10b0 <time@plt>
sub    %r12d,%eax
mov    $0x1,%ebx
cmp    $0x10,%eax
jl     13ac <handle_new_connection+0x1dc>
xor    %r15d,%r15d
xor    %eax,%eax
call   1060 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %ebx,%ebx
mov    $0x7a120,%edi
call   10f0 <usleep@plt>
test   %ebx,%ebx
jne    133b <handle_new_connection+0x16b>
test   %ebp,%ebp
jle    1270 <handle_new_connection+0xa0>
mov    %r14,%rbp
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xc88(%rip),%rdi
mov    %eax,%esi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1090 <printf@plt>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%r12d
mov    $0x1f4,%edi
call   10f0 <usleep@plt>
test   %r15d,%r15d
je     1446 <handle_new_connection+0x276>
xor    %eax,%eax
call   1060 <getpid@plt>
mov    0x4(%rsp),%edx
lea    0xc69(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x4(%rsp),%r14d
lea    0xc7a(%rip),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <write@plt>
mov    %rbp,%r14
test   %r15d,%r15d
jne    1283 <handle_new_connection+0xb3>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xc72(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x4(%rsp),%edi
call   10a0 <close@plt>
mov    0x2b73(%rip),%rax
mov    (%rax),%edi
call   1040 <_exit@plt>
mov    $0x4,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [36 x i8] c"Hello from the child process (%d)!\0A\00"
@.str.1 = [23 x i8] c"%d: Waiting a message\0A\00"
@.str.2 = [36 x i8] c"%d: Client has closed connection !\0A\00"
@.str.3 = [26 x i8] c"%d: Recieve message : %s\0A\00"
@.str.4 = [38 x i8] c"%d: Respond on socket descriptor %d.\0A\00"
@.str.5 = [39 x i8] c"Welcome to you, but I can't talk more.\00"
@.str.6 = [21 x i8] c"End of world for %d\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handle_new_connection(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [255 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
%16 = alloca i64
%17 = alloca i8*
store i32 %0, i32* %2
%18 = load i32, i32* %2
%19 = call i32 @accept(i32 %18, %struct.sockaddr* %3, i32* %4)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %1
%23 = load i32, i32* %2
br label %24
24: ; preds = %22, %1
%25 = call i32 (...) @fork()
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @_exit(i32 4)
unreachable
30: ; preds = %24
%31 = load i32, i32* %6
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %128
33: ; preds = %30
%34 = call i32 (...) @getpid()
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = call i32 @time(i32* null)
store i32 %36, i32* %8
%37 = call i32 @time(i32* null)
store i32 %37, i32* %9
store i32 1, i32* %10
br label %38
38: ; preds = %120, %33
%39 = load i32, i32* %10
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %121
41: ; preds = %38
store i32 0, i32* %12
br label %42
42: ; preds = %49, %41
%43 = load i32, i32* %12
%44 = icmp slt i32 %43, 255
br i1 %44, label %45, label %52
45: ; preds = %42
%46 = load i32, i32* %12
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 %47
store i8 0, i8* %48
br label %49
49: ; preds = %45
%50 = load i32, i32* %12
%51 = add nsw i32 %50, 1
store i32 %51, i32* %12
br label %42
52: ; preds = %42
store i32 0, i32* %13
store i32 1, i32* %14
%53 = call i32 @time(i32* null)
store i32 %53, i32* %8
%54 = call i32 (...) @getpid()
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = call i32 @select(i32 1, i32* %5, i32 0, i32 0, i32 0)
br label %57
57: ; preds = %93, %52
%58 = load i32, i32* %5
%59 = call i64 @recv(i32 %58, i8* %15, i32 1, i32 0)
store i64 %59, i64* %16
%60 = load i64, i64* %16
%61 = icmp sgt i64 %60, 0
br i1 %61, label %62, label %82
62: ; preds = %57
%63 = load i8, i8* %15
%64 = load i32, i32* %13
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 %65
store i8 %63, i8* %66
%67 = load i32, i32* %13
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 46
br i1 %72, label %73, label %79
73: ; preds = %62
%74 = load i32, i32* %13
%75 = add nsw i32 %74, 1
store i32 %75, i32* %13
%76 = load i32, i32* %13
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 %77
store i8 0, i8* %78
store i32 0, i32* %14
br label %79
79: ; preds = %73, %62
%80 = load i32, i32* %13
%81 = add nsw i32 %80, 1
store i32 %81, i32* %13
br label %92
82: ; preds = %57
%83 = call i32 @time(i32* null)
%84 = load i32, i32* %9
%85 = sub nsw i32 %83, %84
%86 = icmp sgt i32 %85, 15
br i1 %86, label %87, label %90
87: ; preds = %82
store i32 0, i32* %14
%88 = call i32 (...) @getpid()
%89 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %88)
store i32 0, i32* %10
br label %90
90: ; preds = %87, %82
%91 = call i32 @usleep(i32 500000)
br label %92
92: ; preds = %90, %79
br label %93
93: ; preds = %92
%94 = load i32, i32* %14
%95 = icmp ne i32 %94, 0
br i1 %95, label %57, label %96
96: ; preds = %93
%97 = load i32, i32* %13
%98 = icmp sgt i32 %97, 0
br i1 %98, label %99, label %104
99: ; preds = %96
%100 = call i32 (...) @getpid()
%101 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%102 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %100, i8* %101)
%103 = call i32 @time(i32* null)
store i32 %103, i32* %9
br label %104
104: ; preds = %99, %96
%105 = call i32 @usleep(i32 500)
%106 = load i32, i32* %10
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %120
108: ; preds = %104
%109 = load i32, i32* %13
%110 = icmp sgt i32 %109, 0
br i1 %110, label %111, label %120
111: ; preds = %108
%112 = call i32 (...) @getpid()
%113 = load i32, i32* %5
%114 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %112, i32 %113)
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8** %17
%115 = load i32, i32* %5
%116 = load i8*, i8** %17
%117 = load i8*, i8** %17
%118 = call i32 @strlen(i8* %117)
%119 = call i32 @write(i32 %115, i8* %116, i32 %118)
br label %120
120: ; preds = %111, %108, %104
br label %38
121: ; preds = %38
%122 = call i32 (...) @getpid()
%123 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %122)
%124 = load i32, i32* %5
%125 = call i32 @close(i32 %124)
%126 = load i32, i32* @EXIT_SUCCESS
%127 = call i32 @_exit(i32 %126)
unreachable
128: ; preds = %30
%129 = load i32, i32* %2
br label %130
130: ; preds = %128
br label %131
131: ; preds = %130
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [36 x i8] c"Hello from the child process (%d)!\0A\00"
@.str.1 = [23 x i8] c"%d: Waiting a message\0A\00"
@.str.2 = [36 x i8] c"%d: Client has closed connection !\0A\00"
@.str.3 = [26 x i8] c"%d: Recieve message : %s\0A\00"
@.str.4 = [38 x i8] c"%d: Respond on socket descriptor %d.\0A\00"
@.str.5 = [39 x i8] c"Welcome to you, but I can't talk more.\00"
@.str.6 = [21 x i8] c"End of world for %d\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handle_new_connection(i32 %0) {
%2 = alloca %struct.sockaddr
%3 = alloca i32
%4 = alloca i32
%5 = alloca [255 x i8]
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%7 = alloca i8
%8 = bitcast %struct.sockaddr* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = call i32 @accept(i32 %0, %struct.sockaddr* %2, i32* %3)
store i32 %11, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %1
br label %14
14: ; preds = %13, %1
%15 = call i32 (...) @fork()
switch i32 %15, label %93 [
i32 -1, label %16
i32 0, label %18
]
16: ; preds = %14
%17 = call i32 @_exit(i32 4)
unreachable
18: ; preds = %14
%19 = call i32 (...) @getpid()
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i32 @time(i32* null)
%22 = call i32 @time(i32* null)
%23 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
br label %24
24: ; preds = %18, %83
%25 = phi i32 [ %22, %18 ], [ %84, %83 ]
%26 = call i32 @time(i32* null)
%27 = call i32 (...) @getpid()
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = call i32 @select(i32 1, i32* %4, i32 0, i32 0, i32 0)
br label %30
30: ; preds = %60, %24
%31 = phi i32 [ 1, %24 ], [ %61, %60 ]
%32 = phi i32 [ 0, %24 ], [ %62, %60 ]
%33 = load i32, i32* %4
%34 = call i64 @recv(i32 %33, i8* %7, i32 1, i32 0)
%35 = icmp sgt i64 %34, 0
br i1 %35, label %36, label %49
36: ; preds = %30
%37 = load i8, i8* %7
%38 = sext i32 %32 to i64
%39 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 %38
store i8 %37, i8* %39
%40 = icmp eq i8 %37, 46
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = add nsw i32 %32, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 %43
store i8 0, i8* %44
br label %45
45: ; preds = %41, %36
%46 = phi i32 [ %42, %41 ], [ %32, %36 ]
%47 = phi i32 [ 0, %41 ], [ 1, %36 ]
%48 = add nsw i32 %46, 1
br label %60
49: ; preds = %30
%50 = call i32 @time(i32* null)
%51 = sub nsw i32 %50, %25
%52 = icmp sgt i32 %51, 15
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = call i32 (...) @getpid()
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %53, %49
%57 = phi i32 [ 0, %53 ], [ %31, %49 ]
%58 = phi i32 [ 0, %53 ], [ 1, %49 ]
%59 = call i32 @usleep(i32 500000)
br label %60
60: ; preds = %56, %45
%61 = phi i32 [ %31, %45 ], [ %57, %56 ]
%62 = phi i32 [ %48, %45 ], [ %32, %56 ]
%63 = phi i32 [ %47, %45 ], [ %58, %56 ]
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %30
65: ; preds = %60
%66 = icmp sgt i32 %62, 0
br i1 %66, label %69, label %67
67: ; preds = %65
%68 = call i32 @usleep(i32 500)
br label %83
69: ; preds = %65
%70 = call i32 (...) @getpid()
%71 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %70, i8* %23)
%72 = call i32 @time(i32* null)
%73 = call i32 @usleep(i32 500)
%74 = icmp eq i32 %61, 0
br i1 %74, label %75, label %76
75: ; preds = %69
br label %86
76: ; preds = %69
%77 = call i32 (...) @getpid()
%78 = load i32, i32* %4
%79 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %77, i32 %78)
%80 = load i32, i32* %4
%81 = call i32 @strlen(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%82 = call i32 @write(i32 %80, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %81)
br label %83
83: ; preds = %67, %76
%84 = phi i32 [ %25, %67 ], [ %72, %76 ]
%85 = icmp eq i32 %61, 0
br i1 %85, label %86, label %24
86: ; preds = %83, %75
%87 = call i32 (...) @getpid()
%88 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %4
%90 = call i32 @close(i32 %89)
%91 = load i32, i32* @EXIT_SUCCESS
%92 = call i32 @_exit(i32 %91)
unreachable
93: ; preds = %14
ret void
}