xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double dbl;
  printf("size of double: %d\n", sizeof dbl);
  dbl = 22.0 / 7.0;
  printf("%f", dbl);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
movsd  0xed4(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"size of double: %d\0A\00"
@.str.1 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double 8.000000e+00)
store double 0x4009249249249249, double* %2
%4 = load double, double* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"size of double: %d\0A\00"
@.str.1 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double 8.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double 0x4009249249249249)
ret i32 0
}
int absolute(int x) { return (x > 0) ? x : -x; }


x86 assembly (clang, -O0):
<absolute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <absolute+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <absolute+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @absolute(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @absolute(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
void Sys_Error(const char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @Sys_Error(i8* nocapture %0, ...) {
ret void
}
void initialiseStatesAndConstants(double *states, double *variables) {
  variables[0] = 1.0;
  states[0] = 1.0;
}


x86 assembly (clang, -O0):
<initialiseStatesAndConstants>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xee8(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialiseStatesAndConstants>:
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rsi)
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @initialiseStatesAndConstants(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 0
store double 1.000000e+00, double* %6
%7 = load double*, double** %3
%8 = getelementptr inbounds double, double* %7, i64 0
store double 1.000000e+00, double* %8
ret void
}

LLVM IR (-O2):
define void @initialiseStatesAndConstants(double* nocapture writeonly %0, double* nocapture writeonly %1) {
store double 1.000000e+00, double* %1
store double 1.000000e+00, double* %0
ret void
}
int fast_rand() {
  static unsigned long next = 1;
  next = next * 1103515245 + 12345;
  return ((unsigned)(next / 65536) % 32768);
}


x86 assembly (clang, -O0):
<fast_rand>:
push   %rbp
mov    %rsp,%rbp
imul   $0x41c64e6d,0x2f11(%rip),%rax
6d 4e c6 41
add    $0x3039,%rax
mov    %rax,0x2f04(%rip)
mov    0x2efd(%rip),%rax
shr    $0x10,%rax
and    $0x7fff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_rand>:
imul   $0x41c64e6d,0x2f15(%rip),%rax
6d 4e c6 41
add    $0x3039,%rax
mov    %rax,0x2f08(%rip)
shr    $0x10,%eax
and    $0x7fff,%eax
ret

LLVM IR (-O0):
@fast_rand.next = internal global i64 1
define i32 @fast_rand() {
%1 = load i64, i64* @fast_rand.next
%2 = mul i64 %1, 1103515245
%3 = add i64 %2, 12345
store i64 %3, i64* @fast_rand.next
%4 = load i64, i64* @fast_rand.next
%5 = udiv i64 %4, 65536
%6 = trunc i64 %5 to i32
%7 = urem i32 %6, 32768
ret i32 %7
}

LLVM IR (-O2):
@fast_rand.next = internal unnamed_addr global i64 1
define i32 @fast_rand() {
%1 = load i64, i64* @fast_rand.next
%2 = mul i64 %1, 1103515245
%3 = add i64 %2, 12345
store i64 %3, i64* @fast_rand.next
%4 = trunc i64 %3 to i32
%5 = lshr i32 %4, 16
%6 = and i32 %5, 32767
ret i32 %6
}
void test_one(int x) {
#pragma omp parallel for simd
  for (int i = 0; i < x; i++)
    ;
}


x86 assembly (clang, -O0):
<test_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    112d <test_one+0x2d>
jmp    111f <test_one+0x1f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <test_one+0xe>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_one(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ poly_inner(int, int);
int poly(int n) {
  int i = 1;
  int result = 0;
  for (; i <= n; i++) {
    result += poly_inner(n, i);
  }
  return result;
}


x86 assembly (clang, -O0):
<poly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     115b <poly+0x4b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <poly_inner@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <poly+0x19>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poly>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1151 <poly+0x41>
mov    %edi,%r14d
mov    %edi,%r15d
neg    %r15d
mov    $0x1,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <poly_inner@plt>
add    %eax,%ebp
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1130 <poly+0x20>
jmp    1153 <poly+0x43>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @poly(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 1, %1 ]
%6 = tail call i64 @poly_inner(i32 %0, i32 %5)
%7 = trunc i64 %6 to i32
%8 = add i32 %4, %7
%9 = add nuw i32 %5, 1
%10 = icmp eq i32 %5, %0
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
unsigned av_clip_uintp2_c(int a, int p) {
  if (a & ~((1 << p) - 1))
    return -a >> 31 & ((1 << p) - 1);
  else
    return a;
}


x86 assembly (clang, -O0):
<av_clip_uintp2_c>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     114b <av_clip_uintp2_c+0x4b>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
sar    $0x1f,%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <av_clip_uintp2_c+0x51>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_clip_uintp2_c>:
mov    %esi,%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
not    %ecx
xor    %eax,%eax
test   %edi,%edi
cmovg  %ecx,%eax
test   %edi,%edx
cmove  %edi,%eax
ret

LLVM IR (-O0):
define i32 @av_clip_uintp2_c(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* %4
%7 = load i32, i32* %5
%8 = shl i32 1, %7
%9 = sub nsw i32 %8, 1
%10 = xor i32 %9, -1
%11 = and i32 %6, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i32, i32* %4
%15 = sub nsw i32 0, %14
%16 = ashr i32 %15, 31
%17 = load i32, i32* %5
%18 = shl i32 1, %17
%19 = sub nsw i32 %18, 1
%20 = and i32 %16, %19
store i32 %20, i32* %3
br label %23
21: ; preds = %2
%22 = load i32, i32* %4
store i32 %22, i32* %3
br label %23
23: ; preds = %21, %13
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @av_clip_uintp2_c(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = and i32 %3, %0
%5 = icmp eq i32 %4, 0
%6 = xor i32 %3, -1
%7 = icmp sgt i32 %0, 0
%8 = select i1 %7, i32 %6, i32 0
%9 = select i1 %5, i32 %0, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *, ...);
void Pl_Jump(char *label) {
  Inst_Printf("call", "%s", label);
  Inst_Printf("nop", "");
}


x86 assembly (clang, -O0):
<Pl_Jump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
lea    0xecc(%rip),%rdi
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1030 <Inst_Printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pl_Jump>:
push   %rax
mov    %rdi,%rdx
lea    0xee5(%rip),%rdi
lea    0xee3(%rip),%rsi
xor    %eax,%eax
call   1030 <Inst_Printf@plt>
lea    0xed8(%rip),%rdi
lea    0xecd(%rip),%rsi
xor    %eax,%eax
pop    %rcx
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"call\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"nop\00"
@.str.3 = [1 x i8] zeroinitializer
define void @Pl_Jump(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"call\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"nop\00"
@.str.3 = [1 x i8] zeroinitializer
define void @Pl_Jump(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i8*, i8*, ...) @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ wrap_free(int *);
void interproc_free_ok() {
  int *p = (int *)malloc(sizeof(int));
  wrap_free(p);
}


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

x86 assembly (clang, -O2):
<interproc_free_ok>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <wrap_free@plt>

LLVM IR (-O0):
define void @interproc_free_ok() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = call i32 @wrap_free(i32* %4)
ret void
}

LLVM IR (-O2):
define void @interproc_free_ok() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @wrap_free(i32* %2)
ret void
}
double douSquare(double d) { return d * d; }


x86 assembly (clang, -O0):
<douSquare>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<douSquare>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @douSquare(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @douSquare(double %0) {
%2 = fmul double %0, %0
ret double %2
}
int test_imm_64uint8_reg(unsigned char val) {
  return ((val) & (0x64 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_64uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 100
%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_64uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 100
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int bitcount(unsigned x) {
  int b;
  for (b = 0; x != 0; x &= x - 1)
    ++b;
  return b;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <bitcount+0x32>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    110e <bitcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
xor    %eax,%eax
test   %edi,%edi
je     111c <bitcount+0x1c>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
lea    -0x1(%rdi),%ecx
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <bitcount+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = add i32 %5, -1
%8 = and i32 %7, %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ os_error(char *);
void *xcalloc(size_t nmemb, size_t size) {
  if (!nmemb || !size)
    nmemb = size = 1;
  void *p = calloc(nmemb, size);
  if (!p)
    os_error("Allocating cleared memory failed");
  return p;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1146 <xcalloc+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    1156 <xcalloc+0x36>
movq   $0x1,-0x10(%rbp)
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117e <xcalloc+0x5e>
lea    0xe87(%rip),%rdi
call   1040 <os_error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
test   %cl,%al
mov    $0x1,%eax
cmove  %rax,%rsi
cmove  %rax,%rdi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1155 <xcalloc+0x35>
lea    0xeb0(%rip),%rdi
call   1040 <os_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Allocating cleared memory failed\00"
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i64, i64* %4
%10 = icmp ne i64 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %8, %2
store i64 1, i64* %4
store i64 1, i64* %3
br label %12
12: ; preds = %11, %8
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = call i8* @calloc(i64 %13, i64 %14)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %12
%19 = call i32 @os_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
@.str = [33 x i8] c"Allocating cleared memory failed\00"
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = icmp ne i64 %0, 0
%4 = icmp ne i64 %1, 0
%5 = and i1 %3, %4
%6 = select i1 %5, i64 %1, i64 1
%7 = select i1 %5, i64 %0, i64 1
%8 = tail call i8* @calloc(i64 %7, i64 %6)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @os_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
ret i8* %8
}
int LexIsWhiteSpace(char c) {
  if (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<LexIsWhiteSpace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     113e <LexIsWhiteSpace+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     113e <LexIsWhiteSpace+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0xd,%eax
je     113e <LexIsWhiteSpace+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    114a <LexIsWhiteSpace+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <LexIsWhiteSpace+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LexIsWhiteSpace>:
cmp    $0x20,%dil
ja     1120 <LexIsWhiteSpace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100002600,%rdx
bt     %rcx,%rdx
jae    1120 <LexIsWhiteSpace+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @LexIsWhiteSpace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 13, label %3
i8 10, label %3
i8 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
char *_eglstrdup(const char *s) {
  if (s) {
    size_t l = strlen(s);
    char *s2 = malloc(l + 1);
    if (s2)
      strcpy(s2, s);
    return s2;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<_eglstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118a <_eglstrdup+0x5a>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117d <_eglstrdup+0x4d>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1192 <_eglstrdup+0x62>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_eglstrdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115f <_eglstrdup+0x2f>
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115f <_eglstrdup+0x2f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1161 <_eglstrdup+0x31>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @_eglstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = add i64 %4, 1
%6 = tail call i8* @malloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %10
10: ; preds = %1, %3, %8
%11 = phi i8* [ %6, %8 ], [ null, %3 ], [ null, %1 ]
ret i8* %11
}
int test_imm_8Dint32_reg(int val) { return ((val) & (0x8D << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_8Dint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x8d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_8Dint32_reg(i32 %0) {
%2 = and i32 %0, 141
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void smp_rmb(void) { __asm __volatile("lfence" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @smp_rmb() {
tail call void asm sideeffect "lfence", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void fprint_rrc(FILE *stream) {
  fprintf(stream, "RRC   A                         ");
}


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

x86 assembly (clang, -O2):
<fprint_rrc>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
@.str = [33 x i8] c"RRC A \00"
define void @fprint_rrc(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 32, i64 1, i32* %0)
ret void
}
char *sha1hex(bitstr, bitcnt)
unsigned char *bitstr;
unsigned long bitcnt;
{ return ((char *)shacomp(1, 2, bitstr, bitcnt)); }


x86 assembly (clang, -O0):
<sha1hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <shacomp@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha1hex>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    $0x1,%edi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <shacomp@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @sha1hex(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 (i32, i32, i8*, i64, ...) bitcast (i32 (...)* @shacomp to i32 (i32, i32, i8*, i64, ...)*)(i32 1, i32 2, i8* %5, i64 %6)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define i8* @sha1hex(i8* %0, i64 %1) {
%3 = tail call i32 (i32, i32, i8*, i64, ...) bitcast (i32 (...)* @shacomp to i32 (i32, i32, i8*, i64, ...)*)(i32 1, i32 2, i8* %0, i64 %1)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ cppUngetc(int const);
int /*<<< orphan*/ skipToMatch(char *);
int skipToNonWhite();
void skipParens() {
  const int c = skipToNonWhite();
  if (c == '(')
    skipToMatch("()");
  else
    cppUngetc(c);
}


x86 assembly (clang, -O0):
<skipParens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <skipToNonWhite@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x28,-0x4(%rbp)
jne    115d <skipParens+0x2d>
lea    0xead(%rip),%rdi
call   1040 <skipToMatch@plt>
jmp    1165 <skipParens+0x35>
mov    -0x4(%rbp),%edi
call   1050 <cppUngetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipParens>:
push   %rax
xor    %eax,%eax
call   1030 <skipToNonWhite@plt>
cmp    $0x28,%eax
jne    114a <skipParens+0x1a>
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1040 <skipToMatch@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <cppUngetc@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"()\00"
define void @skipParens() {
%1 = alloca i32
%2 = call i32 (...) @skipToNonWhite()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 40
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @skipToMatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %0
%8 = load i32, i32* %1
%9 = call i32 @cppUngetc(i32 %8)
br label %10
10: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"()\00"
define void @skipParens() {
%1 = tail call i32 (...) @skipToNonWhite()
%2 = icmp eq i32 %1, 40
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @skipToMatch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 @cppUngetc(i32 %1)
br label %7
7: ; preds = %5, %3
ret void
}
double sqr(double a) { return a * a; }


x86 assembly (clang, -O0):
<sqr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqr>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @sqr(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @sqr(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ bitwise(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ parseInt(char *);
int /*<<< orphan*/ printf(char *);
main(int argc, char **argv) {
  if (argc >= 3) {
    bitwise(parseInt(argv[1]), parseInt(argv[2]));
  } else {
    printf("Usage: ./bitwise <n> <b>\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     117c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <parseInt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <parseInt@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1050 <bitwise@plt>
jmp    1188 <main+0x58>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jl     115a <main+0x2a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <parseInt@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1040 <parseInt@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <bitwise@plt>
jmp    1166 <main+0x36>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: ./bitwise <n> <b>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 3
br i1 %7, label %8, label %18
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @parseInt(i8* %11)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @parseInt(i8* %15)
%17 = call i32 @bitwise(i32 %12, i32 %16)
br label %20
18: ; preds = %2
%19 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@str = [25 x i8] c"Usage: ./bitwise <n> <b>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @parseInt(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @parseInt(i8* %9)
%11 = tail call i32 @bitwise(i32 %7, i32 %10)
br label %14
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %12, %4
ret i32 0
}
int sunxi_is_wfi_mode(int cpu) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @sunxi_is_wfi_mode(i32 %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ x_arg_error(char *, char const *, char const *);
void invalid_arg(const char *name, const char *try) {
  x_arg_error("Invalid", name, try);
}


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

x86 assembly (clang, -O2):
<invalid_arg>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <x_arg_error@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"Invalid\00"
define void @invalid_arg(i8* %0, i8* %1) {
%3 = tail call i32 @x_arg_error(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
void seekdir(DIR *dir, long loc) {}


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

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

LLVM IR (-O0):
define void @seekdir(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @seekdir(i32* nocapture %0, i64 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vt100_EscSeq(int, unsigned char *, long long);
void vt100_SD(int n) { vt100_EscSeq(n, (unsigned char *)"T", (long long)2); }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
mov    $0x2,%edx
call   1030 <vt100_EscSeq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
lea    0xee9(%rip),%rsi
mov    $0x2,%edx
jmp    1030 <vt100_EscSeq@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"T\00"
define void @vt100_SD(i32 %0) {
%2 = tail call i32 @vt100_EscSeq(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void necro_exit(int code) {
  printf("NECRO_EXIT: %i\n", code);
  ;
  exit(code);
}


x86 assembly (clang, -O0):
<necro_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<necro_exit>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"NECRO_EXIT: %i\0A\00"
define void @necro_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [16 x i8] c"NECRO_EXIT: %i\0A\00"
define void @necro_exit(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ cpu_features_detect();
int pll_hardware_probe() {
  cpu_features_detect();
  return 1;
}


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

x86 assembly (clang, -O2):
<pll_hardware_probe>:
push   %rax
xor    %eax,%eax
call   1030 <cpu_features_detect@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pll_hardware_probe() {
%1 = call i32 (...) @cpu_features_detect()
ret i32 1
}

LLVM IR (-O2):
define i32 @pll_hardware_probe() {
%1 = tail call i32 (...) @cpu_features_detect()
ret i32 1
}
/* Type definitions */
struct ship {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Write(int, struct ship *, long, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
void send_row(struct ship *ship, long a) { Write(23, ship, a, 0, 0, 0); }


x86 assembly (clang, -O0):
<send_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x17,%edi
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <Write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_row>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x17,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <Write@plt>

LLVM IR (-O0):
%struct.ship = type { i32 }
define void @send_row(%struct.ship* %0, i64 %1) {
%3 = alloca %struct.ship*
%4 = alloca i64
store %struct.ship* %0, %struct.ship** %3
store i64 %1, i64* %4
%5 = load %struct.ship*, %struct.ship** %3
%6 = load i64, i64* %4
%7 = call i32 @Write(i32 23, %struct.ship* %5, i64 %6, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
%struct.ship = type { i32 }
define void @send_row(%struct.ship* %0, i64 %1) {
%3 = tail call i32 @Write(i32 23, %struct.ship* %0, i64 %1, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
scalar_t__ cosh(float);
float coshf(float x) { return (float)cosh(x); }


x86 assembly (clang, -O0):
<coshf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <cosh@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coshf>:
push   %rax
call   1030 <cosh@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @coshf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @cosh(float %3)
%5 = sitofp i64 %4 to float
ret float %5
}

LLVM IR (-O2):
define float @coshf(float %0) {
%2 = tail call i64 @cosh(float %0)
%3 = sitofp i64 %2 to float
ret float %3
}
int cmpFunc(const void *a, const void *b) { return (*(int *)a - *(int *)b); }


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

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

LLVM IR (-O0):
define i32 @cmpFunc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmpFunc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ST7735_SetCursor(int /*<<< orphan*/, int /*<<< orphan*/);
void LCD_SetCursor(uint16_t x, uint16_t y) { ST7735_SetCursor(x, y); }


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

x86 assembly (clang, -O2):
<LCD_SetCursor>:
jmp    1030 <ST7735_SetCursor@plt>

LLVM IR (-O0):
define void @LCD_SetCursor(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 @ST7735_SetCursor(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @LCD_SetCursor(i32 %0, i32 %1) {
%3 = tail call i32 @ST7735_SetCursor(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int gen_mask(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("mask(8,4) = %x\n", gen_mask(8, 4));
  printf("mask(31,4) = %x\n", gen_mask(31, 4));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x8,%edi
mov    $0x4,%esi
call   1040 <gen_mask@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1f,%edi
mov    $0x4,%esi
call   1040 <gen_mask@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"mask(8,4) = %x\0A\00"
@.str.1 = [17 x i8] c"mask(31,4) = %x\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @gen_mask(i32 8, i32 4)
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @gen_mask(i32 31, i32 4)
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"mask(8,4) = %x\0A\00"
@.str.1 = [17 x i8] c"mask(31,4) = %x\0A\00"
define i32 @main() {
%1 = tail call i32 @gen_mask(i32 8, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @gen_mask(i32 31, i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isprint(int);
void t_isprint_0x48() {
  Assert_real((isprint(72)),
              "/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_isprint.c",
              365, ("isprint should be 1 for H"));
}


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

x86 assembly (clang, -O2):
<t_isprint_0x48>:
push   %rax
mov    $0x48,%edi
call   1030 <isprint@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x16d,%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_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for H\00"
define void @t_isprint_0x48() {
%1 = call i32 @isprint(i32 72)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 365, i8* getelementptr inbounds ([26 x i8], [26 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_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for H\00"
define void @t_isprint_0x48() {
%1 = tail call i32 @isprint(i32 72)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 365, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void print_usage(bool err) {
  fprintf(err ? stderr : stdout,
          "Usage: rstr <srcdir> <destdir>\n"
          "  srcdir  - directory that was used to backup;\n"
          "  destdir - destination of the restore.\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1136 <print_usage+0x26>
mov    0x2eb4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <print_usage+0x32>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xeb4(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
test   %edi,%edi
jne    111d <print_usage+0xd>
mov    0x2ebd(%rip),%rax
jmp    1124 <print_usage+0x14>
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
lea    0xed3(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@stdout = global i32 0
@.str = [119 x i8] c"Usage: rstr <srcdir> <destdir>\0A srcdir - directory that was used to backup;\0A destdir - destination of the restore.\0A\00"
define void @print_usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* @stderr
br label %9
7: ; preds = %1
%8 = load i32, i32* @stdout
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@stdout = global i32 0
@.str = [119 x i8] c"Usage: rstr <srcdir> <destdir>\0A srcdir - directory that was used to backup;\0A destdir - destination of the restore.\0A\00"
define void @print_usage(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = load i32, i32* @stderr
%4 = load i32, i32* @stdout
%5 = select i1 %2, i32 %4, i32 %3
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void mycallback(char *path, int i, char *value, void *userdata) { puts(value); }


x86 assembly (clang, -O0):
<mycallback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mycallback>:
mov    %rdx,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
define void @mycallback(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %7
%10 = call i32 @puts(i8* %9)
ret void
}

LLVM IR (-O2):
define void @mycallback(i8* nocapture readnone %0, i32 %1, i8* nocapture %2, i8* nocapture readnone %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) %2)
ret void
}