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

/* Variables and functions */
int acceptConnection(int);
int /*<<< orphan*/ close(int);
int handleConnection(char *, int, int, int);
int listenForClient(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void loopOverClients(int lis, int rcv) {
  int done = 0;
  int acpt;
  char buf[32768];
  while (!done) {
    rcv = listenForClient(lis);
    acpt = acceptConnection(lis);
    done = handleConnection(buf, acpt, lis, rcv);
    memset(buf, 0, 32768);
  }
  close(acpt);
}


x86 assembly (clang, -O0):
<loopOverClients>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8010,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    117e <loopOverClients+0x2e>
jmp    11c4 <loopOverClients+0x74>
mov    -0x4(%rbp),%edi
call   1030 <listenForClient@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <acceptConnection@plt>
mov    %eax,-0x10(%rbp)
lea    -0x8010(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1060 <handleConnection@plt>
mov    %eax,-0xc(%rbp)
lea    -0x8010(%rbp),%rdi
xor    %esi,%esi
mov    $0x8000,%edx
call   1050 <memset@plt>
jmp    1168 <loopOverClients+0x18>
mov    -0x10(%rbp),%edi
call   1070 <close@plt>
add    $0x8010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loopOverClients>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x8008,%rsp
mov    %edi,%r15d
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15d,%edi
call   1030 <listenForClient@plt>
mov    %eax,%ebx
mov    %r15d,%edi
call   1040 <acceptConnection@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %eax,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
call   1060 <handleConnection@plt>
mov    %eax,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x8000,%edx
call   1050 <memset@plt>
test   %ebx,%ebx
je     1170 <loopOverClients+0x20>
mov    %ebp,%edi
call   1070 <close@plt>
add    $0x8008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @loopOverClients(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [32768 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %12, %2
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 @listenForClient(i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = call i32 @acceptConnection(i32 %15)
store i32 %16, i32* %6
%17 = getelementptr inbounds [32768 x i8], [32768 x i8]* %7, i64 0, i64 0
%18 = load i32, i32* %6
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @handleConnection(i8* %17, i32 %18, i32 %19, i32 %20)
store i32 %21, i32* %5
%22 = getelementptr inbounds [32768 x i8], [32768 x i8]* %7, i64 0, i64 0
%23 = call i32 @memset(i8* %22, i32 0, i32 32768)
br label %8
24: ; preds = %8
%25 = load i32, i32* %6
%26 = call i32 @close(i32 %25)
ret void
}

LLVM IR (-O2):
define void @loopOverClients(i32 %0, i32 %1) {
%3 = alloca [32768 x i8]
%4 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %2, %5
%6 = call i32 @listenForClient(i32 %0)
%7 = call i32 @acceptConnection(i32 %0)
%8 = call i32 @handleConnection(i8* %4, i32 %7, i32 %0, i32 %6)
%9 = call i32 @memset(i8* %4, i32 0, i32 32768)
%10 = icmp eq i32 %8, 0
br i1 %10, label %5, label %11
11: ; preds = %5
%12 = call i32 @close(i32 %7)
ret void
}