xunge/DecIR huggingface dataset:
double deg_to_rad(double deg) { return deg * 3.14159265 / 180; }


x86 assembly (clang, -O0):
<deg_to_rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg_to_rad>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @deg_to_rad(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x400921FB53C8D4F1
%5 = fdiv double %4, 1.800000e+02
ret double %5
}

LLVM IR (-O2):
define double @deg_to_rad(double %0) {
%2 = fmul double %0, 0x400921FB53C8D4F1
%3 = fdiv double %2, 1.800000e+02
ret double %3
}
void print_asimage_registry() {}


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

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

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

LLVM IR (-O2):
define void @print_asimage_registry() {
ret void
}
/* Type definitions */
struct tree_node {
  int dummy;
};
struct tree {
  int dummy;
};

/* Variables and functions */
struct tree_node *tnode_matchindex(struct tree *, void const *, size_t);
struct tree_node *tree_matchindex(struct tree *tp, const void *key,
                                  size_t len) {
  return tnode_matchindex(tp, key, len);
}


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

x86 assembly (clang, -O2):
<tree_matchindex>:
jmp    1030 <tnode_matchindex@plt>

LLVM IR (-O0):
%struct.tree_node = type { i32 }
%struct.tree = type { i32 }
define %struct.tree_node* @tree_matchindex(%struct.tree* %0, i8* %1, i64 %2) {
%4 = alloca %struct.tree*
%5 = alloca i8*
%6 = alloca i64
store %struct.tree* %0, %struct.tree** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load %struct.tree*, %struct.tree** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call %struct.tree_node* @tnode_matchindex(%struct.tree* %7, i8* %8, i64 %9)
ret %struct.tree_node* %10
}

LLVM IR (-O2):
%struct.tree_node = type { i32 }
%struct.tree = type { i32 }
define %struct.tree_node* @tree_matchindex(%struct.tree* %0, i8* %1, i64 %2) {
%4 = tail call %struct.tree_node* @tnode_matchindex(%struct.tree* %0, i8* %1, i64 %2)
ret %struct.tree_node* %4
}
/* Variables and functions */
int /*<<< orphan*/ LCD_CLR_RESET();
int /*<<< orphan*/ LCD_DELAY(int);
int /*<<< orphan*/ LCD_SET_CS();
int /*<<< orphan*/ LCD_SET_RD();
int /*<<< orphan*/ LCD_SET_RESET();
int /*<<< orphan*/ LCD_SET_WR();
void LCD_X_Init(void) {
  LCD_SET_CS();
  LCD_SET_RD();
  LCD_SET_WR();
  LCD_CLR_RESET();
  LCD_DELAY(20);
  LCD_SET_RESET();
  LCD_DELAY(20);
}


x86 assembly (clang, -O0):
<LCD_X_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <LCD_SET_CS@plt>
mov    $0x0,%al
call   1040 <LCD_SET_RD@plt>
mov    $0x0,%al
call   1070 <LCD_SET_WR@plt>
mov    $0x0,%al
call   1060 <LCD_CLR_RESET@plt>
mov    $0x14,%edi
call   1030 <LCD_DELAY@plt>
mov    $0x0,%al
call   1050 <LCD_SET_RESET@plt>
mov    $0x14,%edi
call   1030 <LCD_DELAY@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_X_Init>:
push   %rax
xor    %eax,%eax
call   1080 <LCD_SET_CS@plt>
xor    %eax,%eax
call   1040 <LCD_SET_RD@plt>
xor    %eax,%eax
call   1070 <LCD_SET_WR@plt>
xor    %eax,%eax
call   1060 <LCD_CLR_RESET@plt>
mov    $0x14,%edi
call   1030 <LCD_DELAY@plt>
xor    %eax,%eax
call   1050 <LCD_SET_RESET@plt>
mov    $0x14,%edi
pop    %rax
jmp    1030 <LCD_DELAY@plt>

LLVM IR (-O0):
define void @LCD_X_Init() {
%1 = call i32 (...) @LCD_SET_CS()
%2 = call i32 (...) @LCD_SET_RD()
%3 = call i32 (...) @LCD_SET_WR()
%4 = call i32 (...) @LCD_CLR_RESET()
%5 = call i32 @LCD_DELAY(i32 20)
%6 = call i32 (...) @LCD_SET_RESET()
%7 = call i32 @LCD_DELAY(i32 20)
ret void
}

LLVM IR (-O2):
define void @LCD_X_Init() {
%1 = tail call i32 (...) @LCD_SET_CS()
%2 = tail call i32 (...) @LCD_SET_RD()
%3 = tail call i32 (...) @LCD_SET_WR()
%4 = tail call i32 (...) @LCD_CLR_RESET()
%5 = tail call i32 @LCD_DELAY(i32 20)
%6 = tail call i32 (...) @LCD_SET_RESET()
%7 = tail call i32 @LCD_DELAY(i32 20)
ret void
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t bound_int32(int32_t val, int32_t min, int32_t max) {
  return val < min ? min : (val > max ? max : val);
}


x86 assembly (clang, -O0):
<bound_int32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    112b <bound_int32+0x2b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1156 <bound_int32+0x56>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1146 <bound_int32+0x46>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    114e <bound_int32+0x4e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bound_int32>:
mov    %rdx,%rax
cmp    %rdx,%rdi
cmovle %rdi,%rax
cmp    %rsi,%rdi
cmovl  %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @bound_int32(i64 %0, i64 %1, i64 %2) {
%4 = icmp slt i64 %0, %1
%5 = icmp sgt i64 %0, %2
%6 = select i1 %5, i64 %2, i64 %0
%7 = select i1 %4, i64 %1, i64 %6
ret i64 %7
}
int parent(int index) { return (index - 1) / 2; }


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
mov    %edi,%eax
add    $0xffffffff,%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0xffffffff,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @parent(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sdiv i32 %2, 2
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ Xorriso__is_compatible(int, int, int /*<<< orphan*/,
                                          int /*<<< orphan*/);
int /*<<< orphan*/ Xorriso__version(int *, int *, int *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ yell_xorriso();
void check_compatibility() {
  int lib_major, lib_minor, lib_micro;
  if (sizeof(off_t) < 6) {
    yell_xorriso();
    fprintf(stderr, "xorriso : FATAL : Compile time misconfiguration. "
                    "sizeof(off_t) too small.\n\n");
    exit(4);
  }
  if (!Xorriso__is_compatible(1, 3, 0, 0)) {
    yell_xorriso();
    Xorriso__version(&lib_major, &lib_minor, &lib_micro);
    fprintf(stderr,
            "xorriso : FATAL : libisoburn/xorriso runtime version mismatch. "
            "Found %d.%d.%d, need %d.%d.%d\n\n",
            lib_major, lib_minor, lib_micro, 1, 3, 0);
    exit(4);
  }
}


x86 assembly (clang, -O0):
<check_compatibility>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <yell_xorriso@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x4,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<check_compatibility>:
push   %rax
xor    %eax,%eax
call   1030 <yell_xorriso@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x4,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [76 x i8] c"xorriso : FATAL : Compile time misconfiguration. sizeof(off_t) too small.\0A\0A\00"
define void @check_compatibility() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @yell_xorriso()
%5 = load i32, i32* @stderr
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 4)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [76 x i8] c"xorriso : FATAL : Compile time misconfiguration. sizeof(off_t) too small.\0A\0A\00"
define void @check_compatibility() {
%1 = tail call i32 (...) @yell_xorriso()
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 4)
unreachable
}
void string_swap(char **a, char **b) {
  char *tmp = *a;
  *a = *b;
  *b = tmp;
}


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

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

LLVM IR (-O0):
define void @string_swap(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8*, i8** %5
%12 = load i8**, i8*** %4
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
define void @string_swap(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
void fio_ctx_delete(struct fio_ctx *this __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
%struct.fio_ctx = type opaque
define void @fio_ctx_delete(%struct.fio_ctx* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("\nolar\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"\0Aolar\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ g();
f(long long i) {
  if (i < 0)
    g();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    112e <f+0x1e>
mov    $0x0,%al
call   1030 <g@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %rdi,%rdi
js     1116 <f+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <g@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @f(i64 %0) {
%2 = icmp slt i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @g()
br label %5
5: ; preds = %3, %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "Usage: addpattern [-i trxfile] [-o binfile] [-B board_id] [-p "
          "pattern] [-g] [-b] [-v v#.#.#] [-r #.#] [-{0|1|2|4}] -h\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [119 x i8] c"Usage: addpattern [-i trxfile] [-o binfile] [-B board_id] [-p pattern] [-g] [-b] [-v v#.#.#] [-r #.#] [-{0|1|2|4}] -h\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [119 x i8] c"Usage: addpattern [-i trxfile] [-o binfile] [-B board_id] [-p pattern] [-g] [-b] [-v v#.#.#] [-r #.#] [-{0|1|2|4}] -h\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int omap_rev();
int is_omap730(void) {
  return (((omap_rev() >> 16) & 0xffff) == (0x0730)) ? 1 : 0;
}


x86 assembly (clang, -O0):
<is_omap730>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <omap_rev@plt>
mov    %eax,%edx
sar    $0x10,%edx
and    $0xffff,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x730,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_omap730>:
push   %rax
xor    %eax,%eax
call   1030 <omap_rev@plt>
and    $0xffff0000,%eax
xor    %ecx,%ecx
cmp    $0x7300000,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_omap730() {
%1 = call i32 (...) @omap_rev()
%2 = ashr i32 %1, 16
%3 = and i32 %2, 65535
%4 = icmp eq i32 %3, 1840
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_omap730() {
%1 = tail call i32 (...) @omap_rev()
%2 = and i32 %1, -65536
%3 = icmp eq i32 %2, 120586240
%4 = zext i1 %3 to i32
ret i32 %4
}
float min_f(float a, float b) {
  if (a > b)
    return b;
  return a;
}


x86 assembly (clang, -O0):
<min_f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    112c <min_f+0x2c>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1136 <min_f+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_f>:
minss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @min_f(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %5
%8 = fcmp ogt float %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load float, float* %5
store float %10, float* %3
br label %13
11: ; preds = %2
%12 = load float, float* %4
store float %12, float* %3
br label %13
13: ; preds = %11, %9
%14 = load float, float* %3
ret float %14
}

LLVM IR (-O2):
define float @min_f(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %1, float %0
ret float %4
}
void g_arith_add_f(void *s, void *d, void *o) {
  *((float *)o) = *((float *)s) + *((float *)d);
}


x86 assembly (clang, -O0):
<g_arith_add_f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
addss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_arith_add_f>:
movss  (%rdi),%xmm0
addss  (%rsi),%xmm0
movss  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define void @g_arith_add_f(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 = bitcast i8* %7 to float*
%9 = load float, float* %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to float*
%12 = load float, float* %11
%13 = fadd float %9, %12
%14 = load i8*, i8** %6
%15 = bitcast i8* %14 to float*
store float %13, float* %15
ret void
}

LLVM IR (-O2):
define void @g_arith_add_f(i8* nocapture %0, i8* nocapture %1, i8* nocapture writeonly %2) {
%4 = bitcast i8* %0 to float*
%5 = load float, float* %4
%6 = bitcast i8* %1 to float*
%7 = load float, float* %6
%8 = fadd float %5, %7
%9 = bitcast i8* %2 to float*
store float %8, float* %9
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/ const);
char *pack_s32(const int32_t *data, char *buffer) {
  *((int32_t *)buffer) = htonl(*data);
  return buffer + sizeof(*data);
}


x86 assembly (clang, -O0):
<pack_s32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_s32>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <htonl@plt>
mov    %eax,(%rbx)
add    $0x4,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @pack_s32(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 = load i32, i32* %5
%7 = call i32 @htonl(i32 %6)
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32 %7, i32* %9
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 4
ret i8* %11
}

LLVM IR (-O2):
define i8* @pack_s32(i32* nocapture %0, i8* writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @htonl(i32 %3)
%5 = bitcast i8* %1 to i32*
store i32 %4, i32* %5
%6 = getelementptr inbounds i8, i8* %1, i64 4
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, size_t);
void test_do_fail(size_t points) { printf("failed  [  0/%3zu]\n", points); }


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

x86 assembly (clang, -O2):
<test_do_fail>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"failed [ 0/%3zu]\0A\00"
define void @test_do_fail(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %3)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"failed [ 0/%3zu]\0A\00"
define void @test_do_fail(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PL_ArenaFinish();
int main() {
  PL_ArenaFinish();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @PL_ArenaFinish()
ret i32 0
}
/* Variables and functions */
scalar_t__ close(int);
int errno;
int close_noerr(int fd) {
  int saved_errno = errno, ret;
  if (close(fd) != 0)
    ret = errno;
  else
    ret = 0;
  errno = saved_errno;
  return ret;
}


x86 assembly (clang, -O0):
<close_noerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
cmp    $0x0,%rax
je     114a <close_noerr+0x3a>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <close_noerr+0x41>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    0x2e85(%rip),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_noerr>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%ebp
call   1030 <close@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     112d <close_noerr+0x1d>
mov    (%rbx),%eax
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @close_noerr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @errno
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i64 @close(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* @errno
store i32 %10, i32* %4
br label %12
11: ; preds = %1
store i32 0, i32* %4
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %3
store i32 %13, i32* @errno
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @close_noerr(i32 %0) {
%2 = load i32, i32* @errno
%3 = tail call i64 @close(i32 %0)
%4 = icmp eq i64 %3, 0
%5 = load i32, i32* @errno
%6 = select i1 %4, i32 0, i32 %5
store i32 %2, i32* @errno
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void quitordebug_16401(void) { exit(1); }


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

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

LLVM IR (-O0):
define void @quitordebug_16401() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @quitordebug_16401() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t swapbyte16_on_le(uint16_t in) {
  return ((in & 0xff) << 8) | ((in & 0xff00) >> 8);
}


x86 assembly (clang, -O0):
<swapbyte16_on_le>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapbyte16_on_le>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @swapbyte16_on_le(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 8
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = ashr i32 %7, 8
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @swapbyte16_on_le(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("ola\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"ola\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [4 x i8] c"ola\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int quitTime(void) {
  char quitAnswer;
  printf("\n Would you like to quit? (y/n)\n");
  scanf("%c", &quitAnswer);
  getchar();
  if (quitAnswer == 'y' || quitAnswer == 'Y') {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<quitTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
je     1175 <quitTime+0x45>
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
jne    1181 <quitTime+0x51>
movl   $0x1,-0x4(%rbp)
jmp    1188 <quitTime+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quitTime>:
push   %rax
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x7(%rsp),%cl
and    $0xdf,%cl
xor    %eax,%eax
cmp    $0x59,%cl
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0A Would you like to quit? (y/n)\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @quitTime() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (...) @getchar()
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 121
br i1 %8, label %13, label %9
9: ; preds = %0
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 89
br i1 %12, label %13, label %14
13: ; preds = %9, %0
store i32 1, i32* %1
br label %15
14: ; preds = %9
store i32 0, i32* %1
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@str = [32 x i8] c"\0A Would you like to quit? (y/n)\00"
define i32 @quitTime() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = call i32 (...) @getchar()
%5 = load i8, i8* %1
%6 = and i8 %5, -33
%7 = icmp eq i8 %6, 89
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int vsprintf(char *, char const *, int /*<<< orphan*/);
int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) {
  char tmp_buf[2048];
  int i;
  i = vsprintf(tmp_buf, fmt, ap);
  if (i > size)
    i = size;
  memcpy(buf, tmp_buf, i);
  return i;
}


x86 assembly (clang, -O0):
<vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <vsprintf@plt>
mov    %eax,-0x824(%rbp)
movslq -0x824(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    116e <vsnprintf+0x4e>
mov    -0x10(%rbp),%rax
mov    %eax,-0x824(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x820(%rbp),%rsi
mov    -0x824(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x824(%rbp),%eax
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsnprintf>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %rsi,%r12
mov    %rdi,%r14
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1040 <vsprintf@plt>
movslq %eax,%rbx
cmp    %r12,%rbx
cmova  %r12d,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <memcpy@plt>
mov    %ebx,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [2048 x i8]
%10 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = call i32 @vsprintf(i8* %11, i8* %12, i32 %13)
store i32 %14, i32* %10
%15 = load i32, i32* %10
%16 = sext i32 %15 to i64
%17 = load i64, i64* %6
%18 = icmp ugt i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load i64, i64* %6
%21 = trunc i64 %20 to i32
store i32 %21, i32* %10
br label %22
22: ; preds = %19, %4
%23 = load i8*, i8** %5
%24 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%25 = load i32, i32* %10
%26 = call i32 @memcpy(i8* %23, i8* %24, i32 %25)
%27 = load i32, i32* %10
ret i32 %27
}

LLVM IR (-O2):
define i32 @vsnprintf(i8* %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = alloca [2048 x i8]
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%7 = call i32 @vsprintf(i8* %6, i8* %2, i32 %3)
%8 = sext i32 %7 to i64
%9 = icmp ugt i64 %8, %1
%10 = trunc i64 %1 to i32
%11 = select i1 %9, i32 %10, i32 %7
%12 = call i32 @memcpy(i8* %0, i8* %6, i32 %11)
ret i32 %11
}
int f_fi(int mode, unsigned char **sec, float *data, unsigned int ndata,
         char *inv_out, void **local) {
  return 0;
}


x86 assembly (clang, -O0):
<f_fi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f_fi(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca float*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8**
store i32 %0, i32* %7
store i8** %1, i8*** %8
store float* %2, float** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8** %5, i8*** %12
ret i32 0
}

LLVM IR (-O2):
define i32 @f_fi(i32 %0, i8** nocapture readnone %1, float* nocapture readnone %2, i32 %3, i8* nocapture readnone %4, i8** nocapture readnone %5) {
ret i32 0
}
unsigned long htonl(unsigned long n) {
  return ((n & 0xFF) << 24) | ((n & 0xFF00) << 8) | ((n & 0xFF0000) >> 8) |
         ((n & 0xFF000000) >> 24);
}


x86 assembly (clang, -O0):
<htonl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
shl    $0x18,%rax
mov    -0x8(%rbp),%rcx
and    $0xff00,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
and    $0xff0000,%rcx
shr    $0x8,%rcx
or     %rcx,%rax
movabs $0xff000000,%rcx
and    -0x8(%rbp),%rcx
shr    $0x18,%rcx
or     %rcx,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @htonl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 255
%5 = shl i64 %4, 24
%6 = load i64, i64* %2
%7 = and i64 %6, 65280
%8 = shl i64 %7, 8
%9 = or i64 %5, %8
%10 = load i64, i64* %2
%11 = and i64 %10, 16711680
%12 = lshr i64 %11, 8
%13 = or i64 %9, %12
%14 = load i64, i64* %2
%15 = and i64 %14, 4278190080
%16 = lshr i64 %15, 24
%17 = or i64 %13, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @htonl(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = zext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int max(int, int);
int max3(int a, int b, int c) { return a < b ? max(b, c) : max(a, c); }


x86 assembly (clang, -O0):
<max3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1140 <max3+0x30>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <max@plt>
mov    %eax,-0x10(%rbp)
jmp    114e <max3+0x3e>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <max@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<max3>:
cmp    %esi,%edi
cmovl  %esi,%edi
mov    %edx,%esi
jmp    1030 <max@plt>

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

LLVM IR (-O2):
define i32 @max3(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = tail call i32 @max(i32 %5, i32 %2)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int main() {
  fprintf(stdout, "hello world\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int test_imm_66int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x66 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_66int64_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, 102
%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_66int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 438086664192
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *strchrnul(char *, int);
char *s_tic6x_coff_c6xabi_attribute(char *const input_line_p) {
  char *work_p = input_line_p;
  work_p = strchrnul(work_p, 0x0a) + 1;
  return work_p;
}


x86 assembly (clang, -O0):
<s_tic6x_coff_c6xabi_attribute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchrnul@plt>
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_tic6x_coff_c6xabi_attribute>:
push   %rax
mov    $0xa,%esi
call   1030 <strchrnul@plt>
add    $0x1,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @s_tic6x_coff_c6xabi_attribute(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchrnul(i8* %5, i32 10)
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %3
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @s_tic6x_coff_c6xabi_attribute(i8* %0) {
%2 = tail call i8* @strchrnul(i8* %0, i32 10)
%3 = getelementptr inbounds i8, i8* %2, i64 1
ret i8* %3
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int);
long long timeval_diff(struct timeval *, struct timeval *);
void wait_for(long long timediff) {
  struct timeval starttime, currtime;
  long difference = 1;
  long long timespent = 0;
  gettimeofday(&starttime, 0x00);
  while (timespent < timediff) {
    gettimeofday(&currtime, 0x00);
    timespent = timeval_diff(&currtime, &starttime);
  }
}


x86 assembly (clang, -O0):
<wait_for>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x1,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    1176 <wait_for+0x56>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
lea    -0x18(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <timeval_diff@plt>
mov    %rax,-0x28(%rbp)
jmp    1147 <wait_for+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %r14,%r14
jle    116a <wait_for+0x4a>
lea    0x8(%rsp),%rbx
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <timeval_diff@plt>
cmp    %r14,%rax
jl     1150 <wait_for+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define void @wait_for(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %2
store i64 1, i64* %5
store i64 0, i64* %6
%7 = call i32 @gettimeofday(%struct.timeval* %3, i32 0)
br label %8
8: ; preds = %12, %1
%9 = load i64, i64* %6
%10 = load i64, i64* %2
%11 = icmp slt i64 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = call i32 @gettimeofday(%struct.timeval* %4, i32 0)
%14 = call i64 @timeval_diff(%struct.timeval* %4, %struct.timeval* %3)
store i64 %14, i64* %6
br label %8
15: ; preds = %8
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @wait_for(i64 %0) {
%2 = alloca %struct.timeval
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %2 to i8*
%5 = bitcast %struct.timeval* %3 to i8*
%6 = call i32 @gettimeofday(%struct.timeval* %2, i32 0)
%7 = icmp sgt i64 %0, 0
br i1 %7, label %8, label %12
8: ; preds = %1, %8
%9 = call i32 @gettimeofday(%struct.timeval* %3, i32 0)
%10 = call i64 @timeval_diff(%struct.timeval* %3, %struct.timeval* %2)
%11 = icmp slt i64 %10, %0
br i1 %11, label %8, label %12
12: ; preds = %8, %1
ret void
}
void ParseCleanWhiteSpaces(char **commandLine) {
  while (((*commandLine)[0] == ' ' || (*commandLine)[0] == '\t') &&
         (*commandLine)[0] != '\0') {
    (*commandLine)++;
  }
  return;
}


x86 assembly (clang, -O0):
<ParseCleanWhiteSpaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1133 <ParseCleanWhiteSpaces+0x33>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x9(%rbp)
jne    1146 <ParseCleanWhiteSpaces+0x46>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1156 <ParseCleanWhiteSpaces+0x56>
jmp    1169 <ParseCleanWhiteSpaces+0x69>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1108 <ParseCleanWhiteSpaces+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseCleanWhiteSpaces>:
mov    (%rdi),%rax
jmp    1113 <ParseCleanWhiteSpaces+0x13>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,(%rdi)
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
cmp    $0x20,%cl
je     1110 <ParseCleanWhiteSpaces+0x10>
cmp    $0x9,%cl
je     1110 <ParseCleanWhiteSpaces+0x10>
ret

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

LLVM IR (-O2):
define void @ParseCleanWhiteSpaces(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %6, %1
%4 = phi i8* [ %7, %6 ], [ %2, %1 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 32, label %6
i8 9, label %6
]
6: ; preds = %3, %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %7, i8** %0
br label %3
8: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdout;
void report_num_tests_tap(int num_tests) {
  fprintf(stdout, "1..%d\n", num_tests);
}


x86 assembly (clang, -O0):
<report_num_tests_tap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_num_tests_tap>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"1..%d\0A\00"
define void @report_num_tests_tap(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int m1(int z) {
  int y = 0;
  int x = 5;
  if (z < 10) {
    int x = 7;
    if (x == 7)
      return x / y;
  }
  if (x == 6)
    return x / y;
  else
    return 0;
}


x86 assembly (clang, -O0):
<m1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x5,-0x10(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1144 <m1+0x44>
movl   $0x7,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jne    113f <m1+0x3f>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1164 <m1+0x64>
jmp    1144 <m1+0x44>
cmpl   $0x6,-0x10(%rbp)
jne    115d <m1+0x5d>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1164 <m1+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @m1(i32 %0) {
ret i32 0
}
char *mote32_Name(void) { return "MOTE32"; }


x86 assembly (clang, -O0):
<mote32_Name>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mote32_Name>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"MOTE32\00"
define i8* @mote32_Name() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"MOTE32\00"
define i8* @mote32_Name() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
int lower_bits(int x, int n) {
  int mask = (1 << n) - 1;
  return x & mask;
}


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

x86 assembly (clang, -O2):
<lower_bits>:
mov    %esi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @lower_bits(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = and i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @lower_bits(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int soma = add(5, 3);
  printf("%d", soma);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
mov    $0x3,%esi
call   1030 <add@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0x3,%esi
call   1030 <add@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @add(i32 5, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}