#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 /*<<< orphan*/ hash_delete(int);
int /*<<< orphan*/ hash_get(int);
int /*<<< orphan*/ hash_insert(int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *testLibrary(void *p) {
  int i;
  int num = (long)p;
  for (i = 0; i < 1000; ++i) {
    hash_insert(num * 1000 + i);
  }
  for (i = 0; i < 100; ++i) {
    hash_delete(num * 1000 + i);
  }
  for (i = 0; i < 1000; ++i) {
    hash_get(num * 1000 + i);
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<testLibrary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    1184 <testLibrary+0x44>
imul   $0x3e8,-0x18(%rbp),%edi
add    -0x14(%rbp),%edi
call   1030 <hash_insert@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <testLibrary+0x1a>
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    11b2 <testLibrary+0x72>
imul   $0x3e8,-0x18(%rbp),%edi
add    -0x14(%rbp),%edi
call   1060 <hash_delete@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118b <testLibrary+0x4b>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    11e3 <testLibrary+0xa3>
imul   $0x3e8,-0x18(%rbp),%edi
add    -0x14(%rbp),%edi
call   1050 <hash_get@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b9 <testLibrary+0x79>
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):
<testLibrary>:
push   %r14
push   %rbx
push   %rax
imul   $0x3e8,%edi,%r14d
xor    %ebx,%ebx
nopl   (%rax)
lea    (%r14,%rbx,1),%edi
call   1030 <hash_insert@plt>
add    $0x1,%ebx
cmp    $0x3e8,%ebx
jne    1150 <testLibrary+0x10>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
lea    (%r14,%rbx,1),%edi
call   1060 <hash_delete@plt>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1170 <testLibrary+0x30>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r14,%rbx,1),%edi
call   1050 <hash_get@plt>
add    $0x1,%ebx
cmp    $0x3e8,%ebx
jne    1190 <testLibrary+0x50>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @testLibrary(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = trunc i64 %7 to i32
store i32 %8, i32* %5
store i32 0, i32* %4
br label %9
9: ; preds = %18, %1
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %5
%14 = mul nsw i32 %13, 1000
%15 = load i32, i32* %4
%16 = add nsw i32 %14, %15
%17 = call i32 @hash_insert(i32 %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %9
21: ; preds = %9
store i32 0, i32* %4
br label %22
22: ; preds = %31, %21
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 100
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %5
%27 = mul nsw i32 %26, 1000
%28 = load i32, i32* %4
%29 = add nsw i32 %27, %28
%30 = call i32 @hash_delete(i32 %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %22
34: ; preds = %22
store i32 0, i32* %4
br label %35
35: ; preds = %44, %34
%36 = load i32, i32* %4
%37 = icmp slt i32 %36, 1000
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = load i32, i32* %5
%40 = mul nsw i32 %39, 1000
%41 = load i32, i32* %4
%42 = add nsw i32 %40, %41
%43 = call i32 @hash_get(i32 %42)
br label %44
44: ; preds = %38
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %35
47: ; preds = %35
%48 = call i32 @pthread_exit(i32* null)
%49 = load i8*, i8** %2
ret i8* %49
}

LLVM IR (-O2):
define noalias i8* @testLibrary(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = mul nsw i32 %3, 1000
br label %5
5: ; preds = %1, %5
%6 = phi i32 [ 0, %1 ], [ %9, %5 ]
%7 = add nsw i32 %6, %4
%8 = tail call i32 @hash_insert(i32 %7)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, 1000
br i1 %10, label %11, label %5
11: ; preds = %5, %11
%12 = phi i32 [ %15, %11 ], [ 0, %5 ]
%13 = add nsw i32 %12, %4
%14 = tail call i32 @hash_delete(i32 %13)
%15 = add nuw nsw i32 %12, 1
%16 = icmp eq i32 %15, 100
br i1 %16, label %17, label %11
17: ; preds = %11, %17
%18 = phi i32 [ %21, %17 ], [ 0, %11 ]
%19 = add nsw i32 %18, %4
%20 = tail call i32 @hash_get(i32 %19)
%21 = add nuw nsw i32 %18, 1
%22 = icmp eq i32 %21, 1000
br i1 %22, label %23, label %17
23: ; preds = %17
%24 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}