xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
size_t mdbm_strlcpy(char *dst, const char *src, size_t dstlen) {
  size_t srclen = strlen(src);
  if (srclen >= dstlen) {
    srclen = dstlen - 1;
  }
  memcpy(dst, src, srclen);
  dst[srclen] = 0;
  return srclen;
}


x86 assembly (clang, -O0):
<mdbm_strlcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jb     115b <mdbm_strlcpy+0x3b>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdbm_strlcpy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbx
lea    -0x1(%r12),%rax
cmp    %r12,%rbx
cmovae %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
movb   $0x0,(%r15,%rbx,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @mdbm_strlcpy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp ult i64 %4, %2
%6 = add i64 %2, -1
%7 = select i1 %5, i64 %4, i64 %6
%8 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %7)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %9
ret i64 %7
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int c, nc;
  nc = 0;
  while ((c = getchar()) != EOF) {
    nc = nc + 1;
  }
  printf("%d\n", nc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     115d <main+0x3d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
mov    0x2eb8(%rip),%r14
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    (%r14),%eax
jne    1130 <main+0x10>
lea    0xeba(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %8, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %4
11: ; preds = %4
%12 = load i32, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
%6 = add nuw nsw i32 %2, 1
br i1 %5, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
double fdim(double x, double y) { return (x > y) ? (x - y) : 0; }


x86 assembly (clang, -O0):
<fdim>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1132 <fdim+0x32>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113f <fdim+0x3f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113f <fdim+0x3f>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdim>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @fdim(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load double, double* %3
%10 = load double, double* %4
%11 = fsub double %9, %10
br label %13
12: ; preds = %2
br label %13
13: ; preds = %12, %8
%14 = phi double [ %11, %8 ], [ 0.000000e+00, %12 ]
ret double %14
}

LLVM IR (-O2):
define double @fdim(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = fsub double %0, %1
%5 = select i1 %3, double %4, double 0.000000e+00
ret double %5
}
/* Type definitions */
typedef scalar_t__ int8_t;

/* Variables and functions */
void lrc_debug_sources_(int n, int8_t *source) {
  ;
  for (int i = 0; i < n; i++) {
    int8_t e = source[i];
    if (e == 0) {
      ;
    } else {
      ;
    }
  };
}


x86 assembly (clang, -O0):
<lrc_debug_sources_>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1156 <lrc_debug_sources_+0x56>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    113e <lrc_debug_sources_+0x3e>
jmp    1143 <lrc_debug_sources_+0x43>
jmp    1143 <lrc_debug_sources_+0x43>
jmp    1148 <lrc_debug_sources_+0x48>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1112 <lrc_debug_sources_+0x12>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @lrc_debug_sources_(i32 %0, i64* nocapture %1) {
ret void
}
/* Variables and functions */
scalar_t__ M_PI_2;
double sin(scalar_t__);
double cos(double x) { return sin(x + M_PI_2); }


x86 assembly (clang, -O0):
<cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ebf(%rip),%rax
cvtsi2sdq (%rax),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos>:
mov    0x2ed1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
jmp    1030 <sin@plt>

LLVM IR (-O0):
@M_PI_2 = global i64 0
define double @cos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load i64, i64* @M_PI_2
%5 = sitofp i64 %4 to double
%6 = fadd double %3, %5
%7 = fptosi double %6 to i64
%8 = call double @sin(i64 %7)
ret double %8
}

LLVM IR (-O2):
@M_PI_2 = global i64 0
define double @cos(double %0) {
%2 = load i64, i64* @M_PI_2
%3 = sitofp i64 %2 to double
%4 = fadd double %3, %0
%5 = fptosi double %4 to i64
%6 = tail call double @sin(i64 %5)
ret double %6
}
/* Variables and functions */
double log(double);
double f3a(double x) {
  return (-4.0 / (-1.0 + x) - log(-1.0 + x) / 2.0 + log(1.0 + x) / 2.0);
}


x86 assembly (clang, -O0):
<f3a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeeb(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
movsd  0xee6(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xecd(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xea3(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe96(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe74(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3a>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  0xeda(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1030 <log@plt>
mulsd  0xec7(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0xeb1(%rip),%xmm0
call   1030 <log@plt>
mulsd  0xe9c(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @f3a(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double -1.000000e+00, %3
%5 = fdiv double -4.000000e+00, %4
%6 = load double, double* %2
%7 = fadd double -1.000000e+00, %6
%8 = call double @log(double %7)
%9 = fdiv double %8, 2.000000e+00
%10 = fsub double %5, %9
%11 = load double, double* %2
%12 = fadd double 1.000000e+00, %11
%13 = call double @log(double %12)
%14 = fdiv double %13, 2.000000e+00
%15 = fadd double %10, %14
ret double %15
}

LLVM IR (-O2):
define double @f3a(double %0) {
%2 = fadd double %0, -1.000000e+00
%3 = fdiv double -4.000000e+00, %2
%4 = tail call double @log(double %2)
%5 = fmul double %4, 5.000000e-01
%6 = fsub double %3, %5
%7 = fadd double %0, 1.000000e+00
%8 = tail call double @log(double %7)
%9 = fmul double %8, 5.000000e-01
%10 = fadd double %6, %9
ret double %10
}
int test_imm_3Auint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x3A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_3Auint64_highword_reg(i64 %0) {
%2 = and i64 %0, 249108103168
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int ptrdiff_t;

/* Variables and functions */
unsigned int hashf_int(const void *key) {
  return (*(const ptrdiff_t *)key ^ (*(const ptrdiff_t *)key >> 16));
}


x86 assembly (clang, -O0):
<hashf_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
sar    $0x10,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashf_int>:
mov    (%rdi),%ecx
mov    %ecx,%eax
sar    $0x10,%eax
xor    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @hashf_int(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = ashr i32 %3, 16
%5 = xor i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fun1();
int /*<<< orphan*/ fun2();
void fun3(void) {
  fun1();
  fun2();
}


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

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

LLVM IR (-O0):
define void @fun3() {
%1 = call i32 (...) @fun1()
%2 = call i32 (...) @fun2()
ret void
}

LLVM IR (-O2):
define void @fun3() {
%1 = tail call i32 (...) @fun1()
%2 = tail call i32 (...) @fun2()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_tild() {
  printf("-------------------------------------------------------------\n");
}


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

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

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

LLVM IR (-O2):
@str = [62 x i8] c"-------------------------------------------------------------\00"
define void @print_tild() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
ret void
}
void glVertexAttrib2f(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glVertexAttrib2f() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_condattr_t;

/* Variables and functions */
int pthread_condattr_destroy(pthread_condattr_t *attr) {
  (void)attr;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @pthread_condattr_destroy(i32* nocapture readnone %0) {
ret i32 0
}
void free_bitmap_with_margins(unsigned char **pixels) {
  assert(pixels);
  free(&pixels[-1][-1]);
  free(pixels - 1);
}


x86 assembly (clang, -O0):
<free_bitmap_with_margins>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    -0x8(%rax),%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_bitmap_with_margins>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <assert@plt>
mov    -0x8(%rbx),%rdi
add    $0xfffffffffffffff8,%rbx
add    $0xffffffffffffffff,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_bitmap_with_margins(i8** %0) {
%2 = tail call i32 (i8**, ...) bitcast (i32 (...)* @assert to i32 (i8**, ...)*)(i8** %0)
%3 = getelementptr inbounds i8*, i8** %0, i64 -1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 -1
tail call void @free(i8* %5)
%6 = bitcast i8** %3 to i8*
tail call void @free(i8* %6)
ret void
}
/* Variables and functions */
char *func();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *s = func();
  printf("%s\n", s);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @func()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
int main() {
  char out = 0x55;
  __asm__("movb $0xFE, %%al; cmpb $0xFF, %%al; seto %%al" : "=a"(out));
  return out;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movb   $0x55,-0x5(%rbp)
mov    $0xfe,%al
cmp    $0xff,%al
seto   %al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xfe,%al
cmp    $0xff,%al
seto   %al
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 85, i8* %2
%3 = call i8 asm "movb $$0xFE, %al; cmpb $$0xFF, %al; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8 asm "movb $$0xFE, %al; cmpb $$0xFF, %al; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
%2 = sext i8 %1 to i32
ret i32 %2
}
long labs(long j) {
  if (j < 0) {
    j = -j;
  }
  return j;
}


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    111d <labs+0x1d>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<labs>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @labs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
store i64 %7, i64* %2
br label %8
8: ; preds = %5, %1
%9 = load i64, i64* %2
ret i64 %9
}

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
double julian_century(double jd) { return (jd - 2451545.0) / 36525.0; }


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

x86 assembly (clang, -O2):
<julian_century>:
addsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @julian_century(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 0x4142B42C80000000
%5 = fdiv double %4, 3.652500e+04
ret double %5
}

LLVM IR (-O2):
define double @julian_century(double %0) {
%2 = fadd double %0, 0xC142B42C80000000
%3 = fdiv double %2, 3.652500e+04
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ cgbrcond(char *, int);
void cgbrne(int n) { cgbrcond("jne", n); }


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

x86 assembly (clang, -O2):
<cgbrne>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <cgbrcond@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"jne\00"
define void @cgbrne(i32 %0) {
%2 = tail call i32 @cgbrcond(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
void terminate_handler(int signo) {
  syslog(LOG_INFO, "Terminating...\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<terminate_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <syslog@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<terminate_handler>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <syslog@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@LOG_INFO = global i32 0
@.str = [16 x i8] c"Terminating...\0A\00"
@EXIT_SUCCESS = global i32 0
define void @terminate_handler(i32 %0) {
%2 = load i32, i32* @LOG_INFO
%3 = tail call i32 @syslog(i32 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int compare_eq16(uint8_t *p1, uint8_t *p2) {
  uint64_t *sp1, *sp2;
  sp1 = (uint64_t *)p1;
  sp2 = (uint64_t *)p2;
  return ((p1[0] == p2[0]) & (p1[1] == p2[1])) == 1;
}


x86 assembly (clang, -O0):
<compare_eq16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
mov    -0x10(%rbp),%rdx
cmp    0x8(%rdx),%rcx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_eq16>:
mov    (%rdi),%rcx
mov    0x8(%rdi),%rdx
xor    (%rsi),%rcx
xor    0x8(%rsi),%rdx
xor    %eax,%eax
or     %rcx,%rdx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @compare_eq16(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = load i64, i64* %1
%5 = icmp eq i64 %3, %4
%6 = getelementptr inbounds i64, i64* %0, i64 1
%7 = load i64, i64* %6
%8 = getelementptr inbounds i64, i64* %1, i64 1
%9 = load i64, i64* %8
%10 = icmp eq i64 %7, %9
%11 = and i1 %5, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int _mkpath(int /*<<< orphan*/, char const *, int /*<<< orphan*/,
            char const **);
int _mkpath_np(const char *path, mode_t omode, const char **firstdir) {
  return _mkpath(AT_FDCWD, path, omode, firstdir);
}


x86 assembly (clang, -O0):
<_mkpath_np>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <_mkpath@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mkpath_np>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <_mkpath@plt>

LLVM IR (-O0):
@AT_FDCWD = global i32 0
define i32 @_mkpath_np(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* @AT_FDCWD
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i8**, i8*** %6
%11 = call i32 @_mkpath(i32 %7, i8* %8, i32 %9, i8** %10)
ret i32 %11
}

LLVM IR (-O2):
@AT_FDCWD = global i32 0
define i32 @_mkpath_np(i8* %0, i32 %1, i8** %2) {
%4 = load i32, i32* @AT_FDCWD
%5 = tail call i32 @_mkpath(i32 %4, i8* %0, i32 %1, i8** %2)
ret i32 %5
}
extern int TakeUint32(unsigned int x) {
  if (x == 0xFFFFFFFE)
    return 12;
  return 0;
}


x86 assembly (clang, -O0):
<TakeUint32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xfffffffe,-0x8(%rbp)
jne    111d <TakeUint32+0x1d>
movl   $0xc,-0x4(%rbp)
jmp    1124 <TakeUint32+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TakeUint32>:
xor    %ecx,%ecx
cmp    $0xfffffffe,%edi
mov    $0xc,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @TakeUint32(i32 %0) {
%2 = icmp eq i32 %0, -2
%3 = select i1 %2, i32 12, i32 0
ret i32 %3
}
/* Variables and functions */
int printf(char *, int);
int diff(char **first, char **last) { return printf("%ld\n", last - first); }


x86 assembly (clang, -O0):
<diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %eax,%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff>:
sub    %rdi,%rsi
shr    $0x3,%rsi
lea    0xee2(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @diff(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = load i8**, i8*** %3
%7 = ptrtoint i8** %5 to i64
%8 = ptrtoint i8** %6 to i64
%9 = sub i64 %7, %8
%10 = sdiv exact i64 %9, 8
%11 = trunc i64 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @diff(i8** %0, i8** %1) {
%3 = ptrtoint i8** %1 to i64
%4 = ptrtoint i8** %0 to i64
%5 = sub i64 %3, %4
%6 = lshr exact i64 %5, 3
%7 = trunc i64 %6 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned char *ripemd256_file(unsigned char *, int /*<<< orphan*/ *);
unsigned char *hash_file_ripemd256(unsigned char *out, FILE *fp) {
  return ripemd256_file(out, fp);
}


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

x86 assembly (clang, -O2):
<hash_file_ripemd256>:
jmp    1030 <ripemd256_file@plt>

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

LLVM IR (-O2):
define i8* @hash_file_ripemd256(i8* %0, i32* %1) {
%3 = tail call i8* @ripemd256_file(i8* %0, i32* %1)
ret i8* %3
}
/* Variables and functions */
int hexDumpFileContentsToFile(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int rtxHexDumpFileContents(const char *inFilePath) {
  return hexDumpFileContentsToFile(inFilePath, stdout);
}


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

x86 assembly (clang, -O2):
<rtxHexDumpFileContents>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <hexDumpFileContentsToFile@plt>

LLVM IR (-O0):
@stdout = global i32 0
define i32 @rtxHexDumpFileContents(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdout
%5 = call i32 @hexDumpFileContentsToFile(i8* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @rtxHexDumpFileContents(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @hexDumpFileContentsToFile(i8* %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_session_get_desktop(const char *session, char **desktop) {
  return -EINVAL;
}


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

x86 assembly (clang, -O2):
<sd_session_get_desktop>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_session_get_desktop(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_session_get_desktop(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int omp_get_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int iam = 0, np = 1;
#pragma omp parallel
  {
    np = omp_get_num_threads();
    iam = omp_get_thread_num();
    printf("Hello from thread %d out of %d \n", iam, np);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1050 <omp_get_num_threads@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Hello from thread %d out of %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
%4 = call i32 (...) @omp_get_num_threads()
store i32 %4, i32* %3
%5 = call i32 (...) @omp_get_thread_num()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Hello from thread %d out of %d \0A\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_num_threads()
%2 = tail call i32 (...) @omp_get_thread_num()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %1)
ret i32 0
}
extern void rpmalloc_thread_collect(void) {}


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

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

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

LLVM IR (-O2):
define void @rpmalloc_thread_collect() {
ret void
}
/* Type definitions */
typedef int int8_t;
typedef int /*<<< orphan*/ input;
typedef int /*<<< orphan*/ expected;

/* Variables and functions */
int /*<<< orphan*/ test_rebase(int, int *, int, int, int *, int);
void test_single_decimal_to_binary(void) {
  int8_t input[] = {5};
  int8_t expected[] = {1, 0, 1};
  test_rebase(10, input, (sizeof(input) / sizeof(input[0])), 2, expected,
              (sizeof(expected) / sizeof(expected[0])));
}


x86 assembly (clang, -O0):
<test_single_decimal_to_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xedc(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeda(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x4(%rbp),%rsi
lea    -0x10(%rbp),%r8
mov    $0xa,%edi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r9d
call   1030 <test_rebase@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_single_decimal_to_binary>:
sub    $0x18,%rsp
movl   $0x5,0x4(%rsp)
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xed3(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%r8
mov    $0xa,%edi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r9d
call   1030 <test_rebase@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_single_decimal_to_binary.input = [1 x i32] [i32 5]
@__const.test_single_decimal_to_binary.expected = [3 x i32] [i32 1, i32 0, i32 1]
define void @test_single_decimal_to_binary() {
%1 = alloca [1 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [1 x i32]* %1 to i8*
%4 = bitcast [3 x i32]* %2 to i8*
%5 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%7 = call i32 @test_rebase(i32 10, i32* %5, i32 1, i32 2, i32* %6, i32 3)
ret void
}

LLVM IR (-O2):
@__const.test_single_decimal_to_binary.expected = [3 x i32] [i32 1, i32 0, i32 1]
define void @test_single_decimal_to_binary() {
%1 = alloca [1 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [1 x i32]* %1 to i8*
%4 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 5, i32* %4
%5 = bitcast [3 x i32]* %2 to i8*
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%7 = call i32 @test_rebase(i32 10, i32* %4, i32 1, i32 2, i32* %6, i32 3)
ret void
}
/* Variables and functions */
int get16();
int /*<<< orphan*/ printf(char *, int);
int decode_length_type() {
  int length_type = get16();
  if (length_type == 0x8100) {
    printf("VLAN: %04x\n", get16());
    length_type = get16();
  }
  printf("length/type: %04x\n", length_type);
  return length_type;
}


x86 assembly (clang, -O0):
<decode_length_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get16@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x8100,-0x4(%rbp)
jne    115e <decode_length_type+0x3e>
mov    $0x0,%al
call   1040 <get16@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <get16@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_length_type>:
push   %rbx
xor    %eax,%eax
call   1040 <get16@plt>
mov    %eax,%ebx
cmp    $0x8100,%eax
jne    114f <decode_length_type+0x2f>
xor    %eax,%eax
call   1040 <get16@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <get16@plt>
mov    %eax,%ebx
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"VLAN: %04x\0A\00"
@.str.1 = [19 x i8] c"length/type: %04x\0A\00"
define i32 @decode_length_type() {
%1 = alloca i32
%2 = call i32 (...) @get16()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 33024
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 (...) @get16()
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (...) @get16()
store i32 %8, i32* %1
br label %9
9: ; preds = %5, %0
%10 = load i32, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [12 x i8] c"VLAN: %04x\0A\00"
@.str.1 = [19 x i8] c"length/type: %04x\0A\00"
define i32 @decode_length_type() {
%1 = tail call i32 (...) @get16()
%2 = icmp eq i32 %1, 33024
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 (...) @get16()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 (...) @get16()
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ %6, %3 ], [ %1, %0 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 %8
}
void hisi_irqaffinity_unregister(unsigned int irq) { return; }


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

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

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

LLVM IR (-O2):
define void @hisi_irqaffinity_unregister(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void gdbmiPrintHelpShow() {
  printf("show version -- Show what version of yaAGC this is\n");
}


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

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

LLVM IR (-O0):
@.str = [52 x i8] c"show version -- Show what version of yaAGC this is\0A\00"
define void @gdbmiPrintHelpShow() {
%1 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [51 x i8] c"show version -- Show what version of yaAGC this is\00"
define void @gdbmiPrintHelpShow() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int bits_setb(uint8_t *vec, size_t size, uint8_t bit) {
  if (size <= (size_t)(bit >> 3)) {
    return -1;
  }
  *(vec + (bit >> 3)) |= (uint8_t)(1 << (bit & 0x07));
  return 1;
}


x86 assembly (clang, -O0):
<bits_setb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
ja     1131 <bits_setb+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <bits_setb+0x58>
mov    -0x1c(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits_setb>:
mov    %edx,%eax
sar    $0x3,%eax
movslq %eax,%r8
mov    $0xffffffff,%eax
cmp    %rsi,%r8
jae    1127 <bits_setb+0x27>
and    $0x7,%dl
mov    $0x1,%esi
mov    %edx,%ecx
shl    %cl,%esi
mov    $0x1,%eax
or     %esi,(%rdi,%r8,4)
ret

LLVM IR (-O0):
define i32 @bits_setb(i32* %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
store i32* %0, i32** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
%8 = load i64, i64* %6
%9 = load i32, i32* %7
%10 = ashr i32 %9, 3
%11 = sext i32 %10 to i64
%12 = icmp ule i64 %8, %11
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 -1, i32* %4
br label %25
14: ; preds = %3
%15 = load i32, i32* %7
%16 = and i32 %15, 7
%17 = shl i32 1, %16
%18 = load i32*, i32** %5
%19 = load i32, i32* %7
%20 = ashr i32 %19, 3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = load i32, i32* %22
%24 = or i32 %23, %17
store i32 %24, i32* %22
store i32 1, i32* %4
br label %25
25: ; preds = %14, %13
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @bits_setb(i32* nocapture %0, i64 %1, i32 %2) {
%4 = ashr i32 %2, 3
%5 = sext i32 %4 to i64
%6 = icmp ult i64 %5, %1
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = and i32 %2, 7
%9 = shl nuw nsw i32 1, %8
%10 = getelementptr inbounds i32, i32* %0, i64 %5
%11 = load i32, i32* %10
%12 = or i32 %11, %9
store i32 %12, i32* %10
br label %13
13: ; preds = %3, %7
%14 = phi i32 [ 1, %7 ], [ -1, %3 ]
ret i32 %14
}
/* Type definitions */
struct ln_rst_time {
  int dummy;
};
struct ln_par_orbit {
  int dummy;
};
struct ln_lnlat_posn {
  int dummy;
};

/* Variables and functions */
int ln_get_par_body_rst_horizon(double, struct ln_lnlat_posn *,
                                struct ln_par_orbit *, double,
                                struct ln_rst_time *);
int ln_get_par_body_rst(double JD, struct ln_lnlat_posn *observer,
                        struct ln_par_orbit *orbit, struct ln_rst_time *rst) {
  return ln_get_par_body_rst_horizon(JD, observer, orbit, -0.5667, rst);
}


x86 assembly (clang, -O0):
<ln_get_par_body_rst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movsd  0xebe(%rip),%xmm1
call   1030 <ln_get_par_body_rst_horizon@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_get_par_body_rst>:
movsd  0xee8(%rip),%xmm1
jmp    1030 <ln_get_par_body_rst_horizon@plt>

LLVM IR (-O0):
%struct.ln_lnlat_posn = type { i32 }
%struct.ln_par_orbit = type { i32 }
%struct.ln_rst_time = type { i32 }
define i32 @ln_get_par_body_rst(double %0, %struct.ln_lnlat_posn* %1, %struct.ln_par_orbit* %2, %struct.ln_rst_time* %3) {
%5 = alloca double
%6 = alloca %struct.ln_lnlat_posn*
%7 = alloca %struct.ln_par_orbit*
%8 = alloca %struct.ln_rst_time*
store double %0, double* %5
store %struct.ln_lnlat_posn* %1, %struct.ln_lnlat_posn** %6
store %struct.ln_par_orbit* %2, %struct.ln_par_orbit** %7
store %struct.ln_rst_time* %3, %struct.ln_rst_time** %8
%9 = load double, double* %5
%10 = load %struct.ln_lnlat_posn*, %struct.ln_lnlat_posn** %6
%11 = load %struct.ln_par_orbit*, %struct.ln_par_orbit** %7
%12 = load %struct.ln_rst_time*, %struct.ln_rst_time** %8
%13 = call i32 @ln_get_par_body_rst_horizon(double %9, %struct.ln_lnlat_posn* %10, %struct.ln_par_orbit* %11, double -5.667000e-01, %struct.ln_rst_time* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.ln_lnlat_posn = type { i32 }
%struct.ln_par_orbit = type { i32 }
%struct.ln_rst_time = type { i32 }
define i32 @ln_get_par_body_rst(double %0, %struct.ln_lnlat_posn* %1, %struct.ln_par_orbit* %2, %struct.ln_rst_time* %3) {
%5 = tail call i32 @ln_get_par_body_rst_horizon(double %0, %struct.ln_lnlat_posn* %1, %struct.ln_par_orbit* %2, double -5.667000e-01, %struct.ln_rst_time* %3)
ret i32 %5
}
double cquat_norm2(const double *q) {
  double sum = (q[0] * q[0]) + (q[1] * q[1]) + (q[2] * q[2]) + (q[3] * q[3]);
  return sum;
}


x86 assembly (clang, -O0):
<cquat_norm2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cquat_norm2>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%rdi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x18(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @cquat_norm2(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fmul double %4, %4
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %6)
%10 = getelementptr inbounds double, double* %0, i64 3
%11 = load double, double* %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %9)
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ckfree(void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<ckfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @ckfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}