xunge/DecIR huggingface dataset:
int test_imm_5Auint8_reg(unsigned char val) {
  return ((val) & (0x5A << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Auint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 90
%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_5Auint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 90
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int in_bitmap(int idx, const char *bitmap, int sz) {
  return idx >= 0 && idx < sz && bitmap[idx];
}


x86 assembly (clang, -O0):
<in_bitmap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x15(%rbp)
jl     1143 <in_bitmap+0x43>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x15(%rbp)
jge    1143 <in_bitmap+0x43>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_bitmap>:
xor    %eax,%eax
test   %edi,%edi
js     1115 <in_bitmap+0x15>
cmp    %edx,%edi
jge    1115 <in_bitmap+0x15>
mov    %edi,%ecx
xor    %eax,%eax
cmpb   $0x0,(%rsi,%rcx,1)
setne  %al
ret

LLVM IR (-O0):
define i32 @in_bitmap(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 = icmp sge i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %3
%10 = load i32, i32* %4
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %13, %9, %3
%22 = phi i1 [ false, %9 ], [ false, %3 ], [ %20, %13 ]
%23 = zext i1 %22 to i32
ret i32 %23
}

LLVM IR (-O2):
define i32 @in_bitmap(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %0, -1
%5 = icmp slt i32 %0, %2
%6 = and i1 %4, %5
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = zext i32 %0 to i64
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %7, %3
%14 = phi i32 [ 0, %3 ], [ %12, %7 ]
ret i32 %14
}
void main() {
  int x, y, _x, _y;
  x = _x;
  y = _y;
  if ((-4681 < y) && (y < 4681) && (x < 32767) && (-32767 < x) &&
      ((7 * y * y - 1) == x * x)) {
    y = 1 / x;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0xffffedb7,%eax
cmp    -0x8(%rbp),%eax
jge    116c <main+0x6c>
cmpl   $0x1249,-0x8(%rbp)
jge    116c <main+0x6c>
cmpl   $0x7fff,-0x4(%rbp)
jge    116c <main+0x6c>
mov    $0xffff8001,%eax
cmp    -0x4(%rbp),%eax
jge    116c <main+0x6c>
imul   $0x7,-0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
sub    $0x1,%eax
mov    -0x4(%rbp),%ecx
imul   -0x4(%rbp),%ecx
cmp    %ecx,%eax
jne    116c <main+0x6c>
mov    $0x1,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = load i32, i32* %3
store i32 %5, i32* %1
%6 = load i32, i32* %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = icmp slt i32 -4681, %7
br i1 %8, label %9, label %31
9: ; preds = %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 4681
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = load i32, i32* %1
%14 = icmp slt i32 %13, 32767
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = load i32, i32* %1
%17 = icmp slt i32 -32767, %16
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = load i32, i32* %2
%20 = mul nsw i32 7, %19
%21 = load i32, i32* %2
%22 = mul nsw i32 %20, %21
%23 = sub nsw i32 %22, 1
%24 = load i32, i32* %1
%25 = load i32, i32* %1
%26 = mul nsw i32 %24, %25
%27 = icmp eq i32 %23, %26
br i1 %27, label %28, label %31
28: ; preds = %18
%29 = load i32, i32* %1
%30 = sdiv i32 1, %29
store i32 %30, i32* %2
br label %31
31: ; preds = %28, %18, %15, %12, %9, %0
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
void logger1(int level, const char *fmt, ...) { return; }


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

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

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

LLVM IR (-O2):
define void @logger1(i32 %0, i8* nocapture %1, ...) {
ret void
}
/* Type definitions */
typedef int ushort;

/* Variables and functions */
int rand();
ushort rand16() { return rand() % (1 << 16); }


x86 assembly (clang, -O0):
<rand16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand16>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rand16() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 65536
ret i32 %2
}

LLVM IR (-O2):
define i32 @rand16() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 65536
ret i32 %2
}
int foo(int *u, int i) { return u[i]; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @foo(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @foo(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int beep();
int wrap_beep(void) { return beep(); }


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

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

LLVM IR (-O0):
define i32 @wrap_beep() {
%1 = call i32 (...) @beep()
ret i32 %1
}

LLVM IR (-O2):
define i32 @wrap_beep() {
%1 = tail call i32 (...) @beep()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("USAGE:\n xor file0 file1\n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"USAGE:\0A xor file0 file1\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"USAGE:\0A xor file0 file1\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
int hash_num(x, size)
int x;
int size;
{ return (((((long)(x)) < 0) ? -((long)(x)) : ((long)(x))) % (size)); }


x86 assembly (clang, -O0):
<hash_num>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x0,%rax
jge    112a <hash_num+0x2a>
movslq -0x4(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1132 <hash_num+0x32>
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
cqto
idiv   %rcx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_num>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
movslq %esi,%rcx
mov    %rcx,%rdx
shr    $0x20,%rdx
je     111c <hash_num+0x1c>
xor    %edx,%edx
idiv   %rcx
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @hash_num(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 = sext i32 %5 to i64
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = sub nsw i64 0, %10
br label %15
12: ; preds = %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
br label %15
15: ; preds = %12, %8
%16 = phi i64 [ %11, %8 ], [ %14, %12 ]
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = srem i64 %16, %18
%20 = trunc i64 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @hash_num(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.abs.i32(i32 %0, i1 false)
%4 = zext i32 %3 to i64
%5 = sext i32 %1 to i64
%6 = srem i64 %4, %5
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Variables and functions */
double pow(double, double);
double v3_norm(double v[3]) {
  double norm;
  norm = pow(pow(v[0], 2.0) + pow(v[1], 2.0) + pow(v[2], 2.0), 0.5);
  return norm;
}


x86 assembly (clang, -O0):
<v3_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xedc(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  0xec1(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  0xe9a(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe79(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3_norm>:
movsd  (%rdi),%xmm1
mulsd  %xmm1,%xmm1
movupd 0x8(%rdi),%xmm0
mulpd  %xmm0,%xmm0
addsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xecb(%rip),%xmm1
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @v3_norm(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = call double @pow(double %6, double 2.000000e+00)
%8 = load double*, double** %2
%9 = getelementptr inbounds double, double* %8, i64 1
%10 = load double, double* %9
%11 = call double @pow(double %10, double 2.000000e+00)
%12 = fadd double %7, %11
%13 = load double*, double** %2
%14 = getelementptr inbounds double, double* %13, i64 2
%15 = load double, double* %14
%16 = call double @pow(double %15, double 2.000000e+00)
%17 = fadd double %12, %16
%18 = call double @pow(double %17, double 5.000000e-01)
store double %18, double* %3
%19 = load double, double* %3
ret double %19
}

LLVM IR (-O2):
define double @v3_norm(double* nocapture %0) {
%2 = load double, double* %0
%3 = fmul double %2, %2
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = bitcast double* %4 to <2 x double>*
%6 = load <2 x double>, <2 x double>* %5
%7 = fmul <2 x double> %6, %6
%8 = extractelement <2 x double> %7, i64 0
%9 = fadd double %3, %8
%10 = extractelement <2 x double> %7, i64 1
%11 = fadd double %9, %10
%12 = tail call double @pow(double %11, double 5.000000e-01)
ret double %12
}
int test_imm_E4int32_reg(int val) { return ((val) & (0xE4 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_E4int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xe4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_E4int32_reg(i32 %0) {
%2 = and i32 %0, 228
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int fun(char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  char a[] = "this is a book.";
  printf("%d", fun(a));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <fun@plt>
mov    %eax,%esi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <fun@plt>
lea    0xec2(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [16 x i8] c"this is a book.\00"
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
store i32 0, i32* %1
%3 = bitcast [16 x i8]* %2 to i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @fun(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [16 x i8] c"this is a book.\00"
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @fun(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @getchar()
ret i32 0
}
int s__cat(char *to, const char *s) {
  int i = 0;
  while (s[i])
    to[i] = s[i], i++;
  return i;
}


x86 assembly (clang, -O0):
<s__cat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1149 <s__cat+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <s__cat+0x13>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<s__cat>:
mov    (%rsi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1120 <s__cat+0x20>
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rdi,%rax,1)
movzbl 0x1(%rsi,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <s__cat+0x10>
ret

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

LLVM IR (-O2):
define i32 @s__cat(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = trunc i64 %9 to i32
br label %15
15: ; preds = %13, %2
%16 = phi i32 [ 0, %2 ], [ %14, %13 ]
ret i32 %16
}
unsigned int f18(unsigned int x, unsigned long int y) {
  return (x >> (8 * 4 - y)) ^ (x << y);
}


x86 assembly (clang, -O0):
<f18>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sub    -0x10(%rbp),%rcx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f18>:
mov    %esi,%ecx
neg    %cl
mov    %edi,%eax
shr    %cl,%eax
mov    %esi,%ecx
shl    %cl,%edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @f18(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = load i64, i64* %4
%7 = sub i64 32, %6
%8 = trunc i64 %7 to i32
%9 = lshr i32 %5, %8
%10 = load i32, i32* %3
%11 = load i64, i64* %4
%12 = trunc i64 %11 to i32
%13 = shl i32 %10, %12
%14 = xor i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @f18(i32 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = sub i32 32, %3
%5 = lshr i32 %0, %4
%6 = shl i32 %0, %3
%7 = xor i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, unsigned int);
int main(int argc, char *argv[]) {
  int i = 1;
  unsigned u = 2;
  printf("%d %d\n", i, u);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32 2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __asan_poison_memory_region(char *, int);
int /*<<< orphan*/ assert(int);
char *strcasestr(char *, char *);
int main(int argc, char **argv) {
  char *r = 0;
  char s1[] = "ab";
  char s2[4] = "cba";
  __asan_poison_memory_region((char *)&s2[2], 2);
  r = strcasestr(s1, s2);
  assert(r == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0xeab(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xea3(%rip),%al
mov    %al,-0x19(%rbp)
mov    0xe9b(%rip),%eax
mov    %eax,-0x1f(%rbp)
lea    -0x1f(%rbp),%rdi
add    $0x2,%rdi
mov    $0x2,%esi
call   1030 <__asan_poison_memory_region@plt>
lea    -0x1b(%rbp),%rdi
lea    -0x1f(%rbp),%rsi
call   1050 <strcasestr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x2(%rsp)
movw   $0x6261,(%rsp)
movl   $0x616263,0x4(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x2,%esi
call   1030 <__asan_poison_memory_region@plt>
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   1050 <strcasestr@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.s1 = [3 x i8] c"ab\00"
@__const.main.s2 = [4 x i8] c"cba\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [3 x i8]
%8 = alloca [4 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%9 = bitcast [3 x i8]* %7 to i8*
%10 = bitcast [4 x i8]* %8 to i8*
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 2
%12 = call i32 @__asan_poison_memory_region(i8* %11, i32 2)
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%15 = call i8* @strcasestr(i8* %13, i8* %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = icmp eq i8* %16, null
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s1 = [3 x i8] c"ab\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8]
%4 = alloca i32
%5 = bitcast i32* %4 to [4 x i8]*
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
store i32 6382179, i32* %4
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
%9 = call i32 @__asan_poison_memory_region(i8* %8, i32 2)
%10 = call i8* @strcasestr(i8* %6, i8* %7)
%11 = icmp eq i8* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret i32 0
}
void pop_cbr(int ctx) {}


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

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

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

LLVM IR (-O2):
define void @pop_cbr(i32 %0) {
ret void
}
void UI_get0_user_data(void) {}


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

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

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

LLVM IR (-O2):
define void @UI_get0_user_data() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
void shim_exit_group(int status) { _exit(status); }


x86 assembly (clang, -O0):
<shim_exit_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<shim_exit_group>:
push   %rax
call   1030 <_exit@plt>

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

LLVM IR (-O2):
define void @shim_exit_group(i32 %0) {
%2 = tail call i32 @_exit(i32 %0)
unreachable
}
/* Variables and functions */
double fabs(float const);
int fEqual(const float b, const float a) { return fabs(a - b) < 1.0e-6; }


x86 assembly (clang, -O0):
<fEqual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xec4(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fEqual>:
push   %rax
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
call   1030 <fabs@plt>
movsd  0xedb(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fEqual(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = load float, float* %3
%7 = fsub float %5, %6
%8 = call double @fabs(float %7)
%9 = fcmp olt double %8, 0x3EB0C6F7A0B5ED8D
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @fEqual(float %0, float %1) {
%3 = fsub float %1, %0
%4 = tail call double @fabs(float %3)
%5 = fcmp olt double %4, 0x3EB0C6F7A0B5ED8D
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ _gets(char *);
int level1(void) {
  int a = 0;
  char buf[20];
  _gets(buf);
  if (a == 0x58) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<level1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <_gets@plt>
cmpl   $0x58,-0x8(%rbp)
jne    113e <level1+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1145 <level1+0x35>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<level1>:
sub    $0x18,%rsp
mov    %rsp,%rdi
call   1030 <_gets@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @level1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
store i32 0, i32* %2
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i32 @_gets(i8* %4)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 88
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 0, i32* %1
br label %10
9: ; preds = %0
store i32 1, i32* %1
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @level1() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @_gets(i8* %2)
ret i32 1
}
void omp_set_nested(const int n) {}


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

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

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

LLVM IR (-O2):
define void @omp_set_nested(i32 %0) {
ret void
}
/* Variables and functions */
int strlen(char *string) {
  int length = 0;
  while (*string != 0) {
    string++;
    length++;
  }
  return length;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <strlen+0x39>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int is_prime(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int prime, sample = 0;
  prime = is_prime(sample);
  printf("%d", prime);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <is_prime@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%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
xor    %edi,%edi
call   1040 <is_prime@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @is_prime(i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ psw_write_bit(int, int);
void psw_write_ac(int ac) { psw_write_bit(6, ac); }


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

x86 assembly (clang, -O2):
<psw_write_ac>:
mov    %edi,%esi
mov    $0x6,%edi
jmp    1030 <psw_write_bit@plt>

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

LLVM IR (-O2):
define void @psw_write_ac(i32 %0) {
%2 = tail call i32 @psw_write_bit(i32 6, i32 %0)
ret void
}
unsigned char readIRBit() {
  return ((~(*(unsigned int *)0x50003FFC)) & (1 << (8))) >> 8;
}


x86 assembly (clang, -O0):
<readIRBit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x50003ffc,%eax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    $0x100,%eax
shr    $0x8,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readIRBit>:
mov    0x50003ffd,%al
not    %al
and    $0x1,%al
ret

LLVM IR (-O0):
define zeroext i8 @readIRBit() {
%1 = load i32, i32* inttoptr (i64 1342193660 to i32*)
%2 = xor i32 %1, -1
%3 = and i32 %2, 256
%4 = lshr i32 %3, 8
%5 = trunc i32 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @readIRBit() {
%1 = load i32, i32* inttoptr (i64 1342193660 to i32*)
%2 = lshr i32 %1, 8
%3 = trunc i32 %2 to i8
%4 = and i8 %3, 1
%5 = xor i8 %4, 1
ret i8 %5
}
char charupper(char c) { return c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c; }


x86 assembly (clang, -O0):
<charupper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1136 <charupper+0x36>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jg     1136 <charupper+0x36>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <charupper+0x3d>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<charupper>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @charupper(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 97
%14 = add nsw i32 %13, 65
br label %18
15: ; preds = %6, %1
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
br label %18
18: ; preds = %15, %10
%19 = phi i32 [ %14, %10 ], [ %17, %15 ]
%20 = trunc i32 %19 to i8
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @charupper(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
long long gcdi(long long, long long);
long long llabs(long long);
long long lcmu(long long a, long long b) {
  return (llabs(a) * llabs(b)) / gcdi(llabs(a), llabs(b));
}


x86 assembly (clang, -O0):
<lcmu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <llabs@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <llabs@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <llabs@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <llabs@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1040 <gcdi@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cqto
idiv   %rcx
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcmu>:
push   %rbx
mov    %rdi,%rax
neg    %rax
cmovns %rax,%rdi
mov    %rsi,%rax
neg    %rax
cmovns %rax,%rsi
mov    %rsi,%rbx
imul   %rdi,%rbx
call   1030 <gcdi@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1147 <lcmu+0x37>
mov    %rbx,%rax
cqto
idiv   %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i64 @lcmu(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = call i64 @llabs(i64 %5)
%7 = load i64, i64* %4
%8 = call i64 @llabs(i64 %7)
%9 = mul nsw i64 %6, %8
%10 = load i64, i64* %3
%11 = call i64 @llabs(i64 %10)
%12 = load i64, i64* %4
%13 = call i64 @llabs(i64 %12)
%14 = call i64 @gcdi(i64 %11, i64 %13)
%15 = sdiv i64 %9, %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @lcmu(i64 %0, i64 %1) {
%3 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
%4 = tail call i64 @llvm.abs.i64(i64 %1, i1 true)
%5 = mul nsw i64 %4, %3
%6 = tail call i64 @gcdi(i64 %3, i64 %4)
%7 = sdiv i64 %5, %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ I2C_SLAVE;
scalar_t__ ioctl(int, int /*<<< orphan*/, int);
int i2cSelectSlave(int fd, int slaveAddress) {
  if (ioctl(fd, I2C_SLAVE, slaveAddress) < 0) {
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<i2cSelectSlave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1148 <i2cSelectSlave+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <i2cSelectSlave+0x3e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2cSelectSlave>:
push   %rbx
mov    %esi,%edx
mov    %edi,%ebx
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
test   %rax,%rax
mov    $0xffffffff,%eax
cmovns %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@I2C_SLAVE = global i32 0
define i32 @i2cSelectSlave(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* @I2C_SLAVE
%8 = load i32, i32* %5
%9 = call i64 @ioctl(i32 %6, i32 %7, i32 %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %14
12: ; preds = %2
%13 = load i32, i32* %4
store i32 %13, i32* %3
br label %14
14: ; preds = %12, %11
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@I2C_SLAVE = global i32 0
define i32 @i2cSelectSlave(i32 %0, i32 %1) {
%3 = load i32, i32* @I2C_SLAVE
%4 = tail call i64 @ioctl(i32 %0, i32 %3, i32 %1)
%5 = icmp slt i64 %4, 0
%6 = select i1 %5, i32 -1, i32 %0
ret i32 %6
}
/* Variables and functions */
int string_equal_display_error(void const *, void *);
int check_string(const void *value, void *check_value_data) {
  return string_equal_display_error(value, check_value_data);
}


x86 assembly (clang, -O0):
<check_string>:
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 <string_equal_display_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_string>:
jmp    1030 <string_equal_display_error@plt>

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

LLVM IR (-O2):
define i32 @check_string(i8* %0, i8* %1) {
%3 = tail call i32 @string_equal_display_error(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sim_dram_exit();
int /*<<< orphan*/ sim_flash_exit();
void test_env_exit(void) {
  sim_dram_exit();
  sim_flash_exit();
  exit(0);
}


x86 assembly (clang, -O0):
<test_env_exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sim_dram_exit@plt>
mov    $0x0,%al
call   1040 <sim_flash_exit@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<test_env_exit>:
push   %rax
xor    %eax,%eax
call   1030 <sim_dram_exit@plt>
xor    %eax,%eax
call   1040 <sim_flash_exit@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define void @test_env_exit() {
%1 = call i32 (...) @sim_dram_exit()
%2 = call i32 (...) @sim_flash_exit()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @test_env_exit() {
%1 = tail call i32 (...) @sim_dram_exit()
%2 = tail call i32 (...) @sim_flash_exit()
%3 = tail call i32 @exit(i32 0)
unreachable
}
int return_ketjeJrSize(int len) {
  if (len % 2 == 0) {
    return len - 2;
  } else {
    return len - 1;
  }
}


x86 assembly (clang, -O0):
<return_ketjeJrSize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1129 <return_ketjeJrSize+0x29>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <return_ketjeJrSize+0x32>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_ketjeJrSize>:
mov    %edi,%eax
or     $0xfffffffe,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @return_ketjeJrSize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = srem i32 %4, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 2
store i32 %9, i32* %2
br label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @return_ketjeJrSize(i32 %0) {
%2 = or i32 %0, -2
%3 = add nsw i32 %2, %0
ret i32 %3
}
/* Type definitions */
struct sock {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __tcp_init_westwood(struct sock *);
void tcp_init_westwood(struct sock *sk) { __tcp_init_westwood(sk); }


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

x86 assembly (clang, -O2):
<tcp_init_westwood>:
jmp    1030 <__tcp_init_westwood@plt>

LLVM IR (-O0):
%struct.sock = type { i32 }
define void @tcp_init_westwood(%struct.sock* %0) {
%2 = alloca %struct.sock*
store %struct.sock* %0, %struct.sock** %2
%3 = load %struct.sock*, %struct.sock** %2
%4 = call i32 @__tcp_init_westwood(%struct.sock* %3)
ret void
}

LLVM IR (-O2):
%struct.sock = type { i32 }
define void @tcp_init_westwood(%struct.sock* %0) {
%2 = tail call i32 @__tcp_init_westwood(%struct.sock* %0)
ret void
}
/* Variables and functions */
char *wceex_strerror(int errnum) { return ""; }


x86 assembly (clang, -O0):
<wceex_strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wceex_strerror>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @wceex_strerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @wceex_strerror(i32 %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ timespecsub(struct timespec *, struct timespec *,
                               struct timespec *);
struct timespec timespec_sub(struct timespec a, struct timespec b) {
  struct timespec d;
  timespecsub(&a, &b, &d);
  return d;
}


x86 assembly (clang, -O0):
<timespec_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x10(%rbp)
mov    %esi,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <timespecsub@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_sub>:
sub    $0x18,%rsp
mov    %edi,0x8(%rsp)
mov    %esi,(%rsp)
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
lea    0x10(%rsp),%rdx
call   1030 <timespecsub@plt>
mov    0x10(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @timespec_sub(i32 %0, i32 %1) {
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
%5 = alloca %struct.timespec
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
store i32 %0, i32* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
store i32 %1, i32* %7
%8 = call i32 @timespecsub(%struct.timespec* %4, %struct.timespec* %5, %struct.timespec* %3)
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @timespec_sub(i32 %0, i32 %1) {
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
%5 = alloca %struct.timespec
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
store i32 %0, i32* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 0
store i32 %1, i32* %7
%8 = call i32 @timespecsub(%struct.timespec* %4, %struct.timespec* %5, %struct.timespec* %3)
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%10 = load i32, i32* %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ IFF_UP;
int ifc_set_flags(char const *, int /*<<< orphan*/, int /*<<< orphan*/);
int ifc_up(const char *name) { return ifc_set_flags(name, IFF_UP, 0); }


x86 assembly (clang, -O0):
<ifc_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <ifc_set_flags@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifc_up>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <ifc_set_flags@plt>

LLVM IR (-O0):
@IFF_UP = global i32 0
define i32 @ifc_up(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @IFF_UP
%5 = call i32 @ifc_set_flags(i8* %3, i32 %4, i32 0)
ret i32 %5
}

LLVM IR (-O2):
@IFF_UP = global i32 0
define i32 @ifc_up(i8* %0) {
%2 = load i32, i32* @IFF_UP
%3 = tail call i32 @ifc_set_flags(i8* %0, i32 %2, i32 0)
ret i32 %3
}
/* Variables and functions */
double genrand_int32(unsigned long *, unsigned long *);
double genrand_real2(unsigned long mt[], unsigned long *mtiPtr) {
  return genrand_int32(mt, mtiPtr) * (1.0 / 4294967296.0);
}


x86 assembly (clang, -O0):
<genrand_real2>:
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 <genrand_int32@plt>
movsd  0xecb(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genrand_real2>:
push   %rax
call   1030 <genrand_int32@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @genrand_real2(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
store i64* %0, i64** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %3
%6 = load i64*, i64** %4
%7 = call double @genrand_int32(i64* %5, i64* %6)
%8 = fmul double %7, 0x3DF0000000000000
ret double %8
}

LLVM IR (-O2):
define double @genrand_real2(i64* %0, i64* %1) {
%3 = tail call double @genrand_int32(i64* %0, i64* %1)
%4 = fmul double %3, 0x3DF0000000000000
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void emms() {
  db(0x0F);
  db(0x77);
}


x86 assembly (clang, -O0):
<emms>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0x77,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emms>:
push   %rax
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0x77,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @emms() {
%1 = call i32 @db(i32 15)
%2 = call i32 @db(i32 119)
ret void
}

LLVM IR (-O2):
define void @emms() {
%1 = tail call i32 @db(i32 15)
%2 = tail call i32 @db(i32 119)
ret void
}
/* Type definitions */
struct rcu_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ call_rcu_sched(struct rcu_head *,
                                  void (*)(struct rcu_head *));
void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) {
  call_rcu_sched(head, func);
}


x86 assembly (clang, -O0):
<call_rcu>:
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 <call_rcu_sched@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_rcu>:
jmp    1030 <call_rcu_sched@plt>

LLVM IR (-O0):
%struct.rcu_head = type { i32 }
define void @call_rcu(%struct.rcu_head* %0, void (%struct.rcu_head*)* %1) {
%3 = alloca %struct.rcu_head*
%4 = alloca void (%struct.rcu_head*)*
store %struct.rcu_head* %0, %struct.rcu_head** %3
store void (%struct.rcu_head*)* %1, void (%struct.rcu_head*)** %4
%5 = load %struct.rcu_head*, %struct.rcu_head** %3
%6 = load void (%struct.rcu_head*)*, void (%struct.rcu_head*)** %4
%7 = call i32 @call_rcu_sched(%struct.rcu_head* %5, void (%struct.rcu_head*)* %6)
ret void
}

LLVM IR (-O2):
%struct.rcu_head = type { i32 }
define void @call_rcu(%struct.rcu_head* %0, void (%struct.rcu_head*)* %1) {
%3 = tail call i32 @call_rcu_sched(%struct.rcu_head* %0, void (%struct.rcu_head*)* %1)
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
uint64_t MWC_AddMod64(uint64_t a, uint64_t b, uint64_t M) {
  uint64_t v = a + b;
  if ((v >= M) || (v < a))
    v = v - M;
  return v;
}


x86 assembly (clang, -O0):
<MWC_AddMod64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1138 <MWC_AddMod64+0x38>
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    1144 <MWC_AddMod64+0x44>
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MWC_AddMod64>:
lea    (%rdi,%rsi,1),%rax
xor    %ecx,%ecx
cmp    %rdx,%rax
cmovge %rdx,%rcx
test   %rsi,%rsi
cmovs  %rdx,%rcx
sub    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @MWC_AddMod64(i64 %0, i64 %1, i64 %2) {
%4 = add nsw i64 %1, %0
%5 = icmp sge i64 %4, %2
%6 = icmp slt i64 %1, 0
%7 = or i1 %6, %5
%8 = select i1 %7, i64 %2, i64 0
%9 = sub nsw i64 %4, %8
ret i64 %9
}