xunge/DecIR huggingface dataset:
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ subtree_dispose(struct node *);
void tree_dispose(struct node *node) { subtree_dispose(node); }


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

x86 assembly (clang, -O2):
<tree_dispose>:
jmp    1030 <subtree_dispose@plt>

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

LLVM IR (-O2):
%struct.node = type { i32 }
define void @tree_dispose(%struct.node* %0) {
%2 = tail call i32 @subtree_dispose(%struct.node* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("latod-e xd");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"latod-e xd\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"latod-e xd\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
const char main(int argc, char **argv) {
  (void)argc;
  (void)argv;
  const int i = 0;
  return i;
}


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

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

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

LLVM IR (-O2):
define signext i8 @main(i32 %0, i8** nocapture readnone %1) {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void likwid_markerClose(void) {
  fprintf(stderr, "WARNING: dummy likwid_markerClose() called\n");
}


x86 assembly (clang, -O0):
<likwid_markerClose>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<likwid_markerClose>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"WARNING: dummy likwid_markerClose() called\0A\00"
define void @likwid_markerClose() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"WARNING: dummy likwid_markerClose() called\0A\00"
define void @likwid_markerClose() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ key_equals(int, unsigned char const *);
int transl_input(unsigned char const *, int);
int transl_strict(const unsigned char *input, int flags) {
  int k = transl_input(input, flags | 0x800);
  if (flags & 0x100 && !key_equals(k | flags, input))
    k = 0;
  return k;
}


x86 assembly (clang, -O0):
<transl_strict>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
or     $0x800,%esi
call   1030 <transl_input@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     1174 <transl_strict+0x54>
mov    -0x10(%rbp),%edi
or     -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <key_equals@plt>
cmp    $0x0,%eax
jne    1174 <transl_strict+0x54>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transl_strict>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
or     $0x800,%esi
call   1030 <transl_input@plt>
mov    %eax,%ebx
test   $0x100,%ebp
je     114f <transl_strict+0x2f>
or     %ebx,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <key_equals@plt>
test   %eax,%eax
cmove  %eax,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @transl_strict(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = or i32 %7, 2048
%9 = call i32 @transl_input(i8* %6, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = and i32 %10, 256
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = or i32 %14, %15
%17 = load i8*, i8** %3
%18 = call i32 @key_equals(i32 %16, i8* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %13
store i32 0, i32* %5
br label %21
21: ; preds = %20, %13, %2
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
define i32 @transl_strict(i8* %0, i32 %1) {
%3 = or i32 %1, 2048
%4 = tail call i32 @transl_input(i8* %0, i32 %3)
%5 = and i32 %1, 256
%6 = icmp eq i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = or i32 %4, %1
%9 = tail call i32 @key_equals(i32 %8, i8* %0)
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i32 0, i32 %4
br label %12
12: ; preds = %7, %2
%13 = phi i32 [ %4, %2 ], [ %11, %7 ]
ret i32 %13
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char *a;
  char b[] = "pwnt";
  a = malloc(1024);
  a = (size_t)a * 1024;
  strcpy(a, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x1d(%rbp)
mov    0xec6(%rip),%al
mov    %al,-0x19(%rbp)
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0xa,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x1d(%rbp),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x4(%rsp)
movl   $0x746e7770,(%rsp)
mov    $0x400,%edi
call   1040 <malloc@plt>
shl    $0xa,%rax
mov    %rsp,%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.b = [5 x i8] c"pwnt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca [5 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = bitcast [5 x i8]* %6 to i8*
%8 = call i8* @malloc(i32 1024)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = ptrtoint i8* %9 to i64
%11 = mul i64 %10, 1024
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%15 = call i32 @strcpy(i8* %13, i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.b = [5 x i8] c"pwnt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%5 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%6 = ptrtoint i8* %5 to i64
%7 = shl i64 %6, 10
%8 = inttoptr i64 %7 to i8*
%9 = call i32 @strcpy(i8* %8, i8* %4)
ret i32 0
}
int is_little_endian() {
  unsigned int x = 1;
  char *c = (char *)&x;
  return (int)*c;
}


x86 assembly (clang, -O0):
<is_little_endian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @is_little_endian() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ _free(void *);
void free(void *ptr) { _free(ptr); }


x86 assembly (clang, -O0):
<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):
<free>:
jmp    1030 <_free@plt>

LLVM IR (-O0):
define void @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 @free(i8* %0) {
%2 = tail call i32 @_free(i8* %0)
ret void
}
int *doit() {
  int i = 2;
  return &i;
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
movl   $0x2,-0x4(%rbp)
lea    -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<doit>:
lea    -0x4(%rsp),%rax
ret

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

LLVM IR (-O2):
define noalias i32* @doit() {
%1 = alloca i32
ret i32* %1
}
float calc_uspb(float b) { return 1000000.0 / (b / 60.0); }


x86 assembly (clang, -O0):
<calc_uspb>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeee(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xeda(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_uspb>:
cvtss2sd %xmm0,%xmm0
divsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @calc_uspb(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fdiv double %4, 6.000000e+01
%6 = fdiv double 1.000000e+06, %5
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @calc_uspb(float %0) {
%2 = fpext float %0 to double
%3 = fdiv double %2, 6.000000e+01
%4 = fdiv double 1.000000e+06, %3
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
int dal_reg_write(unsigned int, unsigned int, unsigned int);
int ingress_reg_set(unsigned int dev_id, unsigned int reg_addr,
                    unsigned int value) {
  return dal_reg_write(dev_id, reg_addr + 0x100000, value);
}


x86 assembly (clang, -O0):
<ingress_reg_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x100000,%esi
mov    -0xc(%rbp),%edx
call   1030 <dal_reg_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ingress_reg_set>:
add    $0x100000,%esi
jmp    1030 <dal_reg_write@plt>

LLVM IR (-O0):
define i32 @ingress_reg_set(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add i32 %8, 1048576
%10 = load i32, i32* %6
%11 = call i32 @dal_reg_write(i32 %7, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @ingress_reg_set(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %1, 1048576
%5 = tail call i32 @dal_reg_write(i32 %0, i32 %4, i32 %2)
ret i32 %5
}
int fun111() { return 111; }


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

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

LLVM IR (-O0):
define i32 @fun111() {
ret i32 111
}

LLVM IR (-O2):
define i32 @fun111() {
ret i32 111
}
void rop3_100_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = T | S;
  stk2 = *D & stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


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

x86 assembly (clang, -O2):
or     %edx,%esi
and    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_100_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %2, %1
%6 = and i8 %4, %5
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned short, unsigned short,
                          unsigned short, char *, unsigned short);
void print_segreg(unsigned short seg) {
  printf("%02x: index %d (%x), %s, rpl %d\n", seg, (seg >> 3), (seg >> 3),
         (seg & 0x4) ? "LDT" : "GDT", (seg & 0x3));
}


x86 assembly (clang, -O0):
<print_segreg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%si
movzwl -0x2(%rbp),%eax
sar    $0x3,%eax
mov    %ax,%dx
movzwl -0x2(%rbp),%eax
sar    $0x3,%eax
mov    %ax,%cx
movzwl -0x2(%rbp),%edi
and    $0x4,%edi
lea    0xee0(%rip),%r8
lea    0xed5(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
movzwl -0x2(%rbp),%eax
and    $0x3,%eax
lea    0xe9f(%rip),%rdi
movzwl %si,%esi
movzwl %dx,%edx
movzwl %cx,%ecx
movzwl %ax,%r9d
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_segreg>:
mov    %edi,%ecx
shr    $0x3,%ecx
test   $0x4,%dil
lea    0xf05(%rip),%rax
lea    0xefa(%rip),%r8
cmove  %rax,%r8
mov    %edi,%r9d
and    $0x3,%r9d
lea    0xec7(%rip),%rax
mov    %edi,%esi
mov    %rax,%rdi
mov    %ecx,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"%02x: index %d (%x), %s, rpl %d\0A\00"
@.str.1 = [4 x i8] c"LDT\00"
@.str.2 = [4 x i8] c"GDT\00"
define void @print_segreg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = ashr i32 %5, 3
%7 = trunc i32 %6 to i16
%8 = load i16, i16* %2
%9 = zext i16 %8 to i32
%10 = ashr i32 %9, 3
%11 = trunc i32 %10 to i16
%12 = load i16, i16* %2
%13 = zext i16 %12 to i32
%14 = and i32 %13, 4
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%18 = load i16, i16* %2
%19 = zext i16 %18 to i32
%20 = and i32 %19, 3
%21 = trunc i32 %20 to i16
%22 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i16 zeroext %3, i16 zeroext %7, i16 zeroext %11, i8* %17, i16 zeroext %21)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"%02x: index %d (%x), %s, rpl %d\0A\00"
@.str.1 = [4 x i8] c"LDT\00"
@.str.2 = [4 x i8] c"GDT\00"
define void @print_segreg(i16 zeroext %0) {
%2 = lshr i16 %0, 3
%3 = and i16 %0, 4
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%6 = and i16 %0, 3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i16 zeroext %0, i16 zeroext %2, i16 zeroext %2, i8* %5, i16 zeroext %6)
ret void
}
int abs(int val) {
  if (val < 0)
    return -val;
  return val;
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <abs+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
void clean_b(char *buffer) {
  int index = 0;
  while (index < 1024) {
    buffer[index] = '\0';
    index++;
  }
}


x86 assembly (clang, -O0):
<clean_b>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    1136 <clean_b+0x36>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <clean_b+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_b>:
push   %rax
mov    $0x400,%edx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @clean_b(i8* nocapture writeonly %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *const);
void pm_freerow(void *const itrow) { free(itrow); }


x86 assembly (clang, -O0):
<pm_freerow>:
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):
<pm_freerow>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @pm_freerow(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 @pm_freerow(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int foo(long double d, int i) {
  if (d == (long double)i)
    return 1;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
mov    %edi,-0x24(%rbp)
fldt   -0x20(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
fildl  -0x28(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    1137 <foo+0x37>
jp     1137 <foo+0x37>
jmp    1130 <foo+0x30>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(x86_fp80 %0, i32 %1) {
%3 = alloca i32
%4 = alloca x86_fp80
%5 = alloca i32
store x86_fp80 %0, x86_fp80* %4
store i32 %1, i32* %5
%6 = load x86_fp80, x86_fp80* %4
%7 = load i32, i32* %5
%8 = sitofp i32 %7 to x86_fp80
%9 = fcmp oeq x86_fp80 %6, %8
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %11
11: ; preds = %10, %2
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @foo(x86_fp80 %0, i32 %1) {
ret i32 1
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  return b;
}


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

x86 assembly (clang, -O2):
<min>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @min(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ arrobot_setwheelvels(double, double);
void arrobot_setvel2(double left, double right) {
  arrobot_setwheelvels(left, right);
}


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

x86 assembly (clang, -O2):
<arrobot_setvel2>:
jmp    1030 <arrobot_setwheelvels@plt>

LLVM IR (-O0):
define void @arrobot_setvel2(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 = call i32 @arrobot_setwheelvels(double %5, double %6)
ret void
}

LLVM IR (-O2):
define void @arrobot_setvel2(double %0, double %1) {
%3 = tail call i32 @arrobot_setwheelvels(double %0, double %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_CIPHER;

/* Variables and functions */
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void) { return NULL; }


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

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

LLVM IR (-O0):
define i32* @EVP_aes_128_cbc_hmac_sha256() {
ret i32* null
}

LLVM IR (-O2):
define noalias i32* @EVP_aes_128_cbc_hmac_sha256() {
ret i32* null
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char const);
int isnumb(const char *str) {
  while (*str) {
    if (!isdigit(*str))
      return 0;
    str++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isnumb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <isnumb+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    114a <isnumb+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1162 <isnumb+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <isnumb+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumb>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <isnumb+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <isnumb+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isnumb+0x20>
jmp    114b <isnumb+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isnumb(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isdigit(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
int nonseekable_open(struct inode *inode, struct file *filp) {
  int i;
  { return (i); }
}


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

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

LLVM IR (-O0):
%struct.inode = type opaque
%struct.file = type opaque
define i32 @nonseekable_open(%struct.inode* %0, %struct.file* %1) {
%3 = alloca %struct.inode*
%4 = alloca %struct.file*
%5 = alloca i32
store %struct.inode* %0, %struct.inode** %3
store %struct.file* %1, %struct.file** %4
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.inode = type opaque
%struct.file = type opaque
define i32 @nonseekable_open(%struct.inode* nocapture readnone %0, %struct.file* nocapture readnone %1) {
ret i32 undef
}
void printMessage(char msg[]) {
  puts(msg);
  printf(sizeof(msg));
}


x86 assembly (clang, -O0):
<printMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    $0x8,%edi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMessage>:
push   %rax
xor    %eax,%eax
call   1030 <puts@plt>
mov    $0x8,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <printf@plt>

LLVM IR (-O0):
define void @printMessage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 8 to i8*))
ret void
}

LLVM IR (-O2):
define void @printMessage(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %0)
%3 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 8 to i8*))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void DestroyArray(void *V) {
  free(V);
  V = NULL;
}


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

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

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

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

/* Variables and functions */
int catclose(nl_catd catd) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @catclose(i32 %0) {
ret i32 0
}
char *itoa(value, string, radix)
int value;
char *string;
int radix;
{
  sprintf(string, "%d", value);
  return string;
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xee3(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i8* @itoa(i32 %0, i8* returned writeonly %1, i32 %2) {
%4 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* %1
}
void foo_1_2_1_1_2_1_2_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_1_1_2_1_2_1_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(unsigned char);
int str_isnumber(const char *p) {
  unsigned char *q = (unsigned char *)p;
  while (*q) {
    if (!isdigit(*q))
      return 0;
    q++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<str_isnumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <str_isnumber+0x53>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1152 <str_isnumber+0x42>
movl   $0x0,-0x4(%rbp)
jmp    116a <str_isnumber+0x5a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <str_isnumber+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_isnumber>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <str_isnumber+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <str_isnumber+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <str_isnumber+0x20>
jmp    114b <str_isnumber+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @str_isnumber(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isdigit(i8 zeroext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ test_trig();
int main(void) {
  test_trig();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_trig()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ add_data();
int /*<<< orphan*/ sleep(int);
void *reader_thread(void *arg) {
  while (1) {
    add_data();
    sleep(5);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<reader_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <add_data@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
jmp    112c <reader_thread+0xc>

x86 assembly (clang, -O2):
<reader_thread>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <add_data@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
jmp    1130 <reader_thread+0x10>

LLVM IR (-O0):
define i8* @reader_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 (...) @add_data()
%5 = call i32 @sleep(i32 5)
br label %3
}

LLVM IR (-O2):
define noalias i8* @reader_thread(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 (...) @add_data()
%4 = tail call i32 @sleep(i32 5)
br label %2
}
/* Variables and functions */
int fact(int);
int fact_unsigned(int);
int r();
int call_recursive(void) { return r() + fact_unsigned(3) + fact(3); }


x86 assembly (clang, -O0):
<call_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <r@plt>
mov    %eax,-0x8(%rbp)
mov    $0x3,%edi
call   1040 <fact_unsigned@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    $0x3,%edi
call   1050 <fact@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_recursive>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <r@plt>
mov    %eax,%ebx
mov    $0x3,%edi
call   1040 <fact_unsigned@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    $0x3,%edi
call   1050 <fact@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @call_recursive() {
%1 = call i32 (...) @r()
%2 = call i32 @fact_unsigned(i32 3)
%3 = add nsw i32 %1, %2
%4 = call i32 @fact(i32 3)
%5 = add nsw i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @call_recursive() {
%1 = tail call i32 (...) @r()
%2 = tail call i32 @fact_unsigned(i32 3)
%3 = add nsw i32 %2, %1
%4 = tail call i32 @fact(i32 3)
%5 = add nsw i32 %3, %4
ret i32 %5
}
/* Variables and functions */
unsigned long ffz(unsigned long);
unsigned long __ffs(unsigned long word) { return ffz(~word); }


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

x86 assembly (clang, -O2):
<__ffs>:
not    %rdi
jmp    1030 <ffz@plt>

LLVM IR (-O0):
define i64 @__ffs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = xor i64 %3, -1
%5 = call i64 @ffz(i64 %4)
ret i64 %5
}

LLVM IR (-O2):
define i64 @__ffs(i64 %0) {
%2 = xor i64 %0, -1
%3 = tail call i64 @ffz(i64 %2)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ glColor4s(short, short, short, short);
void Color4s(short r, short g, short b, short a) { glColor4s(r, g, b, a); }


x86 assembly (clang, -O0):
<Color4s>:
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)
mov    -0x2(%rbp),%dx
mov    -0x4(%rbp),%cx
mov    -0x6(%rbp),%ax
movswl %dx,%edi
movswl %cx,%esi
movswl %ax,%edx
movswl -0x8(%rbp),%ecx
call   1030 <glColor4s@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Color4s>:
jmp    1030 <glColor4s@plt>

LLVM IR (-O0):
define void @Color4s(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 = load i16, i16* %6
%11 = load i16, i16* %7
%12 = load i16, i16* %8
%13 = call i32 @glColor4s(i16 signext %9, i16 signext %10, i16 signext %11, i16 signext %12)
ret void
}

LLVM IR (-O2):
define void @Color4s(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3) {
%5 = tail call i32 @glColor4s(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3)
ret void
}
/* Variables and functions */
int fsync(int);
int fdatasync(int filedes) { return fsync(filedes); }


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

x86 assembly (clang, -O2):
<fdatasync>:
jmp    1030 <fsync@plt>

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

LLVM IR (-O2):
define i32 @fdatasync(i32 %0) {
%2 = tail call i32 @fsync(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("[?] Usage: icai_risc_as [<assmebler_file>] [-o <output_file>] [-f "
         "<format>] [-h]\n"
         "\t<assembler_file>\t- File containig the assembler to compile. If "
         "not stdin will be used.\n"
         "\t-o <output_file>\t- Filename for output.\n"
         "\t-f <format>     \t- Output format (vhdl, mif, bin).\n"
         "\t-h              \t- Show this help message.\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [307 x i8] c"[?] Usage: icai_risc_as [<assmebler_file>] [-o <output_file>] [-f <format>] [-h]\0A\09<assembler_file>\09- File containig the assembler to compile. If not stdin will be used.\0A\09-o <output_file>\09- Filename for output.\0A\09-f <format> \09- Output format (vhdl, mif, bin).\0A\09-h \09- Show this help message.\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([307 x i8], [307 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [306 x i8] c"[?] Usage: icai_risc_as [<assmebler_file>] [-o <output_file>] [-f <format>] [-h]\0A\09<assembler_file>\09- File containig the assembler to compile. If not stdin will be used.\0A\09-o <output_file>\09- Filename for output.\0A\09-f <format> \09- Output format (vhdl, mif, bin).\0A\09-h \09- Show this help message.\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([306 x i8], [306 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int search_in_file(char *, char *);
int octopus_check_sternheimer_convergence(char *output_file) {
  return search_in_file(output_file,
                        "ALL STERNHEIMER LINEAR SYSTEMS CONVERGED");
}


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

x86 assembly (clang, -O2):
<octopus_check_sternheimer_convergence>:
lea    0xee9(%rip),%rsi
jmp    1030 <search_in_file@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"ALL STERNHEIMER LINEAR SYSTEMS CONVERGED\00"
define i32 @octopus_check_sternheimer_convergence(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @search_in_file(i8* %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [41 x i8] c"ALL STERNHEIMER LINEAR SYSTEMS CONVERGED\00"
define i32 @octopus_check_sternheimer_convergence(i8* %0) {
%2 = tail call i32 @search_in_file(i8* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
int isModoApertura(int modo_client, int modo) {
  if ((modo_client & modo) == modo) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isModoApertura>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1125 <isModoApertura+0x25>
movl   $0x1,-0x4(%rbp)
jmp    112c <isModoApertura+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isModoApertura>:
not    %edi
xor    %eax,%eax
test   %edi,%esi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isModoApertura(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = icmp eq i32 %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ x;
};
struct TYPE_4__ {
  TYPE_1__ xgravity;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xgravity_x(void *_p) { return (int)((XEvent *)_p)->xgravity.x; }


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

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

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

LLVM IR (-O2):
define i32 @get_XEvent_xgravity_x(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
char getchar();
char *readLine(char *in) {
  char ch;
  int length = 0;
  while ((ch = getchar()) != 10) {
    in[length++] = ch;
  }
  return in;
}


x86 assembly (clang, -O0):
<readLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1156 <readLine+0x46>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x10(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1123 <readLine+0x13>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readLine>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     1141 <readLine+0x31>
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %al,(%rbx)
xor    %eax,%eax
call   1030 <getchar@plt>
add    $0x1,%rbx
cmp    $0xa,%al
jne    1130 <readLine+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @readLine(i8* returned writeonly %0) {
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %9, %4 ], [ %2, %1 ]
%7 = add nuw i64 %5, 1
%8 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %6, i8* %8
%9 = tail call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i8* %0
}
unsigned pmmap_bytes(int num_blocks) { return 0x1000 * num_blocks; }


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

x86 assembly (clang, -O2):
<pmmap_bytes>:
mov    %edi,%eax
shl    $0xc,%eax
ret

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

LLVM IR (-O2):
define i32 @pmmap_bytes(i32 %0) {
%2 = shl nsw i32 %0, 12
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void smpte_fec_set_type(uint8_t *p_fec, uint8_t type) {
  type &= 0x7;
  p_fec[12] = (p_fec[12] & 0xc7) | (type << 3);
}


x86 assembly (clang, -O0):
<smpte_fec_set_type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%ecx
and    $0xc7,%ecx
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x30(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpte_fec_set_type>:
mov    $0xc7,%eax
and    0x30(%rdi),%eax
and    $0x7,%esi
lea    (%rax,%rsi,8),%eax
mov    %eax,0x30(%rdi)
ret

LLVM IR (-O0):
define void @smpte_fec_set_type(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 7
store i32 %6, i32* %4
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 12
%9 = load i32, i32* %8
%10 = and i32 %9, 199
%11 = load i32, i32* %4
%12 = shl i32 %11, 3
%13 = or i32 %10, %12
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 12
store i32 %13, i32* %15
ret void
}

LLVM IR (-O2):
define void @smpte_fec_set_type(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 12
%4 = load i32, i32* %3
%5 = and i32 %4, 199
%6 = shl i32 %1, 3
%7 = and i32 %6, 56
%8 = or i32 %5, %7
store i32 %8, i32* %3
ret void
}