#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 /*<<< orphan*/ boithoa_getLdapResponsList(int, char ***, int *);
int cconnect(char *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ sendpacked(int, int, int, int /*<<< orphan*/,
                              int /*<<< orphan*/ *, char *);
int boithoad_listUsers(char **respons_list[], int *nrofresponses) {
  int socketha;
  *nrofresponses = 0;
  if ((socketha = cconnect("localhost", 3491)) == 0) {
    return 0;
  }
  sendpacked(socketha, 10, 1, 0, NULL, "");
  if (!boithoa_getLdapResponsList(socketha, respons_list, nrofresponses)) {
    return 0;
  }
  close(socketha);
  return 1;
}


x86 assembly (clang, -O0):
<boithoad_listUsers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
lea    0xe9f(%rip),%rdi
mov    $0xda3,%esi
call   1060 <cconnect@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jne    1183 <boithoad_listUsers+0x43>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <boithoad_listUsers+0x97>
mov    -0x1c(%rbp),%edi
mov    $0xa,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
lea    0xe6b(%rip),%r9
call   1050 <sendpacked@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <boithoa_getLdapResponsList@plt>
cmp    $0x0,%eax
jne    11c8 <boithoad_listUsers+0x88>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <boithoad_listUsers+0x97>
mov    -0x1c(%rbp),%edi
call   1030 <close@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boithoad_listUsers>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movl   $0x0,(%rsi)
lea    0xea6(%rip),%rdi
mov    $0xda3,%esi
call   1060 <cconnect@plt>
test   %eax,%eax
je     11aa <boithoad_listUsers+0x6a>
mov    %eax,%ebp
lea    0xe98(%rip),%r9
xor    %r15d,%r15d
mov    %eax,%edi
mov    $0xa,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <sendpacked@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <boithoa_getLdapResponsList@plt>
test   %eax,%eax
je     11ad <boithoad_listUsers+0x6d>
mov    %ebp,%edi
call   1030 <close@plt>
mov    $0x1,%r15d
jmp    11ad <boithoad_listUsers+0x6d>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @boithoad_listUsers(i8*** %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8***
%5 = alloca i32*
%6 = alloca i32
store i8*** %0, i8**** %4
store i32* %1, i32** %5
%7 = load i32*, i32** %5
store i32 0, i32* %7
%8 = call i32 @cconnect(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3491)
store i32 %8, i32* %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %23
11: ; preds = %2
%12 = load i32, i32* %6
%13 = call i32 @sendpacked(i32 %12, i32 10, i32 1, i32 0, i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %6
%15 = load i8***, i8**** %4
%16 = load i32*, i32** %5
%17 = call i32 @boithoa_getLdapResponsList(i32 %14, i8*** %15, i32* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %11
store i32 0, i32* %3
br label %23
20: ; preds = %11
%21 = load i32, i32* %6
%22 = call i32 @close(i32 %21)
store i32 1, i32* %3
br label %23
23: ; preds = %20, %19, %10
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @boithoad_listUsers(i8*** %0, i32* %1) {
store i32 0, i32* %1
%3 = tail call i32 @cconnect(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3491)
%4 = icmp eq i32 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @sendpacked(i32 %3, i32 10, i32 1, i32 0, i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @boithoa_getLdapResponsList(i32 %3, i8*** %0, i32* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @close(i32 %3)
br label %11
11: ; preds = %5, %2, %9
%12 = phi i32 [ 1, %9 ], [ 0, %2 ], [ 0, %5 ]
ret i32 %12
}