xunge/DecIR huggingface dataset:
/* Variables and functions */
int O_NDELAY;
int O_NOCTTY;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int console_open(int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void print(char *s) {
  int fd;
  if ((fd = console_open(O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0) {
    write(fd, s, strlen(s));
    close(fd);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    0x2e84(%rip),%rax
or     (%rax),%edi
mov    0x2e73(%rip),%rax
or     (%rax),%edi
call   1040 <console_open@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     11a5 <print+0x65>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e7e(%rip),%rcx
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    %rdi,%rbx
mov    0x2e79(%rip),%rcx
or     (%rcx),%eax
mov    %eax,%edi
call   1040 <console_open@plt>
test   %eax,%eax
js     118f <print+0x4f>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <close@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
define void @print(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* @O_WRONLY
%5 = load i32, i32* @O_NOCTTY
%6 = or i32 %4, %5
%7 = load i32, i32* @O_NDELAY
%8 = or i32 %6, %7
%9 = call i32 @console_open(i32 %8)
store i32 %9, i32* %3
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %1
%12 = load i32, i32* %3
%13 = load i8*, i8** %2
%14 = load i8*, i8** %2
%15 = call i32 @strlen(i8* %14)
%16 = call i32 @write(i32 %12, i8* %13, i32 %15)
%17 = load i32, i32* %3
%18 = call i32 @close(i32 %17)
br label %19
19: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
define void @print(i8* %0) {
%2 = load i32, i32* @O_WRONLY
%3 = load i32, i32* @O_NOCTTY
%4 = or i32 %3, %2
%5 = load i32, i32* @O_NDELAY
%6 = or i32 %4, %5
%7 = tail call i32 @console_open(i32 %6)
%8 = icmp sgt i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = tail call i32 @strlen(i8* %0)
%11 = tail call i32 @write(i32 %7, i8* %0, i32 %10)
%12 = tail call i32 @close(i32 %7)
br label %13
13: ; preds = %9, %1
ret void
}
int foo(int x, int y) {
  int unknown;
  {
    if (unknown) {
      return (9);
    }
    return (x + 3);
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1120 <foo+0x20>
movl   $0x9,-0x4(%rbp)
jmp    1129 <foo+0x29>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 3
ret i32 %3
}
/* Variables and functions */
int function(int *);
int main() {
  int a[3] = {0};
  return function(a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
lea    -0x10(%rbp),%rdi
call   1040 <function@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <function@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @function(i32* %3)
ret i32 %4
}
void glAlphaFunc(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glAlphaFunc() {
ret void
}
double cephes_cotdg(x)
double x;
{ return (tancot(x, 1)); }


x86 assembly (clang, -O0):
<cephes_cotdg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%edi
mov    $0x1,%al
call   1030 <tancot@plt>
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cephes_cotdg>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%al
call   1030 <tancot@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @cephes_cotdg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 (double, i32, ...) bitcast (i32 (...)* @tancot to i32 (double, i32, ...)*)(double %3, i32 1)
%5 = sitofp i32 %4 to double
ret double %5
}

LLVM IR (-O2):
define double @cephes_cotdg(double %0) {
%2 = tail call i32 (double, i32, ...) bitcast (i32 (...)* @tancot to i32 (double, i32, ...)*)(double %0, i32 1)
%3 = sitofp i32 %2 to double
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ test_tcl_comment_entities();
int /*<<< orphan*/ test_tcl_comments();
void all_tcl_tests() {
  test_tcl_comments();
  test_tcl_comment_entities();
}


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

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

LLVM IR (-O0):
define void @all_tcl_tests() {
%1 = call i32 (...) @test_tcl_comments()
%2 = call i32 (...) @test_tcl_comment_entities()
ret void
}

LLVM IR (-O2):
define void @all_tcl_tests() {
%1 = tail call i32 (...) @test_tcl_comments()
%2 = tail call i32 (...) @test_tcl_comment_entities()
ret void
}
void megalog_end() {}


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

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

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

LLVM IR (-O2):
define void @megalog_end() {
ret void
}
int IS_NAN(float x) {
  union {
    float f;
    int i;
  } num;
  num.f = x;
  return ((num.i & (255 << 23)) == (255 << 23));
}


x86 assembly (clang, -O0):
<IS_NAN>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7f800000,%eax
cmp    $0x7f800000,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IS_NAN>:
movd   %xmm0,%ecx
not    %ecx
xor    %eax,%eax
test   $0x7f800000,%ecx
sete   %al
ret

LLVM IR (-O0):
%union.anon = type { float }
define i32 @IS_NAN(float %0) {
%2 = alloca float
%3 = alloca %union.anon
store float %0, float* %2
%4 = load float, float* %2
%5 = bitcast %union.anon* %3 to float*
store float %4, float* %5
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
%8 = and i32 %7, 2139095040
%9 = icmp eq i32 %8, 2139095040
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @IS_NAN(float %0) {
%2 = bitcast float %0 to i32
%3 = and i32 %2, 2139095040
%4 = icmp eq i32 %3, 2139095040
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
void test14_head() {
  do {
    printf("test14");
    puts("");
  } while (0);
}


x86 assembly (clang, -O0):
<test14_head>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <test14_head+0x9>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"test14\00"
@.str.1 = [1 x i8] zeroinitializer
define void @test14_head() {
br label %1
1: ; preds = %0
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"test14\00"
define void @test14_head() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret void
}
void xfuse_devredir_cb_file_close(void *vp) {}


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

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

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

LLVM IR (-O2):
define void @xfuse_devredir_cb_file_close(i8* nocapture %0) {
ret void
}
void g_scanner_peek_next_token() {}


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

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

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

LLVM IR (-O2):
define void @g_scanner_peek_next_token() {
ret void
}
unsigned short int system_get_temperature() { return 0; }


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

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

LLVM IR (-O0):
define zeroext i16 @system_get_temperature() {
ret i16 0
}

LLVM IR (-O2):
define zeroext i16 @system_get_temperature() {
ret i16 0
}
/* Type definitions */
typedef unsigned long long uint64_t;

/* Variables and functions */
uint64_t data_oid_to_idx(uint64_t oid) { return oid & ((1ULL << 20) - 1); }


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

x86 assembly (clang, -O2):
<data_oid_to_idx>:
mov    %rdi,%rax
and    $0xfffff,%eax
ret

LLVM IR (-O0):
define i64 @data_oid_to_idx(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 1048575
ret i64 %4
}

LLVM IR (-O2):
define i64 @data_oid_to_idx(i64 %0) {
%2 = and i64 %0, 1048575
ret i64 %2
}
/* Variables and functions */
char *mem_alloc(scalar_t__, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *mem_strdup(char *str, char *fil, int lin) {
  char *s;
  s = mem_alloc(strlen(str) + 1, fil, lin);
  if (s != NULL) {
    strcpy(s, str);
  }
  return s;
}


x86 assembly (clang, -O0):
<mem_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <mem_alloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117b <mem_strdup+0x4b>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_strdup>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <mem_alloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1162 <mem_strdup+0x32>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @mem_strdup(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %9, 1
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i8* @mem_alloc(i64 %10, i8* %11, i32 %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = load i8*, i8** %7
%18 = load i8*, i8** %4
%19 = call i32 @strcpy(i8* %17, i8* %18)
br label %20
20: ; preds = %16, %3
%21 = load i8*, i8** %7
ret i8* %21
}

LLVM IR (-O2):
define i8* @mem_strdup(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add nsw i64 %4, 1
%6 = tail call i8* @mem_alloc(i64 %5, i8* %1, i32 %2)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %10
10: ; preds = %8, %3
ret i8* %6
}
/* Type definitions */
struct product {
  int dummy;
};
struct factory {
  int dummy;
};
struct domain_class {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
struct product *factory_ops_create(struct factory *factory,
                                   struct domain_class *dc) {
  printf("factory::create()\n");
  return 0;
}


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

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

LLVM IR (-O0):
%struct.product = type { i32 }
%struct.factory = type { i32 }
%struct.domain_class = type { i32 }
@.str = [19 x i8] c"factory::create()\0A\00"
define %struct.product* @factory_ops_create(%struct.factory* %0, %struct.domain_class* %1) {
%3 = alloca %struct.factory*
%4 = alloca %struct.domain_class*
store %struct.factory* %0, %struct.factory** %3
store %struct.domain_class* %1, %struct.domain_class** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret %struct.product* null
}

LLVM IR (-O2):
%struct.product = type { i32 }
%struct.factory = type { i32 }
%struct.domain_class = type { i32 }
@str = [18 x i8] c"factory::create()\00"
define noalias %struct.product* @factory_ops_create(%struct.factory* nocapture readnone %0, %struct.domain_class* nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret %struct.product* null
}
/* Variables and functions */
int /*<<< orphan*/ Heapify(int *, int, int);
void Build_Heap(int A[], int Length) {
  int i, heapSize;
  heapSize = Length;
  for (i = Length / 2; i >= 1; i--)
    Heapify(A, i, heapSize);
}


x86 assembly (clang, -O0):
<Build_Heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jl     115a <Build_Heap+0x4a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <Heapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <Build_Heap+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Build_Heap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1146 <Build_Heap+0x36>
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <Heapify@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1130 <Build_Heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @Build_Heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = lshr i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %5, %4 ]
%8 = tail call i32 @Heapify(i32* %0, i32 %7, i32 %1)
%9 = add nsw i32 %7, -1
%10 = icmp ugt i32 %7, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %2
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ ioctl_get_msg(int);
int main(int argc, char **argv) {
  ioctl_get_msg(10);
  return EXIT_SUCCESS;
}


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    $0xa,%edi
call   1030 <ioctl_get_msg@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <ioctl_get_msg@plt>
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
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 @ioctl_get_msg(i32 10)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @ioctl_get_msg(i32 10)
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
void start_vet(char vet[], int size) {
  int i;
  for (i = 0; i < size; ++i)
    vet[i] = ' ';
  vet[i] = '\0';
}


x86 assembly (clang, -O0):
<start_vet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <start_vet+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <start_vet+0x12>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_vet>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %esi,%esi
jle    112f <start_vet+0x1f>
mov    %esi,%ebx
mov    %r14,%rdi
mov    $0x20,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
jmp    1131 <start_vet+0x21>
xor    %ebx,%ebx
movb   $0x0,(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @start_vet(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %4, %2
%8 = phi i64 [ 0, %2 ], [ %6, %4 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 0, i8* %9
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ rtc_mem_write(scalar_t__, int);
void rtc_mem_write64(uint32_t addr, uint64_t val) {
  rtc_mem_write(addr + 1, val >> 32);
  rtc_mem_write(addr, val & 0xffffffff);
}


x86 assembly (clang, -O0):
<rtc_mem_write64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0xc(%rbp),%esi
mov    $0x20,%ecx
sar    %cl,%esi
call   1030 <rtc_mem_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
and    $0xffffffff,%esi
call   1030 <rtc_mem_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtc_mem_write64>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%rdi
call   1030 <rtc_mem_write@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <rtc_mem_write@plt>

LLVM IR (-O0):
define void @rtc_mem_write64(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = add nsw i64 %5, 1
%7 = load i32, i32* %4
%8 = ashr i32 %7, 32
%9 = call i32 @rtc_mem_write(i64 %6, i32 %8)
%10 = load i64, i64* %3
%11 = load i32, i32* %4
%12 = and i32 %11, -1
%13 = call i32 @rtc_mem_write(i64 %10, i32 %12)
ret void
}

LLVM IR (-O2):
define void @rtc_mem_write64(i64 %0, i32 %1) {
%3 = add nsw i64 %0, 1
%4 = tail call i32 @rtc_mem_write(i64 %3, i32 poison)
%5 = tail call i32 @rtc_mem_write(i64 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0xfa() {
  Assert_real((isascii(250) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              1255, ("isascii should be 0 for 0xfa"));
}


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

x86 assembly (clang, -O2):
<t_isascii_0xfa>:
push   %rax
mov    $0xfa,%edi
call   1030 <isascii@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4e7,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xfa\00"
define void @t_isascii_0xfa() {
%1 = call i64 @isascii(i32 250)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1255, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xfa\00"
define void @t_isascii_0xfa() {
%1 = tail call i64 @isascii(i32 250)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1255, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int modbus_send(uint8_t addr, uint8_t function, uint8_t *payload, uint8_t len) {
  return 0;
}


x86 assembly (clang, -O0):
<modbus_send>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @modbus_send(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @modbus_send(i32 %0, i32 %1, i32* nocapture readnone %2, i32 %3) {
ret i32 0
}
int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
                                   struct batadv_bcast_packet *bcast_packet,
                                   int hdr_size) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.batadv_priv = type opaque
%struct.batadv_bcast_packet = type opaque
define i32 @batadv_bla_check_bcast_duplist(%struct.batadv_priv* %0, %struct.batadv_bcast_packet* %1, i32 %2) {
%4 = alloca %struct.batadv_priv*
%5 = alloca %struct.batadv_bcast_packet*
%6 = alloca i32
store %struct.batadv_priv* %0, %struct.batadv_priv** %4
store %struct.batadv_bcast_packet* %1, %struct.batadv_bcast_packet** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
%struct.batadv_priv = type opaque
%struct.batadv_bcast_packet = type opaque
define i32 @batadv_bla_check_bcast_duplist(%struct.batadv_priv* nocapture readnone %0, %struct.batadv_bcast_packet* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int isPalindrome(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = -1;
  printf("%d\n", isPalindrome(x));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @isPalindrome(i32 -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
short abs(short);
short distanceManhattan(short x1, short y1, short x2, short y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}


x86 assembly (clang, -O0):
<distanceManhattan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cx,%ax
mov    %dx,%cx
mov    %si,%dx
mov    %di,%si
mov    %si,-0x2(%rbp)
mov    %dx,-0x4(%rbp)
mov    %cx,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x6(%rbp),%ecx
sub    %ecx,%eax
movswl %ax,%edi
call   1030 <abs@plt>
cwtl
mov    %eax,-0xc(%rbp)
movswl -0x4(%rbp),%eax
movswl -0x8(%rbp),%ecx
sub    %ecx,%eax
movswl %ax,%edi
call   1030 <abs@plt>
mov    %ax,%cx
mov    -0xc(%rbp),%eax
movswl %cx,%ecx
add    %ecx,%eax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distanceManhattan>:
sub    %edx,%edi
mov    %edi,%edx
neg    %dx
cmovs  %di,%dx
sub    %ecx,%esi
mov    %esi,%eax
neg    %ax
cmovs  %si,%ax
add    %edx,%eax
ret

LLVM IR (-O0):
define signext i16 @distanceManhattan(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3) {
%5 = alloca i16
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
store i16 %0, i16* %5
store i16 %1, i16* %6
store i16 %2, i16* %7
store i16 %3, i16* %8
%9 = load i16, i16* %5
%10 = sext i16 %9 to i32
%11 = load i16, i16* %7
%12 = sext i16 %11 to i32
%13 = sub nsw i32 %10, %12
%14 = trunc i32 %13 to i16
%15 = call signext i16 @abs(i16 signext %14)
%16 = sext i16 %15 to i32
%17 = load i16, i16* %6
%18 = sext i16 %17 to i32
%19 = load i16, i16* %8
%20 = sext i16 %19 to i32
%21 = sub nsw i32 %18, %20
%22 = trunc i32 %21 to i16
%23 = call signext i16 @abs(i16 signext %22)
%24 = sext i16 %23 to i32
%25 = add nsw i32 %16, %24
%26 = trunc i32 %25 to i16
ret i16 %26
}

LLVM IR (-O2):
define signext i16 @distanceManhattan(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3) {
%5 = sub i16 %0, %2
%6 = tail call i16 @llvm.abs.i16(i16 %5, i1 true)
%7 = sub i16 %1, %3
%8 = tail call i16 @llvm.abs.i16(i16 %7, i1 true)
%9 = add nuw i16 %8, %6
ret i16 %9
}
/* Variables and functions */
int /*<<< orphan*/ PR_GET_NAME;
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int prctl(int /*<<< orphan*/, unsigned long, int /*<<< orphan*/,
          int /*<<< orphan*/, int /*<<< orphan*/);
char *ut_process_get_name(char name[17]) {
  int ret;
  memset(name, 0, 17);
  ret = prctl(PR_GET_NAME, (unsigned long)name, 0, 0, 0);
  name[16] = 0;
  return ret == 0 ? name : NULL;
}


x86 assembly (clang, -O0):
<ut_process_get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1030 <memset@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <prctl@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,0x10(%rax)
cmpl   $0x0,-0xc(%rbp)
jne    1179 <ut_process_get_name+0x59>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1184 <ut_process_get_name+0x64>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1184 <ut_process_get_name+0x64>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ut_process_get_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r14d,%r14d
xor    %esi,%esi
mov    $0x11,%edx
call   1030 <memset@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <prctl@plt>
movb   $0x0,0x10(%rbx)
test   %eax,%eax
cmove  %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@PR_GET_NAME = global i32 0
define i8* @ut_process_get_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @memset(i8* %4, i32 0, i32 17)
%6 = load i32, i32* @PR_GET_NAME
%7 = load i8*, i8** %2
%8 = ptrtoint i8* %7 to i64
%9 = call i32 @prctl(i32 %6, i64 %8, i32 0, i32 0, i32 0)
store i32 %9, i32* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 16
store i8 0, i8* %11
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = load i8*, i8** %2
br label %17
16: ; preds = %1
br label %17
17: ; preds = %16, %14
%18 = phi i8* [ %15, %14 ], [ null, %16 ]
ret i8* %18
}

LLVM IR (-O2):
@PR_GET_NAME = global i32 0
define i8* @ut_process_get_name(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i32 0, i32 17)
%3 = load i32, i32* @PR_GET_NAME
%4 = ptrtoint i8* %0 to i64
%5 = tail call i32 @prctl(i32 %3, i64 %4, i32 0, i32 0, i32 0)
%6 = getelementptr inbounds i8, i8* %0, i64 16
store i8 0, i8* %6
%7 = icmp eq i32 %5, 0
%8 = select i1 %7, i8* %0, i8* null
ret i8* %8
}
char tram_swizzle(unsigned swzl) {
  switch (swzl) {
  case 0:
    return 'x';
  case 1:
    return 'y';
  case 2:
    return 'z';
  case 3:
    return 'w';
  }
  return '!';
}


x86 assembly (clang, -O0):
<tram_swizzle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     1150 <tram_swizzle+0x50>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x78,-0x1(%rbp)
jmp    1154 <tram_swizzle+0x54>
movb   $0x79,-0x1(%rbp)
jmp    1154 <tram_swizzle+0x54>
movb   $0x7a,-0x1(%rbp)
jmp    1154 <tram_swizzle+0x54>
movb   $0x77,-0x1(%rbp)
jmp    1154 <tram_swizzle+0x54>
movb   $0x21,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tram_swizzle>:
lea    0x0(,%rdi,8),%ecx
mov    $0x777a7978,%edx
shr    %cl,%edx
cmp    $0x4,%edi
mov    $0x21,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @tram_swizzle(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
]
5: ; preds = %1
store i8 120, i8* %2
br label %10
6: ; preds = %1
store i8 121, i8* %2
br label %10
7: ; preds = %1
store i8 122, i8* %2
br label %10
8: ; preds = %1
store i8 119, i8* %2
br label %10
9: ; preds = %1
store i8 33, i8* %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i8, i8* %2
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @tram_swizzle(i32 %0) {
%2 = icmp ult i32 %0, 4
%3 = shl i32 %0, 3
%4 = lshr i32 2004515192, %3
%5 = trunc i32 %4 to i8
%6 = select i1 %2, i8 %5, i8 33
ret i8 %6
}
void cache_data_disable(void) {}


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

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

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

LLVM IR (-O2):
define void @cache_data_disable() {
ret void
}
const char *msg_gettext(const char *msg) { return &msg[6]; }


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

x86 assembly (clang, -O2):
<msg_gettext>:
lea    0x6(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @msg_gettext(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 6
ret i8* %4
}

LLVM IR (-O2):
define i8* @msg_gettext(i8* readnone %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 6
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ protect_mem(void *, size_t, int);
void protect_mem_check(void *start, size_t len, int prot, int expected) {
  protect_mem(start, len, prot);
}


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

x86 assembly (clang, -O2):
<protect_mem_check>:
jmp    1030 <protect_mem@plt>

LLVM IR (-O0):
define void @protect_mem_check(i8* %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i32, i32* %7
%12 = call i32 @protect_mem(i8* %9, i64 %10, i32 %11)
ret void
}

LLVM IR (-O2):
define void @protect_mem_check(i8* %0, i64 %1, i32 %2, i32 %3) {
%5 = tail call i32 @protect_mem(i8* %0, i64 %1, i32 %2)
ret void
}
int reverseInt(int n) {
  unsigned int reversed = 0, t = n;
  while (t) {
    reversed = 10 * reversed + (t % 10);
    t /= 10;
  }
  return reversed;
}


x86 assembly (clang, -O0):
<reverseInt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114d <reverseInt+0x4d>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
jmp    1114 <reverseInt+0x14>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverseInt>:
xor    %eax,%eax
test   %edi,%edi
je     1131 <reverseInt+0x31>
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
lea    (%rax,%rax,4),%eax
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
lea    (%rcx,%rax,2),%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <reverseInt+0x10>
ret

LLVM IR (-O0):
define i32 @reverseInt(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
store i32 %5, i32* %4
br label %6
6: ; preds = %9, %1
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i32, i32* %3
%11 = mul i32 10, %10
%12 = load i32, i32* %4
%13 = urem i32 %12, 10
%14 = add i32 %11, %13
store i32 %14, i32* %3
%15 = load i32, i32* %4
%16 = udiv i32 %15, 10
store i32 %16, i32* %4
br label %6
17: ; preds = %6
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @reverseInt(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = mul i32 %5, 10
%7 = urem i32 %4, 10
%8 = add i32 %7, %6
%9 = udiv i32 %4, 10
%10 = icmp ult i32 %4, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
int test_and_set_bit(int nr, volatile unsigned long *addr) {
  int oldbit;
  __asm__ volatile("lock bts %2,%1\n\t"
                   "sbb %0,%0"
                   : "=r"(oldbit), "+m"(*(volatile long *)(addr))
                   : "Ir"(nr)
                   : "memory");
  return (oldbit);
}


x86 assembly (clang, -O0):
<test_and_set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
lock bts %ecx,(%rax)
sbb    %eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_and_set_bit>:
lock bts %edi,(%rsi)
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @test_and_set_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i32
store i32 %0, i32* %3
store i64* %1, i64** %4
%6 = load i64*, i64** %4
%7 = load i32, i32* %3
%8 = call i32 asm sideeffect "lock bts $2,$1\0A\09sbb $0,$0", "=r,=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %6, i32 %7, i64* elementtype(i64) %6)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_and_set_bit(i32 %0, i64* %1) {
%3 = tail call i32 asm sideeffect "lock bts $2,$1\0A\09sbb $0,$0", "=r,=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i32 %0, i64* elementtype(i64) %1)
ret i32 %3
}
int fun585() { return 585; }


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

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

LLVM IR (-O0):
define i32 @fun585() {
ret i32 585
}

LLVM IR (-O2):
define i32 @fun585() {
ret i32 585
}
int main() {
  int a, b, c;
  if (a) {
    b = 0;
    c = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1123 <main+0x23>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%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
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 0, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %7, %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void dec_ctx_free(struct dec_ctx *ctx) {}


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

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

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

LLVM IR (-O2):
%struct.dec_ctx = type opaque
define void @dec_ctx_free(%struct.dec_ctx* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ be_nice_to_people();
int /*<<< orphan*/ vuln(char *);
int main(int argc, char **argv) {
  be_nice_to_people();
  if (argc > 1)
    vuln(argv[1]);
  return 0;
}


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   1040 <be_nice_to_people@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1154 <main+0x34>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <vuln@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <be_nice_to_people@plt>
cmp    $0x2,%ebp
jl     113d <main+0x1d>
mov    0x8(%rbx),%rdi
call   1030 <vuln@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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 (...) @be_nice_to_people()
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @vuln(i8* %12)
br label %14
14: ; preds = %9, %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @be_nice_to_people()
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @vuln(i8* %7)
br label %9
9: ; preds = %5, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ handle_42(int /*<<< orphan*/);
int gen_42() {
  handle_42(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_42>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_42@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_42() {
%1 = call i32 @handle_42(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_42() {
%1 = tail call i32 @handle_42(i32 0)
ret i32 0
}
int test_imm_C6uint16_reg(unsigned short val) {
  return ((val) & (-0xC6 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_C6uint16_reg>:
test   $0xff3a,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C6uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -198
%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_C6uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -198
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int func1_in_obj();
int func2_in_obj();
int main(int argc, char **argv) { return func1_in_obj() + func2_in_obj(); }


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    $0x0,%al
call   1040 <func1_in_obj@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <func2_in_obj@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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 (...) @func1_in_obj()
%7 = call i32 (...) @func2_in_obj()
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func1_in_obj()
%4 = tail call i32 (...) @func2_in_obj()
%5 = add nsw i32 %4, %3
ret i32 %5
}
void set_int_array(int *array, int value, int index) {
  int i;
  if (index < 0) {
    for (i = 0; i < 11; i++)
      array[i] = value;
  } else
    array[index] = value;
}


x86 assembly (clang, -O0):
<set_int_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    114a <set_int_array+0x4a>
movl   $0x0,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jge    1145 <set_int_array+0x45>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111f <set_int_array+0x1f>
jmp    1158 <set_int_array+0x58>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_int_array>:
test   %edx,%edx
js     110a <set_int_array+0xa>
mov    %edx,%eax
mov    %esi,(%rdi,%rax,4)
ret
movd   %esi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqu %xmm0,(%rdi)
movdqu %xmm0,0x10(%rdi)
mov    %esi,0x20(%rdi)
mov    %esi,0x24(%rdi)
mov    $0xa,%eax
mov    %esi,(%rdi,%rax,4)
ret

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

LLVM IR (-O2):
define void @set_int_array(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 0
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = insertelement <4 x i32> poison, i32 %1, i64 0
%7 = shufflevector <4 x i32> %6, <4 x i32> poison, <4 x i32> zeroinitializer
%8 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %8
%9 = getelementptr inbounds i32, i32* %0, i64 4
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %10
%11 = getelementptr inbounds i32, i32* %0, i64 8
store i32 %1, i32* %11
%12 = getelementptr inbounds i32, i32* %0, i64 9
store i32 %1, i32* %12
br label %15
13: ; preds = %3
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %5, %13
%16 = phi i64 [ 10, %5 ], [ %14, %13 ]
%17 = getelementptr inbounds i32, i32* %0, i64 %16
store i32 %1, i32* %17
ret void
}
int signal(int signum, int handler) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @signal(i32 %0, i32 %1) {
ret i32 0
}