xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cgiSimpleTableRowStart() { printf("<TR>\n"); }


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"<TR>\00"
define void @cgiSimpleTableRowStart() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
int length(const char *as) {
  register const char *s;
  if (s = as) {
    while (*s++)
      ;
    ;
  }
  return (s - as);
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1141 <length+0x41>
jmp    111f <length+0x1f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
je     113c <length+0x3c>
jmp    111f <length+0x1f>
jmp    1141 <length+0x41>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
test   %rdi,%rdi
je     1120 <length+0x20>
mov    %rdi,%rax
mov    %rdi,%rcx
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <length+0x10>
sub    %edi,%eax
ret
xor    %eax,%eax
sub    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @length(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %5, %3 ], [ %0, %1 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = ptrtoint i8* %5 to i64
br label %10
10: ; preds = %8, %1
%11 = phi i64 [ 0, %1 ], [ %9, %8 ]
%12 = ptrtoint i8* %0 to i64
%13 = sub i64 %11, %12
%14 = trunc i64 %13 to i32
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ ftell(int /*<<< orphan*/ *);
unsigned long fsize(char *file) {
  FILE *f = fopen(file, "r");
  unsigned long len = (unsigned long)ftell(f);
  fclose(f);
  return len;
}


x86 assembly (clang, -O0):
<fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsize>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <ftell@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i64 @fsize(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = call i64 @ftell(i32* %7)
store i64 %8, i64* %4
%9 = load i32*, i32** %3
%10 = call i32 @fclose(i32* %9)
%11 = load i64, i64* %4
ret i64 %11
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i64 @fsize(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @ftell(i32* %2)
%4 = tail call i32 @fclose(i32* %2)
ret i64 %3
}
/* Variables and functions */
int CHAR_BIT;
int /*<<< orphan*/ printf(char *, int);
int hlp_wordsize(void) {
  printf("%lu\n", CHAR_BIT * sizeof(void *));
  return 0;
}


x86 assembly (clang, -O0):
<hlp_wordsize>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%esi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hlp_wordsize>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
shl    $0x3,%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
@CHAR_BIT = global i32 0
define i32 @hlp_wordsize() {
%1 = load i32, i32* @CHAR_BIT
%2 = sext i32 %1 to i64
%3 = mul i64 %2, 8
%4 = trunc i64 %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lu\0A\00"
@CHAR_BIT = global i32 0
define i32 @hlp_wordsize() {
%1 = load i32, i32* @CHAR_BIT
%2 = shl i32 %1, 3
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
int cmpfunc(const void *a, const void *b) { return (*(int *)a - *(int *)b); }


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

x86 assembly (clang, -O2):
<cmpfunc>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @cmpfunc(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmpfunc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
double foo(int a, int b) { return (a == b) ? 1 : 0; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    %esi,%edi
je     1108 <foo+0x8>
xorps  %xmm0,%xmm0
ret
movsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @foo(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 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
%10 = sitofp i32 %9 to double
ret double %10
}

LLVM IR (-O2):
define double @foo(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = uitofp i1 %3 to double
ret double %4
}
double covariance_scalar_merge(double uxA, double uyA, double sA, int nA,
                               double uxB, double uyB, double sB, int nB) {
  double sX;
  sX = sA + sB +
       (uxA - uxB) * (uyA - uyB) *
           (((double)nA) * ((double)nB) / ((double)nA + (double)nB));
  return sX;
}


x86 assembly (clang, -O0):
<covariance_scalar_merge>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
mov    %esi,-0x3c(%rbp)
movsd  -0x18(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
subsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm2
cvtsi2sdl -0x3c(%rbp),%xmm3
mulsd  %xmm3,%xmm2
cvtsi2sdl -0x1c(%rbp),%xmm3
cvtsi2sdl -0x3c(%rbp),%xmm4
addsd  %xmm4,%xmm3
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<covariance_scalar_merge>:
addsd  %xmm5,%xmm2
subsd  %xmm3,%xmm0
subsd  %xmm4,%xmm1
xorps  %xmm3,%xmm3
cvtsi2sd %edi,%xmm3
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
movapd %xmm3,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm1,%xmm3
divsd  %xmm3,%xmm4
mulsd  %xmm4,%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @covariance_scalar_merge(double %0, double %1, double %2, i32 %3, double %4, double %5, double %6, i32 %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store i32 %3, i32* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
store i32 %7, i32* %16
%18 = load double, double* %11
%19 = load double, double* %15
%20 = fadd double %18, %19
%21 = load double, double* %9
%22 = load double, double* %13
%23 = fsub double %21, %22
%24 = load double, double* %10
%25 = load double, double* %14
%26 = fsub double %24, %25
%27 = fmul double %23, %26
%28 = load i32, i32* %12
%29 = sitofp i32 %28 to double
%30 = load i32, i32* %16
%31 = sitofp i32 %30 to double
%32 = fmul double %29, %31
%33 = load i32, i32* %12
%34 = sitofp i32 %33 to double
%35 = load i32, i32* %16
%36 = sitofp i32 %35 to double
%37 = fadd double %34, %36
%38 = fdiv double %32, %37
%39 = call double @llvm.fmuladd.f64(double %27, double %38, double %20)
store double %39, double* %17
%40 = load double, double* %17
ret double %40
}

LLVM IR (-O2):
define double @covariance_scalar_merge(double %0, double %1, double %2, i32 %3, double %4, double %5, double %6, i32 %7) {
%9 = fadd double %2, %6
%10 = fsub double %0, %4
%11 = fsub double %1, %5
%12 = fmul double %10, %11
%13 = sitofp i32 %3 to double
%14 = sitofp i32 %7 to double
%15 = fmul double %13, %14
%16 = fadd double %13, %14
%17 = fdiv double %15, %16
%18 = tail call double @llvm.fmuladd.f64(double %12, double %17, double %9)
ret double %18
}
/* Variables and functions */
char _random_char_func(char, char);
signed char AMCRandomChar(signed char min, signed char max) {
  return _random_char_func(min, max);
}


x86 assembly (clang, -O0):
<AMCRandomChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
movsbl %al,%edi
movsbl -0x2(%rbp),%esi
call   1030 <_random_char_func@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AMCRandomChar>:
jmp    1030 <_random_char_func@plt>

LLVM IR (-O0):
define signext i8 @AMCRandomChar(i8 signext %0, i8 signext %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 signext i8 @_random_char_func(i8 signext %5, i8 signext %6)
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @AMCRandomChar(i8 signext %0, i8 signext %1) {
%3 = tail call signext i8 @_random_char_func(i8 signext %0, i8 signext %1)
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ init_std_data();
void rand_initialize(void) { init_std_data(); }


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

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

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

LLVM IR (-O2):
define void @rand_initialize() {
%1 = tail call i32 (...) @init_std_data()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int main(int argc __attribute__((unused)),
         char **argv __attribute__((unused))) {
  int val;
  FILE *fd = fopen("/dev/zero", "r");
  fread(&val, sizeof(int), 1, fd);
  fclose(fd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeba(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/zero\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %6
%8 = load i32*, i32** %6
%9 = call i32 @fread(i32* %5, i32 4, i32 1, i32* %8)
%10 = load i32*, i32** %6
%11 = call i32 @fclose(i32* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/zero\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @fread(i32* %3, i32 4, i32 1, i32* %5)
%7 = tail call i32 @fclose(i32* %5)
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *duplicateString(const char *source) {
  char *destination = malloc((strlen(source) + 1) * sizeof(char));
  strcpy(destination, source);
  return destination;
}


x86 assembly (clang, -O0):
<duplicateString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<duplicateString>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @duplicateString(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i8* @malloc(i32 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @duplicateString(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
float funPrintInt(float r) {
  float a;
  a = 3.14 * r * r;
  return a;
}


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

x86 assembly (clang, -O2):
<funPrintInt>:
cvtss2sd %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @funPrintInt(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 = fmul double 3.140000e+00, %5
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fmul double %6, %8
%10 = fptrunc double %9 to float
store float %10, float* %3
%11 = load float, float* %3
ret float %11
}

LLVM IR (-O2):
define float @funPrintInt(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 3.140000e+00
%4 = fmul double %3, %2
%5 = fptrunc double %4 to float
ret float %5
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t _crc_ccitt_update(uint16_t crc, uint8_t data) {
  data ^= (crc & 255);
  data ^= data << 4;
  return ((((uint16_t)data << 8) | (crc >> 8)) ^ (uint8_t)(data >> 4) ^
          ((uint16_t)data << 3));
}


x86 assembly (clang, -O0):
<_crc_ccitt_update>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    $0x4,%ecx
xor    %ecx,%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_crc_ccitt_update>:
movzbl %dil,%ecx
xor    %esi,%ecx
mov    %ecx,%eax
shl    $0x4,%eax
xor    %ecx,%eax
mov    %eax,%ecx
shl    $0x8,%ecx
sar    $0x8,%edi
or     %edi,%ecx
mov    %eax,%edx
sar    $0x4,%edx
shl    $0x3,%eax
xor    %edx,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @_crc_ccitt_update(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 = and i32 %5, 255
%7 = load i32, i32* %4
%8 = xor i32 %7, %6
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = shl i32 %9, 4
%11 = load i32, i32* %4
%12 = xor i32 %11, %10
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = shl i32 %13, 8
%15 = load i32, i32* %3
%16 = ashr i32 %15, 8
%17 = or i32 %14, %16
%18 = load i32, i32* %4
%19 = ashr i32 %18, 4
%20 = xor i32 %17, %19
%21 = load i32, i32* %4
%22 = shl i32 %21, 3
%23 = xor i32 %20, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @_crc_ccitt_update(i32 %0, i32 %1) {
%3 = and i32 %0, 255
%4 = xor i32 %3, %1
%5 = shl i32 %4, 4
%6 = xor i32 %5, %4
%7 = shl i32 %6, 8
%8 = ashr i32 %0, 8
%9 = or i32 %7, %8
%10 = ashr i32 %6, 4
%11 = shl i32 %6, 3
%12 = xor i32 %11, %10
%13 = xor i32 %12, %9
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ strobe();
int zylons() {
  while (1) {
    strobe();
  }
}


x86 assembly (clang, -O0):
<zylons>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <zylons+0x9>
mov    $0x0,%al
call   1030 <strobe@plt>
jmp    1119 <zylons+0x9>

x86 assembly (clang, -O2):
<zylons>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <strobe@plt>
jmp    1120 <zylons+0x10>

LLVM IR (-O0):
define i32 @zylons() {
br label %1
1: ; preds = %0, %1
%2 = call i32 (...) @strobe()
br label %1
}

LLVM IR (-O2):
define i32 @zylons() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @strobe()
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
long get_index_file_offset(const int zone, const int ra_start) {
  const int rval = (zone - 1) + ra_start * 900;
  return (rval * sizeof(int32_t));
}


x86 assembly (clang, -O0):
<get_index_file_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
imul   $0x384,-0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_index_file_offset>:
imul   $0x384,%esi,%eax
add    %edi,%eax
add    $0xffffffff,%eax
cltq
shl    $0x2,%rax
ret

LLVM IR (-O0):
define i64 @get_index_file_offset(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %6, 1
%8 = load i32, i32* %4
%9 = mul nsw i32 %8, 900
%10 = add nsw i32 %7, %9
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 4
ret i64 %13
}

LLVM IR (-O2):
define i64 @get_index_file_offset(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -1
%4 = mul nsw i32 %1, 900
%5 = add nsw i32 %3, %4
%6 = sext i32 %5 to i64
%7 = shl nsw i64 %6, 2
ret i64 %7
}
/* Type definitions */
typedef int mode_t;

/* Variables and functions */
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
mode_t xstream_file_omode(const char *mode) {
  return (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
}


x86 assembly (clang, -O0):
<xstream_file_omode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2eb1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
or     (%rcx),%eax
mov    0x2eaf(%rip),%rcx
or     (%rcx),%eax
mov    0x2ebe(%rip),%rcx
or     (%rcx),%eax
mov    0x2e95(%rip),%rcx
or     (%rcx),%eax
mov    0x2e74(%rip),%rcx
or     (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstream_file_omode>:
mov    0x2eb9(%rip),%rcx
mov    0x2ed2(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    0x2eb7(%rip),%rcx
or     (%rcx),%eax
mov    0x2ec6(%rip),%rcx
or     (%rcx),%eax
mov    0x2e9d(%rip),%rcx
or     (%rcx),%eax
mov    0x2e7c(%rip),%rcx
or     (%rcx),%eax
ret

LLVM IR (-O0):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
define i32 @xstream_file_omode(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @S_IRUSR
%4 = load i32, i32* @S_IWUSR
%5 = or i32 %3, %4
%6 = load i32, i32* @S_IRGRP
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IWGRP
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IROTH
%11 = or i32 %9, %10
%12 = load i32, i32* @S_IWOTH
%13 = or i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
define i32 @xstream_file_omode(i8* nocapture readnone %0) {
%2 = load i32, i32* @S_IRUSR
%3 = load i32, i32* @S_IWUSR
%4 = or i32 %3, %2
%5 = load i32, i32* @S_IRGRP
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IWGRP
%8 = or i32 %6, %7
%9 = load i32, i32* @S_IROTH
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IWOTH
%12 = or i32 %10, %11
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ command;

/* Variables and functions */
int /*<<< orphan*/ matrix_write(unsigned char *, int);
void matrix_setgamma(unsigned int gamma) {
  unsigned char command[] = {'F', 'W', 'C', (1 << 5) | 1, gamma};
  matrix_write(command, sizeof(command));
}


x86 assembly (clang, -O0):
<matrix_setgamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x46,-0x9(%rbp)
movb   $0x57,-0x8(%rbp)
movb   $0x43,-0x7(%rbp)
movb   $0x21,-0x6(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
lea    -0x9(%rbp),%rdi
mov    $0x5,%esi
call   1030 <matrix_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_setgamma>:
push   %rax
movl   $0x21435746,0x3(%rsp)
21
mov    %dil,0x7(%rsp)
lea    0x3(%rsp),%rdi
mov    $0x5,%esi
call   1030 <matrix_write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @matrix_setgamma(i32 %0) {
%2 = alloca i32
%3 = alloca [5 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
store i8 70, i8* %4
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 87, i8* %5
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 67, i8* %6
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8 33, i8* %7
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i32, i32* %2
%10 = trunc i32 %9 to i8
store i8 %10, i8* %8
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%12 = call i32 @matrix_write(i8* %11, i32 5)
ret void
}

LLVM IR (-O2):
define void @matrix_setgamma(i32 %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
store i8 70, i8* %3
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
store i8 87, i8* %4
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
store i8 67, i8* %5
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
store i8 33, i8* %6
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%8 = trunc i32 %0 to i8
store i8 %8, i8* %7
%9 = call i32 @matrix_write(i8* %3, i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int foo(int a, int b) {
  if (a == b)
    puts("a and b are equal");
  else
    puts("a and b are not equal");
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    113b <foo+0x2b>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
jmp    1147 <foo+0x37>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
cmp    %esi,%edi
lea    0xee6(%rip),%rax
lea    0xef1(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"a and b are equal\00"
@.str.1 = [22 x i8] c"a and b are not equal\00"
define i32 @foo(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 = icmp eq i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %2
%11 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"a and b are equal\00"
@.str.1 = [22 x i8] c"a and b are not equal\00"
define i32 @foo(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = select i1 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
ret i32 0
}
/* Type definitions */
typedef int ulong;

/* Variables and functions */
void ClearScreen(char *Screen, int xmax, int ymax) {
  register ulong k;
  for (k = 0; k < xmax * ymax; k++)
    Screen[k] = 0;
}


x86 assembly (clang, -O0):
<ClearScreen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1141 <ClearScreen+0x41>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <ClearScreen+0x15>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClearScreen>:
imul   %edx,%esi
test   %esi,%esi
jle    1125 <ClearScreen+0x15>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @ClearScreen(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = mul i32 %2, %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = zext i32 %4 to i64
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
unsigned int mus_char_to_ulint(const unsigned char *inp) {
  unsigned int o;
  unsigned char *outp = (unsigned char *)&o;
  memcpy((void *)outp, (void *)inp, 4);
  return (o);
}


x86 assembly (clang, -O0):
<mus_char_to_ulint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_char_to_ulint>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mus_char_to_ulint(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = bitcast i32* %3 to i8*
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = load i8*, i8** %2
%8 = call i32 @memcpy(i8* %6, i8* %7, i32 4)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @mus_char_to_ulint(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i8* %3, i8* %0, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
char fgaj_normalize_level(char);
char strtol(char *, int /*<<< orphan*/ *, int);
char fgaj_parse_level(char *s) {
  if (*s >= '0' && *s <= '9')
    return strtol(s, NULL, 10);
  return fgaj_normalize_level(*s);
}


x86 assembly (clang, -O0):
<fgaj_parse_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1166 <fgaj_parse_level+0x46>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     1166 <fgaj_parse_level+0x46>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %al,-0x1(%rbp)
jmp    1175 <fgaj_parse_level+0x55>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <fgaj_normalize_level@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgaj_parse_level>:
mov    (%rdi),%al
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1136 <fgaj_parse_level+0x16>
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtol@plt>
movsbl %al,%edi
jmp    1040 <fgaj_normalize_level@plt>

LLVM IR (-O0):
define signext i8 @fgaj_parse_level(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 48
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 57
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call signext i8 @strtol(i8* %14, i32* null, i32 10)
store i8 %15, i8* %2
br label %20
16: ; preds = %8, %1
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = call signext i8 @fgaj_normalize_level(i8 signext %18)
store i8 %19, i8* %2
br label %20
20: ; preds = %16, %13
%21 = load i8, i8* %2
ret i8 %21
}

LLVM IR (-O2):
define signext i8 @fgaj_parse_level(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call signext i8 @strtol(i8* nocapture %0, i32* null, i32 10)
br label %9
7: ; preds = %1
%8 = tail call signext i8 @fgaj_normalize_level(i8 signext %2)
br label %9
9: ; preds = %7, %5
%10 = phi i8 [ %6, %5 ], [ %8, %7 ]
ret i8 %10
}
int test_imm_85int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x85 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_85int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8716288
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int main(int argc, char **argv) {
  const char *name;
  name = (argc > 1) ? argv[1] : "world";
  printf("hello, %s\n", name);
  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)
cmpl   $0x1,-0x8(%rbp)
jle    1141 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1151 <main+0x41>
lea    0xeb8(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1151 <main+0x41>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     111c <main+0xc>
mov    0x8(%rsi),%rsi
jmp    1123 <main+0x13>
lea    0xedd(%rip),%rsi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"world\00"
@.str.1 = [11 x i8] c"hello, %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %2 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ protocol_init();
void protocol_maintainerthread() { protocol_init(); }


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

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

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

LLVM IR (-O2):
define void @protocol_maintainerthread() {
%1 = tail call i32 (...) @protocol_init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int symlinkat(char const *, int /*<<< orphan*/, char const *);
int symlink(const char *oldpath, const char *newpath) {
  return symlinkat(oldpath, AT_FDCWD, newpath);
}


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

x86 assembly (clang, -O2):
<symlink>:
mov    %rsi,%rdx
mov    0x2ebe(%rip),%rax
mov    (%rax),%esi
jmp    1030 <symlinkat@plt>

LLVM IR (-O0):
@AT_FDCWD = global i32 0
define i32 @symlink(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 i32, i32* @AT_FDCWD
%7 = load i8*, i8** %4
%8 = call i32 @symlinkat(i8* %5, i32 %6, i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@AT_FDCWD = global i32 0
define i32 @symlink(i8* %0, i8* %1) {
%3 = load i32, i32* @AT_FDCWD
%4 = tail call i32 @symlinkat(i8* %0, i32 %3, i8* %1)
ret i32 %4
}
unsigned latin1_upcase(unsigned c) {
  if (c - (unsigned char)'a' <= (unsigned char)'z' - (unsigned char)'a' ||
      (c - (unsigned char)'`' <= (unsigned char)'~' - (unsigned char)'`' &&
       c != (unsigned char)'w'))
    return c - (unsigned char)'a' + (unsigned char)'A';
  else
    return c;
}


x86 assembly (clang, -O0):
<latin1_upcase>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
cmp    $0x19,%eax
jbe    112f <latin1_upcase+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x60,%eax
cmp    $0x1e,%eax
ja     1140 <latin1_upcase+0x40>
cmpl   $0x77,-0x8(%rbp)
je     1140 <latin1_upcase+0x40>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <latin1_upcase+0x46>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<latin1_upcase>:
lea    -0x60(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1f,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @latin1_upcase(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sub i32 %4, 97
%6 = icmp ule i32 %5, 25
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub i32 %8, 96
%10 = icmp ule i32 %9, 30
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 119
br i1 %13, label %14, label %18
14: ; preds = %11, %1
%15 = load i32, i32* %3
%16 = sub i32 %15, 97
%17 = add i32 %16, 65
store i32 %17, i32* %2
br label %20
18: ; preds = %11, %7
%19 = load i32, i32* %3
store i32 %19, i32* %2
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @latin1_upcase(i32 %0) {
%2 = add i32 %0, -96
%3 = icmp ult i32 %2, 31
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
int /*<<< orphan*/ mysql_close(int /*<<< orphan*/ *);
void closeMysqlConnection(MYSQL *connection) { mysql_close(connection); }


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

x86 assembly (clang, -O2):
<closeMysqlConnection>:
jmp    1030 <mysql_close@plt>

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

LLVM IR (-O2):
define void @closeMysqlConnection(i32* %0) {
%2 = tail call i32 @mysql_close(i32* %0)
ret void
}
/* Variables and functions */
int rename(char const *, char const *);
int txc_libc_rename(const char *oldpath, const char *newpath) {
  return rename(oldpath, newpath);
}


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

x86 assembly (clang, -O2):
<txc_libc_rename>:
jmp    1030 <rename@plt>

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

LLVM IR (-O2):
define i32 @txc_libc_rename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ run(char *, char const *);
void mkdirp(const char *path) { run("mkdir -p \"%s\"", path); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"mkdir -p \22%s\22\00"
define void @mkdirp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @run(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"mkdir -p \22%s\22\00"
define void @mkdirp(i8* %0) {
%2 = tail call i32 @run(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
void *calloc(int, int);
int /*<<< orphan*/ error(int, char *);
void *ecalloc(int size, int cnt) {
  void *t = calloc(size, cnt);
  if (!t)
    error(1, "out of memory");
  return t;
}


x86 assembly (clang, -O0):
<ecalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1159 <ecalloc+0x39>
mov    $0x1,%edi
lea    0xeac(%rip),%rsi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecalloc>:
push   %rbx
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113f <ecalloc+0x1f>
lea    0xecb(%rip),%rsi
mov    $0x1,%edi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @ecalloc(i32 %0, i32 %1) {
%3 = tail call i8* @calloc(i32 %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @error(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
long long plugin_library_version(void) {
  return 0 * 100000000 + 0 * 100000 + 1;
}


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

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

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

LLVM IR (-O2):
define i64 @plugin_library_version() {
ret i64 1
}
unsigned long pte_index(unsigned long address) {
  return (address >> 12) & (1024 - 1);
}


x86 assembly (clang, -O0):
<pte_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0xc,%rax
and    $0x3ff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pte_index>:
mov    %rdi,%rax
shr    $0xc,%eax
and    $0x3ff,%eax
ret

LLVM IR (-O0):
define i64 @pte_index(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 12
%5 = and i64 %4, 1023
ret i64 %5
}

LLVM IR (-O2):
define i64 @pte_index(i64 %0) {
%2 = lshr i64 %0, 12
%3 = and i64 %2, 1023
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ RAND_bytes(unsigned char *, int);
char generate_random_char() {
  unsigned char c;
  do {
    (void)RAND_bytes(&c, 1);
  } while (c == '\0' || c == '\n' || c == '\r');
  return c;
}


x86 assembly (clang, -O0):
<generate_random_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x1(%rbp),%rdi
mov    $0x1,%esi
call   1030 <RAND_bytes@plt>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
je     1157 <generate_random_char+0x47>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     1157 <generate_random_char+0x47>
movzbl -0x1(%rbp),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1118 <generate_random_char+0x8>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_random_char>:
push   %r14
push   %rbx
push   %rax
lea    0x7(%rsp),%r14
mov    $0x2401,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <RAND_bytes@plt>
movzbl 0x7(%rsp),%eax
cmp    $0xd,%rax
ja     113e <generate_random_char+0x2e>
bt     %rax,%rbx
jb     1120 <generate_random_char+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define signext i8 @generate_random_char() {
%1 = alloca i8
br label %2
2: ; preds = %16, %0
%3 = call i32 @RAND_bytes(i8* %1, i32 1)
br label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = zext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = load i8, i8* %1
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 10
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i8, i8* %1
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 13
br label %16
16: ; preds = %12, %8, %4
%17 = phi i1 [ true, %8 ], [ true, %4 ], [ %15, %12 ]
br i1 %17, label %2, label %18
18: ; preds = %16
%19 = load i8, i8* %1
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @generate_random_char() {
%1 = alloca i8
br label %2
2: ; preds = %5, %0
%3 = call i32 @RAND_bytes(i8* %1, i32 1)
%4 = load i8, i8* %1
switch i8 %4, label %6 [
i8 13, label %5
i8 10, label %5
i8 0, label %5
]
5: ; preds = %2, %2, %2
br label %2
6: ; preds = %2
ret i8 %4
}
int _dup2(oldfd, newfd) {
  _close(newfd);
  return _fcntl(oldfd, 0, newfd);
}


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

x86 assembly (clang, -O2):
<_dup2>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
xor    %eax,%eax
call   1030 <_close@plt>
mov    %ebp,%edi
xor    %esi,%esi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <_fcntl@plt>

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

LLVM IR (-O2):
define i32 @_dup2(i32 %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @_close to i32 (i32, ...)*)(i32 %1)
%4 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @_fcntl to i32 (i32, i32, i32, ...)*)(i32 %0, i32 0, i32 %1)
ret i32 %4
}