xunge/DecIR huggingface dataset:
extern void flush_pages_to_ram(unsigned long address, int n) {}


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

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

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

LLVM IR (-O2):
define void @flush_pages_to_ram(i64 %0, i32 %1) {
ret void
}
unsigned short inports(unsigned short port) {
  unsigned short value;
  asm volatile("inw %1, %0" : "=a"(value) : "dN"(port));
  return value;
}


x86 assembly (clang, -O0):
<inports>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @inports(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inports(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *pmalloc(size_t);
int strlen(char const *);
char *pstrdup(const char *s) {
  size_t l = strlen(s) + 1;
  char *p = pmalloc(l);
  memcpy(p, s, l);
  return p;
}


x86 assembly (clang, -O0):
<pstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <pmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pstrdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <pmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @pstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = call i8* @pmalloc(i64 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = load i64, i64* %3
%14 = call i32 @memcpy(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @pstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @pmalloc(i64 %4)
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
ret i8* %5
}
int movzwl_1(void) {
  int res;
  __asm__ __volatile__("movl $0x12345678, %%eax\n\t"
                       "movw $0x2222, %%ax\n\t"
                       "movzwl %%ax,%%eax\n\t"
                       "mov %%eax, %0"
                       : "=r"(res)
                       :
                       : "eax");
  return res;
}


x86 assembly (clang, -O0):
<movzwl_1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x12345678,%eax
mov    $0x2222,%ax
movzwl %ax,%eax
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<movzwl_1>:
mov    $0x12345678,%eax
mov    $0x2222,%ax
movzwl %ax,%eax
mov    %eax,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @movzwl_1() {
%1 = alloca i32
%2 = call i32 asm sideeffect "movl $$0x12345678, %eax\0A\09movw $$0x2222, %ax\0A\09movzwl %ax,%eax\0A\09mov %eax, $0", "=r,~{eax},~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @movzwl_1() {
%1 = tail call i32 asm sideeffect "movl $$0x12345678, %eax\0A\09movw $$0x2222, %ax\0A\09movzwl %ax,%eax\0A\09mov %eax, $0", "=r,~{eax},~{dirflag},~{fpsr},~{flags}"()
ret i32 %1
}
/* Variables and functions */
scalar_t__ mersenne_twister();
double mersenne_twister_real(void) {
  return ((double)(mersenne_twister())) / ((double)0xFFFFFFFF);
}


x86 assembly (clang, -O0):
<mersenne_twister_real>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mersenne_twister@plt>
cvtsi2sd %rax,%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mersenne_twister_real>:
push   %rax
xor    %eax,%eax
call   1030 <mersenne_twister@plt>
cvtsi2sd %rax,%xmm0
divsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mersenne_twister_real() {
%1 = call i64 (...) @mersenne_twister()
%2 = sitofp i64 %1 to double
%3 = fdiv double %2, 0x41EFFFFFFFE00000
ret double %3
}

LLVM IR (-O2):
define double @mersenne_twister_real() {
%1 = tail call i64 (...) @mersenne_twister()
%2 = sitofp i64 %1 to double
%3 = fdiv double %2, 0x41EFFFFFFFE00000
ret double %3
}
void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s) {}


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

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

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

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define void @wpas_wps_notify_scan_results(%struct.wpa_supplicant* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ pixel_avg_weight_wxh(int /*<<< orphan*/ *, int,
                                        int /*<<< orphan*/ *, int, int, int,
                                        int);
void pixel_avg_weight_8x8(uint8_t *pix1, int i_stride_pix1, uint8_t *pix2,
                          int i_stride_pix2, int i_weight1) {
  pixel_avg_weight_wxh(pix1, i_stride_pix1, pix2, i_stride_pix2, 8, 8,
                       i_weight1);
}


x86 assembly (clang, -O0):
<pixel_avg_weight_8x8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%eax
mov    $0x8,%r9d
mov    %r9d,%r8d
mov    %eax,(%rsp)
call   1030 <pixel_avg_weight_wxh@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixel_avg_weight_8x8>:
push   %rax
mov    %r8d,(%rsp)
mov    $0x8,%r8d
mov    $0x8,%r9d
call   1030 <pixel_avg_weight_wxh@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @pixel_avg_weight_8x8(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = load i32*, i32** %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @pixel_avg_weight_wxh(i32* %11, i32 %12, i32* %13, i32 %14, i32 8, i32 8, i32 %15)
ret void
}

LLVM IR (-O2):
define void @pixel_avg_weight_8x8(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4) {
%6 = tail call i32 @pixel_avg_weight_wxh(i32* %0, i32 %1, i32* %2, i32 %3, i32 8, i32 8, i32 %4)
ret void
}
void mt_dcm_peri_on(void) {}


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

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

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

LLVM IR (-O2):
define void @mt_dcm_peri_on() {
ret void
}
int val_to_char(int v) {
  if (v >= 0 && v < 10)
    return '0' + v;
  else if (v >= 10 && v < 16)
    return ('a' - 10) + v;
  else
    return -1;
}


x86 assembly (clang, -O0):
<val_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1129 <val_to_char+0x29>
cmpl   $0xa,-0x8(%rbp)
jge    1129 <val_to_char+0x29>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <val_to_char+0x52>
cmpl   $0xa,-0x8(%rbp)
jl     114b <val_to_char+0x4b>
cmpl   $0x10,-0x8(%rbp)
jge    114b <val_to_char+0x4b>
mov    -0x8(%rbp),%eax
add    $0x57,%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <val_to_char+0x52>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<val_to_char>:
mov    %edi,%eax
cmp    $0x9,%edi
ja     110b <val_to_char+0xb>
add    $0x30,%eax
ret
lea    -0xa(%rax),%ecx
add    $0x57,%eax
cmp    $0x6,%ecx
mov    $0xffffffff,%ecx
cmovb  %eax,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @val_to_char(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = add nuw nsw i32 %0, 48
br label %10
5: ; preds = %1
%6 = add i32 %0, -10
%7 = icmp ult i32 %6, 6
%8 = add nsw i32 %0, 87
%9 = select i1 %7, i32 %8, i32 -1
br label %10
10: ; preds = %5, %3
%11 = phi i32 [ %4, %3 ], [ %9, %5 ]
ret i32 %11
}
int test_imm_9Bint16_mem(short *val) {
  return ((*val) & (-0x9B << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_9Bint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -155
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int load(int *ptr) { return __atomic_load_n(ptr, 5); }


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

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

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

LLVM IR (-O2):
define i32 @load(i32* nocapture %0) {
%2 = load atomic i32, i32* %0 seq_cst
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ isdigit(char);
int ctoi(char c) {
  assert(isdigit(c));
  return c - '0';
}


x86 assembly (clang, -O0):
<ctoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isdigit@plt>
mov    %eax,%edi
call   1040 <assert@plt>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctoi>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
mov    %eax,%edi
call   1040 <assert@plt>
add    $0xffffffd0,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ctoi(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @isdigit(i8 signext %3)
%5 = call i32 @assert(i32 %4)
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = sub nsw i32 %7, 48
ret i32 %8
}

LLVM IR (-O2):
define i32 @ctoi(i8 signext %0) {
%2 = tail call i32 @isdigit(i8 signext %0)
%3 = tail call i32 @assert(i32 %2)
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
scalar_t__ setregid(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ setreuid(int /*<<< orphan*/, int /*<<< orphan*/);
int priv_start(uid_t real_uid, gid_t real_gid, uid_t effective_uid,
               gid_t effective_gid) {
  if (0 != setreuid(real_uid, effective_uid)) {
    return -1;
  }
  if (0 != setregid(real_gid, effective_gid)) {
    return -2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<priv_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <setreuid@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1159 <priv_start+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1185 <priv_start+0x65>
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <setregid@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     117e <priv_start+0x5e>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1185 <priv_start+0x65>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priv_start>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %esi,%ebp
mov    %edx,%esi
call   1030 <setreuid@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1152 <priv_start+0x32>
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <setregid@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%rcx,1),%eax
add    $0xfffffffe,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @priv_start(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @setreuid(i32 %0, i32 %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i64 @setregid(i32 %1, i32 %3)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i32 0, i32 -2
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ -1, %4 ], [ %10, %7 ]
ret i32 %12
}
int busca_elemento(int vetor[50], int tamanho, int elemento) {
  int i;
  for (i = 0; i <= tamanho; i++) {
    if (vetor[i] == elemento) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<busca_elemento>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1154 <busca_elemento+0x54>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1141 <busca_elemento+0x41>
movl   $0x1,-0x4(%rbp)
jmp    115b <busca_elemento+0x5b>
jmp    1146 <busca_elemento+0x46>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <busca_elemento+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<busca_elemento>:
test   %esi,%esi
js     111e <busca_elemento+0x1e>
add    $0x1,%esi
xor    %eax,%eax
nopl   0x0(%rax)
cmp    %edx,(%rdi,%rax,4)
je     1121 <busca_elemento+0x21>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1110 <busca_elemento+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @busca_elemento(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 0
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = add nuw i32 %1, 1
%7 = zext i32 %6 to i64
br label %11
8: ; preds = %11
%9 = add nuw nsw i64 %12, 1
%10 = icmp eq i64 %9, %7
br i1 %10, label %16, label %11
11: ; preds = %5, %8
%12 = phi i64 [ 0, %5 ], [ %9, %8 ]
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, %2
br i1 %15, label %16, label %8
16: ; preds = %11, %8, %3
%17 = phi i32 [ 0, %3 ], [ 0, %8 ], [ 1, %11 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void _gcry_burn_stack(int bytes) {
  char buf[64];
  memset(buf, 0, sizeof buf);
  bytes -= sizeof buf;
  if (bytes > 0)
    _gcry_burn_stack(bytes);
}


x86 assembly (clang, -O0):
<_gcry_burn_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
movslq -0x4(%rbp),%rax
sub    $0x40,%rax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1158 <_gcry_burn_stack+0x38>
mov    -0x4(%rbp),%edi
call   1030 <_gcry_burn_stack@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gcry_burn_stack>:
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebx
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
add    $0xffffffc0,%ebx
test   %ebx,%ebx
jle    1144 <_gcry_burn_stack+0x24>
mov    %ebx,%edi
call   1030 <_gcry_burn_stack@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @_gcry_burn_stack(i32 %0) {
%2 = alloca i32
%3 = alloca [64 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 64)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = sub i64 %7, 64
%9 = trunc i64 %8 to i32
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = load i32, i32* %2
br label %14
14: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
define void @_gcry_burn_stack(i32 %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 64)
%5 = add i32 %0, -64
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %1
ret void
}
/* Variables and functions */
int get_mem(int);
int /*<<< orphan*/ put_mem(int, char);
void uart_put(char val) {
  while ((get_mem(0x20000000 + 0x00215054) & 0x20) == 0) {
  }
  put_mem(0x20000000 + 0x00215040, val);
}


x86 assembly (clang, -O0):
<uart_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x20215054,%edi
call   1040 <get_mem@plt>
and    $0x20,%eax
cmp    $0x0,%eax
jne    1149 <uart_put+0x29>
jmp    112e <uart_put+0xe>
mov    $0x20215040,%edi
movsbl -0x1(%rbp),%esi
call   1030 <put_mem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_put>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20215054,%edi
call   1040 <get_mem@plt>
test   $0x20,%al
je     1130 <uart_put+0x10>
movsbl %bl,%esi
mov    $0x20215040,%edi
pop    %rbx
jmp    1030 <put_mem@plt>

LLVM IR (-O0):
define void @uart_put(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %7, %1
%4 = call i32 @get_mem(i32 539054164)
%5 = and i32 %4, 32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i8, i8* %2
%10 = call i32 @put_mem(i32 539054144, i8 signext %9)
ret void
}

LLVM IR (-O2):
define void @uart_put(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @get_mem(i32 539054164)
%4 = and i32 %3, 32
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = tail call i32 @put_mem(i32 539054144, i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char const *, ...);
int /*<<< orphan*/ stdout;
void fmtchk(const char *fmt) {
  (void)fputs(fmt, stdout);
  (void)printf(":\t`");
  (void)printf(fmt, 0x12);
  (void)printf("'\n");
}


x86 assembly (clang, -O0):
<fmtchk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x12,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmtchk>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c":\09`\00"
@.str.1 = [3 x i8] c"'\0A\00"
define void @fmtchk(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdout
%5 = call i32 @fputs(i8* %3, i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* %7, i32 18)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c":\09`\00"
@str = [2 x i8] c"'\00"
define void @fmtchk(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fputs(i8* %0, i32 %2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0, i32 18)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
char randomChar() { return rand() % (127 - 32) + 32; }


x86 assembly (clang, -O0):
<randomChar>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x5f,%ecx
cltd
idiv   %ecx
add    $0x20,%edx
mov    %dl,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomChar>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffffac769185,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x6,%ecx
add    %edx,%ecx
imul   $0x5f,%ecx,%ecx
sub    %ecx,%eax
add    $0x20,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @randomChar() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 95
%3 = add nsw i32 %2, 32
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @randomChar() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 95
%3 = trunc i32 %2 to i8
%4 = add nsw i8 %3, 32
ret i8 %4
}
int nada(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @nada() {
ret i32 0
}
/* Type definitions */
struct twhlist_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ twhlist_unhashed(struct twhlist_node *);
int twhash_hashed(struct twhlist_node *node) { return !twhlist_unhashed(node); }


x86 assembly (clang, -O0):
<twhash_hashed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <twhlist_unhashed@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.twhlist_node = type { i32 }
define i32 @twhash_hashed(%struct.twhlist_node* %0) {
%2 = alloca %struct.twhlist_node*
store %struct.twhlist_node* %0, %struct.twhlist_node** %2
%3 = load %struct.twhlist_node*, %struct.twhlist_node** %2
%4 = call i32 @twhlist_unhashed(%struct.twhlist_node* %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.twhlist_node = type { i32 }
define i32 @twhash_hashed(%struct.twhlist_node* %0) {
%2 = tail call i32 @twhlist_unhashed(%struct.twhlist_node* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
yyEndPrint() { printf("\n"); }


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

x86 assembly (clang, -O2):
<yyEndPrint>:
mov    $0xa,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define i32 @yyEndPrint() {
%1 = tail call i32 @putchar(i32 10)
ret i32 undef
}
/* Variables and functions */
unsigned long float_new(float);
unsigned long int float_s_new(unsigned long int recv, float num) {
  return float_new(num);
}


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

x86 assembly (clang, -O2):
<float_s_new>:
jmp    1030 <float_new@plt>

LLVM IR (-O0):
define i64 @float_s_new(i64 %0, float %1) {
%3 = alloca i64
%4 = alloca float
store i64 %0, i64* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = call i64 @float_new(float %5)
ret i64 %6
}

LLVM IR (-O2):
define i64 @float_s_new(i64 %0, float %1) {
%3 = tail call i64 @float_new(float %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int q1b() {
  int a = 1;
  int b = 1;
  int c = -1;
  printf("\n%s\n", "q1b ------");
  c = --a && b++;
  printf("%d %d %d\n", a, b, c);
  return 1;
}


x86 assembly (clang, -O0):
<q1b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
lea    0xecc(%rip),%rdi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     116d <q1b+0x5d>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q1b>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee6(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [11 x i8] c"q1b ------\00"
@.str.2 = [10 x i8] c"%d %d %d\0A\00"
define i32 @q1b() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1, i32* %1
store i32 1, i32* %2
store i32 -1, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %1
%6 = add nsw i32 %5, -1
store i32 %6, i32* %1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br label %12
12: ; preds = %8, %0
%13 = phi i1 [ false, %0 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
store i32 %14, i32* %3
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
ret i32 1
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [11 x i8] c"q1b ------\00"
@.str.2 = [10 x i8] c"%d %d %d\0A\00"
define i32 @q1b() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 1, i32 0)
ret i32 1
}
int compare_int(const void *a, const void *b) {
  return (*(int *)a - *(int *)b);
}


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

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

LLVM IR (-O0):
define i32 @compare_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ TreeCCOutOfMemory(int /*<<< orphan*/);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *TreeCCDupString(char *str) {
  char *newstr = (char *)malloc(strlen(str) + 1);
  if (!newstr) {
    TreeCCOutOfMemory(0);
  }
  strcpy(newstr, str);
  return newstr;
}


x86 assembly (clang, -O0):
<TreeCCDupString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1177 <TreeCCDupString+0x37>
xor    %edi,%edi
call   1040 <TreeCCOutOfMemory@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TreeCCDupString>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1164 <TreeCCDupString+0x24>
xor    %edi,%edi
call   1040 <TreeCCOutOfMemory@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @TreeCCDupString(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @TreeCCOutOfMemory(i32 0)
br label %9
9: ; preds = %7, %1
%10 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
int fib_recursive(int c) {
  if (c == 0)
    return 0;
  else if (c == 1)
    return 1;
  else
    return fib_recursive(c - 2) + fib_recursive(c - 1);
}


x86 assembly (clang, -O0):
<fib_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <fib_recursive+0x21>
movl   $0x0,-0x4(%rbp)
jmp    116a <fib_recursive+0x5a>
cmpl   $0x1,-0x8(%rbp)
jne    1147 <fib_recursive+0x37>
movl   $0x1,-0x4(%rbp)
jmp    116a <fib_recursive+0x5a>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib_recursive@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib_recursive@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_recursive>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%ebx
jb     1132 <fib_recursive+0x22>
nopl   0x0(%rax)
lea    -0x2(%rbx),%edi
call   1030 <fib_recursive@plt>
add    %eax,%ebp
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
jae    1120 <fib_recursive+0x10>
add    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib_recursive(i32 %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i32 [ 0, %1 ], [ %10, %6 ]
%4 = phi i32 [ %0, %1 ], [ %9, %6 ]
%5 = icmp ult i32 %4, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = add nsw i32 %4, -2
%8 = tail call i32 @fib_recursive(i32 %7)
%9 = add nsw i32 %4, -1
%10 = add nsw i32 %8, %3
br label %2
11: ; preds = %2
%12 = add nsw i32 %4, %3
ret i32 %12
}
void RTManifestWriteStandard(void) {}


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

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

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

LLVM IR (-O2):
define void @RTManifestWriteStandard() {
ret void
}
unsigned long b_mem_allocate(unsigned long *mem, unsigned long nbr) {
  unsigned long tlong;
  asm volatile("call *0x00100050" : "=a"(*(mem)), "=c"(tlong) : "c"(nbr));
  return tlong;
}


x86 assembly (clang, -O0):
<b_mem_allocate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
call   *0x100050
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    %rdx,(%rax)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_mem_allocate>:
mov    %rsi,%rcx
call   *0x100050
mov    %rax,(%rdi)
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @b_mem_allocate(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %4
%8 = call { i64, i64 } asm sideeffect "call *0x00100050", "={ax},={cx},{cx},~{dirflag},~{fpsr},~{flags}"(i64 %7)
%9 = extractvalue { i64, i64 } %8, 0
%10 = extractvalue { i64, i64 } %8, 1
store i64 %9, i64* %6
store i64 %10, i64* %5
%11 = load i64, i64* %5
ret i64 %11
}

LLVM IR (-O2):
define i64 @b_mem_allocate(i64* nocapture writeonly %0, i64 %1) {
%3 = tail call { i64, i64 } asm sideeffect "call *0x00100050", "={ax},={cx},{cx},~{dirflag},~{fpsr},~{flags}"(i64 %1)
%4 = extractvalue { i64, i64 } %3, 0
%5 = extractvalue { i64, i64 } %3, 1
store i64 %4, i64* %0
ret i64 %5
}
int test_imm_02uint8_mem(unsigned char *val) {
  return ((*val) & (0x02 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_02uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 2
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct clk {
  int dummy;
};

/* Variables and functions */
struct clk *clk_fixed_factor(char const *, char const *, unsigned int,
                             unsigned int, int /*<<< orphan*/);
struct clk *mxs_clk_fixed_factor(const char *name, const char *parent_name,
                                 unsigned int mult, unsigned int div) {
  return clk_fixed_factor(name, parent_name, mult, div, 0);
}


x86 assembly (clang, -O0):
<mxs_clk_fixed_factor>:
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
mov    -0x18(%rbp),%ecx
xor    %r8d,%r8d
call   1030 <clk_fixed_factor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mxs_clk_fixed_factor>:
xor    %r8d,%r8d
jmp    1030 <clk_fixed_factor@plt>

LLVM IR (-O0):
%struct.clk = type { i32 }
define %struct.clk* @mxs_clk_fixed_factor(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call %struct.clk* @clk_fixed_factor(i8* %9, i8* %10, i32 %11, i32 %12, i32 0)
ret %struct.clk* %13
}

LLVM IR (-O2):
%struct.clk = type { i32 }
define %struct.clk* @mxs_clk_fixed_factor(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call %struct.clk* @clk_fixed_factor(i8* %0, i8* %1, i32 %2, i32 %3, i32 0)
ret %struct.clk* %5
}
unsigned int GetBt2TrailerMagic(void) { return 0x1CEB72AB; }


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

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

LLVM IR (-O0):
define i32 @GetBt2TrailerMagic() {
ret i32 485192363
}

LLVM IR (-O2):
define i32 @GetBt2TrailerMagic() {
ret i32 485192363
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
void printbits(unsigned x) {
  unsigned i;
  printf("0b");
  for (i = (unsigned)(8 * sizeof(int)); i > 0; i--)
    (bool)(x & (1 << (i - 1))) ? putchar('1') : putchar('0');
}


x86 assembly (clang, -O0):
<printbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
movl   $0x20,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    118c <printbits+0x6c>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1174 <printbits+0x54>
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    117e <printbits+0x5e>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <printbits+0x1e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printbits>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1f,%ebp
cs nopw 0x0(%rax,%rax,1)
bt     %ebp,%ebx
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jb     1140 <printbits+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"0b\00"
define void @printbits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 32, i32* %3
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %3
%7 = icmp ugt i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = sub i32 %10, 1
%12 = shl i32 1, %11
%13 = and i32 %9, %12
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %8
%16 = call i32 @putchar(i8 signext 49)
br label %19
17: ; preds = %8
%18 = call i32 @putchar(i8 signext 48)
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ %16, %15 ], [ %18, %17 ]
br label %21
21: ; preds = %19
%22 = load i32, i32* %3
%23 = add i32 %22, -1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"0b\00"
define void @printbits(i32 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 32, %1 ], [ %5, %3 ]
%5 = add nsw i32 %4, -1
%6 = shl nuw i32 1, %5
%7 = and i32 %6, %0
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8 48, i8 49
%10 = tail call i32 @putchar(i8 signext %9)
%11 = icmp eq i32 %5, 0
br i1 %11, label %12, label %3
12: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test(int);
int main(void) {
  test(0);
  test(1);
  test(2);
  test(3);
  test(4);
  test(5);
  test(-1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <test@plt>
mov    $0x1,%edi
call   1030 <test@plt>
mov    $0x2,%edi
call   1030 <test@plt>
mov    $0x3,%edi
call   1030 <test@plt>
mov    $0x4,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0xffffffff,%edi
call   1030 <test@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(i32 0)
%3 = call i32 @test(i32 1)
%4 = call i32 @test(i32 2)
%5 = call i32 @test(i32 3)
%6 = call i32 @test(i32 4)
%7 = call i32 @test(i32 5)
%8 = call i32 @test(i32 -1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test(i32 0)
%2 = tail call i32 @test(i32 1)
%3 = tail call i32 @test(i32 2)
%4 = tail call i32 @test(i32 3)
%5 = tail call i32 @test(i32 4)
%6 = tail call i32 @test(i32 5)
%7 = tail call i32 @test(i32 -1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_170() {
  Assert_real((isqrt(170) == 13),
              "/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/stdlib/isqrt.c",
              855, ("Integer square root of 170 should be 13"));
}


x86 assembly (clang, -O0):
<t_sqrt_170>:
push   %rbp
mov    %rsp,%rbp
mov    $0xaa,%edi
call   1030 <isqrt@plt>
cmp    $0xd,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x357,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_170>:
push   %rax
mov    $0xaa,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xd,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x357,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 170 should be 13\00"
define void @t_sqrt_170() {
%1 = call i32 @isqrt(i32 170)
%2 = icmp eq i32 %1, 13
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 855, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 170 should be 13\00"
define void @t_sqrt_170() {
%1 = tail call i32 @isqrt(i32 170)
%2 = icmp eq i32 %1, 13
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 855, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int test_imm_7Duint8_mem(unsigned char *val) {
  return ((*val) & (-0x7D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_7Duint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -125
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}