xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int32_t;
typedef int int16_t;

/* Variables and functions */
void tcdiv_nopersp(int32_t ss, int32_t st, int32_t sw, int32_t *sss,
                   int32_t *sst) {
  *sss = (((int16_t)(ss))) & 0x1ffff;
  *sst = (((int16_t)(st))) & 0x1ffff;
}


x86 assembly (clang, -O0):
<tcdiv_nopersp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1ffff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
and    $0x1ffff,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcdiv_nopersp>:
and    $0x1ffff,%edi
mov    %edi,(%rcx)
and    $0x1ffff,%esi
mov    %esi,(%r8)
ret

LLVM IR (-O0):
define void @tcdiv_nopersp(i32 %0, i32 %1, i32 %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = and i32 %11, 131071
%13 = load i32*, i32** %9
store i32 %12, i32* %13
%14 = load i32, i32* %7
%15 = and i32 %14, 131071
%16 = load i32*, i32** %10
store i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @tcdiv_nopersp(i32 %0, i32 %1, i32 %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = and i32 %0, 131071
store i32 %6, i32* %3
%7 = and i32 %1, 131071
store i32 %7, i32* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ vfdprintf(int, char const *, int /*<<< orphan*/);
void vwarnx(const char *f, va_list a) { vfdprintf(2, f, a); }


x86 assembly (clang, -O0):
<vwarnx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x2,%edi
call   1030 <vfdprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vwarnx>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0x2,%edi
jmp    1030 <vfdprintf@plt>

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

LLVM IR (-O2):
define void @vwarnx(i8* %0, i32 %1) {
%3 = tail call i32 @vfdprintf(i32 2, i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ macro_new_table_test();
int /*<<< orphan*/ macro_new_test();
int main() {
  macro_new_test();
  macro_new_table_test();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <macro_new_test@plt>
mov    $0x0,%al
call   1030 <macro_new_table_test@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @macro_new_test()
%2 = call i32 (...) @macro_new_table_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @macro_new_test()
%2 = tail call i32 (...) @macro_new_table_test()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_palindrome(char const *, int, int);
void test12(void) {
  const char a[] = {'1', '2', '3', '2', '1'};
  test_palindrome(a, sizeof(a), 1);
  test_palindrome(a, sizeof(a), 2);
  printf("\n");
}


x86 assembly (clang, -O0):
<test12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x5(%rbp),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1040 <test_palindrome@plt>
lea    -0x5(%rbp),%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1040 <test_palindrome@plt>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test12>:
push   %rbx
sub    $0x10,%rsp
movb   $0x31,0xc(%rsp)
movl   $0x32333231,0x8(%rsp)
32
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1040 <test_palindrome@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1040 <test_palindrome@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test12.a = [5 x i8] c"12321"
@.str = [2 x i8] c"\0A\00"
define void @test12() {
%1 = alloca [5 x i8]
%2 = bitcast [5 x i8]* %1 to i8*
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = call i32 @test_palindrome(i8* %3, i32 5, i32 1)
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%6 = call i32 @test_palindrome(i8* %5, i32 5, i32 2)
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test12.a = [5 x i8] c"12321"
define void @test12() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @test_palindrome(i8* %2, i32 5, i32 1)
%4 = call i32 @test_palindrome(i8* %2, i32 5, i32 2)
%5 = call i32 @putchar(i32 10)
ret void
}
int whisper_close() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @whisper_close() {
ret i32 0
}
void mus_set_big_endian_short(unsigned char *j, short x) {
  unsigned char *ox;
  ox = (unsigned char *)&x;
  j[0] = ox[0];
  j[1] = ox[1];
}


x86 assembly (clang, -O0):
<mus_set_big_endian_short>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
lea    -0xa(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_set_big_endian_short>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @mus_set_big_endian_short(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i8*
store i8* %0, i8** %3
store i16 %1, i16* %4
%6 = bitcast i16* %4 to i8*
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
ret void
}

LLVM IR (-O2):
define void @mus_set_big_endian_short(i8* nocapture writeonly %0, i16 signext %1) {
%3 = trunc i16 %1 to i8
%4 = lshr i16 %1, 8
%5 = trunc i16 %4 to i8
store i8 %3, i8* %0
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ connect_to_compiler();
int /*<<< orphan*/ disconnect_from_compiler();
scalar_t__ update_code();
int main() {
  connect_to_compiler();
  while (update_code()) {
  }
  disconnect_from_compiler();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <connect_to_compiler@plt>
mov    $0x0,%al
call   1030 <update_code@plt>
cmp    $0x0,%rax
je     115c <main+0x2c>
jmp    1146 <main+0x16>
mov    $0x0,%al
call   1050 <disconnect_from_compiler@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <connect_to_compiler@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <update_code@plt>
test   %rax,%rax
jne    1140 <main+0x10>
xor    %eax,%eax
call   1050 <disconnect_from_compiler@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @connect_to_compiler()
br label %2
2: ; preds = %2, %0
%3 = tail call i64 (...) @update_code()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %2
5: ; preds = %2
%6 = tail call i32 (...) @disconnect_from_compiler()
ret i32 0
}
int baddu4(int a, int b) { return (a + b) & 0xff; }


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

x86 assembly (clang, -O2):
<baddu4>:
add    %esi,%edi
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @baddu4(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 = add nsw i32 %5, %6
%8 = and i32 %7, 255
ret i32 %8
}

LLVM IR (-O2):
define i32 @baddu4(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = and i32 %3, 255
ret i32 %4
}
int test_imm_D3int64_midword_reg(long long val) {
  return ((val >> 16) & (0xD3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D3int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 211
%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_D3int64_midword_reg(i64 %0) {
%2 = and i64 %0, 13828096
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void test119_BlinkMilli_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test119_BlinkMilli_targetInit__I() {
ret void
}
void dsi_wait_dsi2_pll_active(void) {}


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

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

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

LLVM IR (-O2):
define void @dsi_wait_dsi2_pll_active() {
ret void
}
/* Variables and functions */
double exp(double);
double phi(double z) { return (0.3989422804014327 * exp(-.5 * z * z)); }


x86 assembly (clang, -O0):
<phi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xec1(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phi>:
push   %rax
movsd  0xee7(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0xeda(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @phi(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double -5.000000e-01, %3
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = call double @exp(double %6)
%8 = fmul double 0x3FD9884533D43651, %7
ret double %8
}

LLVM IR (-O2):
define double @phi(double %0) {
%2 = fmul double %0, -5.000000e-01
%3 = fmul double %2, %0
%4 = tail call double @exp(double %3)
%5 = fmul double %4, 0x3FD9884533D43651
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ decrypt_archive(char *, char *);
void main() { decrypt_archive("sanket", "sanket"); }


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

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    %rdi,%rsi
jmp    1030 <decrypt_archive@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"sanket\00"
define void @main() {
%1 = tail call i32 @decrypt_archive(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
int test2(int b) { return ~b + b; }


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

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

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

LLVM IR (-O2):
define i32 @test2(i32 %0) {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_EXTENSIONS;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_EXTENSIONS_it;
int i2d_X509_EXTENSIONS(X509_EXTENSIONS *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_EXTENSIONS_it);
}


x86 assembly (clang, -O0):
<i2d_X509_EXTENSIONS>:
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    0x2eb1(%rip),%rdx
call   1030 <ASN1_item_i2d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2d_X509_EXTENSIONS>:
mov    0x2ec9(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

LLVM IR (-O0):
@X509_EXTENSIONS_it = global i32 0
define i32 @i2d_X509_EXTENSIONS(i32* %0, i8** %1) {
%3 = alloca i32*
%4 = alloca i8**
store i32* %0, i32** %3
store i8** %1, i8*** %4
%5 = load i32*, i32** %3
%6 = load i8**, i8*** %4
%7 = call i32 @ASN1_item_i2d(i32* %5, i8** %6, i32* @X509_EXTENSIONS_it)
ret i32 %7
}

LLVM IR (-O2):
@X509_EXTENSIONS_it = global i32 0
define i32 @i2d_X509_EXTENSIONS(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @X509_EXTENSIONS_it)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG(int /*<<< orphan*/, char *);
int /*<<< orphan*/ exit(int);
void sys_srandom(unsigned int seed) {
  DEBUG(0, ("Error - no srandom function available !\n"));
  exit(1);
}


x86 assembly (clang, -O0):
<sys_srandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
lea    0xecc(%rip),%rsi
call   1030 <DEBUG@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sys_srandom>:
push   %rax
lea    0xed8(%rip),%rsi
xor    %edi,%edi
call   1030 <DEBUG@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Error - no srandom function available !\0A\00"
define void @sys_srandom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @DEBUG(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [41 x i8] c"Error - no srandom function available !\0A\00"
define void @sys_srandom(i32 %0) {
%2 = tail call i32 @DEBUG(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void Usage() {
  printf("\nUsage: %s -h -f <filename> [-s <extend size>]"
         " [-n <numwrites>]\n",
         "verify");
  printf("Will verify a file created by  extend_and_write.\n\n"
         "<extend size> Size of the extend (Default=1024)\n"
         "<numwrites> Number of writes to be performed (Default=10240).\n");
  exit(1);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xf0f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xf02(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [65 x i8] c"\0AUsage: %s -h -f <filename> [-s <extend size>] [-n <numwrites>]\0A\00"
@.str.1 = [7 x i8] c"verify\00"
@.str.2 = [161 x i8] c"Will verify a file created by extend_and_write.\0A\0A<extend size> Size of the extend (Default=1024)\0A<numwrites> Number of writes to be performed (Default=10240).\0A\00"
define void @Usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [65 x i8] c"\0AUsage: %s -h -f <filename> [-s <extend size>] [-n <numwrites>]\0A\00"
@.str.1 = [7 x i8] c"verify\00"
@str = [160 x i8] c"Will verify a file created by extend_and_write.\0A\0A<extend size> Size of the extend (Default=1024)\0A<numwrites> Number of writes to be performed (Default=10240).\00"
define void @Usage() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([160 x i8], [160 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ansi_fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void unknown_cmd(FILE *file, char *s) {
  ansi_fprintf(stdout,
               "<[YELLOW,BLUE]%s[RESET,RESET]> - "
               "not a valid command! help displays the list\n",
               s);
}


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

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [78 x i8] c"<[YELLOW,BLUE]%s[RESET,RESET]> - not a valid command! help displays the list\0A\00"
define void @unknown_cmd(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stdout
%6 = load i8*, i8** %4
%7 = call i32 @ansi_fprintf(i32 %5, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [78 x i8] c"<[YELLOW,BLUE]%s[RESET,RESET]> - not a valid command! help displays the list\0A\00"
define void @unknown_cmd(i32* nocapture readnone %0, i8* %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @ansi_fprintf(i32 %3, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void os_sleep_ms(int ms) { usleep(ms * 1000); }


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

x86 assembly (clang, -O2):
<os_sleep_ms>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @os_sleep_ms(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @os_sleep_ms(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
char *getenv(char *);
char *splinter_find_variable(char *name) { return getenv(name); }


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

x86 assembly (clang, -O2):
<splinter_find_variable>:
jmp    1030 <getenv@plt>

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

LLVM IR (-O2):
define i8* @splinter_find_variable(i8* nocapture %0) {
%2 = tail call i8* @getenv(i8* %0)
ret i8* %2
}
int f(long long *a) {
  long long b = *a;
  b++;
  return b;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = add nsw i64 %6, 1
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @f(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = add i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Initialize();
void McCdsp_Init(void) { Initialize(); }


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

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

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

LLVM IR (-O2):
define void @McCdsp_Init() {
%1 = tail call i32 (...) @Initialize()
ret void
}
void glGenSamplers(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glGenSamplers() {
ret void
}
unsigned long DRV_GET_WCDMA_PLL_STATUS(void) { return 1; }


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

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

LLVM IR (-O0):
define i64 @DRV_GET_WCDMA_PLL_STATUS() {
ret i64 1
}

LLVM IR (-O2):
define i64 @DRV_GET_WCDMA_PLL_STATUS() {
ret i64 1
}
main() {
  struct {
    int a;
    struct {
      int b, c;
    } sub;
  } st;
  st.sub.b = 5;
  return (&(&st)->sub)->b == 5 ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x5,%edx
cmove  %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i32, %struct.anon.0 }
%struct.anon.0 = type { i32, i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.anon
store i32 0, i32* %1
%3 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 1
%4 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %3, i32 0, i32 0
store i32 5, i32* %4
%5 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 1
%6 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 5
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int fib(int);
int main(void) { return fib(42); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x2a,%edi
jmp    1030 <fib@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @fib(i32 42)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ ler();
int main(void) { ler(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @ler()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ler()
ret i32 0
}
/* Variables and functions */
void *calloc(size_t const, size_t const);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t const);
int /*<<< orphan*/ stderr;
void *xcalloc(const size_t elements, const size_t size) {
  void *result = calloc(elements, size);
  if (!result) {
    fprintf(stderr, "No more memory available. Trying to callocte %zu bytes.",
            size);
    exit(1);
  }
  return result;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117f <xcalloc+0x4f>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rbx
mov    %rsi,%rbx
call   1030 <calloc@plt>
test   %rax,%rax
je     1140 <xcalloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"No more memory available. Trying to callocte %zu bytes.\00"
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i64, i64* %4
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i64 %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"No more memory available. Trying to callocte %zu bytes.\00"
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i64 %1)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret i8* %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int const *);
int label_is_wildcard(const uint8_t *label) {
  assert(label);
  return label[0] == 1 && label[1] == '*';
}


x86 assembly (clang, -O0):
<label_is_wildcard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x1,(%rcx)
mov    %al,-0x9(%rbp)
jne    1145 <label_is_wildcard+0x35>
mov    -0x8(%rbp),%rax
cmpl   $0x2a,0x4(%rax)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<label_is_wildcard>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
xor    %eax,%eax
cmpl   $0x1,(%rbx)
jne    1129 <label_is_wildcard+0x19>
xor    %eax,%eax
cmpl   $0x2a,0x4(%rbx)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @label_is_wildcard(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @assert(i32* %3)
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 42
br label %14
14: ; preds = %9, %1
%15 = phi i1 [ false, %1 ], [ %13, %9 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @label_is_wildcard(i32* %0) {
%2 = tail call i32 @assert(i32* %0)
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 42
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %11
}
int test_imm_91int32_mem(int *val) {
  return ((*val) & (0x91 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_91int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 145
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int Operand_art_encode(unsigned int *valp) {
  int error;
  error = (*valp & ~0xf) != 0;
  return error;
}


x86 assembly (clang, -O0):
<Operand_art_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xfffffff0,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_art_encode>:
xor    %eax,%eax
cmpl   $0x10,(%rdi)
setae  %al
ret

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

LLVM IR (-O2):
define i32 @Operand_art_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp ugt i32 %2, 15
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
void init_win() {
  initscr();
  cbreak();
  start_color();
  noecho();
  curs_set(0);
  keypad(stdscr, TRUE);
}


x86 assembly (clang, -O0):
<init_win>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    $0x0,%al
call   1060 <start_color@plt>
mov    $0x0,%al
call   1070 <noecho@plt>
xor    %edi,%edi
call   1080 <curs_set@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_win>:
push   %rax
xor    %eax,%eax
call   1050 <initscr@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
xor    %eax,%eax
call   1060 <start_color@plt>
xor    %eax,%eax
call   1070 <noecho@plt>
xor    %edi,%edi
call   1080 <curs_set@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
pop    %rax
jmp    1040 <keypad@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
define void @init_win() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @cbreak()
%3 = call i32 (...) @start_color()
%4 = call i32 (...) @noecho()
%5 = call i32 @curs_set(i32 0)
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = call i32 @keypad(i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
define void @init_win() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @cbreak()
%3 = tail call i32 (...) @start_color()
%4 = tail call i32 (...) @noecho()
%5 = tail call i32 @curs_set(i32 0)
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = tail call i32 @keypad(i32 %6, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FILENAME_MAX;
int /*<<< orphan*/ safeGetString(char *, int /*<<< orphan*/);
void getFileName(char *fileName) { safeGetString(fileName, FILENAME_MAX); }


x86 assembly (clang, -O0):
<getFileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <safeGetString@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileName>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <safeGetString@plt>

LLVM IR (-O0):
@FILENAME_MAX = global i32 0
define void @getFileName(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @FILENAME_MAX
%5 = call i32 @safeGetString(i8* %3, i32 %4)
ret void
}

LLVM IR (-O2):
@FILENAME_MAX = global i32 0
define void @getFileName(i8* %0) {
%2 = load i32, i32* @FILENAME_MAX
%3 = tail call i32 @safeGetString(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int memcmp(unsigned char const *, unsigned char const *, int);
int eblob_id_cmp(const unsigned char *id1, const unsigned char *id2) {
  return memcmp(id1, id2, 64);
}


x86 assembly (clang, -O0):
<eblob_id_cmp>:
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    $0x40,%edx
call   1030 <memcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eblob_id_cmp>:
mov    $0x40,%edx
jmp    1030 <memcmp@plt>

LLVM IR (-O0):
define i32 @eblob_id_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @memcmp(i8* %5, i8* %6, i32 64)
ret i32 %7
}

LLVM IR (-O2):
define i32 @eblob_id_cmp(i8* %0, i8* %1) {
%3 = tail call i32 @memcmp(i8* %0, i8* %1, i32 64)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Test words with different lengths and punctuation.\n"); }


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

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

LLVM IR (-O0):
@.str = [52 x i8] c"Test words with different lengths and punctuation.\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [51 x i8] c"Test words with different lengths and punctuation.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int extern_count;
int /*<<< orphan*/ printf(char *, int, int);
void times() {
  static int count;
  extern extern_count;
  printf("%d,%d\n", count, extern_count);
  count++;
  extern_count++;
}


x86 assembly (clang, -O0):
<times>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f12(%rip),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ef7(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eee(%rip)
mov    0x2e9b(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2e8f(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<times>:
push   %rbx
mov    0x2f15(%rip),%esi
mov    0x2ec2(%rip),%rbx
mov    (%rbx),%edx
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
addl   $0x1,0x2ef9(%rip)
addl   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@times.count = internal global i32 0
@.str = [7 x i8] c"%d,%d\0A\00"
@extern_count = global i32 0
define void @times() {
%1 = load i32, i32* @times.count
%2 = load i32, i32* @extern_count
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = load i32, i32* @times.count
%5 = add nsw i32 %4, 1
store i32 %5, i32* @times.count
%6 = load i32, i32* @extern_count
%7 = add nsw i32 %6, 1
store i32 %7, i32* @extern_count
ret void
}

LLVM IR (-O2):
@times.count = internal unnamed_addr global i32 0
@.str = [7 x i8] c"%d,%d\0A\00"
@extern_count = global i32 0
define void @times() {
%1 = load i32, i32* @times.count
%2 = load i32, i32* @extern_count
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = load i32, i32* @times.count
%5 = add nsw i32 %4, 1
store i32 %5, i32* @times.count
%6 = load i32, i32* @extern_count
%7 = add nsw i32 %6, 1
store i32 %7, i32* @extern_count
ret void
}
void foo(__complex__ double x) {
  if (__real__ x != 1.0 || __imag__ x != 2.0)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1161 <foo+0x51>
jp     1161 <foo+0x51>
movsd  -0x8(%rbp),%xmm0
movsd  0xebc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1161 <foo+0x51>
jp     1161 <foo+0x51>
jmp    1166 <foo+0x56>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
ucomisd 0xee7(%rip),%xmm0
jne    112b <foo+0x1b>
jp     112b <foo+0x1b>
ucomisd 0xee3(%rip),%xmm1
jne    112b <foo+0x1b>
jp     112b <foo+0x1b>
pop    %rax
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define void @foo(double %0, double %1) {
%3 = alloca { double, double }
%4 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %4
%5 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %5
%6 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%7 = load double, double* %6
%8 = fcmp une double %7, 1.000000e+00
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%11 = load double, double* %10
%12 = fcmp une double %11, 2.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %9, %2
unreachable
14: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @foo(double %0, double %1) {
%3 = fcmp une double %0, 1.000000e+00
%4 = fcmp une double %1, 2.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %6, label %7
6: ; preds = %2
tail call void @abort()
unreachable
7: ; preds = %2
ret void
}
int fb_dd_write(int x, int y, const void *pixel) { return 1; }


x86 assembly (clang, -O0):
<fb_dd_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fb_dd_write(i32 %0, i32 %1, i8* nocapture readnone %2) {
ret i32 1
}
/* Variables and functions */
char *strchr(char *in, char c) {
  while (*in) {
    if (*in == c)
      break;
    in++;
  }
  return in;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1144 <strchr+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1133 <strchr+0x33>
jmp    1144 <strchr+0x44>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110e <strchr+0xe>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <strchr+0x21>
cmp    %sil,%cl
jne    1110 <strchr+0x10>
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = icmp eq i8 %5, %1
%8 = or i1 %6, %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
ret i8* %4
}
int test_imm_AFuint8_mem(unsigned char *val) {
  return ((*val) & (0xAF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_AFuint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 175
%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_AFuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -81
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_cmatrix(char **m, long nrl, long nrh, long ncl, long nch) {
  free((char *)(m[nrl] + ncl - 1));
  free((char *)(m + nrl - 1));
}


x86 assembly (clang, -O0):
<free_cmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    -0x20(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_cmatrix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi,%rsi,8),%rax
lea    (%rax,%rcx,1),%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <free@plt>
lea    (%rbx,%r14,8),%rdi
add    $0xfffffffffffffff8,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_cmatrix(i8** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = getelementptr inbounds i8*, i8** %0, i64 %1
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8, i8* %7, i64 %3
%9 = getelementptr inbounds i8, i8* %8, i64 -1
%10 = tail call i32 @free(i8* %9)
%11 = getelementptr inbounds i8*, i8** %6, i64 -1
%12 = bitcast i8** %11 to i8*
%13 = tail call i32 @free(i8* %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void recover(void) {
  printf("hello: recovered from divide by zero\n");
  exit(0);
}


x86 assembly (clang, -O0):
<recover>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<recover>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"hello: recovered from divide by zero\0A\00"
define void @recover() {
%1 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [37 x i8] c"hello: recovered from divide by zero\00"
define void @recover() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fsync(int);
void bvfs_unistd_sync(void *handle) {
  int *fd = handle;
  fsync(*fd);
}


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

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

LLVM IR (-O0):
define void @bvfs_unistd_sync(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 = load i32, i32* %6
%8 = call i32 @fsync(i32 %7)
ret void
}

LLVM IR (-O2):
define void @bvfs_unistd_sync(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @fsync(i32 %3)
ret void
}
void wait_for_completion(struct completion *x) { return; }


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

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

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

LLVM IR (-O2):
%struct.completion = type opaque
define void @wait_for_completion(%struct.completion* nocapture %0) {
ret void
}
/* Variables and functions */
unsigned long hash(unsigned char *);
unsigned long hashtable_hash(char *str) { return hash((unsigned char *)str); }


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

x86 assembly (clang, -O2):
<hashtable_hash>:
jmp    1030 <hash@plt>

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

LLVM IR (-O2):
define i64 @hashtable_hash(i8* %0) {
%2 = tail call i64 @hash(i8* %0)
ret i64 %2
}