xunge/DecIR huggingface dataset:
/* Variables and functions */
int test1();
int test2();
int main(void) { return test1() + test2(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test1@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test2@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <test1@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <test2@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test1()
%3 = call i32 (...) @test2()
%4 = add nsw i32 %2, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test1()
%2 = tail call i32 (...) @test2()
%3 = add nsw i32 %2, %1
ret i32 %3
}
double __extendsfdf2(float a __attribute__((unused))) { return 0.0; }


x86 assembly (clang, -O0):
<__extendsfdf2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__extendsfdf2>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @__extendsfdf2(float %0) {
%2 = alloca float
store float %0, float* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @__extendsfdf2(float %0) {
ret double 0.000000e+00
}
double topocentric_elevation_angle_corrected(double e0, double delta_e) {
  return e0 + delta_e;
}


x86 assembly (clang, -O0):
<topocentric_elevation_angle_corrected>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<topocentric_elevation_angle_corrected>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @topocentric_elevation_angle_corrected(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @topocentric_elevation_angle_corrected(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
int dim(int arr[]) { return sizeof(arr) / sizeof(*arr); }


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

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

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

LLVM IR (-O2):
define i32 @dim(i32* nocapture readnone %0) {
ret i32 2
}
int exact_square(int n) {
  int a;
  for (a = 0; a * a <= n; a++) {
    if (n == a * a) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     114f <exact_square+0x4f>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    113c <exact_square+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1156 <exact_square+0x56>
jmp    1141 <exact_square+0x41>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <exact_square+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
test   %edi,%edi
js     1120 <exact_square+0x20>
xor    %edx,%edx
mov    $0x1,%eax
mov    $0x1,%ecx
cmp    %edi,%edx
je     1122 <exact_square+0x22>
mov    %ecx,%edx
imul   %ecx,%edx
add    $0x1,%ecx
cmp    %edi,%edx
jle    1110 <exact_square+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %11, label %6
3: ; preds = %6
%4 = mul nsw i32 %10, %10
%5 = icmp sgt i32 %4, %0
br i1 %5, label %11, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 0, %1 ]
%8 = phi i32 [ %10, %3 ], [ 0, %1 ]
%9 = icmp eq i32 %7, %0
%10 = add nuw nsw i32 %8, 1
br i1 %9, label %11, label %3
11: ; preds = %6, %3, %1
%12 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %6 ]
ret i32 %12
}
void PowerCtrlPadSleepDisable(void) {
  (*((volatile unsigned long *)(0x40090000 + 0x0000002C))) = 1;
  (*((volatile unsigned long *)(0x40092000 + 0x0000002C)));
}


x86 assembly (clang, -O0):
<PowerCtrlPadSleepDisable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4009002c,%eax
movq   $0x1,(%rax)
mov    $0x4009202c,%eax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PowerCtrlPadSleepDisable>:
movq   $0x1,0x4009002c
mov    0x4009202c,%rax
40
ret

LLVM IR (-O0):
define void @PowerCtrlPadSleepDisable() {
store volatile i64 1, i64* inttoptr (i64 1074331692 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 1074339884 to i64*)
ret void
}

LLVM IR (-O2):
define void @PowerCtrlPadSleepDisable() {
store volatile i64 1, i64* inttoptr (i64 1074331692 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 1074339884 to i64*)
ret void
}
int add_htab_mem_range(struct crash_mem **mem_ranges) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.crash_mem = type opaque
define i32 @add_htab_mem_range(%struct.crash_mem** nocapture readnone %0) {
ret i32 0
}
int do_bnode_init(struct stp_bnode *bnode) { return -1; }


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

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

LLVM IR (-O0):
%struct.stp_bnode = type opaque
define i32 @do_bnode_init(%struct.stp_bnode* %0) {
%2 = alloca %struct.stp_bnode*
store %struct.stp_bnode* %0, %struct.stp_bnode** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.stp_bnode = type opaque
define i32 @do_bnode_init(%struct.stp_bnode* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int log_2(unsigned long);
unsigned long round_down_2power(unsigned long val) { return 1 << (log_2(val)); }


x86 assembly (clang, -O0):
<round_down_2power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <log_2@plt>
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_down_2power>:
push   %rax
call   1030 <log_2@plt>
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%edx
movslq %edx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @round_down_2power(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @log_2(i64 %3)
%5 = shl i32 1, %4
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @round_down_2power(i64 %0) {
%2 = tail call i32 @log_2(i64 %0)
%3 = shl nuw i32 1, %2
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int getint(int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int test;
  int status;
  status = getint(&test);
  printf("status: %d\n", status);
  printf("value: %d\n\n", test);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <getint@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"status: %d\0A\00"
@.str.1 = [12 x i8] c"value: %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @getint(i32* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() {
  printf("xkeymacs - X11 KEYboard MACroS\n"
         "Usage:\n"
         "\txkeymacs [OPTION]\n"
         "Options:\n"
         "\t-d, --daemon\n"
         "\t\tstart xkeymacs as daemon\n"
         "\t-h, --help\n"
         "\t\tdisplay this help and exit\n");
}


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

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

LLVM IR (-O0):
@.str = [149 x i8] c"xkeymacs - X11 KEYboard MACroS\0AUsage:\0A\09xkeymacs [OPTION]\0AOptions:\0A\09-d, --daemon\0A\09\09start xkeymacs as daemon\0A\09-h, --help\0A\09\09display this help and exit\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [148 x i8] c"xkeymacs - X11 KEYboard MACroS\0AUsage:\0A\09xkeymacs [OPTION]\0AOptions:\0A\09-d, --daemon\0A\09\09start xkeymacs as daemon\0A\09-h, --help\0A\09\09display this help and exit\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([148 x i8], [148 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct cstr_t {
  int dummy;
};

/* Variables and functions */
int cstr_comparestrat(struct cstr_t const *, int /*<<< orphan*/, char const *,
                      int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int cstr_comparestr(const struct cstr_t *a, const char *b) {
  ;
  int rval = cstr_comparestrat(a, 0, b, strlen(b));
  { return (rval); };
}


x86 assembly (clang, -O0):
<cstr_comparestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
xor    %esi,%esi
call   1040 <cstr_comparestrat@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstr_comparestr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cstr_comparestrat@plt>

LLVM IR (-O0):
%struct.cstr_t = type { i32 }
define i32 @cstr_comparestr(%struct.cstr_t* %0, i8* %1) {
%3 = alloca %struct.cstr_t*
%4 = alloca i8*
%5 = alloca i32
store %struct.cstr_t* %0, %struct.cstr_t** %3
store i8* %1, i8** %4
%6 = load %struct.cstr_t*, %struct.cstr_t** %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @cstr_comparestrat(%struct.cstr_t* %6, i32 0, i8* %7, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
%struct.cstr_t = type { i32 }
define i32 @cstr_comparestr(%struct.cstr_t* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @cstr_comparestrat(%struct.cstr_t* %0, i32 0, i8* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, int);
void _copy_chromosome_double(void *dst, const void *src, int size) {
  memcpy(dst, src, size * sizeof(double));
}


x86 assembly (clang, -O0):
<_copy_chromosome_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_copy_chromosome_double>:
shl    $0x3,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @_copy_chromosome_double(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 8
%12 = trunc i64 %11 to i32
%13 = call i32 @memcpy(i8* %7, i8* %8, i32 %12)
ret void
}

LLVM IR (-O2):
define void @_copy_chromosome_double(i8* %0, i8* %1, i32 %2) {
%4 = shl i32 %2, 3
%5 = tail call i32 @memcpy(i8* %0, i8* %1, i32 %4)
ret void
}
/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ printf(char *, char const *);
int usage(const char *argv0) {
  printf("Usage: %s cg-path device-index\n", argv0);
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [32 x i8] c"Usage: %s cg-path device-index\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
ret i32 %5
}

LLVM IR (-O2):
@.str = [32 x i8] c"Usage: %s cg-path device-index\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ radix_tree_tag_clear(int *);
int main() {
  int n;
  radix_tree_tag_clear(&n);
  if (n != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <radix_tree_tag_clear@plt>
cmpl   $0x1,-0x8(%rbp)
je     1149 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <radix_tree_tag_clear@plt>
cmpl   $0x1,0x4(%rsp)
jne    1136 <main+0x16>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @radix_tree_tag_clear(i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 1
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}
/* Type definitions */
struct emu_value {
  int dummy;
};

/* Variables and functions */
struct emu_value *emu_value_append_int(struct emu_value *, int /*<<< orphan*/);
int /*<<< orphan*/ emu_value_new(char const *);
struct emu_value *emu_value_append(struct emu_value *value, const char *buf) {
  return emu_value_append_int(value, emu_value_new(buf));
}


x86 assembly (clang, -O0):
<emu_value_append>:
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    -0x10(%rbp),%rdi
call   1030 <emu_value_new@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <emu_value_append_int@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emu_value_append>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <emu_value_new@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <emu_value_append_int@plt>

LLVM IR (-O0):
%struct.emu_value = type { i32 }
define %struct.emu_value* @emu_value_append(%struct.emu_value* %0, i8* %1) {
%3 = alloca %struct.emu_value*
%4 = alloca i8*
store %struct.emu_value* %0, %struct.emu_value** %3
store i8* %1, i8** %4
%5 = load %struct.emu_value*, %struct.emu_value** %3
%6 = load i8*, i8** %4
%7 = call i32 @emu_value_new(i8* %6)
%8 = call %struct.emu_value* @emu_value_append_int(%struct.emu_value* %5, i32 %7)
ret %struct.emu_value* %8
}

LLVM IR (-O2):
%struct.emu_value = type { i32 }
define %struct.emu_value* @emu_value_append(%struct.emu_value* %0, i8* %1) {
%3 = tail call i32 @emu_value_new(i8* %1)
%4 = tail call %struct.emu_value* @emu_value_append_int(%struct.emu_value* %0, i32 %3)
ret %struct.emu_value* %4
}
/* Variables and functions */
char *strrchr(char *, char);
char *_glp_lib_strtrim(char *str) {
  char *t;
  for (t = strrchr(str, '\0') - 1; t >= str; t--) {
    if (*t != ' ')
      break;
    *t = '\0';
  }
  return str;
}


x86 assembly (clang, -O0):
<_glp_lib_strtrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <strrchr@plt>
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jb     116a <_glp_lib_strtrim+0x5a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1152 <_glp_lib_strtrim+0x42>
jmp    116a <_glp_lib_strtrim+0x5a>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <_glp_lib_strtrim+0x1f>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_glp_lib_strtrim>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
add    %rbx,%rax
add    $0xffffffffffffffff,%rax
cmp    %rbx,%rax
jb     1141 <_glp_lib_strtrim+0x31>
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x20,(%rax)
jne    1141 <_glp_lib_strtrim+0x31>
movb   $0x0,(%rax)
add    $0xffffffffffffffff,%rax
cmp    %rbx,%rax
jae    1130 <_glp_lib_strtrim+0x20>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @_glp_lib_strtrim(i8* returned %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = getelementptr i8, i8* %0, i64 %2
%4 = getelementptr inbounds i8, i8* %3, i64 -1
%5 = icmp ult i8* %4, %0
br i1 %5, label %13, label %6
6: ; preds = %1, %10
%7 = phi i8* [ %11, %10 ], [ %4, %1 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 32
br i1 %9, label %10, label %13
10: ; preds = %6
store i8 0, i8* %7
%11 = getelementptr inbounds i8, i8* %7, i64 -1
%12 = icmp ult i8* %11, %0
br i1 %12, label %13, label %6
13: ; preds = %10, %6, %1
ret i8* %0
}
void rop3_247_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D & S;
  stk2 = ~stk2;
  stk1 = T | stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


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

x86 assembly (clang, -O2):
<rop3_247_1_0>:
not    %sil
or     %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_247_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = and i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = or i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = load i8, i8* %5
%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 = trunc i32 %38 to i8
%40 = load i8*, i8** %4
store i8 %39, i8* %40
ret void
}

LLVM IR (-O2):
define void @rop3_247_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %1, -1
%6 = or i8 %4, %5
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int setAllLedOn2(void) {
  puts("0");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
define i32 @setAllLedOn2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void RTAvlroGCPhysGetRoot(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlroGCPhysGetRoot() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ is_valid_block_size(size_t const);
size_t round_down_to_block_size(const size_t n) {
  static const size_t shift =
      (3 + (18 * sizeof(size_t) - sizeof(size_t) * sizeof(size_t) - 8) / 24) -
      2;
  const size_t ans = (n >> shift) << shift;
  assert(is_valid_block_size(ans));
  return ans;
}


x86 assembly (clang, -O0):
<round_down_to_block_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x4,%rax
shl    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <is_valid_block_size@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_down_to_block_size>:
push   %rbx
mov    %rdi,%rbx
and    $0xfffffffffffffff0,%rbx
mov    %rbx,%rdi
call   1030 <is_valid_block_size@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@round_down_to_block_size.shift = internal constant i64 4
define i64 @round_down_to_block_size(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = lshr i64 %4, 4
%6 = shl i64 %5, 4
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = call i32 @is_valid_block_size(i64 %7)
%9 = call i32 @assert(i32 %8)
%10 = load i64, i64* %3
ret i64 %10
}

LLVM IR (-O2):
define i64 @round_down_to_block_size(i64 %0) {
%2 = and i64 %0, -16
%3 = tail call i32 @is_valid_block_size(i64 %2)
%4 = tail call i32 @assert(i32 %3)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void cmd_free(char *cmd) { free(cmd); }


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

x86 assembly (clang, -O2):
<cmd_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @cmd_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fwrite_unlocked(char const *, int, size_t, int /*<<< orphan*/ *);
size_t callback(void *file, const char *s, size_t nBytes) {
  return fwrite_unlocked(s, 1, nBytes, (FILE *)file);
}


x86 assembly (clang, -O0):
<callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fwrite_unlocked@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callback>:
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
jmp    1030 <fwrite_unlocked@plt>

LLVM IR (-O0):
define i64 @callback(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
%11 = call i64 @fwrite_unlocked(i8* %7, i32 1, i64 %8, i32* %10)
ret i64 %11
}

LLVM IR (-O2):
define i64 @callback(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i64 @fwrite_unlocked(i8* %1, i32 1, i64 %2, i32* %4)
ret i64 %5
}
/* Variables and functions */
scalar_t__ isspace(char);
int /*<<< orphan*/ strcpy(char *, char *);
char *ltrim(char *string) {
  while (isspace(*string))
    strcpy((string + 0), (string + 0 + 1));
  return string;
}


x86 assembly (clang, -O0):
<ltrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1158 <ltrim+0x38>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    112c <ltrim+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltrim>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1158 <ltrim+0x38>
lea    0x1(%rbx),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movsbl (%rbx),%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1140 <ltrim+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @ltrim(i8* returned %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isspace(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
br label %7
7: ; preds = %5, %7
%8 = tail call i32 @strcpy(i8* %0, i8* %6)
%9 = load i8, i8* %0
%10 = tail call i64 @isspace(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %1
ret i8* %0
}
int test_imm_78uint16_mem(unsigned short *val) {
  return ((*val) & (0x78 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_78uint16_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, 120
%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_78uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 120
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int get_y(int pair) { return (pair >> 10) & 1023; }


x86 assembly (clang, -O0):
<get_y>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xa,%eax
and    $0x3ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_y>:
mov    %edi,%eax
shr    $0xa,%eax
and    $0x3ff,%eax
ret

LLVM IR (-O0):
define i32 @get_y(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 10
%5 = and i32 %4, 1023
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_y(i32 %0) {
%2 = lshr i32 %0, 10
%3 = and i32 %2, 1023
ret i32 %3
}
unsigned short getds(void) {
  unsigned short ds;
  asm("mov %%ds, %0" : "=r"(ds) :);
  return ds;
}


x86 assembly (clang, -O0):
<getds>:
push   %rbp
mov    %rsp,%rbp
mov    %ds,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getds>:
mov    %ds,%ax
ret

LLVM IR (-O0):
define zeroext i16 @getds() {
%1 = alloca i16
%2 = call i16 asm "mov %ds, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i16 %2, i16* %1
%3 = load i16, i16* %1
ret i16 %3
}

LLVM IR (-O2):
define zeroext i16 @getds() {
%1 = tail call i16 asm "mov %ds, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i16 %1
}
int num(int number) {
  int i = 1;
  while ((number = number / 10) > 0) {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<num>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jle    1133 <num+0x33>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <num+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num>:
mov    $0x1,%eax
cmp    $0xa,%edi
jl     1134 <num+0x34>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <num+0x20>
ret

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

LLVM IR (-O2):
define i32 @num(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 99
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %10
}
void button_init() {
  *((volatile unsigned long *)0x7f008830) = (0x2) | (0x2 << 10);
}


x86 assembly (clang, -O0):
<button_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f008830,%eax
movq   $0x802,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<button_init>:
movq   $0x802,0x7f008830
ret

LLVM IR (-O0):
define void @button_init() {
store volatile i64 2050, i64* inttoptr (i64 2130741296 to i64*)
ret void
}

LLVM IR (-O2):
define void @button_init() {
store volatile i64 2050, i64* inttoptr (i64 2130741296 to i64*)
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *);
void GetTimeOfDay(struct timeval *tval) { gettimeofday(tval); }


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

x86 assembly (clang, -O2):
<GetTimeOfDay>:
jmp    1030 <gettimeofday@plt>

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @GetTimeOfDay(%struct.timeval* %0) {
%2 = tail call i32 @gettimeofday(%struct.timeval* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *currProcess) {
  printf("Usage: %s cpfnumber\n", currProcess);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [21 x i8] c"Usage: %s cpfnumber\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ version();
void print_version(void) {
  version();
  exit(-1);
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <version@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_version>:
push   %rax
xor    %eax,%eax
call   1030 <version@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @print_version() {
%1 = call i32 (...) @version()
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @print_version() {
%1 = tail call i32 (...) @version()
%2 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ sockets_initialize();
int /*<<< orphan*/ useSockets();
void test4(void) {
  sockets_initialize();
  useSockets();
}


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

x86 assembly (clang, -O2):
<test4>:
push   %rax
xor    %eax,%eax
call   1030 <sockets_initialize@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <useSockets@plt>

LLVM IR (-O0):
define void @test4() {
%1 = call i32 (...) @sockets_initialize()
%2 = call i32 (...) @useSockets()
ret void
}

LLVM IR (-O2):
define void @test4() {
%1 = tail call i32 (...) @sockets_initialize()
%2 = tail call i32 (...) @useSockets()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xip_fpo_flttofix_int_d(int *, double);
int xil_fpo_flttofix_int_d(double a) {
  int res_int;
  xip_fpo_flttofix_int_d(&res_int, a);
  return res_int;
}


x86 assembly (clang, -O0):
<xil_fpo_flttofix_int_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0xc(%rbp),%rdi
call   1030 <xip_fpo_flttofix_int_d@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xil_fpo_flttofix_int_d>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <xip_fpo_flttofix_int_d@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @xil_fpo_flttofix_int_d(double %0) {
%2 = alloca double
%3 = alloca i32
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 @xip_fpo_flttofix_int_d(i32* %3, double %4)
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @xil_fpo_flttofix_int_d(double %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @xip_fpo_flttofix_int_d(i32* %2, double %0)
%5 = load i32, i32* %2
ret i32 %5
}
unsigned long bit_toggle(register unsigned long value,
                         register unsigned long pos) {
  return (value ^= (1 << (pos)));
}


x86 assembly (clang, -O0):
<bit_toggle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
xor    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_toggle>:
mov    %rsi,%rcx
mov    $0x1,%eax
shl    %cl,%eax
cltq
xor    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @bit_toggle(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 1, %6
%8 = sext i32 %7 to i64
%9 = load i64, i64* %3
%10 = xor i64 %9, %8
store i64 %10, i64* %3
ret i64 %10
}

LLVM IR (-O2):
define i64 @bit_toggle(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl nuw i32 1, %3
%5 = sext i32 %4 to i64
%6 = xor i64 %5, %0
ret i64 %6
}
/* Variables and functions */
scalar_t__ nrfx_usbd_errata_type_52840_eng_a();
bool nrfx_usbd_errata_104(void) {
  return (1 && nrfx_usbd_errata_type_52840_eng_a());
}


x86 assembly (clang, -O0):
<nrfx_usbd_errata_104>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <nrfx_usbd_errata_type_52840_eng_a@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @nrfx_usbd_errata_104() {
%1 = tail call i64 (...) @nrfx_usbd_errata_type_52840_eng_a()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
unsigned int _uiKeyPressed(void) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @_uiKeyPressed() {
ret i32 0
}
void g_hash_table_size() {}


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

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

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

LLVM IR (-O2):
define void @g_hash_table_size() {
ret void
}
void setds(unsigned short ds) { asm("movw %0, %%ds" : : "r"(ds)); }


x86 assembly (clang, -O0):
<setds>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
mov    %eax,%ds
pop    %rbp
ret

x86 assembly (clang, -O2):
<setds>:
mov    %edi,%ds
ret

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

LLVM IR (-O2):
define void @setds(i16 zeroext %0) {
tail call void asm sideeffect "movw $0, %ds", "r,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void tty_restore(int __attribute__((unused)) signo) { exit(0); }


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

x86 assembly (clang, -O2):
<tty_restore>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @tty_restore(i32 %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ltrim(char *);
int /*<<< orphan*/ rtrim(char *);
void trim(char *text) {
  rtrim(text);
  ltrim(text);
}


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

x86 assembly (clang, -O2):
<trim>:
push   %rbx
mov    %rdi,%rbx
call   1030 <rtrim@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <ltrim@plt>

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

LLVM IR (-O2):
define void @trim(i8* %0) {
%2 = tail call i32 @rtrim(i8* %0)
%3 = tail call i32 @ltrim(i8* %0)
ret void
}
unsigned int max(long long a, long long b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <max+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <max+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @max(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 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
%14 = trunc i64 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @max(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef char *uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint32_t inl(uint16_t port) {
  uint32_t val;
  __asm__ __volatile__("inl %%dx, %%eax" : "=a"(val) : "d"(port));
  return val;
}


x86 assembly (clang, -O0):
<inl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl>:
mov    %edi,%edx
in     (%dx),%eax
ret

LLVM IR (-O0):
define i8* @inl(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* asm sideeffect "inl %dx, %eax", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define i8* @inl(i32 %0) {
%2 = tail call i8* asm sideeffect "inl %dx, %eax", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i8* %2
}
/* Variables and functions */
int vapi_sub_test_start();
int main(int argc, char *argv[]) { return vapi_sub_test_start(); }


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    $0x0,%al
call   1030 <vapi_sub_test_start@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
jmp    1030 <vapi_sub_test_start@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 = call i32 (...) @vapi_sub_test_start()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @vapi_sub_test_start()
ret i32 %3
}
void test_invalid_clause() {
  int i;
#pragma omp simd foo bar
  for (i = 0; i < 16; ++i)
    ;
}


x86 assembly (clang, -O0):
<test_invalid_clause>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1128 <test_invalid_clause+0x28>
jmp    111a <test_invalid_clause+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <test_invalid_clause+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_invalid_clause() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 16
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @test_invalid_clause() {
ret void
}
/* Variables and functions */
char EOF;
char getchar();
void clear_buffer(void) {
  char c;
  while ((c = getchar() != '\n') && (c != EOF))
    continue;
}


x86 assembly (clang, -O0):
<clear_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x1(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
je     1157 <clear_buffer+0x47>
movsbl -0x1(%rbp),%eax
mov    0x2e9c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1167 <clear_buffer+0x57>
jmp    116c <clear_buffer+0x5c>
jmp    1118 <clear_buffer+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_buffer>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
xor    %ecx,%ecx
cmp    $0xa,%al
setne  %al
je     1139 <clear_buffer+0x29>
mov    %al,%cl
movsbl (%rbx),%eax
cmp    %eax,%ecx
jne    1120 <clear_buffer+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @clear_buffer() {
%1 = alloca i8
br label %2
2: ; preds = %18, %0
%3 = call signext i8 (...) @getchar()
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 10
%6 = zext i1 %5 to i32
%7 = trunc i32 %6 to i8
store i8 %7, i8* %1
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
%13 = load i8, i8* @EOF
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %12, %14
br label %16
16: ; preds = %10, %2
%17 = phi i1 [ false, %2 ], [ %15, %10 ]
br i1 %17, label %18, label %19
18: ; preds = %16
br label %2
19: ; preds = %16
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @clear_buffer() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp ne i8 %2, 10
%4 = zext i1 %3 to i32
%5 = load i8, i8* @EOF
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %4, %6
%8 = select i1 %3, i1 %7, i1 false
br i1 %8, label %1, label %9
9: ; preds = %1
ret void
}