xunge/DecIR huggingface dataset:
/* Variables and functions */
int read_data_cmd();
int /*<<< orphan*/ send_ctrl_cmd(int);
unsigned int lcm_compare_id(void) {
  send_ctrl_cmd(0x2300);
  send_ctrl_cmd(0x05);
  return ((0x0170) == read_data_cmd()) ? 1 : 0;
}


x86 assembly (clang, -O0):
<lcm_compare_id>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2300,%edi
call   1040 <send_ctrl_cmd@plt>
mov    $0x5,%edi
call   1040 <send_ctrl_cmd@plt>
mov    $0x0,%al
call   1030 <read_data_cmd@plt>
mov    %eax,%esi
mov    $0x170,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm_compare_id>:
push   %rax
mov    $0x2300,%edi
call   1040 <send_ctrl_cmd@plt>
mov    $0x5,%edi
call   1040 <send_ctrl_cmd@plt>
xor    %eax,%eax
call   1030 <read_data_cmd@plt>
xor    %ecx,%ecx
cmp    $0x170,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @lcm_compare_id() {
%1 = call i32 @send_ctrl_cmd(i32 8960)
%2 = call i32 @send_ctrl_cmd(i32 5)
%3 = call i32 (...) @read_data_cmd()
%4 = icmp eq i32 368, %3
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
ret i32 %6
}

LLVM IR (-O2):
define i32 @lcm_compare_id() {
%1 = tail call i32 @send_ctrl_cmd(i32 8960)
%2 = tail call i32 @send_ctrl_cmd(i32 5)
%3 = tail call i32 (...) @read_data_cmd()
%4 = icmp eq i32 %3, 368
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ KEY_MAX;
int /*<<< orphan*/ define_key(char *, scalar_t__);
void define_esc_key(int ch) {
  char seq[3] = {'\x1b', ch, 0};
  define_key(seq, (KEY_MAX + 10 + ch));
}


x86 assembly (clang, -O0):
<define_esc_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x1b,-0x7(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x6(%rbp)
movb   $0x0,-0x5(%rbp)
lea    -0x7(%rbp),%rdi
mov    0x2eac(%rip),%rax
mov    (%rax),%rsi
add    $0xa,%rsi
movslq -0x4(%rbp),%rax
add    %rax,%rsi
call   1030 <define_key@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<define_esc_key>:
push   %rax
movb   $0x1b,0x5(%rsp)
mov    %dil,0x6(%rsp)
movb   $0x0,0x7(%rsp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%rax
movslq %edi,%rcx
lea    (%rcx,%rax,1),%rsi
add    $0xa,%rsi
lea    0x5(%rsp),%rdi
call   1030 <define_key@plt>
pop    %rax
ret

LLVM IR (-O0):
@KEY_MAX = global i64 0
define void @define_esc_key(i32 %0) {
%2 = alloca i32
%3 = alloca [3 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
store i8 27, i8* %4
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i32, i32* %2
%7 = trunc i32 %6 to i8
store i8 %7, i8* %5
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 0, i8* %8
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%10 = load i64, i64* @KEY_MAX
%11 = add nsw i64 %10, 10
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = add nsw i64 %11, %13
%15 = call i32 @define_key(i8* %9, i64 %14)
ret void
}

LLVM IR (-O2):
@KEY_MAX = global i64 0
define void @define_esc_key(i32 %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
store i8 27, i8* %3
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
%5 = trunc i32 %0 to i8
store i8 %5, i8* %4
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 0, i8* %6
%7 = load i64, i64* @KEY_MAX
%8 = sext i32 %0 to i64
%9 = add nsw i64 %8, 10
%10 = add i64 %9, %7
%11 = call i32 @define_key(i8* %3, i64 %10)
ret void
}
/* Variables and functions */
int CHAR_BIT;
unsigned int bit_floor_log2_impl(unsigned int);
unsigned int bit_ceil_log2_impl(unsigned int n) {
  int y = n & (n - 1);
  y |= -y;
  y >>= ((CHAR_BIT * sizeof(unsigned int)) - 1);
  return (bit_floor_log2_impl(n) - y);
}


x86 assembly (clang, -O0):
<bit_ceil_log2_impl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
movslq (%rax),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
mov    -0x8(%rbp),%eax
sar    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <bit_floor_log2_impl@plt>
sub    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_ceil_log2_impl>:
push   %rbx
lea    -0x1(%rdi),%eax
and    %edi,%eax
mov    %eax,%ebx
neg    %ebx
or     %eax,%ebx
mov    0x2ebd(%rip),%rax
mov    (%rax),%cl
shl    $0x2,%cl
add    $0xff,%cl
sar    %cl,%ebx
call   1030 <bit_floor_log2_impl@plt>
sub    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define i32 @bit_ceil_log2_impl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = sub i32 %5, 1
%7 = and i32 %4, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = sub nsw i32 0, %8
%10 = load i32, i32* %3
%11 = or i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* @CHAR_BIT
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 4
%15 = sub i64 %14, 1
%16 = load i32, i32* %3
%17 = trunc i64 %15 to i32
%18 = ashr i32 %16, %17
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = call i32 @bit_floor_log2_impl(i32 %19)
%21 = load i32, i32* %3
%22 = sub i32 %20, %21
ret i32 %22
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i32 @bit_ceil_log2_impl(i32 %0) {
%2 = add i32 %0, -1
%3 = and i32 %2, %0
%4 = sub nsw i32 0, %3
%5 = or i32 %3, %4
%6 = load i32, i32* @CHAR_BIT
%7 = shl i32 %6, 2
%8 = add i32 %7, -1
%9 = ashr i32 %5, %8
%10 = tail call i32 @bit_floor_log2_impl(i32 %0)
%11 = sub i32 %10, %9
ret i32 %11
}
/* Type definitions */
typedef int uint8_t;
typedef unsigned long long uint64_t;

/* Variables and functions */
void set_block_number_in_tweak(uint8_t *tweak, const uint64_t block_no) {
  tweak[3] = (tweak[3] & 0xe0) ^ ((block_no >> 16ULL) & 0x1f);
  tweak[4] = ((block_no >> 8ULL) & 0xff);
  tweak[5] = ((block_no >> 0ULL) & 0xff);
}


x86 assembly (clang, -O0):
<set_block_number_in_tweak>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
and    $0xe0,%eax
cltq
mov    -0x10(%rbp),%rcx
shr    $0x10,%rcx
and    $0x1f,%rcx
xor    %rcx,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%rax
shr    $0x0,%rax
and    $0xff,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_block_number_in_tweak>:
mov    %rsi,%rax
mov    $0xe0,%ecx
and    0xc(%rdi),%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x10,%eax
and    $0x1f,%eax
or     %ecx,%eax
mov    %eax,0xc(%rdi)
mov    %edx,0x10(%rdi)
mov    %esi,0x14(%rdi)
ret

LLVM IR (-O0):
define void @set_block_number_in_tweak(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 3
%7 = load i32, i32* %6
%8 = and i32 %7, 224
%9 = sext i32 %8 to i64
%10 = load i64, i64* %4
%11 = lshr i64 %10, 16
%12 = and i64 %11, 31
%13 = xor i64 %9, %12
%14 = trunc i64 %13 to i32
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 3
store i32 %14, i32* %16
%17 = load i64, i64* %4
%18 = lshr i64 %17, 8
%19 = and i64 %18, 255
%20 = trunc i64 %19 to i32
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 4
store i32 %20, i32* %22
%23 = load i64, i64* %4
%24 = lshr i64 %23, 0
%25 = and i64 %24, 255
%26 = trunc i64 %25 to i32
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i64 5
store i32 %26, i32* %28
ret void
}

LLVM IR (-O2):
define void @set_block_number_in_tweak(i32* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 3
%4 = load i32, i32* %3
%5 = and i32 %4, 224
%6 = trunc i64 %1 to i32
%7 = lshr i32 %6, 16
%8 = and i32 %7, 31
%9 = or i32 %5, %8
store i32 %9, i32* %3
%10 = lshr i32 %6, 8
%11 = and i32 %10, 255
%12 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %11, i32* %12
%13 = and i32 %6, 255
%14 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %13, i32* %14
ret void
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int bufbsdsock_read(int, char *, void *);
int16_t bufbsdsock_getch(void *data) {
  char ch;
  if (1 != bufbsdsock_read(1, &ch, data))
    return -1;
  return ch;
}


x86 assembly (clang, -O0):
<bufbsdsock_getch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    -0x11(%rbp),%rsi
call   1030 <bufbsdsock_read@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     1149 <bufbsdsock_getch+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1150 <bufbsdsock_getch+0x40>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bufbsdsock_getch>:
push   %rax
mov    %rdi,%rdx
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
call   1030 <bufbsdsock_read@plt>
cmp    $0x1,%eax
movsbl 0x7(%rsp),%ecx
mov    $0xffffffff,%eax
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bufbsdsock_getch(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @bufbsdsock_read(i32 1, i8* %4, i8* %5)
%7 = icmp ne i32 1, %6
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %12
9: ; preds = %1
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @bufbsdsock_getch(i8* %0) {
%2 = alloca i8
%3 = call i32 @bufbsdsock_read(i32 1, i8* %2, i8* %0)
%4 = icmp eq i32 %3, 1
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = select i1 %4, i32 %6, i32 -1
ret i32 %7
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int syscon_clear_multprec_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(447, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_clear_multprec_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1bf,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_clear_multprec_system>:
mov    $0x1bf,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @syscon_clear_multprec_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 447, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @syscon_clear_multprec_system() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 447, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
void *realloc(void *, size_t);
void *cr_default_realloc(void *opaque, void *ptr, size_t size) {
  return realloc(ptr, size);
}


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

x86 assembly (clang, -O2):
<cr_default_realloc>:
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @cr_default_realloc(i8* nocapture readnone %0, i8* nocapture %1, i64 %2) {
%4 = tail call i8* @realloc(i8* %1, i64 %2)
ret i8* %4
}
int scandir(const char *dirp, struct dirent ***namelist,
            int (*filter)(const struct dirent *),
            int (*compar)(const struct dirent **, const struct dirent **)) {}


x86 assembly (clang, -O0):
<scandir>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.dirent = type opaque
define i32 @scandir(i8* %0, %struct.dirent*** %1, i32 (%struct.dirent*)* %2, i32 (%struct.dirent**, %struct.dirent**)* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.dirent***
%8 = alloca i32 (%struct.dirent*)*
%9 = alloca i32 (%struct.dirent**, %struct.dirent**)*
store i8* %0, i8** %6
store %struct.dirent*** %1, %struct.dirent**** %7
store i32 (%struct.dirent*)* %2, i32 (%struct.dirent*)** %8
store i32 (%struct.dirent**, %struct.dirent**)* %3, i32 (%struct.dirent**, %struct.dirent**)** %9
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
%struct.dirent = type opaque
define i32 @scandir(i8* nocapture readnone %0, %struct.dirent*** nocapture readnone %1, i32 (%struct.dirent*)* nocapture readnone %2, i32 (%struct.dirent**, %struct.dirent**)* nocapture readnone %3) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("usage:\n");
  printf("  suffix -d <directory>\n");
  printf("  suffix -h display help\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"usage:\0A\00"
@.str.1 = [25 x i8] c" suffix -d <directory>\0A\00"
@.str.2 = [26 x i8] c" suffix -h display help\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"usage:\00"
@str.3 = [24 x i8] c" suffix -d <directory>\00"
@str.4 = [25 x i8] c" suffix -h display help\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
ret void
}
long labs(long a) {
  if (a < 0)
    return -a;
  return a;
}


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1122 <labs+0x22>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112a <labs+0x2a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @labs(i64 %0) {
%2 = alloca i64
%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 %9
6: ; preds = %1
%7 = load i64, i64* %3
%8 = sub nsw i64 0, %7
store i64 %8, i64* %2
br label %11
9: ; preds = %1
%10 = load i64, i64* %3
store i64 %10, i64* %2
br label %11
11: ; preds = %9, %6
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* 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: yess [-dmsuv] -f <filename>.yo\n");
  fprintf(stderr, "       yess [-dsuv] -i <filename>.mem\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    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"usage: yess [-dmsuv] -f <filename>.yo\0A\00"
@.str.1 = [39 x i8] c" yess [-dsuv] -i <filename>.mem\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"usage: yess [-dmsuv] -f <filename>.yo\0A\00"
@.str.1 = [39 x i8] c" yess [-dsuv] -i <filename>.mem\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 ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
void testB() {}


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

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

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

LLVM IR (-O2):
define void @testB() {
ret void
}
/* Variables and functions */
scalar_t__ isalpha(char);
char tolower(char);
void strToLower(char *p) {
  for (; *p; ++p) {
    if (isalpha(*p))
      *p = tolower(*p);
  }
}


x86 assembly (clang, -O0):
<strToLower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1179 <strToLower+0x59>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     1163 <strToLower+0x43>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    1168 <strToLower+0x48>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <strToLower+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strToLower>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1155 <strToLower+0x35>
mov    %rdi,%rbx
jmp    113c <strToLower+0x1c>
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1155 <strToLower+0x35>
movsbl %al,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
je     1130 <strToLower+0x10>
movsbl (%rbx),%edi
call   1030 <tolower@plt>
mov    %al,(%rbx)
jmp    1130 <strToLower+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @strToLower(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %18, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %21
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = call i64 @isalpha(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = call signext i8 @tolower(i8 signext %14)
%16 = load i8*, i8** %2
store i8 %15, i8* %16
br label %17
17: ; preds = %12, %7
br label %18
18: ; preds = %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
br label %3
21: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @strToLower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = tail call i64 @isalpha(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i8, i8* %6
%11 = tail call signext i8 @tolower(i8 signext %10)
store i8 %11, i8* %6
br label %12
12: ; preds = %4, %9
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %12, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int kacharf(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  char kelime[100];
  gets(kelime);
  printf("Kelime harf sayisi >> %d", kacharf(kelime));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1050 <kacharf@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Kelime harf sayisi >> %d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = call i32 @kacharf(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Kelime harf sayisi >> %d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = call i32 @kacharf(i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
int rl_forward_char(count, key)
int count, key;
{ return (rl_forward_byte(count, key)); }


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

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

LLVM IR (-O0):
define i32 @rl_forward_char(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 (i32, i32, ...) bitcast (i32 (...)* @rl_forward_byte to i32 (i32, i32, ...)*)(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @rl_forward_char(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @rl_forward_byte to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
void *dlsym(void *, char const *);
void *__dlvsym(void *handle, const char *name, const char *version_str) {
  return dlsym(handle, name);
}


x86 assembly (clang, -O0):
<__dlvsym>:
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
call   1030 <dlsym@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__dlvsym>:
jmp    1030 <dlsym@plt>

LLVM IR (-O0):
define i8* @__dlvsym(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 = call i8* @dlsym(i8* %7, i8* %8)
ret i8* %9
}

LLVM IR (-O2):
define i8* @__dlvsym(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = tail call i8* @dlsym(i8* %0, i8* %1)
ret i8* %4
}
void oc_backtrace_symbols_fd(void *const *buffer, int size, int fd) {}


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

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

LLVM IR (-O0):
define void @oc_backtrace_symbols_fd(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @oc_backtrace_symbols_fd(i8** nocapture %0, i32 %1, i32 %2) {
ret void
}
float smooth(float t) { return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f); }


x86 assembly (clang, -O0):
<smooth>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  0xeda(%rip),%xmm3
mulss  %xmm3,%xmm2
movss  0xed2(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xeba(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<smooth>:
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
movss  0xeed(%rip),%xmm2
mulss  %xmm0,%xmm2
addss  0xee5(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  0xedd(%rip),%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @smooth(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fmul float %3, %4
%6 = load float, float* %2
%7 = fmul float %5, %6
%8 = load float, float* %2
%9 = load float, float* %2
%10 = call float @llvm.fmuladd.f32(float %9, float 6.000000e+00, float -1.500000e+01)
%11 = call float @llvm.fmuladd.f32(float %8, float %10, float 1.000000e+01)
%12 = fmul float %7, %11
ret float %12
}

LLVM IR (-O2):
define float @smooth(float %0) {
%2 = fmul float %0, %0
%3 = fmul float %2, %0
%4 = tail call float @llvm.fmuladd.f32(float %0, float 6.000000e+00, float -1.500000e+01)
%5 = tail call float @llvm.fmuladd.f32(float %0, float %4, float 1.000000e+01)
%6 = fmul float %3, %5
ret float %6
}
/* Type definitions */
struct json_buffer {
  int dummy;
};
struct json_attr_t {
  int dummy;
};

/* Variables and functions */
int json_internal_read_object(struct json_buffer *, struct json_attr_t const *,
                              int /*<<< orphan*/ *, int /*<<< orphan*/);
int json_read_object(struct json_buffer *jb, const struct json_attr_t *attrs) {
  int st;
  st = json_internal_read_object(jb, attrs, NULL, 0);
  return st;
}


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

x86 assembly (clang, -O2):
<json_read_object>:
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <json_internal_read_object@plt>

LLVM IR (-O0):
%struct.json_buffer = type { i32 }
%struct.json_attr_t = type { i32 }
define i32 @json_read_object(%struct.json_buffer* %0, %struct.json_attr_t* %1) {
%3 = alloca %struct.json_buffer*
%4 = alloca %struct.json_attr_t*
%5 = alloca i32
store %struct.json_buffer* %0, %struct.json_buffer** %3
store %struct.json_attr_t* %1, %struct.json_attr_t** %4
%6 = load %struct.json_buffer*, %struct.json_buffer** %3
%7 = load %struct.json_attr_t*, %struct.json_attr_t** %4
%8 = call i32 @json_internal_read_object(%struct.json_buffer* %6, %struct.json_attr_t* %7, i32* null, i32 0)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
%struct.json_buffer = type { i32 }
%struct.json_attr_t = type { i32 }
define i32 @json_read_object(%struct.json_buffer* %0, %struct.json_attr_t* %1) {
%3 = tail call i32 @json_internal_read_object(%struct.json_buffer* %0, %struct.json_attr_t* %1, i32* null, i32 0)
ret i32 %3
}
int hide_zero(int n) { return (n == 0) ? ' ' : n; }


x86 assembly (clang, -O0):
<hide_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    111e <hide_zero+0x1e>
mov    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <hide_zero+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hide_zero>:
test   %edi,%edi
mov    $0x20,%eax
cmovne %edi,%eax
ret

LLVM IR (-O0):
define i32 @hide_zero(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = load i32, i32* %2
br label %8
8: ; preds = %6, %5
%9 = phi i32 [ 32, %5 ], [ %7, %6 ]
ret i32 %9
}

LLVM IR (-O2):
define i32 @hide_zero(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 32, i32 %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  int i = 5;
  while (i > 0) {
    puts("Hello, world!");
    i = i - 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1151 <main+0x41>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
br label %7
7: ; preds = %10, %2
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %6
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %6
br label %7
14: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ Elf32_Ehdr;

/* Variables and functions */
Elf32_Ehdr *elf_get_header(void *elf_image) { return (Elf32_Ehdr *)elf_image; }


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

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

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

LLVM IR (-O2):
define i32* @elf_get_header(i8* readnone %0) {
%2 = bitcast i8* %0 to i32*
ret i32* %2
}
/* Variables and functions */
long fib(int);
long fib_recursive(int n) {
  long result;
  static long map[45];
  if (n == 0)
    result = 0;
  else if (n == 1)
    result = 1;
  else
    result = fib(n - 1) + fib(n - 2);
  return result;
}


x86 assembly (clang, -O0):
<fib_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1132 <fib_recursive+0x22>
movq   $0x0,-0x10(%rbp)
jmp    1176 <fib_recursive+0x66>
cmpl   $0x1,-0x4(%rbp)
jne    1149 <fib_recursive+0x39>
movq   $0x1,-0x10(%rbp)
jmp    1171 <fib_recursive+0x61>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1176 <fib_recursive+0x66>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_recursive>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
je     1126 <fib_recursive+0x16>
mov    %edi,%ebx
cmp    $0x1,%edi
jne    112a <fib_recursive+0x1a>
mov    $0x1,%eax
jmp    1142 <fib_recursive+0x32>
xor    %eax,%eax
jmp    1142 <fib_recursive+0x32>
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
mov    %rax,%r14
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1030 <fib@plt>
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@fib_recursive.map = internal global [45 x i64] zeroinitializer
define i64 @fib_recursive(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 0, i64* %3
br label %20
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %7
store i64 1, i64* %3
br label %19
11: ; preds = %7
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 1
%14 = call i64 @fib(i32 %13)
%15 = load i32, i32* %2
%16 = sub nsw i32 %15, 2
%17 = call i64 @fib(i32 %16)
%18 = add nsw i64 %14, %17
store i64 %18, i64* %3
br label %19
19: ; preds = %11, %10
br label %20
20: ; preds = %19, %6
%21 = load i64, i64* %3
ret i64 %21
}

LLVM IR (-O2):
define i64 @fib_recursive(i32 %0) {
switch i32 %0, label %3 [
i32 0, label %9
i32 1, label %2
]
2: ; preds = %1
br label %9
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i64 @fib(i32 %4)
%6 = add nsw i32 %0, -2
%7 = tail call i64 @fib(i32 %6)
%8 = add nsw i64 %7, %5
br label %9
9: ; preds = %1, %2, %3
%10 = phi i64 [ 1, %2 ], [ %8, %3 ], [ 0, %1 ]
ret i64 %10
}
/* Variables and functions */
float endian_read_float(void *, int /*<<< orphan*/);
float be_read_float(void *ptr) { return endian_read_float(ptr, 0); }


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

x86 assembly (clang, -O2):
<be_read_float>:
xor    %esi,%esi
jmp    1030 <endian_read_float@plt>

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

LLVM IR (-O2):
define float @be_read_float(i8* %0) {
%2 = tail call float @endian_read_float(i8* %0, i32 0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
size_t write(int, void *, size_t);
void Write(int fd, void *ptr, size_t nbytes) {
  if (write(fd, ptr, nbytes) != nbytes)
    err_sys("write error");
}


x86 assembly (clang, -O0):
<Write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <write@plt>
cmp    -0x18(%rbp),%rax
je     1159 <Write+0x39>
lea    0xeac(%rip),%rdi
call   1030 <err_sys@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Write>:
push   %rbx
mov    %rdx,%rbx
call   1040 <write@plt>
cmp    %rbx,%rax
jne    1130 <Write+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
pop    %rbx
jmp    1030 <err_sys@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"write error\00"
define void @Write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @write(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @err_sys(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ glutTimerFunc(int, void (*)(int), int);
void OnTimer(int value) {
  glutPostRedisplay();
  glutTimerFunc(20, &OnTimer, value);
}


x86 assembly (clang, -O0):
<OnTimer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <glutPostRedisplay@plt>
mov    -0x4(%rbp),%edx
mov    $0x14,%edi
mov    0x2e9f(%rip),%rsi
call   1030 <glutTimerFunc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OnTimer>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <glutPostRedisplay@plt>
mov    0x2eaf(%rip),%rsi
mov    $0x14,%edi
mov    %ebx,%edx
pop    %rbx
jmp    1030 <glutTimerFunc@plt>

LLVM IR (-O0):
define void @OnTimer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @glutPostRedisplay()
%4 = load i32, i32* %2
%5 = call i32 @glutTimerFunc(i32 20, void (i32)* @OnTimer, i32 %4)
ret void
}

LLVM IR (-O2):
define void @OnTimer(i32 %0) {
%2 = tail call i32 (...) @glutPostRedisplay()
%3 = tail call i32 @glutTimerFunc(i32 20, void (i32)* @OnTimer, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pic_mask(int);
void irq_mask(int irq) { pic_mask(irq); }


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

x86 assembly (clang, -O2):
<irq_mask>:
jmp    1030 <pic_mask@plt>

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

LLVM IR (-O2):
define void @irq_mask(i32 %0) {
%2 = tail call i32 @pic_mask(i32 %0)
ret void
}
float lerp(float from, float to, float val) { return from + val * (to - from); }


x86 assembly (clang, -O0):
<lerp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerp>:
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @lerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %6
%9 = load float, float* %5
%10 = load float, float* %4
%11 = fsub float %9, %10
%12 = call float @llvm.fmuladd.f32(float %8, float %11, float %7)
ret float %12
}

LLVM IR (-O2):
define float @lerp(float %0, float %1, float %2) {
%4 = fsub float %1, %0
%5 = tail call float @llvm.fmuladd.f32(float %2, float %4, float %0)
ret float %5
}
void trivial_function(void) {}


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

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

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

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

/* Variables and functions */
int FUTEX_PRIVATE_FLAG;
int FUTEX_WAKE_OP;
int futex(int *, int, int, struct timespec *, int *, int);
int futex_wake_op(int *uaddr1, int to_wake1, int *uaddr2, int to_wake2,
                  int op) {
  return futex(uaddr1, FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG, to_wake1,
               (struct timespec *)(unsigned long)to_wake2, uaddr2, op);
}


x86 assembly (clang, -O0):
<futex_wake_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
mov    0x2e9a(%rip),%rax
or     (%rax),%esi
mov    -0xc(%rbp),%edx
movslq -0x1c(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9d
call   1030 <futex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<futex_wake_op>:
mov    %r8d,%r9d
mov    %rdx,%r8
mov    %esi,%edx
mov    0x2ec1(%rip),%rax
mov    0x2eb2(%rip),%rsi
mov    (%rsi),%esi
or     (%rax),%esi
movslq %ecx,%rcx
jmp    1030 <futex@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@FUTEX_WAKE_OP = global i32 0
@FUTEX_PRIVATE_FLAG = global i32 0
define i32 @futex_wake_op(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* @FUTEX_WAKE_OP
%13 = load i32, i32* @FUTEX_PRIVATE_FLAG
%14 = or i32 %12, %13
%15 = load i32, i32* %7
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to %struct.timespec*
%19 = load i32*, i32** %8
%20 = load i32, i32* %10
%21 = call i32 @futex(i32* %11, i32 %14, i32 %15, %struct.timespec* %18, i32* %19, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@FUTEX_WAKE_OP = global i32 0
@FUTEX_PRIVATE_FLAG = global i32 0
define i32 @futex_wake_op(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4) {
%6 = load i32, i32* @FUTEX_WAKE_OP
%7 = load i32, i32* @FUTEX_PRIVATE_FLAG
%8 = or i32 %7, %6
%9 = sext i32 %3 to i64
%10 = inttoptr i64 %9 to %struct.timespec*
%11 = tail call i32 @futex(i32* %0, i32 %8, i32 %1, %struct.timespec* %10, i32* %2, i32 %4)
ret i32 %11
}
void av_frame_new_side_data() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_new_side_data() {
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, char);
main() {
  char c;
  c = getchar();
  printf("%d", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x1(%rbp)
lea    0xec7(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %al,%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %1)
ret i32 0
}
int test_imm_8Euint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x8E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_8Euint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $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_8Euint64_highword_mem>:
testb  $0x8e,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_8Euint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr 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_8Euint64_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
}
int test_imm_BDint16_mem(short *val) {
  return ((*val) & (-0xBD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_BDint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff43,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_BDint16_mem>:
movzwl (%rdi),%eax
test   $0xff43,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_BDint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -189
%7 = icmp ne i32 %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_BDint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -189
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void foo_1_2_2_2_1_1_1_1_2() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void print_usage(FILE *stream) {
  fprintf(stream,
          "Usage: hashdup [OPTIONS] FILE [FILE...]\nIdentify duplicate "
          "hashes.\n\n -o FILE   output file (default: %s)\n -q        quiet; "
          "suppress all output except for errors\n\n -V        print version "
          "information and exit\n -h        display this help and "
          "exit\n\nProject home page: <http://code.google.com/p/onion/>\n",
          "duphashes");
}


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

x86 assembly (clang, -O2):
<print_usage>:
lea    0xee9(%rip),%rsi
lea    0x100f(%rip),%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [301 x i8] c"Usage: hashdup [OPTIONS] FILE [FILE...]\0AIdentify duplicate hashes.\0A\0A -o FILE output file (default: %s)\0A -q quiet; suppress all output except for errors\0A\0A -V print version information and exit\0A -h display this help and exit\0A\0AProject home page: <http://code.google.com/p/onion/>\0A\00"
@.str.1 = [10 x i8] c"duphashes\00"
define void @print_usage(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([301 x i8], [301 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [301 x i8] c"Usage: hashdup [OPTIONS] FILE [FILE...]\0AIdentify duplicate hashes.\0A\0A -o FILE output file (default: %s)\0A -q quiet; suppress all output except for errors\0A\0A -V print version information and exit\0A -h display this help and exit\0A\0AProject home page: <http://code.google.com/p/onion/>\0A\00"
@.str.1 = [10 x i8] c"duphashes\00"
define void @print_usage(i32* nocapture %0) {
%2 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([301 x i8], [301 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}