xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_shortest_path(int *predecessor, int dest) {
  if (predecessor[dest] != -1)
    print_shortest_path(predecessor, predecessor[dest]);
  printf("-> %d ", dest);
}


x86 assembly (clang, -O0):
<print_shortest_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1155 <print_shortest_path+0x35>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1040 <print_shortest_path@plt>
mov    -0xc(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_shortest_path>:
push   %rbx
mov    %esi,%ebx
movslq %esi,%rax
mov    (%rdi,%rax,4),%esi
cmp    $0xffffffff,%esi
je     1133 <print_shortest_path+0x13>
call   1040 <print_shortest_path@plt>
lea    0xec6(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"-> %d \00"
define void @print_shortest_path(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32*, i32** %3
%13 = load i32*, i32** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
br label %18
18: ; preds = %11, %2
%19 = load i32, i32* %4
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"-> %d \00"
define void @print_shortest_path(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, -1
br i1 %6, label %8, label %7
7: ; preds = %2
tail call void @print_shortest_path(i32* %0, i32 %5)
br label %8
8: ; preds = %7, %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
void g_file_open_tmp() {}


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

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

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

LLVM IR (-O2):
define void @g_file_open_tmp() {
ret void
}
void unused_isr(void) {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define void @unused_isr() {
br label %1
1: ; preds = %0, %1
br label %1
}
int minusOne(void) {
  int x = 0;
  return --x;
}


x86 assembly (clang, -O0):
<minusOne>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @minusOne() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ hello_en();
int /*<<< orphan*/ hello_pl();
int /*<<< orphan*/ linux_en();
int /*<<< orphan*/ linux_pl();
int main(void) {
  hello_pl();
  hello_en();
  linux_pl();
  linux_en();
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <hello_pl@plt>
xor    %eax,%eax
call   1030 <hello_en@plt>
xor    %eax,%eax
call   1060 <linux_pl@plt>
xor    %eax,%eax
call   1050 <linux_en@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @hello_pl()
%3 = call i32 (...) @hello_en()
%4 = call i32 (...) @linux_pl()
%5 = call i32 (...) @linux_en()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @hello_pl()
%2 = tail call i32 (...) @hello_en()
%3 = tail call i32 (...) @linux_pl()
%4 = tail call i32 (...) @linux_en()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int ftrylockfile(FILE *stream) {
  (void)stream;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @ftrylockfile(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ PrintTemp(int, int, float, int);
void Temp_Wait(float Temp) { PrintTemp(1, 1, Temp, 2); }


x86 assembly (clang, -O0):
<Temp_Wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x1,%esi
mov    $0x2,%edx
mov    %esi,%edi
call   1030 <PrintTemp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Temp_Wait>:
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x2,%edx
jmp    1030 <PrintTemp@plt>

LLVM IR (-O0):
define void @Temp_Wait(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @PrintTemp(i32 1, i32 1, float %3, i32 2)
ret void
}

LLVM IR (-O2):
define void @Temp_Wait(float %0) {
%2 = tail call i32 @PrintTemp(i32 1, i32 1, float %0, i32 2)
ret void
}
void free_convert_matrix(b, nrl, nrh, ncl, nch) float **b;
int nrl, nrh, ncl, nch;
{
  if (nrh + ncl + nch)
    nch = nch;
  free((char *)(b + nrl));
}


x86 assembly (clang, -O0):
<free_convert_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cmp    $0x0,%eax
je     1141 <free_convert_matrix+0x31>
mov    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_convert_matrix>:
movslq %esi,%rax
lea    (%rdi,%rax,8),%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_convert_matrix(float** %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca float**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store float** %0, float*** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %8
%12 = load i32, i32* %9
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %10
%15 = add nsw i32 %13, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %5
%18 = load i32, i32* %10
store i32 %18, i32* %10
br label %19
19: ; preds = %17, %5
%20 = load float**, float*** %6
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float*, float** %20, i64 %22
%24 = bitcast float** %23 to i8*
ret void
}

LLVM IR (-O2):
define void @free_convert_matrix(float** nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds float*, float** %0, i64 %6
%8 = bitcast float** %7 to i8*
tail call void @free(i8* %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
off_t _lseek(int32_t fd, off_t offset, int32_t dir) { return 0; }


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

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

LLVM IR (-O0):
define i32 @_lseek(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
ret i32 0
}

LLVM IR (-O2):
define i32 @_lseek(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
extern void primFreeBSTR(void *p) {}


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

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

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

LLVM IR (-O2):
define void @primFreeBSTR(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NoDepY_func();
void NoDepX_func() { NoDepY_func(); }


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

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

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

LLVM IR (-O2):
define void @NoDepX_func() {
%1 = tail call i32 (...) @NoDepY_func()
ret void
}
/* Type definitions */
struct rb_table {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void *rb_delete(struct rb_table *, void const *);
const void *(rb_assert_delete)(struct rb_table *table, const void *item) {
  const void *p = rb_delete(table, item);
  assert(p != NULL);
  return p;
}


x86 assembly (clang, -O0):
<rb_assert_delete>:
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   1040 <rb_delete@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rb_assert_delete>:
push   %rbx
call   1040 <rb_delete@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.rb_table = type { i32 }
define i8* @rb_assert_delete(%struct.rb_table* %0, i8* %1) {
%3 = alloca %struct.rb_table*
%4 = alloca i8*
%5 = alloca i8*
store %struct.rb_table* %0, %struct.rb_table** %3
store i8* %1, i8** %4
%6 = load %struct.rb_table*, %struct.rb_table** %3
%7 = load i8*, i8** %4
%8 = call i8* @rb_delete(%struct.rb_table* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
%struct.rb_table = type { i32 }
define i8* @rb_assert_delete(%struct.rb_table* %0, i8* %1) {
%3 = tail call i8* @rb_delete(%struct.rb_table* %0, i8* %1)
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret i8* %3
}
void g_main_context_release() {}


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

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

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

LLVM IR (-O2):
define void @g_main_context_release() {
ret void
}
void unsigned_char_shl_signed_char_signed_char(unsigned char *LHS,
                                               signed char RHS) {
  (*LHS) <<= RHS;
}


x86 assembly (clang, -O0):
<unsigned_char_shl_signed_char_signed_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
shl    %cl,%edx
mov    %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_char_shl_signed_char_signed_char>:
mov    %esi,%ecx
movzbl (%rdi),%eax
shl    %cl,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @unsigned_char_shl_signed_char_signed_char(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl i32 %9, %6
%11 = trunc i32 %10 to i8
store i8 %11, i8* %7
ret void
}

LLVM IR (-O2):
define void @unsigned_char_shl_signed_char_signed_char(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = zext i8 %1 to i32
%6 = shl i32 %4, %5
%7 = trunc i32 %6 to i8
store i8 %7, i8* %0
ret void
}
int longitud_string_vieja(char s[]) {
  int i;
  i = 0;
  while (s[i] != '\0')
    i++;
  return i;
}


x86 assembly (clang, -O0):
<longitud_string_vieja>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <longitud_string_vieja+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <longitud_string_vieja+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<longitud_string_vieja>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <longitud_string_vieja+0x10>
ret

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

LLVM IR (-O2):
define i32 @longitud_string_vieja(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Type definitions */
struct timeval {
  long tv_usec;
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long current_time_usec(void) {
  struct timeval t;
  gettimeofday(&t, NULL);
  return t.tv_usec + t.tv_sec * 1000000;
}


x86 assembly (clang, -O0):
<current_time_usec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x10(%rbp),%rax
imul   $0xf4240,-0x8(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_time_usec>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x10(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x8(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i32 }
define i64 @current_time_usec() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000000
%8 = sext i32 %7 to i64
%9 = add nsw i64 %4, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
define i64 @current_time_usec() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000
%9 = sext i32 %8 to i64
%10 = add nsw i64 %5, %9
ret i64 %10
}
void default_mpgdecoder_close(void *ctx) {}


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

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

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

LLVM IR (-O2):
define void @default_mpgdecoder_close(i8* nocapture %0) {
ret void
}
int echo_no(string, flag)
char *string[];
long *flag;
{
  *flag = 1L;
  return (1);
}


x86 assembly (clang, -O0):
<echo_no>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x1,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @echo_no(i8** nocapture readnone %0, i64* nocapture writeonly %1) {
store i64 1, i64* %1
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void myexit(int code) { exit(code); }


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

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

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

LLVM IR (-O2):
define void @myexit(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
void RandomFunc(unsigned char input[1], unsigned char output[1]) {
  unsigned char state[1];
  unsigned char local1;
  {
    state[0UL] = (input[0UL] + 914778474UL) ^ (unsigned char)11;
    local1 = 0UL;
    while (local1 < 1UL) {
      state[local1] |= (state[local1] & (unsigned char)31) << 4UL;
      local1++;
    }
    output[0UL] = state[0UL] | (unsigned char)118;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
add    $0x3686696a,%rax
xor    $0xb,%rax
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
cmp    $0x1,%rax
jae    115d <RandomFunc+0x5d>
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp,%rax,1),%edx
and    $0x1f,%edx
shl    $0x4,%edx
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp,%rax,1),%ecx
or     %edx,%ecx
mov    %cl,-0x11(%rbp,%rax,1)
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    1124 <RandomFunc+0x24>
movzbl -0x11(%rbp),%eax
or     $0x76,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    (%rdi),%al
add    $0x6a,%al
xor    $0xb,%al
mov    %eax,%ecx
shl    $0x4,%cl
or     %al,%cl
or     $0x76,%cl
mov    %cl,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1 x i8]
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = add i64 %10, 914778474
%12 = xor i64 %11, 11
%13 = trunc i64 %12 to i8
%14 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 %13, i8* %14
store i8 0, i8* %6
br label %15
15: ; preds = %19, %2
%16 = load i8, i8* %6
%17 = zext i8 %16 to i64
%18 = icmp ult i64 %17, 1
br i1 %18, label %19, label %36
19: ; preds = %15
%20 = load i8, i8* %6
%21 = zext i8 %20 to i64
%22 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = and i32 %24, 31
%26 = shl i32 %25, 4
%27 = load i8, i8* %6
%28 = zext i8 %27 to i64
%29 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = or i32 %31, %26
%33 = trunc i32 %32 to i8
store i8 %33, i8* %29
%34 = load i8, i8* %6
%35 = add i8 %34, 1
store i8 %35, i8* %6
br label %15
36: ; preds = %15
%37 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = or i32 %39, 118
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %4
%43 = getelementptr inbounds i8, i8* %42, i64 0
store i8 %41, i8* %43
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = add i8 %3, 106
%5 = xor i8 %4, 11
%6 = shl i8 %5, 4
%7 = or i8 %6, %5
%8 = or i8 %7, 118
store i8 %8, i8* %1
ret void
}
/* Variables and functions */
unsigned int test_tree_node_removal(unsigned int);
int cmain(void) {
  unsigned int i;
  for (i = 1; i < 512; i++) {
    unsigned int rv;
    rv = test_tree_node_removal(i * 2);
    if (rv != 0)
      return (int)rv;
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
cmpl   $0x200,-0x8(%rbp)
jae    1162 <cmain+0x52>
mov    -0x8(%rbp),%edi
shl    $0x1,%edi
call   1030 <test_tree_node_removal@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114f <cmain+0x3f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <cmain+0x59>
jmp    1154 <cmain+0x44>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <cmain+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmain>:
push   %rbx
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <test_tree_node_removal@plt>
test   %eax,%eax
jne    1138 <cmain+0x28>
lea    0x2(%rbx),%ecx
cmp    $0x3fe,%ebx
mov    %ecx,%ebx
jne    1120 <cmain+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @cmain() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 1, %0 ], [ %6, %1 ]
%3 = shl nuw nsw i32 %2, 1
%4 = tail call i32 @test_tree_node_removal(i32 %3)
%5 = icmp ne i32 %4, 0
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 512
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %9, label %1
9: ; preds = %1
ret i32 %4
}
/* Variables and functions */
float q8_rsqrt(float);
float qrsqrt(float f) { return (q8_rsqrt(f)); }


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

x86 assembly (clang, -O2):
<qrsqrt>:
jmp    1030 <q8_rsqrt@plt>

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

LLVM IR (-O2):
define float @qrsqrt(float %0) {
%2 = tail call float @q8_rsqrt(float %0)
ret float %2
}
int lower(s)
char *s;
{
  int n = 0;
  while (*s) {
    if (*s >= 'A' && *s <= 'Z')
      *s += ('A' - 'a');
    s++, n++;
  }
  return (n);
}


x86 assembly (clang, -O0):
<lower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1162 <lower+0x62>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1148 <lower+0x48>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     1148 <lower+0x48>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
add    $0xffffffe0,%ecx
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <lower+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower>:
mov    (%rdi),%cl
xor    %eax,%eax
jmp    1119 <lower+0x19>
cs nopw 0x0(%rax,%rax,1)
movzbl 0x1(%rdi,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
je     112d <lower+0x2d>
lea    -0x41(%rcx),%edx
cmp    $0x19,%dl
ja     1110 <lower+0x10>
add    $0xe0,%cl
mov    %cl,(%rdi,%rax,1)
jmp    1110 <lower+0x10>
ret

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

LLVM IR (-O2):
define i32 @lower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %15, %12 ], [ %2, %1 ]
%6 = phi i32 [ %14, %12 ], [ 0, %1 ]
%7 = phi i8* [ %13, %12 ], [ %0, %1 ]
%8 = add i8 %5, -65
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = add nsw i8 %5, -32
store i8 %11, i8* %7
br label %12
12: ; preds = %10, %4
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = add nuw nsw i32 %6, 1
%15 = load i8, i8* %13
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %12, %1
%18 = phi i32 [ 0, %1 ], [ %14, %12 ]
ret i32 %18
}
void test_ar_1_LONG(void *d, long n) {
  if (n == 0x7fffffffffffffffL - 1)
    n = 0x7fffffffffffffffL - 2;
  __builtin_memset(d, 0, n);
}


x86 assembly (clang, -O0):
<test_ar_1_LONG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x7ffffffffffffffe,%rax
ff ff 7f
cmp    %rax,-0x10(%rbp)
jne    1142 <test_ar_1_LONG+0x32>
movabs $0x7ffffffffffffffd,%rax
ff ff 7f
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ar_1_LONG>:
movabs $0x7ffffffffffffffd,%rdx
ff ff 7f
lea    0x1(%rdx),%rax
cmp    %rax,%rsi
cmovne %rsi,%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @test_ar_1_LONG(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 9223372036854775806
br i1 %6, label %7, label %8
7: ; preds = %2
store i64 9223372036854775805, i64* %4
br label %8
8: ; preds = %7, %2
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
ret void
}

LLVM IR (-O2):
define void @test_ar_1_LONG(i8* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 9223372036854775806
%4 = select i1 %3, i64 9223372036854775805, i64 %1
tail call void @llvm.memset.p0i8.i64(i8* align 1 %0, i8 0, i64 %4, i1 false)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ foo();
void f(unsigned a, unsigned b, unsigned c, unsigned d) {
  if (a <= b || c > d)
    foo();
  else
    bar();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    114c <f+0x2c>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jbe    1158 <f+0x38>
mov    $0x0,%al
call   1040 <foo@plt>
jmp    115f <f+0x3f>
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    %esi,%edi
jbe    112f <f+0xf>
cmp    %ecx,%edx
ja     112f <f+0xf>
xor    %eax,%eax
jmp    1030 <bar@plt>
xor    %eax,%eax
jmp    1040 <foo@plt>

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

LLVM IR (-O2):
define void @f(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ule i32 %0, %1
%6 = icmp ugt i32 %2, %3
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (...) @foo()
br label %12
10: ; preds = %4
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %8
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rsp_reg(uint32_t address) { return (address & 0xffff) >> 2; }


x86 assembly (clang, -O0):
<rsp_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
sar    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsp_reg>:
mov    %edi,%eax
shr    $0x2,%eax
and    $0x3fff,%eax
ret

LLVM IR (-O0):
define i32 @rsp_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65535
%5 = ashr i32 %4, 2
ret i32 %5
}

LLVM IR (-O2):
define i32 @rsp_reg(i32 %0) {
%2 = lshr i32 %0, 2
%3 = and i32 %2, 16383
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ta_oom_b(int /*<<< orphan*/);
int /*<<< orphan*/ ta_strdup_append(char **, char const *);
char *ta_talloc_strdup_append(char *s, const char *a) {
  ta_oom_b(ta_strdup_append(&s, a));
  return s;
}


x86 assembly (clang, -O0):
<ta_talloc_strdup_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   1030 <ta_strdup_append@plt>
mov    %eax,%edi
call   1040 <ta_oom_b@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta_talloc_strdup_append>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
call   1030 <ta_strdup_append@plt>
mov    %eax,%edi
call   1040 <ta_oom_b@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @ta_talloc_strdup_append(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @ta_strdup_append(i8** %3, i8* %1)
%5 = call i32 @ta_oom_b(i32 %4)
%6 = load i8*, i8** %3
ret i8* %6
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int permutation_after_loop(int d, int *permutation) {
  int *a, fail;
  double *c;
  fail = _ada_use_c2phc(52, a, permutation, c);
  return fail;
}


x86 assembly (clang, -O0):
<permutation_after_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x34,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<permutation_after_loop>:
mov    %rsi,%rdx
mov    $0x34,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @permutation_after_loop(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca double*
store i32 %0, i32* %3
store i32* %1, i32** %4
%8 = load i32*, i32** %5
%9 = load i32*, i32** %4
%10 = load double*, double** %7
%11 = call i32 @_ada_use_c2phc(i32 52, i32* %8, i32* %9, double* %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
ret i32 %12
}

LLVM IR (-O2):
define i32 @permutation_after_loop(i32 %0, i32* %1) {
%3 = tail call i32 @_ada_use_c2phc(i32 52, i32* undef, i32* %1, double* undef)
ret i32 %3
}
void RTT_IRQHandler(void) {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define void @RTT_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
extern void traceclose(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define i64 @main() {
ret i64 undef
}
/* Variables and functions */
char const *strrchr(char const *, char);
const char *get_ext(const char *url) { return strrchr(url, '.'); }


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

x86 assembly (clang, -O2):
<get_ext>:
mov    $0x2e,%esi
jmp    1030 <strrchr@plt>

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

LLVM IR (-O2):
define i8* @get_ext(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
ret i8* %2
}
void module_init(const char *appname, const char *version) {}


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

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

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

LLVM IR (-O2):
define void @module_init(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void set_uint16(unsigned char *p, unsigned short v) {
  p[0] = (v >> 8) & 0xff;
  p[1] = v & 0xff;
}


x86 assembly (clang, -O0):
<set_uint16>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
movzwl -0xa(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_uint16>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @set_uint16(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = ashr i32 %6, 8
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i16, i16* %4
%13 = zext i16 %12 to i32
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %15, i8* %17
ret void
}

LLVM IR (-O2):
define void @set_uint16(i8* nocapture writeonly %0, i16 zeroext %1) {
%3 = lshr i16 %1, 8
%4 = trunc i16 %3 to i8
store i8 %4, i8* %0
%5 = trunc i16 %1 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
void CAN0_Handler(void) {
  while (1) {
  }
}


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

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

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

LLVM IR (-O2):
define void @CAN0_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test0r() { printf("test0r\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"test0r\00"
define void @test0r() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void die(char *msg) {
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int IPC_CREAT;
int /*<<< orphan*/ IPC_PRIVATE;
int /*<<< orphan*/ perror(char *);
int semget(int /*<<< orphan*/, int, int);
int safesemget() {
  int returnVar = semget(IPC_PRIVATE, 3, 0666 | IPC_CREAT);
  if (returnVar < 0)
    perror("ERROR WHILE GETTING SEMID!");
  return returnVar;
}


x86 assembly (clang, -O0):
<safesemget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
mov    $0x3,%esi
call   1030 <semget@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1163 <safesemget+0x43>
lea    0xea2(%rip),%rdi
call   1040 <perror@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safesemget>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rax
mov    $0x1b6,%edx
or     (%rax),%edx
mov    $0x3,%esi
call   1030 <semget@plt>
mov    %eax,%ebx
test   %eax,%eax
js     114c <safesemget+0x2c>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xead(%rip),%rdi
call   1040 <perror@plt>
jmp    1148 <safesemget+0x28>

LLVM IR (-O0):
@IPC_PRIVATE = global i32 0
@IPC_CREAT = global i32 0
@.str = [27 x i8] c"ERROR WHILE GETTING SEMID!\00"
define i32 @safesemget() {
%1 = alloca i32
%2 = load i32, i32* @IPC_PRIVATE
%3 = load i32, i32* @IPC_CREAT
%4 = or i32 438, %3
%5 = call i32 @semget(i32 %2, i32 3, i32 %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@IPC_PRIVATE = global i32 0
@IPC_CREAT = global i32 0
@.str = [27 x i8] c"ERROR WHILE GETTING SEMID!\00"
define i32 @safesemget() {
%1 = load i32, i32* @IPC_PRIVATE
%2 = load i32, i32* @IPC_CREAT
%3 = or i32 %2, 438
%4 = tail call i32 @semget(i32 %1, i32 3, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret i32 %4
}
/* Variables and functions */
float tanf(float);
float libm_tanf(float x) { return tanf(x); }


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

x86 assembly (clang, -O2):
<libm_tanf>:
jmp    1030 <tanf@plt>

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

LLVM IR (-O2):
define float @libm_tanf(float %0) {
%2 = tail call float @tanf(float %0)
ret float %2
}
unsigned long getSoftDataLimit(void) { return ((unsigned long)2147483648ul); }


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

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

LLVM IR (-O0):
define i64 @getSoftDataLimit() {
ret i64 2147483648
}

LLVM IR (-O2):
define i64 @getSoftDataLimit() {
ret i64 2147483648
}
/* Variables and functions */
int strcmp(void const *, void const *);
int htab_str_cmp(const void *data1, const void *data2) {
  return strcmp(data1, data2);
}


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

x86 assembly (clang, -O2):
<htab_str_cmp>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @htab_str_cmp(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 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @htab_str_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
int test_imm_0Eint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x0E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Eint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0xe,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_0Eint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 60129542144
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ readInput(char *);
int main(int argc, char *argv[], char *envp[]) {
  char input[1024];
  readInput(input);
  printf("%s \n", input);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
call   1040 <readInput@plt>
lea    -0x420(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <readInput@plt>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s \0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [1024 x i8]
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%10 = call i32 @readInput(i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11)
ret i32 1
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @readInput(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 1
}
/* Variables and functions */
unsigned long CountTrailingZeroes(unsigned long);
unsigned long LSBitPos(unsigned long x) {
  return CountTrailingZeroes(x & -(signed long)x);
}


x86 assembly (clang, -O0):
<LSBitPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
sub    -0x8(%rbp),%rax
and    %rax,%rdi
call   1030 <CountTrailingZeroes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LSBitPos>:
mov    %rdi,%rax
neg    %rax
and    %rax,%rdi
jmp    1030 <CountTrailingZeroes@plt>

LLVM IR (-O0):
define i64 @LSBitPos(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = sub nsw i64 0, %4
%6 = and i64 %3, %5
%7 = call i64 @CountTrailingZeroes(i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @LSBitPos(i64 %0) {
%2 = sub nsw i64 0, %0
%3 = and i64 %2, %0
%4 = tail call i64 @CountTrailingZeroes(i64 %3)
ret i64 %4
}
void *my_atomic_loadptr(void *volatile *a) { return __atomic_load_n(a, 5); }


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

x86 assembly (clang, -O2):
<my_atomic_loadptr>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
define i8* @my_atomic_loadptr(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = bitcast i8** %4 to i64*
%6 = bitcast i8** %3 to i64*
%7 = load atomic volatile i64, i64* %5 seq_cst
store i64 %7, i64* %6
%8 = bitcast i64* %6 to i8**
%9 = load i8*, i8** %8
ret i8* %9
}

LLVM IR (-O2):
define i8* @my_atomic_loadptr(i8** %0) {
%2 = bitcast i8** %0 to i64*
%3 = load atomic volatile i64, i64* %2 seq_cst
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
double dmax(double a, double b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<dmax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <dmax+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <dmax+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmax>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dmax(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 = fcmp ogt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @dmax(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}