xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ sleep(int);
int main() {
  initscr();
  move(5, 15);
  printw("hello world\n");
  refresh();
  sleep(2);
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
mov    $0x5,%edi
mov    $0xf,%esi
call   1080 <move@plt>
lea    0xe74(%rip),%rdi
call   1040 <printw@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
mov    $0x0,%al
call   1060 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <initscr@plt>
mov    $0x5,%edi
mov    $0xf,%esi
call   1080 <move@plt>
lea    0xe82(%rip),%rdi
call   1040 <printw@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
call   1060 <endwin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i32 @move(i32 5, i32 15)
%4 = call i32 @printw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @refresh()
%6 = call i32 @sleep(i32 2)
%7 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 @move(i32 5, i32 15)
%3 = tail call i32 @printw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @refresh()
%5 = tail call i32 @sleep(i32 2)
%6 = tail call i32 (...) @endwin()
ret i32 0
}
/* Type definitions */
typedef scalar_t__ flags;

/* Variables and functions */
int /*<<< orphan*/ raw_local_irq_enable();
void raw_local_irq_restore(unsigned long flags) {
  if (!(((flags) & ~0x3f) == 0))
    raw_local_irq_enable();
}


x86 assembly (clang, -O0):
<raw_local_irq_restore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffffffffffffffc0,%rax
cmp    $0x0,%rax
je     1135 <raw_local_irq_restore+0x25>
mov    $0x0,%al
call   1030 <raw_local_irq_enable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_local_irq_restore>:
cmp    $0x40,%rdi
jae    1117 <raw_local_irq_restore+0x7>
ret
xor    %eax,%eax
jmp    1030 <raw_local_irq_enable@plt>

LLVM IR (-O0):
define void @raw_local_irq_restore(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, -64
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 (...) @raw_local_irq_enable()
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @raw_local_irq_restore(i64 %0) {
%2 = icmp ult i64 %0, 64
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @raw_local_irq_enable()
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
int dummyfn(int x, int y) {
  fprintf(stderr, "dummyfn %d, %d\n", x, y);
  return x + y;
}


x86 assembly (clang, -O0):
<dummyfn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dummyfn>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
lea    0xed9(%rip),%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1030 <fprintf@plt>
add    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"dummyfn %d, %d\0A\00"
define i32 @dummyfn(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"dummyfn %d, %d\0A\00"
define i32 @dummyfn(i32 %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%5 = add nsw i32 %1, %0
ret i32 %5
}
char *check_if_exist_big_low_conflict() { int exist = 0; }


x86 assembly (clang, -O0):
<check_if_exist_big_low_conflict>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @check_if_exist_big_low_conflict() {
%1 = alloca i8*
%2 = alloca i32
store i32 0, i32* %2
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define noalias i8* @check_if_exist_big_low_conflict() {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void btktermio_move_cursor(int y, int x) { printf("\033[%i;%iH", y, x); }


x86 assembly (clang, -O0):
<btktermio_move_cursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btktermio_move_cursor>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%i;%iH\00"
define void @btktermio_move_cursor(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 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%i;%iH\00"
define void @btktermio_move_cursor(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ carmen_commander_clear_processes();
int /*<<< orphan*/ carmen_commander_make_menu(int /*<<< orphan*/ *);
int /*<<< orphan*/ clear();
void carmen_commander_update() {
  carmen_commander_clear_processes();
  clear();
  carmen_commander_make_menu(NULL);
}


x86 assembly (clang, -O0):
<carmen_commander_update>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <carmen_commander_clear_processes@plt>
mov    $0x0,%al
call   1050 <clear@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <carmen_commander_make_menu@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<carmen_commander_update>:
push   %rax
xor    %eax,%eax
call   1040 <carmen_commander_clear_processes@plt>
xor    %eax,%eax
call   1050 <clear@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <carmen_commander_make_menu@plt>

LLVM IR (-O0):
define void @carmen_commander_update() {
%1 = call i32 (...) @carmen_commander_clear_processes()
%2 = call i32 (...) @clear()
%3 = call i32 @carmen_commander_make_menu(i32* null)
ret void
}

LLVM IR (-O2):
define void @carmen_commander_update() {
%1 = tail call i32 (...) @carmen_commander_clear_processes()
%2 = tail call i32 (...) @clear()
%3 = tail call i32 @carmen_commander_make_menu(i32* null)
ret void
}
/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int read(int, void *, int);
int xread(int fd, void *to, int len) {
  int ret;
  do {
    ret = read(fd, to, len);
  } while (ret < 0 && errno == EINTR);
  return ret;
}


x86 assembly (clang, -O0):
<xread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jge    115d <xread+0x4d>
mov    0x2e96(%rip),%rax
mov    (%rax),%rax
mov    0x2e84(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1122 <xread+0x12>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xread>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <read@plt>
test   %eax,%eax
jns    114a <xread+0x3a>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <xread+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @xread(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @read(i32 %9, i8* %10, i32 %11)
store i32 %12, i32* %7
br label %13
13: ; preds = %8
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* @errno
%18 = load i64, i64* @EINTR
%19 = icmp eq i64 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @xread(i32 %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
%6 = icmp slt i32 %5, 0
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ popNarray(char *, unsigned int);
void popinteger4array_(void *x, unsigned int *n) {
  popNarray((char *)x, (*n * 4));
}


x86 assembly (clang, -O0):
<popinteger4array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x2,%esi
call   1030 <popNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popinteger4array_>:
mov    (%rsi),%esi
shl    $0x2,%esi
jmp    1030 <popNarray@plt>

LLVM IR (-O0):
define void @popinteger4array_(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 = load i32, i32* %6
%8 = mul i32 %7, 4
%9 = call i32 @popNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @popinteger4array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 2
%5 = tail call i32 @popNarray(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printw(char *);
void draw_win() { printw("Congratz!\n"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"Congratz!\0A\00"
define void @draw_win() {
%1 = call i32 @printw(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Congratz!\0A\00"
define void @draw_win() {
%1 = tail call i32 @printw(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
XSetTransientForHint() {}


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

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

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

LLVM IR (-O2):
define i32 @XSetTransientForHint() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
void check_arry(int *l, int a) {
  int i = 0;
  while (i < a) {
    printf("%d\t", l[i++]);
  }
  puts("");
}


x86 assembly (clang, -O0):
<check_arry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1168 <check_arry+0x48>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
jmp    1136 <check_arry+0x16>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arry>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1155 <check_arry+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xec5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <printf@plt>
cmp    %rbx,%r12
jne    1140 <check_arry+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @check_arry(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %8, %6 ]
%8 = add nuw nsw i64 %7, 1
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp eq i64 %8, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
unsigned int readmem(int, int);
unsigned int cbgc(int x, int y) { return readmem(x, y); }


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

x86 assembly (clang, -O2):
<cbgc>:
jmp    1030 <readmem@plt>

LLVM IR (-O0):
define i32 @cbgc(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 @readmem(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbgc(i32 %0, i32 %1) {
%3 = tail call i32 @readmem(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ writeLog();
int main(int argc, char **argv) {
  writeLog();
  system("tail /var/log/syslog");
  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 <writeLog@plt>
lea    0xebc(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"tail /var/log/syslog\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
%6 = call i32 (...) @writeLog()
%7 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"tail /var/log/syslog\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @writeLog()
%4 = tail call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
double __nv_exp10(double);
double exp10(double __a) { return __nv_exp10(__a); }


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

x86 assembly (clang, -O2):
<exp10>:
jmp    1030 <__nv_exp10@plt>

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

LLVM IR (-O2):
define double @exp10(double %0) {
%2 = tail call double @__nv_exp10(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ _mu_test_postprocess();
int /*<<< orphan*/ _mu_test_preprocess(char *);
int /*<<< orphan*/ test_getline();
void test_utils(void) {
  do {
    _mu_test_preprocess("test_getline");
    test_getline();
    _mu_test_postprocess();
  } while (0);
}


x86 assembly (clang, -O0):
<test_utils>:
push   %rbp
mov    %rsp,%rbp
jmp    1139 <test_utils+0x9>
lea    0xec0(%rip),%rdi
call   1040 <_mu_test_preprocess@plt>
mov    $0x0,%al
call   1030 <test_getline@plt>
mov    $0x0,%al
call   1050 <_mu_test_postprocess@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_utils>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <_mu_test_preprocess@plt>
xor    %eax,%eax
call   1030 <test_getline@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <_mu_test_postprocess@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"test_getline\00"
define void @test_utils() {
br label %1
1: ; preds = %0
%2 = call i32 @_mu_test_preprocess(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @test_getline()
%4 = call i32 (...) @_mu_test_postprocess()
br label %5
5: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"test_getline\00"
define void @test_utils() {
%1 = tail call i32 @_mu_test_preprocess(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @test_getline()
%3 = tail call i32 (...) @_mu_test_postprocess()
ret void
}
/* Variables and functions */
int add_range(int, int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int result[100];
  result[0] = add_range(1, 10);
  result[1] = add_range(1, 100);
  printf("result[0]=%d\nresult[1]=%d\n", result[0], result[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0xa,%esi
call   1030 <add_range@plt>
mov    %eax,-0x1a0(%rbp)
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <add_range@plt>
mov    %eax,-0x19c(%rbp)
mov    -0x1a0(%rbp),%esi
mov    -0x19c(%rbp),%edx
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0xa,%esi
call   1030 <add_range@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <add_range@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"result[0]=%d\0Aresult[1]=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @add_range(i32 1, i32 10)
%2 = tail call i32 @add_range(i32 1, i32 100)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 0
}
/* Variables and functions */
int gfx_pci_config_read(int);
int /*<<< orphan*/ gfx_pci_config_write(int, unsigned long);
int gfx_vga_set_pci_command(unsigned char command) {
  unsigned long value;
  value = gfx_pci_config_read(0x80009404) & 0xFFFFFF00;
  value |= (unsigned long)command;
  gfx_pci_config_write(0x80009404, value);
  return (0);
}


x86 assembly (clang, -O0):
<gfx_vga_set_pci_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x80009404,%edi
call   1040 <gfx_pci_config_read@plt>
and    $0xffffff00,%eax
mov    %eax,%eax
mov    %rax,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x80009404,%edi
call   1030 <gfx_pci_config_write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_vga_set_pci_command>:
push   %rbx
mov    %edi,%ebx
mov    $0x80009404,%edi
call   1040 <gfx_pci_config_read@plt>
and    $0xffffff00,%eax
or     %eax,%ebx
mov    $0x80009404,%edi
mov    %rbx,%rsi
call   1030 <gfx_pci_config_write@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @gfx_vga_set_pci_command(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i64
store i8 %0, i8* %2
%4 = call i32 @gfx_pci_config_read(i32 -2147445756)
%5 = and i32 %4, -256
%6 = zext i32 %5 to i64
store i64 %6, i64* %3
%7 = load i8, i8* %2
%8 = zext i8 %7 to i64
%9 = load i64, i64* %3
%10 = or i64 %9, %8
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = call i32 @gfx_pci_config_write(i32 -2147445756, i64 %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @gfx_vga_set_pci_command(i8 zeroext %0) {
%2 = tail call i32 @gfx_pci_config_read(i32 -2147445756)
%3 = and i32 %2, -256
%4 = zext i32 %3 to i64
%5 = zext i8 %0 to i64
%6 = or i64 %4, %5
%7 = tail call i32 @gfx_pci_config_write(i32 -2147445756, i64 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ error(int, char *, char *);
scalar_t__ read(int, char *, int);
void mread(int fd, char *address, int bytes) {
  if (read(fd, address, bytes) < 0 && bytes != 0)
    error(1, "Read error", ((char *)0));
}


x86 assembly (clang, -O0):
<mread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read@plt>
cmp    $0x0,%rax
jge    116a <mread+0x4a>
cmpl   $0x0,-0x14(%rbp)
je     116a <mread+0x4a>
mov    $0x1,%edi
lea    0xe9f(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mread>:
push   %rbx
mov    %edx,%ebx
call   1030 <read@plt>
test   %ebx,%ebx
je     1145 <mread+0x25>
test   %rax,%rax
jns    1145 <mread+0x25>
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
xor    %edx,%edx
pop    %rbx
jmp    1040 <error@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Read error\00"
define void @mread(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i64 @read(i32 %7, i8* %8, i32 %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @error(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* null)
br label %17
17: ; preds = %15, %12, %3
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Read error\00"
define void @mread(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i64 @read(i32 %0, i8* %1, i32 %2)
%5 = icmp slt i64 %4, 0
%6 = icmp ne i32 %2, 0
%7 = and i1 %6, %5
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @error(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* null)
br label %10
10: ; preds = %8, %3
ret void
}
/* Variables and functions */
double exp(double);
double pois_b1(double x) { return exp(x); }


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

x86 assembly (clang, -O2):
<pois_b1>:
jmp    1030 <exp@plt>

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

LLVM IR (-O2):
define double @pois_b1(double %0) {
%2 = tail call double @exp(double %0)
ret double %2
}
unsigned int ick_rotleft32(unsigned int n) {
  return !!(n & 0x80000000) | ((n & 0x7FFFFFFF) << 1);
}


x86 assembly (clang, -O0):
<ick_rotleft32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%ecx
and    $0x7fffffff,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ick_rotleft32>:
mov    %edi,%eax
rol    %eax
ret

LLVM IR (-O0):
define i32 @ick_rotleft32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -2147483648
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
%9 = load i32, i32* %2
%10 = and i32 %9, 2147483647
%11 = shl i32 %10, 1
%12 = or i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ick_rotleft32(i32 %0) {
%2 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 1)
ret i32 %2
}
int main() {
  int x;
  x = 3;
  int y;
  y = 6;
  return x + y - 9;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x9,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int f(int a, int b) { return a / b; }


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

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @f(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 = sdiv i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
float acoshf(float x) { return 0.0; }


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

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

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

LLVM IR (-O2):
define float @acoshf(float %0) {
ret float 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ setenv(char *, char *, int);
void unset_launcher_env() { setenv("TESTLAUNCHER", "0", 1); }


x86 assembly (clang, -O0):
<unset_launcher_env>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeeb(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<unset_launcher_env>:
lea    0xee9(%rip),%rdi
lea    0xeef(%rip),%rsi
mov    $0x1,%edx
jmp    1030 <setenv@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"TESTLAUNCHER\00"
@.str.1 = [2 x i8] c"0\00"
define void @unset_launcher_env() {
%1 = tail call i32 @setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
ret void
}
int test_imm_DDuint16_reg(unsigned short val) {
  return ((val) & (-0xDD << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_DDuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -221
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
scalar_t__ rand();
float MyRand(void) { return 10.0 * ((float)rand() / (float)32767 - 0.5); }


x86 assembly (clang, -O0):
<MyRand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
movss  0xee8(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed0(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<MyRand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
divss  0xedb(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xed7(%rip),%xmm0
mulsd  0xed7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @MyRand() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = fdiv float %2, 3.276700e+04
%4 = fpext float %3 to double
%5 = fsub double %4, 5.000000e-01
%6 = fmul double 1.000000e+01, %5
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @MyRand() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = fdiv float %2, 3.276700e+04
%4 = fpext float %3 to double
%5 = fadd double %4, -5.000000e-01
%6 = fmul double %5, 1.000000e+01
%7 = fptrunc double %6 to float
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void print_usage(const char *program_name) {
  printf("usage: %s INI-FILE\n", program_name);
  exit(0);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"usage: %s INI-FILE\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [20 x i8] c"usage: %s INI-FILE\0A\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ puts(int /*<<< orphan*/);
int /*<<< orphan*/ str2array(char *);
int /*<<< orphan*/ test(char *);
int main() {
  char *foo = "This is a test";
  str2array(foo);
  char bar[10] = "Test";
  puts(test(bar));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <str2array@plt>
mov    0xeb5(%rip),%rax
mov    %rax,-0x1a(%rbp)
mov    0xeb2(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x1a(%rbp),%rdi
call   1050 <test@plt>
mov    %eax,%edi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
call   1040 <str2array@plt>
movw   $0x0,0x10(%rsp)
movq   $0x74736554,0x8(%rsp)
73 74
lea    0x8(%rsp),%rdi
call   1050 <test@plt>
mov    %eax,%edi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"This is a test\00"
@__const.main.bar = [10 x i8] c"Test\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [10 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @str2array(i8* %4)
%6 = bitcast [10 x i8]* %3 to i8*
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%8 = call i32 @test(i8* %7)
%9 = call i32 @puts(i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"This is a test\00"
@__const.main.bar = [10 x i8] c"Test\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = tail call i32 @str2array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @test(i8* %3)
%5 = call i32 @puts(i32 %4)
ret i32 0
}
double al(double a) { return (1 / (a + 1) + 2 / (a + 2) + 3 / (a + 3)); }


x86 assembly (clang, -O0):
<al>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
movsd  0xef2(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm2
addsd  -0x8(%rbp),%xmm2
movsd  0xed1(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xeb9(%rip),%xmm2
addsd  -0x8(%rbp),%xmm2
movsd  0xeac(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<al>:
movsd  0xef8(%rip),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm1
unpcklpd %xmm0,%xmm0
movapd 0xef0(%rip),%xmm2
addpd  %xmm2,%xmm0
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @al(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
%6 = load double, double* %2
%7 = fadd double %6, 2.000000e+00
%8 = fdiv double 2.000000e+00, %7
%9 = fadd double %5, %8
%10 = load double, double* %2
%11 = fadd double %10, 3.000000e+00
%12 = fdiv double 3.000000e+00, %11
%13 = fadd double %9, %12
ret double %13
}

LLVM IR (-O2):
define double @al(double %0) {
%2 = fadd double %0, 2.000000e+00
%3 = fdiv double 2.000000e+00, %2
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> zeroinitializer
%6 = fadd <2 x double> %5, <double 3.000000e+00, double 1.000000e+00>
%7 = fdiv <2 x double> <double 3.000000e+00, double 1.000000e+00>, %6
%8 = extractelement <2 x double> %7, i64 1
%9 = fadd double %8, %3
%10 = extractelement <2 x double> %7, i64 0
%11 = fadd double %10, %9
ret double %11
}
unsigned char f3(unsigned char x, int y) {
  x = x | (unsigned char)(y & 255);
  return x;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
movzbl %cl,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
mov    %edi,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f3(i8 zeroext %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 = zext i8 %5 to i32
%7 = load i32, i32* %4
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = zext i8 %9 to i32
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i8
store i8 %12, i8* %3
%13 = load i8, i8* %3
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @f3(i8 zeroext %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = or i8 %3, %0
ret i8 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void le16_to_cpus(uint16_t *p) {}


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

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

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

LLVM IR (-O2):
define void @le16_to_cpus(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
main() {
  signed int a = -1;
  unsigned int b = 2;
  signed short c = -1;
  unsigned short d = 2;
  if (a > b) {
  } else if (a < b) {
    abort();
  } else {
    abort();
  }
  if (c > d) {
    abort();
  } else if (c < d) {
  } else {
    abort();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movw   $0xffff,-0xe(%rbp)
movw   $0x2,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jbe    114a <main+0x3a>
jmp    1164 <main+0x54>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    115d <main+0x4d>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1030 <abort@plt>
movswl -0xe(%rbp),%eax
movzwl -0x10(%rbp),%ecx
cmp    %ecx,%eax
jle    117b <main+0x6b>
mov    $0x0,%al
call   1030 <abort@plt>
movswl -0xe(%rbp),%eax
movzwl -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1190 <main+0x80>
jmp    1197 <main+0x87>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    119c <main+0x8c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i16
%5 = alloca i16
store i32 0, i32* %1
store i32 -1, i32* %2
store i32 2, i32* %3
store i16 -1, i16* %4
store i16 2, i16* %5
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = icmp ugt i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %0
br label %18
10: ; preds = %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %10
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %9
%19 = load i16, i16* %4
%20 = sext i16 %19 to i32
%21 = load i16, i16* %5
%22 = zext i16 %21 to i32
%23 = icmp sgt i32 %20, %22
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 (...) @abort()
unreachable
26: ; preds = %18
%27 = load i16, i16* %4
%28 = sext i16 %27 to i32
%29 = load i16, i16* %5
%30 = zext i16 %29 to i32
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %26
br label %35
33: ; preds = %26
%34 = call i32 (...) @abort()
unreachable
35: ; preds = %32
br label %36
36: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int dep(int /*<<< orphan*/, int *);
int /*<<< orphan*/ strlen(char const *);
int fun(const char *str) {
  int out;
  int r = dep(strlen(str), &out);
  return 2 * out + r;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edi
lea    -0xc(%rbp),%rsi
call   1040 <dep@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rax
call   1030 <strlen@plt>
lea    0x4(%rsp),%rsi
mov    %eax,%edi
call   1040 <dep@plt>
mov    0x4(%rsp),%ecx
lea    (%rax,%rcx,2),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fun(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @dep(i32 %6, i32* %3)
store i32 %7, i32* %4
%8 = load i32, i32* %3
%9 = mul nsw i32 2, %8
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @fun(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @strlen(i8* %0)
%5 = call i32 @dep(i32 %4, i32* %2)
%6 = load i32, i32* %2
%7 = shl nsw i32 %6, 1
%8 = add nsw i32 %7, %5
ret i32 %8
}
unsigned invert(unsigned x, int p, int n) {
  return ((x >> (p + 1 - n)) & ~(~0 << n)) ^ ~(~0 << n);
}


x86 assembly (clang, -O0):
<invert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert>:
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shr    %cl,%edi
mov    $0xffffffff,%eax
mov    %edx,%ecx
shl    %cl,%eax
or     %edi,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @invert(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %8, 1
%10 = load i32, i32* %6
%11 = sub nsw i32 %9, %10
%12 = lshr i32 %7, %11
%13 = load i32, i32* %6
%14 = shl i32 -1, %13
%15 = xor i32 %14, -1
%16 = and i32 %12, %15
%17 = load i32, i32* %6
%18 = shl i32 -1, %17
%19 = xor i32 %18, -1
%20 = xor i32 %16, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @invert(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, 1
%5 = sub i32 %4, %2
%6 = lshr i32 %0, %5
%7 = shl nsw i32 -1, %2
%8 = or i32 %6, %7
%9 = xor i32 %8, -1
ret i32 %9
}
/* Variables and functions */
double *malloc(int);
double *loglik_test() {
  double *loglik = malloc(2 * sizeof(double));
  loglik[1] = 34;
  loglik[0] = loglik[1];
  return loglik;
}


x86 assembly (clang, -O0):
<loglik_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xece(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loglik_test>:
push   %rax
mov    $0x10,%edi
call   1030 <malloc@plt>
movaps 0xede(%rip),%xmm0
movups %xmm0,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define double* @loglik_test() {
%1 = alloca double*
%2 = call double* @malloc(i32 16)
store double* %2, double** %1
%3 = load double*, double** %1
%4 = getelementptr inbounds double, double* %3, i64 1
store double 3.400000e+01, double* %4
%5 = load double*, double** %1
%6 = getelementptr inbounds double, double* %5, i64 1
%7 = load double, double* %6
%8 = load double*, double** %1
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %1
ret double* %10
}

LLVM IR (-O2):
define noalias double* @loglik_test() {
%1 = tail call double* @malloc(i32 16)
%2 = bitcast double* %1 to <2 x double>*
store <2 x double> <double 3.400000e+01, double 3.400000e+01>, <2 x double>* %2
ret double* %1
}
/* Variables and functions */
int /*<<< orphan*/ piece(char *, char, char *, int /*<<< orphan*/);
char *strdup(char *);
char *spreadsheet_datatype_label(char *spreadsheet_header_label) {
  char datatype_label[256];
  if (!spreadsheet_header_label || !*spreadsheet_header_label)
    return (char *)0;
  piece(datatype_label, '(', spreadsheet_header_label, 0);
  return strdup(datatype_label);
}


x86 assembly (clang, -O0):
<spreadsheet_datatype_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1147 <spreadsheet_datatype_label+0x27>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1154 <spreadsheet_datatype_label+0x34>
movq   $0x0,-0x8(%rbp)
jmp    117b <spreadsheet_datatype_label+0x5b>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x28,%esi
xor    %ecx,%ecx
call   1030 <piece@plt>
lea    -0x110(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spreadsheet_datatype_label>:
push   %rbx
sub    $0x100,%rsp
test   %rdi,%rdi
je     1151 <spreadsheet_datatype_label+0x31>
mov    %rdi,%rdx
cmpb   $0x0,(%rdi)
je     1151 <spreadsheet_datatype_label+0x31>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
xor    %ecx,%ecx
call   1030 <piece@plt>
mov    %rbx,%rdi
call   1040 <strdup@plt>
jmp    1153 <spreadsheet_datatype_label+0x33>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @spreadsheet_datatype_label(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = call i32 @piece(i8* %3, i8 signext 40, i8* %0, i32 0)
%10 = call i8* @strdup(i8* %3)
br label %11
11: ; preds = %1, %5, %8
%12 = phi i8* [ %10, %8 ], [ null, %5 ], [ null, %1 ]
ret i8* %12
}