xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ value;
typedef int uint32_t;

/* Variables and functions */
void value_to_char_array(uint32_t value, char *buffer) {
  for (int i = 0; i < sizeof(value); ++i)
    buffer[i] = (((uint32_t)(value >> (i * 8))) & (0xFF));
}


x86 assembly (clang, -O0):
<value_to_char_array>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x4,%rax
jae    114b <value_to_char_array+0x4b>
mov    -0x4(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1112 <value_to_char_array+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<value_to_char_array>:
mov    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @value_to_char_array(i32 %0, i8* nocapture writeonly %1) {
%3 = trunc i32 %0 to i8
store i8 %3, i8* %1
%4 = lshr i32 %0, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %0, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %0, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
int rand();
char *randStr(char *set[], int size) {
  int i = rand() % size;
  return set[i];
}


x86 assembly (clang, -O0):
<randStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randStr>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
movslq %edx,%rax
mov    (%r14,%rax,8),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @randStr(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%6 = call i32 (...) @rand()
%7 = load i32, i32* %4
%8 = srem i32 %6, %7
store i32 %8, i32* %5
%9 = load i8**, i8*** %3
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %9, i64 %11
%13 = load i8*, i8** %12
ret i8* %13
}

LLVM IR (-O2):
define i8* @randStr(i8** nocapture %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
void _write_remaining_length(char **pptr, char *bytes, int count) {
  memcpy(*pptr, bytes, count);
  *pptr += count;
}


x86 assembly (clang, -O0):
<_write_remaining_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write_remaining_length>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <memcpy@plt>
movslq %ebp,%rax
add    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @_write_remaining_length(i8** %0, i8* %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @memcpy(i8* %8, i8* %9, i32 %10)
%12 = load i32, i32* %6
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
%15 = sext i32 %12 to i64
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8* %16, i8** %13
ret void
}

LLVM IR (-O2):
define void @_write_remaining_length(i8** nocapture %0, i8* %1, i32 %2) {
%4 = load i8*, i8** %0
%5 = tail call i32 @memcpy(i8* %4, i8* %1, i32 %2)
%6 = load i8*, i8** %0
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %6, i64 %7
store i8* %8, i8** %0
ret void
}
char decimalToAscii(int num) {
  char c = (char)num;
  return c;
}


x86 assembly (clang, -O0):
<decimalToAscii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @decimalToAscii(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = trunc i32 %4 to i8
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @decimalToAscii(i32 %0) {
%2 = trunc i32 %0 to i8
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ set_free(int);
void put_left_fork(int mine) {
  int item = (mine);
  set_free(item);
}


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

x86 assembly (clang, -O2):
<put_left_fork>:
jmp    1030 <set_free@plt>

LLVM IR (-O0):
define void @put_left_fork(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @set_free(i32 %5)
ret void
}

LLVM IR (-O2):
define void @put_left_fork(i32 %0) {
%2 = tail call i32 @set_free(i32 %0)
ret void
}
void putshort(struct _IO_FILE$link42 *outf, unsigned short int val) {
  unsigned char buf[2l];
  buf[(signed long int)0] = (unsigned char)((signed int)val >> 8);
  buf[(signed long int)1] = (unsigned char)((signed int)val & 255);
  fwrite((const void *)buf, (unsigned long int)2, (unsigned long int)1, outf);
}


x86 assembly (clang, -O0):
<putshort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0xc(%rbp)
movzwl -0xa(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xb(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putshort>:
push   %rax
mov    %rdi,%rcx
rol    $0x8,%si
mov    %si,0x6(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <fwrite@plt>
pop    %rax
ret

LLVM IR (-O0):
%"struct._IO_FILE$link42" = type opaque
define void @putshort(%"struct._IO_FILE$link42"* %0, i16 zeroext %1) {
%3 = alloca %"struct._IO_FILE$link42"*
%4 = alloca i16
%5 = alloca [2 x i8]
store %"struct._IO_FILE$link42"* %0, %"struct._IO_FILE$link42"** %3
store i16 %1, i16* %4
%6 = load i16, i16* %4
%7 = zext i16 %6 to i32
%8 = ashr i32 %7, 8
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 %14, i8* %15
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%17 = load %"struct._IO_FILE$link42"*, %"struct._IO_FILE$link42"** %3
%18 = call i32 (i8*, i64, i64, %"struct._IO_FILE$link42"*, ...) bitcast (i32 (...)* @fwrite to i32 (i8*, i64, i64, %"struct._IO_FILE$link42"*, ...)*)(i8* %16, i64 2, i64 1, %"struct._IO_FILE$link42"* %17)
ret void
}

LLVM IR (-O2):
%"struct._IO_FILE$link42" = type opaque
define void @putshort(%"struct._IO_FILE$link42"* %0, i16 zeroext %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = lshr i16 %1, 8
%6 = trunc i16 %5 to i8
store i8 %6, i8* %4
%7 = trunc i16 %1 to i8
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 %7, i8* %8
%9 = call i32 (i8*, i64, i64, %"struct._IO_FILE$link42"*, ...) bitcast (i32 (...)* @fwrite to i32 (i8*, i64, i64, %"struct._IO_FILE$link42"*, ...)*)(i8* %4, i64 2, i64 1, %"struct._IO_FILE$link42"* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _IO(int, int);
int ioctl(int, int /*<<< orphan*/);
int CED_GetOutBufSpace(int fh) { return ioctl(fh, _IO(0xce, 14)); }


x86 assembly (clang, -O0):
<CED_GetOutBufSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0xce,%edi
mov    $0xe,%esi
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CED_GetOutBufSpace>:
push   %rbx
mov    %edi,%ebx
mov    $0xce,%edi
mov    $0xe,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @CED_GetOutBufSpace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_IO(i32 206, i32 14)
%5 = call i32 @ioctl(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @CED_GetOutBufSpace(i32 %0) {
%2 = tail call i32 @_IO(i32 206, i32 14)
%3 = tail call i32 @ioctl(i32 %0, i32 %2)
ret i32 %3
}
unsigned int inl(unsigned short int port) {
  unsigned int value;
  __asm__ __volatile__("inl %w1,%0" : "=a"(value) : "Nd"(port));
  return value;
}


x86 assembly (clang, -O0):
<inl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl>:
mov    %edi,%edx
in     (%dx),%eax
ret

LLVM IR (-O0):
define i32 @inl(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @inl(i16 zeroext %0) {
%2 = tail call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i32 %2
}
void resource_removed(struct _diva_segment_alloc *pI) {}


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

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

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

LLVM IR (-O2):
%struct._diva_segment_alloc = type opaque
define void @resource_removed(%struct._diva_segment_alloc* nocapture %0) {
ret void
}
/* Variables and functions */
int bar();
int foo(void) { return 42 + bar(); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x2a,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
add    $0x2a,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo() {
%1 = call i32 (...) @bar()
%2 = add nsw i32 42, %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 (...) @bar()
%2 = add nsw i32 %1, 42
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ lmrgno_(double *, double *, int *);
void clmrgno(double *para, double *xmom, int nmom) {
  lmrgno_(para, xmom, &nmom);
}


x86 assembly (clang, -O0):
<clmrgno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <lmrgno_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clmrgno>:
push   %rax
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rdx
call   1030 <lmrgno_@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @clmrgno(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load double*, double** %5
%9 = call i32 @lmrgno_(double* %7, double* %8, i32* %6)
ret void
}

LLVM IR (-O2):
define void @clmrgno(double* %0, double* %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = call i32 @lmrgno_(double* %0, double* %1, i32* %4)
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
double tsc_delta(const uint64_t *now, const uint64_t *then,
                 const double *tsc_rate) {
  return (*now >= *then ? (*now - *then) : (*then - *now)) / *tsc_rate;
}


x86 assembly (clang, -O0):
<tsc_delta>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jl     113b <tsc_delta+0x3b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%rax
mov    %rax,-0x20(%rbp)
jmp    114d <tsc_delta+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    -0x18(%rbp),%rax
divsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsc_delta>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    %rax,%rsi
sub    %rcx,%rsi
neg    %rsi
sub    %rcx,%rax
cmovl  %rsi,%rax
cvtsi2sd %rax,%xmm0
divsd  (%rdx),%xmm0
ret

LLVM IR (-O0):
define double @tsc_delta(i64* %0, i64* %1, double* %2) {
%4 = alloca i64*
%5 = alloca i64*
%6 = alloca double*
store i64* %0, i64** %4
store i64* %1, i64** %5
store double* %2, double** %6
%7 = load i64*, i64** %4
%8 = load i64, i64* %7
%9 = load i64*, i64** %5
%10 = load i64, i64* %9
%11 = icmp sge i64 %8, %10
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = load i64*, i64** %4
%14 = load i64, i64* %13
%15 = load i64*, i64** %5
%16 = load i64, i64* %15
%17 = sub nsw i64 %14, %16
br label %24
18: ; preds = %3
%19 = load i64*, i64** %5
%20 = load i64, i64* %19
%21 = load i64*, i64** %4
%22 = load i64, i64* %21
%23 = sub nsw i64 %20, %22
br label %24
24: ; preds = %18, %12
%25 = phi i64 [ %17, %12 ], [ %23, %18 ]
%26 = sitofp i64 %25 to double
%27 = load double*, double** %6
%28 = load double, double* %27
%29 = fdiv double %26, %28
ret double %29
}

LLVM IR (-O2):
define double @tsc_delta(i64* nocapture %0, i64* nocapture %1, double* nocapture %2) {
%4 = load i64, i64* %0
%5 = load i64, i64* %1
%6 = icmp slt i64 %4, %5
%7 = sub nsw i64 %4, %5
%8 = sub nsw i64 %5, %4
%9 = select i1 %6, i64 %8, i64 %7
%10 = sitofp i64 %9 to double
%11 = load double, double* %2
%12 = fdiv double %10, %11
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
void cmd_exit(char *argv[]) {
  (void)argv;
  _exit(0);
}


x86 assembly (clang, -O0):
<cmd_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<cmd_exit>:
push   %rax
xor    %edi,%edi
call   1030 <_exit@plt>

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

LLVM IR (-O2):
define void @cmd_exit(i8** nocapture readnone %0) {
%2 = tail call i32 @_exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void callback3(void) { printf("callback3 called\n"); }


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

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

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

LLVM IR (-O2):
@str = [17 x i8] c"callback3 called\00"
define void @callback3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
long tge_get_whole_seconds(const double seconds) { return ((long)seconds); }


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

x86 assembly (clang, -O2):
<tge_get_whole_seconds>:
cvttsd2si %xmm0,%rax
ret

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

LLVM IR (-O2):
define i64 @tge_get_whole_seconds(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
int isgraph(int c) { return (c > ' ' && c <= '~'); }


x86 assembly (clang, -O0):
<isgraph>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1120 <isgraph+0x20>
cmpl   $0x7e,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isgraph>:
add    $0xffffffdf,%edi
xor    %eax,%eax
cmp    $0x5e,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isgraph(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 126
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isgraph(i32 %0) {
%2 = add i32 %0, -33
%3 = icmp ult i32 %2, 94
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *);
int assert_partitioned(const unsigned char *mbr) {
  if (mbr[0x1fe] != 0x55 && mbr[0x1ff] != 0xaa) {
    printk("ERROR: card not partitioned, no MBR\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<assert_partitioned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x1fe(%rax),%eax
cmp    $0x55,%eax
je     115e <assert_partitioned+0x4e>
mov    -0x10(%rbp),%rax
movzbl 0x1ff(%rax),%eax
cmp    $0xaa,%eax
je     115e <assert_partitioned+0x4e>
lea    0xeb3(%rip),%rdi
call   1030 <printk@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1165 <assert_partitioned+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_partitioned>:
push   %rax
xor    %eax,%eax
cmpb   $0x55,0x1fe(%rdi)
je     1136 <assert_partitioned+0x26>
cmpb   $0xaa,0x1ff(%rdi)
je     1136 <assert_partitioned+0x26>
lea    0xed4(%rip),%rdi
call   1030 <printk@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"ERROR: card not partitioned, no MBR\0A\00"
define i32 @assert_partitioned(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 510
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = icmp ne i32 %7, 85
br i1 %8, label %9, label %17
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 511
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp ne i32 %13, 170
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 @printk(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %18
17: ; preds = %9, %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %15
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [37 x i8] c"ERROR: card not partitioned, no MBR\0A\00"
define i32 @assert_partitioned(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 510
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 85
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 511
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, -86
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @printk(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %1, %5, %9
%12 = phi i32 [ -1, %9 ], [ 0, %5 ], [ 0, %1 ]
ret i32 %12
}
/* Variables and functions */
int isascii(int);
int is_http_char(int c) { return isascii(c); }


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

x86 assembly (clang, -O2):
<is_http_char>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_http_char(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ xcb_get_property_reply_t;
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ xcb_ewmh_get_cardinal_from_reply(int /*<<< orphan*/ *,
                                                    int /*<<< orphan*/ *);
uint8_t
xcb_ewmh_get_wm_user_time_window_from_reply(uint32_t *xtime,
                                            xcb_get_property_reply_t *r) {
  return xcb_ewmh_get_cardinal_from_reply(xtime, r);
}


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

x86 assembly (clang, -O2):
<xcb_ewmh_get_wm_user_time_window_from_reply>:
jmp    1030 <xcb_ewmh_get_cardinal_from_reply@plt>

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

LLVM IR (-O2):
define i32 @xcb_ewmh_get_wm_user_time_window_from_reply(i32* %0, i32* %1) {
%3 = tail call i32 @xcb_ewmh_get_cardinal_from_reply(i32* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ send_command_to_variable_server(int, char *);
int poll(int socket) {
  if (send_command_to_variable_server(socket, "trick.var_send()") < 0) {
    return -1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<poll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <send_command_to_variable_server@plt>
cmp    $0x0,%rax
jge    1140 <poll+0x30>
movl   $0xffffffff,-0x4(%rbp)
jmp    1147 <poll+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poll>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <send_command_to_variable_server@plt>
sar    $0x3f,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"trick.var_send()\00"
define i32 @poll(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @send_command_to_variable_server(i32 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [17 x i8] c"trick.var_send()\00"
define i32 @poll(i32 %0) {
%2 = tail call i64 @send_command_to_variable_server(i32 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = ashr i64 %2, 63
%4 = trunc i64 %3 to i32
ret i32 %4
}
int align(int x, int n) { return (((x >> n) + 1) << n); }


x86 assembly (clang, -O0):
<align>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
add    $0x1,%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align>:
mov    %esi,%ecx
sar    %cl,%edi
lea    0x1(%rdi),%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @align(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 = ashr i32 %5, %6
%8 = add nsw i32 %7, 1
%9 = load i32, i32* %4
%10 = shl i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @align(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = add nsw i32 %3, 1
%5 = shl i32 %4, %1
ret i32 %5
}
/* Variables and functions */
char *tounixfilename_base(char *);
char *au_check_filename(char *name) { return tounixfilename_base(name); }


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

x86 assembly (clang, -O2):
<au_check_filename>:
jmp    1030 <tounixfilename_base@plt>

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

LLVM IR (-O2):
define i8* @au_check_filename(i8* %0) {
%2 = tail call i8* @tounixfilename_base(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_usage(void) {
  printf("mii_mgr -g -p [phy number] -r [register number]\n");
  printf("  Get: mii_mgr -g -p 3 -r 4\n\n");
  printf("mii_mgr -s -p [phy number] -r [register number] -v [0xvalue]\n");
  printf("  Set: mii_mgr -s -p 4 -r 1 -v 0xff11\n\n");
}


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

x86 assembly (clang, -O2):
<show_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4e(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"mii_mgr -g -p [phy number] -r [register number]\0A\00"
@.str.1 = [30 x i8] c" Get: mii_mgr -g -p 3 -r 4\0A\0A\00"
@.str.2 = [62 x i8] c"mii_mgr -s -p [phy number] -r [register number] -v [0xvalue]\0A\00"
@.str.3 = [40 x i8] c" Set: mii_mgr -s -p 4 -r 1 -v 0xff11\0A\0A\00"
define void @show_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [48 x i8] c"mii_mgr -g -p [phy number] -r [register number]\00"
@str.4 = [29 x i8] c" Get: mii_mgr -g -p 3 -r 4\0A\00"
@str.5 = [61 x i8] c"mii_mgr -s -p [phy number] -r [register number] -v [0xvalue]\00"
@str.6 = [39 x i8] c" Set: mii_mgr -s -p 4 -r 1 -v 0xff11\0A\00"
define void @show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ios_init(int);
int /*<<< orphan*/ set_port_name(char *);
void comm_init(char *name, int baud) {
  set_port_name(name);
  ios_init(baud);
}


x86 assembly (clang, -O0):
<comm_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <set_port_name@plt>
mov    -0xc(%rbp),%edi
call   1040 <ios_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @comm_init(i8* %0, i32 %1) {
%3 = tail call i32 @set_port_name(i8* %0)
%4 = tail call i32 @ios_init(i32 %1)
ret void
}
/* Type definitions */
typedef char int32_t;

/* Variables and functions */
scalar_t__ isupper(char const);
int32_t tolower(const int32_t c) { return isupper(c) ? 'a' + (c - 'A') : c; }


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
je     1143 <tolower+0x33>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <tolower+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <isupper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @tolower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isupper(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %8, 65
%10 = add nsw i32 97, %9
br label %14
11: ; preds = %1
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
br label %14
14: ; preds = %11, %6
%15 = phi i32 [ %10, %6 ], [ %13, %11 ]
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @tolower(i8 signext %0) {
%2 = tail call i64 @isupper(i8 signext %0)
%3 = icmp eq i64 %2, 0
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}
/* Variables and functions */
float fabsf(float);
float dloglaplace_scale(float x, float loc, float sc, float logsc) {
  return (fabsf(x - loc) / sc - 1.0) / sc;
}


x86 assembly (clang, -O0):
<dloglaplace_scale>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movaps 0xee7(%rip),%xmm1
pand   %xmm1,%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec2(%rip),%xmm1
subsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dloglaplace_scale>:
subss  %xmm1,%xmm0
andps  0xef5(%rip),%xmm0
divss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xef5(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @dloglaplace_scale(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %6
%11 = fsub float %9, %10
%12 = call float @llvm.fabs.f32(float %11)
%13 = load float, float* %7
%14 = fdiv float %12, %13
%15 = fpext float %14 to double
%16 = fsub double %15, 1.000000e+00
%17 = load float, float* %7
%18 = fpext float %17 to double
%19 = fdiv double %16, %18
%20 = fptrunc double %19 to float
ret float %20
}

LLVM IR (-O2):
define float @dloglaplace_scale(float %0, float %1, float %2, float %3) {
%5 = fsub float %0, %1
%6 = tail call float @llvm.fabs.f32(float %5)
%7 = fdiv float %6, %2
%8 = fpext float %7 to double
%9 = fadd double %8, -1.000000e+00
%10 = fpext float %2 to double
%11 = fdiv double %9, %10
%12 = fptrunc double %11 to float
ret float %12
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ createThread(void *(*)(void *), void *);
int /*<<< orphan*/ log_error(int, char *);
int pthread_detach(int /*<<< orphan*/);
pthread_t createDetachedThread(void *(*start_routine)(void *), void *arg) {
  int retval;
  pthread_t thread = createThread(start_routine, arg);
  retval = pthread_detach(thread);
  if (retval != 0) {
    log_error(retval, "Error pthread_detach()");
    abort();
  }
  return thread;
}


x86 assembly (clang, -O0):
<createDetachedThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <createThread@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1060 <pthread_detach@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     118b <createDetachedThread+0x4b>
mov    -0x14(%rbp),%edi
lea    0xe81(%rip),%rsi
call   1040 <log_error@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createDetachedThread>:
push   %rbx
call   1050 <createThread@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <pthread_detach@plt>
test   %eax,%eax
jne    1157 <createDetachedThread+0x17>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xea2(%rip),%rsi
mov    %eax,%edi
call   1040 <log_error@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Error pthread_detach()\00"
define i32 @createDetachedThread(i8* (i8*)* %0, i8* %1) {
%3 = alloca i8* (i8*)*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* (i8*)* %0, i8* (i8*)** %3
store i8* %1, i8** %4
%7 = load i8* (i8*)*, i8* (i8*)** %3
%8 = load i8*, i8** %4
%9 = call i32 @createThread(i8* (i8*)* %7, i8* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = call i32 @pthread_detach(i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* %5
%16 = call i32 @log_error(i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %2
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
@.str = [23 x i8] c"Error pthread_detach()\00"
define i32 @createDetachedThread(i8* (i8*)* %0, i8* %1) {
%3 = tail call i32 @createThread(i8* (i8*)* %0, i8* %1)
%4 = tail call i32 @pthread_detach(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @log_error(i32 %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
ret i32 %3
}
int test_imm_75int8_reg(signed char val) {
  return ((val) & (-0x75 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_75int8_reg(i8 signext %0) {
%2 = and i8 %0, -117
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int RECOIL_GetB5G5R5Color(int c) {
  c = (c & 31) << 19 | (c & 992) << 6 | (c >> 7 & 248);
  return c | (c >> 5 & 460551);
}


x86 assembly (clang, -O0):
<RECOIL_GetB5G5R5Color>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1f,%eax
shl    $0x13,%eax
mov    -0x4(%rbp),%ecx
and    $0x3e0,%ecx
shl    $0x6,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x7,%ecx
and    $0xf8,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x5,%ecx
and    $0x70707,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RECOIL_GetB5G5R5Color>:
mov    %edi,%eax
and    $0x1f,%eax
shl    $0x13,%eax
mov    %edi,%ecx
shl    $0x6,%ecx
and    $0xf800,%ecx
or     %eax,%ecx
shr    $0x7,%edi
and    $0xf8,%edi
or     %edi,%ecx
mov    %ecx,%eax
shr    $0x5,%eax
and    $0x70707,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @RECOIL_GetB5G5R5Color(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 31
%5 = shl i32 %4, 19
%6 = load i32, i32* %2
%7 = and i32 %6, 992
%8 = shl i32 %7, 6
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = ashr i32 %10, 7
%12 = and i32 %11, 248
%13 = or i32 %9, %12
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = ashr i32 %15, 5
%17 = and i32 %16, 460551
%18 = or i32 %14, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @RECOIL_GetB5G5R5Color(i32 %0) {
%2 = shl i32 %0, 19
%3 = and i32 %2, 16252928
%4 = shl i32 %0, 6
%5 = and i32 %4, 63488
%6 = or i32 %3, %5
%7 = lshr i32 %0, 7
%8 = and i32 %7, 248
%9 = or i32 %6, %8
%10 = lshr i32 %9, 5
%11 = and i32 %10, 460551
%12 = or i32 %11, %9
ret i32 %12
}
void pmsav8_setup(void) {}


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

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

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

LLVM IR (-O2):
define void @pmsav8_setup() {
ret void
}
int adis16130_probe_trigger(struct iio_dev *indio_dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.iio_dev = type opaque
define i32 @adis16130_probe_trigger(%struct.iio_dev* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
size_t base64len(size_t n) { return (n + 2) / 3 * 4; }


x86 assembly (clang, -O0):
<base64len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
shl    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64len>:
lea    0x2(%rdi),%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
lea    (%rdx,%rdx,1),%rax
and    $0xfffffffffffffffc,%rax
ret

LLVM IR (-O0):
define i64 @base64len(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 2
%5 = udiv i64 %4, 3
%6 = mul i64 %5, 4
ret i64 %6
}

LLVM IR (-O2):
define i64 @base64len(i64 %0) {
%2 = add i64 %0, 2
%3 = udiv i64 %2, 3
%4 = shl i64 %3, 2
ret i64 %4
}
int cmp(const void *p, const void *q) {
  return *(const int *)p - *(const int *)q;
}


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

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

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ test_char();
int /*<<< orphan*/ test_double();
int /*<<< orphan*/ test_float();
int /*<<< orphan*/ test_int();
int /*<<< orphan*/ test_long();
int /*<<< orphan*/ test_short();
int /*<<< orphan*/ test_uchar();
int /*<<< orphan*/ test_uint();
int /*<<< orphan*/ test_ulong();
int /*<<< orphan*/ test_ushort();
int main() {
  test_char();
  test_uchar();
  test_short();
  test_ushort();
  test_int();
  test_uint();
  test_long();
  test_ulong();
  test_float();
  test_double();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <test_char@plt>
mov    $0x0,%al
call   1030 <test_uchar@plt>
mov    $0x0,%al
call   10a0 <test_short@plt>
mov    $0x0,%al
call   1060 <test_ushort@plt>
mov    $0x0,%al
call   1090 <test_int@plt>
mov    $0x0,%al
call   10c0 <test_uint@plt>
mov    $0x0,%al
call   1050 <test_long@plt>
mov    $0x0,%al
call   10b0 <test_ulong@plt>
mov    $0x0,%al
call   1040 <test_float@plt>
mov    $0x0,%al
call   1070 <test_double@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <test_char@plt>
xor    %eax,%eax
call   1030 <test_uchar@plt>
xor    %eax,%eax
call   10a0 <test_short@plt>
xor    %eax,%eax
call   1060 <test_ushort@plt>
xor    %eax,%eax
call   1090 <test_int@plt>
xor    %eax,%eax
call   10c0 <test_uint@plt>
xor    %eax,%eax
call   1050 <test_long@plt>
xor    %eax,%eax
call   10b0 <test_ulong@plt>
xor    %eax,%eax
call   1040 <test_float@plt>
xor    %eax,%eax
call   1070 <test_double@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_char()
%3 = call i32 (...) @test_uchar()
%4 = call i32 (...) @test_short()
%5 = call i32 (...) @test_ushort()
%6 = call i32 (...) @test_int()
%7 = call i32 (...) @test_uint()
%8 = call i32 (...) @test_long()
%9 = call i32 (...) @test_ulong()
%10 = call i32 (...) @test_float()
%11 = call i32 (...) @test_double()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_char()
%2 = tail call i32 (...) @test_uchar()
%3 = tail call i32 (...) @test_short()
%4 = tail call i32 (...) @test_ushort()
%5 = tail call i32 (...) @test_int()
%6 = tail call i32 (...) @test_uint()
%7 = tail call i32 (...) @test_long()
%8 = tail call i32 (...) @test_ulong()
%9 = tail call i32 (...) @test_float()
%10 = tail call i32 (...) @test_double()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  a += 5;
  b *= 2;
  printf("가로 = %d\n세로 = %d\n넓이 = %d\n", a, b, a * b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
add    $0x5,%esi
mov    %esi,0x4(%rsp)
mov    (%rsp),%edx
add    %edx,%edx
mov    %edx,(%rsp)
mov    %edx,%ecx
imul   %esi,%ecx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [37 x i8] c"\EA\B0\80\EB\A1\9C = %d\0A\EC\84\B8\EB\A1\9C = %d\0A\EB\84\93\EC\9D\B4 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 5
store i32 %6, i32* %2
%7 = load i32, i32* %3
%8 = mul nsw i32 %7, 2
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [37 x i8] c"\EA\B0\80\EB\A1\9C = %d\0A\EC\84\B8\EB\A1\9C = %d\0A\EB\84\93\EC\9D\B4 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 5
store i32 %7, i32* %1
%8 = load i32, i32* %2
%9 = shl nsw i32 %8, 1
store i32 %9, i32* %2
%10 = mul nsw i32 %9, %7
%11 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %9, i32 %10)
ret i32 0
}
func1(int *f) {}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @func1(i32* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
bool is_status_valid(const char status) {
  if ('A' == status)
    return true;
  return false;
}


x86 assembly (clang, -O0):
<is_status_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jne    1127 <is_status_valid+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <is_status_valid+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_status_valid>:
xor    %eax,%eax
cmp    $0x41,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_status_valid(i8 signext %0) {
%2 = icmp eq i8 %0, 65
%3 = zext i1 %2 to i32
ret i32 %3
}
char *simplePing(char *i_var) {
  static int result = 0;
  result = *i_var;
  return (char *)&result;
}


x86 assembly (clang, -O0):
<simplePing>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,0x2f0f(%rip)
lea    0x2f08(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<simplePing>:
movsbl (%rdi),%eax
mov    %eax,0x2f1b(%rip)
lea    0x2f14(%rip),%rax
ret

LLVM IR (-O0):
@simplePing.result = internal global i32 0
define i8* @simplePing(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
store i32 %5, i32* @simplePing.result
ret i8* bitcast (i32* @simplePing.result to i8*)
}

LLVM IR (-O2):
@simplePing.result = internal global i32 0
define i8* @simplePing(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
store i32 %3, i32* @simplePing.result
ret i8* bitcast (i32* @simplePing.result to i8*)
}
void av_samples_alloc() {}


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

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

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

LLVM IR (-O2):
define void @av_samples_alloc() {
ret void
}