xunge/DecIR huggingface dataset:
/* Variables and functions */
double sqrt(double);
double vector_norm(double *v) {
  return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}


x86 assembly (clang, -O0):
<vector_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_norm>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1141 <vector_norm+0x31>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @vector_norm(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = fmul double %11, %14
%16 = call double @llvm.fmuladd.f64(double %5, double %8, double %15)
%17 = load double*, double** %2
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = load double*, double** %2
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = call double @llvm.fmuladd.f64(double %19, double %22, double %16)
%24 = call double @sqrt(double %23)
ret double %24
}

LLVM IR (-O2):
define double @vector_norm(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fmul double %4, %4
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %6)
%10 = tail call double @sqrt(double %9)
ret double %10
}
g() {
  enum A { X } a;
}


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

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

LLVM IR (-O0):
define i32 @g() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @g() {
ret i32 undef
}
unsigned int test_20(int x, unsigned int y, unsigned int z) {
  return ~(x >> 31) ? y : z;
}


x86 assembly (clang, -O0):
<test_20>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
xor    $0xffffffff,%eax
cmp    $0x0,%eax
je     112a <test_20+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <test_20+0x30>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_20>:
mov    %esi,%eax
test   %edi,%edi
cmovs  %edx,%eax
ret

LLVM IR (-O0):
define i32 @test_20(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = ashr i32 %7, 31
%9 = xor i32 %8, -1
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load i32, i32* %5
br label %15
13: ; preds = %3
%14 = load i32, i32* %6
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %12, %11 ], [ %14, %13 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @test_20(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, 0
%5 = select i1 %4, i32 %2, i32 %1
ret i32 %5
}
int division(int *a, int *b) { return *a / *b; }


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

x86 assembly (clang, -O2):
<division>:
mov    (%rdi),%eax
cltd
idivl  (%rsi)
ret

LLVM IR (-O0):
define i32 @division(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* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = sdiv i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @division(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = sdiv i32 %3, %4
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ max_char_or_byte2;
};
typedef TYPE_1__ XFontStruct;

/* Variables and functions */
unsigned get_XFontStruct_max_char_or_byte2(void *_p) {
  return (unsigned)((XFontStruct *)_p)->max_char_or_byte2;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define i32 @get_XFontStruct_max_char_or_byte2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @get_XFontStruct_max_char_or_byte2(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
double fabs(double);
int rd_dbl_eq0(double a, double b, double prec) { return fabs(a - b) < prec; }


x86 assembly (clang, -O0):
<rd_dbl_eq0>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movaps 0xedc(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd_dbl_eq0>:
subsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm0,%xmm2
seta   %al
ret

LLVM IR (-O0):
define i32 @rd_dbl_eq0(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
%10 = call double @llvm.fabs.f64(double %9)
%11 = load double, double* %6
%12 = fcmp olt double %10, %11
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @rd_dbl_eq0(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fcmp olt double %5, %2
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
double Random();
int log(double);
long Geometric(double p) { return ((long)(log(1.0 - Random()) / log(p))); }


x86 assembly (clang, -O0):
<Geometric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <Random@plt>
movaps %xmm0,%xmm1
movsd  0xec1(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1040 <log@plt>
mov    %eax,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <log@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Geometric>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <Random@plt>
movsd  0xec6(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <log@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1040 <log@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
cltq
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @Geometric(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call double (...) @Random()
%4 = fsub double 1.000000e+00, %3
%5 = call i32 @log(double %4)
%6 = load double, double* %2
%7 = call i32 @log(double %6)
%8 = sdiv i32 %5, %7
%9 = sext i32 %8 to i64
ret i64 %9
}

LLVM IR (-O2):
define i64 @Geometric(double %0) {
%2 = tail call double (...) @Random()
%3 = fsub double 1.000000e+00, %2
%4 = tail call i32 @log(double %3)
%5 = tail call i32 @log(double %0)
%6 = sdiv i32 %4, %5
%7 = sext i32 %6 to i64
ret i64 %7
}
/* Variables and functions */
int set_clear_promisc(int /*<<< orphan*/);
int clear_promisc() { return set_clear_promisc(0); }


x86 assembly (clang, -O0):
<clear_promisc>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <set_clear_promisc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_promisc>:
xor    %edi,%edi
jmp    1030 <set_clear_promisc@plt>

LLVM IR (-O0):
define i32 @clear_promisc() {
%1 = call i32 @set_clear_promisc(i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @clear_promisc() {
%1 = tail call i32 @set_clear_promisc(i32 0)
ret i32 %1
}
int _packh2(unsigned int src1, unsigned int src2) {
  unsigned v0 = src1 & 0xffff0000;
  unsigned v1 = src2 >> 16;
  unsigned v = v0 | v1;
  return v;
}


x86 assembly (clang, -O0):
<_packh2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff0000,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_packh2>:
and    $0xffff0000,%edi
shr    $0x10,%esi
lea    (%rsi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @_packh2(i32 %0, i32 %1) {
%3 = and i32 %0, -65536
%4 = lshr i32 %1, 16
%5 = or i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
__attribute__((constructor)) void aloha(void) { exit(0xFD); }


x86 assembly (clang, -O0):
<aloha>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfd,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<aloha>:
push   %rax
mov    $0xfd,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @aloha, i8* null }]
define void @aloha() {
%1 = call i32 @exit(i32 253)
unreachable
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @aloha, i8* null }]
define void @aloha() {
%1 = tail call i32 @exit(i32 253)
unreachable
}
double calculateAngleMoveTime(double differenceInAngle) {
  return (differenceInAngle / 1 * 1000);
}


x86 assembly (clang, -O0):
<calculateAngleMoveTime>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xef2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateAngleMoveTime>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @calculateAngleMoveTime(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 1.000000e+00
%5 = fmul double %4, 1.000000e+03
ret double %5
}

LLVM IR (-O2):
define double @calculateAngleMoveTime(double %0) {
%2 = fmul double %0, 1.000000e+03
ret double %2
}
/* Variables and functions */
scalar_t__ ceil(int /*<<< orphan*/);
int /*<<< orphan*/ log2(double);
double rbits(int);
double R_unif_index(double dn) {
  if (dn <= 0)
    return 0.0;
  int bits = (int)ceil(log2(dn));
  double dv;
  do {
    dv = rbits(bits);
  } while (dn <= dv);
  return dv;
}


x86 assembly (clang, -O0):
<R_unif_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1158 <R_unif_index+0x28>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1197 <R_unif_index+0x67>
movsd  -0x10(%rbp),%xmm0
call   1030 <log2@plt>
mov    %eax,%edi
call   1040 <ceil@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <rbits@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    116c <R_unif_index+0x3c>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<R_unif_index>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm1,0x8(%rsp)
ucomisd %xmm1,%xmm0
jae    116f <R_unif_index+0x3f>
movsd  0x8(%rsp),%xmm0
call   1030 <log2@plt>
mov    %eax,%edi
call   1040 <ceil@plt>
mov    %rax,%rbx
xchg   %ax,%ax
mov    %ebx,%edi
call   1050 <rbits@plt>
ucomisd 0x8(%rsp),%xmm0
jae    1160 <R_unif_index+0x30>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @R_unif_index(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = fcmp ole double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %1
store double 0.000000e+00, double* %2
br label %23
9: ; preds = %1
%10 = load double, double* %3
%11 = call i32 @log2(double %10)
%12 = call i64 @ceil(i32 %11)
%13 = trunc i64 %12 to i32
store i32 %13, i32* %4
br label %14
14: ; preds = %17, %9
%15 = load i32, i32* %4
%16 = call double @rbits(i32 %15)
store double %16, double* %5
br label %17
17: ; preds = %14
%18 = load double, double* %3
%19 = load double, double* %5
%20 = fcmp ole double %18, %19
br i1 %20, label %14, label %21
21: ; preds = %17
%22 = load double, double* %5
store double %22, double* %2
br label %23
23: ; preds = %21, %8
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
define double @R_unif_index(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %3, label %10
3: ; preds = %1
%4 = tail call i32 @log2(double %0)
%5 = tail call i64 @ceil(i32 %4)
%6 = trunc i64 %5 to i32
br label %7
7: ; preds = %7, %3
%8 = tail call double @rbits(i32 %6)
%9 = fcmp ult double %8, %0
br i1 %9, label %10, label %7
10: ; preds = %7, %1
%11 = phi double [ 0.000000e+00, %1 ], [ %8, %7 ]
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ angle_d(char *, char *);
int /*<<< orphan*/ angle_u(char *, char *);
int /*<<< orphan*/ checker(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ parallel(char *, char *);
int /*<<< orphan*/ vertical(char *, char *);
void wrd(char *a, char *b) {
  parallel(a, b);
  vertical(a, b);
  angle_d(a, b);
  angle_u(a, b);
  checker(0, 0, 1);
}


x86 assembly (clang, -O0):
<wrd>:
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   1050 <parallel@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <vertical@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <angle_d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <angle_u@plt>
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1060 <checker@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrd>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <parallel@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <vertical@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <angle_d@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <angle_u@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <checker@plt>

LLVM IR (-O0):
define void @wrd(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 @parallel(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @vertical(i8* %8, i8* %9)
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i32 @angle_d(i8* %11, i8* %12)
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = call i32 @angle_u(i8* %14, i8* %15)
%17 = call i32 @checker(i32 0, i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @wrd(i8* %0, i8* %1) {
%3 = tail call i32 @parallel(i8* %0, i8* %1)
%4 = tail call i32 @vertical(i8* %0, i8* %1)
%5 = tail call i32 @angle_d(i8* %0, i8* %1)
%6 = tail call i32 @angle_u(i8* %0, i8* %1)
%7 = tail call i32 @checker(i32 0, i32 0, i32 1)
ret void
}
void foo384(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo384(i32 %0) {
ret void
}
long replace_dot_by_N(char *seq) {
  long n = 0;
  long replaced = 0;
  while (seq[n] != '\0') {
    if (seq[n] == '.') {
      ++replaced;
      seq[n] = 'N';
    }
    ++n;
  }
  return replaced;
}


x86 assembly (clang, -O0):
<replace_dot_by_N>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116b <replace_dot_by_N+0x6b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    115a <replace_dot_by_N+0x5a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x4e,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <replace_dot_by_N+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_dot_by_N>:
xor    %eax,%eax
jmp    111b <replace_dot_by_N+0x1b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rax
movb   $0x4e,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x2e,%cl
je     1110 <replace_dot_by_N+0x10>
test   %cl,%cl
jne    1117 <replace_dot_by_N+0x17>
ret

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

LLVM IR (-O2):
define i64 @replace_dot_by_N(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i64 [ 0, %1 ], [ %11, %9 ]
%4 = phi i64 [ 0, %1 ], [ %10, %9 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 0, label %12
i8 46, label %7
]
7: ; preds = %2
%8 = add nsw i64 %4, 1
store i8 78, i8* %5
br label %9
9: ; preds = %2, %7
%10 = phi i64 [ %8, %7 ], [ %4, %2 ]
%11 = add nuw nsw i64 %3, 1
br label %2
12: ; preds = %2
ret i64 %4
}
int tokpos(char *str, int len, char tok) {
  int i;
  int pos = -1;
  for (i = 0; i < len; i++) {
    if (str[i] == tok) {
      pos = i;
      break;
    }
  }
  return pos;
}


x86 assembly (clang, -O0):
<tokpos>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movl   $0xffffffff,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1160 <tokpos+0x60>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0xd(%rbp),%ecx
cmp    %ecx,%eax
jne    114d <tokpos+0x4d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <tokpos+0x60>
jmp    1152 <tokpos+0x52>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111e <tokpos+0x1e>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tokpos>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <tokpos+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %dl,(%rdi,%rcx,1)
je     111f <tokpos+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <tokpos+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @tokpos(i8* nocapture %0, i32 %1, i8 signext %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ slab_deinit_ctable();
int /*<<< orphan*/ slab_deinit_stable();
void slab_deinit(void) {
  slab_deinit_ctable();
  slab_deinit_stable();
}


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

x86 assembly (clang, -O2):
<slab_deinit>:
push   %rax
xor    %eax,%eax
call   1030 <slab_deinit_ctable@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <slab_deinit_stable@plt>

LLVM IR (-O0):
define void @slab_deinit() {
%1 = call i32 (...) @slab_deinit_ctable()
%2 = call i32 (...) @slab_deinit_stable()
ret void
}

LLVM IR (-O2):
define void @slab_deinit() {
%1 = tail call i32 (...) @slab_deinit_ctable()
%2 = tail call i32 (...) @slab_deinit_stable()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ create_drive_direct(int, int);
void lib_create_drive_direct(int left, int right) {
  create_drive_direct(left, right);
}


x86 assembly (clang, -O0):
<lib_create_drive_direct>:
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 <create_drive_direct@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib_create_drive_direct>:
jmp    1030 <create_drive_direct@plt>

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

LLVM IR (-O2):
define void @lib_create_drive_direct(i32 %0, i32 %1) {
%3 = tail call i32 @create_drive_direct(i32 %0, i32 %1)
ret void
}
int se_8_32(int reg) {
  int value = (0x000000ff & reg);
  int mask = 0x00000080;
  if (mask & reg) {
    value += 0xffffff00;
  }
  return value;
}


x86 assembly (clang, -O0):
<se_8_32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
movl   $0x80,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    -0x4(%rbp),%eax
cmp    $0x0,%eax
je     1133 <se_8_32+0x33>
mov    -0x8(%rbp),%eax
add    $0xffffff00,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<se_8_32>:
movzbl %dil,%ecx
movsbl %cl,%eax
and    $0xffffff00,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @se_8_32(i32 %0) {
%2 = and i32 %0, 255
%3 = and i32 %0, 128
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 0, i32 -256
%6 = or i32 %5, %2
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int rand();
int irand(int n) {
  assert(n > 1);
  return rand() % n;
}


x86 assembly (clang, -O0):
<irand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x0,%al
call   1040 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irand>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x2,%ebx
setge  %dil
call   1030 <assert@plt>
xor    %eax,%eax
call   1040 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @irand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 1
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i32 (...) @rand()
%8 = load i32, i32* %2
%9 = srem i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @irand(i32 %0) {
%2 = icmp sgt i32 %0, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, %0
ret i32 %6
}
/* Variables and functions */
long in_be32(unsigned int volatile *);
int /*<<< orphan*/ out_be32(unsigned int volatile *, int);
long cpc700_read_memreg(int reg) {
  out_be32((volatile unsigned int *)0xff500008, reg);
  return in_be32((volatile unsigned int *)0xff50000c);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0xff500008,%edi
call   1040 <out_be32@plt>
mov    $0xff50000c,%edi
call   1030 <in_be32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
mov    %edi,%esi
mov    $0xff500008,%ebx
mov    $0xff500008,%edi
call   1040 <out_be32@plt>
or     $0x4,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <in_be32@plt>

LLVM IR (-O0):
define i64 @cpc700_read_memreg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @out_be32(i32* inttoptr (i64 4283432968 to i32*), i32 %3)
%5 = call i64 @in_be32(i32* inttoptr (i64 4283432972 to i32*))
ret i64 %5
}

LLVM IR (-O2):
define i64 @cpc700_read_memreg(i32 %0) {
%2 = tail call i32 @out_be32(i32* inttoptr (i64 4283432968 to i32*), i32 %0)
%3 = tail call i64 @in_be32(i32* inttoptr (i64 4283432972 to i32*))
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ consume();
int /*<<< orphan*/ endOfProcess();
void consumer() {
  consume();
  endOfProcess();
}


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

x86 assembly (clang, -O2):
<consumer>:
push   %rax
xor    %eax,%eax
call   1040 <consume@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <endOfProcess@plt>

LLVM IR (-O0):
define void @consumer() {
%1 = call i32 (...) @consume()
%2 = call i32 (...) @endOfProcess()
ret void
}

LLVM IR (-O2):
define void @consumer() {
%1 = tail call i32 (...) @consume()
%2 = tail call i32 (...) @endOfProcess()
ret void
}
/* Variables and functions */
scalar_t__ is_num(char);
int char_to_int(char num) {
  if (is_num(num)) {
    return num - '0';
  }
  return 0;
}


x86 assembly (clang, -O0):
<char_to_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <is_num@plt>
cmp    $0x0,%rax
je     1140 <char_to_int+0x30>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <char_to_int+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_to_int>:
push   %rbx
mov    %edi,%ebx
call   1030 <is_num@plt>
add    $0xffffffd0,%ebx
xor    %ecx,%ecx
test   %rax,%rax
cmovne %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @char_to_int(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @is_num(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @char_to_int(i8 signext %0) {
%2 = tail call i64 @is_num(i8 signext %0)
%3 = icmp eq i64 %2, 0
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
long double test_fmal(long double x, long double y, long double z) {
  return __builtin_fmal(x, y, z);
}


x86 assembly (clang, -O0):
<test_fmal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
fldt   0x30(%rbp)
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <fmal@plt>
fld    %st(0)
fstp   %st(0)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fmal>:
sub    $0x38,%rsp
fldt   0x40(%rsp)
fldt   0x50(%rsp)
fldt   0x60(%rsp)
fstpt  0x20(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1030 <fmal@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @test_fmal(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2) {
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
store x86_fp80 %2, x86_fp80* %6
%7 = load x86_fp80, x86_fp80* %4
%8 = load x86_fp80, x86_fp80* %5
%9 = load x86_fp80, x86_fp80* %6
%10 = call x86_fp80 @llvm.fma.f80(x86_fp80 %7, x86_fp80 %8, x86_fp80 %9)
ret x86_fp80 %10
}

LLVM IR (-O2):
define x86_fp80 @test_fmal(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2) {
%4 = tail call x86_fp80 @llvm.fma.f80(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2)
ret x86_fp80 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("gdbstub [-s speed] [-t tty-dev]\n");
  printf("  defaults:  /dev/ttyS0 with speed unmodified by this program\n");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefc(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"gdbstub [-s speed] [-t tty-dev]\0A\00"
@.str.1 = [63 x i8] c" defaults: /dev/ttyS0 with speed unmodified by this program\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [32 x i8] c"gdbstub [-s speed] [-t tty-dev]\00"
@str.2 = [62 x i8] c" defaults: /dev/ttyS0 with speed unmodified by this program\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.2, i64 0, i64 0))
ret void
}
unsigned char unsignedchar_ignoring_unsignedint(unsigned char x,
                                                unsigned int y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedchar_ignoring_unsignedint>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsignedchar_ignoring_unsignedint>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @unsignedchar_ignoring_unsignedint(i8 returned zeroext %0, i32 %1) {
ret i8 %0
}
/* Variables and functions */
size_t Int32Hash(size_t);
size_t Int64Hash(size_t);
size_t GenIntHash(size_t a) {
  return sizeof(size_t) == 4   ? Int32Hash(a)
         : sizeof(size_t) == 8 ? Int64Hash(a)
                               : 0;
}


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

x86 assembly (clang, -O2):
<GenIntHash>:
jmp    1030 <Int64Hash@plt>

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

LLVM IR (-O2):
define i64 @GenIntHash(i64 %0) {
%2 = tail call i64 @Int64Hash(i64 %0)
ret i64 %2
}
unsigned int unbcd(unsigned int value) {
  return (((value >> 16) & 15) * 1000 + ((value >> 12) & 15) * 100 +
          ((value >> 4) & 15) * 10 + (value & 15));
}


x86 assembly (clang, -O0):
<unbcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xf,%eax
imul   $0x3e8,%eax,%eax
mov    -0x4(%rbp),%ecx
shr    $0xc,%ecx
and    $0xf,%ecx
imul   $0x64,%ecx,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shr    $0x4,%ecx
and    $0xf,%ecx
imul   $0xa,%ecx,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unbcd>:
mov    %edi,%eax
shr    $0x10,%eax
and    $0xf,%eax
imul   $0x3e8,%eax,%eax
mov    %edi,%ecx
shr    $0xc,%ecx
and    $0xf,%ecx
imul   $0x64,%ecx,%ecx
mov    %edi,%edx
shr    $0x4,%edx
and    $0xf,%edx
lea    (%rdx,%rdx,4),%edx
and    $0xf,%edi
add    %ecx,%edi
add    %eax,%edi
lea    (%rdi,%rdx,2),%eax
ret

LLVM IR (-O0):
define i32 @unbcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 16
%5 = and i32 %4, 15
%6 = mul i32 %5, 1000
%7 = load i32, i32* %2
%8 = lshr i32 %7, 12
%9 = and i32 %8, 15
%10 = mul i32 %9, 100
%11 = add i32 %6, %10
%12 = load i32, i32* %2
%13 = lshr i32 %12, 4
%14 = and i32 %13, 15
%15 = mul i32 %14, 10
%16 = add i32 %11, %15
%17 = load i32, i32* %2
%18 = and i32 %17, 15
%19 = add i32 %16, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @unbcd(i32 %0) {
%2 = lshr i32 %0, 16
%3 = and i32 %2, 15
%4 = mul nuw nsw i32 %3, 1000
%5 = lshr i32 %0, 12
%6 = and i32 %5, 15
%7 = mul nuw nsw i32 %6, 100
%8 = lshr i32 %0, 4
%9 = and i32 %8, 15
%10 = mul nuw nsw i32 %9, 10
%11 = and i32 %0, 15
%12 = add nuw nsw i32 %7, %11
%13 = add nuw nsw i32 %12, %4
%14 = add nuw nsw i32 %13, %10
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int game_over() {
  sleep(1);
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<game_over>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x0,%al
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<game_over>:
push   %rax
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @game_over() {
%1 = call i32 @sleep(i32 1)
%2 = call i32 (...) @endwin()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @game_over() {
%1 = tail call i32 @sleep(i32 1)
%2 = tail call i32 (...) @endwin()
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ sink(int *);
void test_int_vla_location(void) {
  unsigned nelts = 7;
  int vla[nelts];
  vla[0] = 26;
  vla[nelts] = 1;
  sink(vla);
}


x86 assembly (clang, -O0):
<test_int_vla_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x7,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x1a,(%rdi)
mov    -0x4(%rbp),%eax
movl   $0x1,(%rdi,%rax,4)
call   1030 <sink@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_int_vla_location>:
sub    $0x28,%rsp
movl   $0x1a,(%rsp)
movl   $0x1,0x1c(%rsp)
mov    %rsp,%rdi
call   1030 <sink@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @test_int_vla_location() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
store i32 7, i32* %1
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
store i8* %6, i8** %2
%7 = alloca i32, i64 %5
store i64 %5, i64* %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 26, i32* %8
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %7, i64 %10
store i32 1, i32* %11
%12 = call i32 @sink(i32* %7)
%13 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @test_int_vla_location() {
%1 = alloca [7 x i32]
%2 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
store i32 26, i32* %2
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 7
store i32 1, i32* %3
%4 = call i32 @sink(i32* %2)
ret void
}
int LeftChild(int Parent) { return Parent * 2 + 1; }


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

x86 assembly (clang, -O2):
<LeftChild>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @LeftChild(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Variables and functions */
void *memchr(const void *s, int c, size_t n) {
  const unsigned char *pc = (unsigned char *)s;
  for (; n--; pc++)
    if (*pc == c)
      return ((void *)pc);
  return 0;
}


x86 assembly (clang, -O0):
<memchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1163 <memchr+0x63>
mov    -0x28(%rbp),%rax
movzbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    114d <memchr+0x4d>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <memchr+0x6b>
jmp    1152 <memchr+0x52>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1117 <memchr+0x17>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memchr>:
test   %rdx,%rdx
je     1124 <memchr+0x24>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
cmp    %esi,%ecx
je     1126 <memchr+0x26>
add    $0xffffffffffffffff,%rdx
add    $0x1,%rax
test   %rdx,%rdx
jne    1110 <memchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @memchr(i8* %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3, %12
%6 = phi i64 [ %8, %12 ], [ %2, %3 ]
%7 = phi i8* [ %13, %12 ], [ %0, %3 ]
%8 = add i64 %6, -1
%9 = load i8, i8* %7
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, %1
br i1 %11, label %15, label %12
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = icmp eq i64 %8, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %12, %3
%16 = phi i8* [ null, %3 ], [ null, %12 ], [ %7, %5 ]
ret i8* %16
}
int test_imm_47uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x47 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_47uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 71
%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_47uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 304942678016
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void ADCComparatorIntDisable(unsigned long ulBase,
                             unsigned long ulSequenceNum) {
  ;
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000008))) &=
      ~(0x10000 << ulSequenceNum);
}


x86 assembly (clang, -O0):
<ADCComparatorIntDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x10000,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCComparatorIntDisable>:
mov    %rsi,%rcx
mov    $0x10000,%eax
shl    %cl,%eax
not    %eax
cltq
and    %rax,0x8(%rdi)
ret

LLVM IR (-O0):
define void @ADCComparatorIntDisable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 65536, %6
%8 = xor i32 %7, -1
%9 = sext i32 %8 to i64
%10 = load i64, i64* %3
%11 = add i64 %10, 8
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, %9
store volatile i64 %14, i64* %12
ret void
}

LLVM IR (-O2):
define void @ADCComparatorIntDisable(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl i32 65536, %3
%5 = xor i32 %4, -1
%6 = sext i32 %5 to i64
%7 = add i64 %0, 8
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, %6
store volatile i64 %10, i64* %8
ret void
}
void *AssetCreateHandler(struct _Asset *asset) {}


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

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

LLVM IR (-O0):
%struct._Asset = type opaque
define i8* @AssetCreateHandler(%struct._Asset* %0) {
%2 = alloca i8*
%3 = alloca %struct._Asset*
store %struct._Asset* %0, %struct._Asset** %3
%4 = load i8*, i8** %2
ret i8* %4
}

LLVM IR (-O2):
%struct._Asset = type opaque
define noalias i8* @AssetCreateHandler(%struct._Asset* nocapture readnone %0) {
ret i8* undef
}
int test_imm_4Dint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x4D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_4Dint64_highword_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, 32
%6 = and i64 %5, 77
%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_4Dint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 330712481792
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int _mpyh(int src1, int src2) {
  return (short)(src1 >> 16) * (short)(src2 >> 16);
}


x86 assembly (clang, -O0):
<_mpyh>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
cwtl
mov    -0x8(%rbp),%ecx
sar    $0x10,%ecx
movswl %cx,%ecx
imul   %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mpyh>:
mov    %esi,%eax
sar    $0x10,%edi
sar    $0x10,%eax
imul   %edi,%eax
ret

LLVM IR (-O0):
define i32 @_mpyh(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 = ashr i32 %5, 16
%7 = trunc i32 %6 to i16
%8 = sext i16 %7 to i32
%9 = load i32, i32* %4
%10 = ashr i32 %9, 16
%11 = trunc i32 %10 to i16
%12 = sext i16 %11 to i32
%13 = mul nsw i32 %8, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @_mpyh(i32 %0, i32 %1) {
%3 = ashr i32 %0, 16
%4 = ashr i32 %1, 16
%5 = mul nsw i32 %4, %3
ret i32 %5
}
/* Variables and functions */
char *ipv6_addr_split_str(char *, char);
char *ipv6_addr_split_iface(char *addr_str) {
  return ipv6_addr_split_str(addr_str, '%');
}


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

x86 assembly (clang, -O2):
<ipv6_addr_split_iface>:
mov    $0x25,%esi
jmp    1030 <ipv6_addr_split_str@plt>

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

LLVM IR (-O2):
define i8* @ipv6_addr_split_iface(i8* %0) {
%2 = tail call i8* @ipv6_addr_split_str(i8* %0, i8 signext 37)
ret i8* %2
}
int test_imm_30int8_reg(signed char val) {
  return ((val) & (-0x30 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_30int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffd0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_30int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -48
%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_30int8_reg(i8 signext %0) {
%2 = and i8 %0, -48
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}