#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 sockaddr_storage {
  scalar_t__ ss_family;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in6 {
  TYPE_1__ sin6_addr;
  int /*<<< orphan*/ sin6_port;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  scalar_t__ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ cli_addr;

/* Variables and functions */
scalar_t__ AF_INET;
scalar_t__ AF_INET6;
int EXIT_SUCCESS;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ http_handle_client(int, char *, int);
int /*<<< orphan*/ inet_ntop(scalar_t__, TYPE_1__ *, char *, int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int ntohs(int /*<<< orphan*/);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  int sockfd, newsockfd, portno, clilen;
  struct sockaddr_in serv_addr;
  struct sockaddr_storage cli_addr;
  int optval = 1;
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd < 0) {
    error("ERROR opening socket");
  }
  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int)) ==
      -1) {
    error("ERROR rebinding address");
  }
  memset((char *)&serv_addr, 0, sizeof(serv_addr));
  portno = 4000;
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_addr.s_addr = INADDR_ANY;
  serv_addr.sin_port = htons(portno);
  if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
    error("ERROR on binding");
  }
  listen(sockfd, 5);
  clilen = sizeof(cli_addr);
  while (1) {
    newsockfd =
        accept(sockfd, (struct sockaddr *)&cli_addr, (socklen_t *)&clilen);
    if (newsockfd < 0) {
      error("ERROR on accept");
    }
    int pid = fork();
    if (pid < 0) {
      error("ERROR on fork");
    } else if (pid == 0) {
      close(sockfd);
      char ipstr[INET6_ADDRSTRLEN + 1];
      int cli_port;
      if (cli_addr.ss_family == AF_INET) {
        struct sockaddr_in *s = (struct sockaddr_in *)&cli_addr;
        cli_port = ntohs(s->sin_port);
        inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr);
      } else {
        struct sockaddr_in6 *s = (struct sockaddr_in6 *)&cli_addr;
        cli_port = ntohs(s->sin6_port);
        inet_ntop(AF_INET6, &s->sin6_addr, ipstr, sizeof ipstr);
      }
      http_handle_client(newsockfd, ipstr, cli_port);
      exit(EXIT_SUCCESS);
    } else {
      close(newsockfd);
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
mov    0x2ddb(%rip),%rax
mov    (%rax),%rdi
mov    0x2db1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1229 <main+0x49>
lea    0xddc(%rip),%rdi
call   10b0 <error@plt>
mov    -0x8(%rbp),%edi
mov    0x2db5(%rip),%rax
mov    (%rax),%esi
mov    0x2d6c(%rip),%rax
mov    (%rax),%edx
lea    -0x34(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1262 <main+0x82>
lea    0xdb8(%rip),%rdi
call   10b0 <error@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movl   $0xfa0,-0x10(%rbp)
mov    0x2d58(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2d42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jge    12c5 <main+0xe5>
lea    0xd6d(%rip),%rdi
call   10b0 <error@plt>
mov    -0x8(%rbp),%edi
mov    $0x5,%esi
call   1080 <listen@plt>
movl   $0x8,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1302 <main+0x122>
lea    0xd41(%rip),%rdi
call   10b0 <error@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jge    1327 <main+0x147>
lea    0xd31(%rip),%rdi
call   10b0 <error@plt>
jmp    141b <main+0x23b>
cmpl   $0x0,-0x38(%rbp)
jne    140e <main+0x22e>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
mov    0x2ca0(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rax,-0x70(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    0x2c61(%rip),%rcx
cmp    (%rcx),%rax
jne    13bb <main+0x1db>
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    0x4(%rax),%edi
call   1090 <ntohs@plt>
mov    -0x68(%rbp),%rdx
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
mov    %ecx,-0x4c(%rbp)
mov    0x2c30(%rip),%rcx
mov    (%rcx),%rdi
mov    -0x58(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
jmp    13f1 <main+0x211>
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    0x4(%rax),%edi
call   1090 <ntohs@plt>
mov    -0x68(%rbp),%rdx
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
mov    %ecx,-0x4c(%rbp)
mov    0x2be5(%rip),%rcx
mov    (%rcx),%rdi
mov    -0x60(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x68(%rbp),%rsi
mov    -0xc(%rbp),%edi
mov    -0x4c(%rbp),%edx
call   10c0 <http_handle_client@plt>
mov    0x2ba9(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
jmp    141b <main+0x23b>
jmp    12d9 <main+0xf9>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x1,-0x2c(%rbp)
mov    0x2dd9(%rip),%r15
mov    (%r15),%rdi
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,%r14d
test   %eax,%eax
jns    1225 <main+0x45>
lea    0xde0(%rip),%rdi
call   10b0 <error@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%esi
mov    0x2d73(%rip),%rax
mov    (%rax),%edx
lea    -0x2c(%rbp),%rcx
mov    %r14d,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    125a <main+0x7a>
lea    0xdc0(%rip),%rdi
call   10b0 <error@plt>
lea    -0x48(%rbp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    (%r15),%rax
mov    %rax,-0x40(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    $0xfa0,%edi
call   1050 <htons@plt>
mov    %eax,-0x44(%rbp)
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   10a0 <bind@plt>
test   %rax,%rax
jns    12ae <main+0xce>
lea    0xd84(%rip),%rdi
call   10b0 <error@plt>
mov    %r14d,%edi
mov    $0x5,%esi
call   1080 <listen@plt>
movl   $0x8,-0x30(%rbp)
lea    -0x38(%rbp),%r15
lea    -0x30(%rbp),%r12
lea    0xd7d(%rip),%r13
jmp    12e8 <main+0x108>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
call   10b0 <error@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   10d0 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1308 <main+0x128>
lea    0xd3b(%rip),%rdi
call   10b0 <error@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
js     12e0 <main+0x100>
je     131e <main+0x13e>
mov    %ebx,%edi
call   1070 <close@plt>
jmp    12e8 <main+0x108>
mov    %r14d,%edi
call   1070 <close@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%r14d
add    $0x1,%r14d
mov    %rsp,%r15
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    -0x38(%rbp),%rax
mov    %rax,%rdi
shr    $0x20,%rdi
mov    0x2c81(%rip),%r13
cmp    0x0(%r13),%rax
je     1364 <main+0x184>
mov    0x2c64(%rip),%r13
call   1090 <ntohs@plt>
mov    %eax,%r12d
mov    0x0(%r13),%rdi
lea    -0x38(%rbp),%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <inet_ntop@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r12d,%edx
call   10c0 <http_handle_client@plt>
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i64 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_storage = type { i64 }
%struct.sockaddr_in6 = type { %struct.TYPE_2__, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i64 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"ERROR opening socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [24 x i8] c"ERROR rebinding address\00"
@INADDR_ANY = global i32 0
@.str.2 = [17 x i8] c"ERROR on binding\00"
@.str.3 = [16 x i8] c"ERROR on accept\00"
@.str.4 = [14 x i8] c"ERROR on fork\00"
@INET6_ADDRSTRLEN = global i32 0
@AF_INET6 = global i64 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_storage
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca %struct.sockaddr_in*
%14 = alloca %struct.sockaddr_in6*
store i32 0, i32* %1
store i32 1, i32* %8
%15 = load i64, i64* @AF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = call i32 @socket(i64 %15, i32 %16, i32 0)
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %0
%23 = load i32, i32* %2
%24 = load i32, i32* @SOL_SOCKET
%25 = load i32, i32* @SO_REUSEADDR
%26 = call i32 @setsockopt(i32 %23, i32 %24, i32 %25, i32* %8, i32 4)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %22
%31 = bitcast %struct.sockaddr_in* %6 to i8*
%32 = call i32 @memset(i8* %31, i32 0, i32 16)
store i32 4000, i32* %4
%33 = load i64, i64* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i64 %33, i64* %34
%35 = load i32, i32* @INADDR_ANY
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%37 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %36, i32 0, i32 0
store i32 %35, i32* %37
%38 = load i32, i32* %4
%39 = call i32 @htons(i32 %38)
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i32 %39, i32* %40
%41 = load i32, i32* %2
%42 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%43 = call i64 @bind(i32 %41, %struct.sockaddr* %42, i32 16)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %30
%46 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %30
%48 = load i32, i32* %2
%49 = call i32 @listen(i32 %48, i32 5)
store i32 8, i32* %5
br label %50
50: ; preds = %47, %111
%51 = load i32, i32* %2
%52 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr*
%53 = call i32 @accept(i32 %51, %struct.sockaddr* %52, i32* %5)
store i32 %53, i32* %3
%54 = load i32, i32* %3
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %50
%57 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %58
58: ; preds = %56, %50
%59 = call i32 (...) @fork()
store i32 %59, i32* %9
%60 = load i32, i32* %9
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %111
64: ; preds = %58
%65 = load i32, i32* %9
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %107
67: ; preds = %64
%68 = load i32, i32* %2
%69 = call i32 @close(i32 %68)
%70 = load i32, i32* @INET6_ADDRSTRLEN
%71 = add nsw i32 %70, 1
%72 = zext i32 %71 to i64
%73 = call i8* @llvm.stacksave()
store i8* %73, i8** %10
%74 = alloca i8, i64 %72
store i64 %72, i64* %11
%75 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %7, i32 0, i32 0
%76 = load i64, i64* %75
%77 = load i64, i64* @AF_INET
%78 = icmp eq i64 %76, %77
br i1 %78, label %79, label %90
79: ; preds = %67
%80 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr_in*
store %struct.sockaddr_in* %80, %struct.sockaddr_in** %13
%81 = load %struct.sockaddr_in*, %struct.sockaddr_in** %13
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %81, i32 0, i32 1
%83 = load i32, i32* %82
%84 = call i32 @ntohs(i32 %83)
store i32 %84, i32* %12
%85 = load i64, i64* @AF_INET
%86 = load %struct.sockaddr_in*, %struct.sockaddr_in** %13
%87 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %86, i32 0, i32 0
%88 = trunc i64 %72 to i32
%89 = call i32 @inet_ntop(i64 %85, %struct.TYPE_2__* %87, i8* %74, i32 %88)
br label %101
90: ; preds = %67
%91 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr_in6*
store %struct.sockaddr_in6* %91, %struct.sockaddr_in6** %14
%92 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %14
%93 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %92, i32 0, i32 1
%94 = load i32, i32* %93
%95 = call i32 @ntohs(i32 %94)
store i32 %95, i32* %12
%96 = load i64, i64* @AF_INET6
%97 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %14
%98 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %97, i32 0, i32 0
%99 = trunc i64 %72 to i32
%100 = call i32 @inet_ntop(i64 %96, %struct.TYPE_2__* %98, i8* %74, i32 %99)
br label %101
101: ; preds = %90, %79
%102 = load i32, i32* %3
%103 = load i32, i32* %12
%104 = call i32 @http_handle_client(i32 %102, i8* %74, i32 %103)
%105 = load i32, i32* @EXIT_SUCCESS
%106 = call i32 @exit(i32 %105)
unreachable
107: ; preds = %64
%108 = load i32, i32* %3
%109 = call i32 @close(i32 %108)
br label %110
110: ; preds = %107
br label %111
111: ; preds = %110, %62
br label %50
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i64 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_storage = type { i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i64 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"ERROR opening socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [24 x i8] c"ERROR rebinding address\00"
@INADDR_ANY = global i32 0
@.str.2 = [17 x i8] c"ERROR on binding\00"
@.str.3 = [16 x i8] c"ERROR on accept\00"
@.str.4 = [14 x i8] c"ERROR on fork\00"
@INET6_ADDRSTRLEN = global i32 0
@AF_INET6 = global i64 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.sockaddr_storage
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast %struct.sockaddr_in* %2 to i8*
%7 = bitcast %struct.sockaddr_storage* %3 to i8*
%8 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%9 = load i64, i64* @AF_INET
%10 = load i32, i32* @SOCK_STREAM
%11 = tail call i32 @socket(i64 %9, i32 %10, i32 0)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %0
%16 = load i32, i32* @SOL_SOCKET
%17 = load i32, i32* @SO_REUSEADDR
%18 = call i32 @setsockopt(i32 %11, i32 %16, i32 %17, i32* %4, i32 4)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
%23 = call i32 @memset(i8* %6, i32 0, i32 16)
%24 = load i64, i64* @AF_INET
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i64 %24, i64* %25
%26 = load i32, i32* @INADDR_ANY
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0, i32 0
store i32 %26, i32* %27
%28 = call i32 @htons(i32 4000)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
store i32 %28, i32* %29
%30 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%31 = call i64 @bind(i32 %11, %struct.sockaddr* %30, i32 16)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %22
%34 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %22
%36 = call i32 @listen(i32 %11, i32 5)
store i32 8, i32* %1
%37 = bitcast %struct.sockaddr_storage* %3 to %struct.sockaddr*
br label %38
38: ; preds = %73, %35
%39 = call i32 @accept(i32 %11, %struct.sockaddr* %37, i32* %1)
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
%44 = call i32 (...) @fork()
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %73
48: ; preds = %43
%49 = icmp eq i32 %44, 0
br i1 %49, label %50, label %71
50: ; preds = %48
%51 = call i32 @close(i32 %11)
%52 = load i32, i32* @INET6_ADDRSTRLEN
%53 = add nsw i32 %52, 1
%54 = zext i32 %53 to i64
%55 = alloca i8, i64 %54
%56 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %3, i64 0, i32 0
%57 = load i64, i64* %56
%58 = load i64, i64* @AF_INET
%59 = icmp eq i64 %57, %58
%60 = lshr i64 %57, 32
%61 = trunc i64 %60 to i32
%62 = call i32 @ntohs(i32 %61)
%63 = load i64, i64* @AF_INET
%64 = load i64, i64* @AF_INET6
%65 = select i1 %59, i64 %63, i64 %64
%66 = bitcast %struct.sockaddr_storage* %3 to %struct.TYPE_2__*
%67 = call i32 @inet_ntop(i64 %65, %struct.TYPE_2__* %66, i8* %55, i32 %53)
%68 = call i32 @http_handle_client(i32 %39, i8* %55, i32 %62)
%69 = load i32, i32* @EXIT_SUCCESS
%70 = call i32 @exit(i32 %69)
unreachable
71: ; preds = %48
%72 = call i32 @close(i32 %39)
br label %73
73: ; preds = %71, %46
br label %38
}