#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 long pthread_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long, ...);
int /*<<< orphan*/ pthread_equal(long, long);
int /*<<< orphan*/ pthread_self();
int main(int argc, char *argv[]) {
  pthread_t tid1 = 1L;
  pthread_t tid2 = 2L;
  printf("%lu == %lu is %d\n", tid1, tid2, pthread_equal(tid1, tid2));
  printf("%lu == %lu is %d\n", 1L, 1L, pthread_equal(1L, 1L));
  printf("pthread_id = %lu\n", pthread_self());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x2,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <pthread_equal@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%esi
mov    %rsi,%rdi
call   1040 <pthread_equal@plt>
mov    %eax,%ecx
lea    0xe5f(%rip),%rdi
mov    $0x1,%edx
mov    %rdx,%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <pthread_self@plt>
movslq %eax,%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <pthread_equal@plt>
lea    0xeb9(%rip),%rbx
mov    $0x1,%esi
mov    $0x2,%edx
mov    %rbx,%rdi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <pthread_equal@plt>
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <pthread_self@plt>
movslq %eax,%rsi
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%lu == %lu is %d\0A\00"
@.str.1 = [18 x i8] c"pthread_id = %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 1, i64* %6
store i64 2, i64* %7
%8 = load i64, i64* %6
%9 = load i64, i64* %7
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = call i32 @pthread_equal(i64 %10, i64 %11)
%13 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %9, i32 %12)
%14 = call i32 @pthread_equal(i64 1, i64 1)
%15 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 1, i64 1, i32 %14)
%16 = call i32 (...) @pthread_self()
%17 = sext i32 %16 to i64
%18 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"%lu == %lu is %d\0A\00"
@.str.1 = [18 x i8] c"pthread_id = %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @pthread_equal(i64 1, i64 2)
%4 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 1, i64 2, i32 %3)
%5 = tail call i32 @pthread_equal(i64 1, i64 1)
%6 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 1, i64 1, i32 %5)
%7 = tail call i32 (...) @pthread_self()
%8 = sext i32 %7 to i64
%9 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 %8)
ret i32 0
}