#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 loadIndexInGPUMemory();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int sendInteger(int, int);
void onIndexLoadRequest(int socketfd) {
  printf("Connection handler - Load Index Request\n");
  int result = loadIndexInGPUMemory();
  if (result == 1) {
    result = 1;
  } else {
    result = -1;
  }
  if (sendInteger(socketfd, result) == -1)
    perror("send indexing result status");
}


x86 assembly (clang, -O0):
<onIndexLoadRequest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <loadIndexInGPUMemory@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1177 <onIndexLoadRequest+0x37>
movl   $0x1,-0x8(%rbp)
jmp    117e <onIndexLoadRequest+0x3e>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <sendInteger@plt>
cmp    $0xffffffff,%eax
jne    119e <onIndexLoadRequest+0x5e>
lea    0xe90(%rip),%rdi
call   1060 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<onIndexLoadRequest>:
push   %rbx
mov    %edi,%ebx
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <loadIndexInGPUMemory@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,1),%esi
add    $0xffffffff,%esi
mov    %ebx,%edi
call   1040 <sendInteger@plt>
cmp    $0xffffffff,%eax
je     1172 <onIndexLoadRequest+0x32>
pop    %rbx
ret
lea    0xe87(%rip),%rdi
pop    %rbx
jmp    1060 <perror@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Connection handler - Load Index Request\0A\00"
@.str.1 = [28 x i8] c"send indexing result status\00"
define void @onIndexLoadRequest(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @loadIndexInGPUMemory()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %3
br label %10
9: ; preds = %1
store i32 -1, i32* %3
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @sendInteger(i32 %11, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"send indexing result status\00"
@str = [40 x i8] c"Connection handler - Load Index Request\00"
define void @onIndexLoadRequest(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @loadIndexInGPUMemory()
%4 = icmp eq i32 %3, 1
%5 = select i1 %4, i32 1, i32 -1
%6 = tail call i32 @sendInteger(i32 %0, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
ret void
}