xunge/DecIR huggingface dataset:
int squareofsums(int num) {
  int sum;
  int i;
  for (i = 1, sum = 0; i <= num; ++i)
    sum += i;
  return sum * sum;
}


x86 assembly (clang, -O0):
<squareofsums>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1138 <squareofsums+0x38>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <squareofsums+0x15>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<squareofsums>:
test   %edi,%edi
jle    111b <squareofsums+0x1b>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
imul   %eax,%eax
ret
xor    %eax,%eax
imul   %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @squareofsums(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
%16 = mul nsw i32 %15, %15
ret i32 %16
}
int test_imm_EBuint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xEB << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_EBuint64_highword_reg>:
movabs $0xeb00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_EBuint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 235
%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_EBuint64_highword_reg(i64 %0) {
%2 = and i64 %0, 1009317314560
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
unsigned long atoll(char *);
int /*<<< orphan*/ eratosthenes_sieve(int *, unsigned long);
scalar_t__ malloc(int);
int main(int argc, char *argv[]) {
  long unsigned n = atoll(argv[1]);
  int *sieve = (int *)malloc(sizeof(int) * (n / 2));
  eratosthenes_sieve(sieve, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoll@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x1,%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <eratosthenes_sieve@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1040 <atoll@plt>
mov    %rax,%rbx
lea    (%rax,%rax,1),%edi
and    $0xfffffffc,%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <eratosthenes_sieve@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @atoll(i8* %10)
store i64 %11, i64* %6
%12 = load i64, i64* %6
%13 = udiv i64 %12, 2
%14 = mul i64 4, %13
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i32*
store i32* %17, i32** %7
%18 = load i32*, i32** %7
%19 = load i64, i64* %6
%20 = call i32 @eratosthenes_sieve(i32* %18, i64 %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoll(i8* %4)
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 1
%8 = and i32 %7, -4
%9 = tail call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i32*
%11 = tail call i32 @eratosthenes_sieve(i32* %10, i64 %5)
ret i32 0
}
float celciusToFahrenheit(float Tc) {
  float Tf = ((float)9.0 / 5.0) * Tc + 32.0;
  return (Tf);
}


x86 assembly (clang, -O0):
<celciusToFahrenheit>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<celciusToFahrenheit>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @celciusToFahrenheit(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %5, double 3.200000e+01)
%7 = fptrunc double %6 to float
store float %7, float* %3
%8 = load float, float* %3
ret float %8
}

LLVM IR (-O2):
define float @celciusToFahrenheit(float %0) {
%2 = fpext float %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = fptrunc double %3 to float
ret float %4
}
int skip(int len) {
  if (len < 128)
    return 2;
  if (len >= 128 && len < 256)
    return 3;
  return 4;
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jge    1120 <skip+0x20>
movl   $0x2,-0x4(%rbp)
jmp    114d <skip+0x4d>
cmpl   $0x80,-0x8(%rbp)
jl     1146 <skip+0x46>
cmpl   $0x100,-0x8(%rbp)
jge    1146 <skip+0x46>
movl   $0x3,-0x4(%rbp)
jmp    114d <skip+0x4d>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip>:
xor    %eax,%eax
cmp    $0x100,%edi
setl   %al
mov    $0x4,%ecx
sub    %eax,%ecx
cmp    $0x80,%edi
mov    $0x2,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @skip(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 128
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 2, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 128
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 256
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 3, i32* %2
br label %15
14: ; preds = %10, %7
store i32 4, i32* %2
br label %15
15: ; preds = %14, %13, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @skip(i32 %0) {
%2 = icmp slt i32 %0, 128
%3 = icmp slt i32 %0, 256
%4 = select i1 %3, i32 3, i32 4
%5 = select i1 %2, i32 2, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ cut_zeros(double, char *);
int /*<<< orphan*/ fround(double *, int);
double parse(char const *);
void calculate(const char *exp, char *output, int output_size) {
  double result;
  result = parse(exp);
  fround(&result, 3);
  cut_zeros(result, output);
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <parse@plt>
movsd  %xmm0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1050 <fround@plt>
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <cut_zeros@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
call   1040 <parse@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1050 <fround@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <cut_zeros@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @calculate(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call double @parse(i8* %8)
store double %9, double* %7
%10 = call i32 @fround(double* %7, i32 3)
%11 = load double, double* %7
%12 = load i8*, i8** %5
%13 = call i32 @cut_zeros(double %11, i8* %12)
ret void
}

LLVM IR (-O2):
define void @calculate(i8* %0, i8* %1, i32 %2) {
%4 = alloca double
%5 = bitcast double* %4 to i8*
%6 = tail call double @parse(i8* %0)
store double %6, double* %4
%7 = call i32 @fround(double* %4, i32 3)
%8 = load double, double* %4
%9 = call i32 @cut_zeros(double %8, i8* %1)
ret void
}
int musfade_exit() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @musfade_exit() {
ret i32 0
}
void sys_set_share(int p_share) {
  asm volatile("int %0\n" : : "i"(51), "a"(p_share) : "cc", "memory");
}


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

x86 assembly (clang, -O2):
<sys_set_share>:
mov    %edi,%eax
int    $0x33
ret

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

LLVM IR (-O2):
define void @sys_set_share(i32 %0) {
tail call void asm sideeffect "int $0\0A", "i,{ax},~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 51, i32 %0)
ret void
}
int test_c(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @test_c() {
ret i32 1
}

LLVM IR (-O2):
define i32 @test_c() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ soar_ecPrintInternalSymbols();
void print_internal_symbols(void) { soar_ecPrintInternalSymbols(); }


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

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

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

LLVM IR (-O2):
define void @print_internal_symbols() {
%1 = tail call i32 (...) @soar_ecPrintInternalSymbols()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int teste(void *Argumentos) {
  int *num = (int *)Argumentos;
  printf("Teste!\n");
  printf("Imprima os Argumentos %d!\n", *num);
}


x86 assembly (clang, -O0):
<teste>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<teste>:
push   %rbx
mov    %rdi,%rbx
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Teste!\0A\00"
@.str.1 = [27 x i8] c"Imprima os Argumentos %d!\0A\00"
define i32 @teste(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"Imprima os Argumentos %d!\0A\00"
@str = [7 x i8] c"Teste!\00"
define i32 @teste(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 undef
}
int main() { return sizeof(unsigned char); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ sig_default(int /*<<< orphan*/);
extern void sig_term_default(void) { sig_default(SIGTERM); }


x86 assembly (clang, -O0):
<sig_term_default>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sig_default@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_term_default>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sig_default@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
define void @sig_term_default() {
%1 = load i32, i32* @SIGTERM
%2 = call i32 @sig_default(i32 %1)
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define void @sig_term_default() {
%1 = load i32, i32* @SIGTERM
%2 = tail call i32 @sig_default(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void storeValue(char *str, int num) { sprintf(str, "%d", num); }


x86 assembly (clang, -O0):
<storeValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<storeValue>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @storeValue(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 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @storeValue(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void frag_one() {
  printf("a = b = c = d = 0;\n");
  int a, b, c, d;
  a = b = c = d = 0;
  printf("a = %d, b = %d, c = %d, d = %d\n", a, b, c, d);
}


x86 assembly (clang, -O0):
<frag_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frag_one>:
push   %rax
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
pop    %r9
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"a = b = c = d = 0;\0A\00"
@.str.1 = [32 x i8] c"a = %d, b = %d, c = %d, d = %d\0A\00"
define void @frag_one() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
store i32 0, i32* %1
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"a = %d, b = %d, c = %d, d = %d\0A\00"
@str = [19 x i8] c"a = b = c = d = 0;\00"
define void @frag_one() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar_serial0(char);
void putstring_serial0(const char *string) {
  char ch;
  while ((ch = *string)) {
    putchar_serial0(ch);
    string++;
  }
}


x86 assembly (clang, -O0):
<putstring_serial0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
cmp    $0x0,%al
je     1147 <putstring_serial0+0x37>
movsbl -0x9(%rbp),%edi
call   1030 <putchar_serial0@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <putstring_serial0+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstring_serial0>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <putstring_serial0+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar_serial0@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <putstring_serial0+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @putstring_serial0(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @putchar_serial0(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int u_int;
typedef int u_char;

/* Variables and functions */
u_int get4bytes(u_char *buf) {
  u_int ret;
  ret = buf[0] << 24;
  ret |= buf[1] << 16;
  ret |= buf[2] << 8;
  ret |= buf[3];
  return ret;
}


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

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

LLVM IR (-O0):
define i32 @get4bytes(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
%7 = shl i32 %6, 24
store i32 %7, i32* %3
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = shl i32 %10, 16
%12 = load i32, i32* %3
%13 = or i32 %12, %11
store i32 %13, i32* %3
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 2
%16 = load i32, i32* %15
%17 = shl i32 %16, 8
%18 = load i32, i32* %3
%19 = or i32 %18, %17
store i32 %19, i32* %3
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 3
%22 = load i32, i32* %21
%23 = load i32, i32* %3
%24 = or i32 %23, %22
store i32 %24, i32* %3
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @get4bytes(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 24
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = or i32 %6, %3
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = or i32 %7, %10
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = or i32 %11, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ halt();
int /*<<< orphan*/ uart_puts(char *);
void abort(void) {
  uart_puts("System aborted\r\n");
  halt();
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <uart_puts@plt>
mov    $0x0,%al
call   1030 <halt@plt>

x86 assembly (clang, -O2):
<abort>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <uart_puts@plt>
xor    %eax,%eax
call   1030 <halt@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"System aborted\0D\0A\00"
define void @abort() {
%1 = call i32 @uart_puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @halt()
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"System aborted\0D\0A\00"
define void @abort() {
%1 = tail call i32 @uart_puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @halt()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("pierwszy program \n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [18 x i8] c"pierwszy program \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void outb(const unsigned short port, unsigned char value) {
  asm volatile("outb %0,%1" ::"a"(value), "Nd"(port));
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    -0x2(%rbp),%dx
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb>:
mov    %esi,%eax
mov    %edi,%edx
out    %al,(%dx)
ret

LLVM IR (-O0):
define void @outb(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i16, i16* %3
ret void
}

LLVM IR (-O2):
define void @outb(i16 zeroext %0, i8 zeroext %1) {
tail call void asm sideeffect "outb $0,$1", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i8 %1, i16 %0)
ret void
}
int f() {
  int a = -42;
  int b = -35;
  if (a = b)
    return a;
  return 1;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0xffffffd6,-0x8(%rbp)
movl   $0xffffffdd,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     112c <f+0x2c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1133 <f+0x33>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 -35
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void fmsynth_memory_free(void *ptr) {
  void **p = (void **)ptr;
  free(p[-1]);
}


x86 assembly (clang, -O0):
<fmsynth_memory_free>:
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    -0x8(%rax),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmsynth_memory_free>:
mov    -0x8(%rdi),%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @fmsynth_memory_free(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -8
%3 = bitcast i8* %2 to i8**
%4 = load i8*, i8** %3
%5 = tail call i32 @free(i8* %4)
ret void
}
int test_imm_52int16_reg(short val) {
  return ((val) & (-0x52 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_52int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffffae,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_52int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -82
%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_52int16_reg(i16 signext %0) {
%2 = and i16 %0, -82
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M25_f(char *s) {
  debug("M25_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M25_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M25_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"M25_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M25_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [46 x i8] c"M25_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M25_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ generate_random_salt(char *, int);
char *int_to_base64(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *make_ext_salt(int rounds) {
  static char salt[10];
  sprintf(salt, "_%s", int_to_base64(rounds));
  generate_random_salt(&salt[5], 4);
  salt[9] = '\0';
  return salt;
}


x86 assembly (clang, -O0):
<make_ext_salt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <int_to_base64@plt>
mov    %rax,%rdx
lea    0x2eec(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1050 <sprintf@plt>
lea    0x2ed9(%rip),%rdi
add    $0x5,%rdi
mov    $0x4,%esi
call   1030 <generate_random_salt@plt>
movb   $0x0,0x2ecd(%rip)
lea    0x2ebd(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_ext_salt>:
push   %rbx
call   1040 <int_to_base64@plt>
lea    0x2efc(%rip),%rbx
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
call   1050 <sprintf@plt>
lea    0x2ee8(%rip),%rdi
mov    $0x4,%esi
call   1030 <generate_random_salt@plt>
movb   $0x0,0x2edb(%rip)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@make_ext_salt.salt = internal global [10 x i8] zeroinitializer
@.str = [4 x i8] c"_%s\00"
define i8* @make_ext_salt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i8* @int_to_base64(i32 %3)
%5 = call i32 @sprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @generate_random_salt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 5), i32 4)
store i8 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 9)
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 0)
}

LLVM IR (-O2):
@make_ext_salt.salt = internal global [10 x i8] zeroinitializer
@.str = [4 x i8] c"_%s\00"
define i8* @make_ext_salt(i32 %0) {
%2 = tail call i8* @int_to_base64(i32 %0)
%3 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @generate_random_salt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 5), i32 4)
store i8 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 9)
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @make_ext_salt.salt, i64 0, i64 0)
}
__int128_t __attribute__((no)) shift_3_ll(long long data) {
  return (__int128_t)data << 3;
}


x86 assembly (clang, -O0):
<shift_3_ll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,%rax
sar    $0x3f,%rax
shld   $0x3,%rcx,%rax
shl    $0x3,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_3_ll>:
mov    %rdi,%rdx
sar    $0x3f,%rdx
shld   $0x3,%rdi,%rdx
lea    0x0(,%rdi,8),%rax
ret

LLVM IR (-O0):
define { i64, i64 } @shift_3_ll(i64 %0) {
%2 = alloca i128
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = sext i64 %4 to i128
%6 = shl i128 %5, 3
store i128 %6, i128* %2
%7 = bitcast i128* %2 to { i64, i64 }*
%8 = load { i64, i64 }, { i64, i64 }* %7
ret { i64, i64 } %8
}

LLVM IR (-O2):
define { i64, i64 } @shift_3_ll(i64 %0) {
%2 = sext i64 %0 to i128
%3 = shl nsw i128 %2, 3
%4 = trunc i128 %3 to i64
%5 = lshr i128 %3, 64
%6 = trunc i128 %5 to i64
%7 = insertvalue { i64, i64 } poison, i64 %4, 0
%8 = insertvalue { i64, i64 } %7, i64 %6, 1
ret { i64, i64 } %8
}
void RTStrCopy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrCopy() {
ret void
}
int Fibonacci(int x) {
  if (x < 2) {
    return x;
  }
  return (Fibonacci(x - 1) + Fibonacci(x - 2));
}


x86 assembly (clang, -O0):
<Fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1130 <Fibonacci+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <Fibonacci+0x43>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <Fibonacci@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <Fibonacci@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fibonacci>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <Fibonacci+0x10>
mov    %ebx,%ecx
jmp    1144 <Fibonacci+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <Fibonacci@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <Fibonacci+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Fibonacci(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @Fibonacci(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ nn_ins_term();
void nn_inproc_term(void) { nn_ins_term(); }


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

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

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

LLVM IR (-O2):
define void @nn_inproc_term() {
%1 = tail call i32 (...) @nn_ins_term()
ret void
}
void f(void) { int i = 1; }


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

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

LLVM IR (-O0):
define void @f() {
%1 = alloca i32
store i32 1, i32* %1
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
void *getsym_none(void *arg, const char *name) { return 0; }


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

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

LLVM IR (-O0):
define i8* @getsym_none(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @getsym_none(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *);
char *encode_request_msg(char buf[128]) {
  snprintf(buf, 128, "R");
  return buf;
}


x86 assembly (clang, -O0):
<encode_request_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
lea    0xed4(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_request_msg>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdx
mov    $0x80,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"R\00"
define i8* @encode_request_msg(i8* returned %0) {
%2 = tail call i32 @snprintf(i8* %0, i32 128, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8* %0
}
strcpy2(s1, s2) char *s1, *s2;
{
  while (*s2)
    *s1++ = toupper(*s2++);
  *s1 = '\0';
}


x86 assembly (clang, -O0):
<strcpy2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     115c <strcpy2+0x4c>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1120 <strcpy2+0x10>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy2>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rsi),%al
test   %al,%al
je     114a <strcpy2+0x3a>
mov    %rsi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,(%r14)
add    $0x1,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strcpy2+0x20>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @strcpy2(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %13, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %6 to i32
%11 = tail call i32 @toupper(i32 %10)
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %12, i8* %8
%14 = load i8, i8* %9
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i8* [ %0, %2 ], [ %13, %5 ]
store i8 0, i8* %17
ret i32 undef
}
int xmlUCSIsCJKCompatibilityIdeographs(int code) {
  return (((code >= 0xF900) && (code <= 0xFAFF)));
}


x86 assembly (clang, -O0):
<xmlUCSIsCJKCompatibilityIdeographs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0xf900,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsCJKCompatibilityIdeographs+0x26>
cmpl   $0xfaff,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsCJKCompatibilityIdeographs>:
add    $0xffff0700,%edi
xor    %eax,%eax
cmp    $0x200,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsCJKCompatibilityIdeographs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 63744
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 64255
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xmlUCSIsCJKCompatibilityIdeographs(i32 %0) {
%2 = add i32 %0, -63744
%3 = icmp ult i32 %2, 512
%4 = zext i1 %3 to i32
ret i32 %4
}
int link() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @link() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0x02() {
  Assert_real((isxdigit(2) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isxdigit.c",
              15, ("isxdigit should be 0 for 0x02"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0x02>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0xf,%edx
lea    0xf5c(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0x02>:
push   %rax
mov    $0x2,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0xf,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0x02\00"
define void @t_isxdigit_0x02() {
%1 = call i64 @isxdigit(i32 2)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0x02\00"
define void @t_isxdigit_0x02() {
%1 = tail call i64 @isxdigit(i32 2)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int *get_last_node_with_offset(void *head, int offset) {
  int *ret = (int *)head, *ptr = (int *)head;
  while (ptr) {
    ret = ptr;
    ptr = (int *)*((int *)((int)ptr + offset));
  }
  return ret;
}


x86 assembly (clang, -O0):
<get_last_node_with_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1143 <get_last_node_with_offset+0x43>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    -0xc(%rbp),%eax
cltq
movslq (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    111b <get_last_node_with_offset+0x1b>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_last_node_with_offset>:
mov    %rdi,%rax
test   %rdi,%rdi
je     111f <get_last_node_with_offset+0x1f>
movslq %esi,%rcx
mov    %rax,%rdx
xchg   %ax,%ax
mov    %rdx,%rax
movslq %eax,%rdx
movslq (%rdx,%rcx,1),%rdx
test   %rdx,%rdx
jne    1110 <get_last_node_with_offset+0x10>
ret

LLVM IR (-O0):
define i32* @get_last_node_with_offset(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
br label %11
11: ; preds = %14, %2
%12 = load i32*, i32** %6
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load i32*, i32** %6
store i32* %15, i32** %5
%16 = load i32*, i32** %6
%17 = ptrtoint i32* %16 to i32
%18 = load i32, i32* %4
%19 = add nsw i32 %17, %18
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
store i32* %24, i32** %6
br label %11
25: ; preds = %11
%26 = load i32*, i32** %5
ret i32* %26
}

LLVM IR (-O2):
define i32* @get_last_node_with_offset(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = icmp eq i8* %0, null
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i32* [ %14, %5 ], [ %3, %2 ]
%7 = ptrtoint i32* %6 to i64
%8 = trunc i64 %7 to i32
%9 = add nsw i32 %8, %1
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = icmp eq i32 %12, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32* [ %3, %2 ], [ %6, %5 ]
ret i32* %17
}
int test_imm_ACint16_mem(short *val) {
  return ((*val) & (-0xAC << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_ACint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -172
%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_ACint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -172
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
const char *BZ2_bzlibVersion(void) { return "1.0.1, 23-June-2000"; }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"1.0.1, 23-June-2000\00"
define i8* @BZ2_bzlibVersion() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [20 x i8] c"1.0.1, 23-June-2000\00"
define i8* @BZ2_bzlibVersion() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}