xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("usage: sha <file> [<file> ...]\n");
  printf("\tThis program will display the message digest\n");
  printf("\tfor files using the Secure Hashing Algorithm (SHA-1).\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1c(%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    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1d(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"usage: sha <file> [<file> ...]\0A\00"
@.str.1 = [47 x i8] c"\09This program will display the message digest\0A\00"
@.str.2 = [56 x i8] c"\09for files using the Secure Hashing Algorithm (SHA-1).\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"usage: sha <file> [<file> ...]\00"
@str.3 = [46 x i8] c"\09This program will display the message digest\00"
@str.4 = [55 x i8] c"\09for files using the Secure Hashing Algorithm (SHA-1).\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.4, i64 0, i64 0))
ret void
}
int any_one(unsigned x) { return !!x; }


x86 assembly (clang, -O0):
<any_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<any_one>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @any_one(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct openpgp_publickey {
  int dummy;
};
struct onak_dbctx {
  int dummy;
};
struct keyarray {
  int dummy;
};

/* Variables and functions */
int keyring_update_keys(struct onak_dbctx *dbctx,
                        struct openpgp_publickey **keys,
                        struct keyarray *blacklist, bool updateonly,
                        bool sendsync) {
  return 0;
}


x86 assembly (clang, -O0):
<keyring_update_keys>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.onak_dbctx = type { i32 }
%struct.openpgp_publickey = type { i32 }
%struct.keyarray = type { i32 }
define i32 @keyring_update_keys(%struct.onak_dbctx* %0, %struct.openpgp_publickey** %1, %struct.keyarray* %2, i32 %3, i32 %4) {
%6 = alloca %struct.onak_dbctx*
%7 = alloca %struct.openpgp_publickey**
%8 = alloca %struct.keyarray*
%9 = alloca i32
%10 = alloca i32
store %struct.onak_dbctx* %0, %struct.onak_dbctx** %6
store %struct.openpgp_publickey** %1, %struct.openpgp_publickey*** %7
store %struct.keyarray* %2, %struct.keyarray** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret i32 0
}

LLVM IR (-O2):
%struct.onak_dbctx = type { i32 }
%struct.openpgp_publickey = type { i32 }
%struct.keyarray = type { i32 }
define i32 @keyring_update_keys(%struct.onak_dbctx* nocapture readnone %0, %struct.openpgp_publickey** nocapture readnone %1, %struct.keyarray* nocapture readnone %2, i32 %3, i32 %4) {
ret i32 0
}
/* Variables and functions */
int bar(int /*<<< orphan*/);
int bar2(double);
int main() { return bar(0) + bar2(0.0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <bar@plt>
mov    %eax,-0x8(%rbp)
xorps  %xmm0,%xmm0
call   1030 <bar2@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1040 <bar@plt>
mov    %eax,%ebx
xorps  %xmm0,%xmm0
call   1030 <bar2@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @bar(i32 0)
%3 = call i32 @bar2(double 0.000000e+00)
%4 = add nsw i32 %2, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @bar(i32 0)
%2 = tail call i32 @bar2(double 0.000000e+00)
%3 = add nsw i32 %2, %1
ret i32 %3
}
/* Variables and functions */
double fabs(double);
int is_zero(double d) { return fabs(d) < 0.000000001; }


x86 assembly (clang, -O0):
<is_zero>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movaps 0xefb(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xedf(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_zero>:
andpd  0xef8(%rip),%xmm0
movsd  0xf00(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define i32 @is_zero(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fabs.f64(double %3)
%5 = fcmp olt double %4, 1.000000e-09
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_zero(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp olt double %2, 1.000000e-09
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ escape(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char msg[] = "Tab here 	ok";
  char to[1000];
  escape(to, msg);
  printf("%s\n", to);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec0(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x400(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <escape@plt>
lea    -0x400(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
movabs $0x6b6f0920657265,%rax
mov    %rax,0x5(%rsp)
movabs $0x6572656820626154,%rax
65 72 65
mov    %rax,(%rsp)
lea    0x10(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <escape@plt>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.msg = [13 x i8] c"Tab here \09ok\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca [1000 x i8]
store i32 0, i32* %1
%4 = bitcast [13 x i8]* %2 to i8*
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%7 = call i32 @escape(i8* %5, i8* %6)
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.msg = [13 x i8] c"Tab here \09ok\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @escape(i8* %4, i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
int test_imm_86uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x86 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_86uint64_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, 134
%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_86uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 8781824
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ModuleInit();
void ApplicationRun(void) { ModuleInit(); }


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

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

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

LLVM IR (-O2):
define void @ApplicationRun() {
%1 = tail call i32 (...) @ModuleInit()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ xcb_window_t;
typedef int /*<<< orphan*/ xcb_get_property_reply_t;
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ xcb_ewmh_get_window_from_reply(int /*<<< orphan*/ *,
                                                  int /*<<< orphan*/ *);
uint8_t xcb_ewmh_get_active_window_from_reply(xcb_window_t *active_window,
                                              xcb_get_property_reply_t *r) {
  return xcb_ewmh_get_window_from_reply(active_window, r);
}


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

x86 assembly (clang, -O2):
<xcb_ewmh_get_active_window_from_reply>:
jmp    1030 <xcb_ewmh_get_window_from_reply@plt>

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

LLVM IR (-O2):
define i32 @xcb_ewmh_get_active_window_from_reply(i32* %0, i32* %1) {
%3 = tail call i32 @xcb_ewmh_get_window_from_reply(i32* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_panic__();
void err(int eval, const char *fmt, ...) { __coverity_panic__(); }


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

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

LLVM IR (-O0):
define void @err(i32 %0, i8* %1, ...) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = call i32 (...) @__coverity_panic__()
ret void
}

LLVM IR (-O2):
define void @err(i32 %0, i8* nocapture readnone %1, ...) {
%3 = tail call i32 (...) @__coverity_panic__()
ret void
}
int test_imm_E5int64_lowword_reg(long long val) {
  return ((val) & (0xE5 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E5int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 229
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ PRINT_LOG(char *, char *);
void PRINT_ERR(char *y) { PRINT_LOG("ERR ", y); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"ERR \00"
define void @PRINT_ERR(i8* %0) {
%2 = tail call i32 @PRINT_LOG(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void __attribute__((used)) f5() {}


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

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

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @f5 to i8*)], section "llvm.metadata"
define void @f5() {
ret void
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @f5 to i8*)], section "llvm.metadata"
define void @f5() {
ret void
}
/* Variables and functions */
int count_blocks(int const *, int);
int total_block_size(int const *, int);
int average_block_size(const int *mem, int avg_allocs) {
  int average = 0;
  if (avg_allocs) {
    average = total_block_size(mem, 1) / (count_blocks(mem, 1) + 1);
  } else {
    average = total_block_size(mem, 0) / (count_blocks(mem, 0) + 1);
  }
  return average;
}


x86 assembly (clang, -O0):
<average_block_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1172 <average_block_size+0x52>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <total_block_size@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <count_blocks@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    1199 <average_block_size+0x79>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <total_block_size@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <count_blocks@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<average_block_size>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %ebp,%ebp
test   %esi,%esi
setne  %bpl
mov    %ebp,%esi
call   1040 <total_block_size@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <count_blocks@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    %r14d,%eax
cltd
idiv   %ecx
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @average_block_size(i32* %0, i32 %1) {
%3 = icmp ne i32 %1, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @total_block_size(i32* %0, i32 %4)
%6 = tail call i32 @count_blocks(i32* %0, i32 %4)
%7 = add nsw i32 %6, 1
%8 = sdiv i32 %5, %7
ret i32 %8
}
void test_fprintf() {}


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

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

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

LLVM IR (-O2):
define void @test_fprintf() {
ret void
}
int MarsagliaXORV(int x) {
  if (x == 0)
    x = 1;
  x ^= x << 6;
  x ^= ((unsigned)x) >> 21;
  x ^= x << 7;
  return x;
}


x86 assembly (clang, -O0):
<MarsagliaXORV>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1118 <MarsagliaXORV+0x18>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x6,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x15,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x7,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MarsagliaXORV>:
test   %edi,%edi
mov    $0x1,%eax
cmovne %edi,%eax
mov    %eax,%ecx
shl    $0x6,%ecx
xor    %eax,%ecx
mov    %ecx,%edx
shr    $0x15,%edx
xor    %ecx,%edx
mov    %edx,%eax
shl    $0x7,%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define i32 @MarsagliaXORV(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
store i32 1, i32* %2
br label %6
6: ; preds = %5, %1
%7 = load i32, i32* %2
%8 = shl i32 %7, 6
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = lshr i32 %11, 21
%13 = load i32, i32* %2
%14 = xor i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = shl i32 %15, 7
%17 = load i32, i32* %2
%18 = xor i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @MarsagliaXORV(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 1, i32 %0
%4 = shl i32 %3, 6
%5 = xor i32 %4, %3
%6 = lshr i32 %5, 21
%7 = xor i32 %6, %5
%8 = shl i32 %7, 7
%9 = xor i32 %8, %7
ret i32 %9
}
/* Variables and functions */
int read_dcdheader(char *);
int initialize_read_xyz(char *filename) { return read_dcdheader(filename); }


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

x86 assembly (clang, -O2):
<initialize_read_xyz>:
jmp    1030 <read_dcdheader@plt>

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

LLVM IR (-O2):
define i32 @initialize_read_xyz(i8* %0) {
%2 = tail call i32 @read_dcdheader(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "\nvoucher [-c cfg_file] -k public_key voucher\nvoucher [-c "
                  "cfg_file] -p private_key roll count\nvoucher -s -k "
                  "private_key\nvoucher -g keylen\n\n");
  exit(1);
}


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    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [139 x i8] c"\0Avoucher [-c cfg_file] -k public_key voucher\0Avoucher [-c cfg_file] -p private_key roll count\0Avoucher -s -k private_key\0Avoucher -g keylen\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [139 x i8] c"\0Avoucher [-c cfg_file] -k public_key voucher\0Avoucher [-c cfg_file] -p private_key roll count\0Avoucher -s -k private_key\0Avoucher -g keylen\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ swap_uint32(int /*<<< orphan*/);
uint32_t GetChunkLength(uint8_t const *chunk_ptr) {
  uint32_t chunk_length = ((uint32_t *)chunk_ptr)[0];
  chunk_length = swap_uint32(chunk_length);
  return chunk_length;
}


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

x86 assembly (clang, -O2):
<GetChunkLength>:
mov    (%rdi),%edi
jmp    1030 <swap_uint32@plt>

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

LLVM IR (-O2):
define i32 @GetChunkLength(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @swap_uint32(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ bswap64(int /*<<< orphan*/);
void be64_to_cpus(uint64_t *p) { *p = bswap64(*p); }


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

x86 assembly (clang, -O2):
<be64_to_cpus>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <bswap64@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @be64_to_cpus(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @bswap64(i32 %2)
store i32 %3, i32* %0
ret void
}
int test_imm_74int8_mem(signed char *val) {
  return ((*val) & (-0x74 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_74int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -116
%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_74int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -116
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int cos(double);
float Sine__easeInOut(float t, float b, float c, float d, float p0, float p1) {
  return -c / 2 * (cos(3.1415926535897932384626433832795 * t / d) - 1) + b;
}


x86 assembly (clang, -O0):
<Sine__easeInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xeb8(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe96(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
movss  -0x1c(%rbp),%xmm0
sub    $0x1,%eax
cvtsi2ss %eax,%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sine__easeInOut>:
push   %rax
movss  %xmm1,0x4(%rsp)
mulss  0xee1(%rip),%xmm2
movss  %xmm2,(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xed8(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Sine__easeInOut(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%13 = load float, float* %9
%14 = fneg float %13
%15 = fdiv float %14, 2.000000e+00
%16 = load float, float* %7
%17 = fpext float %16 to double
%18 = fmul double 0x400921FB54442D18, %17
%19 = load float, float* %10
%20 = fpext float %19 to double
%21 = fdiv double %18, %20
%22 = call i32 @cos(double %21)
%23 = sub nsw i32 %22, 1
%24 = sitofp i32 %23 to float
%25 = load float, float* %8
%26 = call float @llvm.fmuladd.f32(float %15, float %24, float %25)
ret float %26
}

LLVM IR (-O2):
define float @Sine__easeInOut(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fmul float %2, -5.000000e-01
%8 = fpext float %0 to double
%9 = fmul double %8, 0x400921FB54442D18
%10 = fpext float %3 to double
%11 = fdiv double %9, %10
%12 = tail call i32 @cos(double %11)
%13 = add nsw i32 %12, -1
%14 = sitofp i32 %13 to float
%15 = tail call float @llvm.fmuladd.f32(float %7, float %14, float %1)
ret float %15
}
int setuid(int uid) {}


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

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

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

LLVM IR (-O2):
define i32 @setuid(i32 %0) {
ret i32 undef
}
int fegetround() { return 0; }


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

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

LLVM IR (-O0):
define i32 @fegetround() {
ret i32 0
}

LLVM IR (-O2):
define i32 @fegetround() {
ret i32 0
}
char *langRomTypeMegaRam256() { return "256kB MegaRAM"; }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"256kB MegaRAM\00"
define i8* @langRomTypeMegaRam256() {
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [14 x i8] c"256kB MegaRAM\00"
define i8* @langRomTypeMegaRam256() {
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int g() { abort(); }


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

x86 assembly (clang, -O2):
<g>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @g() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define i32 @g() {
%1 = tail call i32 (...) @abort()
unreachable
}
unsigned char BCD2UpperCh(unsigned char bcd) { return ((bcd >> 4) + '0'); }


x86 assembly (clang, -O0):
<BCD2UpperCh>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
add    $0x30,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BCD2UpperCh>:
shr    $0x4,%dil
lea    0x30(%rdi),%eax
ret

LLVM IR (-O0):
define zeroext i8 @BCD2UpperCh(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = add nsw i32 %5, 48
%7 = trunc i32 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define zeroext i8 @BCD2UpperCh(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = or i8 %2, 48
ret i8 %3
}
/* Variables and functions */
int rand();
int rnd(int min, int max) {
  if (max != min)
    return (rand() % (max - min) + min);
  else
    return (max);
}


x86 assembly (clang, -O0):
<rnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1145 <rnd+0x35>
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0xc(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x4(%rbp)
jmp    114b <rnd+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%eax
mov    %esi,%ebp
sub    %edi,%ebp
je     112b <rnd+0x1b>
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%eax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @rnd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, %0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i32 (...) @rand()
%6 = sub nsw i32 %1, %0
%7 = srem i32 %5, %6
%8 = add nsw i32 %7, %0
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ %8, %4 ], [ %1, %2 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ path;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int, char const *);
unsigned int sysfs_read_file(char *, char *, size_t);
unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname,
                                     char *buf, size_t buflen) {
  char path[255];
  snprintf(path, sizeof(path),
           "/sys/devices/system/cpu/"
           "cpu%u/cpufreq/%s",
           cpu, fname);
  return sysfs_read_file(path, buf, buflen);
}


x86 assembly (clang, -O0):
<sysfs_cpufreq_read_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    $0xff,%esi
lea    0xeac(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <sysfs_read_file@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysfs_cpufreq_read_file>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r8
mov    %edi,%ecx
lea    0xec2(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xff,%esi
call   1030 <snprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <sysfs_read_file@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"/sys/devices/system/cpu/cpu%u/cpufreq/%s\00"
define i32 @sysfs_cpufreq_read_file(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca [255 x i8]
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%11 = load i32, i32* %5
%12 = load i8*, i8** %6
%13 = call i32 @snprintf(i8* %10, i32 255, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %12)
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i64, i64* %8
%17 = call i32 @sysfs_read_file(i8* %14, i8* %15, i64 %16)
ret i32 %17
}

LLVM IR (-O2):
@.str = [41 x i8] c"/sys/devices/system/cpu/cpu%u/cpufreq/%s\00"
define i32 @sysfs_cpufreq_read_file(i32 %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca [255 x i8]
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 255, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
%8 = call i32 @sysfs_read_file(i8* %6, i8* %2, i64 %3)
ret i32 %8
}
int test_imm_7Fuint16_mem(unsigned short *val) {
  return ((*val) & (-0x7F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_7Fuint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -127
%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_7Fuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -127
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void other_function(void) {
  int i = 1;
  i++;
}


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

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

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

LLVM IR (-O2):
define void @other_function() {
ret void
}
/* Variables and functions */
int minDistance(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", minDistance("ALGORITHM", "ALTRUISTIC"));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1040 <minDistance@plt>
lea    0xec5(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [10 x i8] c"ALGORITHM\00"
@.str.2 = [11 x i8] c"ALTRUISTIC\00"
define i32 @main() {
%1 = tail call i32 @minDistance(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void minipack_pack_str32(void *ptr, uint32_t length, size_t *sz) {
  *sz = 5;
  *((uint8_t *)ptr) = 0xDB;
  *((uint32_t *)(ptr + 1)) = htonl(length);
}


x86 assembly (clang, -O0):
<minipack_pack_str32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x5,(%rax)
mov    -0x8(%rbp),%rax
movl   $0xdb,(%rax)
mov    -0xc(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_pack_str32>:
push   %rbx
mov    %rdi,%rbx
movq   $0x5,(%rdx)
movl   $0xdb,(%rdi)
mov    %esi,%edi
call   1030 <htonl@plt>
mov    %eax,0x1(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @minipack_pack_str32(i8* %0, i32 %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64* %2, i64** %6
%7 = load i64*, i64** %6
store i64 5, i64* %7
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32 219, i32* %9
%10 = load i32, i32* %5
%11 = call i32 @htonl(i32 %10)
%12 = load i8*, i8** %4
%13 = getelementptr i8, i8* %12, i64 1
%14 = bitcast i8* %13 to i32*
store i32 %11, i32* %14
ret void
}

LLVM IR (-O2):
define void @minipack_pack_str32(i8* nocapture writeonly %0, i32 %1, i64* nocapture writeonly %2) {
store i64 5, i64* %2
%4 = bitcast i8* %0 to i32*
store i32 219, i32* %4
%5 = tail call i32 @htonl(i32 %1)
%6 = getelementptr i8, i8* %0, i64 1
%7 = bitcast i8* %6 to i32*
store i32 %5, i32* %7
ret void
}
int is_prime(int a) {
  if (a < 1)
    return -1;
  int i;
  for (i = 2; i < a; i++) {
    if (a % i == 0) {
      if (a == 2)
        return 1;
      else
        return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    111d <is_prime+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <is_prime+0x7c>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1175 <is_prime+0x75>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1162 <is_prime+0x62>
cmpl   $0x2,-0x8(%rbp)
jne    1156 <is_prime+0x56>
movl   $0x1,-0x4(%rbp)
jmp    117c <is_prime+0x7c>
movl   $0x0,-0x4(%rbp)
jmp    117c <is_prime+0x7c>
jmp    1167 <is_prime+0x67>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <is_prime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
test   %edi,%edi
jle    1133 <is_prime+0x33>
mov    $0x1,%ecx
cmp    $0x3,%edi
jb     1130 <is_prime+0x30>
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1139 <is_prime+0x39>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <is_prime+0x20>
mov    %ecx,%eax
ret
mov    $0xffffffff,%eax
ret
xor    %ecx,%ecx
cmp    $0x2,%edi
sete   %cl
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 2
br i1 %4, label %7, label %15
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %15, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7
%13 = icmp eq i32 %0, 2
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %5, %3, %12, %1
%16 = phi i32 [ -1, %1 ], [ %14, %12 ], [ 1, %3 ], [ 1, %5 ]
ret i32 %16
}
int fast_open_filter(struct file *file, struct inode *inode) { return 0; }


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

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

LLVM IR (-O0):
%struct.file = type opaque
%struct.inode = type opaque
define i32 @fast_open_filter(%struct.file* %0, %struct.inode* %1) {
%3 = alloca %struct.file*
%4 = alloca %struct.inode*
store %struct.file* %0, %struct.file** %3
store %struct.inode* %1, %struct.inode** %4
ret i32 0
}

LLVM IR (-O2):
%struct.file = type opaque
%struct.inode = type opaque
define i32 @fast_open_filter(%struct.file* nocapture readnone %0, %struct.inode* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *wmalloc(int size) {
  void *ptr = NULL;
  if (!size)
    return NULL;
  ptr = (void *)malloc(size);
  if (NULL != ptr) {
    memset(ptr, 0, size);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<wmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114a <wmalloc+0x2a>
movq   $0x0,-0x8(%rbp)
jmp    1178 <wmalloc+0x58>
mov    -0xc(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     1170 <wmalloc+0x50>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmalloc>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     1144 <wmalloc+0x24>
mov    %edi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1146 <wmalloc+0x26>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
jmp    1146 <wmalloc+0x26>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @wmalloc(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i64 @malloc(i32 %0)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @memset(i8* %5, i32 0, i32 %0)
br label %9
9: ; preds = %3, %7, %1
%10 = phi i8* [ null, %1 ], [ %5, %7 ], [ %5, %3 ]
ret i8* %10
}
/* Variables and functions */
int test_fifo(int, int, int);
int test_fifo_1_2_3(int argc, const char **argv) { return test_fifo(1, 2, 3); }


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

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

LLVM IR (-O0):
define i32 @test_fifo_1_2_3(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @test_fifo(i32 1, i32 2, i32 3)
ret i32 %5
}

LLVM IR (-O2):
define i32 @test_fifo_1_2_3(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @test_fifo(i32 1, i32 2, i32 3)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __uportsys_recv(int, void *, size_t, int,
                                   int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
ssize_t recv(int sd, void *buf, size_t len, int flags) {
  return __uportsys_recv(sd, buf, len, flags, &errno);
}


x86 assembly (clang, -O0):
<recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2ea5(%rip),%r8
call   1030 <__uportsys_recv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recv>:
mov    0x2ec9(%rip),%r8
jmp    1030 <__uportsys_recv@plt>

LLVM IR (-O0):
@errno = global i32 0
define i32 @recv(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = load i32, i32* %8
%13 = call i32 @__uportsys_recv(i32 %9, i8* %10, i64 %11, i32 %12, i32* @errno)
ret i32 %13
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @recv(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i32 @__uportsys_recv(i32 %0, i8* %1, i64 %2, i32 %3, i32* @errno)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ initI2C();
int /*<<< orphan*/ pwmDelayTimeInit();
int /*<<< orphan*/ pwmInit();
int /*<<< orphan*/ pwmInitialPosition();
void init() {
  initI2C();
  pwmInit();
  pwmDelayTimeInit();
  pwmInitialPosition();
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <initI2C@plt>
mov    $0x0,%al
call   1050 <pwmInit@plt>
mov    $0x0,%al
call   1030 <pwmDelayTimeInit@plt>
mov    $0x0,%al
call   1040 <pwmInitialPosition@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
xor    %eax,%eax
call   1060 <initI2C@plt>
xor    %eax,%eax
call   1050 <pwmInit@plt>
xor    %eax,%eax
call   1030 <pwmDelayTimeInit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <pwmInitialPosition@plt>

LLVM IR (-O0):
define void @init() {
%1 = call i32 (...) @initI2C()
%2 = call i32 (...) @pwmInit()
%3 = call i32 (...) @pwmDelayTimeInit()
%4 = call i32 (...) @pwmInitialPosition()
ret void
}

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @initI2C()
%2 = tail call i32 (...) @pwmInit()
%3 = tail call i32 (...) @pwmDelayTimeInit()
%4 = tail call i32 (...) @pwmInitialPosition()
ret void
}