xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ disabled_wait();
int /*<<< orphan*/ sclp_print(char const *);
void virtio_panic(const char *string) {
  sclp_print(string);
  disabled_wait();
  while (1) {
  }
}


x86 assembly (clang, -O0):
<virtio_panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sclp_print@plt>
mov    $0x0,%al
call   1030 <disabled_wait@plt>
jmp    113c <virtio_panic+0x1c>

x86 assembly (clang, -O2):
<virtio_panic>:
push   %rax
call   1040 <sclp_print@plt>
xor    %eax,%eax
call   1030 <disabled_wait@plt>
nopl   (%rax)
jmp    1130 <virtio_panic+0x10>

LLVM IR (-O0):
define void @virtio_panic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sclp_print(i8* %3)
%5 = call i32 (...) @disabled_wait()
br label %6
6: ; preds = %1, %6
br label %6
}

LLVM IR (-O2):
define void @virtio_panic(i8* %0) {
%2 = tail call i32 @sclp_print(i8* %0)
%3 = tail call i32 (...) @disabled_wait()
br label %4
4: ; preds = %1, %4
br label %4
}
/* Type definitions */
struct rbtree {
  int dummy;
};
struct rbnode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rbtree_insert3(struct rbtree *, struct rbnode *,
                                  int /*<<< orphan*/);
void rbtree_insert(struct rbtree *rbtree, struct rbnode *data) {
  rbtree_insert3(rbtree, data, 0);
}


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

x86 assembly (clang, -O2):
<rbtree_insert>:
xor    %edx,%edx
jmp    1030 <rbtree_insert3@plt>

LLVM IR (-O0):
%struct.rbtree = type { i32 }
%struct.rbnode = type { i32 }
define void @rbtree_insert(%struct.rbtree* %0, %struct.rbnode* %1) {
%3 = alloca %struct.rbtree*
%4 = alloca %struct.rbnode*
store %struct.rbtree* %0, %struct.rbtree** %3
store %struct.rbnode* %1, %struct.rbnode** %4
%5 = load %struct.rbtree*, %struct.rbtree** %3
%6 = load %struct.rbnode*, %struct.rbnode** %4
%7 = call i32 @rbtree_insert3(%struct.rbtree* %5, %struct.rbnode* %6, i32 0)
ret void
}

LLVM IR (-O2):
%struct.rbtree = type { i32 }
%struct.rbnode = type { i32 }
define void @rbtree_insert(%struct.rbtree* %0, %struct.rbnode* %1) {
%3 = tail call i32 @rbtree_insert3(%struct.rbtree* %0, %struct.rbnode* %1, i32 0)
ret void
}
indreg0regx1_set(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{ (*p0) = (p1[x1]); }


x86 assembly (clang, -O0):
<indreg0regx1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0regx1_set>:
movslq %ecx,%rax
mov    (%r9,%rax,4),%eax
mov    %eax,(%r8)
ret

LLVM IR (-O0):
define i32 @indreg0regx1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32*, i32** %13
%15 = load i32, i32* %11
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32*, i32** %12
store i32 %18, i32* %19
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @indreg0regx1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4, i32* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %4
ret i32 undef
}
int intcmp(const void *_a, const void *_b) {
  int a = *((int *)_a), b = *((int *)_b);
  if (a < b)
    return -1;
  else if (a == b)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<intcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <intcmp+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <intcmp+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    114e <intcmp+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <intcmp+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcmp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @intcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
store i32 %10, i32* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %3
br label %24
23: ; preds = %18
store i32 1, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @intcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void default_io_handler(void) {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<default_io_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <default_io_handler+0x9>
jmp    1109 <default_io_handler+0x9>

x86 assembly (clang, -O2):
<default_io_handler>:
jmp    1100 <default_io_handler>

LLVM IR (-O0):
define void @default_io_handler() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @default_io_handler() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ clock_t;

/* Variables and functions */
int /*<<< orphan*/ clock();
void lprofC_start_timer(clock_t *time_marker) { *time_marker = clock(); }


x86 assembly (clang, -O0):
<lprofC_start_timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lprofC_start_timer>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @lprofC_start_timer(i32* nocapture writeonly %0) {
%2 = tail call i32 (...) @clock()
store i32 %2, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ check_table();
int main(void) {
  check_table();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @check_table()
ret i32 0
}
void mod_brute_is_dlclose_safe() {}


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

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

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

LLVM IR (-O2):
define void @mod_brute_is_dlclose_safe() {
ret void
}
int test_imm_53int8_reg(signed char val) {
  return ((val) & (-0x53 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_53int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffad,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_53int8_reg>:
test   $0xad,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_53int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -83
%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_53int8_reg(i8 signext %0) {
%2 = and i8 %0, -83
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int pool_waitIdle(struct _WsbmBufStorage *buf, int lazy) { return 0; }


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

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

LLVM IR (-O0):
%struct._WsbmBufStorage = type opaque
define i32 @pool_waitIdle(%struct._WsbmBufStorage* %0, i32 %1) {
%3 = alloca %struct._WsbmBufStorage*
%4 = alloca i32
store %struct._WsbmBufStorage* %0, %struct._WsbmBufStorage** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct._WsbmBufStorage = type opaque
define i32 @pool_waitIdle(%struct._WsbmBufStorage* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *xcalloc(size_t nmemb, size_t size) {
  void *ptr = calloc(nmemb, size);
  if (ptr)
    return ptr;
  fprintf(stderr, "out of memory\n");
  exit(1);
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1166 <xcalloc+0x36>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<xcalloc>:
push   %rax
call   1030 <calloc@plt>
test   %rax,%rax
je     113d <xcalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i8*, i8** %5
ret i8* %12
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %2
ret i8* %3
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int write_string_file_atomic_label_ts(char const *, char const *,
                                      int /*<<< orphan*/ *);
int write_string_file_atomic_label(const char *fn, const char *line) {
  return write_string_file_atomic_label_ts(fn, line, NULL);
}


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

x86 assembly (clang, -O2):
<write_string_file_atomic_label>:
xor    %edx,%edx
jmp    1030 <write_string_file_atomic_label_ts@plt>

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

LLVM IR (-O2):
define i32 @write_string_file_atomic_label(i8* %0, i8* %1) {
%3 = tail call i32 @write_string_file_atomic_label_ts(i8* %0, i8* %1, i32* null)
ret i32 %3
}
void RTjpeg_dct_init(void) {}


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

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

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

LLVM IR (-O2):
define void @RTjpeg_dct_init() {
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ lsh_loop();
int main(int argc, char **argv) {
  lsh_loop();
  return EXIT_SUCCESS;
}


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

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

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @lsh_loop()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint64_t dspd_src_get_frame_count(uint64_t rate_in, uint64_t rate_out,
                                  uint64_t frames_in) {
  uint32_t iper = 1000000000 / rate_in;
  uint32_t oper = 1000000000 / rate_out;
  uint32_t ret, t;
  t = frames_in * iper;
  ret = t / oper;
  if (t % oper)
    ret++;
  return ret;
}


x86 assembly (clang, -O0):
<dspd_src_get_frame_count>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x3b9aca00,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x10(%rbp)
mov    $0x3b9aca00,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
je     1152 <dspd_src_get_frame_count+0x52>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dspd_src_get_frame_count>:
mov    %edx,%ecx
mov    $0x3b9aca00,%eax
xor    %edx,%edx
idiv   %edi
mov    %eax,%edi
mov    $0x3b9aca00,%eax
xor    %edx,%edx
idiv   %esi
mov    %eax,%esi
imul   %ecx,%edi
mov    %edi,%eax
cltd
idiv   %esi
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @dspd_src_get_frame_count(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %4
%12 = sdiv i32 1000000000, %11
store i32 %12, i32* %7
%13 = load i32, i32* %5
%14 = sdiv i32 1000000000, %13
store i32 %14, i32* %8
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %10
%18 = load i32, i32* %10
%19 = load i32, i32* %8
%20 = sdiv i32 %18, %19
store i32 %20, i32* %9
%21 = load i32, i32* %10
%22 = load i32, i32* %8
%23 = srem i32 %21, %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %3
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %28
28: ; preds = %25, %3
%29 = load i32, i32* %9
ret i32 %29
}

LLVM IR (-O2):
define i32 @dspd_src_get_frame_count(i32 %0, i32 %1, i32 %2) {
%4 = sdiv i32 1000000000, %0
%5 = sdiv i32 1000000000, %1
%6 = mul nsw i32 %4, %2
%7 = sdiv i32 %6, %5
%8 = srem i32 %6, %5
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
%11 = add nsw i32 %7, %10
ret i32 %11
}
/* Variables and functions */
scalar_t__ lrand48();
int gen_number(int range) { return (int)lrand48() % range; }


x86 assembly (clang, -O0):
<gen_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <lrand48@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_number>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <lrand48@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @gen_number(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @lrand48()
%4 = trunc i64 %3 to i32
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @gen_number(i32 %0) {
%2 = tail call i64 (...) @lrand48()
%3 = trunc i64 %2 to i32
%4 = srem i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int read(int, void *, int);
int fd_read(int fd, void *buffer, int count) { return read(fd, buffer, count); }


x86 assembly (clang, -O0):
<fd_read>:
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>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_read>:
jmp    1030 <read@plt>

LLVM IR (-O0):
define i32 @fd_read(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 i32 @read(i32 %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @fd_read(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
char *strchr(char *, char);
char *var_find(char *str) { return strchr(str, '$'); }


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

x86 assembly (clang, -O2):
<var_find>:
mov    $0x24,%esi
jmp    1030 <strchr@plt>

LLVM IR (-O0):
define i8* @var_find(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strchr(i8* %3, i8 signext 36)
ret i8* %4
}

LLVM IR (-O2):
define i8* @var_find(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 36)
ret i8* %2
}
void main(void) {
  int x;
  int y;
  int w;
  w = x + y - 10 / 2;
}


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

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
void UART5_IRQHandler(void) {}


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

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

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

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

/* Variables and functions */
int addArray(int *, int);
int /*<<< orphan*/ printf(char *, int);
main() {
  int data[] = {4, 3, 2, 1, 0, 5, 6, 7, 8, 9};
  int size = sizeof(data) / sizeof(data[0]);
  printf("sum is %d\n", addArray(data, size));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <addArray@plt>
mov    %eax,%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <addArray@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.data = [10 x i32] [i32 4, i32 3, i32 2, i32 1, i32 0, i32 5, i32 6, i32 7, i32 8, i32 9]
@.str = [11 x i8] c"sum is %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @addArray(i32* %3, i32 10)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ IntDisable(scalar_t__);
int /*<<< orphan*/ IntUnregister(scalar_t__);
scalar_t__ _SysExcIntNumberGet();
void SysExcIntUnregister(void) {
  uint32_t ui32Int;
  ui32Int = _SysExcIntNumberGet();
  ASSERT(ui32Int != 0);
  IntDisable(ui32Int);
  IntUnregister(ui32Int);
}


x86 assembly (clang, -O0):
<SysExcIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <_SysExcIntNumberGet@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <ASSERT@plt>
mov    -0x8(%rbp),%rdi
call   1040 <IntDisable@plt>
mov    -0x8(%rbp),%rdi
call   1060 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysExcIntUnregister>:
push   %rbx
xor    %eax,%eax
call   1030 <_SysExcIntNumberGet@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <ASSERT@plt>
mov    %rbx,%rdi
call   1040 <IntDisable@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <IntUnregister@plt>

LLVM IR (-O0):
define void @SysExcIntUnregister() {
%1 = alloca i64
%2 = call i64 (...) @_SysExcIntNumberGet()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i64, i64* %1
%8 = call i32 @IntDisable(i64 %7)
%9 = load i64, i64* %1
%10 = call i32 @IntUnregister(i64 %9)
ret void
}

LLVM IR (-O2):
define void @SysExcIntUnregister() {
%1 = tail call i64 (...) @_SysExcIntNumberGet()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = tail call i32 @IntDisable(i64 %1)
%6 = tail call i32 @IntUnregister(i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(int *src, unsigned len) {
  unsigned i = 0;
  for (; i < len; ++i) {
    printf("%d ", src[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
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
jae    1158 <print_array+0x48>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1157 <print_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_array+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 \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_array(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 = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_array(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ vwprintf(int /*<<< orphan*/ *, int /*<<< orphan*/);
void uninitvar_vwprintf(wchar_t *Format, va_list Arg) {
  wchar_t *format;
  va_list arg;
  (void)vwprintf(format, arg);
  (void)vwprintf(format, Arg);
  (void)vwprintf(Format, Arg);
  (void)vwprintf(Format, arg);
}


x86 assembly (clang, -O0):
<uninitvar_vwprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <vwprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <vwprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <vwprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <vwprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_vwprintf>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
call   1030 <vwprintf@plt>
mov    %ebx,%esi
call   1030 <vwprintf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <vwprintf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <vwprintf@plt>

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

LLVM IR (-O2):
define void @uninitvar_vwprintf(i32* %0, i32 %1) {
%3 = tail call i32 @vwprintf(i32* undef, i32 undef)
%4 = tail call i32 @vwprintf(i32* undef, i32 %1)
%5 = tail call i32 @vwprintf(i32* %0, i32 %1)
%6 = tail call i32 @vwprintf(i32* %0, i32 undef)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *memcpy(void *, void const *, size_t);
void *memdup(const void *buf, size_t size) {
  void *new_buf = malloc(size);
  return memcpy(new_buf, buf, size);
}


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

x86 assembly (clang, -O2):
<memdup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define i8* @memdup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @memdup(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 %0, i64 %1, i1 false)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ Elf32_Addr;

/* Variables and functions */
Elf32_Addr elf_machine_dynamic(void) {
  register Elf32_Addr *got __asm__("%ebx");
  return *got;
}


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

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

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

LLVM IR (-O2):
define i32 @elf_machine_dynamic() {
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t crc32_init(void) { return 0xffffffff; }


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

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

LLVM IR (-O0):
define i32 @crc32_init() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @crc32_init() {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, void const *, size_t);
uint8_t *format_bytes(uint8_t *restrict buffer, const void *restrict bytes,
                      size_t size) {
  memcpy(buffer, bytes, size);
  return buffer + size;
}


x86 assembly (clang, -O0):
<format_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_bytes>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <memcpy@plt>
lea    (%rbx,%r14,4),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @format_bytes(i32* noalias %0, i8* noalias %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @memcpy(i32* %7, i8* %8, i64 %9)
%11 = load i32*, i32** %4
%12 = load i64, i64* %6
%13 = getelementptr inbounds i32, i32* %11, i64 %12
ret i32* %13
}

LLVM IR (-O2):
define i32* @format_bytes(i32* noalias %0, i8* noalias %1, i64 %2) {
%4 = tail call i32 @memcpy(i32* %0, i8* %1, i64 %2)
%5 = getelementptr inbounds i32, i32* %0, i64 %2
ret i32* %5
}
double mypow(double x, double y) { return x * y; }


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

x86 assembly (clang, -O2):
<mypow>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @mypow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @mypow(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
int maximum(int x, int y, int z) {
  int max = x;
  if (y > max) {
    max = y;
  }
  if (z > max) {
    max = z;
  }
  return max;
}


x86 assembly (clang, -O0):
<maximum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1125 <maximum+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1137 <maximum+0x37>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maximum>:
mov    %edi,%eax
cmp    %edi,%esi
cmovg  %esi,%eax
cmp    %edx,%eax
cmovl  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @maximum(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, %0
%5 = select i1 %4, i32 %1, i32 %0
%6 = icmp slt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
/* Variables and functions */
char *__st_strtok_r(char *, char const *, char **);
char *st_strtok_r(char *s, const char *delim, char **s2) {
  return __st_strtok_r(s, delim, s2);
}


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

x86 assembly (clang, -O2):
<st_strtok_r>:
jmp    1030 <__st_strtok_r@plt>

LLVM IR (-O0):
define i8* @st_strtok_r(i8* %0, i8* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8**, i8*** %6
%10 = call i8* @__st_strtok_r(i8* %7, i8* %8, i8** %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @st_strtok_r(i8* %0, i8* %1, i8** %2) {
%4 = tail call i8* @__st_strtok_r(i8* %0, i8* %1, i8** %2)
ret i8* %4
}
void gdk_query_depths() {}


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

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

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

LLVM IR (-O2):
define void @gdk_query_depths() {
ret void
}
__attribute__((__unused__)) int PyMPI_UNAVAILABLE(const char *name, ...) {
  return -1;
}


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

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

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

LLVM IR (-O2):
define i32 @PyMPI_UNAVAILABLE(i8* nocapture readnone %0, ...) {
ret i32 -1
}
void _wait_twb(void) {}


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

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

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

LLVM IR (-O2):
define void @_wait_twb() {
ret void
}
int dev_param_set_generic(struct device_d *dev, struct param_d *p,
                          const char *val) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.device_d = type opaque
%struct.param_d = type opaque
define i32 @dev_param_set_generic(%struct.device_d* nocapture readnone %0, %struct.param_d* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ HplAtm128Timer3P__CompareC__default__fired();
void HplAtm128Timer3P__CompareC__fired(void) {
  HplAtm128Timer3P__CompareC__default__fired();
}


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

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

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

LLVM IR (-O2):
define void @HplAtm128Timer3P__CompareC__fired() {
%1 = tail call i32 (...) @HplAtm128Timer3P__CompareC__default__fired()
ret void
}
void halt() {
  for (;;)
    __asm__("hlt");
}


x86 assembly (clang, -O0):
<halt>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <halt+0x9>
hlt
jmp    1109 <halt+0x9>

x86 assembly (clang, -O2):
<halt>:
hlt
jmp    1100 <halt>

LLVM IR (-O0):
define void @halt() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @halt() {
br label %1
1: ; preds = %1, %0
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
br label %1
}
void f1(int *x) {
  int i;
#pragma omp simd
  for (i = 0; i < 100; i++)
#pragma omp ordered simd
    x[i / 2] = i;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    114f <f1+0x4f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <f1+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    $0x4,%eax
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x4(%rax),%ecx
mov    %ecx,%edx
shr    %edx
mov    %ecx,(%rdi,%rdx,4)
lea    -0x3(%rax),%ecx
mov    %ecx,%edx
shr    %edx
mov    %ecx,(%rdi,%rdx,4)
lea    -0x2(%rax),%ecx
mov    %ecx,%edx
shr    %edx
mov    %ecx,(%rdi,%rdx,4)
lea    -0x1(%rax),%ecx
mov    %ecx,%edx
shr    %edx
mov    %ecx,(%rdi,%rdx,4)
mov    %eax,%ecx
shr    %ecx
mov    %eax,(%rdi,%rcx,4)
lea    0x5(%rax),%ecx
cmp    $0x63,%eax
mov    %ecx,%eax
jne    1110 <f1+0x10>
ret

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

LLVM IR (-O2):
define void @f1(i32* nocapture writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %23, %2 ]
%4 = lshr i32 %3, 1
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 %3, i32* %6
%7 = add nuw nsw i32 %3, 1
%8 = lshr i32 %7, 1
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %7, i32* %10
%11 = add nuw nsw i32 %3, 2
%12 = lshr i32 %11, 1
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
store i32 %11, i32* %14
%15 = add nuw nsw i32 %3, 3
%16 = lshr i32 %15, 1
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %0, i64 %17
store i32 %15, i32* %18
%19 = add nuw nsw i32 %3, 4
%20 = lshr i32 %19, 1
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %0, i64 %21
store i32 %19, i32* %22
%23 = add nuw nsw i32 %3, 5
%24 = icmp eq i32 %23, 100
br i1 %24, label %25, label %2
25: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ envcpy(char *, char const *, char const *, char const *);
int envlen(char const *, char const *, char const *);
scalar_t__ malloc(int);
char *env_new(const char *env_var, const char *home_dir, const char *file) {
  char *env_string;
  env_string =
      (char *)malloc((envlen(env_var, home_dir, file) + 1) * sizeof(char));
  ;
  envcpy(env_string, env_var, home_dir, file);
  return (env_string);
}


x86 assembly (clang, -O0):
<env_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <envlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1040 <envcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<env_new>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
call   1030 <envlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <envcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @env_new(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @envlen(i8* %8, i8* %9, i8* %10)
%12 = add nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 1
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %7
%18 = load i8*, i8** %7
%19 = load i8*, i8** %4
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = call i32 @envcpy(i8* %18, i8* %19, i8* %20, i8* %21)
%23 = load i8*, i8** %7
ret i8* %23
}

LLVM IR (-O2):
define i8* @env_new(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @envlen(i8* %0, i8* %1, i8* %2)
%5 = add nsw i32 %4, 1
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @envcpy(i8* %7, i8* %0, i8* %1, i8* %2)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ TiniWait(char);
char TiniWrite(char *, int);
int TiniWriteAndWait(char *buffer, int n, char promptChar) {
  char bytes = TiniWrite(buffer, n);
  TiniWait(promptChar);
  return bytes;
}


x86 assembly (clang, -O0):
<TiniWriteAndWait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <TiniWrite@plt>
mov    %al,-0xe(%rbp)
movsbl -0xd(%rbp),%edi
call   1030 <TiniWait@plt>
movsbl -0xe(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TiniWriteAndWait>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
call   1040 <TiniWrite@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <TiniWait@plt>
movsbl %bl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @TiniWriteAndWait(i8* %0, i32 %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call signext i8 @TiniWrite(i8* %8, i32 %9)
store i8 %10, i8* %7
%11 = load i8, i8* %6
%12 = call i32 @TiniWait(i8 signext %11)
%13 = load i8, i8* %7
%14 = sext i8 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @TiniWriteAndWait(i8* %0, i32 %1, i8 signext %2) {
%4 = tail call signext i8 @TiniWrite(i8* %0, i32 %1)
%5 = tail call i32 @TiniWait(i8 signext %2)
%6 = sext i8 %4 to i32
ret i32 %6
}
int read_through_null(void) { return *(int *)0; }


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

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

LLVM IR (-O0):
define i32 @read_through_null() {
%1 = load i32, i32* null
ret i32 %1
}

LLVM IR (-O2):
define i32 @read_through_null() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint32_t;

/* Variables and functions */
uint32_t load32(const void *src) { return *(const uint32_t *)(src); }


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

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

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

LLVM IR (-O2):
define i32 @load32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
void foo61() {}


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

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

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

LLVM IR (-O2):
define void @foo61() {
ret void
}