xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Pick_Forks(int);
int /*<<< orphan*/ Return_Forks(int);
int rand();
int /*<<< orphan*/ sleep(int);
void *philosopher(void *i) {
  int random_Timer = (rand() % 3) + 1;
  int *number = i;
  Pick_Forks(*number);
  sleep(random_Timer);
  Return_Forks(*number);
}


x86 assembly (clang, -O0):
<philosopher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1040 <Pick_Forks@plt>
mov    -0x14(%rbp),%edi
call   1050 <sleep@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1030 <Return_Forks@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<philosopher>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
mov    (%rbx),%edi
call   1040 <Pick_Forks@plt>
mov    %ebp,%edi
call   1050 <sleep@plt>
mov    (%rbx),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <Return_Forks@plt>

LLVM IR (-O0):
define i8* @philosopher(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %4
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %5
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = call i32 @Pick_Forks(i32 %12)
%14 = load i32, i32* %4
%15 = call i32 @sleep(i32 %14)
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = call i32 @Return_Forks(i32 %17)
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define noalias i8* @philosopher(i8* nocapture %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 3
%4 = add nsw i32 %3, 1
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = tail call i32 @Pick_Forks(i32 %6)
%8 = tail call i32 @sleep(i32 %4)
%9 = load i32, i32* %5
%10 = tail call i32 @Return_Forks(i32 %9)
ret i8* undef
}
/* Variables and functions */
float exp(float);
float n_t(float t, float N0, float lambda) { return N0 * exp(-lambda * t); }


x86 assembly (clang, -O0):
<n_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x4(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_t>:
push   %rax
movss  %xmm1,0x4(%rsp)
xorps  0xee2(%rip),%xmm2
mulss  %xmm2,%xmm0
call   1030 <exp@plt>
mulss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @n_t(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = load float, float* %6
%9 = fneg float %8
%10 = load float, float* %4
%11 = fmul float %9, %10
%12 = call float @exp(float %11)
%13 = fmul float %7, %12
ret float %13
}

LLVM IR (-O2):
define float @n_t(float %0, float %1, float %2) {
%4 = fneg float %2
%5 = fmul float %4, %0
%6 = tail call float @exp(float %5)
%7 = fmul float %6, %1
ret float %7
}
void Play_Music(char loop) {}


x86 assembly (clang, -O0):
<Play_Music>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @Play_Music(i8 signext %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void *myThreadFun(void *vargp) {
  sleep(1);
  printf("Printing from Thread \n");
  return NULL;
}


x86 assembly (clang, -O0):
<myThreadFun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myThreadFun>:
push   %rax
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Printing from Thread \0A\00"
define i8* @myThreadFun(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sleep(i32 1)
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [22 x i8] c"Printing from Thread \00"
define noalias i8* @myThreadFun(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i8* null
}
/* Variables and functions */
scalar_t__ strtoxl(char const *, char **, int, int /*<<< orphan*/);
long strtol(const char *nptr, char **endptr, int ibase) {
  return (long)strtoxl(nptr, endptr, ibase, 0);
}


x86 assembly (clang, -O0):
<strtol>:
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    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <strtoxl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtol>:
xor    %ecx,%ecx
jmp    1030 <strtoxl@plt>

LLVM IR (-O0):
define i64 @strtol(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 i8**, i8*** %5
%9 = load i32, i32* %6
%10 = call i64 @strtoxl(i8* %7, i8** %8, i32 %9, i32 0)
ret i64 %10
}

LLVM IR (-O2):
define i64 @strtol(i8* %0, i8** %1, i32 %2) {
%4 = tail call i64 @strtoxl(i8* %0, i8** %1, i32 %2, i32 0)
ret i64 %4
}
void bd_forget(struct inode *inode) {}


x86 assembly (clang, -O0):
<bd_forget>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.inode = type opaque
define void @bd_forget(%struct.inode* %0) {
%2 = alloca %struct.inode*
store %struct.inode* %0, %struct.inode** %2
ret void
}

LLVM IR (-O2):
%struct.inode = type opaque
define void @bd_forget(%struct.inode* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *, int *);
int main() {
  int x, y, z;
  z = scanf("%d%d", &x, &y);
  printf("z = %d\n", z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [8 x i8] c"z = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
void render_feature_status(void) {}


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

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

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

LLVM IR (-O2):
define void @render_feature_status() {
ret void
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_bkgrnd(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_bkgrnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_bkgrnd+0x2a>
jmp    1170 <cmd_bkgrnd+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_bkgrnd>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_bkgrnd+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_bkgrnd(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_bkgrnd(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Variables and functions */
unsigned long native_save_fl();
unsigned long arch_local_save_flags(void) { return native_save_fl(); }


x86 assembly (clang, -O0):
<arch_local_save_flags>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <native_save_fl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_local_save_flags>:
xor    %eax,%eax
jmp    1030 <native_save_fl@plt>

LLVM IR (-O0):
define i64 @arch_local_save_flags() {
%1 = call i64 (...) @native_save_fl()
ret i64 %1
}

LLVM IR (-O2):
define i64 @arch_local_save_flags() {
%1 = tail call i64 (...) @native_save_fl()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ LineTo(short, short);
int /*<<< orphan*/ MoveTo(short, short);
scalar_t__ RGsetwind(short);
short RGMpoint(short w, short x, short y) {
  if (RGsetwind(w))
    return (-1);
  MoveTo(x, y);
  LineTo(x, y);
}


x86 assembly (clang, -O0):
<RGMpoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %di,%dx
mov    %dx,-0x4(%rbp)
mov    %cx,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
movswl -0x4(%rbp),%edi
call   1050 <RGsetwind@plt>
cmp    $0x0,%rax
je     116b <RGMpoint+0x3b>
movw   $0xffff,-0x2(%rbp)
jmp    118b <RGMpoint+0x5b>
mov    -0x6(%rbp),%ax
movswl %ax,%edi
movswl -0x8(%rbp),%esi
call   1040 <MoveTo@plt>
mov    -0x6(%rbp),%ax
movswl %ax,%edi
movswl -0x8(%rbp),%esi
call   1030 <LineTo@plt>
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RGMpoint>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
call   1050 <RGsetwind@plt>
test   %rax,%rax
jne    1159 <RGMpoint+0x29>
movswl %bp,%ebp
movswl %bx,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <MoveTo@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <LineTo@plt>
mov    $0xffff,%ax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define signext i16 @RGMpoint(i16 signext %0, i16 signext %1, i16 signext %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
%7 = alloca i16
store i16 %0, i16* %5
store i16 %1, i16* %6
store i16 %2, i16* %7
%8 = load i16, i16* %5
%9 = call i64 @RGsetwind(i16 signext %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
store i16 -1, i16* %4
br label %19
12: ; preds = %3
%13 = load i16, i16* %6
%14 = load i16, i16* %7
%15 = call i32 @MoveTo(i16 signext %13, i16 signext %14)
%16 = load i16, i16* %6
%17 = load i16, i16* %7
%18 = call i32 @LineTo(i16 signext %16, i16 signext %17)
br label %19
19: ; preds = %12, %11
%20 = load i16, i16* %4
ret i16 %20
}

LLVM IR (-O2):
define signext i16 @RGMpoint(i16 signext %0, i16 signext %1, i16 signext %2) {
%4 = tail call i64 @RGsetwind(i16 signext %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @MoveTo(i16 signext %1, i16 signext %2)
%8 = tail call i32 @LineTo(i16 signext %1, i16 signext %2)
br label %9
9: ; preds = %3, %6
ret i16 -1
}
/* Variables and functions */
int /*<<< orphan*/ assert_int_equal(int, int /*<<< orphan*/);
int /*<<< orphan*/ pawns_able_to_capture_any(int, int, int);
void pawns_able_to_capture_any_test(void **state) {
  assert_int_equal(
      0x0000000014000000ul,
      pawns_able_to_capture_any(0x000000001C000000ul, 0x0000100800000000ul, 0));
  assert_int_equal(
      0x0000001400000000ul,
      pawns_able_to_capture_any(0x0000001C00000000ul, 0x0000000008000000ul, 1));
}


x86 assembly (clang, -O0):
<pawns_able_to_capture_any_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1c000000,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <pawns_able_to_capture_any@plt>
mov    %eax,%esi
mov    $0x14000000,%edi
call   1040 <assert_int_equal@plt>
xor    %edi,%edi
mov    $0x8000000,%esi
mov    $0x1,%edx
call   1030 <pawns_able_to_capture_any@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1040 <assert_int_equal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pawns_able_to_capture_any_test>:
push   %rax
mov    $0x1c000000,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <pawns_able_to_capture_any@plt>
mov    $0x14000000,%edi
mov    %eax,%esi
call   1040 <assert_int_equal@plt>
xor    %edi,%edi
mov    $0x8000000,%esi
mov    $0x1,%edx
call   1030 <pawns_able_to_capture_any@plt>
xor    %edi,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <assert_int_equal@plt>

LLVM IR (-O0):
define void @pawns_able_to_capture_any_test(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @pawns_able_to_capture_any(i32 469762048, i32 0, i32 0)
%4 = call i32 @assert_int_equal(i32 335544320, i32 %3)
%5 = call i32 @pawns_able_to_capture_any(i32 0, i32 134217728, i32 1)
%6 = call i32 @assert_int_equal(i32 0, i32 %5)
ret void
}

LLVM IR (-O2):
define void @pawns_able_to_capture_any_test(i8** nocapture readnone %0) {
%2 = tail call i32 @pawns_able_to_capture_any(i32 469762048, i32 0, i32 0)
%3 = tail call i32 @assert_int_equal(i32 335544320, i32 %2)
%4 = tail call i32 @pawns_able_to_capture_any(i32 0, i32 134217728, i32 1)
%5 = tail call i32 @assert_int_equal(i32 0, i32 %4)
ret void
}
/* Variables and functions */
unsigned long long rdmsr(int);
int /*<<< orphan*/ report(char *, int);
int /*<<< orphan*/ wrmsr(int, unsigned long long);
void test_kernel_gs_base(void) {
  unsigned long long v1 = 0x123456789abcdef, v2;
  wrmsr(0xc0000102, v1);
  v2 = rdmsr(0xc0000102);
  report("MSR_KERNEL_GS_BASE", v1 == v2);
}


x86 assembly (clang, -O0):
<test_kernel_gs_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movabs $0x123456789abcdef,%rax
45 23 01
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xc0000102,%edi
call   1040 <wrmsr@plt>
mov    $0xc0000102,%edi
call   1030 <rdmsr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe87(%rip),%rdi
call   1050 <report@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_kernel_gs_base>:
push   %rbx
movabs $0x123456789abcdef,%rbx
45 23 01
mov    $0xc0000102,%edi
mov    %rbx,%rsi
call   1040 <wrmsr@plt>
mov    $0xc0000102,%edi
call   1030 <rdmsr@plt>
xor    %esi,%esi
cmp    %rbx,%rax
sete   %sil
lea    0xe9e(%rip),%rdi
pop    %rbx
jmp    1050 <report@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"MSR_KERNEL_GS_BASE\00"
define void @test_kernel_gs_base() {
%1 = alloca i64
%2 = alloca i64
store i64 81985529216486895, i64* %1
%3 = load i64, i64* %1
%4 = call i32 @wrmsr(i32 -1073741566, i64 %3)
%5 = call i64 @rdmsr(i32 -1073741566)
store i64 %5, i64* %2
%6 = load i64, i64* %1
%7 = load i64, i64* %2
%8 = icmp eq i64 %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 @report(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"MSR_KERNEL_GS_BASE\00"
define void @test_kernel_gs_base() {
%1 = tail call i32 @wrmsr(i32 -1073741566, i64 81985529216486895)
%2 = tail call i64 @rdmsr(i32 -1073741566)
%3 = icmp eq i64 %2, 81985529216486895
%4 = zext i1 %3 to i32
%5 = tail call i32 @report(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int rand();
int select_movie(char movie_list[5][100], int n) { return rand() % n; }


x86 assembly (clang, -O0):
<select_movie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_movie>:
push   %rbx
mov    %esi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @select_movie([100 x i8]* %0, i32 %1) {
%3 = alloca [100 x i8]*
%4 = alloca i32
store [100 x i8]* %0, [100 x i8]** %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = srem i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @select_movie([100 x i8]* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, %1
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t mp2vseq_get_framerate(const uint8_t *p_mp2vseq) {
  return (p_mp2vseq[7] & 0xf);
}


x86 assembly (clang, -O0):
<mp2vseq_get_framerate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%eax
and    $0xf,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vseq_get_framerate>:
mov    0x1c(%rdi),%eax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @mp2vseq_get_framerate(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 7
%5 = load i32, i32* %4
%6 = and i32 %5, 15
ret i32 %6
}

LLVM IR (-O2):
define i32 @mp2vseq_get_framerate(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 7
%3 = load i32, i32* %2
%4 = and i32 %3, 15
ret i32 %4
}
int a_cas(volatile int *p, int t, int s) {
  int old;
  for (;;) {
    if (!((int (*)(int, int, volatile int *))0xffff0fc0)(t, s, p))
      return t;
    if ((old = *p) != t)
      return old;
  }
}


x86 assembly (clang, -O0):
<a_cas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0xffff0fc0,%eax
call   *%rax
cmp    $0x0,%eax
jne    1137 <a_cas+0x37>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <a_cas+0x59>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmp    -0x14(%rbp),%eax
je     1154 <a_cas+0x54>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <a_cas+0x59>
jmp    1112 <a_cas+0x12>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_cas>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%rbp
mov    $0xffff0fc0,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %r14d,%esi
mov    %rbp,%rdx
call   *%r15
test   %eax,%eax
je     1138 <a_cas+0x38>
mov    0x0(%rbp),%eax
cmp    %ebx,%eax
je     1120 <a_cas+0x20>
jmp    113a <a_cas+0x3a>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @a_cas(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
br label %9
9: ; preds = %24, %3
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32*, i32** %5
%13 = call i32 inttoptr (i64 4294905792 to i32 (i32, i32, i32*)*)(i32 %10, i32 %11, i32* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %9
%16 = load i32, i32* %6
store i32 %16, i32* %4
br label %25
17: ; preds = %9
%18 = load i32*, i32** %5
%19 = load volatile i32, i32* %18
store i32 %19, i32* %8
%20 = load i32, i32* %6
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = load i32, i32* %8
store i32 %23, i32* %4
br label %25
24: ; preds = %17
br label %9
25: ; preds = %22, %15
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @a_cas(i32* %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %7, %3
%5 = tail call i32 inttoptr (i64 4294905792 to i32 (i32, i32, i32*)*)(i32 %1, i32 %2, i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load volatile i32, i32* %0
%9 = icmp eq i32 %8, %1
br i1 %9, label %4, label %10
10: ; preds = %7, %4
%11 = phi i32 [ %1, %4 ], [ %8, %7 ]
ret i32 %11
}
/* Variables and functions */
void *realloc(void *, size_t);
void *nmx_realloc(void *p, size_t size) {
  if (p) {
    return realloc(p, size);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<nmx_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1141 <nmx_realloc+0x31>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
jmp    1149 <nmx_realloc+0x39>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmx_realloc>:
test   %rdi,%rdi
je     111a <nmx_realloc+0xa>
jmp    1030 <realloc@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @nmx_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = load i64, i64* %5
%11 = call i8* @realloc(i8* %9, i64 %10)
store i8* %11, i8** %3
br label %13
12: ; preds = %2
store i8* null, i8** %3
br label %13
13: ; preds = %12, %8
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @nmx_realloc(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i8* @realloc(i8* %0, i64 %1)
br label %6
6: ; preds = %2, %4
%7 = phi i8* [ %5, %4 ], [ null, %2 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void qaz(void) { bar(); }


x86 assembly (clang, -O0):
<qaz>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<qaz>:
xor    %eax,%eax
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @qaz() {
%1 = call i32 (...) @bar()
ret void
}

LLVM IR (-O2):
define void @qaz() {
%1 = tail call i32 (...) @bar()
ret void
}
/* Variables and functions */
int GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ draw();
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glutSwapBuffers();
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  draw();
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
or     (%rax),%edi
call   1040 <glClear@plt>
mov    $0x0,%al
call   1030 <draw@plt>
mov    $0x0,%al
call   1050 <glutSwapBuffers@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    0x2ea9(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1040 <glClear@plt>
xor    %eax,%eax
call   1030 <draw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glutSwapBuffers@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %1, %2
%4 = call i32 @glClear(i32 %3)
%5 = call i32 (...) @draw()
%6 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %2, %1
%4 = tail call i32 @glClear(i32 %3)
%5 = tail call i32 (...) @draw()
%6 = tail call i32 (...) @glutSwapBuffers()
ret void
}
int main(int argc, char *argv[]) {
  int i = 0;
  i = 1 + 2;
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 3
}
/* Type definitions */
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int boolean_parenthesization(char *, char *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char c[] = "TFTTF";
  char s[] = "|&|^";
  int n = sizeof(c) - 1 / sizeof(c[0]);
  printf("%d\n", boolean_parenthesization(c, s, n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xeb8(%rip),%al
mov    %al,-0xb(%rbp)
movl   $0x5,-0x14(%rbp)
lea    -0xa(%rbp),%rdi
lea    -0xf(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <boolean_parenthesization@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movw   $0x46,0x14(%rsp)
movl   $0x54544654,0x10(%rsp)
54
movb   $0x0,0xc(%rsp)
movl   $0x5e7c267c,0x8(%rsp)
5e
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    $0x5,%edx
call   1040 <boolean_parenthesization@plt>
lea    0xeb0(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.c = [6 x i8] c"TFTTF\00"
@__const.main.s = [5 x i8] c"|&|^\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [5 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [6 x i8]* %2 to i8*
%6 = bitcast [5 x i8]* %3 to i8*
store i32 5, i32* %4
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i32 @boolean_parenthesization(i8* %7, i8* %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.c = [6 x i8] c"TFTTF\00"
@__const.main.s = [5 x i8] c"|&|^\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @boolean_parenthesization(i8* %3, i8* %4, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
int ATLAS_GET_KEY(char *keyName) {
  if (!keyName)
    return 0;
  if (!strcmp("RACE_TIME", keyName))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ATLAS_GET_KEY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <ATLAS_GET_KEY+0x23>
movl   $0x0,-0x4(%rbp)
jmp    115f <ATLAS_GET_KEY+0x4f>
mov    -0x10(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1158 <ATLAS_GET_KEY+0x48>
movl   $0x1,-0x4(%rbp)
jmp    115f <ATLAS_GET_KEY+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ATLAS_GET_KEY>:
test   %rdi,%rdi
je     1133 <ATLAS_GET_KEY+0x23>
push   %rax
mov    %rdi,%rsi
lea    0xee0(%rip),%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"RACE_TIME\00"
define i32 @ATLAS_GET_KEY(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 0, i32* %2
br label %13
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strcmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [10 x i8] c"RACE_TIME\00"
define i32 @ATLAS_GET_KEY(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @strcmp(i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
int test_imm_82uint16_reg(unsigned short val) {
  return ((val) & (0x82 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_82uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x82,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_82uint16_reg>:
test   $0x82,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_82uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 130
%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_82uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 130
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int eg_val(int);
int mg_val(int);
int phased_val(int val, int phase) {
  return ((mg_val(val) * phase) + (eg_val(val) * ((256) - phase))) / (256);
}


x86 assembly (clang, -O0):
<phased_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <mg_val@plt>
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <eg_val@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    $0x100,%edx
sub    -0x8(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phased_val>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
call   1040 <mg_val@plt>
mov    %eax,%ebx
imul   %r14d,%ebx
mov    %ebp,%edi
call   1030 <eg_val@plt>
mov    $0x100,%ecx
sub    %r14d,%ecx
imul   %eax,%ecx
lea    (%rcx,%rbx,1),%eax
add    $0xff,%eax
add    %ebx,%ecx
cmovns %ecx,%eax
sar    $0x8,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @phased_val(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @mg_val(i32 %5)
%7 = load i32, i32* %4
%8 = mul nsw i32 %6, %7
%9 = load i32, i32* %3
%10 = call i32 @eg_val(i32 %9)
%11 = load i32, i32* %4
%12 = sub nsw i32 256, %11
%13 = mul nsw i32 %10, %12
%14 = add nsw i32 %8, %13
%15 = sdiv i32 %14, 256
ret i32 %15
}

LLVM IR (-O2):
define i32 @phased_val(i32 %0, i32 %1) {
%3 = tail call i32 @mg_val(i32 %0)
%4 = mul nsw i32 %3, %1
%5 = tail call i32 @eg_val(i32 %0)
%6 = sub nsw i32 256, %1
%7 = mul nsw i32 %5, %6
%8 = add nsw i32 %7, %4
%9 = sdiv i32 %8, 256
ret i32 %9
}
int test_imm_DBuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xDB << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DBuint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0xdb,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_DBuint64_midword_mem>:
testb  $0xdb,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_DBuint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 219
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_DBuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 14352384
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
const char *skip_whitespace(const char *str) {
  while (*str && *str <= ' ')
    str++;
  return str;
}


x86 assembly (clang, -O0):
<skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     112d <skip_whitespace+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <skip_whitespace+0x3d>
jmp    114e <skip_whitespace+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip_whitespace+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <skip_whitespace+0x21>
cmp    $0x21,%cl
jl     1110 <skip_whitespace+0x10>
ret

LLVM IR (-O0):
define i8* @skip_whitespace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 32
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @skip_whitespace(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %8, %2 ]
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 0
%6 = icmp slt i8 %4, 33
%7 = and i1 %5, %6
%8 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %7, label %2, label %9
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int gpio_dir(unsigned int, int);
int gpio_dir_out(unsigned gpio) { return gpio_dir(gpio, 1); }


x86 assembly (clang, -O0):
<gpio_dir_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <gpio_dir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_dir_out>:
mov    $0x1,%esi
jmp    1030 <gpio_dir@plt>

LLVM IR (-O0):
define i32 @gpio_dir_out(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @gpio_dir(i32 %3, i32 1)
ret i32 %4
}

LLVM IR (-O2):
define i32 @gpio_dir_out(i32 %0) {
%2 = tail call i32 @gpio_dir(i32 %0, i32 1)
ret i32 %2
}
float tf_f(float c) { return c / 3; }


x86 assembly (clang, -O0):
<tf_f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tf_f>:
divss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @tf_f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fdiv float %3, 3.000000e+00
ret float %4
}

LLVM IR (-O2):
define float @tf_f(float %0) {
%2 = fdiv float %0, 3.000000e+00
ret float %2
}
double getY(double *inputVec, int index) { return inputVec[index * 2]; }


x86 assembly (clang, -O0):
<getY>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getY>:
add    %esi,%esi
movslq %esi,%rax
movsd  (%rdi,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @getY(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %6, 2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds double, double* %5, i64 %8
%10 = load double, double* %9
ret double %10
}

LLVM IR (-O2):
define double @getY(double* nocapture %0, i32 %1) {
%3 = shl nsw i32 %1, 1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = load double, double* %5
ret double %6
}
/* Type definitions */
typedef long uint64_t;
struct timespec {
  long tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
uint64_t rte_timespec_to_ns(const struct timespec *ts) {
  return ((uint64_t)ts->tv_sec * 1000000000L) + ts->tv_nsec;
}


x86 assembly (clang, -O0):
<rte_timespec_to_ns>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3b9aca00,0x8(%rax),%rax
3b
mov    -0x8(%rbp),%rcx
add    (%rcx),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rte_timespec_to_ns>:
imul   $0x3b9aca00,0x8(%rdi),%rax
3b
add    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i64 @rte_timespec_to_ns(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load %struct.timespec*, %struct.timespec** %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000000000
%7 = load %struct.timespec*, %struct.timespec** %2
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 0
%9 = load i64, i64* %8
%10 = add nsw i64 %6, %9
ret i64 %10
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define i64 @rte_timespec_to_ns(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%3 = load i64, i64* %2
%4 = mul nsw i64 %3, 1000000000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%6 = load i64, i64* %5
%7 = add nsw i64 %4, %6
ret i64 %7
}
/* Type definitions */
struct Point_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dump_point(struct Point_s *);
int /*<<< orphan*/ puts(char *);
int report(struct Point_s *point) {
  dump_point(point);
  puts("");
  return 0;
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <dump_point@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
push   %rax
call   1040 <dump_point@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.Point_s = type { i32 }
@.str = [1 x i8] zeroinitializer
define i32 @report(%struct.Point_s* %0) {
%2 = alloca %struct.Point_s*
store %struct.Point_s* %0, %struct.Point_s** %2
%3 = load %struct.Point_s*, %struct.Point_s** %2
%4 = call i32 @dump_point(%struct.Point_s* %3)
%5 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.Point_s = type { i32 }
define i32 @report(%struct.Point_s* %0) {
%2 = tail call i32 @dump_point(%struct.Point_s* %0)
%3 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
int partition(int *, int, int);
void quicksort(int a[], int start, int end) {
  int pivot;
  if (start < end) {
    pivot = partition(a, start, end);
    quicksort(a, start, (pivot - 1));
    quicksort(a, (pivot + 1), end);
  }
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quicksort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quicksort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quicksort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partition(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = load i32*, i32** %4
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %6
br label %24
24: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quicksort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ArgNum();
int /*<<< orphan*/ SetFlag(int /*<<< orphan*/, int /*<<< orphan*/);
void Act_Clear(void) { SetFlag(ArgNum(), 0); }


x86 assembly (clang, -O0):
<Act_Clear>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ArgNum@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <SetFlag@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Act_Clear>:
push   %rax
xor    %eax,%eax
call   1040 <ArgNum@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <SetFlag@plt>

LLVM IR (-O0):
define void @Act_Clear() {
%1 = call i32 (...) @ArgNum()
%2 = call i32 @SetFlag(i32 %1, i32 0)
ret void
}

LLVM IR (-O2):
define void @Act_Clear() {
%1 = tail call i32 (...) @ArgNum()
%2 = tail call i32 @SetFlag(i32 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ output(char *, int);
int /*<<< orphan*/ sscanf(char const *, char *, int *);
void print24DiskWIOInfo(const char *cmd) {
  int id;
  sscanf(cmd + 9, "%d", &id);
  output("Disk %d Write\t0\t0\tKB/s\n", id);
}


x86 assembly (clang, -O0):
<print24DiskWIOInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x9,%rdi
lea    0xec5(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print24DiskWIOInfo>:
push   %rax
add    $0x9,%rdi
lea    0xed4(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x4(%rsp),%esi
lea    0xec2(%rip),%rdi
call   1030 <output@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [24 x i8] c"Disk %d Write\090\090\09KB/s\0A\00"
define void @print24DiskWIOInfo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 9
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @output(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [24 x i8] c"Disk %d Write\090\090\09KB/s\0A\00"
define void @print24DiskWIOInfo(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8, i8* %0, i64 9
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @output(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void pci_mfree(void *x) {
  if (x)
    free(x);
}


x86 assembly (clang, -O0):
<pci_mfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <pci_mfree+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pci_mfree>:
test   %rdi,%rdi
je     111a <pci_mfree+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @pci_mfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @pci_mfree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void av_set_options_string() {}


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

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

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

LLVM IR (-O2):
define void @av_set_options_string() {
ret void
}
void disableHx1(void) {}


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

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

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

LLVM IR (-O2):
define void @disableHx1() {
ret void
}