#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 */
typedef struct l_class_OC_Thread l_class_OC_Thread;

/* Variables and functions */
int /*<<< orphan*/ pthread_exit(unsigned char *);
unsigned char *_ZN6Thread8functionEPv(unsigned char *ptr) {
  void (**tmp__203)(struct l_class_OC_Thread *);
  void (*tmp__204)(struct l_class_OC_Thread *);
  if ((ptr == ((unsigned char *)0))) {
    goto tmp__205;
  } else {
    goto tmp__206;
  }
tmp__205:
  return ((unsigned char *)0);
tmp__206:
  tmp__203 = *(((void (***)(struct l_class_OC_Thread *))ptr));
  tmp__204 = *tmp__203;
  tmp__204((((struct l_class_OC_Thread *)ptr)));
  pthread_exit(ptr);
  ;
}


x86 assembly (clang, -O0):
<_ZN6Thread8functionEPv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    112c <_ZN6Thread8functionEPv+0x1c>
jmp    1131 <_ZN6Thread8functionEPv+0x21>
jmp    113e <_ZN6Thread8functionEPv+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    1167 <_ZN6Thread8functionEPv+0x57>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
mov    -0x10(%rbp),%rdi
call   1030 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ZN6Thread8functionEPv>:
test   %rdi,%rdi
je     1127 <_ZN6Thread8functionEPv+0x17>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
call   *(%rax)
mov    %rbx,%rdi
call   1030 <pthread_exit@plt>
pop    %rbx
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.l_class_OC_Thread = type opaque
define i8* @_ZN6Thread8functionEPv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca void (%struct.l_class_OC_Thread*)**
%5 = alloca void (%struct.l_class_OC_Thread*)*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
br label %10
9: ; preds = %1
br label %11
10: ; preds = %8
store i8* null, i8** %2
br label %22
11: ; preds = %9
%12 = load i8*, i8** %3
%13 = bitcast i8* %12 to void (%struct.l_class_OC_Thread*)***
%14 = load void (%struct.l_class_OC_Thread*)**, void (%struct.l_class_OC_Thread*)*** %13
store void (%struct.l_class_OC_Thread*)** %14, void (%struct.l_class_OC_Thread*)*** %4
%15 = load void (%struct.l_class_OC_Thread*)**, void (%struct.l_class_OC_Thread*)*** %4
%16 = load void (%struct.l_class_OC_Thread*)*, void (%struct.l_class_OC_Thread*)** %15
store void (%struct.l_class_OC_Thread*)* %16, void (%struct.l_class_OC_Thread*)** %5
%17 = load void (%struct.l_class_OC_Thread*)*, void (%struct.l_class_OC_Thread*)** %5
%18 = load i8*, i8** %3
%19 = bitcast i8* %18 to %struct.l_class_OC_Thread*
%20 = load i8*, i8** %3
%21 = call i32 @pthread_exit(i8* %20)
br label %22
22: ; preds = %11, %10
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
%struct.l_class_OC_Thread = type opaque
define i8* @_ZN6Thread8functionEPv(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = bitcast i8* %0 to void (%struct.l_class_OC_Thread*)***
%5 = load void (%struct.l_class_OC_Thread*)**, void (%struct.l_class_OC_Thread*)*** %4
%6 = load void (%struct.l_class_OC_Thread*)*, void (%struct.l_class_OC_Thread*)** %5
%7 = bitcast i8* %0 to %struct.l_class_OC_Thread*
tail call void %6(%struct.l_class_OC_Thread* %7)
%8 = tail call i32 @pthread_exit(i8* %0)
br label %9
9: ; preds = %1, %3
ret i8* null
}