void *remote_add(void *arguments) {
  int failure;
  int *result;
  int *args;
  args = (int *)arguments;
  failure = remote_service_client_init((unsigned int)args[0]);
  printf("failure? %i\n", failure);
  result = malloc(sizeof(int));
  *result = remote_service_add((unsigned int)args[0], args[1], args[2]);
  return result;
}


x86 assembly (clang, -O0):
<remote_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1040 <remote_service_client_init@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%edx
mov    $0x0,%al
call   1050 <remote_service_add@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remote_add>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%edi
xor    %eax,%eax
call   1040 <remote_service_client_init@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    (%rbx),%edi
mov    0x4(%rbx),%esi
mov    0x8(%rbx),%edx
xor    %eax,%eax
call   1050 <remote_service_add@plt>
mov    %eax,(%r14)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"failure? %i\0A\00"
define i8* @remote_add(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = call i32 (i32, ...) bitcast (i32 (...)* @remote_service_client_init to i32 (i32, ...)*)(i32 %10)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i8* @malloc(i64 4)
%15 = bitcast i8* %14 to i32*
store i32* %15, i32** %4
%16 = load i32*, i32** %5
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = load i32, i32* %17
%19 = load i32*, i32** %5
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = load i32, i32* %20
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i64 2
%24 = load i32, i32* %23
%25 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @remote_service_add to i32 (i32, i32, i32, ...)*)(i32 %18, i32 %21, i32 %24)
%26 = load i32*, i32** %4
store i32 %25, i32* %26
%27 = load i32*, i32** %4
%28 = bitcast i32* %27 to i8*
ret i8* %28
}

LLVM IR (-O2):
@.str = [13 x i8] c"failure? %i\0A\00"
define i8* @remote_add(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @remote_service_client_init to i32 (i32, ...)*)(i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %2
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = getelementptr inbounds i8, i8* %0, i64 8
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
%15 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @remote_service_add to i32 (i32, i32, i32, ...)*)(i32 %8, i32 %11, i32 %14)
store i32 %15, i32* %7
ret i8* %6
}