xunge/DecIR huggingface dataset:
int ffs(int i) { return __builtin_ffs(i); }


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
bsf    %edx,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
bsf    %edi,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ffs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.cttz.i32(i32 %3, i1 true)
%5 = add i32 %4, 1
%6 = icmp eq i32 %3, 0
%7 = select i1 %6, i32 0, i32 %5
ret i32 %7
}

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%3 = add nuw nsw i32 %2, 1
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 0, i32 %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ rfc2045_error(char *);
void rfc2045_enomem() { rfc2045_error("Out of memory."); }


x86 assembly (clang, -O0):
<rfc2045_enomem>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <rfc2045_error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfc2045_enomem>:
lea    0xee9(%rip),%rdi
jmp    1030 <rfc2045_error@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Out of memory.\00"
define void @rfc2045_enomem() {
%1 = call i32 @rfc2045_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Out of memory.\00"
define void @rfc2045_enomem() {
%1 = tail call i32 @rfc2045_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
float filt_box(float x) {
  if (x < -0.5)
    return 0.0;
  if (x < 0.5)
    return 1.0;
  return 0.0;
}


x86 assembly (clang, -O0):
<filt_box>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xee6(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <filt_box+0x31>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1166 <filt_box+0x66>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec6(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    115e <filt_box+0x5e>
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1166 <filt_box+0x66>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<filt_box>:
movaps %xmm0,%xmm1
cmpltss 0xef4(%rip),%xmm1
movss  0xef0(%rip),%xmm2
andps  %xmm1,%xmm2
cmpltss 0xee8(%rip),%xmm0
andnps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @filt_box(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp olt double %5, -5.000000e-01
br i1 %6, label %7, label %8
7: ; preds = %1
store float 0.000000e+00, float* %2
br label %14
8: ; preds = %1
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fcmp olt double %10, 5.000000e-01
br i1 %11, label %12, label %13
12: ; preds = %8
store float 1.000000e+00, float* %2
br label %14
13: ; preds = %8
store float 0.000000e+00, float* %2
br label %14
14: ; preds = %13, %12, %7
%15 = load float, float* %2
ret float %15
}

LLVM IR (-O2):
define float @filt_box(float %0) {
%2 = fcmp olt float %0, -5.000000e-01
%3 = fcmp olt float %0, 5.000000e-01
%4 = select i1 %3, float 1.000000e+00, float 0.000000e+00
%5 = select i1 %2, float 0.000000e+00, float %4
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ cgbrcond(char *, int);
void cgbrge(int n) { cgbrcond("jge", n); }


x86 assembly (clang, -O0):
<cgbrge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <cgbrcond@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgbrge>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <cgbrcond@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"jge\00"
define void @cgbrge(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cgbrcond(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"jge\00"
define void @cgbrge(i32 %0) {
%2 = tail call i32 @cgbrcond(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int main(void) {
  sleep(10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sleep(i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sleep(i32 10)
ret i32 0
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned int get_current_time() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}


x86 assembly (clang, -O0):
<get_current_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_current_time>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,(%rsp),%ecx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @get_current_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @get_current_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
ret i32 %10
}
/* Variables and functions */
scalar_t__ malloc(unsigned int);
scalar_t__ realloc(void *, unsigned int);
void *T_realloc(void *block, unsigned int len) {
  if (block == NULL)
    return (void *)malloc(len ? len : 1);
  return (void *)realloc(block, len);
}


x86 assembly (clang, -O0):
<T_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116d <T_realloc+0x4d>
cmpl   $0x0,-0x14(%rbp)
je     114f <T_realloc+0x2f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    115c <T_realloc+0x3c>
mov    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <T_realloc+0x3c>
mov    -0x18(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
jmp    117d <T_realloc+0x5d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<T_realloc>:
push   %rax
test   %rdi,%rdi
je     112d <T_realloc+0xd>
call   1040 <realloc@plt>
pop    %rcx
ret
test   %esi,%esi
mov    $0x1,%edi
cmovne %esi,%edi
call   1030 <malloc@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @T_realloc(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = icmp eq i32 %1, 0
%6 = select i1 %5, i32 1, i32 %1
%7 = tail call i64 @malloc(i32 %6)
br label %10
8: ; preds = %2
%9 = tail call i64 @realloc(i8* %0, i32 %1)
br label %10
10: ; preds = %8, %4
%11 = phi i64 [ %7, %4 ], [ %9, %8 ]
%12 = inttoptr i64 %11 to i8*
ret i8* %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ pm_close(int /*<<< orphan*/ *const);
void pm_closew(FILE *const f) { pm_close(f); }


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

x86 assembly (clang, -O2):
<pm_closew>:
jmp    1030 <pm_close@plt>

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

LLVM IR (-O2):
define void @pm_closew(i32* %0) {
%2 = tail call i32 @pm_close(i32* %0)
ret void
}
/* Variables and functions */
int read(int, char *, int);
int tap_read(int fd, char *buf, int len) { return read(fd, buf, len); }


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

x86 assembly (clang, -O2):
<tap_read>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @tap_read(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Type definitions */
struct ThreadResources {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ updateTickCount(struct ThreadResources *);
void countdownTicks(int tickNo, struct ThreadResources *thResources) {
  int i;
  for (i = 0; i < tickNo; i++) {
    updateTickCount(thResources);
  }
}


x86 assembly (clang, -O0):
<countdownTicks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1149 <countdownTicks+0x39>
mov    -0x10(%rbp),%rdi
call   1030 <updateTickCount@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <countdownTicks+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countdownTicks>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    112d <countdownTicks+0x1d>
mov    %rsi,%rbx
mov    %edi,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <updateTickCount@plt>
add    $0xffffffff,%ebp
jne    1120 <countdownTicks+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.ThreadResources = type { i32 }
define void @countdownTicks(i32 %0, %struct.ThreadResources* %1) {
%3 = alloca i32
%4 = alloca %struct.ThreadResources*
%5 = alloca i32
store i32 %0, i32* %3
store %struct.ThreadResources* %1, %struct.ThreadResources** %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load %struct.ThreadResources*, %struct.ThreadResources** %4
%12 = call i32 @updateTickCount(%struct.ThreadResources* %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.ThreadResources = type { i32 }
define void @countdownTicks(i32 %0, %struct.ThreadResources* %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @updateTickCount(%struct.ThreadResources* %1)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int *);
void __cyg_profile_func_enter(void *this, void *callsite) {
  printf("Enter %p\n", (int *)this);
}


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

x86 assembly (clang, -O2):
<__cyg_profile_func_enter>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Enter %p\0A\00"
define void @__cyg_profile_func_enter(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 = bitcast i8* %5 to i32*
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter %p\0A\00"
define void @__cyg_profile_func_enter(i8* %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %3)
ret void
}
/* Type definitions */
struct user_input_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ user_input_set_state(int /*<<< orphan*/ *);
void help_completion(void *tinst, struct user_input_state *s) {
  user_input_set_state(NULL);
}


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

x86 assembly (clang, -O2):
<help_completion>:
xor    %edi,%edi
jmp    1030 <user_input_set_state@plt>

LLVM IR (-O0):
%struct.user_input_state = type { i32 }
define void @help_completion(i8* %0, %struct.user_input_state* %1) {
%3 = alloca i8*
%4 = alloca %struct.user_input_state*
store i8* %0, i8** %3
store %struct.user_input_state* %1, %struct.user_input_state** %4
%5 = call i32 @user_input_set_state(i32* null)
ret void
}

LLVM IR (-O2):
%struct.user_input_state = type { i32 }
define void @help_completion(i8* nocapture readnone %0, %struct.user_input_state* nocapture readnone %1) {
%3 = tail call i32 @user_input_set_state(i32* null)
ret void
}
/* Variables and functions */
int abs(int);
int smallest_2(int a, int b) { return ((a + b) - abs(a - b)) / 2; }


x86 assembly (clang, -O0):
<smallest_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smallest_2>:
lea    (%rsi,%rdi,1),%eax
sub    %esi,%edi
mov    %edi,%ecx
neg    %ecx
cmovns %edi,%ecx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @smallest_2(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 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %8, %9
%11 = call i32 @abs(i32 %10)
%12 = sub nsw i32 %7, %11
%13 = sdiv i32 %12, 2
ret i32 %13
}

LLVM IR (-O2):
define i32 @smallest_2(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = sub nsw i32 %0, %1
%5 = tail call i32 @llvm.abs.i32(i32 %4, i1 true)
%6 = sub i32 %3, %5
%7 = sdiv i32 %6, 2
ret i32 %7
}
void flushwrite(const char *msg) { ; }


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

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

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

LLVM IR (-O2):
define void @flushwrite(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clearend() { printf("\x1b[K"); }


x86 assembly (clang, -O0):
<clearend>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearend>:
lea    0xee9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[K\00"
define void @clearend() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[K\00"
define void @clearend() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
void ff_hevc_put_hevc_bi_epel_hv48_8_avx2() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_hv48_8_avx2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CC2420TransmitP__ChipSpiResource__releasing();
void CC2420SpiP__ChipSpiResource__releasing(void) {
  CC2420TransmitP__ChipSpiResource__releasing();
}


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

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

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

LLVM IR (-O2):
define void @CC2420SpiP__ChipSpiResource__releasing() {
%1 = tail call i32 (...) @CC2420TransmitP__ChipSpiResource__releasing()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sched_yield();
void *thread(void *arg) {
  while (1)
    sched_yield();
}


x86 assembly (clang, -O0):
<thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <sched_yield@plt>
jmp    111c <thread+0xc>

x86 assembly (clang, -O2):
<thread>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <sched_yield@plt>
jmp    1120 <thread+0x10>

LLVM IR (-O0):
define i8* @thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 (...) @sched_yield()
br label %3
}

LLVM IR (-O2):
define noalias i8* @thread(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 (...) @sched_yield()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M191_f(char *s) {
  debug("M191_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M191_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M191_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M191_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M191_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M191_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M191_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
int shl(int x, int y, int z) {
  int s = y & 63;
  if (s >= 32)
    return 0;
  else
    return x << s;
}


x86 assembly (clang, -O0):
<shl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jl     112c <shl+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1137 <shl+0x37>
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shl>:
mov    %esi,%ecx
and    $0x3f,%ecx
shl    %cl,%edi
xor    %eax,%eax
cmp    $0x20,%ecx
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @shl(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
%9 = load i32, i32* %6
%10 = and i32 %9, 63
store i32 %10, i32* %8
%11 = load i32, i32* %8
%12 = icmp sge i32 %11, 32
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %4
br label %18
14: ; preds = %3
%15 = load i32, i32* %5
%16 = load i32, i32* %8
%17 = shl i32 %15, %16
store i32 %17, i32* %4
br label %18
18: ; preds = %14, %13
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @shl(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, 63
%5 = icmp ugt i32 %4, 31
%6 = shl i32 %0, %4
%7 = select i1 %5, i32 0, i32 %6
ret i32 %7
}
void modify_char_refs_new_syntax(char *first, char *second) {
  (*first)++;
  (*second)--;
}


x86 assembly (clang, -O0):
<modify_char_refs_new_syntax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
add    $0x1,%cl
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
add    $0xff,%cl
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<modify_char_refs_new_syntax>:
addb   $0x1,(%rdi)
addb   $0xff,(%rsi)
ret

LLVM IR (-O0):
define void @modify_char_refs_new_syntax(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* %5
%7 = add i8 %6, 1
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = add i8 %9, -1
store i8 %10, i8* %8
ret void
}

LLVM IR (-O2):
define void @modify_char_refs_new_syntax(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = add i8 %3, 1
store i8 %4, i8* %0
%5 = load i8, i8* %1
%6 = add i8 %5, -1
store i8 %6, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M751_f(char *s) {
  debug("M751_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M751_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M751_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M751_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M751_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M751_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M751_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
main() { __typeof(5) a; }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct vec3i {
  int dummy;
};
struct vec3 {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec3i_floor(int /*<<< orphan*/ *, float *);
__attribute__((always_)) struct vec3i *psvec3i_floor(struct vec3i *result,
                                                     struct vec3 *a) {
  vec3i_floor((int32_t *)result, (float *)a);
  return result;
}


x86 assembly (clang, -O0):
<psvec3i_floor>:
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 <vec3i_floor@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec3i_floor>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec3i_floor@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec3i = type { i32 }
%struct.vec3 = type { i32 }
define %struct.vec3i* @psvec3i_floor(%struct.vec3i* %0, %struct.vec3* %1) {
%3 = alloca %struct.vec3i*
%4 = alloca %struct.vec3*
store %struct.vec3i* %0, %struct.vec3i** %3
store %struct.vec3* %1, %struct.vec3** %4
%5 = load %struct.vec3i*, %struct.vec3i** %3
%6 = bitcast %struct.vec3i* %5 to i32*
%7 = load %struct.vec3*, %struct.vec3** %4
%8 = bitcast %struct.vec3* %7 to float*
%9 = call i32 @vec3i_floor(i32* %6, float* %8)
%10 = load %struct.vec3i*, %struct.vec3i** %3
ret %struct.vec3i* %10
}

LLVM IR (-O2):
%struct.vec3i = type { i32 }
%struct.vec3 = type { i32 }
define %struct.vec3i* @psvec3i_floor(%struct.vec3i* returned %0, %struct.vec3* %1) {
%3 = getelementptr %struct.vec3i, %struct.vec3i* %0, i64 0, i32 0
%4 = bitcast %struct.vec3* %1 to float*
%5 = tail call i32 @vec3i_floor(i32* %3, float* %4)
ret %struct.vec3i* %0
}
/* Variables and functions */
int /*<<< orphan*/ prune_add2(int);
void call_prune_add2_3_Good() { prune_add2(100); }


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

x86 assembly (clang, -O2):
<call_prune_add2_3_Good>:
mov    $0x64,%edi
jmp    1030 <prune_add2@plt>

LLVM IR (-O0):
define void @call_prune_add2_3_Good() {
%1 = call i32 @prune_add2(i32 100)
ret void
}

LLVM IR (-O2):
define void @call_prune_add2_3_Good() {
%1 = tail call i32 @prune_add2(i32 100)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void version_print() {
  char *str = "This is free software; see the source for copying conditions.\n"
              "There is no warranty; not even for MERCHANTABILITY or FITNESS\n"
              "FOR A PARTICULAR PURPOSE.\n";
  printf("Steel v%.1f Copyright (c) Niko Rosvall <niko@byteptr.com>\n", 1.0);
  printf("%s", str);
}


x86 assembly (clang, -O0):
<version_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee9(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xf75(%rip),%rdi
movsd  0xece(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<version_print>:
push   %rax
lea    0xee0(%rip),%rdi
movsd  0xed0(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf05(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [151 x i8] c"This is free software; see the source for copying conditions.\0AThere is no warranty; not even for MERCHANTABILITY or FITNESS\0AFOR A PARTICULAR PURPOSE.\0A\00"
@.str.1 = [59 x i8] c"Steel v%.1f Copyright (c) Niko Rosvall <niko@byteptr.com>\0A\00"
@.str.2 = [3 x i8] c"%s\00"
define void @version_print() {
%1 = alloca i8*
store i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), double 1.000000e+00)
%3 = load i8*, i8** %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str.1 = [59 x i8] c"Steel v%.1f Copyright (c) Niko Rosvall <niko@byteptr.com>\0A\00"
@str = [150 x i8] c"This is free software; see the source for copying conditions.\0AThere is no warranty; not even for MERCHANTABILITY or FITNESS\0AFOR A PARTICULAR PURPOSE.\00"
define void @version_print() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), double 1.000000e+00)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([150 x i8], [150 x i8]* @str, i64 0, i64 0))
ret void
}
void XSetWMHints() {}


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

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

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

LLVM IR (-O2):
define void @XSetWMHints() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x32() {
  Assert_real((isgraph(50)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              255, ("isgraph should be 1 for 2"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x32>:
push   %rbp
mov    %rsp,%rbp
mov    $0x32,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0xff,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x32>:
push   %rax
mov    $0x32,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0xff,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for 2\00"
define void @t_isgraph_0x32() {
%1 = call i32 @isgraph(i32 50)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for 2\00"
define void @t_isgraph_0x32() {
%1 = tail call i32 @isgraph(i32 50)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
__attribute__((always_)) int register_one_node(int nid) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @register_one_node(i32 %0) {
ret i32 0
}
/* Variables and functions */
int PAPI_lock(int);
void PAPIF_LOCK(int *lock, int *check) { *check = PAPI_lock(*lock); }


x86 assembly (clang, -O0):
<PAPIF_LOCK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <PAPI_lock@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAPIF_LOCK>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_lock@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @PAPIF_LOCK(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 = load i32, i32* %5
%7 = call i32 @PAPI_lock(i32 %6)
%8 = load i32*, i32** %4
store i32 %7, i32* %8
ret void
}

LLVM IR (-O2):
define void @PAPIF_LOCK(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @PAPI_lock(i32 %3)
store i32 %4, i32* %1
ret void
}
unsigned long long int d2ull(double d) { return (unsigned long long int)d; }


x86 assembly (clang, -O0):
<d2ull>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm2
movaps %xmm0,%xmm1
subsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rcx
cvttsd2si %xmm0,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
and    %rdx,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2ull>:
cvttsd2si %xmm0,%rcx
mov    %rcx,%rdx
sar    $0x3f,%rdx
subsd  0xeec(%rip),%xmm0
cvttsd2si %xmm0,%rax
and    %rdx,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @d2ull(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptoui double %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @d2ull(double %0) {
%2 = fptoui double %0 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ qdcgaReset();
void qdxReset() { qdcgaReset(); }


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

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

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

LLVM IR (-O2):
define void @qdxReset() {
%1 = tail call i32 (...) @qdcgaReset()
ret void
}
int f3(int a) { return a; }


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

x86 assembly (clang, -O2):
<f3>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f3(i32 returned %0) {
ret i32 %0
}
void caller_2_2_2_2_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @caller_2_2_2_2_1_2_1() {
ret void
}
void inst_mc68851_prestore() {
  slog("%s: Error, not implemented!\n", __func__);
  assert(!"blowup");
}


x86 assembly (clang, -O0):
<inst_mc68851_prestore>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xeeb(%rip),%rsi
mov    $0x0,%al
call   1040 <slog@plt>
xor    %edi,%edi
mov    $0x0,%al
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<inst_mc68851_prestore>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
call   1040 <slog@plt>
xor    %edi,%edi
xor    %eax,%eax
pop    %rcx
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"%s: Error, not implemented!\0A\00"
@__func__.inst_mc68851_prestore = [22 x i8] c"inst_mc68851_prestore\00"
@.str.1 = [7 x i8] c"blowup\00"
define void @inst_mc68851_prestore() {
%1 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @slog to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__func__.inst_mc68851_prestore, i64 0, i64 0))
%2 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"%s: Error, not implemented!\0A\00"
@__func__.inst_mc68851_prestore = [22 x i8] c"inst_mc68851_prestore\00"
define void @inst_mc68851_prestore() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @slog to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__func__.inst_mc68851_prestore, i64 0, i64 0))
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
ret void
}
int dummyaudio_RomOpen(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @dummyaudio_RomOpen() {
ret i32 1
}

LLVM IR (-O2):
define i32 @dummyaudio_RomOpen() {
ret i32 1
}
void RTAvlrU64Get(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlrU64Get() {
ret void
}
unsigned long buff_to_uint16(unsigned char const *buff, unsigned int *off) {
  unsigned long val;
  val = (buff[*off + 0] << 8) | buff[*off + 1];
  *off += 2;
  return val;
}


x86 assembly (clang, -O0):
<buff_to_uint16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x0,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    (%rdx),%edx
add    $0x1,%edx
mov    %edx,%edx
movzbl (%rcx,%rdx,1),%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buff_to_uint16>:
mov    (%rsi),%ecx
movzbl (%rdi,%rcx,1),%edx
shl    $0x8,%rdx
lea    0x1(%rcx),%eax
movzbl (%rdi,%rax,1),%eax
or     %rdx,%rax
add    $0x2,%ecx
mov    %ecx,(%rsi)
ret

LLVM IR (-O0):
define i64 @buff_to_uint16(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i64
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = add i32 %8, 0
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %6, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8*, i8** %3
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = add i32 %17, 1
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %15, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = or i32 %14, %22
%24 = sext i32 %23 to i64
store i64 %24, i64* %5
%25 = load i32*, i32** %4
%26 = load i32, i32* %25
%27 = add i32 %26, 2
store i32 %27, i32* %25
%28 = load i64, i64* %5
ret i64 %28
}

LLVM IR (-O2):
define i64 @buff_to_uint16(i8* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %7, 8
%9 = add i32 %3, 1
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = or i64 %8, %13
%15 = add i32 %3, 2
store i32 %15, i32* %1
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
__attribute__((no, noclone)) unsigned short f7(unsigned short x) {
  unsigned short r = (unsigned short)-2 + x;
  if (r > (unsigned short)-2)
    foo(0);
  return r;
}


x86 assembly (clang, -O0):
<f7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0xfffe,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
cmp    $0xfffe,%eax
jle    1142 <f7+0x32>
xor    %edi,%edi
call   1030 <foo@plt>
movzwl -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f7>:
push   %rbx
mov    %edi,%ebx
add    $0xfffffffe,%ebx
cmp    $0xffff,%bx
jne    1123 <f7+0x13>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i16 @f7(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = add nsw i32 65534, %5
%7 = trunc i32 %6 to i16
store i16 %7, i16* %3
%8 = load i16, i16* %3
%9 = zext i16 %8 to i32
%10 = icmp sgt i32 %9, 65534
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @foo(i32 0)
br label %13
13: ; preds = %11, %1
%14 = load i16, i16* %3
ret i16 %14
}

LLVM IR (-O2):
define zeroext i16 @f7(i16 zeroext %0) {
%2 = add i16 %0, -2
%3 = icmp eq i16 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @foo(i32 0)
br label %6
6: ; preds = %4, %1
ret i16 %2
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *strndup(const char *string, size_t len) {
  char *result;
  result = (char *)malloc(len + 1);
  memcpy(result, string, len);
  result[len] = '\0';
  return (result);
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = add i64 %6, 1
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %3
%12 = load i64, i64* %4
%13 = call i32 @memcpy(i8* %10, i8* %11, i64 %12)
%14 = load i8*, i8** %5
%15 = load i64, i64* %4
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @strndup(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %1)
%7 = getelementptr inbounds i8, i8* %5, i64 %1
store i8 0, i8* %7
ret i8* %5
}
unsigned int GetBitFromByte(unsigned char theByte, int index) {
  static unsigned char bitmask[8] = {1, 2, 4, 8, 16, 32, 64, 128};
  return theByte & bitmask[index] >> index;
}


x86 assembly (clang, -O0):
<GetBitFromByte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2f04(%rip),%rcx
movzbl (%rcx,%rdx,1),%edx
mov    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetBitFromByte>:
movslq %esi,%rcx
lea    0xef6(%rip),%rax
movzbl (%rcx,%rax,1),%eax
shr    %cl,%eax
and    %edi,%eax
ret

LLVM IR (-O0):
@GetBitFromByte.bitmask = internal global [8 x i8] c"\01\02\04\08\10 @\80"
define i32 @GetBitFromByte(i8 zeroext %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 = zext i8 %5 to i32
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [8 x i8], [8 x i8]* @GetBitFromByte.bitmask, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i32, i32* %4
%13 = ashr i32 %11, %12
%14 = and i32 %6, %13
ret i32 %14
}

LLVM IR (-O2):
@GetBitFromByte.bitmask = internal unnamed_addr constant [8 x i8] c"\01\02\04\08\10 @\80"
define i32 @GetBitFromByte(i8 zeroext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds [8 x i8], [8 x i8]* @GetBitFromByte.bitmask, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = lshr i32 %7, %1
%9 = and i32 %8, %3
ret i32 %9
}
unsigned char get_on_mask(unsigned int pos) {
  unsigned char array[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
  return array[pos];
}


x86 assembly (clang, -O0):
<get_on_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
movzbl -0xc(%rbp,%rax,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_on_mask>:
mov    %edi,%eax
lea    0xef7(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret

LLVM IR (-O0):
@__const.get_on_mask.array = [8 x i8] c"\01\02\04\08\10 @\80"
define zeroext i8 @get_on_mask(i32 %0) {
%2 = alloca i32
%3 = alloca [8 x i8]
store i32 %0, i32* %2
%4 = bitcast [8 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}

LLVM IR (-O2):
@__const.get_on_mask.array = [8 x i8] c"\01\02\04\08\10 @\80"
define zeroext i8 @get_on_mask(i32 %0) {
%2 = zext i32 %0 to i64
%3 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.get_on_mask.array, i64 0, i64 %2
%4 = load i8, i8* %3
ret i8 %4
}