xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ TxTimedString(char *, char);
int /*<<< orphan*/ sprintf(char *, char *, long);
void TxTimedLong(long l, char txDelay) {
  char str[20];
  sprintf(str, "%ld", l);
  TxTimedString(str, txDelay);
}


x86 assembly (clang, -O0):
<TxTimedLong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x20(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <TxTimedString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TxTimedLong>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %rdi,%rdx
lea    0xecd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <TxTimedString@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
define void @TxTimedLong(i64 %0, i8 signext %1) {
%3 = alloca i64
%4 = alloca i8
%5 = alloca [20 x i8]
store i64 %0, i64* %3
store i8 %1, i8* %4
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%7 = load i64, i64* %3
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%10 = load i8, i8* %4
%11 = call i32 @TxTimedString(i8* %9, i8 signext %10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define void @TxTimedLong(i64 %0, i8 signext %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
%6 = call i32 @TxTimedString(i8* %4, i8 signext %1)
ret void
}
/* Type definitions */
struct katcp_dispatch {
  int dummy;
};

/* Variables and functions */
struct katcp_dispatch *setup_katcp(int);
struct katcp_dispatch *startup_katcp() {
  return setup_katcp(-1);
}


x86 assembly (clang, -O0):
<startup_katcp>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
call   1030 <setup_katcp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<startup_katcp>:
mov    $0xffffffff,%edi
jmp    1030 <setup_katcp@plt>

LLVM IR (-O0):
%struct.katcp_dispatch = type { i32 }
define %struct.katcp_dispatch* @startup_katcp() {
%1 = call %struct.katcp_dispatch* @setup_katcp(i32 -1)
ret %struct.katcp_dispatch* %1
}

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
define %struct.katcp_dispatch* @startup_katcp() {
%1 = tail call %struct.katcp_dispatch* @setup_katcp(i32 -1)
ret %struct.katcp_dispatch* %1
}
int _ptr_cmp(const void *left, const void *right) {
  return (int)(left - right);
}


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

x86 assembly (clang, -O2):
<_ptr_cmp>:
mov    %rdi,%rax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @_ptr_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 = load i8*, i8** %4
%7 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @_ptr_cmp(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
void main() {
  int b;
  int a;
  b = 3;
  a = 12;
  a = (b + 2) - (a * 3) / 6;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
imul   $0x3,-0x8(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 3, i32* %1
store i32 12, i32* %2
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 2
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 3
%7 = sdiv i32 %6, 6
%8 = sub nsw i32 %4, %7
store i32 %8, i32* %2
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
scalar_t__ empurra_maior(int *, int);
void bubble_r(int *v, int n) {
  if (n <= 1)
    return;
  if (empurra_maior(v, n))
    bubble_r(v, n - 1);
}


x86 assembly (clang, -O0):
<bubble_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     113e <bubble_r+0x1e>
jmp    1163 <bubble_r+0x43>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <empurra_maior@plt>
cmp    $0x0,%rax
je     1163 <bubble_r+0x43>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1040 <bubble_r@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bubble_r>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%esi
jl     1139 <bubble_r+0x29>
mov    %esi,%ebx
mov    %rdi,%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <empurra_maior@plt>
test   %rax,%rax
je     1139 <bubble_r+0x29>
lea    -0x1(%rbx),%eax
cmp    $0x2,%ebx
mov    %eax,%ebx
jg     1120 <bubble_r+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @bubble_r(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %1, %2 ]
%6 = tail call i64 @empurra_maior(i32* %0, i32 %5)
%7 = icmp eq i64 %6, 0
%8 = add nsw i32 %5, -1
%9 = icmp slt i32 %5, 3
%10 = or i1 %7, %9
br i1 %10, label %11, label %4
11: ; preds = %4, %2
ret void
}
/* Variables and functions */
char *strrchr(char *, char);
char *base(char *s) {
  char *p;
  p = strrchr(s, '\\');
  if (p)
    return p + 1;
  return s;
}


x86 assembly (clang, -O0):
<base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <base+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <base+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base>:
push   %rbx
mov    %rdi,%rbx
mov    $0x5c,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @base(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 92)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %11, i8** %2
br label %14
12: ; preds = %1
%13 = load i8*, i8** %3
store i8* %13, i8** %2
br label %14
14: ; preds = %12, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
define i8* @base(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 92)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ SYS_tkill;
scalar_t__ _real_syscall(int /*<<< orphan*/, int, int);
__attribute__((visibility("hidden"))) int _real_tkill(int tid, int sig) {
  return (int)_real_syscall(SYS_tkill, tid, sig);
}


x86 assembly (clang, -O0):
<_real_tkill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <_real_syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_real_tkill>:
mov    %esi,%edx
mov    %edi,%esi
mov    0x2edd(%rip),%rax
mov    (%rax),%edi
jmp    1030 <_real_syscall@plt>

LLVM IR (-O0):
@SYS_tkill = global i32 0
define hidden i32 @_real_tkill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @SYS_tkill
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i64 @_real_syscall(i32 %5, i32 %6, i32 %7)
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@SYS_tkill = global i32 0
define hidden i32 @_real_tkill(i32 %0, i32 %1) {
%3 = load i32, i32* @SYS_tkill
%4 = tail call i64 @_real_syscall(i32 %3, i32 %0, i32 %1)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int func1_in_obj();
int func2_in_obj();
int func3_in_obj();
int main(int argc, char **argv) {
  return func1_in_obj() + func2_in_obj() + func3_in_obj();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <func1_in_obj@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <func2_in_obj@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <func3_in_obj@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <func1_in_obj@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <func2_in_obj@plt>
mov    %eax,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <func3_in_obj@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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 (...) @func1_in_obj()
%7 = call i32 (...) @func2_in_obj()
%8 = add nsw i32 %6, %7
%9 = call i32 (...) @func3_in_obj()
%10 = add nsw i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func1_in_obj()
%4 = tail call i32 (...) @func2_in_obj()
%5 = add nsw i32 %4, %3
%6 = tail call i32 (...) @func3_in_obj()
%7 = add nsw i32 %5, %6
ret i32 %7
}
void TIM8_UP_TIM13_IRQHandler() {}


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

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

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

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

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ *SEM_FAILED;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ *sem_open(char *, int, int, unsigned int);
int main() {
  int flags, opt;
  unsigned int value = 1;
  sem_t *sem;
  sem = sem_open("/mysem", O_CREAT | O_RDWR, 666, value);
  if (sem == SEM_FAILED)
    perror("sem_open");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
mov    0x2e9a(%rip),%rax
or     (%rax),%esi
mov    -0x10(%rbp),%ecx
lea    0xeae(%rip),%rdi
mov    $0x29a,%edx
call   1030 <sem_open@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2e6d(%rip),%rcx
cmp    (%rcx),%rax
jne    1180 <main+0x60>
lea    0xe8c(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xec6(%rip),%rdi
mov    $0x29a,%edx
mov    $0x1,%ecx
call   1030 <sem_open@plt>
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
je     1159 <main+0x39>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea7(%rip),%rdi
call   1040 <perror@plt>
jmp    1155 <main+0x35>

LLVM IR (-O0):
@.str = [7 x i8] c"/mysem\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@SEM_FAILED = global i32* null
@.str.1 = [9 x i8] c"sem_open\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 0, i32* %1
store i32 1, i32* %4
%6 = load i32, i32* @O_CREAT
%7 = load i32, i32* @O_RDWR
%8 = or i32 %6, %7
%9 = load i32, i32* %4
%10 = call i32* @sem_open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %8, i32 666, i32 %9)
store i32* %10, i32** %5
%11 = load i32*, i32** %5
%12 = load i32*, i32** @SEM_FAILED
%13 = icmp eq i32* %11, %12
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"/mysem\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@SEM_FAILED = global i32* null
@.str.1 = [9 x i8] c"sem_open\00"
define i32 @main() {
%1 = load i32, i32* @O_CREAT
%2 = load i32, i32* @O_RDWR
%3 = or i32 %2, %1
%4 = tail call i32* @sem_open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32 666, i32 1)
%5 = load i32*, i32** @SEM_FAILED
%6 = icmp eq i32* %4, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
ret i32 0
}
XFreeGC() {}


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

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

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

LLVM IR (-O2):
define i32 @XFreeGC() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int putint(int x) {
  printf("%d", x);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @putint(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
void output_b(int foo) {}


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

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

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

LLVM IR (-O2):
define void @output_b(i32 %0) {
ret void
}
__attribute__((weak)) void tearDown(void) {}


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

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

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

LLVM IR (-O2):
define weak void @tearDown() {
ret void
}
/* Variables and functions */
char *SMake_Version();
int /*<<< orphan*/ printf(char *, ...);
void SMake_Greet(const char *pName) {
  printf("================================================\n");
  printf("%s Version: %s\n", pName, SMake_Version());
  printf("================================================\n");
}


x86 assembly (clang, -O0):
<SMake_Greet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <SMake_Version@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SMake_Greet>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <SMake_Version@plt>
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str.1 = [16 x i8] c"%s Version: %s\0A\00"
@str.2 = [49 x i8] c"================================================\00"
define void @SMake_Greet(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i8* (...) @SMake_Version()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("This is text.\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"This is text.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int TestError(LinkId)
int LinkId;
{}


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

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

LLVM IR (-O0):
define i32 @TestError(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 @TestError(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_usage(char *progName) {
  printf("Usage: %s inputBitmap.bmp outputBinary.rgb <outputHeader.h>\n",
         progName);
}


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

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"Usage: %s inputBitmap.bmp outputBinary.rgb <outputHeader.h>\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"Usage: %s inputBitmap.bmp outputBinary.rgb <outputHeader.h>\0A\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void clear(void) {
  printf("\033[2J");
  printf("\033[%d;%dH", 0, 0);
}


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
xor    %edx,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [9 x i8] c"\1B[%d;%dH\00"
define void @clear() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [9 x i8] c"\1B[%d;%dH\00"
define void @clear() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
ret void
}
/* Type definitions */
struct ui_cmd_command {
  int dummy;
};

/* Variables and functions */
struct ui_cmd_command *ui_cmd_find_command(char *);
int /*<<< orphan*/ ui_cmd_gettok_str(char *, char **, char **);
struct ui_cmd_command *ui_cmd_gettok_cmd(char *input, char **token,
                                         char **remainder) {
  ui_cmd_gettok_str(input, token, remainder);
  return ui_cmd_find_command(*token);
}


x86 assembly (clang, -O0):
<ui_cmd_gettok_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <ui_cmd_gettok_str@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <ui_cmd_find_command@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_cmd_gettok_cmd>:
push   %rbx
mov    %rsi,%rbx
call   1040 <ui_cmd_gettok_str@plt>
mov    (%rbx),%rdi
pop    %rbx
jmp    1030 <ui_cmd_find_command@plt>

LLVM IR (-O0):
%struct.ui_cmd_command = type { i32 }
define %struct.ui_cmd_command* @ui_cmd_gettok_cmd(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i8**, i8*** %6
%10 = call i32 @ui_cmd_gettok_str(i8* %7, i8** %8, i8** %9)
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = call %struct.ui_cmd_command* @ui_cmd_find_command(i8* %12)
ret %struct.ui_cmd_command* %13
}

LLVM IR (-O2):
%struct.ui_cmd_command = type { i32 }
define %struct.ui_cmd_command* @ui_cmd_gettok_cmd(i8* %0, i8** %1, i8** %2) {
%4 = tail call i32 @ui_cmd_gettok_str(i8* %0, i8** %1, i8** %2)
%5 = load i8*, i8** %1
%6 = tail call %struct.ui_cmd_command* @ui_cmd_find_command(i8* %5)
ret %struct.ui_cmd_command* %6
}
void X509at_add1_attr(void) {}


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

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

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

LLVM IR (-O2):
define void @X509at_add1_attr() {
ret void
}
void __vsyslog(int pri, const char *fmt, int ap) {}


x86 assembly (clang, -O0):
<__vsyslog>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @__vsyslog(i32 %0, i8* nocapture %1, i32 %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ err(char *);
int fread(void *, int, int, int /*<<< orphan*/ *);
void myread(void *p, int length, FILE *f) {
  int l = fread(p, 1, length, f);
  if (l != length)
    err("Error reading input file.\n");
  return;
}


x86 assembly (clang, -O0):
<myread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1163 <myread+0x43>
lea    0xea2(%rip),%rdi
call   1040 <err@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myread>:
push   %rbx
mov    %rdx,%rcx
mov    %esi,%ebx
mov    $0x1,%esi
mov    %ebx,%edx
call   1030 <fread@plt>
cmp    %ebx,%eax
jne    1138 <myread+0x18>
pop    %rbx
ret
lea    0xec1(%rip),%rdi
pop    %rbx
jmp    1040 <err@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Error reading input file.\0A\00"
define void @myread(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32*, i32** %6
%11 = call i32 @fread(i8* %8, i32 1, i32 %9, i32* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 @err(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %3
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Error reading input file.\0A\00"
define void @myread(i8* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = tail call i32 @fread(i8* %0, i32 1, i32 %1, i32* %2)
%5 = icmp eq i32 %4, %1
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @err(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
int test_imm_ACuint8_reg(unsigned char val) {
  return ((val) & (-0xAC << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_ACuint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -172
%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_ACuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 84
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
void stub1(char);
void testClosureBrV(void (*closure)(char), char a1) {
  if (closure != NULL)
    (*closure)(a1);
}


x86 assembly (clang, -O0):
<testClosureBrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1127 <testClosureBrV+0x27>
mov    -0x8(%rbp),%rax
movsbl -0x9(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureBrV>:
test   %rdi,%rdi
je     110e <testClosureBrV+0xe>
mov    %rdi,%rax
movsbl %sil,%edi
jmp    *%rax
ret

LLVM IR (-O0):
define void @testClosureBrV(void (i8)* %0, i8 signext %1) {
%3 = alloca void (i8)*
%4 = alloca i8
store void (i8)* %0, void (i8)** %3
store i8 %1, i8* %4
%5 = load void (i8)*, void (i8)** %3
%6 = icmp ne void (i8)* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load void (i8)*, void (i8)** %3
%9 = load i8, i8* %4
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @testClosureBrV(void (i8)* %0, i8 signext %1) {
%3 = icmp eq void (i8)* %0, null
br i1 %3, label %5, label %4
4: ; preds = %2
tail call void %0(i8 signext %1)
br label %5
5: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int,
                           int /*<<< orphan*/, int);
void version(FILE *out) {
  fprintf(out, "Android Debug Bridge version %d.%d.%d\n", 1, 0, 31);
}


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

x86 assembly (clang, -O2):
<version>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    $0x1f,%r8d
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Android Debug Bridge version %d.%d.%d\0A\00"
define void @version(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 1, i32 0, i32 31)
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"Android Debug Bridge version %d.%d.%d\0A\00"
define void @version(i32* nocapture %0) {
%2 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 1, i32 0, i32 31)
ret void
}
/* Variables and functions */
scalar_t__ COND_NE();
int /*<<< orphan*/ EA_A7_PD_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sne_8_pd7(void) {
  m68ki_write_8(EA_A7_PD_8(), COND_NE() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_sne_8_pd7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <EA_A7_PD_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <COND_NE@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sne_8_pd7>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <EA_A7_PD_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <COND_NE@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sne_8_pd7() {
%1 = call i32 (...) @EA_A7_PD_8()
%2 = call i64 (...) @COND_NE()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sne_8_pd7() {
%1 = tail call i32 (...) @EA_A7_PD_8()
%2 = tail call i64 (...) @COND_NE()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char buf[100];
  fgets(buf, 100, stdin);
  printf(buf);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    0x2ea4(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1040 <fgets@plt>
lea    -0x80(%rbp),%rdi
call   1030 <printf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0x2ebc(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 100, i32 %8)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = call i32 @printf(i8* %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

LLVM IR (-O2):
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 100, i32 %5)
%7 = call i32 @printf(i8* %4)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}
/* Variables and functions */
size_t strlen(const char *s) {
  const char *a = s;
  while (*a != 0) {
    a++;
  }
  return a - s;
}


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

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

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Variables and functions */
unsigned int const __arch__swab32(unsigned int);
const unsigned int __fswab32(unsigned int x) { return __arch__swab32(x); }


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

x86 assembly (clang, -O2):
<__fswab32>:
jmp    1030 <__arch__swab32@plt>

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

LLVM IR (-O2):
define i32 @__fswab32(i32 %0) {
%2 = tail call i32 @__arch__swab32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int sum = 0;
  int i;
  for (i = 0; i < 1000; i++) {
    sum++;
  }
  assert(sum != i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1151 <main+0x41>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = icmp ne i32 %14, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int strcspn(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *getName(char *line) {
  int i = strcspn(line, "= ");
  char *name = (char *)malloc(sizeof(char) * (i + 1));
  strncpy(name, line, i);
  *(name + i) = '\0';
  return name;
}


x86 assembly (clang, -O0):
<getName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getName>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xec1(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"= \00"
define i8* @getName(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strcspn(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = mul i64 1, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = call i32 @strncpy(i8* %14, i8* %15, i32 %16)
%18 = load i8*, i8** %4
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i8*, i8** %4
ret i8* %22
}

LLVM IR (-O2):
@.str = [3 x i8] c"= \00"
define i8* @getName(i8* %0) {
%2 = tail call i32 @strcspn(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strncpy(i8* %5, i8* %0, i32 %2)
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
ret i8* %5
}
int imod5(i) { return i % 5; }


x86 assembly (clang, -O0):
<imod5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imod5>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @imod5(i32 %0) {
%2 = srem i32 %0, 5
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ log_fmt(char *, char *, int);
void log_int(char *name, int v) { log_fmt(name, "%d", v); }


x86 assembly (clang, -O0):
<log_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <log_fmt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_int>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <log_fmt@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @log_int(i8* %0, i32 %1) {
%3 = tail call i32 @log_fmt(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
double floorf(double);
double floor(double d) { return floorf(d); }


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

x86 assembly (clang, -O2):
<floor>:
jmp    1030 <floorf@plt>

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

LLVM IR (-O2):
define double @floor(double %0) {
%2 = tail call double @floorf(double %0)
ret double %2
}
void RTAvlrGCPtrInsert(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlrGCPtrInsert() {
ret void
}
/* Variables and functions */
long double coshl(long double);
long double sinhl(long double);
long double tanhl(long double x) { return sinhl(x) / coshl(x); }


x86 assembly (clang, -O0):
<tanhl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <sinhl@plt>
fstpt  -0x1c(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <coshl@plt>
fldt   -0x1c(%rbp)
fdivp  %st,%st(1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanhl>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x10(%rsp)
fstpt  (%rsp)
call   1040 <sinhl@plt>
fstpt  0x1c(%rsp)
fldt   0x10(%rsp)
fstpt  (%rsp)
call   1030 <coshl@plt>
fldt   0x1c(%rsp)
fdivp  %st,%st(1)
add    $0x28,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @tanhl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @sinhl(x86_fp80 %3)
%5 = load x86_fp80, x86_fp80* %2
%6 = call x86_fp80 @coshl(x86_fp80 %5)
%7 = fdiv x86_fp80 %4, %6
ret x86_fp80 %7
}

LLVM IR (-O2):
define x86_fp80 @tanhl(x86_fp80 %0) {
%2 = tail call x86_fp80 @sinhl(x86_fp80 %0)
%3 = tail call x86_fp80 @coshl(x86_fp80 %0)
%4 = fdiv x86_fp80 %2, %3
ret x86_fp80 %4
}
int test_imm_D0int64_lowword_reg(long long val) {
  return ((val) & (0xD0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D0int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 208
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
extern unsigned int hweight8(unsigned char w) {
  unsigned short res = (w & 0x55) + ((w >> 1) & 0x55);
  res = (res & 0x33) + ((res >> 2) & 0x33);
  return (res & 0x0F) + ((res >> 4) & 0x0F);
}


x86 assembly (clang, -O0):
<hweight8>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x55,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x1,%ecx
and    $0x55,%ecx
add    %ecx,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
and    $0x33,%eax
movzwl -0x4(%rbp),%ecx
sar    $0x2,%ecx
and    $0x33,%ecx
add    %ecx,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
and    $0xf,%eax
movzwl -0x4(%rbp),%ecx
sar    $0x4,%ecx
and    $0xf,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hweight8>:
mov    %edi,%eax
and    $0x55,%eax
shr    %edi
and    $0xffffffd5,%edi
add    %edi,%eax
mov    %eax,%ecx
and    $0x33,%ecx
shr    $0x2,%eax
and    $0xfffffff3,%eax
add    %ecx,%eax
mov    %eax,%ecx
and    $0x7,%ecx
shr    $0x4,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hweight8(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i16
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = and i32 %5, 85
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = ashr i32 %8, 1
%10 = and i32 %9, 85
%11 = add nsw i32 %6, %10
%12 = trunc i32 %11 to i16
store i16 %12, i16* %3
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = and i32 %14, 51
%16 = load i16, i16* %3
%17 = zext i16 %16 to i32
%18 = ashr i32 %17, 2
%19 = and i32 %18, 51
%20 = add nsw i32 %15, %19
%21 = trunc i32 %20 to i16
store i16 %21, i16* %3
%22 = load i16, i16* %3
%23 = zext i16 %22 to i32
%24 = and i32 %23, 15
%25 = load i16, i16* %3
%26 = zext i16 %25 to i32
%27 = ashr i32 %26, 4
%28 = and i32 %27, 15
%29 = add nsw i32 %24, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @hweight8(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 85
%4 = lshr i32 %2, 1
%5 = and i32 %4, 85
%6 = add nuw nsw i32 %5, %3
%7 = and i32 %6, 51
%8 = lshr i32 %6, 2
%9 = and i32 %8, 51
%10 = add nuw nsw i32 %9, %7
%11 = and i32 %10, 7
%12 = lshr i32 %10, 4
%13 = add nuw nsw i32 %11, %12
ret i32 %13
}
unsigned int _hrt_p2_up(unsigned int x) {
  x |= (x >> 1);
  x |= (x >> 2);
  x |= (x >> 4);
  x |= (x >> 8);
  x |= (x >> 16);
  return x + 1;
}


x86 assembly (clang, -O0):
<_hrt_p2_up>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hrt_p2_up>:
mov    %edi,%eax
shr    %eax
or     %edi,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
or     %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @_hrt_p2_up(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = load i32, i32* %2
%6 = or i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = lshr i32 %7, 2
%9 = load i32, i32* %2
%10 = or i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = lshr i32 %11, 4
%13 = load i32, i32* %2
%14 = or i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = lshr i32 %15, 8
%17 = load i32, i32* %2
%18 = or i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = lshr i32 %19, 16
%21 = load i32, i32* %2
%22 = or i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = add i32 %23, 1
ret i32 %24
}

LLVM IR (-O2):
define i32 @_hrt_p2_up(i32 %0) {
%2 = lshr i32 %0, 1
%3 = or i32 %2, %0
%4 = lshr i32 %3, 2
%5 = or i32 %4, %3
%6 = lshr i32 %5, 4
%7 = or i32 %6, %5
%8 = lshr i32 %7, 8
%9 = or i32 %8, %7
%10 = lshr i32 %9, 16
%11 = or i32 %10, %9
%12 = add i32 %11, 1
ret i32 %12
}