xunge/DecIR huggingface dataset:
int gcd(int x, int y) {
  if (0 == y) {
    return x;
  } else {
    return gcd(y, x % y);
  }
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
jne    1134 <gcd+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <gcd+0x38>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <gcd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ check_file(char *);
int /*<<< orphan*/ check_null();
int main(void) {
  check_null();
  check_file("strtoc.dat");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"strtoc.dat\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @check_null()
%3 = call i32 @check_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"strtoc.dat\00"
define i32 @main() {
%1 = tail call i32 (...) @check_null()
%2 = tail call i32 @check_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
double f4(double x) { return (x - (-0.0)) - (-0.0); }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, -0.000000e+00
%5 = fsub double %4, -0.000000e+00
ret double %5
}

LLVM IR (-O2):
define double @f4(double %0) {
%2 = fadd double %0, 0.000000e+00
ret double %2
}
void efx_init_mcdi_logging(struct efx_nic *efx) {}


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

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

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

LLVM IR (-O2):
%struct.efx_nic = type opaque
define void @efx_init_mcdi_logging(%struct.efx_nic* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MapFile(char *);
int /*<<< orphan*/ TellFile(int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *);
TellClauseFile() {
  char name[4096];
  extern char *SourceName();
  sprintf(name, "%s.c", SourceName());
  TellFile(MapFile(name));
}


x86 assembly (clang, -O0):
<TellClauseFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
lea    -0x1010(%rbp),%rax
mov    %rax,-0x1018(%rbp)
mov    $0x0,%al
call   1040 <SourceName@plt>
mov    -0x1018(%rbp),%rdi
mov    %rax,%rdx
lea    0xe8f(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x1010(%rbp),%rdi
call   1030 <MapFile@plt>
mov    %eax,%edi
call   1060 <TellFile@plt>
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TellClauseFile>:
push   %rbx
sub    $0x1000,%rsp
xor    %eax,%eax
call   1040 <SourceName@plt>
lea    0xeaa(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <MapFile@plt>
mov    %eax,%edi
call   1060 <TellFile@plt>
add    $0x1000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s.c\00"
define i32 @TellClauseFile() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = call i8* (...) @SourceName()
%5 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%7 = call i32 @MapFile(i8* %6)
%8 = call i32 @TellFile(i32 %7)
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s.c\00"
define i32 @TellClauseFile() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = tail call i8* (...) @SourceName()
%4 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @MapFile(i8* %2)
%6 = call i32 @TellFile(i32 %5)
ret i32 undef
}
/* Variables and functions */
size_t ccp4_flength(char *s, int len) {
  while (s[--len] == ' ')
    ;
  return (++len);
}


x86 assembly (clang, -O0):
<ccp4_flength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    112d <ccp4_flength+0x2d>
jmp    110b <ccp4_flength+0xb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccp4_flength>:
movslq %esi,%rdx
lea    (%rdx,%rdi,1),%rcx
add    $0xffffffffffffffff,%rcx
shl    $0x20,%rdx
movabs $0x100000000,%rax
add    %rdx,%rax
movabs $0xffffffff00000000,%rdx
ff ff ff
cs nopw 0x0(%rax,%rax,1)
add    %rdx,%rax
cmpb   $0x20,(%rcx)
lea    -0x1(%rcx),%rcx
je     1130 <ccp4_flength+0x30>
sar    $0x20,%rax
ret

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

LLVM IR (-O2):
define i64 @ccp4_flength(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ %6, %4 ], [ %3, %2 ]
%6 = add nsw i64 %5, -1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 32
br i1 %9, label %4, label %10
10: ; preds = %4
%11 = shl i64 %5, 32
%12 = ashr exact i64 %11, 32
ret i64 %12
}
/* Variables and functions */
float fasterexp(float);
float fastercosh(float p) { return 0.5f * (fasterexp(p) + fasterexp(-p)); }


x86 assembly (clang, -O0):
<fastercosh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fasterexp@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <fasterexp@plt>
movss  -0x8(%rbp),%xmm1
addss  %xmm0,%xmm1
movss  0xeac(%rip),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastercosh>:
sub    $0x28,%rsp
movaps %xmm0,0x10(%rsp)
call   1030 <fasterexp@plt>
movss  %xmm0,0xc(%rsp)
movaps 0x10(%rsp),%xmm0
xorps  0xed0(%rip),%xmm0
call   1030 <fasterexp@plt>
addss  0xc(%rsp),%xmm0
mulss  0xecd(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @fastercosh(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @fasterexp(float %3)
%5 = load float, float* %2
%6 = fneg float %5
%7 = call float @fasterexp(float %6)
%8 = fadd float %4, %7
%9 = fmul float 5.000000e-01, %8
ret float %9
}

LLVM IR (-O2):
define float @fastercosh(float %0) {
%2 = tail call float @fasterexp(float %0)
%3 = fneg float %0
%4 = tail call float @fasterexp(float %3)
%5 = fadd float %2, %4
%6 = fmul float %5, 5.000000e-01
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void failwhale(void) {
  printf("fail whale :(\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"fail whale :(\0A\00"
define void @failwhale() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [14 x i8] c"fail whale :(\00"
define void @failwhale() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int qsort_desc_dvector(const void *a, const void *b) {
  const double *aa = a;
  const double *bb = b;
  if (*aa < *bb)
    return 1;
  else if (*aa == *bb)
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<qsort_desc_dvector>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1142 <qsort_desc_dvector+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1176 <qsort_desc_dvector+0x76>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jne    116a <qsort_desc_dvector+0x6a>
jp     116a <qsort_desc_dvector+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1176 <qsort_desc_dvector+0x76>
jmp    116f <qsort_desc_dvector+0x6f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort_desc_dvector>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
ucomisd %xmm0,%xmm1
cmpneqsd %xmm1,%xmm0
movq   %xmm0,%rcx
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @qsort_desc_dvector(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double*
%7 = alloca double*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
store double* %9, double** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to double*
store double* %11, double** %7
%12 = load double*, double** %6
%13 = load double, double* %12
%14 = load double*, double** %7
%15 = load double, double* %14
%16 = fcmp olt double %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %27
18: ; preds = %2
%19 = load double*, double** %6
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = load double, double* %21
%23 = fcmp oeq double %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 0, i32* %3
br label %27
25: ; preds = %18
br label %26
26: ; preds = %25
store i32 -1, i32* %3
br label %27
27: ; preds = %26, %24, %17
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @qsort_desc_dvector(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = fcmp une double %5, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void **copy_2d(void **dst, const void **src, size_t n, size_t m, size_t size) {
  memcpy(dst[0], src[0], n * m * size);
  return dst;
}


x86 assembly (clang, -O0):
<copy_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rdx
imul   -0x20(%rbp),%rdx
imul   -0x28(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_2d>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    (%rsi),%rsi
imul   %rcx,%rdx
imul   %r8,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8** @copy_2d(i8** returned %0, i8** nocapture %1, i64 %2, i64 %3, i64 %4) {
%6 = load i8*, i8** %0
%7 = load i8*, i8** %1
%8 = mul i64 %3, %2
%9 = mul i64 %8, %4
%10 = tail call i32 @memcpy(i8* %6, i8* %7, i64 %9)
ret i8** %0
}
double get_volts(int val, int zero, int range) {
  if (val <= 0x7000)
    val = val + 0x10000;
  val = val - zero;
  return ((double)val * 3.3) / range;
}


x86 assembly (clang, -O0):
<get_volts>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x7000,-0x4(%rbp)
jg     1125 <get_volts+0x25>
mov    -0x4(%rbp),%eax
add    $0x10000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xec5(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_volts>:
lea    0x10000(%rdi),%eax
cmp    $0x7001,%edi
cmovge %edi,%eax
sub    %esi,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xee3(%rip),%xmm0
cvtsi2sd %edx,%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @get_volts(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 = icmp sle i32 %7, 28672
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 65536
store i32 %11, i32* %4
br label %12
12: ; preds = %9, %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = sub nsw i32 %13, %14
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = fmul double %17, 3.300000e+00
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to double
%21 = fdiv double %18, %20
ret double %21
}

LLVM IR (-O2):
define double @get_volts(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, 28673
%5 = add nsw i32 %0, 65536
%6 = select i1 %4, i32 %5, i32 %0
%7 = sub nsw i32 %6, %1
%8 = sitofp i32 %7 to double
%9 = fmul double %8, 3.300000e+00
%10 = sitofp i32 %2 to double
%11 = fdiv double %9, %10
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void main() {
  while (1) {
    putchar('a');
    return;
  }
  putchar(10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <main+0x9>
mov    $0x61,%edi
call   1030 <putchar@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
br label %1
1: ; preds = %0
%2 = call i32 @putchar(i32 97)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @putchar(i32 97)
ret void
}
/* Variables and functions */
void *cpy(char *, char *, int);
int main(int argc, char **argv) {
  void *foo = 0;
  if (argc > 16)
    foo = cpy(argv[0], argv[1], argc);
  return foo != 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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x8(%rbp)
jle    1153 <main+0x43>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x8(%rbp),%edx
call   1030 <cpy@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
cmp    $0x11,%edi
jl     1135 <main+0x25>
push   %rax
mov    %edi,%edx
mov    (%rsi),%rdi
mov    0x8(%rsi),%rsi
call   1030 <cpy@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret

LLVM IR (-O0):
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
store i8* null, i8** %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 16
br i1 %8, label %9, label %18
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i32, i32* %4
%17 = call i8* @cpy(i8* %12, i8* %15, i32 %16)
store i8* %17, i8** %6
br label %18
18: ; preds = %9, %2
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 16
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i8* @cpy(i8* %5, i8* %7, i32 %0)
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %2
%12 = phi i32 [ %10, %4 ], [ 0, %2 ]
ret i32 %12
}
void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable) {}


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

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

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

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define void @sme_sched_obss_scan(%struct.wpa_supplicant* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ XMapRequestEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XMapRequestEvent(void *_p) {
  if (_p == NULL)
    abort();
  free((XMapRequestEvent *)_p);
}


x86 assembly (clang, -O0):
<free_XMapRequestEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XMapRequestEvent+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XMapRequestEvent>:
test   %rdi,%rdi
je     112a <free_XMapRequestEvent+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XMapRequestEvent(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XMapRequestEvent(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
void fc161(int n) {
  {
    typedef int(*b)[n];
    {
      typedef int(*c)[n];
      0;
    }
    {
      typedef int(*d)[n];
      0;
    };
    typedef int(*e)[n];
    0;
  };
  {
    typedef int(*f)[n];
  a : {
    typedef int(*g)[n];
    goto a;
    0;
  };
    {
      typedef int(*h)[n];
      0;
    };
    ;
    typedef int(*i)[n];
    0;
  };
  ;
  typedef int(*j)[n];
  0;
}


x86 assembly (clang, -O0):
<fc161>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fc161+0x7>

x86 assembly (clang, -O2):
<fc161>:
jmp    1100 <fc161>

LLVM IR (-O0):
define void @fc161(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = load i32, i32* %2
%8 = zext i32 %7 to i64
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
br label %13
13: ; preds = %13, %1
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
br label %13
16: ; No predecessors!
%17 = load i32, i32* %2
%18 = zext i32 %17 to i64
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
%21 = load i32, i32* %2
%22 = zext i32 %21 to i64
ret void
}

LLVM IR (-O2):
define void @fc161(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
int main() {
  char b[5] = {"AIUB"};
  rev(b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x4(%rsp)
movl   $0x42554941,(%rsp)
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <rev@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.b = [5 x i8] c"AIUB\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
store i32 0, i32* %1
%3 = bitcast [5 x i8]* %2 to i8*
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @rev to i32 (i8*, ...)*)(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.b = [5 x i8] c"AIUB\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @rev to i32 (i8*, ...)*)(i8* %2)
ret i32 0
}
int left_child(int parent) { return (2 * parent); }


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

x86 assembly (clang, -O2):
<left_child>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @left_child(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHeader() {
  printf("\n        int       htons       htonl       ntohs       ntohl\n");
}


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

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

LLVM IR (-O0):
@.str = [62 x i8] c"\0A int htons htonl ntohs ntohl\0A\00"
define void @printHeader() {
%1 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [61 x i8] c"\0A int htons htonl ntohs ntohl\00"
define void @printHeader() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
ret void
}
void tce_sort_0_(double *unsorted, double *sorted, double *factor) {
  *sorted = (*unsorted) * (*factor);
}


x86 assembly (clang, -O0):
<tce_sort_0_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tce_sort_0_>:
movsd  (%rdi),%xmm0
mulsd  (%rdx),%xmm0
movsd  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @tce_sort_0_(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* %7
%9 = load double*, double** %6
%10 = load double, double* %9
%11 = fmul double %8, %10
%12 = load double*, double** %5
store double %11, double* %12
ret void
}

LLVM IR (-O2):
define void @tce_sort_0_(double* nocapture %0, double* nocapture writeonly %1, double* nocapture %2) {
%4 = load double, double* %0
%5 = load double, double* %2
%6 = fmul double %4, %5
store double %6, double* %1
ret void
}
/* Variables and functions */
scalar_t__ isleap(int);
int count_year(int a, int b) {
  int total, i;
  for (total = 0, i = a; i < b; i++) {
    if (isleap(i)) {
      total += 1;
    }
    total += 365;
  }
  return total;
}


x86 assembly (clang, -O0):
<count_year>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116b <count_year+0x5b>
mov    -0x10(%rbp),%edi
call   1030 <isleap@plt>
cmp    $0x0,%rax
je     1152 <count_year+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x16d,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112b <count_year+0x1b>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_year>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
cmp    %esi,%edi
jge    114c <count_year+0x3c>
mov    %esi,%r14d
mov    %edi,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <isleap@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
add    $0x16d,%ebx
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1130 <count_year+0x20>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @count_year(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %4, label %14
4: ; preds = %2, %4
%5 = phi i32 [ %12, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ 0, %2 ]
%7 = tail call i64 @isleap(i32 %5)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
%10 = add i32 %6, 365
%11 = add i32 %10, %9
%12 = add i32 %5, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %4
14: ; preds = %4, %2
%15 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %15
}
/* Variables and functions */
void latent(int a) {
  if (a == 4) {
    int *p = NULL;
    *p = 42;
  }
}


x86 assembly (clang, -O0):
<latent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jne    1123 <latent+0x23>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2a,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @latent(i32 %0) {
%2 = icmp ne i32 %0, 4
tail call void @llvm.assume(i1 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test(void) { printf("Test.\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"Test.\00"
define void @test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tabulate_dim();
int /*<<< orphan*/ tabulate_key();
int main(void) {
  tabulate_dim();
  tabulate_key();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <tabulate_dim@plt>
mov    $0x0,%al
call   1030 <tabulate_key@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @tabulate_dim()
%2 = tail call i32 (...) @tabulate_key()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Initialize();
__attribute__((constructor)) void __load() { Initialize(); }


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

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

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

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__load, i8* null }]
define void @__load() {
%1 = tail call i32 (...) @Initialize()
ret void
}
extern unsigned int rbits32(unsigned int w) {
  w = ((w >> 1) & 0x55555555) | ((w << 1) & 0xaaaaaaaa);
  w = ((w >> 2) & 0x33333333) | ((w << 2) & 0xcccccccc);
  w = ((w >> 4) & 0x0f0f0f0f) | ((w << 4) & 0xf0f0f0f0);
  w = ((w >> 8) & 0x00ff00ff) | ((w << 8) & 0xff00ff00);
  w = ((w >> 16) & 0x0000ffff) | ((w << 16) & 0xffff0000);
  return w;
}


x86 assembly (clang, -O0):
<rbits32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
and    $0x55555555,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
and    $0xaaaaaaaa,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
and    $0x33333333,%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
and    $0xcccccccc,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
and    $0xf0f0f0f,%eax
mov    -0x4(%rbp),%ecx
shl    $0x4,%ecx
and    $0xf0f0f0f0,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff00ff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00ff00,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xffff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x10,%ecx
and    $0xffff0000,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rbits32>:
bswap  %edi
mov    %edi,%eax
and    $0xf0f0f0f,%eax
shl    $0x4,%eax
shr    $0x4,%edi
and    $0xf0f0f0f,%edi
or     %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
lea    (%rdi,%rax,4),%eax
mov    %eax,%ecx
and    $0x55555555,%ecx
shr    %eax
and    $0x55555555,%eax
lea    (%rax,%rcx,2),%eax
ret

LLVM IR (-O0):
define i32 @rbits32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = and i32 %4, 1431655765
%6 = load i32, i32* %2
%7 = shl i32 %6, 1
%8 = and i32 %7, -1431655766
%9 = or i32 %5, %8
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = lshr i32 %10, 2
%12 = and i32 %11, 858993459
%13 = load i32, i32* %2
%14 = shl i32 %13, 2
%15 = and i32 %14, -858993460
%16 = or i32 %12, %15
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = lshr i32 %17, 4
%19 = and i32 %18, 252645135
%20 = load i32, i32* %2
%21 = shl i32 %20, 4
%22 = and i32 %21, -252645136
%23 = or i32 %19, %22
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = lshr i32 %24, 8
%26 = and i32 %25, 16711935
%27 = load i32, i32* %2
%28 = shl i32 %27, 8
%29 = and i32 %28, -16711936
%30 = or i32 %26, %29
store i32 %30, i32* %2
%31 = load i32, i32* %2
%32 = lshr i32 %31, 16
%33 = and i32 %32, 65535
%34 = load i32, i32* %2
%35 = shl i32 %34, 16
%36 = and i32 %35, -65536
%37 = or i32 %33, %36
store i32 %37, i32* %2
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @rbits32(i32 %0) {
%2 = tail call i32 @llvm.bitreverse.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int strlen(char *);
char *get_block_relocated_name(char *block_name) {
  static int program_relocator = 0;
  char *relocated_name;
  ;
  {};
  relocated_name = (char *)malloc((5 + strlen(block_name)) * sizeof(char));
  sprintf(relocated_name, "%s_%04d", block_name, (++program_relocator));
  return (relocated_name);
}


x86 assembly (clang, -O0):
<get_block_relocated_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x5,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    0x2ed5(%rip),%ecx
add    $0x1,%ecx
mov    %ecx,0x2ecc(%rip)
lea    0xe89(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_block_relocated_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x5(%rax),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    0x2eef(%rip),%ecx
add    $0x1,%ecx
mov    %ecx,0x2ee6(%rip)
lea    0xea3(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@get_block_relocated_name.program_relocator = internal global i32 0
@.str = [8 x i8] c"%s_%04d\00"
define i8* @get_block_relocated_name(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, %5
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = load i32, i32* @get_block_relocated_name.program_relocator
%15 = add nsw i32 %14, 1
store i32 %15, i32* @get_block_relocated_name.program_relocator
%16 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %15)
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@get_block_relocated_name.program_relocator = internal unnamed_addr global i32 0
@.str = [8 x i8] c"%s_%04d\00"
define i8* @get_block_relocated_name(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 5
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = load i32, i32* @get_block_relocated_name.program_relocator
%7 = add nsw i32 %6, 1
store i32 %7, i32* @get_block_relocated_name.program_relocator
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %7)
ret i8* %5
}
int Digits(long long int n) {
  int c = 0;
  while (n != 0) {
    c++;
    n = n / 10;
  }
  return c;
}


x86 assembly (clang, -O0):
<Digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113a <Digits+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    110f <Digits+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Digits>:
xor    %ecx,%ecx
test   %rdi,%rdi
je     1144 <Digits+0x44>
movabs $0x6666666666666667,%rsi
66 66 66
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %rdi,%rax
imul   %rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
add    $0x9,%rdi
cmp    $0x12,%rdi
mov    %rdx,%rdi
ja     1120 <Digits+0x20>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @Digits(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = load i64, i64* %2
%11 = sdiv i64 %10, 10
store i64 %11, i64* %2
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @Digits(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = sdiv i64 %5, 10
%8 = add i64 %5, 9
%9 = icmp ult i64 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ s2rectxy(float, float, float, float, float);
void s2rectxy_(float *xmin, float *xmax, float *ymin, float *ymax, float *z) {
  s2rectxy(*xmin, *xmax, *ymin, *ymax, *z);
}


x86 assembly (clang, -O0):
<s2rectxy_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm3
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm4
call   1030 <s2rectxy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2rectxy_>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  (%rdx),%xmm2
movss  (%rcx),%xmm3
movss  (%r8),%xmm4
jmp    1030 <s2rectxy@plt>

LLVM IR (-O0):
define void @s2rectxy_(float* %0, float* %1, float* %2, float* %3, float* %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store float* %3, float** %9
store float* %4, float** %10
%11 = load float*, float** %6
%12 = load float, float* %11
%13 = load float*, float** %7
%14 = load float, float* %13
%15 = load float*, float** %8
%16 = load float, float* %15
%17 = load float*, float** %9
%18 = load float, float* %17
%19 = load float*, float** %10
%20 = load float, float* %19
%21 = call i32 @s2rectxy(float %12, float %14, float %16, float %18, float %20)
ret void
}

LLVM IR (-O2):
define void @s2rectxy_(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3, float* nocapture %4) {
%6 = load float, float* %0
%7 = load float, float* %1
%8 = load float, float* %2
%9 = load float, float* %3
%10 = load float, float* %4
%11 = tail call i32 @s2rectxy(float %6, float %7, float %8, float %9, float %10)
ret void
}
const char *str_expr_identifier() { return "identifier"; }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"identifier\00"
define i8* @str_expr_identifier() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [11 x i8] c"identifier\00"
define i8* @str_expr_identifier() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}
void _Jv_AllocObject(void) {}


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

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

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

LLVM IR (-O2):
define void @_Jv_AllocObject() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XFetchName() {
  printf("XFetchName called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [18 x i8] c"XFetchName called\00"
define i32 @XFetchName() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int strlen(char *);
int stringlength(char *string) { return strlen(string); }


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

x86 assembly (clang, -O2):
<stringlength>:
jmp    1030 <strlen@plt>

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

LLVM IR (-O2):
define i32 @stringlength(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
ret i32 %2
}
unsigned get_fileattr(const char *fname) {
  unsigned attrib = 0;
  return attrib & 0x002f;
}


x86 assembly (clang, -O0):
<get_fileattr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x2f,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @get_fileattr(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *);
int main() {
  char tmp[100];
  sprintf(tmp, "Hello %s!");
  printf("%s", tmp);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xed4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
lea    0xecc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Hello %s!\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Hello %s!\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int scanf(char *, int *);
int readDataType(int *data) { return scanf("%d ", data); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @readDataType(i32* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ ispunct(int);
void t_ispunct_0x5c() {
  Assert_real((ispunct(92)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              465, ("ispunct should be 1 for 0x5c"));
}


x86 assembly (clang, -O0):
<t_ispunct_0x5c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5c,%edi
call   1030 <ispunct@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1d1,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0x5c>:
push   %rax
mov    $0x5c,%edi
call   1030 <ispunct@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x1d1,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 1 for 0x5c\00"
define void @t_ispunct_0x5c() {
%1 = call i32 @ispunct(i32 92)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 465, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 1 for 0x5c\00"
define void @t_ispunct_0x5c() {
%1 = tail call i32 @ispunct(i32 92)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 465, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}