xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int yet_another(bool enter) {
  if (false) {
    printf("The idea is that this code will never be called");
  }
}


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

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

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

LLVM IR (-O2):
define i32 @yet_another(i32 %0) {
ret i32 undef
}
/* Variables and functions */
float __nv_tanf(float);
float tanf(float __a) { return __nv_tanf(__a); }


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

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

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

LLVM IR (-O2):
define float @tanf(float %0) {
%2 = tail call float @__nv_tanf(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_bst_node_data_comma(int *data) {
  printf("%d", (*data));
  printf(" ,");
}


x86 assembly (clang, -O0):
<print_bst_node_data_comma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bst_node_data_comma>:
push   %rax
mov    (%rdi),%esi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c" ,\00"
define void @print_bst_node_data_comma(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int cr_negative_set(unsigned this_cr) { return (this_cr & 0x8); }


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

x86 assembly (clang, -O2):
<cr_negative_set>:
mov    %edi,%eax
and    $0x8,%eax
ret

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

LLVM IR (-O2):
define i32 @cr_negative_set(i32 %0) {
%2 = and i32 %0, 8
ret i32 %2
}
int func1(int a) { return a - a; }


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

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

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

LLVM IR (-O2):
define i32 @func1(i32 %0) {
ret i32 0
}
/* Variables and functions */
char const *umax_to_str(unsigned long);
const char *ulong_to_str(unsigned long x) { return umax_to_str(x); }


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

x86 assembly (clang, -O2):
<ulong_to_str>:
jmp    1030 <umax_to_str@plt>

LLVM IR (-O0):
define i8* @ulong_to_str(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @umax_to_str(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @ulong_to_str(i64 %0) {
%2 = tail call i8* @umax_to_str(i64 %0)
ret i8* %2
}
void RTBldCfgTargetArch(void) {}


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

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

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

LLVM IR (-O2):
define void @RTBldCfgTargetArch() {
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int);
void setSeed() { srand(((rand()) % (1 << 16)) * 39163); }


x86 assembly (clang, -O0):
<setSeed>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
imul   $0x98fb,%edx,%edi
call   1030 <srand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setSeed>:
push   %rax
xor    %eax,%eax
call   1040 <rand@plt>
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff0000,%ecx
sub    %ecx,%eax
imul   $0x98fb,%eax,%edi
pop    %rax
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @setSeed() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 65536
%3 = mul nsw i32 %2, 39163
%4 = call i32 @srand(i32 %3)
ret void
}

LLVM IR (-O2):
define void @setSeed() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 65536
%3 = mul nsw i32 %2, 39163
%4 = tail call i32 @srand(i32 %3)
ret void
}
/* Variables and functions */
int partition(int *, int, int);
void quickSort(int *arr, int lower, int upper) {
  int i = 0;
  if (upper > lower) {
    i = partition(arr, lower, upper);
    quickSort(arr, lower, i - 1);
    quickSort(arr, i + 1, upper);
  }
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    117b <quickSort+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quickSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quickSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %esi,%edx
jle    1166 <quickSort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quickSort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quickSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quickSort(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
store i32 0, i32* %7
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partition(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = load i32*, i32** %4
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %6
br label %24
24: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quickSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, %1
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quickSort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
void swap(int *arr[], int a, int b) {}


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

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

LLVM IR (-O0):
define void @swap(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 void
}

LLVM IR (-O2):
define void @swap(i32** nocapture %0, i32 %1, i32 %2) {
ret void
}
int test_imm_EDuint16_reg(unsigned short val) {
  return ((val) & (0xED << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_EDuint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 237
%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_EDuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 237
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ dxl_write_word(unsigned char, int, unsigned short);
void setCWAngleLimit(unsigned char id, unsigned short limit) {
  dxl_write_word(id, (6), limit);
}


x86 assembly (clang, -O0):
<setCWAngleLimit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x1(%rbp),%al
mov    $0x6,%esi
movzbl %al,%edi
movzwl -0x4(%rbp),%edx
call   1030 <dxl_write_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setCWAngleLimit>:
mov    %esi,%edx
mov    $0x6,%esi
jmp    1030 <dxl_write_word@plt>

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

LLVM IR (-O2):
define void @setCWAngleLimit(i8 zeroext %0, i16 zeroext %1) {
%3 = tail call i32 @dxl_write_word(i8 zeroext %0, i32 6, i16 zeroext %1)
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int const uint32_t;

/* Variables and functions */
scalar_t__ ndm_endian_is_le();
uint32_t ndm_endian_letoh32(const uint32_t x) {
  if (ndm_endian_is_le()) {
    return x;
  }
  const uint8_t *p = (const uint8_t *)&x;
  return (uint32_t)(((uint32_t) * (p + 0)) << 0 | ((uint32_t) * (p + 1)) << 8 |
                    ((uint32_t) * (p + 2)) << 16 |
                    ((uint32_t) * (p + 3)) << 24);
}


x86 assembly (clang, -O0):
<ndm_endian_letoh32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <ndm_endian_is_le@plt>
cmp    $0x0,%rax
je     1137 <ndm_endian_letoh32+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <ndm_endian_letoh32+0x63>
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
shl    $0x0,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndm_endian_letoh32>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <ndm_endian_is_le@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ndm_endian_letoh32(i32 returned %0) {
%2 = tail call i64 (...) @ndm_endian_is_le()
ret i32 %0
}
void main() { 37 + 54; }


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

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emit(char *);
int /*<<< orphan*/ sprintf(char *, char *);
void get_endfor() {
  char line[140];
  sprintf(line, "command EndFor");
  emit(line);
}


x86 assembly (clang, -O0):
<get_endfor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    -0x90(%rbp),%rdi
lea    0xec7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <emit@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_endfor>:
sub    $0x98,%rsp
movabs $0x726f46646e4520,%rax
mov    %rax,0x7(%rsp)
movabs $0x20646e616d6d6f63,%rax
6e 64 20
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <emit@plt>
add    $0x98,%rsp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"command EndFor\00"
define void @get_endfor() {
%1 = alloca [140 x i8]
%2 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 0
%5 = call i32 @emit(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"command EndFor\00"
define void @get_endfor() {
%1 = alloca [140 x i8]
%2 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 0
%3 = call i32 @emit(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *cmd) {
  fprintf(stderr, "usage: %s [ -r repeats] [ -d delay ]\n", cmd);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"usage: %s [ -r repeats] [ -d delay ]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"usage: %s [ -r repeats] [ -d delay ]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void foo579() {}


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

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

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

LLVM IR (-O2):
define void @foo579() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_core();
int /*<<< orphan*/ init_round();
void begin_match() {
  init_core();
  init_round();
}


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

x86 assembly (clang, -O2):
<begin_match>:
push   %rax
xor    %eax,%eax
call   1030 <init_core@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <init_round@plt>

LLVM IR (-O0):
define void @begin_match() {
%1 = call i32 (...) @init_core()
%2 = call i32 (...) @init_round()
ret void
}

LLVM IR (-O2):
define void @begin_match() {
%1 = tail call i32 (...) @init_core()
%2 = tail call i32 (...) @init_round()
ret void
}
double etime_(z)
double *z;
{ return (0.0); }


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

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

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

LLVM IR (-O2):
define double @etime_(double* nocapture readnone %0) {
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void usage(int argc, char **argv) {
  if (argc != 2) {
    printf("Usage: %s <PORT>\n", argv[0]);
    exit(0);
  }
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1153 <usage+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
cmp    $0x2,%edi
jne    1126 <usage+0x6>
ret
push   %rax
mov    (%rsi),%rsi
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s <PORT>\0A\00"
define void @usage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 2
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 @exit(i32 0)
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s <PORT>\0A\00"
define void @usage(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
ret void
}
/* Type definitions */
struct statfs {
  int dummy;
};

/* Variables and functions */
int syscall(int, char const *, struct statfs *);
int __statfs(const char *path, struct statfs *buf) {
  return syscall(137, path, buf);
}


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

x86 assembly (clang, -O2):
<__statfs>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x89,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.statfs = type { i32 }
define i32 @__statfs(i8* %0, %struct.statfs* %1) {
%3 = alloca i8*
%4 = alloca %struct.statfs*
store i8* %0, i8** %3
store %struct.statfs* %1, %struct.statfs** %4
%5 = load i8*, i8** %3
%6 = load %struct.statfs*, %struct.statfs** %4
%7 = call i32 @syscall(i32 137, i8* %5, %struct.statfs* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.statfs = type { i32 }
define i32 @__statfs(i8* %0, %struct.statfs* %1) {
%3 = tail call i32 @syscall(i32 137, i8* %0, %struct.statfs* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert_str_not_equal_(char *, int, char *, char *);
void test_str_not_equal_fail() {
  assert_str_not_equal_("/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/hughbien/"
                        "assertive/refs/heads/master/test/fail_test.c",
                        26, ("lorem"), ("lorem"));
}


x86 assembly (clang, -O0):
<test_str_not_equal_fail>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1a,%esi
lea    0xf69(%rip),%rcx
mov    %rcx,%rdx
call   1030 <assert_str_not_equal_@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_str_not_equal_fail>:
lea    0xee9(%rip),%rdi
lea    0xf72(%rip),%rcx
mov    $0x1a,%esi
mov    %rcx,%rdx
jmp    1030 <assert_str_not_equal_@plt>

LLVM IR (-O0):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hughbien/assertive/refs/heads/master/test/fail_test.c\00"
@.str.1 = [6 x i8] c"lorem\00"
define void @test_str_not_equal_fail() {
%1 = call i32 @assert_str_not_equal_(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hughbien/assertive/refs/heads/master/test/fail_test.c\00"
@.str.1 = [6 x i8] c"lorem\00"
define void @test_str_not_equal_fail() {
%1 = tail call i32 @assert_str_not_equal_(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
double cfrac_tan(double, int);
double calculate_distance(double height, double alpha) {
  return height / cfrac_tan(alpha, 10);
}


x86 assembly (clang, -O0):
<calculate_distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0xa,%edi
call   1030 <cfrac_tan@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_distance>:
push   %rax
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <cfrac_tan@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @calculate_distance(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 = call double @cfrac_tan(double %6, i32 10)
%8 = fdiv double %5, %7
ret double %8
}

LLVM IR (-O2):
define double @calculate_distance(double %0, double %1) {
%3 = tail call double @cfrac_tan(double %1, i32 10)
%4 = fdiv double %0, %3
ret double %4
}
/* Variables and functions */
int pow(int, int);
int get_dgt_cnt(int num) {
  int i = 1;
  while (num > pow(10, i) - 1) {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<get_dgt_cnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    1153 <get_dgt_cnt+0x43>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <get_dgt_cnt+0x12>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dgt_cnt>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    $0xa,%edi
mov    %ebx,%esi
call   1030 <pow@plt>
cmp    %ebp,%eax
jle    1120 <get_dgt_cnt+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @get_dgt_cnt(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %6, %2 ]
%4 = tail call i32 @pow(i32 10, i32 %3)
%5 = icmp sgt i32 %4, %0
%6 = add nuw nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret i32 %3
}
int tste_vol() {
  union doubleword {
    volatile double d;
    volatile long u[2];
  } dw;
  dw.d = 10;
  return dw.u[0] != 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<tste_vol>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tste_vol>:
movabs $0x4024000000000000,%rax
mov    %rax,-0x8(%rsp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rsp)
setne  %al
ret

LLVM IR (-O0):
%union.doubleword = type { [2 x i64] }
define i32 @tste_vol() {
%1 = alloca %union.doubleword
%2 = bitcast %union.doubleword* %1 to double*
store volatile double 1.000000e+01, double* %2
%3 = bitcast %union.doubleword* %1 to [2 x i64]*
%4 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
%5 = load volatile i64, i64* %4
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 1, i32 0
ret i32 %8
}

LLVM IR (-O2):
define i32 @tste_vol() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store volatile i64 4621819117588971520, i64* %1
%3 = load volatile i64, i64* %1
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int nlmsg_msg_size(int);
int nlmsg_total_size(int);
int nlmsg_padlen(int payload) {
  return nlmsg_total_size(payload) - nlmsg_msg_size(payload);
}


x86 assembly (clang, -O0):
<nlmsg_padlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <nlmsg_total_size@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <nlmsg_msg_size@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nlmsg_padlen>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <nlmsg_total_size@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <nlmsg_msg_size@plt>
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @nlmsg_padlen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @nlmsg_total_size(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @nlmsg_msg_size(i32 %5)
%7 = sub nsw i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @nlmsg_padlen(i32 %0) {
%2 = tail call i32 @nlmsg_total_size(i32 %0)
%3 = tail call i32 @nlmsg_msg_size(i32 %0)
%4 = sub nsw i32 %2, %3
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
void write_byte(FILE *file, char byte) {
  fwrite(&byte, sizeof(char), 1, file);
  return;
}


x86 assembly (clang, -O0):
<write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_byte>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %rax,%rsi
jmp    1030 <fputc@plt>

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

LLVM IR (-O2):
define void @write_byte(i32* nocapture %0, i8 signext %1) {
%3 = sext i8 %1 to i32
%4 = tail call i32 @fputc(i32 %3, i32* %0)
ret void
}
void foo264(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo264(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void stderr_hook(char *line, void *data) {
  fprintf(stderr, line);
  fflush(stderr);
}


x86 assembly (clang, -O0):
<stderr_hook>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <fprintf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stderr_hook>:
push   %rbx
mov    %rdi,%rsi
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @stderr_hook(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = call i32 @fprintf(i32 %5, i8* %6)
%8 = load i32, i32* @stderr
%9 = call i32 @fflush(i32 %8)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @stderr_hook(i8* %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* %0)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fflush(i32 %5)
ret void
}
/* Variables and functions */
char getNonBlank();
int /*<<< orphan*/ ungetTexChar(char);
void skipWhiteSpace(void) {
  char c = getNonBlank();
  ungetTexChar(c);
}


x86 assembly (clang, -O0):
<skipWhiteSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getNonBlank@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <ungetTexChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipWhiteSpace>:
push   %rax
xor    %eax,%eax
call   1040 <getNonBlank@plt>
movsbl %al,%edi
pop    %rax
jmp    1030 <ungetTexChar@plt>

LLVM IR (-O0):
define void @skipWhiteSpace() {
%1 = alloca i8
%2 = call signext i8 (...) @getNonBlank()
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = call i32 @ungetTexChar(i8 signext %3)
ret void
}

LLVM IR (-O2):
define void @skipWhiteSpace() {
%1 = tail call signext i8 (...) @getNonBlank()
%2 = tail call i32 @ungetTexChar(i8 signext %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ num;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void mostra_bin(int num) {
  for (int i = (8 * sizeof(num) - 1); i >= 0; i--)
    printf("%i", (num >> i) & 0x01);
}


x86 assembly (clang, -O0):
<mostra_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1151 <mostra_bin+0x41>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
sar    %cl,%esi
and    $0x1,%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <mostra_bin+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostra_bin>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x1f,%ebp
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%esi
mov    %ebp,%ecx
shr    %cl,%esi
and    $0x1,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jb     1130 <mostra_bin+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define void @mostra_bin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 31, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = ashr i32 %8, %9
%11 = and i32 %10, 1
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, -1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @mostra_bin(i32 %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %1, %3
%4 = phi i32 [ 31, %1 ], [ %8, %3 ]
%5 = lshr i32 %0, %4
%6 = and i32 %5, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = add nsw i32 %4, -1
%9 = icmp eq i32 %4, 0
br i1 %9, label %2, label %3
}
void lkh(int N) {}


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

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

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

LLVM IR (-O2):
define void @lkh(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void throwError(char *err_func, char *err_cat, char *err_msg) {
  printf("%s ::: %s => %s\n", err_func, err_cat, err_msg);
  exit(1);
}


x86 assembly (clang, -O0):
<throwError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<throwError>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"%s ::: %s => %s\0A\00"
define void @throwError(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 i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %9)
%11 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"%s ::: %s => %s\0A\00"
define void @throwError(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%5 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_8Eint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x8E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_8Eint64_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, 142
%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_8Eint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 609885356032
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ driveForward(int);
void AutoCube() { driveForward(3); }


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

x86 assembly (clang, -O2):
<AutoCube>:
mov    $0x3,%edi
jmp    1030 <driveForward@plt>

LLVM IR (-O0):
define void @AutoCube() {
%1 = call i32 @driveForward(i32 3)
ret void
}

LLVM IR (-O2):
define void @AutoCube() {
%1 = tail call i32 @driveForward(i32 3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ get_output_filename(char *, int, int /*<<< orphan*/,
                                       int /*<<< orphan*/, char *);
int /*<<< orphan*/ unlink(char *);
void delete_binary(int64_t snap, int64_t chunk) {
  char buffer[1024];
  get_output_filename(buffer, 1024, snap, chunk, "bin");
  unlink(buffer);
}


x86 assembly (clang, -O0):
<delete_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    $0x400,%esi
lea    0xeb6(%rip),%r8
call   1040 <get_output_filename@plt>
lea    -0x410(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_binary>:
push   %rbx
sub    $0x400,%rsp
mov    %esi,%ecx
mov    %edi,%edx
lea    0xecd(%rip),%r8
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <get_output_filename@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"bin\00"
define void @delete_binary(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1024 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @get_output_filename(i8* %6, i32 1024, i32 %7, i32 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = call i32 @unlink(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"bin\00"
define void @delete_binary(i32 %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @get_output_filename(i8* %4, i32 1024, i32 %0, i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @unlink(i8* %4)
ret void
}
unsigned int submod32(unsigned int a, unsigned int b, unsigned int p) {
  if (a >= b)
    return a - b;
  else
    return a - b + p;
}


x86 assembly (clang, -O0):
<submod32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jb     1127 <submod32+0x27>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1133 <submod32+0x33>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<submod32>:
xor    %eax,%eax
sub    %esi,%edi
cmovb  %edx,%eax
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @submod32(i32 %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %0, %1
%5 = sub i32 %0, %1
%6 = select i1 %4, i32 %2, i32 0
%7 = add i32 %5, %6
ret i32 %7
}
/* Type definitions */
typedef size_t ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
char *strchr(char *, char);
ssize_t strFindFirstChar(char *string, char search) {
  char *pos;
  assert(string != NULL);
  pos = strchr(string, search);
  if (pos)
    return (size_t)(pos - string);
  else
    return -1;
}


x86 assembly (clang, -O0):
<strFindFirstChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1174 <strFindFirstChar+0x54>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    117c <strFindFirstChar+0x5c>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strFindFirstChar>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
cmp    $0x1,%rax
sbb    %rax,%rax
or     %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i64 @strFindFirstChar(i8* %0, i8 signext %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8*
store i8* %0, i8** %4
store i8 %1, i8* %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8*, i8** %4
%12 = load i8, i8* %5
%13 = call i8* @strchr(i8* %11, i8 signext %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i8*, i8** %6
%18 = load i8*, i8** %4
%19 = ptrtoint i8* %17 to i64
%20 = ptrtoint i8* %18 to i64
%21 = sub i64 %19, %20
store i64 %21, i64* %3
br label %23
22: ; preds = %2
store i64 -1, i64* %3
br label %23
23: ; preds = %22, %16
%24 = load i64, i64* %3
ret i64 %24
}

LLVM IR (-O2):
define i64 @strFindFirstChar(i8* %0, i8 signext %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %1)
%7 = icmp eq i8* %6, null
%8 = ptrtoint i8* %6 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = select i1 %7, i64 -1, i64 %10
ret i64 %11
}
/* Variables and functions */
double fabs(double);
double ff(double x, double y) { return fabs((x * x - 1.) / (y * y)); }


x86 assembly (clang, -O0):
<ff>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeec(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movaps 0xec3(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff>:
mulsd  %xmm0,%xmm0
addsd  0xef4(%rip),%xmm0
mulsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @ff(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* %3
%7 = call double @llvm.fmuladd.f64(double %5, double %6, double -1.000000e+00)
%8 = load double, double* %4
%9 = load double, double* %4
%10 = fmul double %8, %9
%11 = fdiv double %7, %10
%12 = call double @llvm.fabs.f64(double %11)
ret double %12
}

LLVM IR (-O2):
define double @ff(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %0, double %0, double -1.000000e+00)
%4 = fmul double %1, %1
%5 = fdiv double %3, %4
%6 = tail call double @llvm.fabs.f64(double %5)
ret double %6
}
int cmp(const void *a, const void *b) {
  double fa = *(double *)a;
  double fb = *(double *)b;
  return (fa > fb) - (fa < fb);
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double
%6 = alloca double
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to double*
%9 = load double, double* %8
store double %9, double* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to double*
%12 = load double, double* %11
store double %12, double* %6
%13 = load double, double* %5
%14 = load double, double* %6
%15 = fcmp ogt double %13, %14
%16 = zext i1 %15 to i32
%17 = load double, double* %5
%18 = load double, double* %6
%19 = fcmp olt double %17, %18
%20 = zext i1 %19 to i32
%21 = sub nsw i32 %16, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = zext i1 %7 to i32
%9 = fcmp olt double %4, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ prepare(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc < 3) {
    printf("wrong args");
    return 0;
  }
  prepare(argv[1], argv[2], argv[3]);
}


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)
cmpl   $0x3,-0x8(%rbp)
jge    1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1175 <main+0x55>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
call   1040 <prepare@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jg     1134 <main+0x14>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
jmp    1148 <main+0x28>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rax
mov    0x18(%rsi),%rdx
mov    %rax,%rsi
call   1040 <prepare@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"wrong args\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %21
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 3
%19 = load i8*, i8** %18
%20 = call i32 @prepare(i8* %13, i8* %16, i8* %19)
br label %21
21: ; preds = %10, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [11 x i8] c"wrong args\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %14
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
%13 = tail call i32 @prepare(i8* %8, i8* %10, i8* %12)
br label %14
14: ; preds = %6, %4
ret i32 0
}