#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 */
struct thread_pass {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
scalar_t__ thread_pass_get(struct thread_pass *);
int /*<<< orphan*/ thread_pass_return(struct thread_pass *);
void *client(void *arg) {
  struct thread_pass *p = ((void **)arg)[0];
  int var2 = *((int *)((void **)arg)[1]);
  *(int *)thread_pass_get(p) = var2;
  thread_pass_return(p);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <thread_pass_get@plt>
mov    -0x20(%rbp),%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <thread_pass_return@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%rbx
mov    0x8(%rdi),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
call   1050 <thread_pass_get@plt>
mov    %ebp,(%rax)
mov    %rbx,%rdi
call   1030 <thread_pass_return@plt>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
%struct.thread_pass = type { i32 }
define i8* @client(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca %struct.thread_pass*
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = bitcast i8* %9 to %struct.thread_pass*
store %struct.thread_pass* %10, %struct.thread_pass** %4
%11 = load i8*, i8** %3
%12 = bitcast i8* %11 to i8**
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = load %struct.thread_pass*, %struct.thread_pass** %4
%19 = call i64 @thread_pass_get(%struct.thread_pass* %18)
%20 = inttoptr i64 %19 to i32*
store i32 %17, i32* %20
%21 = load %struct.thread_pass*, %struct.thread_pass** %4
%22 = call i32 @thread_pass_return(%struct.thread_pass* %21)
%23 = call i32 @pthread_exit(i32* null)
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
%struct.thread_pass = type { i32 }
define noalias i8* @client(i8* nocapture %0) {
%2 = bitcast i8* %0 to %struct.thread_pass**
%3 = load %struct.thread_pass*, %struct.thread_pass** %2
%4 = getelementptr inbounds i8, i8* %0, i64 8
%5 = bitcast i8* %4 to i32**
%6 = load i32*, i32** %5
%7 = load i32, i32* %6
%8 = tail call i64 @thread_pass_get(%struct.thread_pass* %3)
%9 = inttoptr i64 %8 to i32*
store i32 %7, i32* %9
%10 = tail call i32 @thread_pass_return(%struct.thread_pass* %3)
%11 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}