xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t hashids_div_ceil_size_t(size_t x, size_t y) { return x / y + !!(x % y); }


x86 assembly (clang, -O0):
<hashids_div_ceil_size_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    -0x18(%rbp),%rax
cmp    $0x0,%rdx
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashids_div_ceil_size_t>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1116 <hashids_div_ceil_size_t+0x16>
xor    %edx,%edx
div    %rsi
jmp    111a <hashids_div_ceil_size_t+0x1a>
xor    %edx,%edx
div    %esi
cmp    $0x1,%rdx
sbb    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @hashids_div_ceil_size_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = udiv i64 %5, %6
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = urem i64 %8, %9
%11 = icmp ne i64 %10, 0
%12 = xor i1 %11, true
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = sext i32 %14 to i64
%16 = add i64 %7, %15
ret i64 %16
}

LLVM IR (-O2):
define i64 @hashids_div_ceil_size_t(i64 %0, i64 %1) {
%3 = udiv i64 %0, %1
%4 = urem i64 %0, %1
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = add i64 %3, %6
ret i64 %7
}
/* Variables and functions */
int sum(int, int);
int main(int argc, char **argv) { return sum(42, argc); }


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

x86 assembly (clang, -O2):
<main>:
mov    %edi,%esi
mov    $0x2a,%edi
jmp    1030 <sum@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sum(i32 42, i32 %0)
ret i32 %3
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void main() {
  int32_t a;
  a = 1;
  a ^= 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x2,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
void load_arena_mob() { return; }


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

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

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

LLVM IR (-O2):
define void @load_arena_mob() {
ret void
}
int test(float a) { return (a * a); }


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mulss  %xmm0,%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @test(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fmul float %3, %4
%6 = fptosi float %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test(float %0) {
%2 = fmul float %0, %0
%3 = fptosi float %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XDisplayKeycodes() {
  printf("XDisplayKeycodes called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [24 x i8] c"XDisplayKeycodes called\00"
define i32 @XDisplayKeycodes() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, float);
int main(void) {
  int anInt = 213;
  float aFloat = 3.14;
  printf("An integer: %3d\nA float: %0.2f\n", anInt, aFloat);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd5,-0x8(%rbp)
movss  0xed2(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
mov    $0xd5,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"An integer: %3d\0AA float: %0.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 213, i32* %2
store float 0x40091EB860000000, float* %3
%4 = load i32, i32* %2
%5 = load float, float* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %4, float %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"An integer: %3d\0AA float: %0.2f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 213, float 0x40091EB860000000)
ret i32 0
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int);
int pinRead(int pin) {
  int regval;
  srand(pin);
  regval = rand();
  regval &= 1;
  return regval;
}


x86 assembly (clang, -O0):
<pinRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pinRead>:
push   %rax
call   1030 <srand@plt>
xor    %eax,%eax
call   1040 <rand@plt>
and    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pinRead(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @rand()
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = and i32 %7, 1
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @pinRead(i32 %0) {
%2 = tail call i32 @srand(i32 %0)
%3 = tail call i32 (...) @rand()
%4 = and i32 %3, 1
ret i32 %4
}
int test_imm_B8uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xB8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B8uint64_midword_mem>:
testb  $0xb8,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B8uint64_midword_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, 16
%6 = and i64 %5, 184
%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_B8uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12058624
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int, int);
void merge_sort(int A[], int p, int r) {
  if (p < r) {
    int q = (p + r) / 2;
    merge_sort(A, p, q);
    merge_sort(A, q + 1, r);
    merge(A, p, q, r);
  }
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <merge_sort+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    %edx,%esi
jge    1172 <merge_sort+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1040 <merge_sort@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1040 <merge_sort@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <merge@plt>
ret

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

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @merge_sort(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @merge_sort(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
double dist_ie(int dist) {
  double result;
  if (1500 <= dist && dist < 3000) {
    result = 0.15;
  } else if (1 <= dist && dist < 100) {
    result = 0.14;
  } else if (100 <= dist && dist < 1500) {
    result = 0.01;
  } else {
    result = 0.7;
  }
  return result;
}


x86 assembly (clang, -O0):
<dist_ie>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x5dc,%eax
cmp    -0x4(%rbp),%eax
jg     1134 <dist_ie+0x34>
cmpl   $0xbb8,-0x4(%rbp)
jge    1134 <dist_ie+0x34>
movsd  0xeee(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11a2 <dist_ie+0xa2>
mov    $0x1,%eax
cmp    -0x4(%rbp),%eax
jg     115e <dist_ie+0x5e>
cmpl   $0x64,-0x4(%rbp)
jge    115e <dist_ie+0x5e>
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    119d <dist_ie+0x9d>
mov    $0x64,%eax
cmp    -0x4(%rbp),%eax
jg     118b <dist_ie+0x8b>
cmpl   $0x5dc,-0x4(%rbp)
jge    118b <dist_ie+0x8b>
movsd  0xe87(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1198 <dist_ie+0x98>
movsd  0xe6d(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    119d <dist_ie+0x9d>
jmp    11a2 <dist_ie+0xa2>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_ie>:
lea    -0x5dc(%rdi),%eax
cmp    $0x5dc,%eax
jae    1116 <dist_ie+0x16>
movsd  0xeeb(%rip),%xmm0
ret
lea    -0x1(%rdi),%eax
cmp    $0x63,%eax
jae    1127 <dist_ie+0x27>
movsd  0xee2(%rip),%xmm0
ret
add    $0xffffff9c,%edi
xor    %eax,%eax
cmp    $0x578,%edi
setb   %al
lea    0xed4(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @dist_ie(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sle i32 1500, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 3000
br i1 %8, label %9, label %10
9: ; preds = %6
store double 1.500000e-01, double* %3
br label %27
10: ; preds = %6, %1
%11 = load i32, i32* %2
%12 = icmp sle i32 1, %11
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %17
16: ; preds = %13
store double 1.400000e-01, double* %3
br label %26
17: ; preds = %13, %10
%18 = load i32, i32* %2
%19 = icmp sle i32 100, %18
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 1500
br i1 %22, label %23, label %24
23: ; preds = %20
store double 1.000000e-02, double* %3
br label %25
24: ; preds = %20, %17
store double 0x3FE6666666666666, double* %3
br label %25
25: ; preds = %24, %23
br label %26
26: ; preds = %25, %16
br label %27
27: ; preds = %26, %9
%28 = load double, double* %3
ret double %28
}

LLVM IR (-O2):
define double @dist_ie(i32 %0) {
%2 = add i32 %0, -1500
%3 = icmp ult i32 %2, 1500
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = add i32 %0, -1
%6 = icmp ult i32 %5, 99
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = add i32 %0, -100
%9 = icmp ult i32 %8, 1400
%10 = select i1 %9, double 1.000000e-02, double 0x3FE6666666666666
br label %11
11: ; preds = %7, %4, %1
%12 = phi double [ 1.500000e-01, %1 ], [ 1.400000e-01, %4 ], [ %10, %7 ]
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void cls(void) { system("clear"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @cls() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_85uint8_reg(unsigned char val) {
  return ((val) & (-0x85 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_85uint8_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, -133
%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_85uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 123
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void nrerror(char error_text[]) {
  fprintf(stderr, "Run time error....\n");
  fprintf(stderr, "%s\n", error_text);
  fprintf(stderr, "Now exiting the system\n");
  exit(1);
}


x86 assembly (clang, -O0):
<nrerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<nrerror>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xecb(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xebb(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Run time error....\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [24 x i8] c"Now exiting the system\0A\00"
define void @nrerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %2
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Run time error....\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [24 x i8] c"Now exiting the system\0A\00"
define void @nrerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
int fn6(int a, int b, int m) { return (m & b) | (a & ~m); }


x86 assembly (clang, -O0):
<fn6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn6>:
mov    %esi,%eax
xor    %edi,%eax
and    %edx,%eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @fn6(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %5
%9 = and i32 %7, %8
%10 = load i32, i32* %4
%11 = load i32, i32* %6
%12 = xor i32 %11, -1
%13 = and i32 %10, %12
%14 = or i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @fn6(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, %1
%5 = xor i32 %2, -1
%6 = and i32 %5, %0
%7 = or i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ checkPalindrome(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
char *srtingReversal(char *);
void main() {
  char *a = (char *)malloc(sizeof(char) * 100);
  if (!a) {
    printf("Unable to allocate mem to a.\n");
    return;
  }
  a = "raviivark";
  checkPalindrome(a);
  printf("%s\n", srtingReversal(a));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1174 <main+0x34>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a2 <main+0x62>
lea    0xea3(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <checkPalindrome@plt>
mov    -0x8(%rbp),%rdi
call   1060 <srtingReversal@plt>
mov    %rax,%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1170 <main+0x30>
lea    0xea9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <checkPalindrome@plt>
mov    %rbx,%rdi
call   1060 <srtingReversal@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <puts@plt>
lea    0xe93(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Unable to allocate mem to a.\0A\00"
@.str.1 = [10 x i8] c"raviivark\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 100)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp ne i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %14
8: ; preds = %0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %1
%9 = load i8*, i8** %1
%10 = call i32 @checkPalindrome(i8* %9)
%11 = load i8*, i8** %1
%12 = call i8* @srtingReversal(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"raviivark\00"
@str = [29 x i8] c"Unable to allocate mem to a.\00"
define void @main() {
%1 = tail call i64 @malloc(i32 100)
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @checkPalindrome(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i8* @srtingReversal(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %0, %3
%7 = phi i8* [ %5, %3 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0), %0 ]
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MixerSettingsHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void MixerSettingsUpdated() { UAVObjUpdated(MixerSettingsHandle()); }


x86 assembly (clang, -O0):
<MixerSettingsUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <MixerSettingsHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MixerSettingsUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <MixerSettingsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @MixerSettingsUpdated() {
%1 = call i32 (...) @MixerSettingsHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @MixerSettingsUpdated() {
%1 = tail call i32 (...) @MixerSettingsHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void EMACFrameFilterSet(uint32_t ui32Base, uint32_t ui32FilterOpts) {
  ASSERT((ui32FilterOpts &
          ~(0x80000000 | 0x00010000 | 0x00000400 | 0x00000200 | 0x00000100 |
            (0x01 << 6) | (0x02 << 6) | (0x03 << 6) | 0x00000020 | 0x00000010 |
            0x00000008 | 0x00000004 | 0x00000002 | 0x00000001)) == 0);
  (*((volatile uint32_t *)(ui32Base + 0x00000004))) =
      (((*((volatile uint32_t *)(ui32Base + 0x00000004))) &
        ~(0x80000000 | 0x00010000 | 0x00000400 | 0x00000200 | 0x00000100 |
          (0x01 << 6) | (0x02 << 6) | (0x03 << 6) | 0x00000020 | 0x00000010 |
          0x00000008 | 0x00000004 | 0x00000002 | 0x00000001)) |
       ui32FilterOpts);
}


x86 assembly (clang, -O0):
<EMACFrameFilterSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7ffef800,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%ecx
and    $0x7ffef800,%ecx
or     -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACFrameFilterSet>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
test   $0x7ffef800,%esi
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    $0x7ffef800,%ecx
and    0x4(%rax),%ecx
or     %ebx,%ecx
mov    %ecx,0x4(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @EMACFrameFilterSet(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 = and i32 %5, 2147416064
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @ASSERT(i32 %8)
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 4
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, 2147416064
%16 = load i32, i32* %4
%17 = or i32 %15, %16
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 4
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
store volatile i32 %17, i32* %21
ret void
}

LLVM IR (-O2):
define void @EMACFrameFilterSet(i32 %0, i32 %1) {
%3 = and i32 %1, 2147416064
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = add nsw i32 %0, 4
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = and i32 %10, 2147416064
%12 = or i32 %11, %1
store volatile i32 %12, i32* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_diamond(int);
int main() {
  int num = 3;
  print_diamond(num);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_diamond(i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char const *);
void Warning(const char *warn) {
  printf("WARNING:");
  printf(warn);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<Warning>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"WARNING:\00"
define void @Warning(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) %0)
%4 = tail call i32 @putchar(i32 10)
ret void
}
void rop3_150_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T ^ S;
  stk1 = *D ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


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

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

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

LLVM IR (-O2):
define void @rop3_150_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void udev_log_close(void) { closelog(); }


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

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

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

LLVM IR (-O2):
define void @udev_log_close() {
%1 = tail call i32 (...) @closelog()
ret void
}
int main(void) {
  _Static_assert(0 == 0, "oh no!");
  return 0;
}


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

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

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

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


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

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

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

LLVM IR (-O2):
define i32 @keyclose() {
%1 = tail call i32 (...) @singlekey()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __softboundmpx_abort();
__attribute__((__weak__, __always___)) void
__softboundmpx_spatial_load_dereference_check(void *base, void *bound,
                                              void *ptr, size_t size_of_type) {
  if ((ptr < base) || ((void *)((char *)ptr + size_of_type) > bound)) {
    __softboundmpx_abort();
  }
}


x86 assembly (clang, -O0):
<__softboundmpx_spatial_load_dereference_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jb     1148 <__softboundmpx_spatial_load_dereference_check+0x38>
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    114f <__softboundmpx_spatial_load_dereference_check+0x3f>
mov    $0x0,%al
call   1030 <__softboundmpx_abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__softboundmpx_spatial_load_dereference_check>:
cmp    %rdi,%rdx
jb     111e <__softboundmpx_spatial_load_dereference_check+0xe>
add    %rcx,%rdx
cmp    %rsi,%rdx
ja     111e <__softboundmpx_spatial_load_dereference_check+0xe>
ret
xor    %eax,%eax
jmp    1030 <__softboundmpx_abort@plt>

LLVM IR (-O0):
define weak void @__softboundmpx_spatial_load_dereference_check(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %7
%10 = load i8*, i8** %5
%11 = icmp ult i8* %9, %10
br i1 %11, label %18, label %12
12: ; preds = %4
%13 = load i8*, i8** %7
%14 = load i64, i64* %8
%15 = getelementptr inbounds i8, i8* %13, i64 %14
%16 = load i8*, i8** %6
%17 = icmp ugt i8* %15, %16
br i1 %17, label %18, label %20
18: ; preds = %12, %4
%19 = call i32 (...) @__softboundmpx_abort()
br label %20
20: ; preds = %18, %12
ret void
}

LLVM IR (-O2):
define weak void @__softboundmpx_spatial_load_dereference_check(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = icmp ult i8* %2, %0
%6 = getelementptr inbounds i8, i8* %2, i64 %3
%7 = icmp ugt i8* %6, %1
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (...) @__softboundmpx_abort()
br label %11
11: ; preds = %4, %9
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ type;
};
typedef TYPE_1__ XMappingEvent;

/* Variables and functions */
int get_XMappingEvent_type(void *_p) {
  return (int)((XMappingEvent *)_p)->type;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XMappingEvent_type(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XMappingEvent_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ SwapByteOrder_32(int /*<<< orphan*/);
void bswap_32(const int n, void *u) {
  uint32_t *T = u;
  int i;
#pragma omp parallel for private(i)
  for (i = 0; i < n; i++) {
    *(T + i) = SwapByteOrder_32(*(T + i));
  }
  return;
}


x86 assembly (clang, -O0):
<bswap_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1165 <bswap_32+0x55>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <SwapByteOrder_32@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112e <bswap_32+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap_32>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1146 <bswap_32+0x36>
mov    %rsi,%r15
mov    %edi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%edi
call   1030 <SwapByteOrder_32@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <bswap_32+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @bswap_32(i32 %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %3, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @SwapByteOrder_32(i32 %10)
store i32 %11, i32* %9
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %2
ret void
}
int test_imm_93int8_mem(signed char *val) {
  return ((*val) & (-0x93 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_93int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff6d,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_93int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -147
%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_93int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -147
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
int round_up(double num) { return (num - (int)num < 0.5) ? num : ++num; }


x86 assembly (clang, -O0):
<round_up>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
cvttsd2si -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
subsd  %xmm0,%xmm1
movsd  0xedd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    113c <round_up+0x3c>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1153 <round_up+0x53>
movsd  0xec4(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up>:
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movsd  0xee8(%rip),%xmm1
addsd  %xmm0,%xmm1
cmpltsd 0xee3(%rip),%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm0,%xmm2
cvttsd2si %xmm2,%eax
ret

LLVM IR (-O0):
define i32 @round_up(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fptosi double %4 to i32
%6 = sitofp i32 %5 to double
%7 = fsub double %3, %6
%8 = fcmp olt double %7, 5.000000e-01
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load double, double* %2
br label %14
11: ; preds = %1
%12 = load double, double* %2
%13 = fadd double %12, 1.000000e+00
store double %13, double* %2
br label %14
14: ; preds = %11, %9
%15 = phi double [ %10, %9 ], [ %13, %11 ]
%16 = fptosi double %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @round_up(double %0) {
%2 = fptosi double %0 to i32
%3 = sitofp i32 %2 to double
%4 = fsub double %0, %3
%5 = fcmp olt double %4, 5.000000e-01
%6 = fadd double %0, 1.000000e+00
%7 = select i1 %5, double %0, double %6
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ Echo(char);
void Erase(void) {
  Echo((char)010);
  Echo(' ');
  Echo((char)010);
}


x86 assembly (clang, -O0):
<Erase>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8,%edi
call   1030 <Echo@plt>
mov    $0x20,%edi
call   1030 <Echo@plt>
mov    $0x8,%edi
call   1030 <Echo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Erase>:
push   %rax
mov    $0x8,%edi
call   1030 <Echo@plt>
mov    $0x20,%edi
call   1030 <Echo@plt>
mov    $0x8,%edi
pop    %rax
jmp    1030 <Echo@plt>

LLVM IR (-O0):
define void @Erase() {
%1 = call i32 @Echo(i8 signext 8)
%2 = call i32 @Echo(i8 signext 32)
%3 = call i32 @Echo(i8 signext 8)
ret void
}

LLVM IR (-O2):
define void @Erase() {
%1 = tail call i32 @Echo(i8 signext 8)
%2 = tail call i32 @Echo(i8 signext 32)
%3 = tail call i32 @Echo(i8 signext 8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void DMA2_Stream4_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @DMA2_Stream4_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @DMA2_Stream4_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
void SPI_LEDS_EnableTxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SPI_LEDS_EnableTxInt() {
ret void
}
unsigned long long int read_tsc(void) {
  unsigned long long int retval;
  __asm__ volatile("rdtsc" : "=A"(retval)::"memory");
  return retval;
}


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

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

LLVM IR (-O0):
define i64 @read_tsc() {
%1 = alloca i64
%2 = call i64 asm sideeffect "rdtsc", "=A,~{memory},~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @read_tsc() {
%1 = tail call i64 asm sideeffect "rdtsc", "=A,~{memory},~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  printf("Nome do programa: \n%s", argv[0]);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [22 x i8] c"Nome do programa: \0A%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char const *);
int /*<<< orphan*/ setsid();
int /*<<< orphan*/ umask(int);
void os_server_start_1(const char *wdir, int bg) {
  if (bg)
    setsid();
  umask(07007);
  if (wdir)
    chdir(wdir);
}


x86 assembly (clang, -O0):
<os_server_start_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1150 <os_server_start_1+0x20>
mov    $0x0,%al
call   1040 <setsid@plt>
mov    $0xe07,%edi
call   1050 <umask@plt>
cmpq   $0x0,-0x8(%rbp)
je     116e <os_server_start_1+0x3e>
mov    -0x8(%rbp),%rdi
call   1030 <chdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_server_start_1>:
push   %rbx
mov    %rdi,%rbx
test   %esi,%esi
je     113f <os_server_start_1+0xf>
xor    %eax,%eax
call   1040 <setsid@plt>
mov    $0xe07,%edi
call   1050 <umask@plt>
test   %rbx,%rbx
je     1157 <os_server_start_1+0x27>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <chdir@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @os_server_start_1(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @setsid()
br label %6
6: ; preds = %4, %2
%7 = tail call i32 @umask(i32 3591)
%8 = icmp eq i8* %0, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @chdir(i8* %0)
br label %11
11: ; preds = %9, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bef_mov();
int ins_skp() {
  bef_mov();
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @ins_skp() {
%1 = tail call i32 (...) @bef_mov()
ret i32 1
}
int IsHexChar(char ch) {
  if ((ch >= '0') && (ch <= '9'))
    return 1;
  ch |= 0x20;
  if ((ch >= 'a') && (ch <= 'f'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<IsHexChar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1130 <IsHexChar+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1130 <IsHexChar+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1167 <IsHexChar+0x67>
movsbl -0x5(%rbp),%eax
or     $0x20,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1160 <IsHexChar+0x60>
movsbl -0x5(%rbp),%eax
cmp    $0x66,%eax
jg     1160 <IsHexChar+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1167 <IsHexChar+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsHexChar>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
or     $0x20,%dil
add    $0x9f,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @IsHexChar(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %26
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = or i32 %14, 32
%16 = trunc i32 %15 to i8
store i8 %16, i8* %3
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 97
br i1 %19, label %20, label %25
20: ; preds = %12
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 102
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %2
br label %26
25: ; preds = %20, %12
store i32 0, i32* %2
br label %26
26: ; preds = %25, %24, %11
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @IsHexChar(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = or i8 %0, 32
%5 = add i8 %4, -97
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}