xunge/DecIR huggingface dataset:
/* Variables and functions */
int _func_xpath_operators(char *, void *, int, int);
int _func_xpath_operator_inf(char *chunk, void *data) {
  return _func_xpath_operators(chunk, data, 3, 5);
}


x86 assembly (clang, -O0):
<_func_xpath_operator_inf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3,%edx
mov    $0x5,%ecx
call   1030 <_func_xpath_operators@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_func_xpath_operator_inf>:
mov    $0x3,%edx
mov    $0x5,%ecx
jmp    1030 <_func_xpath_operators@plt>

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

LLVM IR (-O2):
define i32 @_func_xpath_operator_inf(i8* %0, i8* %1) {
%3 = tail call i32 @_func_xpath_operators(i8* %0, i8* %1, i32 3, i32 5)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ dbg_msg(char *, int, char *);
int main(int argc, char **argv) {
  int id = 93002;
  char name[] = "Fangxm";
  dbg_msg("id: %d name: %s\n", id, name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x16b4a,-0x14(%rbp)
mov    0xecd(%rip),%eax
mov    %eax,-0x1b(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0x17(%rbp)
mov    0xebf(%rip),%al
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%esi
lea    -0x1b(%rbp),%rdx
lea    0xeaf(%rip),%rdi
call   1030 <dbg_msg@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x6d7867,0x3(%rsp)
movl   $0x676e6146,(%rsp)
lea    0xee0(%rip),%rdi
mov    %rsp,%rdx
mov    $0x16b4a,%esi
call   1030 <dbg_msg@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.name = [7 x i8] c"Fangxm\00"
@.str = [17 x i8] c"id: %d name: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [7 x i8]
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%5 = call i32 @dbg_msg(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 93002, i8* %4)
ret i32 0
}
int test_imm_45int32_reg(int val) { return ((val) & (0x45 << 0)) ? -20 : -40; }


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

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

LLVM IR (-O0):
define i32 @test_imm_45int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 69
%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_45int32_reg(i32 %0) {
%2 = and i32 %0, 69
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double RAND_MAX;
double rand();
int random_char(void) { return (int)(255.0 * (rand() / (RAND_MAX + 1.0))); }


x86 assembly (clang, -O0):
<random_char>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  0xee2(%rip),%xmm0
mov    0x2ebb(%rip),%rax
addsd  (%rax),%xmm0
divsd  %xmm0,%xmm1
movsd  0xec3(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_char>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec9(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xed5(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xed1(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @random_char() {
%1 = call double (...) @rand()
%2 = load double, double* @RAND_MAX
%3 = fadd double %2, 1.000000e+00
%4 = fdiv double %1, %3
%5 = fmul double 2.550000e+02, %4
%6 = fptosi double %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @random_char() {
%1 = tail call double (...) @rand()
%2 = load double, double* @RAND_MAX
%3 = fadd double %2, 1.000000e+00
%4 = fdiv double %1, %3
%5 = fmul double %4, 2.550000e+02
%6 = fptosi double %5 to i32
ret i32 %6
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(int);
main() {
  int c;
  while ((c = getchar()) != EOF) {
    putchar(c);
    printf("%f", c != EOF);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
je     1185 <main+0x55>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
jmp    113f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea6(%rip),%rbx
cmp    (%rbx),%eax
je     1174 <main+0x44>
mov    %eax,%ebp
lea    0xeb1(%rip),%r14
nop
mov    %ebp,%edi
call   1030 <putchar@plt>
xor    %esi,%esi
cmp    (%rbx),%ebp
setne  %sil
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    (%rbx),%eax
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %15
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @putchar(i32 %8)
%10 = load i32, i32* %2
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %3
15: ; preds = %3
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %14, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %11, %4 ], [ %1, %0 ]
%6 = tail call i32 @putchar(i32 %5)
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %5, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %4
14: ; preds = %4, %0
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int mult_will_overflow_u64(uint64_t a, uint64_t b) {
  if (!a)
    return false;
  return (uint64_t)(-1) / a < b;
}


x86 assembly (clang, -O0):
<mult_will_overflow_u64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1120 <mult_will_overflow_u64+0x20>
movl   $0x0,-0x4(%rbp)
jmp    1137 <mult_will_overflow_u64+0x37>
mov    $0xffffffff,%eax
cltd
idivl  -0x8(%rbp)
cmp    -0xc(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mult_will_overflow_u64>:
test   %edi,%edi
je     1116 <mult_will_overflow_u64+0x16>
mov    $0xffffffff,%eax
cltd
idiv   %edi
mov    %eax,%ecx
xor    %eax,%eax
cmp    %esi,%ecx
setl   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @mult_will_overflow_u64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %2
store i32 0, i32* %3
br label %15
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sdiv i32 -1, %10
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
%14 = zext i1 %13 to i32
store i32 %14, i32* %3
br label %15
15: ; preds = %9, %8
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @mult_will_overflow_u64(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = sdiv i32 -1, %0
%6 = icmp slt i32 %5, %1
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
char *malloc(int);
int main(void) {
  char c;
  char *c0, *c1;
  c0 = malloc(10000);
  c1 = malloc(10000);
  assert(c0 && c1);
  c = c0[15000];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2710,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x2710,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x19(%rbp)
je     1166 <main+0x46>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x3a98(%rax),%al
mov    %al,-0x5(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i8* @malloc(i32 10000)
store i8* %5, i8** %3
%6 = call i8* @malloc(i32 10000)
store i8* %6, i8** %4
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br label %12
12: ; preds = %9, %0
%13 = phi i1 [ false, %0 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 15000
%18 = load i8, i8* %17
store i8 %18, i8* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
int is_prime_number(int n) {}


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

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

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

LLVM IR (-O2):
define i32 @is_prime_number(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x1f() {
  Assert_real((isdigit(31) == 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_isdigit.c",
              160, ("isdigit should be 0 for 0x1f"));
}


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

x86 assembly (clang, -O2):
<t_isdigit_0x1f>:
push   %rax
mov    $0x1f,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xa0,%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_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x1f\00"
define void @t_isdigit_0x1f() {
%1 = call i64 @isdigit(i32 31)
%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 160, i8* getelementptr inbounds ([29 x i8], [29 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_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x1f\00"
define void @t_isdigit_0x1f() {
%1 = tail call i64 @isdigit(i32 31)
%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 160, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ optind;
int /*<<< orphan*/ read_archive(int /*<<< orphan*/, int, char **, char, int);
void table_of_contents(int index, int argc, char **argv, int verbose) {
  read_archive(optind, argc, argv, 't', verbose);
}


x86 assembly (clang, -O0):
<table_of_contents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%r8d
mov    $0x74,%ecx
call   1030 <read_archive@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<table_of_contents>:
mov    %ecx,%r8d
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
mov    $0x74,%ecx
jmp    1030 <read_archive@plt>

LLVM IR (-O0):
@optind = global i32 0
define void @table_of_contents(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%9 = load i32, i32* @optind
%10 = load i32, i32* %6
%11 = load i8**, i8*** %7
%12 = load i32, i32* %8
%13 = call i32 @read_archive(i32 %9, i32 %10, i8** %11, i8 signext 116, i32 %12)
ret void
}

LLVM IR (-O2):
@optind = global i32 0
define void @table_of_contents(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = load i32, i32* @optind
%6 = tail call i32 @read_archive(i32 %5, i32 %1, i8** %2, i8 signext 116, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strcmp(void const *, void const *);
int _strcmp(const void *p1, const void *p2) {
  printf("%i\n", strcmp(p1, p2));
  return strcmp(p1, p2);
}


x86 assembly (clang, -O0):
<_strcmp>:
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   1040 <strcmp@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strcmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strcmp@plt>
lea    0xeca(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcmp@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %5
}
/* Type definitions */
struct c_ident {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ c_direct(void *);
c_compile(int (*ext_getchar)(), void (*ext_rewind)(), struct c_ident *externs) {
  c_direct(((void *)0));
}


x86 assembly (clang, -O0):
<c_compile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <c_direct@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.c_ident = type { i32 }
define i32 @c_compile(i32 (...)* %0, void (...)* %1, %struct.c_ident* %2) {
%4 = alloca i32
%5 = alloca i32 (...)*
%6 = alloca void (...)*
%7 = alloca %struct.c_ident*
store i32 (...)* %0, i32 (...)** %5
store void (...)* %1, void (...)** %6
store %struct.c_ident* %2, %struct.c_ident** %7
%8 = call i32 @c_direct(i8* null)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
%struct.c_ident = type { i32 }
define i32 @c_compile(i32 (...)* nocapture readnone %0, void (...)* nocapture readnone %1, %struct.c_ident* nocapture readnone %2) {
%4 = tail call i32 @c_direct(i8* null)
ret i32 undef
}
R0R1(r0, r1, x0, x1, p0, p1) char r0, r1;
char *p0, *p1;
{ r0 = r1; }


x86 assembly (clang, -O0):
<R0R1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @R0R1(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = trunc i32 %0 to i8
%15 = trunc i32 %1 to i8
store i8 %14, i8* %8
store i8 %15, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = load i8, i8* %9
store i8 %16, i8* %8
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @R0R1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
ret i32 undef
}
/* Variables and functions */
char *strdup(char const *);
char *alloc_string(const char *string) {
  if (!string || !*string)
    return NULL;
  return strdup(string);
}


x86 assembly (clang, -O0):
<alloc_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1134 <alloc_string+0x24>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1141 <alloc_string+0x31>
movq   $0x0,-0x8(%rbp)
jmp    114e <alloc_string+0x3e>
mov    -0x10(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_string>:
test   %rdi,%rdi
je     111f <alloc_string+0xf>
cmpb   $0x0,(%rdi)
je     111f <alloc_string+0xf>
jmp    1030 <strdup@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define noalias i8* @alloc_string(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i8* @strdup(i8* %0)
br label %8
8: ; preds = %1, %3, %6
%9 = phi i8* [ %7, %6 ], [ null, %3 ], [ null, %1 ]
ret i8* %9
}
int test_imm_6Buint16_reg(unsigned short val) {
  return ((val) & (0x6B << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_6Buint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 107
%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_6Buint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 107
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ checkIsLeapYear(int, int);
void testIsLeapYear() {
  checkIsLeapYear(1, 0);
  checkIsLeapYear(1500, 0);
  checkIsLeapYear(1582, 0);
  checkIsLeapYear(1999, 0);
  checkIsLeapYear(2000, 1);
  checkIsLeapYear(2001, 0);
  checkIsLeapYear(2004, 1);
}


x86 assembly (clang, -O0):
<testIsLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x5dc,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x62e,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7cf,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7d0,%edi
mov    $0x1,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7d1,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7d4,%edi
mov    $0x1,%esi
call   1030 <checkIsLeapYear@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testIsLeapYear>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x5dc,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x62e,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7cf,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7d0,%edi
mov    $0x1,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7d1,%edi
xor    %esi,%esi
call   1030 <checkIsLeapYear@plt>
mov    $0x7d4,%edi
mov    $0x1,%esi
pop    %rax
jmp    1030 <checkIsLeapYear@plt>

LLVM IR (-O0):
define void @testIsLeapYear() {
%1 = call i32 @checkIsLeapYear(i32 1, i32 0)
%2 = call i32 @checkIsLeapYear(i32 1500, i32 0)
%3 = call i32 @checkIsLeapYear(i32 1582, i32 0)
%4 = call i32 @checkIsLeapYear(i32 1999, i32 0)
%5 = call i32 @checkIsLeapYear(i32 2000, i32 1)
%6 = call i32 @checkIsLeapYear(i32 2001, i32 0)
%7 = call i32 @checkIsLeapYear(i32 2004, i32 1)
ret void
}

LLVM IR (-O2):
define void @testIsLeapYear() {
%1 = tail call i32 @checkIsLeapYear(i32 1, i32 0)
%2 = tail call i32 @checkIsLeapYear(i32 1500, i32 0)
%3 = tail call i32 @checkIsLeapYear(i32 1582, i32 0)
%4 = tail call i32 @checkIsLeapYear(i32 1999, i32 0)
%5 = tail call i32 @checkIsLeapYear(i32 2000, i32 1)
%6 = tail call i32 @checkIsLeapYear(i32 2001, i32 0)
%7 = tail call i32 @checkIsLeapYear(i32 2004, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_version_info() {
  printf("ShowMe Version 0.01\n");
  printf("Copyright (c) 2014. hedongjie@hapigames.com\n");
}


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

x86 assembly (clang, -O2):
<show_version_info>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"ShowMe Version 0.01\0A\00"
@.str.1 = [45 x i8] c"Copyright (c) 2014. hedongjie@hapigames.com\0A\00"
define void @show_version_info() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"ShowMe Version 0.01\00"
@str.2 = [44 x i8] c"Copyright (c) 2014. hedongjie@hapigames.com\00"
define void @show_version_info() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.2, i64 0, i64 0))
ret void
}
void SSMR3Cancel(void) {}


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

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

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

LLVM IR (-O2):
define void @SSMR3Cancel() {
ret void
}
set4(buf, off, val) char *buf;
long val;
{
  buf[off] = val >> 24;
  buf[off + 1] = val >> 16;
  buf[off + 2] = val >> 8;
  buf[off + 3] = val;
}


x86 assembly (clang, -O0):
<set4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sar    $0x18,%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
sar    $0x10,%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
sar    $0x8,%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set4>:
movslq %esi,%rax
bswap  %edx
mov    %edx,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define i32 @set4(i8* %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %5
store i32 %1, i32* %6
store i64 %2, i64* %7
%8 = load i64, i64* %7
%9 = ashr i64 %8, 24
%10 = trunc i64 %9 to i8
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 %10, i8* %14
%15 = load i64, i64* %7
%16 = ashr i64 %15, 16
%17 = trunc i64 %16 to i8
%18 = load i8*, i8** %5
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
store i8 %17, i8* %22
%23 = load i64, i64* %7
%24 = ashr i64 %23, 8
%25 = trunc i64 %24 to i8
%26 = load i8*, i8** %5
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
store i8 %25, i8* %30
%31 = load i64, i64* %7
%32 = trunc i64 %31 to i8
%33 = load i8*, i8** %5
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
store i8 %32, i8* %37
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @set4(i8* nocapture writeonly %0, i32 %1, i64 %2) {
%4 = lshr i64 %2, 24
%5 = trunc i64 %4 to i8
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %5, i8* %7
%8 = lshr i64 %2, 16
%9 = trunc i64 %8 to i8
%10 = add nsw i32 %1, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
store i8 %9, i8* %12
%13 = lshr i64 %2, 8
%14 = trunc i64 %13 to i8
%15 = add nsw i32 %1, 2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 %14, i8* %17
%18 = trunc i64 %2 to i8
%19 = add nsw i32 %1, 3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
store i8 %18, i8* %21
ret i32 undef
}
int test_imm_43int64_highword_reg(long long val) {
  return ((val >> 32) & (0x43 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_43int64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0x43,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_43int64_highword_reg>:
movabs $0x4300000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_43int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 67
%6 = icmp ne i64 %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_43int64_highword_reg(i64 %0) {
%2 = and i64 %0, 287762808832
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_2Buint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x2B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_2Buint64_highword_mem>:
testb  $0x2b,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Buint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 184683593728
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ refresh();
void smemstat_top_refresh(void) { (void)refresh(); }


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

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

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

LLVM IR (-O2):
define void @smemstat_top_refresh() {
%1 = tail call i32 (...) @refresh()
ret void
}
/* Type definitions */
struct attrset {
  int dummy;
};

/* Variables and functions */
int attr_set_str_key(struct attrset **, char const *, char const *, int);
int attr_set_str(struct attrset **setp, const char *key, const char *val) {
  return attr_set_str_key(setp, key, val, -1);
}


x86 assembly (clang, -O0):
<attr_set_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0xffffffff,%ecx
call   1030 <attr_set_str_key@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<attr_set_str>:
mov    $0xffffffff,%ecx
jmp    1030 <attr_set_str_key@plt>

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

LLVM IR (-O2):
%struct.attrset = type { i32 }
define i32 @attr_set_str(%struct.attrset** %0, i8* %1, i8* %2) {
%4 = tail call i32 @attr_set_str_key(%struct.attrset** %0, i8* %1, i8* %2, i32 -1)
ret i32 %4
}
int test_imm_54int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x54 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_54int64_highword_mem>:
testb  $0x54,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_54int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 360777252864
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int canBeep(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @canBeep() {
ret i32 1
}
/* Variables and functions */
scalar_t__ atoi(char *);
int strlen(char *);
void F_ValToChar(char *str, char *c) {
  str[strlen(str) - 1] = 0;
  *c = (char)atoi(str);
}


x86 assembly (clang, -O0):
<F_ValToChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F_ValToChar>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1040 <atoi@plt>
mov    %al,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @F_ValToChar(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** %3
%7 = call i32 @strlen(i8* %6)
%8 = sub nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
store i8 0, i8* %10
%11 = load i8*, i8** %3
%12 = call i64 @atoi(i8* %11)
%13 = trunc i64 %12 to i8
%14 = load i8*, i8** %4
store i8 %13, i8* %14
ret void
}

LLVM IR (-O2):
define void @F_ValToChar(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add nsw i32 %3, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %6
%7 = tail call i64 @atoi(i8* %0)
%8 = trunc i64 %7 to i8
store i8 %8, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int, int);
int /*<<< orphan*/ output_w32(int);
void emit_fsitos(int s, int d) {
  assem_debug("fsitos s%d,s%d", d, s);
  output_w32(0xeeb80ac0 | ((d & 14) << 11) | ((d & 1) << 22) | ((s & 14) >> 1) |
             ((s & 1) << 5));
}


x86 assembly (clang, -O0):
<emit_fsitos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xec5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    -0x8(%rbp),%edi
and    $0xe,%edi
shl    $0xb,%edi
or     $0xeeb80ac0,%edi
mov    -0x8(%rbp),%eax
and    $0x1,%eax
shl    $0x16,%eax
or     %eax,%edi
mov    -0x4(%rbp),%eax
and    $0xe,%eax
sar    $0x1,%eax
or     %eax,%edi
mov    -0x4(%rbp),%eax
and    $0x1,%eax
shl    $0x5,%eax
or     %eax,%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fsitos>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xed2(%rip),%rdi
mov    %ebp,%edx
call   1030 <assem_debug@plt>
mov    %ebx,%eax
and    $0xe,%eax
shl    $0xb,%eax
and    $0x1,%ebx
shl    $0x16,%ebx
mov    %ebp,%ecx
shr    %ecx
and    $0x7,%ecx
shl    $0x5,%ebp
movzbl %bpl,%edi
or     %ecx,%edi
or     %ebx,%edi
or     %eax,%edi
or     $0xeeb80ac0,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"fsitos s%d,s%d\00"
define void @emit_fsitos(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @assem_debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* %4
%9 = and i32 %8, 14
%10 = shl i32 %9, 11
%11 = or i32 -289928512, %10
%12 = load i32, i32* %4
%13 = and i32 %12, 1
%14 = shl i32 %13, 22
%15 = or i32 %11, %14
%16 = load i32, i32* %3
%17 = and i32 %16, 14
%18 = ashr i32 %17, 1
%19 = or i32 %15, %18
%20 = load i32, i32* %3
%21 = and i32 %20, 1
%22 = shl i32 %21, 5
%23 = or i32 %19, %22
%24 = call i32 @output_w32(i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"fsitos s%d,s%d\00"
define void @emit_fsitos(i32 %0, i32 %1) {
%3 = tail call i32 @assem_debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
%4 = shl i32 %1, 11
%5 = and i32 %4, 28672
%6 = shl i32 %1, 22
%7 = and i32 %6, 4194304
%8 = lshr i32 %0, 1
%9 = and i32 %8, 7
%10 = shl i32 %0, 5
%11 = and i32 %10, 32
%12 = or i32 %9, %11
%13 = or i32 %12, %7
%14 = or i32 %13, %5
%15 = or i32 %14, -289928512
%16 = tail call i32 @output_w32(i32 %15)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main() {
  setuid(0);
  system("/home/maberyick/Dropbox/Self-Research_EEG/EpocArmData/main.sh");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <setuid@plt>
lea    0xec3(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [62 x i8] c"/home/maberyick/Dropbox/Self-Research_EEG/EpocArmData/main.sh\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @setuid(i32 0)
%3 = call i32 @system(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [62 x i8] c"/home/maberyick/Dropbox/Self-Research_EEG/EpocArmData/main.sh\00"
define i32 @main() {
%1 = tail call i32 @setuid(i32 0)
%2 = tail call i32 @system(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char *l_momentum(char *, int /*<<< orphan*/, char *);
char *macmomentum(char *arg) { return l_momentum(arg, 0, "momentum"); }


x86 assembly (clang, -O0):
<macmomentum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xed7(%rip),%rdx
call   1030 <l_momentum@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macmomentum>:
lea    0xee9(%rip),%rdx
xor    %esi,%esi
jmp    1030 <l_momentum@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"momentum\00"
define i8* @macmomentum(i8* %0) {
%2 = tail call i8* @l_momentum(i8* %0, i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
int foo(int i) { return 2 + i * 4; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    0x2(,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
%5 = add nsw i32 2, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = or i32 %2, 2
ret i32 %3
}
void handle_PRIO(int sig) {}


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

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

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

LLVM IR (-O2):
define void @handle_PRIO(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ use_memory();
int main() { use_memory(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <use_memory@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @use_memory()
ret i32 0
}
int test10(unsigned n) {
  int x;
  for (unsigned i = 0; i < n; ++i) {
    x = 1;
  }
  return x;
}


x86 assembly (clang, -O0):
<test10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    112f <test10+0x2f>
movl   $0x1,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <test10+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test10(i32 %0) {
ret i32 1
}
/* Variables and functions */
scalar_t__ malloc(unsigned int);
scalar_t__ realloc(char *, unsigned int);
void reallocNotNullPtr(unsigned sizeIn) {
  unsigned size = 12;
  char *p = (char *)malloc(size);
  if (p) {
    char *q = (char *)realloc(p, sizeIn);
    char x = *q;
  }
}


x86 assembly (clang, -O0):
<reallocNotNullPtr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1162 <reallocNotNullPtr+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocNotNullPtr>:
push   %rbx
mov    %edi,%ebx
mov    $0xc,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     113d <reallocNotNullPtr+0x1d>
mov    %rax,%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <realloc@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @reallocNotNullPtr(i32 %0) {
%2 = tail call i64 @malloc(i32 12)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = inttoptr i64 %2 to i8*
%6 = tail call i64 @realloc(i8* %5, i32 %0)
br label %7
7: ; preds = %4, %1
ret void
}
int test_imm_44uint16_mem(unsigned short *val) {
  return ((*val) & (-0x44 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_44uint16_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, -68
%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_44uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -68
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
long ror(long trg, int shift) {
  __asm__("rorq %%cl, %[trg]" : [trg] "+r"(trg) : "c"(shift));
  return trg;
}


x86 assembly (clang, -O0):
<ror>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
ror    %cl,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror>:
mov    %esi,%ecx
mov    %rdi,%rax
ror    %cl,%rax
ret

LLVM IR (-O0):
define i64 @ror(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = call i64 asm "rorq %cl, $0", "=r,{cx},0,~{dirflag},~{fpsr},~{flags}"(i32 %6, i64 %5)
store i64 %7, i64* %3
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
define i64 @ror(i64 %0, i32 %1) {
%3 = tail call i64 asm "rorq %cl, $0", "=r,{cx},0,~{dirflag},~{fpsr},~{flags}"(i32 %1, i64 %0)
ret i64 %3
}
/* Variables and functions */
char *sbt_androidxml_get_string_array(const char *file_name,
                                      const char *res_name) {
  return NULL;
}


x86 assembly (clang, -O0):
<sbt_androidxml_get_string_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @sbt_androidxml_get_string_array(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @sbt_androidxml_get_string_array(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
unsigned int hashpjw(const void *key) { return *(int *)key; }


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

x86 assembly (clang, -O2):
<hashpjw>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @hashpjw(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @hashpjw(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void nguraTTYPutNumber(int i) { printf("%d", i); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @nguraTTYPutNumber(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}