xunge/DecIR huggingface dataset:
/* Variables and functions */
char *CuStrAlloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *CuStrCopy(const char *old) {
  int len = (int)strlen(old);
  char *newStr = CuStrAlloc(len + 1);
  strcpy(newStr, old);
  return newStr;
}


x86 assembly (clang, -O0):
<CuStrCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <CuStrAlloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CuStrCopy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <CuStrAlloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @CuStrCopy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = trunc i64 %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = call i8* @CuStrAlloc(i32 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = load i8*, i8** %4
ret i8* %14
}

LLVM IR (-O2):
define i8* @CuStrCopy(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add nsw i32 %3, 1
%5 = tail call i8* @CuStrAlloc(i32 %4)
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ __gmp_exception(int);
void __gmp_sqrt_of_negative(void) {
  { __gmp_exception(4); }
}


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

x86 assembly (clang, -O2):
<__gmp_sqrt_of_negative>:
mov    $0x4,%edi
jmp    1030 <__gmp_exception@plt>

LLVM IR (-O0):
define void @__gmp_sqrt_of_negative() {
%1 = call i32 @__gmp_exception(i32 4)
ret void
}

LLVM IR (-O2):
define void @__gmp_sqrt_of_negative() {
%1 = tail call i32 @__gmp_exception(i32 4)
ret void
}
/* Variables and functions */
size_t vec_next_capacity(size_t req_size) {
  size_t next_power = req_size;
  size_t num_bits = sizeof(size_t) * 8;
  size_t bit_n;
  next_power--;
  for (bit_n = 1; bit_n < num_bits; bit_n = bit_n << 1)
    next_power = next_power | (next_power >> bit_n);
  next_power++;
  return next_power;
}


x86 assembly (clang, -O0):
<vec_next_capacity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x40,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1164 <vec_next_capacity+0x64>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
shr    %cl,%rdx
mov    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <vec_next_capacity+0x2c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_next_capacity>:
lea    -0x1(%rdi),%rax
mov    %rax,%rcx
shr    %rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x2,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x8,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x10,%rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x20,%rax
or     %rcx,%rax
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @vec_next_capacity(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
%6 = load i64, i64* %2
store i64 %6, i64* %3
store i64 64, i64* %4
%7 = load i64, i64* %3
%8 = add i64 %7, -1
store i64 %8, i64* %3
store i64 1, i64* %5
br label %9
9: ; preds = %19, %1
%10 = load i64, i64* %5
%11 = load i64, i64* %4
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i64, i64* %3
%15 = load i64, i64* %3
%16 = load i64, i64* %5
%17 = lshr i64 %15, %16
%18 = or i64 %14, %17
store i64 %18, i64* %3
br label %19
19: ; preds = %13
%20 = load i64, i64* %5
%21 = shl i64 %20, 1
store i64 %21, i64* %5
br label %9
22: ; preds = %9
%23 = load i64, i64* %3
%24 = add i64 %23, 1
store i64 %24, i64* %3
%25 = load i64, i64* %3
ret i64 %25
}

LLVM IR (-O2):
define i64 @vec_next_capacity(i64 %0) {
%2 = add i64 %0, -1
%3 = lshr i64 %2, 1
%4 = or i64 %3, %2
%5 = lshr i64 %4, 2
%6 = or i64 %5, %4
%7 = lshr i64 %6, 4
%8 = or i64 %7, %6
%9 = lshr i64 %8, 8
%10 = or i64 %9, %8
%11 = lshr i64 %10, 16
%12 = or i64 %11, %10
%13 = lshr i64 %12, 32
%14 = or i64 %13, %12
%15 = add i64 %14, 1
ret i64 %15
}
/* Variables and functions */
scalar_t__ strstr(char const *, char const *);
long long check(const char *in, const char *str) {
  return strstr(in, str) ? 1 : 0;
}


x86 assembly (clang, -O0):
<check>:
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 <strstr@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rax
call   1030 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @check(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 i64 @strstr(i8* %5, i8* %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
%11 = sext i32 %10 to i64
ret i64 %11
}

LLVM IR (-O2):
define i64 @check(i8* %0, i8* %1) {
%3 = tail call i64 @strstr(i8* %0, i8* %1)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i64
ret i64 %5
}
void widgets_update() {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @sws_get_class() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ function(int, int);
int /*<<< orphan*/ printf(char *);
int main() {
  function(1, 2);
  printf("This is where the return address points\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <function@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [41 x i8] c"This is where the return address points\0A\00"
define i32 @main() {
%1 = call i32 @function(i32 1, i32 2)
%2 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [40 x i8] c"This is where the return address points\00"
define i32 @main() {
%1 = tail call i32 @function(i32 1, i32 2)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret i32 0
}
__attribute__((always_)) void baz() {}


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

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

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

LLVM IR (-O2):
define void @baz() {
ret void
}
int test_imm_DEuint8_reg(unsigned char val) {
  return ((val) & (0xDE << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_DEuint8_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, 222
%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_DEuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -34
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ __native_flush_tlb();
int /*<<< orphan*/ __native_flush_tlb_single(unsigned long);
__attribute__((always_)) void __flush_tlb_one(unsigned long addr) {
  if (1)
    __native_flush_tlb_single(addr);
  else
    __native_flush_tlb();
}


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

x86 assembly (clang, -O2):
<__flush_tlb_one>:
jmp    1030 <__native_flush_tlb_single@plt>

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

LLVM IR (-O2):
define void @__flush_tlb_one(i64 %0) {
%2 = tail call i32 @__native_flush_tlb_single(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
void strcat_symbolic_src_length(char *src) {
  char dst[8] = "1234";
  strcat(dst, src);
  if (strlen(dst) < 4)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<strcat_symbolic_src_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcat@plt>
lea    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
jge    1156 <strcat_symbolic_src_length+0x36>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat_symbolic_src_length>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rsi
movq   $0x34333231,0x8(%rsp)
33 34
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.strcat_symbolic_src_length.dst = [8 x i8] c"1234\00\00\00\00"
define void @strcat_symbolic_src_length(i8* %0) {
%2 = alloca i8*
%3 = alloca [8 x i8]
store i8* %0, i8** %2
%4 = bitcast [8 x i8]* %3 to i8*
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @strcat(i8* %5, i8* %6)
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i8, i8* null
br label %13
13: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
define void @strcat_symbolic_src_length(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 875770417, i64* %2
%4 = call i32 @strcat(i8* %3, i8* %0)
%5 = call i32 @strlen(i8* %3)
ret void
}
/* Variables and functions */
int atoi(char const *);
int /*<<< orphan*/ bintree_test(int);
int /*<<< orphan*/ llist_test(int);
int /*<<< orphan*/ queue_test(int);
int /*<<< orphan*/ stack_test(int);
int main(int argc, char const *argv[]) {
  int n_repetitions = (argc < 2) ? 100 : atoi(argv[1]);
  llist_test(n_repetitions);
  stack_test(n_repetitions);
  queue_test(n_repetitions);
  bintree_test(n_repetitions);
  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)
cmpl   $0x2,-0x8(%rbp)
jge    117d <main+0x2d>
mov    $0x64,%eax
mov    %eax,-0x18(%rbp)
jmp    118d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <llist_test@plt>
mov    -0x14(%rbp),%edi
call   1030 <stack_test@plt>
mov    -0x14(%rbp),%edi
call   1050 <queue_test@plt>
mov    -0x14(%rbp),%edi
call   1070 <bintree_test@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%ebx
cmp    $0x2,%edi
jl     1166 <main+0x16>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    %ebx,%edi
call   1040 <llist_test@plt>
mov    %ebx,%edi
call   1030 <stack_test@plt>
mov    %ebx,%edi
call   1050 <queue_test@plt>
mov    %ebx,%edi
call   1070 <bintree_test@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
br label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
br label %15
15: ; preds = %10, %9
%16 = phi i32 [ 100, %9 ], [ %14, %10 ]
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = call i32 @llist_test(i32 %17)
%19 = load i32, i32* %6
%20 = call i32 @stack_test(i32 %19)
%21 = load i32, i32* %6
%22 = call i32 @queue_test(i32 %21)
%23 = load i32, i32* %6
%24 = call i32 @bintree_test(i32 %23)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 100, %2 ]
%10 = tail call i32 @llist_test(i32 %9)
%11 = tail call i32 @stack_test(i32 %9)
%12 = tail call i32 @queue_test(i32 %9)
%13 = tail call i32 @bintree_test(i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int check_isort(int argc, char *argv[]) {
  { printf("NOT OMP\n"); }
  return 0;
}


x86 assembly (clang, -O0):
<check_isort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"NOT OMP\0A\00"
define i32 @check_isort(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [8 x i8] c"NOT OMP\00"
define i32 @check_isort(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef char wint_t;

/* Variables and functions */
scalar_t__ iswupper(char);
wint_t towlower(wint_t wc) {
  if (iswupper(wc)) {
    return wc - 'A' + 'a';
  }
  return wc;
}


x86 assembly (clang, -O0):
<towlower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%edi
call   1030 <iswupper@plt>
cmp    $0x0,%rax
je     1143 <towlower+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %al,-0x1(%rbp)
jmp    1149 <towlower+0x39>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<towlower>:
push   %rbx
mov    %edi,%ebx
call   1030 <iswupper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @towlower(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @iswupper(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 65
%11 = add nsw i32 %10, 97
%12 = trunc i32 %11 to i8
store i8 %12, i8* %2
br label %15
13: ; preds = %1
%14 = load i8, i8* %3
store i8 %14, i8* %2
br label %15
15: ; preds = %13, %7
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @towlower(i8 signext %0) {
%2 = tail call i64 @iswupper(i8 signext %0)
%3 = icmp eq i64 %2, 0
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}
int is_even(int num) { return !(num % 2); }


x86 assembly (clang, -O0):
<is_even>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_even>:
mov    %edi,%eax
not    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @is_even(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_even(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 1
ret i32 %3
}
void omap_hsmmc_init(struct omap2_hsmmc_info *info) {}


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

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

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

LLVM IR (-O2):
%struct.omap2_hsmmc_info = type opaque
define void @omap_hsmmc_init(%struct.omap2_hsmmc_info* nocapture %0) {
ret void
}
int test_imm_F9uint16_mem(unsigned short *val) {
  return ((*val) & (-0xF9 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F9uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffff07,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F9uint16_mem>:
movzwl (%rdi),%eax
test   $0xff07,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F9uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -249
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int EMU68_debugmode(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @EMU68_debugmode() {
ret i32 0
}

LLVM IR (-O2):
define i32 @EMU68_debugmode() {
ret i32 0
}
/* Type definitions */
struct rh_kabi_structs_7_0 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void rh_kabi_7_0(struct rh_kabi_structs_7_0 *rh_kabi_structs_7_0) {
  panic("Problem exists between keyboard and your seat.");
}


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

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

LLVM IR (-O0):
%struct.rh_kabi_structs_7_0 = type { i32 }
@.str = [47 x i8] c"Problem exists between keyboard and your seat.\00"
define void @rh_kabi_7_0(%struct.rh_kabi_structs_7_0* %0) {
%2 = alloca %struct.rh_kabi_structs_7_0*
store %struct.rh_kabi_structs_7_0* %0, %struct.rh_kabi_structs_7_0** %2
%3 = call i32 @panic(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.rh_kabi_structs_7_0 = type { i32 }
@.str = [47 x i8] c"Problem exists between keyboard and your seat.\00"
define void @rh_kabi_7_0(%struct.rh_kabi_structs_7_0* nocapture readnone %0) {
%2 = tail call i32 @panic(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
int genrand() { return (rand()); }


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

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

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

LLVM IR (-O2):
define i32 @genrand() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ LCD_SHOW_STRING(int /*<<< orphan*/, int, char *);
void nrf24l01p_irq_max_rt_handle() {
  LCD_SHOW_STRING(0, 1, "****FUCK MAX****");
}


x86 assembly (clang, -O0):
<nrf24l01p_irq_max_rt_handle>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x1,%esi
lea    0xede(%rip),%rdx
call   1030 <LCD_SHOW_STRING@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf24l01p_irq_max_rt_handle>:
lea    0xee9(%rip),%rdx
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <LCD_SHOW_STRING@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"****FUCK MAX****\00"
define void @nrf24l01p_irq_max_rt_handle() {
%1 = call i32 @LCD_SHOW_STRING(i32 0, i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"****FUCK MAX****\00"
define void @nrf24l01p_irq_max_rt_handle() {
%1 = tail call i32 @LCD_SHOW_STRING(i32 0, i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ add_word(char *);
void cm_print(int arg) {
  if (arg == 1)
    add_word("-|");
}


x86 assembly (clang, -O0):
<cm_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1131 <cm_print+0x21>
lea    0xed4(%rip),%rdi
call   1030 <add_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cm_print>:
cmp    $0x1,%edi
jne    1121 <cm_print+0x11>
lea    0xee4(%rip),%rdi
jmp    1030 <add_word@plt>
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-|\00"
define void @cm_print(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @add_word(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"-|\00"
define void @cm_print(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @add_word(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret void
}
int isspace(int c) { return (c == 0x20) || (c >= 0x09 && c <= 0xd); }


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1135 <isspace+0x35>
xor    %eax,%eax
cmpl   $0x9,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     112f <isspace+0x2f>
cmpl   $0xd,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
cmp    $0x20,%edi
sete   %al
add    $0xfffffff7,%edi
cmp    $0x5,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isspace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 32
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 9
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 13
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
br label %13
13: ; preds = %11, %1
%14 = phi i1 [ true, %1 ], [ %12, %11 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = add i32 %0, -9
%4 = icmp ult i32 %3, 5
%5 = or i1 %2, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vl_func();
void nouveau_drm_screen_create(void) {
  printf("DRI: screen_create\n");
  vl_func();
}


x86 assembly (clang, -O0):
<nouveau_drm_screen_create>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <vl_func@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nouveau_drm_screen_create>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <vl_func@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"DRI: screen_create\0A\00"
define void @nouveau_drm_screen_create() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @vl_func()
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"DRI: screen_create\00"
define void @nouveau_drm_screen_create() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @vl_func()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage(const char *argv[]) { fprintf(stderr, "usage: \n"); }


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"usage: \0A\00"
define void @print_usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"usage: \0A\00"
define void @print_usage(i8** nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0x2e() {
  Assert_real((isupper(46) == 0),
              "/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_isupper.c",
              235, ("isupper should be 0 for ."));
}


x86 assembly (clang, -O0):
<t_isupper_0x2e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2e,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0xeb,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0x2e>:
push   %rax
mov    $0x2e,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xeb,%edx
pop    %rax
jmp    1040 <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_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 0 for .\00"
define void @t_isupper_0x2e() {
%1 = call i64 @isupper(i32 46)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 235, 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_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 0 for .\00"
define void @t_isupper_0x2e() {
%1 = tail call i64 @isupper(i32 46)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 235, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *_strdup(char *);
char *strrchr(char *, char);
char *glmDirName(char *path) {
  char *dir;
  char *s;
  dir = _strdup(path);
  s = strrchr(dir, '/');
  if (s)
    s[1] = '\0';
  else
    dir[0] = '\0';
  return dir;
}


x86 assembly (clang, -O0):
<glmDirName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <_strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1163 <glmDirName+0x43>
mov    -0x18(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    116a <glmDirName+0x4a>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmDirName>:
push   %rbx
call   1040 <_strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
movb   $0x0,(%rcx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @glmDirName(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @_strdup(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @strrchr(i8* %7, i8 signext 47)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8 0, i8* %13
br label %17
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 0
store i8 0, i8* %16
br label %17
17: ; preds = %14, %11
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @glmDirName(i8* %0) {
%2 = tail call i8* @_strdup(i8* %0)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %2, i8 signext 47)
%4 = icmp eq i8* %3, null
%5 = getelementptr inbounds i8, i8* %3, i64 1
%6 = select i1 %4, i8* %2, i8* %5
store i8 0, i8* %6
ret i8* %2
}
/* Variables and functions */
char *concat_path(char const *, char *);
char *getenv(char *);
char *get_config_dir(void) {
  const char *home = getenv("HOME");
  if (home == NULL)
    return NULL;
  return concat_path(home, ".japlay");
}


x86 assembly (clang, -O0):
<get_config_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <get_config_dir+0x30>
movq   $0x0,-0x8(%rbp)
jmp    1164 <get_config_dir+0x44>
mov    -0x10(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <concat_path@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_config_dir>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1142 <get_config_dir+0x22>
lea    0xecc(%rip),%rsi
mov    %rax,%rdi
pop    %rax
jmp    1040 <concat_path@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [8 x i8] c".japlay\00"
define i8* @get_config_dir() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %0
store i8* null, i8** %1
br label %10
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i8* @concat_path(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i8* %9, i8** %1
br label %10
10: ; preds = %7, %6
%11 = load i8*, i8** %1
ret i8* %11
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [8 x i8] c".japlay\00"
define i8* @get_config_dir() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i8* @concat_path(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = phi i8* [ %4, %3 ], [ null, %0 ]
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_prompt(const char *prompt) {
  printf("\x1b[%dm", 1);
  printf("\x1b[%dm", 34);
  printf("%s", prompt);
  printf("\x1b[%dm", 0);
}


x86 assembly (clang, -O0):
<print_prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x22,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_prompt>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x22,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dm\00"
@.str.1 = [3 x i8] c"%s\00"
define void @print_prompt(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 34)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
void *memchr(void const *src, int c, size_t n) {
  unsigned char const *s;
  s = src;
  while (n) {
    if (*s == c) {
      return ((void *)s);
    }
    ++s;
    --n;
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<memchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     115c <memchr+0x5c>
mov    -0x28(%rbp),%rax
movzbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    113f <memchr+0x3f>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1164 <memchr+0x64>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1117 <memchr+0x17>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memchr>:
test   %rdx,%rdx
je     1121 <memchr+0x21>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
cmp    %esi,%ecx
je     1123 <memchr+0x23>
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    1110 <memchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @memchr(i8* %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3, %11
%6 = phi i8* [ %12, %11 ], [ %0, %3 ]
%7 = phi i64 [ %13, %11 ], [ %2, %3 ]
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = icmp eq i32 %9, %1
br i1 %10, label %15, label %11
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = add i64 %7, -1
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %11, %3
%16 = phi i8* [ null, %3 ], [ null, %11 ], [ %6, %5 ]
ret i8* %16
}
/* Variables and functions */
int /*<<< orphan*/ test(int);
int main(void) {
  test(-3);
  test(-2);
  test(-1);
  test(0);
  test(1);
  test(2);
  test(3);
  test(4);
  test(5);
  test(6);
  test(7);
  test(8);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffd,%edi
call   1030 <test@plt>
mov    $0xfffffffe,%edi
call   1030 <test@plt>
mov    $0xffffffff,%edi
call   1030 <test@plt>
xor    %edi,%edi
call   1030 <test@plt>
mov    $0x1,%edi
call   1030 <test@plt>
mov    $0x2,%edi
call   1030 <test@plt>
mov    $0x3,%edi
call   1030 <test@plt>
mov    $0x4,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0x6,%edi
call   1030 <test@plt>
mov    $0x7,%edi
call   1030 <test@plt>
mov    $0x8,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xfffffffd,%edi
call   1030 <test@plt>
mov    $0xfffffffe,%edi
call   1030 <test@plt>
mov    $0xffffffff,%edi
call   1030 <test@plt>
xor    %edi,%edi
call   1030 <test@plt>
mov    $0x1,%edi
call   1030 <test@plt>
mov    $0x2,%edi
call   1030 <test@plt>
mov    $0x3,%edi
call   1030 <test@plt>
mov    $0x4,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0x6,%edi
call   1030 <test@plt>
mov    $0x7,%edi
call   1030 <test@plt>
mov    $0x8,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @test(i32 -3)
%2 = call i32 @test(i32 -2)
%3 = call i32 @test(i32 -1)
%4 = call i32 @test(i32 0)
%5 = call i32 @test(i32 1)
%6 = call i32 @test(i32 2)
%7 = call i32 @test(i32 3)
%8 = call i32 @test(i32 4)
%9 = call i32 @test(i32 5)
%10 = call i32 @test(i32 6)
%11 = call i32 @test(i32 7)
%12 = call i32 @test(i32 8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test(i32 -3)
%2 = tail call i32 @test(i32 -2)
%3 = tail call i32 @test(i32 -1)
%4 = tail call i32 @test(i32 0)
%5 = tail call i32 @test(i32 1)
%6 = tail call i32 @test(i32 2)
%7 = tail call i32 @test(i32 3)
%8 = tail call i32 @test(i32 4)
%9 = tail call i32 @test(i32 5)
%10 = tail call i32 @test(i32 6)
%11 = tail call i32 @test(i32 7)
%12 = tail call i32 @test(i32 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ arch_local_irq_restore(int /*<<< orphan*/);
unsigned long arch_local_save_flags();
unsigned long arch_local_irq_save(void) {
  unsigned long flags;
  flags = arch_local_save_flags();
  arch_local_irq_restore(0);
  return flags;
}


x86 assembly (clang, -O0):
<arch_local_irq_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <arch_local_save_flags@plt>
mov    %rax,-0x8(%rbp)
xor    %edi,%edi
call   1030 <arch_local_irq_restore@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_local_irq_save>:
push   %rbx
xor    %eax,%eax
call   1040 <arch_local_save_flags@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1030 <arch_local_irq_restore@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @arch_local_irq_save() {
%1 = alloca i64
%2 = call i64 (...) @arch_local_save_flags()
store i64 %2, i64* %1
%3 = call i32 @arch_local_irq_restore(i32 0)
%4 = load i64, i64* %1
ret i64 %4
}

LLVM IR (-O2):
define i64 @arch_local_irq_save() {
%1 = tail call i64 (...) @arch_local_save_flags()
%2 = tail call i32 @arch_local_irq_restore(i32 0)
ret i64 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ divisors;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ read(int, int *, int);
void read_divisor(int i, int *pipes) {
  int divisors;
  close(pipes[1]);
  read(pipes[0], &divisors, sizeof(divisors));
  printf("Child %d found %d divisors\n", i, divisors);
  close(pipes[0]);
}


x86 assembly (clang, -O0):
<read_divisor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <close@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1050 <read@plt>
mov    -0x4(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_divisor>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x4(%rsi),%edi
call   1040 <close@plt>
mov    (%rbx),%edi
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1050 <read@plt>
mov    0x4(%rsp),%edx
lea    0xea4(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    (%rbx),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <close@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Child %d found %d divisors\0A\00"
define void @read_divisor(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = call i32 @close(i32 %8)
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = call i32 @read(i32 %12, i32* %5, i32 4)
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = call i32 @close(i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Child %d found %d divisors\0A\00"
define void @read_divisor(i32 %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds i32, i32* %1, i64 1
%6 = load i32, i32* %5
%7 = tail call i32 @close(i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @read(i32 %8, i32* %3, i32 4)
%10 = load i32, i32* %3
%11 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %10)
%12 = load i32, i32* %1
%13 = tail call i32 @close(i32 %12)
ret void
}
/* Variables and functions */
int setpgid(int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) { return setpgid(0, 0); }


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

x86 assembly (clang, -O2):
<main>:
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <setpgid@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @setpgid(i32 0, i32 0)
ret i32 %1
}
void foo648() {}


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

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

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

LLVM IR (-O2):
define void @foo648() {
ret void
}
__attribute__((unused)) unsigned int strlen(const char *s) {
  unsigned int count, i0;
  asm volatile("cld \n\t"
               "repne scasb"
               : "=&D"(i0), "=&c"(count)
               : "0"(s), "a"(0), "1"(0xffffffff));
  return 0xffffffff - count - 1;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    $0xffffffff,%ecx
cld
repnz scas %es:(%rdi),%al
mov    %edi,%eax
mov    %eax,-0x10(%rbp)
mov    %ecx,-0xc(%rbp)
mov    $0xffffffff,%eax
sub    -0xc(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
xor    %eax,%eax
mov    $0xffffffff,%ecx
cld
repnz scas %es:(%rdi),%al
mov    $0xfffffffe,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call { i8*, i32 } asm sideeffect "cld \0A\09repne scasb", "=&{di},=&{cx},0,{ax},1,~{dirflag},~{fpsr},~{flags}"(i8* %5, i32 0, i32 -1)
%7 = extractvalue { i8*, i32 } %6, 0
%8 = extractvalue { i8*, i32 } %6, 1
%9 = ptrtoint i8* %7 to i64
%10 = trunc i64 %9 to i32
store i32 %10, i32* %4
store i32 %8, i32* %3
%11 = load i32, i32* %3
%12 = sub i32 -1, %11
%13 = sub i32 %12, 1
ret i32 %13
}

LLVM IR (-O2):
define i32 @strlen(i8* %0) {
%2 = tail call { i8*, i32 } asm sideeffect "cld \0A\09repne scasb", "=&{di},=&{cx},0,{ax},1,~{dirflag},~{fpsr},~{flags}"(i8* %0, i32 0, i32 -1)
%3 = extractvalue { i8*, i32 } %2, 1
%4 = sub i32 -2, %3
ret i32 %4
}
void rop3_66_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk1 = S ^ *D;
  stk2 = T ^ *D;
  stk1 = stk1 & stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_66_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xa(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_66_1_0>:
mov    (%rdi),%al
xor    %al,%dl
or     %sil,%dl
and    %al,%dl
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_66_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = xor i32 %10, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %7
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = xor i32 %17, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8, i8* %7
%24 = zext i8 %23 to i32
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = and i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = load i8, i8* %5
%32 = zext i8 %31 to i32
%33 = xor i32 %32, -1
%34 = and i32 %30, %33
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = load i8, i8* %5
%39 = zext i8 %38 to i32
%40 = and i32 %37, %39
%41 = or i32 %34, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %4
store i8 %42, i8* %43
ret void
}

LLVM IR (-O2):
define void @rop3_66_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, %2
%6 = or i8 %5, %1
%7 = and i8 %6, %4
store i8 %7, i8* %0
ret void
}