xunge/DecIR huggingface dataset:
int bar(void) {
  printf("%s:%s\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/Boshin/workspace/refs/heads/baseline/"
         "ARMToolChain/source/glibc-2.21/elf/tst-deep1mod2.c",
         __func__);
  return baz() + xyzzy();
  ;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec1(%rip),%rsi
lea    0xf6c(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <baz@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <xyzzy@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec8(%rip),%rsi
lea    0xf73(%rip),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <baz@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <xyzzy@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s:%s\0A\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Boshin/workspace/refs/heads/baseline/ARMToolChain/source/glibc-2.21/elf/tst-deep1mod2.c\00"
@__func__.bar = [4 x i8] c"bar\00"
define i32 @bar() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__func__.bar, i64 0, i64 0))
%2 = call i32 (...) @baz()
%3 = call i32 (...) @xyzzy()
%4 = add nsw i32 %2, %3
ret i32 %4
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s:%s\0A\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Boshin/workspace/refs/heads/baseline/ARMToolChain/source/glibc-2.21/elf/tst-deep1mod2.c\00"
@__func__.bar = [4 x i8] c"bar\00"
define i32 @bar() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__func__.bar, i64 0, i64 0))
%2 = tail call i32 (...) @baz()
%3 = tail call i32 (...) @xyzzy()
%4 = add nsw i32 %3, %2
ret i32 %4
}
/* Variables and functions */
double sin(double);
double cos(double x) { return sin(x + 1.57079632679489661923); }


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

x86 assembly (clang, -O2):
<cos>:
addsd  0xee8(%rip),%xmm0
jmp    1030 <sin@plt>

LLVM IR (-O0):
define double @cos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 0x3FF921FB54442D18
%5 = call double @sin(double %4)
ret double %5
}

LLVM IR (-O2):
define double @cos(double %0) {
%2 = fadd double %0, 0x3FF921FB54442D18
%3 = tail call double @sin(double %2)
ret double %3
}
/* Variables and functions */
unsigned int _bextr2_u32(unsigned int, unsigned int);
unsigned int test_bextr2_u32(unsigned int __X, unsigned int __Y) {
  return _bextr2_u32(__X, __Y);
}


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

x86 assembly (clang, -O2):
<test_bextr2_u32>:
jmp    1030 <_bextr2_u32@plt>

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

LLVM IR (-O2):
define i32 @test_bextr2_u32(i32 %0, i32 %1) {
%3 = tail call i32 @_bextr2_u32(i32 %0, i32 %1)
ret i32 %3
}
int fahr2celsius(int fahr) { return 5 * (fahr - 32) / 9; }


x86 assembly (clang, -O0):
<fahr2celsius>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
imul   $0x5,%eax,%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<fahr2celsius>:
lea    (%rdi,%rdi,4),%eax
add    $0xffffff60,%eax
cltq
imul   $0x38e38e39,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fahr2celsius(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 32
%5 = mul nsw i32 5, %4
%6 = sdiv i32 %5, 9
ret i32 %6
}

LLVM IR (-O2):
define i32 @fahr2celsius(i32 %0) {
%2 = mul i32 %0, 5
%3 = add i32 %2, -160
%4 = sdiv i32 %3, 9
ret i32 %4
}
int sumOfDigits(int num) {
  if (num <= 0)
    return 0;
  else {
    return ((num % 10) + sumOfDigits(num /= 10));
  }
}


x86 assembly (clang, -O0):
<sumOfDigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1131 <sumOfDigits+0x21>
movl   $0x0,-0x4(%rbp)
jmp    115c <sumOfDigits+0x4c>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    %edi,-0x8(%rbp)
call   1030 <sumOfDigits@plt>
mov    -0xc(%rbp),%edx
add    %eax,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfDigits>:
xor    %eax,%eax
test   %edi,%edi
jle    112d <sumOfDigits+0x2d>
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
add    %ecx,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <sumOfDigits+0x10>
ret

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

LLVM IR (-O2):
define i32 @sumOfDigits(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = urem i32 %4, 10
%7 = udiv i32 %4, 10
%8 = add nuw nsw i32 %6, %5
%9 = icmp ult i32 %4, 10
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
/* Type definitions */
typedef int clock_t;

/* Variables and functions */
int clock();
int /*<<< orphan*/ printf(char *, int);
int main() {
  clock_t t;
  t = clock();
  printf("%d\n", t);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @clock()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ assert(int);
int clock_gettime(int /*<<< orphan*/, struct timespec *);
double nano_time_d(void) {
  struct timespec ts;
  int h = clock_gettime(CLOCK_MONOTONIC, &ts);
  assert(!h);
  return (double)ts.tv_sec + (double)ts.tv_nsec * 1e-9;
}


x86 assembly (clang, -O0):
<nano_time_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xe9c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nano_time_d>:
sub    $0x18,%rsp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xea6(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define double @nano_time_d() {
%1 = alloca %struct.timespec
%2 = alloca i32
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%14 = load i64, i64* %13
%15 = sitofp i64 %14 to double
%16 = call double @llvm.fmuladd.f64(double %15, double 1.000000e-09, double %12)
ret double %16
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define double @nano_time_d() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%12 = load i64, i64* %11
%13 = sitofp i64 %12 to double
%14 = call double @llvm.fmuladd.f64(double %13, double 1.000000e-09, double %10)
ret double %14
}
float __floatundisf(unsigned long long x) { return x; }


x86 assembly (clang, -O0):
<__floatundisf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x10(%rbp)
test   %rax,%rax
movss  %xmm0,-0xc(%rbp)
js     1145 <__floatundisf+0x45>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__floatundisf>:
test   %rdi,%rdi
js     110b <__floatundisf+0xb>
cvtsi2ss %rdi,%xmm0
ret
mov    %rdi,%rax
shr    %rax
and    $0x1,%edi
or     %rax,%rdi
cvtsi2ss %rdi,%xmm0
addss  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @__floatundisf(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = uitofp i64 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @__floatundisf(i64 %0) {
%2 = uitofp i64 %0 to float
ret float %2
}
/* Variables and functions */
void *memcpy(int /*<<< orphan*/, void const *, size_t);
int /*<<< orphan*/ xmallocz(size_t);
__attribute__((visibility("hidden"))) void *xmemdupz(const void *data,
                                                     size_t len) {
  return memcpy(xmallocz(len), data, len);
}


x86 assembly (clang, -O0):
<xmemdupz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <xmallocz@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmemdupz>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <xmallocz@plt>
mov    %eax,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <memcpy@plt>

LLVM IR (-O0):
define hidden i8* @xmemdupz(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i32 @xmallocz(i64 %5)
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i8* @memcpy(i32 %6, i8* %7, i64 %8)
ret i8* %9
}

LLVM IR (-O2):
define hidden i8* @xmemdupz(i8* %0, i64 %1) {
%3 = tail call i32 @xmallocz(i64 %1)
%4 = tail call i8* @memcpy(i32 %3, i8* %0, i64 %1)
ret i8* %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
char const *ultoa(scalar_t__, char *);
const char *ltoa(int32_t value, char *buf) {
  uint32_t raw;
  if (value < 0) {
    *buf++ = '-';
    raw = (uint32_t)-value;
  } else {
    raw = (uint32_t)value;
  }
  return ultoa(raw, buf);
}


x86 assembly (clang, -O0):
<ltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    114c <ltoa+0x3c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1154 <ltoa+0x44>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ultoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltoa>:
test   %rdi,%rdi
js     111a <ltoa+0xa>
jmp    1030 <ultoa@plt>
movb   $0x2d,(%rsi)
add    $0x1,%rsi
neg    %rdi
jmp    1030 <ultoa@plt>

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

LLVM IR (-O2):
define i8* @ltoa(i64 %0, i8* %1) {
%3 = icmp slt i64 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 45, i8* %1
%6 = sub nsw i64 0, %0
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %5, %4 ], [ %1, %2 ]
%9 = phi i64 [ %6, %4 ], [ %0, %2 ]
%10 = tail call i8* @ultoa(i64 %9, i8* %8)
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ foo(int, int, int, int);
main() {
  if (foo(2, 24, 3, 4) == 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x18,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1040 <foo@plt>
cmp    $0x0,%rax
jne    1159 <main+0x39>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x18,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1040 <foo@plt>
test   %rax,%rax
je     1143 <main+0x23>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @foo(i32 2, i32 24, i32 3, i32 4)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @foo(i32 2, i32 24, i32 3, i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
void le_uint32_write(void *ptr, unsigned v) {
  unsigned char *ptr8 = (unsigned char *)ptr;
  ptr8[0] = (unsigned char)(v & 0xFF);
  ptr8[1] = (unsigned char)((v >> 8) & 0xFF);
  ptr8[2] = (unsigned char)((v >> 16) & 0xFF);
  ptr8[3] = (unsigned char)((v >> 24) & 0xFF);
}


x86 assembly (clang, -O0):
<le_uint32_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<le_uint32_write>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @le_uint32_write(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
size_t ft_strlen(char *const str) {
  char *much;
  much = str;
  while (*much++ != 0)
    ;
  return (much - str - 1);
}


x86 assembly (clang, -O0):
<ft_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1130 <ft_strlen+0x30>
jmp    1110 <ft_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <ft_strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @ft_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %0 to i64
%10 = xor i64 %9, -1
%11 = add i64 %8, %10
ret i64 %11
}
/* Variables and functions */
scalar_t__ _get_sysfs_numeric(char *, char *, unsigned long *);
unsigned long get_sysfs_lhex(char *sysfs_attr) {
  unsigned long number;
  if (_get_sysfs_numeric(sysfs_attr, "%lx", &number) == 0)
    return number;
  else
    return ((unsigned long)-1);
}


x86 assembly (clang, -O0):
<get_sysfs_lhex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <_get_sysfs_numeric@plt>
cmp    $0x0,%rax
jne    1147 <get_sysfs_lhex+0x37>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114f <get_sysfs_lhex+0x3f>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sysfs_lhex>:
push   %rax
lea    0xee8(%rip),%rsi
mov    %rsp,%rdx
call   1030 <_get_sysfs_numeric@plt>
neg    %rax
sbb    %rax,%rax
or     (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lx\00"
define i64 @get_sysfs_lhex(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i64 @_get_sysfs_numeric(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%5 = icmp eq i64 %4, 0
%6 = load i64, i64* %2
%7 = select i1 %5, i64 %6, i64 -1
ret i64 %7
}
const char *cpu_device_get_serialnumber(void) {
  return "AAABBBCCCDDDEEEFFF000111";
}


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

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

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

LLVM IR (-O2):
@.str = [25 x i8] c"AAABBBCCCDDDEEEFFF000111\00"
define i8* @cpu_device_get_serialnumber() {
ret i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0)
}
int bitwiseaddition(int a, int b) {
  while (b != 0) {
    int carry = a & b;
    a = a ^ b;
    b = carry << 1;
  }
  return a;
}


x86 assembly (clang, -O0):
<bitwiseaddition>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1134 <bitwiseaddition+0x34>
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110a <bitwiseaddition+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bitwiseaddition(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %0, %2 ]
%6 = phi i32 [ %9, %4 ], [ %1, %2 ]
%7 = and i32 %5, %6
%8 = xor i32 %5, %6
%9 = shl i32 %7, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ %0, %2 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
int main(int argc, char *argv[]) {
  void *buf = malloc(16);
  free(buf);
  free(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @malloc(i32 16)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @free(i8* %8)
%10 = load i8*, i8** %6
%11 = call i32 @free(i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%4 = tail call i32 @free(i8* %3)
%5 = tail call i32 @free(i8* %3)
ret i32 0
}
int kwadrat(int a) { return a * a; }


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

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

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

LLVM IR (-O2):
define i32 @kwadrat(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
_Complex float test_csinf(_Complex float x) { return __builtin_csinf(x); }


x86 assembly (clang, -O0):
<test_csinf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movlpd %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  %xmm1,-0x18(%rbp)
movss  %xmm0,-0x14(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <csinf@plt>
movlpd %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0x4(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_csinf>:
jmp    1030 <csinf@plt>

LLVM IR (-O0):
define <2 x float> @test_csinf(<2 x float> %0) {
%2 = alloca { float, float }
%3 = alloca { float, float }
%4 = alloca { float, float }
%5 = alloca { float, float }
%6 = bitcast { float, float }* %3 to <2 x float>*
store <2 x float> %0, <2 x float>* %6
%7 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 0
%8 = load float, float* %7
%9 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 1
%10 = load float, float* %9
%11 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 0
%12 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 1
store float %8, float* %11
store float %10, float* %12
%13 = bitcast { float, float }* %4 to <2 x float>*
%14 = load <2 x float>, <2 x float>* %13
%15 = call <2 x float> @csinf(<2 x float> %14)
%16 = bitcast { float, float }* %5 to <2 x float>*
store <2 x float> %15, <2 x float>* %16
%17 = getelementptr inbounds { float, float }, { float, float }* %5, i32 0, i32 0
%18 = load float, float* %17
%19 = getelementptr inbounds { float, float }, { float, float }* %5, i32 0, i32 1
%20 = load float, float* %19
%21 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%22 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
store float %18, float* %21
store float %20, float* %22
%23 = bitcast { float, float }* %2 to <2 x float>*
%24 = load <2 x float>, <2 x float>* %23
ret <2 x float> %24
}

LLVM IR (-O2):
define <2 x float> @test_csinf(<2 x float> %0) {
%2 = tail call <2 x float> @csinf(<2 x float> %0)
ret <2 x float> %2
}
void idle_task_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @idle_task_exit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int set_timeout(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int disable_timeout(int sock) {
  if (set_timeout(sock, 0) == -1) {
    fprintf(stderr, "[disable_timeout]: couldn't disable timeout for sock\n");
    return -1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<disable_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <set_timeout@plt>
cmp    $0xffffffff,%eax
jne    115f <disable_timeout+0x3f>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1166 <disable_timeout+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_timeout>:
push   %rbx
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <set_timeout@plt>
cmp    $0xffffffff,%eax
jne    1149 <disable_timeout+0x29>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"[disable_timeout]: couldn't disable timeout for sock\0A\00"
define i32 @disable_timeout(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @set_timeout(i32 %4, i32 0)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"[disable_timeout]: couldn't disable timeout for sock\0A\00"
define i32 @disable_timeout(i32 %0) {
%2 = tail call i32 @set_timeout(i32 %0, i32 0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ assert(char const *);
int trio_equal(char const *, char const *);
__attribute__((visibility("default"))) int
trio_equal_locale(const char *first, const char *second) {
  assert(first);
  assert(second);
  return trio_equal(first, second);
}


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

x86 assembly (clang, -O2):
<trio_equal_locale>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <trio_equal@plt>

LLVM IR (-O0):
define i32 @trio_equal_locale(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 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %4
%8 = call i32 @assert(i8* %7)
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 @trio_equal(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @trio_equal_locale(i8* %0, i8* %1) {
%3 = tail call i32 @assert(i8* %0)
%4 = tail call i32 @assert(i8* %1)
%5 = tail call i32 @trio_equal(i8* %0, i8* %1)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int pthread_setaffinity_np(pthread_t thread, size_t size, cpu_set_t *set) {
  ;
  return 0;
}


x86 assembly (clang, -O0):
<pthread_setaffinity_np>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @pthread_setaffinity_np(i32 %0, i64 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32*
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32* %2, i32** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_setaffinity_np(i32 %0, i64 %1, i32* nocapture readnone %2) {
ret i32 0
}
int test_imm_76int32_reg(int val) { return ((val) & (0x76 << 0)) ? -20 : -40; }


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

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

LLVM IR (-O0):
define i32 @test_imm_76int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 118
%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_76int32_reg(i32 %0) {
%2 = and i32 %0, 118
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, size_t);
void cio_stack_free(void *stack, size_t size) { munmap(stack, size); }


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

x86 assembly (clang, -O2):
<cio_stack_free>:
jmp    1030 <munmap@plt>

LLVM IR (-O0):
define void @cio_stack_free(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 @munmap(i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
define void @cio_stack_free(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ blewnop(unsigned char **);
int rand();
void blewnops(unsigned char **p) {
  int i = (rand() % 3) + 1;
  while (i--) {
    blewnop(p);
  }
}


x86 assembly (clang, -O0):
<blewnops>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1163 <blewnops+0x43>
mov    -0x8(%rbp),%rdi
call   1030 <blewnop@plt>
jmp    1141 <blewnops+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blewnops>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rbx
imul   $0x55555556,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebx
inc    %ebx
je     115d <blewnops+0x3d>
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <blewnop@plt>
add    $0xffffffff,%ebx
jne    1150 <blewnops+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @blewnops(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
br label %7
7: ; preds = %11, %1
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8**, i8*** %2
%13 = call i32 @blewnop(i8** %12)
br label %7
14: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @blewnops(i8** %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 3
%4 = add nsw i32 %3, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %8, %6 ], [ %4, %1 ]
%8 = add nsw i32 %7, -1
%9 = tail call i32 @blewnop(i8** %0)
%10 = icmp eq i32 %8, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %1
ret void
}
int fun1021() { return 1021; }


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

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

LLVM IR (-O0):
define i32 @fun1021() {
ret i32 1021
}

LLVM IR (-O2):
define i32 @fun1021() {
ret i32 1021
}
void ARGBToARGB1555() {}


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

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

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

LLVM IR (-O2):
define void @ARGBToARGB1555() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int sum(int, int);
int main(void) {
  int first = 3;
  int second = 11;
  int result = sum(first, second);
  printf("%d + %d = %d \n", first, second, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0xb,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <sum@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0xb,%esi
call   1040 <sum@plt>
lea    0xec9(%rip),%rdi
mov    $0x3,%esi
mov    $0xb,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%d + %d = %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
store i32 11, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @sum(i32 %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d + %d = %d \0A\00"
define i32 @main() {
%1 = tail call i32 @sum(i32 3, i32 11)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, i32 11, i32 %1)
ret i32 0
}
int main() {
  volatile int foo[10];
  int sz = sizeof(int);
  volatile char *bar = (char *)foo;
  bar[sz * 10] = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x34(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
imul   $0xa,-0x34(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
store i32 4, i32* %3
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = bitcast i32* %5 to i8*
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 10
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
store volatile i8 0, i8* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int gen_ip_index(int max) {
  static int i = 0;
  return (i++) % max;
}


x86 assembly (clang, -O0):
<gen_ip_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2f17(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f0c(%rip)
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_ip_index>:
mov    0x2f1e(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f15(%rip)
cltd
idiv   %edi
mov    %edx,%eax
ret

LLVM IR (-O0):
@gen_ip_index.i = internal global i32 0
define i32 @gen_ip_index(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @gen_ip_index.i
%4 = add nsw i32 %3, 1
store i32 %4, i32* @gen_ip_index.i
%5 = load i32, i32* %2
%6 = srem i32 %3, %5
ret i32 %6
}

LLVM IR (-O2):
@gen_ip_index.i = internal unnamed_addr global i32 0
define i32 @gen_ip_index(i32 %0) {
%2 = load i32, i32* @gen_ip_index.i
%3 = add nsw i32 %2, 1
store i32 %3, i32* @gen_ip_index.i
%4 = srem i32 %2, %0
ret i32 %4
}
double ls_costN_nm8_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<ls_costN_nm8_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <ls_costN_nm8_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <ls_costN_nm8_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <ls_costN_nm8_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <ls_costN_nm8_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm8_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

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

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

/* Variables and functions */
bool SHAREMIND_SET_KEY_LESS_THAN_int8_t(int8_t const k1, int8_t const k2) {
  return k1 < k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_SET_KEY_LESS_THAN_int8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_SET_KEY_LESS_THAN_int8_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_int8_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_SET_KEY_LESS_THAN_int8_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct can_dev {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sja1000_clear_dataovr(struct can_dev *);
void sja1000_post_irq(struct can_dev *chip, unsigned short int irqn) {
  if (irqn & 0x4) {
    sja1000_clear_dataovr(chip);
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     113c <sja1000_post_irq+0x2c>
mov    -0x8(%rbp),%rdi
call   1030 <sja1000_clear_dataovr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
test   $0x4,%sil
jne    1117 <sja1000_post_irq+0x7>
ret
jmp    1030 <sja1000_clear_dataovr@plt>

LLVM IR (-O0):
%struct.can_dev = type { i32 }
define void @sja1000_post_irq(%struct.can_dev* %0, i16 zeroext %1) {
%3 = alloca %struct.can_dev*
%4 = alloca i16
store %struct.can_dev* %0, %struct.can_dev** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = and i32 %6, 4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load %struct.can_dev*, %struct.can_dev** %3
%11 = call i32 @sja1000_clear_dataovr(%struct.can_dev* %10)
br label %12
12: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
%struct.can_dev = type { i32 }
define void @sja1000_post_irq(%struct.can_dev* %0, i16 zeroext %1) {
%3 = and i16 %1, 4
%4 = icmp eq i16 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @sja1000_clear_dataovr(%struct.can_dev* %0)
br label %7
7: ; preds = %5, %2
ret void
}
int mysum(int a, int b, int d) { return a + b + d; }


x86 assembly (clang, -O0):
<mysum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysum>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @mysum(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @mysum(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
unsigned char MApi_PNL_TCONMAP_Power_Sequence(unsigned char *pTCONTable,
                                              unsigned char bEnable) {
  printf("\n\n!![Alert]Don't ued this function. It is removed!!\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<MApi_PNL_TCONMAP_Power_Sequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [54 x i8] c"\0A\0A!![Alert]Don't ued this function. It is removed!!\0A\0A\00"
define zeroext i8 @MApi_PNL_TCONMAP_Power_Sequence(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret i8 0
}

LLVM IR (-O2):
@str = [53 x i8] c"\0A\0A!![Alert]Don't ued this function. It is removed!!\0A\00"
define zeroext i8 @MApi_PNL_TCONMAP_Power_Sequence(i8* nocapture readnone %0, i8 zeroext %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
ret i8 0
}
int f_bun_mr1(float *a1, float a2) { return (__builtin_isunordered(*a1, a2)); }


x86 assembly (clang, -O0):
<f_bun_mr1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
ucomiss -0xc(%rbp),%xmm0
setp   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_bun_mr1>:
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setp   %al
ret

LLVM IR (-O0):
define i32 @f_bun_mr1(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float, float* %4
%8 = fcmp uno float %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @f_bun_mr1(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = fcmp uno float %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}