xunge/DecIR huggingface dataset:
/* Type definitions */
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int bind_(int *sockfd, struct sockaddr_in *addr) {
  int ret = bind(*sockfd, (struct sockaddr *)addr, sizeof(struct sockaddr));
  if (-1 == ret) {
    perror("bind");
    exit(1);
  }
  return ret;
}


x86 assembly (clang, -O0):
<bind_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <bind@plt>
mov    %eax,-0x14(%rbp)
mov    $0xffffffff,%eax
cmp    -0x14(%rbp),%eax
jne    117b <bind_+0x4b>
lea    0xe94(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bind_>:
push   %rax
mov    (%rdi),%edi
mov    $0x4,%edx
call   1030 <bind@plt>
cmp    $0xffffffff,%eax
je     1144 <bind_+0x14>
pop    %rcx
ret
lea    0xeb5(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [5 x i8] c"bind\00"
define i32 @bind_(i32* %0, %struct.sockaddr_in* %1) {
%3 = alloca i32*
%4 = alloca %struct.sockaddr_in*
%5 = alloca i32
store i32* %0, i32** %3
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%9 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%10 = call i32 @bind(i32 %7, %struct.sockaddr* %9, i32 4)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp eq i32 -1, %11
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [5 x i8] c"bind\00"
define i32 @bind_(i32* nocapture %0, %struct.sockaddr_in* %1) {
%3 = load i32, i32* %0
%4 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%5 = tail call i32 @bind(i32 %3, %struct.sockaddr* %4, i32 4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int i, n = 5, sum = 0;
  for (i = 1; i <= n; n = n + 1) {
    sum = sum + i;
    printf("%i %i %i\n", i, sum, n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     116c <main+0x5c>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x5,%ebx
lea    0xee0(%rip),%r14
lea    -0x4(%rbx),%edx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%ecx
call   1030 <printf@plt>
add    $0x1,%ebx
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [10 x i8] c"%i %i %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %3
store i32 0, i32* %4
store i32 1, i32* %2
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %20
9: ; preds = %5
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = add nsw i32 %10, %11
store i32 %12, i32* %4
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%i %i %i\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 5, %0 ], [ %6, %1 ]
%3 = phi i32 [ 0, %0 ], [ %4, %1 ]
%4 = add nuw nsw i32 %3, 1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 %4, i32 %2)
%6 = add nuw nsw i32 %2, 1
br label %1
}
int a(int n) { return 2 * n; }


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
lea    (%rdi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @a(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 2, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @a(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ ds_list_destroy(void *);
void ds_list_destructor(void *list) { ds_list_destroy(list); }


x86 assembly (clang, -O0):
<ds_list_destructor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ds_list_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds_list_destructor>:
jmp    1030 <ds_list_destroy@plt>

LLVM IR (-O0):
define void @ds_list_destructor(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @ds_list_destroy(i8* %3)
ret void
}

LLVM IR (-O2):
define void @ds_list_destructor(i8* %0) {
%2 = tail call i32 @ds_list_destroy(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int tribonacci(int);
int main() {
  int n;
  printf("Enter N: ");
  scanf("%d", &n);
  printf("The tribonacci number at position %d is: %d", n, tribonacci(n));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <tribonacci@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1040 <tribonacci@plt>
lea    0xea4(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Enter N: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [44 x i8] c"The tribonacci number at position %d is: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @tribonacci(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter N: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [44 x i8] c"The tribonacci number at position %d is: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @tribonacci(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGCHLD;
int check_clone_autoreap_ptrace(int /*<<< orphan*/);
int check_clone_autoreap_signals_ptrace(void) {
  return check_clone_autoreap_ptrace(SIGCHLD);
}


x86 assembly (clang, -O0):
<check_clone_autoreap_signals_ptrace>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <check_clone_autoreap_ptrace@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_clone_autoreap_signals_ptrace>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <check_clone_autoreap_ptrace@plt>

LLVM IR (-O0):
@SIGCHLD = global i32 0
define i32 @check_clone_autoreap_signals_ptrace() {
%1 = load i32, i32* @SIGCHLD
%2 = call i32 @check_clone_autoreap_ptrace(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@SIGCHLD = global i32 0
define i32 @check_clone_autoreap_signals_ptrace() {
%1 = load i32, i32* @SIGCHLD
%2 = tail call i32 @check_clone_autoreap_ptrace(i32 %1)
ret i32 %2
}
/* Type definitions */
typedef char uint8_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ _write(int, char *, int);
void oled_clear(int fd) {
  uint8_t buf[] = {'C', 'L'};
  _write(fd, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<oled_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0xede(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x6(%rbp),%rsi
mov    $0x2,%edx
call   1030 <_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oled_clear>:
push   %rax
movw   $0x4c43,0x6(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <_write@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.oled_clear.buf = [2 x i8] c"CL"
define void @oled_clear(i32 %0) {
%2 = alloca i32
%3 = alloca [2 x i8]
store i32 %0, i32* %2
%4 = bitcast [2 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%7 = call i32 @_write(i32 %5, i8* %6, i32 2)
ret void
}

LLVM IR (-O2):
define void @oled_clear(i32 %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
store i16 19523, i16* %2
%4 = call i32 @_write(i32 %0, i8* %3, i32 2)
ret void
}
/* Variables and functions */
int create_tarball(char const *, int, char **);
int create(const char *path, char **files, int number) {
  return create_tarball(path, number, files);
}


x86 assembly (clang, -O0):
<create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <create_tarball@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create>:
mov    %rsi,%rax
mov    %edx,%esi
mov    %rax,%rdx
jmp    1030 <create_tarball@plt>

LLVM IR (-O0):
define i32 @create(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %6
%9 = load i8**, i8*** %5
%10 = call i32 @create_tarball(i8* %7, i32 %8, i8** %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @create(i8* %0, i8** %1, i32 %2) {
%4 = tail call i32 @create_tarball(i8* %0, i32 %2, i8** %1)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int sys_setresgid(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int sys_setresgid32(gid_t rgid, gid_t egid, gid_t sgid) {
  return sys_setresgid(rgid, egid, sgid);
}


x86 assembly (clang, -O0):
<sys_setresgid32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <sys_setresgid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_setresgid32>:
jmp    1030 <sys_setresgid@plt>

LLVM IR (-O0):
define i32 @sys_setresgid32(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @sys_setresgid(i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @sys_setresgid32(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @sys_setresgid(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
void *android_dlsym(void *, char const *);
void *hybris_dlsym(void *handle, const char *symbol) {
  return android_dlsym(handle, symbol);
}


x86 assembly (clang, -O0):
<hybris_dlsym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <android_dlsym@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hybris_dlsym>:
jmp    1030 <android_dlsym@plt>

LLVM IR (-O0):
define i8* @hybris_dlsym(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @android_dlsym(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @hybris_dlsym(i8* %0, i8* %1) {
%3 = tail call i8* @android_dlsym(i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ irc_core_init();
int /*<<< orphan*/ irc_dcc_init();
int /*<<< orphan*/ irc_flood_init();
int /*<<< orphan*/ irc_notifylist_init();
void irc_init(void) {
  irc_core_init();
  irc_dcc_init();
  irc_flood_init();
  irc_notifylist_init();
}


x86 assembly (clang, -O0):
<irc_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <irc_core_init@plt>
mov    $0x0,%al
call   1030 <irc_dcc_init@plt>
mov    $0x0,%al
call   1050 <irc_flood_init@plt>
mov    $0x0,%al
call   1060 <irc_notifylist_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_init>:
push   %rax
xor    %eax,%eax
call   1040 <irc_core_init@plt>
xor    %eax,%eax
call   1030 <irc_dcc_init@plt>
xor    %eax,%eax
call   1050 <irc_flood_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <irc_notifylist_init@plt>

LLVM IR (-O0):
define void @irc_init() {
%1 = call i32 (...) @irc_core_init()
%2 = call i32 (...) @irc_dcc_init()
%3 = call i32 (...) @irc_flood_init()
%4 = call i32 (...) @irc_notifylist_init()
ret void
}

LLVM IR (-O2):
define void @irc_init() {
%1 = tail call i32 (...) @irc_core_init()
%2 = tail call i32 (...) @irc_dcc_init()
%3 = tail call i32 (...) @irc_flood_init()
%4 = tail call i32 (...) @irc_notifylist_init()
ret void
}
/* Variables and functions */
int get_st2_prop();
int get_st3_prop();
int get_st1_value(void) { return get_st2_prop() + get_st3_prop(); }


x86 assembly (clang, -O0):
<get_st1_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get_st2_prop@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <get_st3_prop@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_st1_value>:
push   %rbx
xor    %eax,%eax
call   1040 <get_st2_prop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <get_st3_prop@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_st1_value() {
%1 = call i32 (...) @get_st2_prop()
%2 = call i32 (...) @get_st3_prop()
%3 = add nsw i32 %1, %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @get_st1_value() {
%1 = tail call i32 (...) @get_st2_prop()
%2 = tail call i32 (...) @get_st3_prop()
%3 = add nsw i32 %2, %1
ret i32 %3
}
void cond_enabled() {}


x86 assembly (clang, -O0):
<cond_enabled>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cond_enabled>:
ret

LLVM IR (-O0):
define void @cond_enabled() {
ret void
}

LLVM IR (-O2):
define void @cond_enabled() {
ret void
}
int run_with_params(int argc, char *argv[]) { return 0; }


x86 assembly (clang, -O0):
<run_with_params>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_with_params>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @run_with_params(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @run_with_params(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint32_t GetMsTicks(void) {
  struct timeval tval;
  if (gettimeofday(&tval, NULL) < 0) {
    return 0;
  }
  return (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<GetMsTicks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
jge    113b <GetMsTicks+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    115a <GetMsTicks+0x4a>
imul   $0x3e8,-0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMsTicks>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
js     114b <GetMsTicks+0x3b>
imul   $0x3e8,0x8(%rsp),%eax
movslq 0xc(%rsp),%rcx
imul   $0x10624dd3,%rcx,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rbx
add    %ecx,%ebx
add    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @GetMsTicks() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %14
6: ; preds = %0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%11 = load i32, i32* %10
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %9, %12
store i32 %13, i32* %1
br label %14
14: ; preds = %6, %5
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @GetMsTicks() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp slt i64 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add nsw i32 %11, %8
br label %13
13: ; preds = %0, %5
%14 = phi i32 [ %12, %5 ], [ 0, %0 ]
ret i32 %14
}
char *checksym(sym, delimiter)
char *sym;
int delimiter;
{ return checkidentifier(sym, delimiter, 0); }


x86 assembly (clang, -O0):
<checksym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <checkidentifier@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checksym>:
push   %rax
xor    %edx,%edx
xor    %eax,%eax
call   1030 <checkidentifier@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @checksym(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @checkidentifier to i32 (i8*, i32, i32, ...)*)(i8* %5, i32 %6, i32 0)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define i8* @checksym(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @checkidentifier to i32 (i8*, i32, i32, ...)*)(i8* %0, i32 %1, i32 0)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
int pentagon(int n) { return n * (3 * n - 1) / 2; }


x86 assembly (clang, -O0):
<pentagon>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
imul   $0x3,-0x4(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<pentagon>:
lea    (%rdi,%rdi,2),%ecx
add    $0xffffffff,%ecx
imul   %edi,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @pentagon(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 3, %4
%6 = sub nsw i32 %5, 1
%7 = mul nsw i32 %3, %6
%8 = sdiv i32 %7, 2
ret i32 %8
}

LLVM IR (-O2):
define i32 @pentagon(i32 %0) {
%2 = mul nsw i32 %0, 3
%3 = add nsw i32 %2, -1
%4 = mul nsw i32 %3, %0
%5 = sdiv i32 %4, 2
ret i32 %5
}
/* Variables and functions */
void SH2InterpreterDeInit() {}


x86 assembly (clang, -O0):
<SH2InterpreterDeInit>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SH2InterpreterDeInit>:
ret

LLVM IR (-O0):
define void @SH2InterpreterDeInit() {
ret void
}

LLVM IR (-O2):
define void @SH2InterpreterDeInit() {
ret void
}
/* Variables and functions */
int power(int, int, int *);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int cache[100] = {0};
  printf("power is %d", power(2, 10, cache));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1050 <memset@plt>
lea    -0x190(%rbp),%rdx
mov    $0x2,%edi
mov    $0xa,%esi
call   1030 <power@plt>
mov    %eax,%esi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
mov    $0x190,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    $0x2,%edi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1030 <power@plt>
lea    0xe9d(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x190,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"power is %d\00"
define void @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%4 = call i32 @power(i32 2, i32 10, i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"power is %d\00"
define void @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%4 = call i32 @power(i32 2, i32 10, i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i = 1;
  int j = 1;
  i++;
  j--;
  printf("i = %d\n", i);
  printf("j = %d\n", j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"i = %d\0A\00"
@.str.1 = [8 x i8] c"j = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 1
store i32 %4, i32* %1
%5 = load i32, i32* %2
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"i = %d\0A\00"
@.str.1 = [8 x i8] c"j = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret i32 0
}
/* Variables and functions */
float sinf(float);
float intr_wrap_058(float p1) { return sinf(p1); }


x86 assembly (clang, -O0):
<intr_wrap_058>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_058>:
jmp    1030 <sinf@plt>

LLVM IR (-O0):
define float @intr_wrap_058(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sinf(float %3)
ret float %4
}

LLVM IR (-O2):
define float @intr_wrap_058(float %0) {
%2 = tail call float @sinf(float %0)
ret float %2
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int setgid(gid_t __attribute__((unused)) gid) { return 0; }


x86 assembly (clang, -O0):
<setgid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setgid>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @setgid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @setgid(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
dunno() {
  printf("I don't know about that\n");
  exit(0);
}


x86 assembly (clang, -O0):
<dunno>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<dunno>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"I don't know about that\0A\00"
define i32 @dunno() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [24 x i8] c"I don't know about that\00"
define i32 @dunno() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void free_split_res(char **tokens, int count) {
  if (!tokens)
    return;
  while (count--)
    free(tokens[count]);
  free(tokens);
}


x86 assembly (clang, -O0):
<free_split_res>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112f <free_split_res+0x1f>
jmp    1167 <free_split_res+0x57>
jmp    1134 <free_split_res+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     115e <free_split_res+0x4e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    1134 <free_split_res+0x24>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_split_res>:
test   %rdi,%rdi
je     1165 <free_split_res+0x55>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
test   %esi,%esi
je     1152 <free_split_res+0x42>
movslq %r15d,%rax
lea    (%r14,%rax,8),%r12
add    $0xfffffffffffffff8,%r12
neg    %r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rdi
call   1030 <free@plt>
add    $0xffffffffffffffff,%rbx
cmp    %ebx,%r15d
jne    1140 <free_split_res+0x30>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @free_split_res(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = load i8**, i8*** %3
%6 = icmp ne i8** %5, null
br i1 %6, label %8, label %7
7: ; preds = %2
br label %22
8: ; preds = %2
br label %9
9: ; preds = %13, %8
%10 = load i32, i32* %4
%11 = add nsw i32 %10, -1
store i32 %11, i32* %4
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i8**, i8*** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
br label %9
19: ; preds = %9
%20 = load i8**, i8*** %3
%21 = bitcast i8** %20 to i8*
br label %22
22: ; preds = %19, %7
ret void
}

LLVM IR (-O2):
define void @free_split_res(i8** %0, i32 %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = icmp eq i32 %1, 0
br i1 %5, label %15, label %6
6: ; preds = %4
%7 = sext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ %7, %6 ], [ %10, %8 ]
%10 = add nsw i64 %9, -1
%11 = getelementptr inbounds i8*, i8** %0, i64 %10
%12 = load i8*, i8** %11
tail call void @free(i8* %12)
%13 = trunc i64 %10 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %8
15: ; preds = %8, %4
%16 = bitcast i8** %0 to i8*
tail call void @free(i8* %16)
br label %17
17: ; preds = %2, %15
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
bool userns_supported(void) { return access("/proc/self/uid_map", F_OK) >= 0; }


x86 assembly (clang, -O0):
<userns_supported>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <access@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<userns_supported>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <access@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"/proc/self/uid_map\00"
@F_OK = global i32 0
define i32 @userns_supported() {
%1 = load i32, i32* @F_OK
%2 = call i64 @access(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp sge i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
@.str = [19 x i8] c"/proc/self/uid_map\00"
@F_OK = global i32 0
define i32 @userns_supported() {
%1 = load i32, i32* @F_OK
%2 = tail call i64 @access(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = lshr i64 %2, 63
%4 = trunc i64 %3 to i32
%5 = xor i32 %4, 1
ret i32 %5
}
char *get_next_msg(char *bufPtr, char *msgID, int *msgSize) {
  memcpy(msgSize, bufPtr, 4);
  char *message = malloc(*msgSize + 4);
  memcpy(message, bufPtr, *msgSize + 4);
  *msgSize += 4;
  *msgID = *(bufPtr + 4);
  bufPtr = bufPtr + *msgSize;
  return message;
}


x86 assembly (clang, -O0):
<get_next_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x4,%eax
movslq %eax,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x4,%eax
movslq %eax,%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_msg>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
movslq (%rdi),%rbx
mov    %ebx,(%rdx)
add    $0x4,%rbx
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1030 <memcpy@plt>
mov    %ebx,(%r15)
mov    0x4(%r12),%al
mov    %al,(%r14)
mov    %r13,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @get_next_msg(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
%9 = bitcast i32* %8 to i8*
%10 = load i8*, i8** %4
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 4
%14 = sext i32 %13 to i64
%15 = call i8* @malloc(i64 %14)
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = load i8*, i8** %4
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 4
%21 = sext i32 %20 to i64
%22 = load i32*, i32** %6
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 4
store i32 %24, i32* %22
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 4
%27 = load i8, i8* %26
%28 = load i8*, i8** %5
store i8 %27, i8* %28
%29 = load i8*, i8** %4
%30 = load i32*, i32** %6
%31 = load i32, i32* %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
store i8* %33, i8** %4
%34 = load i8*, i8** %7
ret i8* %34
}

LLVM IR (-O2):
define noalias i8* @get_next_msg(i8* nocapture %0, i8* nocapture writeonly %1, i32* nocapture %2) {
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %4
store i32 %5, i32* %2
%6 = add nsw i32 %5, 4
%7 = sext i32 %6 to i64
%8 = tail call i8* @malloc(i64 %7)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %8, i8* align 1 %0, i64 %7, i1 false)
store i32 %6, i32* %2
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = load i8, i8* %9
store i8 %10, i8* %1
ret i8* %8
}
int test_imm_B0int8_reg(signed char val) {
  return ((val) & (-0xB0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B0int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff50,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B0int8_reg>:
test   $0xffffff50,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B0int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -176
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_B0int8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -176
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
__attribute__((always_)) short int atomic_inc_short(short int *v) {
  asm(".section .smp_locks,\"a\"\n"
      " "
      ".balign 8"
      " "
      "\n"
      " "
      ".quad"
      " "
      "661f\n"
      ".previous\n"
      "661:\n\tlock; "
      "addw $1, %0"
      : "+m"(*v));
  return *v;
}


x86 assembly (clang, -O0):
<atomic_inc_short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lock addw $0x1,(%rax)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_inc_short>:
lock addw $0x1,(%rdi)
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define signext i16 @atomic_inc_short(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16*, i16** %2
%5 = load i16, i16* %4
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @atomic_inc_short(i16* %0) {
tail call void asm ".section .smp_locks,\22a\22\0A .balign 8 \0A .quad 661f\0A.previous\0A661:\0A\09lock; addw $$1, $0", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i16* elementtype(i16) %0, i16* elementtype(i16) %0)
%2 = load i16, i16* %0
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void ObjectsTooClose() {
  static int MessageGiven = 0;
  if (!MessageGiven) {
    fprintf(
        stderr,
        "\nWarning: two objects are separated by a distance less than 1000 m.");
    fprintf(stderr,
            "\nCollision is anticipated. Accuracy of results is compromised.");
    MessageGiven = 1;
  }
}


x86 assembly (clang, -O0):
<ObjectsTooClose>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f11(%rip)
jne    1155 <ObjectsTooClose+0x45>
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xefe(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,0x2ed7(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ObjectsTooClose>:
push   %rbx
cmpb   $0x0,0x2f14(%rip)
jne    1144 <ObjectsTooClose+0x34>
mov    0x2ebf(%rip),%rbx
mov    (%rbx),%edi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf0c(%rip),%rsi
call   1030 <fprintf@plt>
movb   $0x1,0x2ee8(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@ObjectsTooClose.MessageGiven = internal global i32 0
@stderr = global i32 0
@.str = [68 x i8] c"\0AWarning: two objects are separated by a distance less than 1000 m.\00"
@.str.1 = [63 x i8] c"\0ACollision is anticipated. Accuracy of results is compromised.\00"
define void @ObjectsTooClose() {
%1 = load i32, i32* @ObjectsTooClose.MessageGiven
%2 = icmp ne i32 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* @ObjectsTooClose.MessageGiven
br label %8
8: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@ObjectsTooClose.MessageGiven = internal unnamed_addr global i1 false
@stderr = global i32 0
@.str = [68 x i8] c"\0AWarning: two objects are separated by a distance less than 1000 m.\00"
@.str.1 = [63 x i8] c"\0ACollision is anticipated. Accuracy of results is compromised.\00"
define void @ObjectsTooClose() {
%1 = load i1, i1* @ObjectsTooClose.MessageGiven
br i1 %1, label %7, label %2
2: ; preds = %0
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
store i1 true, i1* @ObjectsTooClose.MessageGiven
br label %7
7: ; preds = %2, %0
ret void
}
/* Variables and functions */
int mkdir(char *, int);
int xavaMkdir(char *dir) { return mkdir(dir, 0770); }


x86 assembly (clang, -O0):
<xavaMkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1f8,%esi
call   1030 <mkdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xavaMkdir>:
mov    $0x1f8,%esi
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
define i32 @xavaMkdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @mkdir(i8* %3, i32 504)
ret i32 %4
}

LLVM IR (-O2):
define i32 @xavaMkdir(i8* nocapture %0) {
%2 = tail call i32 @mkdir(i8* %0, i32 504)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ closelog_intern(int);
void arcadyan_closelog(void) { closelog_intern(1); }


x86 assembly (clang, -O0):
<arcadyan_closelog>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <closelog_intern@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<arcadyan_closelog>:
mov    $0x1,%edi
jmp    1030 <closelog_intern@plt>

LLVM IR (-O0):
define void @arcadyan_closelog() {
%1 = call i32 @closelog_intern(i32 1)
ret void
}

LLVM IR (-O2):
define void @arcadyan_closelog() {
%1 = tail call i32 @closelog_intern(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ qSessionAddInteger(char *, int);
int qSessionValueInteger(char *);
int qSessionUpdateInteger(char *name, int plusint) {
  qSessionAddInteger(name, qSessionValueInteger(name) + plusint);
  return qSessionValueInteger(name);
}


x86 assembly (clang, -O0):
<qSessionUpdateInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <qSessionValueInteger@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
add    -0xc(%rbp),%esi
call   1040 <qSessionAddInteger@plt>
mov    -0x8(%rbp),%rdi
call   1030 <qSessionValueInteger@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qSessionUpdateInteger>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
call   1030 <qSessionValueInteger@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <qSessionAddInteger@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <qSessionValueInteger@plt>

LLVM IR (-O0):
define i32 @qSessionUpdateInteger(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @qSessionValueInteger(i8* %6)
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
%10 = call i32 @qSessionAddInteger(i8* %5, i32 %9)
%11 = load i8*, i8** %3
%12 = call i32 @qSessionValueInteger(i8* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @qSessionUpdateInteger(i8* %0, i32 %1) {
%3 = tail call i32 @qSessionValueInteger(i8* %0)
%4 = add nsw i32 %3, %1
%5 = tail call i32 @qSessionAddInteger(i8* %0, i32 %4)
%6 = tail call i32 @qSessionValueInteger(i8* %0)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ DDSpriteBuffer_BltImg(int, int, int, int);
int GetStretchX(int);
int GetStretchY(int);
void subDrawElectronTurnRight(int si, int bx) {
  int X, Y;
  X = GetStretchX(si);
  Y = GetStretchY(si);
  DDSpriteBuffer_BltImg(X, Y, 134, 0x10 - bx);
}


x86 assembly (clang, -O0):
<subDrawElectronTurnRight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <GetStretchX@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <GetStretchY@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0x10,%ecx
sub    -0x8(%rbp),%ecx
mov    $0x86,%edx
call   1040 <DDSpriteBuffer_BltImg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subDrawElectronTurnRight>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
call   1030 <GetStretchX@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1050 <GetStretchY@plt>
mov    $0x10,%ecx
sub    %r14d,%ecx
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x86,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <DDSpriteBuffer_BltImg@plt>

LLVM IR (-O0):
define void @subDrawElectronTurnRight(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = call i32 @GetStretchX(i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = call i32 @GetStretchY(i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = sub nsw i32 16, %13
%15 = call i32 @DDSpriteBuffer_BltImg(i32 %11, i32 %12, i32 134, i32 %14)
ret void
}

LLVM IR (-O2):
define void @subDrawElectronTurnRight(i32 %0, i32 %1) {
%3 = tail call i32 @GetStretchX(i32 %0)
%4 = tail call i32 @GetStretchY(i32 %0)
%5 = sub nsw i32 16, %1
%6 = tail call i32 @DDSpriteBuffer_BltImg(i32 %3, i32 %4, i32 134, i32 %5)
ret void
}
/* Variables and functions */
char tolower(char);
int xtoi(char c) {
  int i = -1;
  c = tolower(c);
  if (c >= 'a' && c <= 'f') {
    i = 0xa + (c - 'a');
  } else if (c >= '0' && c <= '9') {
    i = c - '0';
  }
  return i;
}


x86 assembly (clang, -O0):
<xtoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     115d <xtoi+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0x66,%eax
jg     115d <xtoi+0x4d>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    1186 <xtoi+0x76>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1181 <xtoi+0x71>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     1181 <xtoi+0x71>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    1186 <xtoi+0x76>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtoi>:
push   %rax
call   1030 <tolower@plt>
movsbl %al,%eax
lea    -0x61(%rax),%ecx
cmp    $0x5,%cl
ja     1126 <xtoi+0x16>
add    $0xffffffa9,%eax
pop    %rcx
ret
lea    -0x30(%rax),%ecx
add    $0xffffffd0,%eax
cmp    $0xa,%cl
mov    $0xffffffff,%ecx
cmovb  %eax,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @xtoi(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 -1, i32* %3
%4 = load i8, i8* %2
%5 = call signext i8 @tolower(i8 signext %4)
store i8 %5, i8* %2
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 97
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 102
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 97
%17 = add nsw i32 10, %16
store i32 %17, i32* %3
br label %31
18: ; preds = %9, %1
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 48
br i1 %21, label %22, label %30
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 57
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = sub nsw i32 %28, 48
store i32 %29, i32* %3
br label %30
30: ; preds = %26, %22, %18
br label %31
31: ; preds = %30, %13
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @xtoi(i8 signext %0) {
%2 = tail call signext i8 @tolower(i8 signext %0)
%3 = sext i8 %2 to i32
%4 = add i8 %2, -97
%5 = icmp ult i8 %4, 6
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = add nsw i32 %3, -87
br label %13
8: ; preds = %1
%9 = add i8 %2, -48
%10 = icmp ult i8 %9, 10
%11 = add nsw i32 %3, -48
%12 = select i1 %10, i32 %11, i32 -1
br label %13
13: ; preds = %8, %6
%14 = phi i32 [ %7, %6 ], [ %12, %8 ]
ret i32 %14
}
/* Type definitions */
struct iovec {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ __preadv(int, struct iovec const *, int, int /*<<< orphan*/,
                            int /*<<< orphan*/);
ssize_t preadv(int fd, const struct iovec *iovp, int iovcnt, off_t offset) {
  return __preadv(fd, iovp, iovcnt, 0, offset);
}


x86 assembly (clang, -O0):
<preadv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%r8d
xor    %ecx,%ecx
call   1030 <__preadv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<preadv>:
mov    %ecx,%r8d
xor    %ecx,%ecx
jmp    1030 <__preadv@plt>

LLVM IR (-O0):
%struct.iovec = type { i32 }
define i32 @preadv(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.iovec*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store %struct.iovec* %1, %struct.iovec** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load %struct.iovec*, %struct.iovec** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @__preadv(i32 %9, %struct.iovec* %10, i32 %11, i32 0, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
define i32 @preadv(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = tail call i32 @__preadv(i32 %0, %struct.iovec* %1, i32 %2, i32 0, i32 %3)
ret i32 %5
}
void XmeXpmFree(ptr) void *ptr;
{ free(ptr); }


x86 assembly (clang, -O0):
<XmeXpmFree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XmeXpmFree>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @XmeXpmFree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @XmeXpmFree(i8* nocapture %0) {
tail call void @free(i8* %0)
ret void
}