xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void double_fault_abort(void) { panic("exception(abort): double fault"); }


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"exception(abort): double fault\00"
define void @double_fault_abort() {
%1 = call i32 @panic(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"exception(abort): double fault\00"
define void @double_fault_abort() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned long GCD(unsigned long, unsigned long);
unsigned long LCM(unsigned long a, unsigned long b) {
  return (a * b) / GCD(a, b);
}


x86 assembly (clang, -O0):
<LCM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <GCD@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
xor    %edx,%edx
div    %rcx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCM>:
push   %rbx
mov    %rsi,%rbx
imul   %rdi,%rbx
call   1030 <GCD@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1133 <LCM+0x23>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i64 @LCM(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 = mul i64 %5, %6
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = call i64 @GCD(i64 %8, i64 %9)
%11 = udiv i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @LCM(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i64 @GCD(i64 %0, i64 %1)
%5 = udiv i64 %3, %4
ret i64 %5
}
void port_unlock_from_isr(void) {}


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

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

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

LLVM IR (-O2):
define void @port_unlock_from_isr() {
ret void
}
void m3_mdm_sr_update(void) { return; }


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

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

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

LLVM IR (-O2):
define void @m3_mdm_sr_update() {
ret void
}
int _zero_padded(unsigned long num, int width) {
  int n = 1;
  while (num /= 10L)
    n++;
  return width > n ? width - n : 0;
}


x86 assembly (clang, -O0):
<_zero_padded>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     113c <_zero_padded+0x3c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <_zero_padded+0x12>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1156 <_zero_padded+0x56>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <_zero_padded+0x60>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <_zero_padded+0x60>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_zero_padded>:
mov    %esi,%r8d
mov    $0x1,%ecx
cmp    $0xa,%rdi
jb     1136 <_zero_padded+0x36>
mov    $0x1,%ecx
movabs $0xcccccccccccccccd,%rsi
cc cc cc
nopl   (%rax)
mov    %rdi,%rax
mul    %rsi
shr    $0x3,%rdx
add    $0x1,%ecx
cmp    $0x63,%rdi
mov    %rdx,%rdi
ja     1120 <_zero_padded+0x20>
xor    %eax,%eax
sub    %ecx,%r8d
cmovle %eax,%r8d
mov    %r8d,%eax
ret

LLVM IR (-O0):
define i32 @_zero_padded(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
store i32 1, i32* %5
br label %6
6: ; preds = %10, %2
%7 = load i64, i64* %3
%8 = udiv i64 %7, 10
store i64 %8, i64* %3
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
store i32 %12, i32* %5
br label %6
13: ; preds = %6
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 %18, %19
br label %22
21: ; preds = %13
br label %22
22: ; preds = %21, %17
%23 = phi i32 [ %20, %17 ], [ 0, %21 ]
ret i32 %23
}

LLVM IR (-O2):
define i32 @_zero_padded(i64 %0, i32 %1) {
%3 = icmp ult i64 %0, 10
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 1, %2 ]
%6 = phi i64 [ %7, %4 ], [ %0, %2 ]
%7 = udiv i64 %6, 10
%8 = add nuw nsw i32 %5, 1
%9 = icmp ult i64 %6, 100
br i1 %9, label %10, label %4
10: ; preds = %4, %2
%11 = phi i32 [ 1, %2 ], [ %8, %4 ]
%12 = icmp slt i32 %11, %1
%13 = sub nsw i32 %1, %11
%14 = select i1 %12, i32 %13, i32 0
ret i32 %14
}
float cToF(float tempC) { return tempC * 9 / 5 + 32; }


x86 assembly (clang, -O0):
<cToF>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xee6(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xed6(%rip),%xmm1
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cToF>:
mulss  0xef8(%rip),%xmm0
divss  0xef4(%rip),%xmm0
addss  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define float @cToF(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 9.000000e+00
%5 = fdiv float %4, 5.000000e+00
%6 = fadd float %5, 3.200000e+01
ret float %6
}

LLVM IR (-O2):
define float @cToF(float %0) {
%2 = fmul float %0, 9.000000e+00
%3 = fdiv float %2, 5.000000e+00
%4 = fadd float %3, 3.200000e+01
ret float %4
}
/* Variables and functions */
unsigned int mus_char_to_ubint(unsigned char const *);
unsigned int mus_char_to_ulint(unsigned char const *);
unsigned int big_or_little_endian_uint(const unsigned char *n, int little) {
  if (little)
    return (mus_char_to_ulint(n));
  return (mus_char_to_ubint(n));
}


x86 assembly (clang, -O0):
<big_or_little_endian_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     114a <big_or_little_endian_uint+0x2a>
mov    -0x10(%rbp),%rdi
call   1030 <mus_char_to_ulint@plt>
mov    %eax,-0x4(%rbp)
jmp    1156 <big_or_little_endian_uint+0x36>
mov    -0x10(%rbp),%rdi
call   1040 <mus_char_to_ubint@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big_or_little_endian_uint>:
test   %esi,%esi
je     1129 <big_or_little_endian_uint+0x9>
jmp    1030 <mus_char_to_ulint@plt>
jmp    1040 <mus_char_to_ubint@plt>

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

LLVM IR (-O2):
define i32 @big_or_little_endian_uint(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @mus_char_to_ulint(i8* %0)
br label %8
6: ; preds = %2
%7 = tail call i32 @mus_char_to_ubint(i8* %0)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
void posix_class_neg2NP_UPPER() {}


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

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

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

LLVM IR (-O2):
define void @posix_class_neg2NP_UPPER() {
ret void
}
/* Variables and functions */
scalar_t__ abs(int);
double var_weight(int cost, int size) {
  return ((double)abs(cost)) / ((double)size);
}


x86 assembly (clang, -O0):
<var_weight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
cvtsi2sd %rax,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<var_weight>:
push   %rbx
mov    %esi,%ebx
call   1030 <abs@plt>
cvtsi2sd %rax,%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @var_weight(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 = call i64 @abs(i32 %5)
%7 = sitofp i64 %6 to double
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to double
%10 = fdiv double %7, %9
ret double %10
}

LLVM IR (-O2):
define double @var_weight(i32 %0, i32 %1) {
%3 = tail call i64 @abs(i32 %0)
%4 = sitofp i64 %3 to double
%5 = sitofp i32 %1 to double
%6 = fdiv double %4, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_psimatrix(int **m) {
  free((char *)(m[0]));
  free((char *)(m));
}


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

x86 assembly (clang, -O2):
<free_psimatrix>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_psimatrix(i32** nocapture %0) {
%2 = bitcast i32** %0 to i8**
%3 = load i8*, i8** %2
%4 = tail call i32 @free(i8* %3)
%5 = bitcast i32** %0 to i8*
%6 = tail call i32 @free(i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ spi_read16(int, unsigned char *);
int /*<<< orphan*/ spi_write16(int, int);
void MCP23s17_ReadGPIO_A(unsigned char *data) {
  spi_write16((0x01), 0xFF);
  spi_read16((0x13), data);
}


x86 assembly (clang, -O0):
<MCP23s17_ReadGPIO_A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
mov    $0xff,%esi
call   1040 <spi_write16@plt>
mov    -0x8(%rbp),%rsi
mov    $0x13,%edi
call   1030 <spi_read16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MCP23s17_ReadGPIO_A>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
mov    $0xff,%esi
call   1040 <spi_write16@plt>
mov    $0x13,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <spi_read16@plt>

LLVM IR (-O0):
define void @MCP23s17_ReadGPIO_A(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @spi_write16(i32 1, i32 255)
%4 = load i8*, i8** %2
%5 = call i32 @spi_read16(i32 19, i8* %4)
ret void
}

LLVM IR (-O2):
define void @MCP23s17_ReadGPIO_A(i8* %0) {
%2 = tail call i32 @spi_write16(i32 1, i32 255)
%3 = tail call i32 @spi_read16(i32 19, i8* %0)
ret void
}
void inc(const void *val) { *(int *)val = *(int *)val + 1; }


x86 assembly (clang, -O0):
<inc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc>:
addl   $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @inc(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 = add nsw i32 %5, 1
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
ret void
}

LLVM IR (-O2):
define void @inc(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
ret void
}
/* Variables and functions */
int rand();
int get_nonce() {
  int x = rand();
  const int y = x;
  return y;
}


x86 assembly (clang, -O0):
<get_nonce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @get_nonce() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @rand()
store i32 %3, i32* %1
%4 = load i32, i32* %1
store i32 %4, i32* %2
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_nonce() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
long getlong(FILE *inf) {
  unsigned char buf[4];
  fread(buf, 4, 1, inf);
  return ((buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + (buf[3] << 0));
}


x86 assembly (clang, -O0):
<getlong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movzbl -0xc(%rbp),%eax
shl    $0x18,%eax
movzbl -0xb(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
movzbl -0xa(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
movzbl -0x9(%rbp),%ecx
shl    $0x0,%ecx
add    %ecx,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getlong>:
push   %rax
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movzbl 0x4(%rsp),%eax
shl    $0x18,%eax
movzbl 0x5(%rsp),%ecx
shl    $0x10,%rcx
cltq
or     %rcx,%rax
movzbl 0x6(%rsp),%ecx
shl    $0x8,%rcx
or     %rax,%rcx
movzbl 0x7(%rsp),%eax
or     %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @getlong(i32* %0) {
%2 = alloca i32*
%3 = alloca [4 x i8]
store i32* %0, i32** %2
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i32*, i32** %2
%6 = call i32 @fread(i8* %4, i32 4, i32 1, i32* %5)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 24
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 16
%15 = add nsw i32 %10, %14
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = add nsw i32 %15, %19
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = shl i32 %23, 0
%25 = add nsw i32 %20, %24
%26 = sext i32 %25 to i64
ret i64 %26
}

LLVM IR (-O2):
define i64 @getlong(i32* nocapture %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = call i32 @fread(i8* %3, i32 4, i32 1, i32* %0)
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = shl nuw i32 %6, 24
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl nuw nsw i32 %10, 16
%12 = or i32 %11, %7
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl nuw nsw i32 %15, 8
%17 = or i32 %12, %16
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = or i32 %17, %20
%22 = sext i32 %21 to i64
ret i64 %22
}
void entry_to() {}


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

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

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

LLVM IR (-O2):
define void @entry_to() {
ret void
}
/* Variables and functions */
char *strerror(int);
int /*<<< orphan*/ xsnprintf(char *, int, char *, int);
char *safe_strerror(int errnum) {
  char *msg;
  msg = strerror(errnum);
  if (msg == NULL) {
    static char buf[32];
    xsnprintf(buf, sizeof buf, "(undocumented errno %d)", errnum);
    msg = buf;
  }
  return (msg);
}


x86 assembly (clang, -O0):
<safe_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <strerror@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <safe_strerror+0x48>
mov    -0x4(%rbp),%ecx
lea    0x2ef4(%rip),%rdi
mov    $0x20,%esi
lea    0xea8(%rip),%rdx
call   1030 <xsnprintf@plt>
lea    0x2edc(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_strerror>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <strerror@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114f <safe_strerror+0x2f>
lea    0x2f07(%rip),%rbx
lea    0xec0(%rip),%rdx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %ebp,%ecx
call   1030 <xsnprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@safe_strerror.buf = internal global [32 x i8] zeroinitializer
@.str = [24 x i8] c"(undocumented errno %d)\00"
define i8* @safe_strerror(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @strerror(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @xsnprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @safe_strerror.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %9)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @safe_strerror.buf, i64 0, i64 0), i8** %3
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@safe_strerror.buf = internal global [32 x i8] zeroinitializer
@.str = [24 x i8] c"(undocumented errno %d)\00"
define i8* @safe_strerror(i32 %0) {
%2 = tail call i8* @strerror(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @xsnprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @safe_strerror.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
%7 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @safe_strerror.buf, i64 0, i64 0), %4 ], [ %2, %1 ]
ret i8* %7
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t clamp32(int64_t sample) {
  if ((sample >> 31) ^ (sample >> 63))
    sample = 0x7fffffff ^ (sample >> 63);
  return sample;
}


x86 assembly (clang, -O0):
<clamp32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    -0x4(%rbp),%edx
mov    $0x3f,%ecx
sar    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
cmp    $0x0,%eax
je     1136 <clamp32+0x36>
mov    -0x4(%rbp),%eax
mov    $0x3f,%ecx
sar    %cl,%eax
xor    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @clamp32(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int __builtin_clzl(unsigned long);
unsigned long log2(unsigned long n) {
  return (8 * sizeof(unsigned long) - __builtin_clzl(n)) - 1;
}


x86 assembly (clang, -O0):
<log2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
bsr    %rax,%rax
xor    $0x3f,%rax
movslq %eax,%rcx
mov    $0x40,%eax
sub    %rcx,%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2>:
bsr    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @log2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @llvm.ctlz.i64(i64 %3, i1 true)
%5 = trunc i64 %4 to i32
%6 = sext i32 %5 to i64
%7 = sub i64 64, %6
%8 = sub i64 %7, 1
ret i64 %8
}

LLVM IR (-O2):
define i64 @log2(i64 %0) {
%2 = tail call i64 @llvm.ctlz.i64(i64 %0, i1 true)
%3 = xor i64 %2, 63
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void example1(void) {
  int top;
  int top2;
  int arr[10];
  arr[top] = 42;
  top2 = top;
  assert(arr[top2] == 42);
}


x86 assembly (clang, -O0):
<example1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movslq -0x4(%rbp),%rax
movl   $0x2a,-0x30(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmpl   $0x2a,-0x30(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example1>:
mov    $0x1,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @example1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %5
store i32 42, i32* %6
%7 = load i32, i32* %1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 42
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret void
}

LLVM IR (-O2):
define void @example1() {
%1 = tail call i32 @assert(i32 1)
ret void
}
__attribute__((cold)) void dav1d_init_cpu(void) {}


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

x86 assembly (clang, -O2):
<dav1d_init_cpu>:
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)

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

LLVM IR (-O2):
define void @dav1d_init_cpu() {
ret void
}
/* Variables and functions */
int __fpclassify(double);
int __fpclassifyd(double x) { return __fpclassify(x); }


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

x86 assembly (clang, -O2):
<__fpclassifyd>:
jmp    1030 <__fpclassify@plt>

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

LLVM IR (-O2):
define i32 @__fpclassifyd(double %0) {
%2 = tail call i32 @__fpclassify(double %0)
ret i32 %2
}
void wait_intr() { asm volatile("hlt"); }


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

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

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

LLVM IR (-O2):
define void @wait_intr() {
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
moo(__sp, __fuck) { return __sp + __fuck; }


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

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

LLVM IR (-O0):
define i32 @moo(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @moo(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ __NR_ioctl;
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int, int /*<<< orphan*/);
void failing_ioctl_run(void *arg) { syscall(__NR_ioctl, -1, 0); }


x86 assembly (clang, -O0):
<failing_ioctl_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<failing_ioctl_run>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
mov    $0xffffffff,%esi
xor    %edx,%edx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_ioctl = global i32 0
define void @failing_ioctl_run(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @__NR_ioctl
%4 = call i32 @syscall(i32 %3, i32 -1, i32 0)
ret void
}

LLVM IR (-O2):
@__NR_ioctl = global i32 0
define void @failing_ioctl_run(i8* nocapture readnone %0) {
%2 = load i32, i32* @__NR_ioctl
%3 = tail call i32 @syscall(i32 %2, i32 -1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert_in_range(int);
void assert_in_range_2(int m, int n) {
  assert_in_range(m);
  assert_in_range(n);
}


x86 assembly (clang, -O0):
<assert_in_range_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <assert_in_range@plt>
mov    -0x8(%rbp),%edi
call   1030 <assert_in_range@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_in_range_2>:
push   %rbx
mov    %esi,%ebx
call   1030 <assert_in_range@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <assert_in_range@plt>

LLVM IR (-O0):
define void @assert_in_range_2(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 = call i32 @assert_in_range(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @assert_in_range(i32 %7)
ret void
}

LLVM IR (-O2):
define void @assert_in_range_2(i32 %0, i32 %1) {
%3 = tail call i32 @assert_in_range(i32 %0)
%4 = tail call i32 @assert_in_range(i32 %1)
ret void
}
unsigned xrop3_110_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  unsigned stk4;
  stk4 = ~S;
  stk3 = T | stk4;
  stk2 = D & stk3;
  stk1 = S ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_110_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_110_1_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
not    %ecx
mov    %edi,%eax
xor    $0xff,%eax
or     %esi,%eax
and    %ecx,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_110_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
store i32 %17, i32* %6
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
store i32 %23, i32* %7
%24 = load i32, i32* %6
%25 = xor i32 %24, -1
store i32 %25, i32* %11
%26 = load i32, i32* %7
%27 = load i32, i32* %11
%28 = or i32 %26, %27
store i32 %28, i32* %10
%29 = load i32, i32* %5
%30 = load i32, i32* %10
%31 = and i32 %29, %30
store i32 %31, i32* %9
%32 = load i32, i32* %6
%33 = load i32, i32* %9
%34 = xor i32 %32, %33
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = load i32, i32* %6
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = and i32 %39, %40
%42 = or i32 %38, %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @xrop3_110_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = xor i32 %4, -1
%7 = xor i32 %3, 255
%8 = or i32 %7, %5
%9 = and i32 %8, %6
%10 = or i32 %9, %3
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void keyboardFunc(unsigned char key, int x, int y) {
  if (key == 27)
    exit(1);
}


x86 assembly (clang, -O0):
<keyboardFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1b,%eax
jne    113b <keyboardFunc+0x2b>
mov    $0x1,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboardFunc>:
cmp    $0x1b,%dil
je     1117 <keyboardFunc+0x7>
ret
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @keyboardFunc(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 27
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @keyboardFunc(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int a = 0;
  while ((a % 2) == 0) {
    a += 2;
    printf("%d ", a);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1157 <main+0x47>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x2,%ebx
jmp    1120 <main+0x10>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %3, %1 ]
%3 = add nuw nsw i32 %2, 2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %1
}
int dquot_initialize(struct inode *inode) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.inode = type opaque
define i32 @dquot_initialize(%struct.inode* nocapture readnone %0) {
ret i32 0
}
void chderr(dir) const char *const dir;
{
  nlog("Couldn't chdir to");
  logqnl(dir);
}


x86 assembly (clang, -O0):
<chderr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1040 <nlog@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <logqnl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chderr>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <nlog@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <logqnl@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Couldn't chdir to\00"
define void @chderr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @nlog to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @logqnl to i32 (i8*, ...)*)(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Couldn't chdir to\00"
define void @chderr(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @nlog to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @logqnl to i32 (i8*, ...)*)(i8* %0)
ret void
}
int do_795() { return 795; }


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

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

LLVM IR (-O0):
define i32 @do_795() {
ret i32 795
}

LLVM IR (-O2):
define i32 @do_795() {
ret i32 795
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t orr0xf0(uint64_t x) { return x | 0xf0; }


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

x86 assembly (clang, -O2):
<orr0xf0>:
mov    %edi,%eax
or     $0xf0,%eax
ret

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

LLVM IR (-O2):
define i32 @orr0xf0(i32 %0) {
%2 = or i32 %0, 240
ret i32 %2
}
void foo073(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo073(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void newline() { printf("\n"); }


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

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

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

LLVM IR (-O2):
define void @newline() {
%1 = tail call i32 @putchar(i32 10)
ret void
}
int mg_is_ws_first_fragment(unsigned char flags) {
  return (flags & 0x80) == 0 && (flags & 0x0f) != 0;
}


x86 assembly (clang, -O0):
<mg_is_ws_first_fragment>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%ecx
and    $0x80,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
jne    1132 <mg_is_ws_first_fragment+0x32>
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_is_ws_first_fragment>:
test   $0x80,%dil
sete   %al
test   $0xf,%dil
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @mg_is_ws_first_fragment(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 128
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
%11 = icmp ne i32 %10, 0
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @mg_is_ws_first_fragment(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
%5 = and i32 %2, 15
%6 = icmp ne i32 %5, 0
%7 = and i1 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int AddNum(int, int);
void MyFunc() {
  int c;
  c = AddNum(123, 456);
}


x86 assembly (clang, -O0):
<MyFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x7b,%edi
mov    $0x1c8,%esi
call   1030 <AddNum@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MyFunc>:
mov    $0x7b,%edi
mov    $0x1c8,%esi
jmp    1030 <AddNum@plt>

LLVM IR (-O0):
define void @MyFunc() {
%1 = alloca i32
%2 = call i32 @AddNum(i32 123, i32 456)
store i32 %2, i32* %1
ret void
}

LLVM IR (-O2):
define void @MyFunc() {
%1 = tail call i32 @AddNum(i32 123, i32 456)
ret void
}
/* Variables and functions */
const char *strchr(const char *s, char c) {
  for (;;) {
    if (*s == c)
      return s;
    if (!*s++)
      return 0;
  }
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    112e <strchr+0x2e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1158 <strchr+0x58>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    1153 <strchr+0x53>
movq   $0x0,-0x8(%rbp)
jmp    1158 <strchr+0x58>
jmp    110e <strchr+0xe>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
cmp    %sil,%cl
je     1122 <strchr+0x22>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, %1
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, 0
br i1 %9, label %10, label %3
10: ; preds = %7, %3
%11 = phi i8* [ %4, %3 ], [ null, %7 ]
ret i8* %11
}
/* Variables and functions */
int rom_present(char *);
int xtide_at_available() { return rom_present("roms/ide_at.bin"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"roms/ide_at.bin\00"
define i32 @xtide_at_available() {
%1 = call i32 @rom_present(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [16 x i8] c"roms/ide_at.bin\00"
define i32 @xtide_at_available() {
%1 = tail call i32 @rom_present(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ LedsP__Led0__clr();
void LedsP__Leds__led0On(void) {
  LedsP__Led0__clr();
  ;
  ;
}


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

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

LLVM IR (-O0):
define void @LedsP__Leds__led0On() {
%1 = call i32 (...) @LedsP__Led0__clr()
ret void
}

LLVM IR (-O2):
define void @LedsP__Leds__led0On() {
%1 = tail call i32 (...) @LedsP__Led0__clr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
scalar_t__ write(int /*<<< orphan*/, char *, int);
void linenoiseClearScreen(void) {
  if (write(STDOUT_FILENO, "\x1b[H\x1b[2J", 7) <= 0) {
  }
}


x86 assembly (clang, -O0):
<linenoiseClearScreen>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x7,%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jg     113d <linenoiseClearScreen+0x2d>
jmp    113d <linenoiseClearScreen+0x2d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<linenoiseClearScreen>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
mov    $0x7,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @linenoiseClearScreen() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = call i64 @write(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%3 = icmp sle i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
br label %5
5: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @linenoiseClearScreen() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = tail call i64 @write(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ compile(char *, char *);
int /*<<< orphan*/ printf(char *);
void testCompiler() {
  printf("Running testCompiler().\n");
  char *sample0 = "2 + 2 \n";
  char *sample1 = "2+2\n2-2\n2*2\n2/2";
  char *sample2 = "2 + 2\n3-1\n4* 3  \n 9/ 3  ";
  compile(sample0, "test.psc");
  printf("Compilation completed.\n");
}


x86 assembly (clang, -O0):
<testCompiler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xee0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeea(%rip),%rsi
call   1040 <compile@plt>
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testCompiler>:
push   %rax
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0xecd(%rip),%rsi
call   1040 <compile@plt>
lea    0xee2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Running testCompiler().\0A\00"
@.str.1 = [8 x i8] c"2 + 2 \0A\00"
@.str.2 = [16 x i8] c"2+2\0A2-2\0A2*2\0A2/2\00"
@.str.3 = [25 x i8] c"2 + 2\0A3-1\0A4* 3 \0A 9/ 3 \00"
@.str.4 = [9 x i8] c"test.psc\00"
@.str.5 = [24 x i8] c"Compilation completed.\0A\00"
define void @testCompiler() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %1
%6 = call i32 @compile(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"2 + 2 \0A\00"
@.str.4 = [9 x i8] c"test.psc\00"
@str = [24 x i8] c"Running testCompiler().\00"
@str.6 = [23 x i8] c"Compilation completed.\00"
define void @testCompiler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @compile(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _cnn_mnist_test(int);
int main(int argc, char **argv) {
  _cnn_mnist_test(1);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @_cnn_mnist_test(i32 1)
ret i32 0
}
/* Variables and functions */
int strcmp(char *, char *);
compareGenerations(const void *first, const void *second) {
  return strcmp((char *)first, (char *)second);
}


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

x86 assembly (clang, -O2):
<compareGenerations>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compareGenerations(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int EPOLLIN;
int EPOLLRDHUP;
int /*<<< orphan*/ kore_platform_event_schedule(int, int, int /*<<< orphan*/,
                                                void *);
void kore_platform_event_level_read(int fd, void *c) {
  kore_platform_event_schedule(fd, EPOLLIN | EPOLLRDHUP, 0, c);
}


x86 assembly (clang, -O0):
<kore_platform_event_level_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
mov    0x2ea6(%rip),%rax
or     (%rax),%esi
mov    -0x10(%rbp),%rcx
xor    %edx,%edx
call   1030 <kore_platform_event_schedule@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kore_platform_event_level_read>:
mov    %rsi,%rcx
mov    0x2ece(%rip),%rax
mov    0x2eb7(%rip),%rdx
mov    (%rdx),%esi
or     (%rax),%esi
xor    %edx,%edx
jmp    1030 <kore_platform_event_schedule@plt>

LLVM IR (-O0):
@EPOLLIN = global i32 0
@EPOLLRDHUP = global i32 0
define void @kore_platform_event_level_read(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @EPOLLIN
%7 = load i32, i32* @EPOLLRDHUP
%8 = or i32 %6, %7
%9 = load i8*, i8** %4
%10 = call i32 @kore_platform_event_schedule(i32 %5, i32 %8, i32 0, i8* %9)
ret void
}

LLVM IR (-O2):
@EPOLLIN = global i32 0
@EPOLLRDHUP = global i32 0
define void @kore_platform_event_level_read(i32 %0, i8* %1) {
%3 = load i32, i32* @EPOLLIN
%4 = load i32, i32* @EPOLLRDHUP
%5 = or i32 %4, %3
%6 = tail call i32 @kore_platform_event_schedule(i32 %0, i32 %5, i32 0, i8* %1)
ret void
}
/* Variables and functions */
int smack_label_is_valid(char const *);
int smack_subject_is_valid(const char *text) {
  return smack_label_is_valid(text);
}


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

x86 assembly (clang, -O2):
<smack_subject_is_valid>:
jmp    1030 <smack_label_is_valid@plt>

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

LLVM IR (-O2):
define i32 @smack_subject_is_valid(i8* %0) {
%2 = tail call i32 @smack_label_is_valid(i8* %0)
ret i32 %2
}