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


x86 assembly (clang, -O0):
<boithoad_listMailUsers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xea9(%rip),%rdi
mov    $0xda3,%esi
call   1060 <cconnect@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jne    1179 <boithoad_listMailUsers+0x39>
movl   $0x0,-0x4(%rbp)
jmp    11cd <boithoad_listMailUsers+0x8d>
mov    -0x1c(%rbp),%edi
mov    $0xc,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
lea    0xe75(%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    11be <boithoad_listMailUsers+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11cd <boithoad_listMailUsers+0x8d>
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_listMailUsers>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xeab(%rip),%rdi
mov    $0xda3,%esi
call   1060 <cconnect@plt>
test   %eax,%eax
je     11a5 <boithoad_listMailUsers+0x65>
mov    %eax,%ebx
lea    0xe9d(%rip),%r9
xor    %r12d,%r12d
mov    %eax,%edi
mov    $0xc,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <sendpacked@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <boithoa_getLdapResponsList@plt>
test   %eax,%eax
je     11a8 <boithoad_listMailUsers+0x68>
mov    %ebx,%edi
call   1030 <close@plt>
mov    $0x1,%r12d
jmp    11a8 <boithoad_listMailUsers+0x68>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @boithoad_listMailUsers(i8*** %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 12, 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
}