xunge/DecIR huggingface dataset:
/* Variables and functions */
double M_PI;
double cos(double);
double calculateX(double angle, double radius) {
  return (radius * cos(M_PI * angle / 180.0));
}


x86 assembly (clang, -O0):
<calculateX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2eb5(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xebc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateX>:
push   %rax
movsd  %xmm1,(%rsp)
mov    0x2ecb(%rip),%rax
mulsd  (%rax),%xmm0
divsd  0xed7(%rip),%xmm0
call   1030 <cos@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @calculateX(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* @M_PI
%7 = load double, double* %3
%8 = fmul double %6, %7
%9 = fdiv double %8, 1.800000e+02
%10 = call double @cos(double %9)
%11 = fmul double %5, %10
ret double %11
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @calculateX(double %0, double %1) {
%3 = load double, double* @M_PI
%4 = fmul double %3, %0
%5 = fdiv double %4, 1.800000e+02
%6 = tail call double @cos(double %5)
%7 = fmul double %6, %1
ret double %7
}
void pc_serial_init(void) {}


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

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

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

LLVM IR (-O2):
define void @pc_serial_init() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned char *md4_file(unsigned char *, int /*<<< orphan*/ *);
unsigned char *hash_file_md4(unsigned char *out, FILE *fp) {
  return md4_file(out, fp);
}


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

x86 assembly (clang, -O2):
<hash_file_md4>:
jmp    1030 <md4_file@plt>

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

LLVM IR (-O2):
define i8* @hash_file_md4(i8* %0, i32* %1) {
%3 = tail call i8* @md4_file(i8* %0, i32* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *arg) {
  printf("Usage: %s -f tape_path\n", arg);
  printf("       WARNING: %s will overwrite the tape\n\n", arg);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Usage: %s -f tape_path\0A\00"
@.str.1 = [45 x i8] c" WARNING: %s will overwrite the tape\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage: %s -f tape_path\0A\00"
@.str.1 = [45 x i8] c" WARNING: %s will overwrite the tape\0A\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
scalar_t__ sched_yield();
int main(int arc, char *argv[]) {
  while (1)
    if (sched_yield())
      perror("sched_yield");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <sched_yield@plt>
cmp    $0x0,%rax
je     1153 <main+0x33>
lea    0xeb2(%rip),%rdi
call   1040 <perror@plt>
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <sched_yield@plt>
test   %rax,%rax
je     1130 <main+0x10>
mov    %rbx,%rdi
call   1040 <perror@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
@.str = [12 x i8] c"sched_yield\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %2, %11
%7 = call i64 (...) @sched_yield()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
br label %6
}

LLVM IR (-O2):
@.str = [12 x i8] c"sched_yield\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %8, %2
%4 = tail call i64 (...) @sched_yield()
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
void gen_sr_nloop_index(FILE *outfile, int bracket, int dim) {
  fprintf(outfile, "_j%d_%d", bracket, dim);
}


x86 assembly (clang, -O0):
<gen_sr_nloop_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_sr_nloop_index>:
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee5(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"_j%d_%d\00"
define void @gen_sr_nloop_index(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 = load i32, i32* %6
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"_j%d_%d\00"
define void @gen_sr_nloop_index(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ *display;
};
struct TYPE_4__ {
  TYPE_1__ xunmap;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XEvent_xunmap_display(void *_p, void *_v) {
  ((XEvent *)_p)->xunmap.display = (Display *)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XEvent_xunmap_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
int test_imm_44int8_mem(signed char *val) {
  return ((*val) & (-0x44 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_44int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -68
%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_44int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -68
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ SA1Absolute(int);
int /*<<< orphan*/ TRB16(int /*<<< orphan*/, int);
void Op1CM0(void) { TRB16(SA1Absolute(3), 0xFFFF); }


x86 assembly (clang, -O0):
<Op1CM0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <SA1Absolute@plt>
mov    %eax,%edi
mov    $0xffff,%esi
call   1030 <TRB16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op1CM0>:
push   %rax
mov    $0x3,%edi
call   1040 <SA1Absolute@plt>
mov    %eax,%edi
mov    $0xffff,%esi
pop    %rax
jmp    1030 <TRB16@plt>

LLVM IR (-O0):
define void @Op1CM0() {
%1 = call i32 @SA1Absolute(i32 3)
%2 = call i32 @TRB16(i32 %1, i32 65535)
ret void
}

LLVM IR (-O2):
define void @Op1CM0() {
%1 = tail call i32 @SA1Absolute(i32 3)
%2 = tail call i32 @TRB16(i32 %1, i32 65535)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void starexit(int status) { exit(status); }


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

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

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

LLVM IR (-O2):
define void @starexit(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ dev;

/* Variables and functions */
int open(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int mtd_open(int num, int flags) {
  char dev[10];
  snprintf(dev, sizeof(dev), "/dev/mtd%d", num);
  return open(dev, flags);
}


x86 assembly (clang, -O0):
<mtd_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0xa,%esi
lea    0xebf(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x12(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <open@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtd_open>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ecx
lea    0xece(%rip),%rdx
lea    0xe(%rsp),%r14
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <snprintf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <open@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/mtd%d\00"
define i32 @mtd_open(i32 %0, i32 %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = call i32 @open(i8* %4, i32 %1)
ret i32 %6
}
/* Type definitions */
struct olist_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ olist_set_onext(struct olist_head *, struct olist_head *);
int /*<<< orphan*/ olist_set_oprev(struct olist_head *, struct olist_head *);
void INIT_OLIST_HEAD(struct olist_head *list) {
  olist_set_onext(list, list);
  olist_set_oprev(list, list);
}


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

x86 assembly (clang, -O2):
<INIT_OLIST_HEAD>:
push   %rbx
mov    %rdi,%rbx
mov    %rdi,%rsi
call   1030 <olist_set_onext@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <olist_set_oprev@plt>

LLVM IR (-O0):
%struct.olist_head = type { i32 }
define void @INIT_OLIST_HEAD(%struct.olist_head* %0) {
%2 = alloca %struct.olist_head*
store %struct.olist_head* %0, %struct.olist_head** %2
%3 = load %struct.olist_head*, %struct.olist_head** %2
%4 = load %struct.olist_head*, %struct.olist_head** %2
%5 = call i32 @olist_set_onext(%struct.olist_head* %3, %struct.olist_head* %4)
%6 = load %struct.olist_head*, %struct.olist_head** %2
%7 = load %struct.olist_head*, %struct.olist_head** %2
%8 = call i32 @olist_set_oprev(%struct.olist_head* %6, %struct.olist_head* %7)
ret void
}

LLVM IR (-O2):
%struct.olist_head = type { i32 }
define void @INIT_OLIST_HEAD(%struct.olist_head* %0) {
%2 = tail call i32 @olist_set_onext(%struct.olist_head* %0, %struct.olist_head* %0)
%3 = tail call i32 @olist_set_oprev(%struct.olist_head* %0, %struct.olist_head* %0)
ret void
}
void eRTK_timer_init(void) {}


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

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

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

LLVM IR (-O2):
define void @eRTK_timer_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__12__GeneralIO__clr();
void HplSensirionSht11P__DATA__clr(void) { Msp430GpioC__12__GeneralIO__clr(); }


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

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

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

LLVM IR (-O2):
define void @HplSensirionSht11P__DATA__clr() {
%1 = tail call i32 (...) @Msp430GpioC__12__GeneralIO__clr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sbrk(int);
int main() {
  printf("Callign sbrk(4096)\n");
  int adr = (int)sbrk(4096);
  printf("sbrk() returned 0x%0x\n", adr);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1000,%edi
call   1040 <sbrk@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1000,%edi
call   1050 <sbrk@plt>
lea    0xea2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Callign sbrk(4096)\0A\00"
@.str.1 = [23 x i8] c"sbrk() returned 0x%0x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @sbrk(i32 4096)
%5 = trunc i64 %4 to i32
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"sbrk() returned 0x%0x\0A\00"
@str = [19 x i8] c"Callign sbrk(4096)\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 @sbrk(i32 4096)
%3 = trunc i64 %2 to i32
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct rGPIO {
  int dummy;
};

/* Variables and functions */
scalar_t__ GetMmap_(int);
struct rGPIO *GetGPIOC() {
  return (struct rGPIO *)GetMmap_(0xC0010000 + 0xC000);
}


x86 assembly (clang, -O0):
<GetGPIOC>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc001c000,%edi
call   1030 <GetMmap_@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetGPIOC>:
mov    $0xc001c000,%edi
jmp    1030 <GetMmap_@plt>

LLVM IR (-O0):
%struct.rGPIO = type { i32 }
define %struct.rGPIO* @GetGPIOC() {
%1 = call i64 @GetMmap_(i32 -1073627136)
%2 = inttoptr i64 %1 to %struct.rGPIO*
ret %struct.rGPIO* %2
}

LLVM IR (-O2):
%struct.rGPIO = type { i32 }
define %struct.rGPIO* @GetGPIOC() {
%1 = tail call i64 @GetMmap_(i32 -1073627136)
%2 = inttoptr i64 %1 to %struct.rGPIO*
ret %struct.rGPIO* %2
}
/* Variables and functions */
int /*<<< orphan*/ clrtoeol();
int /*<<< orphan*/ egetch();
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
int /*<<< orphan*/ prints(char *);
void temppress(char *s) {
  move(23, 0);
  clrtoeol();
  prints(s);
  egetch();
}


x86 assembly (clang, -O0):
<temppress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x17,%edi
xor    %esi,%esi
call   1060 <move@plt>
mov    $0x0,%al
call   1050 <clrtoeol@plt>
mov    -0x8(%rbp),%rdi
call   1040 <prints@plt>
mov    $0x0,%al
call   1030 <egetch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<temppress>:
push   %rbx
mov    %rdi,%rbx
mov    $0x17,%edi
xor    %esi,%esi
call   1060 <move@plt>
xor    %eax,%eax
call   1050 <clrtoeol@plt>
mov    %rbx,%rdi
call   1040 <prints@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <egetch@plt>

LLVM IR (-O0):
define void @temppress(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @move(i32 23, i32 0)
%4 = call i32 (...) @clrtoeol()
%5 = load i8*, i8** %2
%6 = call i32 @prints(i8* %5)
%7 = call i32 (...) @egetch()
ret void
}

LLVM IR (-O2):
define void @temppress(i8* %0) {
%2 = tail call i32 @move(i32 23, i32 0)
%3 = tail call i32 (...) @clrtoeol()
%4 = tail call i32 @prints(i8* %0)
%5 = tail call i32 (...) @egetch()
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int *CriaVetInt(int tamanho) {
  int *ptr;
  ptr = (int *)malloc(sizeof(int) * tamanho);
  return ptr;
}


x86 assembly (clang, -O0):
<CriaVetInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CriaVetInt>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @CriaVetInt(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 4, %5
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %3
%10 = load i32*, i32** %3
ret i32* %10
}

LLVM IR (-O2):
define i32* @CriaVetInt(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i32*
ret i32* %4
}
void show_tip_node(struct test_info *tip) {}


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

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

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

LLVM IR (-O2):
%struct.test_info = type opaque
define void @show_tip_node(%struct.test_info* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  float f;
  double d;
  unsigned char x;
  d = f;
  if (f == x)
    assert(d == x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movzbl -0x11(%rbp),%eax
cvtsi2ss %eax,%xmm1
ucomiss %xmm1,%xmm0
jne    116c <main+0x5c>
jp     116c <main+0x5c>
movsd  -0x10(%rbp),%xmm0
movzbl -0x11(%rbp),%eax
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = alloca i8
store i32 0, i32* %1
%5 = load float, float* %2
%6 = fpext float %5 to double
store double %6, double* %3
%7 = load float, float* %2
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = sitofp i32 %9 to float
%11 = fcmp oeq float %7, %10
br i1 %11, label %12, label %20
12: ; preds = %0
%13 = load double, double* %3
%14 = load i8, i8* %4
%15 = zext i8 %14 to i32
%16 = sitofp i32 %15 to double
%17 = fcmp oeq double %13, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
br label %20
20: ; preds = %12, %0
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int debug_nowstring(char *buf, int len) {
  buf[0] = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<debug_nowstring>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_nowstring>:
movb   $0x0,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @debug_nowstring(i8* nocapture writeonly %0, i32 %1) {
store i8 0, i8* %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ unwind();
void f(int count) {
  if (count)
    f(count - 1);
  else
    unwind();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1145 <f+0x25>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <f@plt>
jmp    114c <f+0x2c>
mov    $0x0,%al
call   1030 <unwind@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 %6, 1
br label %10
8: ; preds = %1
%9 = call i32 (...) @unwind()
br label %10
10: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = tail call i32 (...) @unwind()
ret void
}
/* Variables and functions */
int strlen(char *);
int writestring(void *, char *, int);
int fputs(char *str, void *f) {
  int n = strlen(str);
  return writestring(f, str, n) == n ? 0 : -1;
}


x86 assembly (clang, -O0):
<fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <writestring@plt>
mov    %eax,%edx
mov    -0x14(%rbp),%esi
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputs>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <writestring@plt>
xor    %ecx,%ecx
cmp    %ebp,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fputs(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = load i32, i32* %5
%11 = call i32 @writestring(i8* %8, i8* %9, i32 %10)
%12 = load i32, i32* %5
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 0, i32 -1
ret i32 %15
}

LLVM IR (-O2):
define i32 @fputs(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @writestring(i8* %1, i8* %0, i32 %3)
%5 = icmp ne i32 %4, %3
%6 = sext i1 %5 to i32
ret i32 %6
}
int main() {
  int a = 3;
  int b = 2;
  while (b) {
    a *= 4;
    b *= a;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113b <main+0x3b>
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1119 <main+0x19>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O2):
void replacetochar(char *str, char oldchar, char newchar) {
  int x;
  for (x = 0; str[x]; x++)
    if (str[x] == oldchar)
      str[x] = newchar;
}


x86 assembly (clang, -O0):
<replacetochar>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1165 <replacetochar+0x65>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1152 <replacetochar+0x52>
mov    -0xa(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1157 <replacetochar+0x57>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111a <replacetochar+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<replacetochar>:
mov    (%rdi),%al
test   %al,%al
je     1125 <replacetochar+0x25>
add    $0x1,%rdi
jmp    111b <replacetochar+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1125 <replacetochar+0x25>
cmp    %sil,%al
jne    1110 <replacetochar+0x10>
mov    %dl,-0x1(%rdi)
jmp    1110 <replacetochar+0x10>
ret

LLVM IR (-O0):
define void @replacetochar(i8* %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
store i32 0, i32* %7
br label %8
8: ; preds = %32, %3
%9 = load i8*, i8** %4
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %35
15: ; preds = %8
%16 = load i8*, i8** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %31
25: ; preds = %15
%26 = load i8, i8* %6
%27 = load i8*, i8** %4
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 %26, i8* %30
br label %31
31: ; preds = %25, %15
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %8
35: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @replacetochar(i8* nocapture %0, i8 signext %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3, %12
%7 = phi i64 [ %13, %12 ], [ 0, %3 ]
%8 = phi i8 [ %15, %12 ], [ %4, %3 ]
%9 = phi i8* [ %14, %12 ], [ %0, %3 ]
%10 = icmp eq i8 %8, %1
br i1 %10, label %11, label %12
11: ; preds = %6
store i8 %2, i8* %9
br label %12
12: ; preds = %6, %11
%13 = add nuw i64 %7, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %12, %3
ret void
}
void tex_disp_at(double n, double perct) {}


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

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

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

LLVM IR (-O2):
define void @tex_disp_at(double %0, double %1) {
ret void
}
int rtems_filesystem_is_separator(char ch) {
  return ((ch == '/') || (ch == '\\') || (ch == '\0'));
}


x86 assembly (clang, -O0):
<rtems_filesystem_is_separator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2f,%ecx
mov    %al,-0x2(%rbp)
je     113b <rtems_filesystem_is_separator+0x3b>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5c,%ecx
mov    %al,-0x2(%rbp)
je     113b <rtems_filesystem_is_separator+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtems_filesystem_is_separator>:
mov    $0x1,%eax
cmp    $0x2f,%dil
je     1111 <rtems_filesystem_is_separator+0x11>
cmp    $0x5c,%dil
jne    1112 <rtems_filesystem_is_separator+0x12>
ret
xor    %eax,%eax
test   %dil,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @rtems_filesystem_is_separator(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 47
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 92
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @rtems_filesystem_is_separator(i8 signext %0) {
switch i8 %0, label %2 [
i8 92, label %5
i8 47, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 0
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
void board_init(void) {}


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

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

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

LLVM IR (-O2):
define void @board_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void _RTreeTabIn(int depth) {
  int i;
  for (i = 0; i < depth; i++)
    putchar(' ');
}


x86 assembly (clang, -O0):
<_RTreeTabIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1146 <_RTreeTabIn+0x36>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <_RTreeTabIn+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_RTreeTabIn>:
push   %rbx
test   %edi,%edi
jle    112f <_RTreeTabIn+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <_RTreeTabIn+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @_RTreeTabIn(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 @putchar(i8 signext 32)
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @_RTreeTabIn(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @putchar(i8 signext 32)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t compress(uint32_t a) {
  int i = 0;
  uint32_t out = 0;
  for (i; a; i++) {
    out |= (a & 1) << i;
    a /= 4;
  }
  return out / 8;
}


x86 assembly (clang, -O0):
<compress>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114c <compress+0x4c>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <compress+0x15>
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<compress>:
test   %edi,%edi
je     1138 <compress+0x38>
xor    %edx,%edx
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
and    $0x1,%eax
shl    %cl,%eax
or     %eax,%edx
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovs  %eax,%edi
sar    $0x2,%edi
add    $0x1,%ecx
cmp    $0x6,%eax
ja     1110 <compress+0x10>
lea    0x7(%rdx),%eax
test   %edx,%edx
cmovns %edx,%eax
sar    $0x3,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @compress(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %16, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = phi i32 [ %11, %3 ], [ 0, %1 ]
%6 = phi i32 [ %10, %3 ], [ %0, %1 ]
%7 = and i32 %6, 1
%8 = shl nuw i32 %7, %5
%9 = or i32 %4, %8
%10 = sdiv i32 %6, 4
%11 = add nuw nsw i32 %5, 1
%12 = add i32 %6, 3
%13 = icmp ult i32 %12, 7
br i1 %13, label %14, label %3
14: ; preds = %3
%15 = sdiv i32 %9, 8
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Type definitions */
typedef int /*<<< orphan*/ fpos_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fsetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int fset_pos(FILE *stream, fpos_t *ptr) { return (fsetpos(stream, ptr)); }


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

x86 assembly (clang, -O2):
<fset_pos>:
jmp    1030 <fsetpos@plt>

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

LLVM IR (-O2):
define i32 @fset_pos(i32* nocapture %0, i32* %1) {
%3 = tail call i32 @fsetpos(i32* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strncpy_term(char *dest, size_t destsize, const char *source, size_t n) {
  if (n > destsize)
    n = destsize;
  strncpy(dest, source, n - 1);
  dest[n - 1] = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<strncpy_term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    113e <strncpy_term+0x2e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy_term>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdi,%r14
cmp    %rsi,%rcx
cmova  %rsi,%rbx
lea    -0x1(%rbx),%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <strncpy@plt>
movb   $0x0,-0x1(%r14,%rbx,1)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strncpy_term(i8* returned %0, i64 %1, i8* %2, i64 %3) {
%5 = icmp ugt i64 %3, %1
%6 = select i1 %5, i64 %1, i64 %3
%7 = add i64 %6, -1
%8 = tail call i32 @strncpy(i8* %0, i8* %2, i64 %7)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %9
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ bug();
int main(int argc, char **argv) { bug(); }


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @bug()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @bug()
ret i32 0
}
/* Variables and functions */
size_t get_data_tag_in_PreAllocGrp(size_t __tag) {
  (void)__tag;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i64 @get_data_tag_in_PreAllocGrp(i64 %0) {
ret i64 0
}
/* Variables and functions */
int check_signature(char const *);
int loader_AF_check(const char *filename, unsigned char *data, long size) {
  if (size >= (16 + 128))
    return check_signature((const char *)&data[1]);
  return 0;
}


x86 assembly (clang, -O0):
<loader_AF_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x90,-0x20(%rbp)
jl     1147 <loader_AF_check+0x37>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1030 <check_signature@plt>
mov    %eax,-0x4(%rbp)
jmp    114e <loader_AF_check+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loader_AF_check>:
cmp    $0x90,%rdx
jl     1125 <loader_AF_check+0x15>
add    $0x1,%rsi
mov    %rsi,%rdi
jmp    1030 <check_signature@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @loader_AF_check(i8* nocapture readnone %0, i8* %1, i64 %2) {
%4 = icmp sgt i64 %2, 143
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = getelementptr inbounds i8, i8* %1, i64 1
%7 = tail call i32 @check_signature(i8* %6)
br label %8
8: ; preds = %3, %5
%9 = phi i32 [ %7, %5 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ ns_sleep(int);
void us_sleep(int us) { ns_sleep(us * 1e3); }


x86 assembly (clang, -O0):
<us_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <ns_sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<us_sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <ns_sleep@plt>

LLVM IR (-O0):
define void @us_sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 1.000000e+03
%6 = fptosi double %5 to i32
%7 = call i32 @ns_sleep(i32 %6)
ret void
}

LLVM IR (-O2):
define void @us_sleep(i32 %0) {
%2 = mul i32 %0, 1000
%3 = tail call i32 @ns_sleep(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void end_html(void) {
  puts("</BODY>");
  puts("</HTML>");
  return;
}


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

x86 assembly (clang, -O2):
<end_html>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"</BODY>\00"
@.str.1 = [8 x i8] c"</HTML>\00"
define void @end_html() {
%1 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"</BODY>\00"
@.str.1 = [8 x i8] c"</HTML>\00"
define void @end_html() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int kill(int, int);
int killpg(int gid, int sig) { return kill(-gid, sig); }


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

x86 assembly (clang, -O2):
<killpg>:
neg    %edi
jmp    1030 <kill@plt>

LLVM IR (-O0):
define i32 @killpg(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = sub nsw i32 0, %5
%7 = load i32, i32* %4
%8 = call i32 @kill(i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @killpg(i32 %0, i32 %1) {
%3 = sub nsw i32 0, %0
%4 = tail call i32 @kill(i32 %3, i32 %1)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __chk_fail();
int /*<<< orphan*/ __readlink(char const *, void *, size_t);
ssize_t __readlink_chk(const char *path, void *buf, size_t len, size_t buflen) {
  if (len > buflen)
    __chk_fail();
  return __readlink(path, buf, len);
}


x86 assembly (clang, -O0):
<__readlink_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    114d <__readlink_chk+0x2d>
mov    $0x0,%al
call   1040 <__chk_fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <__readlink@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__readlink_chk>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
cmp    %rcx,%rdx
jbe    113a <__readlink_chk+0x1a>
xor    %eax,%eax
call   1040 <__chk_fail@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <__readlink@plt>

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

LLVM IR (-O2):
define i32 @__readlink_chk(i8* %0, i8* %1, i64 %2, i64 %3) {
%5 = icmp ugt i64 %2, %3
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (...) @__chk_fail()
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @__readlink(i8* %0, i8* %1, i64 %2)
ret i32 %9
}