xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ is_zero_mb(unsigned long);
unsigned long find_next_zero(unsigned long start, unsigned long end) {
  while (start < end) {
    if (is_zero_mb(start))
      break;
    start += (1024ULL * 1024);
  }
  if (start > end)
    start = end;
  return start;
}


x86 assembly (clang, -O0):
<find_next_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1159 <find_next_zero+0x49>
mov    -0x8(%rbp),%rdi
call   1030 <is_zero_mb@plt>
cmp    $0x0,%rax
je     1146 <find_next_zero+0x36>
jmp    1159 <find_next_zero+0x49>
mov    -0x8(%rbp),%rax
add    $0x100000,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <find_next_zero+0x10>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    116f <find_next_zero+0x5f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_next_zero>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
cmp    %rsi,%rdi
jae    1139 <find_next_zero+0x29>
nop
mov    %rbx,%rdi
call   1030 <is_zero_mb@plt>
test   %rax,%rax
jne    1139 <find_next_zero+0x29>
add    $0x100000,%rbx
cmp    %r14,%rbx
jb     1120 <find_next_zero+0x10>
cmp    %r14,%rbx
cmova  %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @find_next_zero(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
br i1 %3, label %4, label %11
4: ; preds = %2, %8
%5 = phi i64 [ %9, %8 ], [ %0, %2 ]
%6 = tail call i64 @is_zero_mb(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = add i64 %5, 1048576
%10 = icmp ult i64 %9, %1
br i1 %10, label %4, label %11
11: ; preds = %8, %4, %2
%12 = phi i64 [ %0, %2 ], [ %5, %4 ], [ %9, %8 ]
%13 = icmp ugt i64 %12, %1
%14 = select i1 %13, i64 %1, i64 %12
ret i64 %14
}
int get_svga_info(struct SVGA_INFO *svga) {
  unsigned short status;
  unsigned long svga_long = (unsigned long)svga;
  unsigned short svga_segment = ((svga_long >> 4) & 0xFFFF);
  unsigned short svga_offset = svga_long & 0xF;
  __asm__ __volatile__("movw %1, %%bx\n"
                       "movw %%bx, %%es\n"
                       "int $0x10\n"
                       : "=a"(status)
                       : "r"(svga_segment), "0"(0x4F00), "D"(svga_offset)
                       : "%bx", "memory");
  if (status & 0x004F) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<get_svga_info>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
shr    $0x4,%rax
and    $0xffff,%rax
mov    %ax,-0x2a(%rbp)
mov    -0x28(%rbp),%rax
and    $0xf,%rax
mov    %ax,-0x2c(%rbp)
mov    -0x2a(%rbp),%cx
mov    -0x2c(%rbp),%di
mov    $0x4f00,%eax
mov    %cx,%bx
mov    %ebx,%es
int    $0x10
mov    %ax,-0x1a(%rbp)
movzwl -0x1a(%rbp),%eax
and    $0x4f,%eax
cmp    $0x0,%eax
je     1163 <get_svga_info+0x63>
movl   $0x0,-0xc(%rbp)
jmp    116a <get_svga_info+0x6a>
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_svga_info>:
push   %rbx
mov    %rdi,%rcx
shr    $0x4,%rcx
and    $0xf,%edi
mov    $0x4f00,%eax
mov    %cx,%bx
mov    %ebx,%es
int    $0x10
and    $0x4f,%eax
cmp    $0x1,%eax
sbb    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.SVGA_INFO = type opaque
define i32 @get_svga_info(%struct.SVGA_INFO* %0) {
%2 = alloca i32
%3 = alloca %struct.SVGA_INFO*
%4 = alloca i16
%5 = alloca i64
%6 = alloca i16
%7 = alloca i16
store %struct.SVGA_INFO* %0, %struct.SVGA_INFO** %3
%8 = load %struct.SVGA_INFO*, %struct.SVGA_INFO** %3
%9 = ptrtoint %struct.SVGA_INFO* %8 to i64
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = lshr i64 %10, 4
%12 = and i64 %11, 65535
%13 = trunc i64 %12 to i16
store i16 %13, i16* %6
%14 = load i64, i64* %5
%15 = and i64 %14, 15
%16 = trunc i64 %15 to i16
store i16 %16, i16* %7
%17 = load i16, i16* %6
%18 = load i16, i16* %7
%19 = call i32 asm sideeffect "movw $1, %bx\0Amovw %bx, %es\0Aint $$0x10\0A", "={ax},r,0,{di},~{bx},~{memory},~{dirflag},~{fpsr},~{flags}"(i16 %17, i32 20224, i16 %18)
%20 = trunc i32 %19 to i16
store i16 %20, i16* %4
%21 = load i16, i16* %4
%22 = zext i16 %21 to i32
%23 = and i32 %22, 79
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %1
store i32 0, i32* %2
br label %27
26: ; preds = %1
store i32 -1, i32* %2
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
%struct.SVGA_INFO = type opaque
define i32 @get_svga_info(%struct.SVGA_INFO* %0) {
%2 = ptrtoint %struct.SVGA_INFO* %0 to i64
%3 = lshr i64 %2, 4
%4 = trunc i64 %3 to i16
%5 = trunc i64 %2 to i16
%6 = and i16 %5, 15
%7 = tail call i32 asm sideeffect "movw $1, %bx\0Amovw %bx, %es\0Aint $$0x10\0A", "={ax},r,0,{di},~{bx},~{memory},~{dirflag},~{fpsr},~{flags}"(i16 %4, i32 20224, i16 %6)
%8 = and i32 %7, 79
%9 = icmp eq i32 %8, 0
%10 = sext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char *, char, char, char, char, char);
int main(void) {
  char *a = "int main(void){char* a=%c%s%c;char c='%c%c';char "
            "b='%c%c';printf(a,b,a,b,c,c,c,b);return(0);}";
  char c = '\\';
  char b = '\"';
  printf(a, b, a, b, c, c, c, b);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
movb   $0x5c,-0x11(%rbp)
movb   $0x22,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x12(%rbp),%sil
mov    -0x10(%rbp),%rdx
mov    -0x12(%rbp),%cl
mov    -0x11(%rbp),%r8b
mov    -0x11(%rbp),%r9b
mov    -0x11(%rbp),%al
movsbl %sil,%esi
movsbl %cl,%ecx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
movsbl -0x12(%rbp),%eax
mov    %eax,0x8(%rsp)
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x22,%esi
mov    %rdi,%rdx
mov    $0x22,%ecx
mov    $0x5c,%r8d
mov    $0x5c,%r9d
push   $0x22
push   $0x5c
call   1030 <printf@plt>
add    $0x10,%rsp
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [94 x i8] c"int main(void){char* a=%c%s%c;char c='%c%c';char b='%c%c';printf(a,b,a,b,c,c,c,b);return(0);}\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
store i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0), i8** %2
store i8 92, i8* %3
store i8 34, i8* %4
%5 = load i8*, i8** %2
%6 = load i8, i8* %4
%7 = load i8*, i8** %2
%8 = load i8, i8* %4
%9 = load i8, i8* %3
%10 = load i8, i8* %3
%11 = load i8, i8* %3
%12 = load i8, i8* %4
%13 = call i32 @printf(i8* %5, i8 signext %6, i8* %7, i8 signext %8, i8 signext %9, i8 signext %10, i8 signext %11, i8 signext %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [94 x i8] c"int main(void){char* a=%c%s%c;char c='%c%c';char b='%c%c';printf(a,b,a,b,c,c,c,b);return(0);}\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0), i8 signext 34, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0), i8 signext 34, i8 signext 92, i8 signext 92, i8 signext 92, i8 signext 34)
ret i32 0
}
int con_debug_leave(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @con_debug_leave() {
ret i32 0
}
/* Variables and functions */
unsigned long ibs_event_to_counter(unsigned int);
unsigned long get_ibs_vci_key(unsigned int event) {
  unsigned long key = ibs_event_to_counter(event);
  if (key == ~0UL || key < 8)
    return ~0UL;
  key = key - 8;
  return key;
}


x86 assembly (clang, -O0):
<get_ibs_vci_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <ibs_event_to_counter@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
je     113d <get_ibs_vci_key+0x2d>
cmpq   $0x8,-0x18(%rbp)
jae    114a <get_ibs_vci_key+0x3a>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    115e <get_ibs_vci_key+0x4e>
mov    -0x18(%rbp),%rax
sub    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ibs_vci_key>:
push   %rax
call   1030 <ibs_event_to_counter@plt>
lea    0x1(%rax),%rcx
add    $0xfffffffffffffff8,%rax
cmp    $0x9,%rcx
mov    $0xffffffffffffffff,%rcx
cmovb  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @get_ibs_vci_key(i32 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @ibs_event_to_counter(i32 %5)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp eq i64 %7, -1
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i64, i64* %4
%11 = icmp ult i64 %10, 8
br i1 %11, label %12, label %13
12: ; preds = %9, %1
store i64 -1, i64* %2
br label %17
13: ; preds = %9
%14 = load i64, i64* %4
%15 = sub i64 %14, 8
store i64 %15, i64* %4
%16 = load i64, i64* %4
store i64 %16, i64* %2
br label %17
17: ; preds = %13, %12
%18 = load i64, i64* %2
ret i64 %18
}

LLVM IR (-O2):
define i64 @get_ibs_vci_key(i32 %0) {
%2 = tail call i64 @ibs_event_to_counter(i32 %0)
%3 = add i64 %2, 1
%4 = icmp ult i64 %3, 9
%5 = add i64 %2, -8
%6 = select i1 %4, i64 -1, i64 %5
ret i64 %6
}
void adis16251_remove_trigger(struct iio_dev *indio_dev) {}


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

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

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

LLVM IR (-O2):
%struct.iio_dev = type opaque
define void @adis16251_remove_trigger(%struct.iio_dev* nocapture %0) {
ret void
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn76() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn76");
  return result;
}


x86 assembly (clang, -O0):
<fn76>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn76>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn76\00"
define i8* @fn76() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn76\00"
define i8* @fn76() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
int /*<<< orphan*/ foo(int);
int /*<<< orphan*/ xxx(int);
int main() {
  foo(1);
  bar(2);
one:
  foo(3);
two:
  bar(4);
three:
  xxx(5);
  foo(6);
  bar(7);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1050 <foo@plt>
mov    $0x2,%edi
call   1030 <bar@plt>
mov    $0x3,%edi
call   1050 <foo@plt>
mov    $0x4,%edi
call   1030 <bar@plt>
mov    $0x5,%edi
call   1040 <xxx@plt>
mov    $0x6,%edi
call   1050 <foo@plt>
mov    $0x7,%edi
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1050 <foo@plt>
mov    $0x2,%edi
call   1030 <bar@plt>
mov    $0x3,%edi
call   1050 <foo@plt>
mov    $0x4,%edi
call   1030 <bar@plt>
mov    $0x5,%edi
call   1040 <xxx@plt>
mov    $0x6,%edi
call   1050 <foo@plt>
mov    $0x7,%edi
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @foo(i32 1)
%2 = call i32 @bar(i32 2)
br label %3
3: ; preds = %0
%4 = call i32 @foo(i32 3)
br label %5
5: ; preds = %3
%6 = call i32 @bar(i32 4)
br label %7
7: ; preds = %5
%8 = call i32 @xxx(i32 5)
%9 = call i32 @foo(i32 6)
%10 = call i32 @bar(i32 7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 1)
%2 = tail call i32 @bar(i32 2)
%3 = tail call i32 @foo(i32 3)
%4 = tail call i32 @bar(i32 4)
%5 = tail call i32 @xxx(i32 5)
%6 = tail call i32 @foo(i32 6)
%7 = tail call i32 @bar(i32 7)
ret i32 0
}
int test_imm_9Bint8_reg(signed char val) {
  return ((val) & (0x9B << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_9Bint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 155
%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_9Bint8_reg(i8 signext %0) {
%2 = and i8 %0, -101
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_69int32_reg(int val) { return ((val) & (0x69 << 0)) ? -20 : -40; }


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

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

LLVM IR (-O0):
define i32 @test_imm_69int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 105
%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_69int32_reg(i32 %0) {
%2 = and i32 %0, 105
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void convert_rom() {}


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

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

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

LLVM IR (-O2):
define void @convert_rom() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xa5() {
  Assert_real((isbdigit(165) == 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_isbdigit.c",
              830, ("isbdigit should be 0 for 0xa5"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0xa5>:
push   %rax
mov    $0xa5,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x33e,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xa5\00"
define void @t_isbdigit_0xa5() {
%1 = call i64 @isbdigit(i32 165)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 830, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xa5\00"
define void @t_isbdigit_0xa5() {
%1 = tail call i64 @isbdigit(i32 165)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 830, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int /*<<< orphan*/);
int main() {
  char c[100];
  char *d;
  memcpy(c, d, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rsi
xor    %edx,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
mov    %rsp,%rdi
xor    %edx,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = load i8*, i8** %3
%6 = call i32 @memcpy(i8* %4, i8* %5, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @memcpy(i8* %2, i8* undef, i32 0)
ret i32 0
}
char *asctime_r(timeptr, buf) __const struct tm *timeptr;
char *buf;
{
  if (timeptr == 0)
    return 0;
  __asctime(buf, timeptr);
  return buf;
}


x86 assembly (clang, -O0):
<asctime_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1138 <asctime_r+0x28>
movq   $0x0,-0x8(%rbp)
jmp    114f <asctime_r+0x3f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <__asctime@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asctime_r>:
push   %rbx
test   %rdi,%rdi
je     1128 <asctime_r+0x18>
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <__asctime@plt>
jmp    112a <asctime_r+0x1a>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type opaque
define i8* @asctime_r(%struct.tm* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca %struct.tm*
%5 = alloca i8*
store %struct.tm* %0, %struct.tm** %4
store i8* %1, i8** %5
%6 = load %struct.tm*, %struct.tm** %4
%7 = icmp eq %struct.tm* %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* null, i8** %3
br label %14
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = load %struct.tm*, %struct.tm** %4
%12 = call i32 (i8*, %struct.tm*, ...) bitcast (i32 (...)* @__asctime to i32 (i8*, %struct.tm*, ...)*)(i8* %10, %struct.tm* %11)
%13 = load i8*, i8** %5
store i8* %13, i8** %3
br label %14
14: ; preds = %9, %8
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
%struct.tm = type opaque
define i8* @asctime_r(%struct.tm* %0, i8* %1) {
%3 = icmp eq %struct.tm* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, %struct.tm*, ...) bitcast (i32 (...)* @__asctime to i32 (i8*, %struct.tm*, ...)*)(i8* %1, %struct.tm* %0)
br label %6
6: ; preds = %2, %4
%7 = phi i8* [ %1, %4 ], [ null, %2 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_hex(unsigned char *data, int len) {
  int i;
  for (i = 0; i < len; i++) {
    printf("%02hhx ", data[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <print_hex+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_hex+0x16>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hex>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1158 <print_hex+0x38>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_hex+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%02hhx \00"
define void @print_hex(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int DoAsmCodeTest_C();
int /*<<< orphan*/ abort();
int main() {
  if (DoAsmCodeTest_C() != 16)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <DoAsmCodeTest_C@plt>
cmp    $0x10,%eax
je     1146 <main+0x26>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <DoAsmCodeTest_C@plt>
cmp    $0x10,%eax
jne    1131 <main+0x11>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @DoAsmCodeTest_C()
%3 = icmp ne i32 %2, 16
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @DoAsmCodeTest_C()
%2 = icmp eq i32 %1, 16
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
int ejtag_switch(int, int);
int mips_ejtag_read_h(unsigned int addr) {
  addr &= 0x1fffffff;
  return ejtag_switch(0x2011, (int)&addr);
}


x86 assembly (clang, -O0):
<mips_ejtag_read_h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1fffffff,%eax
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %eax,%esi
mov    $0x2011,%edi
call   1030 <ejtag_switch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mips_ejtag_read_h>:
push   %rax
and    $0x1fffffff,%edi
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x2011,%edi
call   1030 <ejtag_switch@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mips_ejtag_read_h(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 536870911
store i32 %4, i32* %2
%5 = ptrtoint i32* %2 to i32
%6 = call i32 @ejtag_switch(i32 8209, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @mips_ejtag_read_h(i32 %0) {
%2 = alloca i32
%3 = and i32 %0, 536870911
store i32 %3, i32* %2
%4 = ptrtoint i32* %2 to i64
%5 = trunc i64 %4 to i32
%6 = call i32 @ejtag_switch(i32 8209, i32 %5)
ret i32 %6
}
/* Variables and functions */
int numbits(unsigned int);
unsigned hamdist(unsigned x, unsigned y) { return numbits(x ^ y); }


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

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

LLVM IR (-O0):
define i32 @hamdist(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 = xor i32 %5, %6
%8 = call i32 @numbits(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @hamdist(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = tail call i32 @numbits(i32 %3)
ret i32 %4
}
void layer_debug(void) { ; }


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

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

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

LLVM IR (-O2):
define void @layer_debug() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void write_function_name(FILE *filep, char *base_name) {
  fprintf(filep, "static void %s(void)\n", base_name);
}


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

x86 assembly (clang, -O2):
<write_function_name>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"static void %s(void)\0A\00"
define void @write_function_name(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"static void %s(void)\0A\00"
define void @write_function_name(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
void utwente_shutdown() {}


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

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

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

LLVM IR (-O2):
define void @utwente_shutdown() {
ret void
}
/* Variables and functions */
double get_seconds();
void init_timer() {
  double t = get_seconds();
  return;
}


x86 assembly (clang, -O0):
<init_timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_seconds@plt>
movsd  %xmm0,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @init_timer() {
%1 = alloca double
%2 = call double (...) @get_seconds()
store double %2, double* %1
ret void
}

LLVM IR (-O2):
define void @init_timer() {
%1 = tail call double (...) @get_seconds()
ret void
}
unsigned int unsignedint_ignoring_signedlonglong(unsigned int x,
                                                 signed long long y) {
  return x;
}


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

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

LLVM IR (-O0):
define i32 @unsignedint_ignoring_signedlonglong(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
ret i32 %5
}

LLVM IR (-O2):
define i32 @unsignedint_ignoring_signedlonglong(i32 returned %0, i64 %1) {
ret i32 %0
}
void double_to_uc(double x, unsigned char *p) { p[3] = x; }


x86 assembly (clang, -O0):
<double_to_uc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_to_uc>:
cvttsd2si %xmm0,%eax
mov    %al,0x3(%rdi)
ret

LLVM IR (-O0):
define void @double_to_uc(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
store double %0, double* %3
store i8* %1, i8** %4
%5 = load double, double* %3
%6 = fptoui double %5 to i8
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 3
store i8 %6, i8* %8
ret void
}

LLVM IR (-O2):
define void @double_to_uc(double %0, i8* nocapture writeonly %1) {
%3 = fptoui double %0 to i8
%4 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %3, i8* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ read_word_data(int, int);
uint16_t io_get_interrupt_on_bus() { return read_word_data(0x20, 0x04); }


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

x86 assembly (clang, -O2):
<io_get_interrupt_on_bus>:
mov    $0x20,%edi
mov    $0x4,%esi
jmp    1030 <read_word_data@plt>

LLVM IR (-O0):
define i32 @io_get_interrupt_on_bus() {
%1 = call i32 @read_word_data(i32 32, i32 4)
ret i32 %1
}

LLVM IR (-O2):
define i32 @io_get_interrupt_on_bus() {
%1 = tail call i32 @read_word_data(i32 32, i32 4)
ret i32 %1
}
int divpwr2(int x, int n) {
  int sign = x >> 31;
  int tmp = sign & ((1 << n) + ~0);
  return (x + tmp) >> n;
}


x86 assembly (clang, -O0):
<divpwr2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
add    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divpwr2>:
mov    %esi,%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
not    %edx
mov    %edi,%eax
sar    $0x1f,%eax
and    %edx,%eax
add    %edi,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @divpwr2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = ashr i32 %7, 31
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = add nsw i32 %11, -1
%13 = and i32 %9, %12
store i32 %13, i32* %6
%14 = load i32, i32* %3
%15 = load i32, i32* %6
%16 = add nsw i32 %14, %15
%17 = load i32, i32* %4
%18 = ashr i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @divpwr2(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = xor i32 %3, -1
%5 = icmp slt i32 %0, 0
%6 = select i1 %5, i32 %4, i32 0
%7 = add nsw i32 %6, %0
%8 = ashr i32 %7, %1
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int wait(int /*<<< orphan*/ *);
int main(void) {
  for (;;)
    if (wait(NULL) == -1)
      sleep(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <wait@plt>
cmp    $0xffffffff,%eax
jne    114b <main+0x2b>
mov    $0x1,%edi
call   1030 <sleep@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1040 <wait@plt>
cmp    $0xffffffff,%eax
jne    1130 <main+0x10>
mov    $0x1,%edi
call   1030 <sleep@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %7, %0
%3 = call i32 @wait(i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = call i32 @sleep(i32 1)
br label %7
7: ; preds = %5, %2
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %6, %0
%2 = tail call i32 @wait(i32* null)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @sleep(i32 1)
br label %6
6: ; preds = %4, %1
br label %1
}
/* Variables and functions */
scalar_t__ config_WITH_CARDREADER();
int config_READER_CRYPTOWORKS(void) { return config_WITH_CARDREADER() ? 1 : 0; }


x86 assembly (clang, -O0):
<config_READER_CRYPTOWORKS>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <config_WITH_CARDREADER@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @config_READER_CRYPTOWORKS() {
%1 = call i64 (...) @config_WITH_CARDREADER()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 1, i32 0
ret i32 %4
}

LLVM IR (-O2):
define i32 @config_READER_CRYPTOWORKS() {
%1 = tail call i64 (...) @config_WITH_CARDREADER()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
int test_imm_32uint8_reg(unsigned char val) {
  return ((val) & (-0x32 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_32uint8_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, -50
%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_32uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -50
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int j = 42;
  int *p = &j;
  int i = (int)*p;
  assert(i == 42);
  assert(!(i != 42));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2a,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2a,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
store i32* %2, i32** %3
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 42
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 42
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
ret i32 0
}
void kol_key_lang_set(unsigned lang) {
  asm volatile("int $0x40" ::"a"(21), "b"(2), "c"(9), "d"(lang));
}


x86 assembly (clang, -O0):
<kol_key_lang_set>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x15,%eax
mov    $0x2,%ebx
mov    $0x9,%ecx
int    $0x40
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_key_lang_set>:
push   %rbx
mov    $0x15,%eax
mov    $0x2,%ebx
mov    $0x9,%ecx
mov    %edi,%edx
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define void @kol_key_lang_set(i32 %0) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 21, i32 2, i32 9, i32 %0)
ret void
}
int getLength(char *str) {
  int i = 0;
  while (str[i] != '\0')
    i++;
  return i;
}


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

x86 assembly (clang, -O2):
<getLength>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <getLength+0x10>
ret

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

LLVM IR (-O2):
define i32 @getLength(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void winner() { printf("Are you are ready for the real thing?\n"); }


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

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

LLVM IR (-O0):
@.str = [39 x i8] c"Are you are ready for the real thing?\0A\00"
define void @winner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [38 x i8] c"Are you are ready for the real thing?\00"
define void @winner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *, double);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ stdout;
void ring_element_destroy(void *x, void *arg) {
  { arg = arg; }
  if (NULL != x) {
    fprintf(stdout, "\tdestrpy element {object=>0x%p,value=>%.3f}\n", x,
            *(double *)x);
    free(x);
  }
}


x86 assembly (clang, -O0):
<ring_element_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     116e <ring_element_destroy+0x4e>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ring_element_destroy>:
test   %rdi,%rdi
je     114e <ring_element_destroy+0x2e>
push   %rbx
mov    %rdi,%rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
movsd  (%rbx),%xmm0
lea    0xec3(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [45 x i8] c"\09destrpy element {object=>0x%p,value=>%.3f}\0A\00"
define void @ring_element_destroy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
store i8* %5, i8** %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* null, %6
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i32, i32* @stdout
%10 = load i8*, i8** %3
%11 = load i8*, i8** %3
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
%14 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %10, double %13)
%15 = load i8*, i8** %3
%16 = call i32 @free(i8* %15)
br label %17
17: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [45 x i8] c"\09destrpy element {object=>0x%p,value=>%.3f}\0A\00"
define void @ring_element_destroy(i8* %0, i8* nocapture readnone %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @stdout
%6 = bitcast i8* %0 to double*
%7 = load double, double* %6
%8 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0, double %7)
%9 = tail call i32 @free(i8* %0)
br label %10
10: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void mm_free0(void **ptr) {
  free(*ptr);
  *ptr = NULL;
}


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

x86 assembly (clang, -O2):
<mm_free0>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @mm_free0(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = call i32 @free(i8* %4)
%6 = load i8**, i8*** %2
store i8* null, i8** %6
ret void
}

LLVM IR (-O2):
define void @mm_free0(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
ret void
}
int max_value(int array[5]) {
  int index, max = array[0];
  for (index = 0; index < 5; index++) {
    if (array[index] > max)
      max = array[index];
  }
  return max;
}


x86 assembly (clang, -O0):
<max_value>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1157 <max_value+0x57>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x10(%rbp),%eax
jle    1144 <max_value+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <max_value+0x49>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1118 <max_value+0x18>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_value>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
cmp    %eax,%ecx
cmovg  %ecx,%eax
mov    0x8(%rdi),%ecx
cmp    %eax,%ecx
cmovg  %ecx,%eax
mov    0xc(%rdi),%ecx
cmp    %eax,%ecx
cmovg  %ecx,%eax
mov    0x10(%rdi),%ecx
cmp    %eax,%ecx
cmovg  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @max_value(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, %2
%6 = select i1 %5, i32 %4, i32 %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, %6
%10 = select i1 %9, i32 %8, i32 %6
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = icmp sgt i32 %12, %10
%14 = select i1 %13, i32 %12, i32 %10
%15 = getelementptr inbounds i32, i32* %0, i64 4
%16 = load i32, i32* %15
%17 = icmp sgt i32 %16, %14
%18 = select i1 %17, i32 %16, i32 %14
ret i32 %18
}