xunge/DecIR huggingface dataset:
/* Variables and functions */
int maximum(int *);
int extractmax(int *queue) {
  int maxkey;
  maxkey = maximum(queue);
  return maxkey;
}


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

x86 assembly (clang, -O2):
<extractmax>:
jmp    1030 <maximum@plt>

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

LLVM IR (-O2):
define i32 @extractmax(i32* %0) {
%2 = tail call i32 @maximum(i32* %0)
ret i32 %2
}
const char *plugin_api_info_weechat_site_download_cb(void *data,
                                                     const char *info_name,
                                                     const char *arguments) {
  (void)data;
  (void)info_name;
  (void)arguments;
  return "https://weechat.org/download";
}


x86 assembly (clang, -O0):
<plugin_api_info_weechat_site_download_cb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xee9(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [29 x i8] c"https://weechat.org/download\00"
define i8* @plugin_api_info_weechat_site_download_cb(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
ret i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [29 x i8] c"https://weechat.org/download\00"
define i8* @plugin_api_info_weechat_site_download_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
ret i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
int /*<<< orphan*/ access(char *, int /*<<< orphan*/);
int fileCheck(char *fileName) { return (!access(fileName, F_OK)); }


x86 assembly (clang, -O0):
<fileCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileCheck>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @fileCheck(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @F_OK
%5 = call i32 @access(i8* %3, i32 %4)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @fileCheck(i8* nocapture %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
double asin_acos(double, int);
double acos(double x) { return asin_acos(x, 1); }


x86 assembly (clang, -O0):
<acos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%edi
call   1030 <asin_acos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acos>:
mov    $0x1,%edi
jmp    1030 <asin_acos@plt>

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

LLVM IR (-O2):
define double @acos(double %0) {
%2 = tail call double @asin_acos(double %0, i32 1)
ret double %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ do_cpuid(int /*<<< orphan*/, int /*<<< orphan*/ *);
uint32_t cpuid_edx(uint32_t op) {
  uint32_t regs[4];
  do_cpuid(op, regs);
  return regs[3];
}


x86 assembly (clang, -O0):
<cpuid_edx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <do_cpuid@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_edx>:
sub    $0x18,%rsp
mov    %rsp,%rsi
call   1030 <do_cpuid@plt>
mov    0xc(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cpuid_edx(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%6 = call i32 @do_cpuid(i32 %4, i32* %5)
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @cpuid_edx(i32 %0) {
%2 = alloca [4 x i32]
%3 = bitcast [4 x i32]* %2 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%5 = call i32 @do_cpuid(i32 %0, i32* %4)
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
%7 = load i32, i32* %6
ret i32 %7
}
/* Type definitions */
struct strerr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ strerr_warn(char const *, char const *, char const *,
                               char const *, char const *, char const *,
                               struct strerr const *);
void strerr_die(int e, const char *x1, const char *x2, const char *x3,
                const char *x4, const char *x5, const char *x6,
                const struct strerr *se) {
  strerr_warn(x1, x2, x3, x4, x5, x6, se);
  exit(e);
}


x86 assembly (clang, -O0):
<strerr_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <strerr_warn@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<strerr_die>:
push   %rbx
sub    $0x10,%rsp
mov    %r9,%rax
mov    %edi,%ebx
mov    0x20(%rsp),%r9
mov    0x28(%rsp),%rdi
mov    %rdi,(%rsp)
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%rcx
mov    %rax,%r8
call   1030 <strerr_warn@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.strerr = type { i32 }
define void @strerr_die(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, %struct.strerr* %7) {
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca %struct.strerr*
store i32 %0, i32* %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i8* %6, i8** %15
store %struct.strerr* %7, %struct.strerr** %16
%17 = load i8*, i8** %10
%18 = load i8*, i8** %11
%19 = load i8*, i8** %12
%20 = load i8*, i8** %13
%21 = load i8*, i8** %14
%22 = load i8*, i8** %15
%23 = load %struct.strerr*, %struct.strerr** %16
%24 = call i32 @strerr_warn(i8* %17, i8* %18, i8* %19, i8* %20, i8* %21, i8* %22, %struct.strerr* %23)
%25 = load i32, i32* %9
%26 = call i32 @exit(i32 %25)
unreachable
}

LLVM IR (-O2):
%struct.strerr = type { i32 }
define void @strerr_die(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, %struct.strerr* %7) {
%9 = tail call i32 @strerr_warn(i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, %struct.strerr* %7)
%10 = tail call i32 @exit(i32 %0)
unreachable
}
int test_mul(int x) {
  int j;
  j = x * 5;
  return j;
}


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

x86 assembly (clang, -O2):
<test_mul>:
lea    (%rdi,%rdi,4),%eax
ret

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

LLVM IR (-O2):
define i32 @test_mul(i32 %0) {
%2 = mul nsw i32 %0, 5
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ func_6(int, char *, unsigned long);
void func_5(int a, char *b, unsigned long c) { func_6(a, b, c); }


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

x86 assembly (clang, -O2):
<func_5>:
jmp    1030 <func_6@plt>

LLVM IR (-O0):
define void @func_5(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 i32 @func_6(i32 %7, i8* %8, i64 %9)
ret void
}

LLVM IR (-O2):
define void @func_5(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @func_6(i32 %0, i8* %1, i64 %2)
ret void
}
/* Type definitions */
typedef char *int64_t;

/* Variables and functions */
int64_t zero_sub32(int64_t in) {
  int64_t out;
  asm("sub %%eax, %%ebx" : "=b"(out) : "a"(in), "0"(0));
  return out;
}


x86 assembly (clang, -O0):
<zero_sub32>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%ebx
sub    %eax,%ebx
mov    %rbx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero_sub32>:
push   %rbx
mov    %rdi,%rax
xor    %ebx,%ebx
sub    %eax,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @zero_sub32(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* asm "sub %eax, %ebx", "={bx},{ax},0,~{dirflag},~{fpsr},~{flags}"(i8* %4, i64 0)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define i8* @zero_sub32(i8* readnone %0) {
%2 = tail call i8* asm "sub %eax, %ebx", "={bx},{ax},0,~{dirflag},~{fpsr},~{flags}"(i8* %0, i64 0)
ret i8* %2
}
void send_delete(struct state *st) {}


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

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

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

LLVM IR (-O2):
%struct.state = type opaque
define void @send_delete(%struct.state* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_invalid_stuff();
int /*<<< orphan*/ do_valid_stuff();
scalar_t__ validate_serial();
int main(int argc, char *argv[]) {
  if (validate_serial())
    do_valid_stuff();
  else
    do_invalid_stuff();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <validate_serial@plt>
cmp    $0x0,%rax
je     1163 <main+0x33>
mov    $0x0,%al
call   1030 <do_valid_stuff@plt>
jmp    116a <main+0x3a>
mov    $0x0,%al
call   1040 <do_invalid_stuff@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <validate_serial@plt>
test   %rax,%rax
je     1146 <main+0x16>
xor    %eax,%eax
call   1030 <do_valid_stuff@plt>
jmp    114d <main+0x1d>
xor    %eax,%eax
call   1040 <do_invalid_stuff@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i64 (...) @validate_serial()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @do_valid_stuff()
br label %12
10: ; preds = %2
%11 = call i32 (...) @do_invalid_stuff()
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @validate_serial()
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @do_valid_stuff()
br label %9
7: ; preds = %2
%8 = tail call i32 (...) @do_invalid_stuff()
br label %9
9: ; preds = %7, %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int r;
  srand(time(NULL));
  r = rand() % 11;
  printf("Random Number from 0 to 10: %d", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
movslq %eax,%rsi
imul   $0x2e8ba2e9,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%eax
sub    %eax,%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Random Number from 0 to 10: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 11
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Random Number from 0 to 10: %d\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 11
%5 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
__attribute__((weak)) int _close(int file) {
  do {
    (void)(file);
  } while (0);
  return -1;
}


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

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

LLVM IR (-O0):
define weak i32 @_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
%4 = load i32, i32* %2
br label %5
5: ; preds = %3
ret i32 -1
}

LLVM IR (-O2):
define weak i32 @_close(i32 %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ link_failure_roundl();
scalar_t__ roundl(long double);
void test_roundl(long double ld) {
  if (roundl(ld) != roundl(ld))
    link_failure_roundl();
}


x86 assembly (clang, -O0):
<test_roundl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <roundl@plt>
mov    %rax,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <roundl@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     1163 <test_roundl+0x43>
mov    $0x0,%al
call   1030 <link_failure_roundl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_roundl>:
push   %rbx
sub    $0x20,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fstpt  (%rsp)
call   1040 <roundl@plt>
mov    %rax,%rbx
fldt   0x14(%rsp)
fstpt  (%rsp)
call   1040 <roundl@plt>
cmp    %rax,%rbx
jne    1151 <test_roundl+0x31>
add    $0x20,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1030 <link_failure_roundl@plt>

LLVM IR (-O0):
define void @test_roundl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i64 @roundl(x86_fp80 %3)
%5 = load x86_fp80, x86_fp80* %2
%6 = call i64 @roundl(x86_fp80 %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_roundl()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_roundl(x86_fp80 %0) {
%2 = tail call i64 @roundl(x86_fp80 %0)
%3 = tail call i64 @roundl(x86_fp80 %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_roundl()
br label %7
7: ; preds = %5, %1
ret void
}
int test_imm_44uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x44 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_44uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0x44,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_44uint64_midword_reg>:
test   $0x440000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_44uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 4456448
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void reserved_error() {
  __asm__ __volatile__("cli");
  SetTextColor(0x04 | 0x08, 0x00);
  kprintf("\nERROR: reserved error\n");
  do {
    __asm__ __volatile__("cli  \n\t"
                         "hlt");
  } while (1 == 1);
}


x86 assembly (clang, -O0):
<reserved_error>:
push   %rbp
mov    %rsp,%rbp
cli
mov    $0xc,%edi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <SetTextColor@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <kprintf@plt>
cli
hlt
mov    $0x1,%al
test   $0x1,%al
jne    1141 <reserved_error+0x21>
jmp    1152 <reserved_error+0x32>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reserved_error>:
push   %rax
cli
mov    $0xc,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <SetTextColor@plt>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <kprintf@plt>
xchg   %ax,%ax
cli
hlt
jmp    1140 <reserved_error+0x20>

LLVM IR (-O0):
@.str = [24 x i8] c"\0AERROR: reserved error\0A\00"
define void @reserved_error() {
%1 = call i32 (i32, i32, ...) bitcast (i32 (...)* @SetTextColor to i32 (i32, i32, ...)*)(i32 12, i32 0)
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %4, %0
br label %4
4: ; preds = %3
br i1 true, label %3, label %5
5: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0AERROR: reserved error\0A\00"
define void @reserved_error() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @SetTextColor to i32 (i32, i32, ...)*)(i32 12, i32 0)
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
tail call void asm sideeffect "cli \0A\09hlt", "~{dirflag},~{fpsr},~{flags}"()
br label %3
}
double fdiv64(double x, double y) { return x / y; }


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

x86 assembly (clang, -O2):
<fdiv64>:
divsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @fdiv64(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
int main(void) {
  int x;
  int y;
  int z;
  x - y - z - 42;
  !x *y + z < x != 42 < x + y * !x;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = sub nsw i32 %4, %5
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = sub nsw i32 %8, 42
%10 = load i32, i32* %1
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
%14 = load i32, i32* %2
%15 = mul nsw i32 %13, %14
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %1
%19 = icmp slt i32 %17, %18
%20 = zext i1 %19 to i32
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = load i32, i32* %1
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
%26 = zext i1 %25 to i32
%27 = mul nsw i32 %22, %26
%28 = add nsw i32 %21, %27
%29 = icmp slt i32 42, %28
%30 = zext i1 %29 to i32
%31 = icmp ne i32 %20, %30
%32 = zext i1 %31 to i32
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void end_function() { printf("}\n\n"); }


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

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

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

LLVM IR (-O2):
@str = [3 x i8] c"}\0A\00"
define void @end_function() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ot(char *);
defextern() { ot("EXTERN "); }


x86 assembly (clang, -O0):
<defextern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ot@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"EXTERN \00"
define i32 @defextern() {
%1 = alloca i32
%2 = call i32 @ot(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [8 x i8] c"EXTERN \00"
define i32 @defextern() {
%1 = tail call i32 @ot(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void a_barrier() { __asm__ __volatile__("" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @a_barrier() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
void closeFB(int fh) {
  Log(7, "function:%s --- paralist{fh=%d}\n", __func__, fh);
  close(fh);
}


x86 assembly (clang, -O0):
<closeFB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x7,%edi
lea    0xec6(%rip),%rsi
lea    0xee0(%rip),%rdx
mov    $0x0,%al
call   1040 <Log@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeFB>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rsi
lea    0xef0(%rip),%rdx
mov    $0x7,%edi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <Log@plt>
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <close@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"function:%s --- paralist{fh=%d}\0A\00"
@__func__.closeFB = [8 x i8] c"closeFB\00"
define void @closeFB(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @Log to i32 (i32, i8*, i8*, i32, ...)*)(i32 7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.closeFB, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"function:%s --- paralist{fh=%d}\0A\00"
@__func__.closeFB = [8 x i8] c"closeFB\00"
define void @closeFB(i32 %0) {
%2 = tail call i32 (i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @Log to i32 (i32, i8*, i8*, i32, ...)*)(i32 7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.closeFB, i64 0, i64 0), i32 %0)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %0)
ret void
}
void ff_hevc_put_hevc_uni_qpel_v4_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_qpel_v4_10_sse4() {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint32_t;

/* Variables and functions */
uint32_t load_32(const void *p) {
  const uint8_t *p8 = p;
  return p8[0] + (p8[1] << 8) + (p8[2] << 16) + (p8[3] << 24);
}


x86 assembly (clang, -O0):
<load_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_32>:
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%ecx
shl    $0x8,%eax
add    (%rdi),%eax
shl    $0x10,%ecx
add    %eax,%ecx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @load_32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = add nsw i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 8
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = shl i32 %11, 16
%13 = add nsw i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 12
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = shl i32 %16, 24
%18 = add nsw i32 %13, %17
ret i32 %18
}
/* Type definitions */
struct iovec {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ INLINE_SYSCALL(
    int /*<<< orphan*/ (*)(int, struct iovec const *, int, int /*<<< orphan*/),
    int, int, struct iovec const *, int, int /*<<< orphan*/);
ssize_t pwritev(int fd, const struct iovec *vector, int count, off_t offset) {
  return INLINE_SYSCALL(pwritev, 4, fd, vector, count, offset);
}


x86 assembly (clang, -O0):
<pwritev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    0x2ead(%rip),%rdi
mov    $0x4,%esi
call   1030 <INLINE_SYSCALL@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwritev>:
mov    %ecx,%r9d
mov    %edx,%r8d
mov    %rsi,%rcx
mov    %edi,%edx
mov    0x2ec6(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <INLINE_SYSCALL@plt>

LLVM IR (-O0):
%struct.iovec = type { i32 }
define i32 @pwritev(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.iovec*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store %struct.iovec* %1, %struct.iovec** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load %struct.iovec*, %struct.iovec** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @INLINE_SYSCALL(i32 (i32, %struct.iovec*, i32, i32)* @pwritev, i32 4, i32 %9, %struct.iovec* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
define i32 @pwritev(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = tail call i32 @INLINE_SYSCALL(i32 (i32, %struct.iovec*, i32, i32)* @pwritev, i32 4, i32 %0, %struct.iovec* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
float ml_rand();
float ml_uniform_rand(float min, float max) {
  return min + ml_rand() * (max - min);
}


x86 assembly (clang, -O0):
<ml_uniform_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <ml_rand@plt>
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ml_uniform_rand>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <ml_rand@plt>
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
subss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @ml_uniform_rand(float %0, float %1) {
%3 = tail call float (...) @ml_rand()
%4 = fsub float %1, %0
%5 = tail call float @llvm.fmuladd.f32(float %3, float %4, float %0)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ last_error();
int /*<<< orphan*/ printc_err(char *, char const *, int /*<<< orphan*/);
void pr_error(const char *prefix) {
  printc_err("%s: %s\n", prefix, last_error());
}


x86 assembly (clang, -O0):
<pr_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <last_error@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xeb8(%rip),%rdi
call   1030 <printc_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_error>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <last_error@plt>
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <printc_err@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %s\0A\00"
define void @pr_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (...) @last_error()
%5 = call i32 @printc_err(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\0A\00"
define void @pr_error(i8* %0) {
%2 = tail call i32 (...) @last_error()
%3 = tail call i32 @printc_err(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2)
ret void
}
void leave() { ; }


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

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

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

LLVM IR (-O2):
define void @leave() {
ret void
}
int btshasp_hashname(char *str) {
  char *s;
  int t;
  s = str;
  t = 0;
  while (*s)
    t = t * 4093 + (*s++);
  t = t * 4093;
  return (t);
}


x86 assembly (clang, -O0):
<btshasp_hashname>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <btshasp_hashname+0x47>
imul   $0xffd,-0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <btshasp_hashname+0x17>
imul   $0xffd,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<btshasp_hashname>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <btshasp_hashname+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %eax,%ecx
imul   $0xffd,%ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <btshasp_hashname+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @btshasp_hashname(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %5 to i32
%10 = add nsw i32 %6, %9
%11 = mul i32 %10, 4093
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Type definitions */
struct page {
  int dummy;
};

/* Variables and functions */
int PageChecked(struct page *);
int is_cold_data(struct page *page) { return PageChecked(page); }


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

x86 assembly (clang, -O2):
<is_cold_data>:
jmp    1030 <PageChecked@plt>

LLVM IR (-O0):
%struct.page = type { i32 }
define i32 @is_cold_data(%struct.page* %0) {
%2 = alloca %struct.page*
store %struct.page* %0, %struct.page** %2
%3 = load %struct.page*, %struct.page** %2
%4 = call i32 @PageChecked(%struct.page* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.page = type { i32 }
define i32 @is_cold_data(%struct.page* %0) {
%2 = tail call i32 @PageChecked(%struct.page* %0)
ret i32 %2
}
/* Variables and functions */
int rand();
float crand(void) { return (rand() & 32767) * (2.0 / 32767) - 1; }


x86 assembly (clang, -O0):
<crand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
and    $0x7fff,%eax
cvtsi2sd %eax,%xmm0
movsd  0xed4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<crand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x7fff,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xed7(%rip),%xmm0
addsd  0xed7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @crand() {
%1 = call i32 (...) @rand()
%2 = and i32 %1, 32767
%3 = sitofp i32 %2 to double
%4 = call double @llvm.fmuladd.f64(double %3, double 0x3F10002000400080, double -1.000000e+00)
%5 = fptrunc double %4 to float
ret float %5
}

LLVM IR (-O2):
define float @crand() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 32767
%3 = sitofp i32 %2 to double
%4 = tail call double @llvm.fmuladd.f64(double %3, double 0x3F10002000400080, double -1.000000e+00)
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ traceprint(char *, int, int);
void row_prt_offtab(int *offtab, int n) {
  int i;
  for (i = 0; i < n; i++) {
    traceprint("offtab[-%d] : %d \n", i, offtab[-i]);
  }
}


x86 assembly (clang, -O0):
<row_prt_offtab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115e <row_prt_offtab+0x4e>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb5(%rip),%rdi
call   1030 <traceprint@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <row_prt_offtab+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<row_prt_offtab>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    114a <row_prt_offtab+0x3a>
mov    %rdi,%r14
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <traceprint@plt>
add    $0x1,%rbx
add    $0xfffffffffffffffc,%r14
cmp    %rbx,%r12
jne    1130 <row_prt_offtab+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"offtab[-%d] : %d \0A\00"
define void @row_prt_offtab(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %13, %6 ]
%8 = sub nsw i64 0, %7
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = trunc i64 %7 to i32
%12 = tail call i32 @traceprint(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %10)
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %6, %2
ret void
}
int readPath(struct proc_s *proc) { return 1; }


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

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

LLVM IR (-O0):
%struct.proc_s = type opaque
define i32 @readPath(%struct.proc_s* %0) {
%2 = alloca %struct.proc_s*
store %struct.proc_s* %0, %struct.proc_s** %2
ret i32 1
}

LLVM IR (-O2):
%struct.proc_s = type opaque
define i32 @readPath(%struct.proc_s* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int dwarf_get_ACCESS_name(unsigned int, char const **);
char const *ellipname(int, unsigned int, char const *, char *, int);
const char *get_ACCESS_name(unsigned int val_in, int printonerr) {
  const char *v = 0;
  int res = dwarf_get_ACCESS_name(val_in, &v);
  return ellipname(res, val_in, v, "ACCESS", printonerr);
}


x86 assembly (clang, -O0):
<get_ACCESS_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <dwarf_get_ACCESS_name@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%r8d
lea    0xea6(%rip),%rcx
call   1040 <ellipname@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ACCESS_name>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1030 <dwarf_get_ACCESS_name@plt>
mov    (%rsp),%rdx
lea    0xebe(%rip),%rcx
mov    %eax,%edi
mov    %ebp,%esi
mov    %ebx,%r8d
call   1040 <ellipname@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"ACCESS\00"
define i8* @get_ACCESS_name(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i8* null, i8** %5
%7 = load i32, i32* %3
%8 = call i32 @dwarf_get_ACCESS_name(i32 %7, i8** %5)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = load i32, i32* %3
%11 = load i8*, i8** %5
%12 = load i32, i32* %4
%13 = call i8* @ellipname(i32 %9, i32 %10, i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i8* %13
}

LLVM IR (-O2):
@.str = [7 x i8] c"ACCESS\00"
define i8* @get_ACCESS_name(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @dwarf_get_ACCESS_name(i32 %0, i8** %3)
%6 = load i8*, i8** %3
%7 = call i8* @ellipname(i32 %5, i32 %0, i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ gfx_set_display_video_downscale(unsigned short,
                                                   unsigned short);
int redcloud_set_video_vertical_downscale(unsigned short srch,
                                          unsigned short dsth) {
  gfx_set_display_video_downscale(srch, dsth);
  return 0;
}


x86 assembly (clang, -O0):
<redcloud_set_video_vertical_downscale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movzwl -0x4(%rbp),%esi
call   1030 <gfx_set_display_video_downscale@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @redcloud_set_video_vertical_downscale(i16 zeroext %0, i16 zeroext %1) {
%3 = tail call i32 @gfx_set_display_video_downscale(i16 zeroext %0, i16 zeroext %1)
ret i32 0
}
/* Type definitions */
struct evp_test {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EVP_PKEY_verify_init;
int pkey_test_init(struct evp_test *, char const *, int, int /*<<< orphan*/,
                   int /*<<< orphan*/);
int verify_test_init(struct evp_test *t, const char *name) {
  return pkey_test_init(t, name, 1, EVP_PKEY_verify_init, 0);
}


x86 assembly (clang, -O0):
<verify_test_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2eb9(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
xor    %r8d,%r8d
call   1030 <pkey_test_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_test_init>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
xor    %r8d,%r8d
jmp    1030 <pkey_test_init@plt>

LLVM IR (-O0):
%struct.evp_test = type { i32 }
@EVP_PKEY_verify_init = global i32 0
define i32 @verify_test_init(%struct.evp_test* %0, i8* %1) {
%3 = alloca %struct.evp_test*
%4 = alloca i8*
store %struct.evp_test* %0, %struct.evp_test** %3
store i8* %1, i8** %4
%5 = load %struct.evp_test*, %struct.evp_test** %3
%6 = load i8*, i8** %4
%7 = load i32, i32* @EVP_PKEY_verify_init
%8 = call i32 @pkey_test_init(%struct.evp_test* %5, i8* %6, i32 1, i32 %7, i32 0)
ret i32 %8
}

LLVM IR (-O2):
%struct.evp_test = type { i32 }
@EVP_PKEY_verify_init = global i32 0
define i32 @verify_test_init(%struct.evp_test* %0, i8* %1) {
%3 = load i32, i32* @EVP_PKEY_verify_init
%4 = tail call i32 @pkey_test_init(%struct.evp_test* %0, i8* %1, i32 1, i32 %3, i32 0)
ret i32 %4
}
double my_round(double x, unsigned int digits) {
  if (digits > 0) {
    return my_round(x * 10.0, digits - 1) / 10.0;
  } else {
    return x;
  }
}


x86 assembly (clang, -O0):
<my_round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jbe    1158 <my_round+0x48>
movsd  0xece(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%edi
sub    $0x1,%edi
call   1030 <my_round@plt>
movsd  0xeb6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1162 <my_round+0x52>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_round>:
test   %edi,%edi
je     1131 <my_round+0x21>
push   %rax
mulsd  0xee3(%rip),%xmm0
add    $0xffffffff,%edi
call   1030 <my_round@plt>
divsd  0xed3(%rip),%xmm0
add    $0x8,%rsp
ret

LLVM IR (-O0):
define double @my_round(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp ugt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load double, double* %4
%10 = fmul double %9, 1.000000e+01
%11 = load i32, i32* %5
%12 = sub i32 %11, 1
%13 = call double @my_round(double %10, i32 %12)
%14 = fdiv double %13, 1.000000e+01
store double %14, double* %3
br label %17
15: ; preds = %2
%16 = load double, double* %4
store double %16, double* %3
br label %17
17: ; preds = %15, %8
%18 = load double, double* %3
ret double %18
}

LLVM IR (-O2):
define double @my_round(double %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2, %6
%5 = phi double [ %10, %6 ], [ %0, %2 ]
ret double %5
6: ; preds = %2
%7 = fmul double %0, 1.000000e+01
%8 = add i32 %1, -1
%9 = tail call double @my_round(double %7, i32 %8)
%10 = fdiv double %9, 1.000000e+01
br label %4
}
void closepipe(pv) int *pv;
{
  close(pv[0]);
  close(pv[1]);
}


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

x86 assembly (clang, -O2):
<closepipe>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
xor    %eax,%eax
call   1030 <close@plt>
mov    0x4(%rbx),%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @closepipe(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %5)
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %9)
ret void
}

LLVM IR (-O2):
define void @closepipe(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %2)
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %5)
ret void
}