xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ test(int);
int main(void) {
  test(3);
  test(6);
  test(9);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <test@plt>
mov    $0x6,%edi
call   1030 <test@plt>
mov    $0x9,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @test(i32 3)
%2 = call i32 @test(i32 6)
%3 = call i32 @test(i32 9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test(i32 3)
%2 = tail call i32 @test(i32 6)
%3 = tail call i32 @test(i32 9)
ret i32 0
}
int g(double b, double c) { return (int)(b + c); }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @g(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
%8 = fptosi double %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @g(double %0, double %1) {
%3 = fadd double %0, %1
%4 = fptosi double %3 to i32
ret i32 %4
}
void testClosureDFrV(void (*closure)(double, float), double a1, float a2) {
  (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureDFrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movss  %xmm1,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureDFrV>:
jmp    *%rdi

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

LLVM IR (-O2):
define void @testClosureDFrV(void (double, float)* nocapture %0, double %1, float %2) {
tail call void %0(double %1, float %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int age = 10;
  int age2;
  int height = 72;
  printf("I am %d years old.\n", age);
  printf("I am %d inches tall.\n", height);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x48,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xece(%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
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x48,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 72, i32* %4
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 72)
ret i32 0
}
void TA0_N_IRQHandler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<TA0_N_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <TA0_N_IRQHandler+0x9>
jmp    1109 <TA0_N_IRQHandler+0x9>

x86 assembly (clang, -O2):
<TA0_N_IRQHandler>:
jmp    1100 <TA0_N_IRQHandler>

LLVM IR (-O0):
define void @TA0_N_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @TA0_N_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
scalar_t__ syscall(int, int /*<<< orphan*/, int /*<<< orphan*/,
                   int /*<<< orphan*/);
int lseek(int file, int ptr, int dir) {
  return (int)syscall(19, (uint)file, (uint)ptr, (uint)dir);
}


x86 assembly (clang, -O0):
<lseek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0x13,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lseek>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    $0x13,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @lseek(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i64 @syscall(i32 19, i32 %7, i32 %8, i32 %9)
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @lseek(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @syscall(i32 19, i32 %0, i32 %1, i32 %2)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *my_thread() { pthread_exit(NULL); }


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

x86 assembly (clang, -O2):
<my_thread>:
xor    %edi,%edi
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @my_thread() {
%1 = alloca i8*
%2 = call i32 @pthread_exit(i32* null)
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define noalias i8* @my_thread() {
%1 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XConfigureWindow() {
  printf("XConfigureWindow called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [24 x i8] c"XConfigureWindow called\00"
define i32 @XConfigureWindow() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int close(int const);
int errno;
int /*<<< orphan*/ perror(char *);
int gpiotools_release_linehandle(const int fd) {
  int ret;
  ret = close(fd);
  if (ret == -1) {
    perror("Failed to close GPIO LINEHANDLE device file");
    ret = -errno;
  }
  return ret;
}


x86 assembly (clang, -O0):
<gpiotools_release_linehandle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    115a <gpiotools_release_linehandle+0x3a>
lea    0xeb9(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
mov    0x2e8b(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpiotools_release_linehandle>:
push   %rax
call   1030 <close@plt>
cmp    $0xffffffff,%eax
je     112d <gpiotools_release_linehandle+0xd>
pop    %rcx
ret
lea    0xecc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2ea0(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Failed to close GPIO LINEHANDLE device file\00"
@errno = global i32 0
define i32 @gpiotools_release_linehandle(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @close(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @errno
%11 = sub nsw i32 0, %10
store i32 %11, i32* %3
br label %12
12: ; preds = %8, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [44 x i8] c"Failed to close GPIO LINEHANDLE device file\00"
@errno = global i32 0
define i32 @gpiotools_release_linehandle(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @errno
%7 = sub nsw i32 0, %6
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ %7, %4 ], [ %2, %1 ]
ret i32 %9
}
void rte_prefetch1(volatile void *p) {
  asm volatile("prefetcht1 %[p]" : [p] "+m"(*(volatile char *)p));
}


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

x86 assembly (clang, -O2):
<rte_prefetch1>:
prefetcht1 (%rdi)
ret

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

LLVM IR (-O2):
define void @rte_prefetch1(i8* %0) {
tail call void asm sideeffect "prefetcht1 $0", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %0, i8* elementtype(i8) %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void trifree(void *memptr) {
  if (memptr != NULL) {
    free(memptr);
  }
}


x86 assembly (clang, -O0):
<trifree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <trifree+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trifree>:
test   %rdi,%rdi
je     111a <trifree+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @trifree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void putstr(s) register const char *s;
{
  while (*s)
    putchr(*s++);
}


x86 assembly (clang, -O0):
<putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <putstr+0x37>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
mov    $0x0,%al
call   1030 <putchr@plt>
jmp    111c <putstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1135 <putstr+0x25>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
xor    %eax,%eax
call   1030 <putchr@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <putstr+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @putstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 (i32, ...) bitcast (i32 (...)* @putchr to i32 (i32, ...)*)(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchr to i32 (i32, ...)*)(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
unsigned varint_length(uint64_t v) {
  int len = 1;
  while (v >= 128) {
    v >>= 7;
    len++;
  }
  return len;
}


x86 assembly (clang, -O0):
<varint_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x80,-0x4(%rbp)
jl     1132 <varint_length+0x32>
mov    -0x4(%rbp),%eax
sar    $0x7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <varint_length+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<varint_length>:
mov    $0x1,%eax
cmp    $0x80,%edi
jl     1130 <varint_length+0x30>
mov    $0x1,%eax
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
shr    $0x7,%ecx
add    $0x1,%eax
cmp    $0x3fff,%edi
mov    %ecx,%edi
ja     1120 <varint_length+0x20>
ret

LLVM IR (-O0):
define i32 @varint_length(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 128
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = ashr i32 %8, 7
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @varint_length(i32 %0) {
%2 = icmp sgt i32 %0, 127
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 7
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 16383
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int asc_to_int(char const);
unsigned int hex_to_int(const char *h) {
  return asc_to_int(*h) * 0x10 + asc_to_int(*(h + 1));
}


x86 assembly (clang, -O0):
<hex_to_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <asc_to_int@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <asc_to_int@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_int>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <asc_to_int@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <asc_to_int@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hex_to_int(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = call i32 @asc_to_int(i8 signext %4)
%6 = mul nsw i32 %5, 16
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = call i32 @asc_to_int(i8 signext %9)
%11 = add nsw i32 %6, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @hex_to_int(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @asc_to_int(i8 signext %2)
%4 = shl nsw i32 %3, 4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @asc_to_int(i8 signext %6)
%8 = add nsw i32 %7, %4
ret i32 %8
}
int cmp(const void *a, const void *b) {
  long long a1, b1;
  a1 = *(long long *)a;
  b1 = *(long long *)b;
  if (a1 < b1) {
    return -1;
  } else if (a1 > b1) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    113c <cmp+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <cmp+0x5d>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    1156 <cmp+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <cmp+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
%8 = icmp sgt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int inb(int);
int /*<<< orphan*/ outb(int, unsigned char);
void nosound() {
  unsigned char tmp = inb(0x61) & 0xFC;
  outb(0x61, tmp);
}


x86 assembly (clang, -O0):
<nosound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x61,%edi
call   1040 <inb@plt>
and    $0xfc,%eax
mov    %al,-0x1(%rbp)
mov    $0x61,%edi
movzbl -0x1(%rbp),%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nosound>:
push   %rax
mov    $0x61,%edi
call   1040 <inb@plt>
and    $0xfc,%eax
mov    $0x61,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @nosound() {
%1 = alloca i8
%2 = call i32 @inb(i32 97)
%3 = and i32 %2, 252
%4 = trunc i32 %3 to i8
store i8 %4, i8* %1
%5 = load i8, i8* %1
%6 = call i32 @outb(i32 97, i8 zeroext %5)
ret void
}

LLVM IR (-O2):
define void @nosound() {
%1 = tail call i32 @inb(i32 97)
%2 = trunc i32 %1 to i8
%3 = and i8 %2, -4
%4 = tail call i32 @outb(i32 97, i8 zeroext %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void clear_cursor(void) {
  fprintf(stdout, "%s", "\E[?25h");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<clear_cursor>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xec8(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_cursor>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
lea    0xecb(%rip),%rdx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"\1B[?25h\00"
define void @clear_cursor() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"\1B[?25h\00"
define void @clear_cursor() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
extern int in_be16(volatile unsigned short *addr) {
  return ({
    unsigned short __v = (*(volatile unsigned short *)(addr));
    __v;
  });
}


x86 assembly (clang, -O0):
<in_be16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ax
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%ax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_be16>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @in_be16(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
%6 = load volatile i16, i16* %5
store i16 %6, i16* %3
%7 = load i16, i16* %3
store i16 %7, i16* %4
%8 = load i16, i16* %4
%9 = zext i16 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @in_be16(i16* %0) {
%2 = load volatile i16, i16* %0
%3 = zext i16 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(double ***);
int /*<<< orphan*/ free_matrix2(double **);
void free_matrix3(double ***X) {
  free_matrix2(X[0]);
  free(X);
}


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

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

LLVM IR (-O0):
define void @free_matrix3(double*** %0) {
%2 = alloca double***
store double*** %0, double**** %2
%3 = load double***, double**** %2
%4 = getelementptr inbounds double**, double*** %3, i64 0
%5 = load double**, double*** %4
%6 = call i32 @free_matrix2(double** %5)
%7 = load double***, double**** %2
%8 = call i32 @free(double*** %7)
ret void
}

LLVM IR (-O2):
define void @free_matrix3(double*** nocapture %0) {
%2 = load double**, double*** %0
%3 = tail call i32 @free_matrix2(double** %2)
%4 = tail call i32 @free(double*** %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ht_free(void *ptr) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @ht_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int mvwprintw(int /*<<< orphan*/ *, int, int, char const *, short);
int i2_mvwprintw(WINDOW *win, int y, int x, const char *fmt, short i) {
  return (mvwprintw(win, y, x, fmt, i));
}


x86 assembly (clang, -O0):
<i2_mvwprintw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8w,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
movswl -0x1a(%rbp),%r8d
call   1030 <mvwprintw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2_mvwprintw>:
jmp    1030 <mvwprintw@plt>

LLVM IR (-O0):
define i32 @i2_mvwprintw(i32* %0, i32 %1, i32 %2, i8* %3, i16 signext %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i16
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i16 %4, i16* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i8*, i8** %9
%15 = load i16, i16* %10
%16 = call i32 @mvwprintw(i32* %11, i32 %12, i32 %13, i8* %14, i16 signext %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @i2_mvwprintw(i32* %0, i32 %1, i32 %2, i8* %3, i16 signext %4) {
%6 = tail call i32 @mvwprintw(i32* %0, i32 %1, i32 %2, i8* %3, i16 signext %4)
ret i32 %6
}
int Prox(int i) { return (i + 1) % 100; }


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

x86 assembly (clang, -O2):
<Prox>:
add    $0x1,%edi
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Prox(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = srem i32 %2, 100
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void help_prompt() {
  puts("prompt [on | off]\n"
       "Sets the display of the prompt to on or off if specified. If called\n"
       "without parameters, displays the prompt once.");
}


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

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

LLVM IR (-O0):
@.str = [132 x i8] c"prompt [on | off]\0ASets the display of the prompt to on or off if specified. If called\0Awithout parameters, displays the prompt once.\00"
define void @help_prompt() {
%1 = call i32 @puts(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [132 x i8] c"prompt [on | off]\0ASets the display of the prompt to on or off if specified. If called\0Awithout parameters, displays the prompt once.\00"
define void @help_prompt() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ sorter_grail_common_sort(int /*<<< orphan*/ *, size_t,
                                            int /*<<< orphan*/ *, int);
void sorter_grail_sort_fixed_buffer(int64_t *arr, size_t Len) {
  int64_t ExtBuf[512];
  sorter_grail_common_sort(arr, Len, ExtBuf, 512);
}


x86 assembly (clang, -O0):
<sorter_grail_sort_fixed_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x810(%rbp),%rdx
mov    $0x200,%ecx
call   1030 <sorter_grail_common_sort@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sorter_grail_sort_fixed_buffer>:
sub    $0x808,%rsp
mov    %rsp,%rdx
mov    $0x200,%ecx
call   1030 <sorter_grail_common_sort@plt>
add    $0x808,%rsp
ret

LLVM IR (-O0):
define void @sorter_grail_sort_fixed_buffer(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca [512 x i32]
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = load i32*, i32** %3
%7 = load i64, i64* %4
%8 = getelementptr inbounds [512 x i32], [512 x i32]* %5, i64 0, i64 0
%9 = call i32 @sorter_grail_common_sort(i32* %6, i64 %7, i32* %8, i32 512)
ret void
}

LLVM IR (-O2):
define void @sorter_grail_sort_fixed_buffer(i32* %0, i64 %1) {
%3 = alloca [512 x i32]
%4 = bitcast [512 x i32]* %3 to i8*
%5 = getelementptr inbounds [512 x i32], [512 x i32]* %3, i64 0, i64 0
%6 = call i32 @sorter_grail_common_sort(i32* %0, i64 %1, i32* %5, i32 512)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unreachable();
int fgt22(int a) {
  unsigned i = a / 4;
  unsigned j = i + 2;
  if (j == -7)
    return -1;
  if (i >= -3)
    return 0;
  if (i > j)
    unreachable();
  return 1;
}


x86 assembly (clang, -O0):
<fgt22>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xfffffff9,-0x10(%rbp)
jne    1148 <fgt22+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1178 <fgt22+0x68>
cmpl   $0xfffffffd,-0xc(%rbp)
jb     115e <fgt22+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1178 <fgt22+0x68>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jbe    1171 <fgt22+0x61>
mov    $0x0,%al
call   1030 <unreachable@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgt22>:
lea    0x27(%rdi),%ecx
mov    $0xffffffff,%eax
cmp    $0x4,%ecx
jb     1120 <fgt22+0x20>
lea    0x3(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
sar    $0x2,%ecx
xor    %eax,%eax
cmp    $0xfffffffd,%ecx
setb   %al
ret

LLVM IR (-O0):
define i32 @fgt22(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 4
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = add i32 %8, 2
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, -7
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 -1, i32* %2
br label %24
13: ; preds = %1
%14 = load i32, i32* %4
%15 = icmp uge i32 %14, -3
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 0, i32* %2
br label %24
17: ; preds = %13
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = icmp ugt i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 (...) @unreachable()
br label %23
23: ; preds = %21, %17
store i32 1, i32* %2
br label %24
24: ; preds = %23, %16, %12
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @fgt22(i32 %0) {
%2 = add i32 %0, 39
%3 = icmp ult i32 %2, 4
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = sdiv i32 %0, 4
%6 = icmp ult i32 %5, -3
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ -1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ func1();
__attribute__((no)) int func2(void) { func1(); }


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

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

LLVM IR (-O0):
define i32 @func2() {
%1 = alloca i32
%2 = call i32 (...) @func1()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @func2() {
%1 = tail call i32 (...) @func1()
ret i32 undef
}
int bar(int a) {
  int *ptr = &a;
  *ptr = 100;
  return a + *ptr;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
store i32* %2, i32** %3
%4 = load i32*, i32** %3
store i32 100, i32* %4
%5 = load i32, i32* %2
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = add nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
ret i32 200
}
/* Variables and functions */
int cmm2yuv4(unsigned char *, unsigned char *, int, int);
int conv_frame(unsigned char *input, unsigned char *output, int height,
               int width) {
  return cmm2yuv4(input, output, height, width);
}


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

x86 assembly (clang, -O2):
<conv_frame>:
jmp    1030 <cmm2yuv4@plt>

LLVM IR (-O0):
define i32 @conv_frame(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @cmm2yuv4(i8* %9, i8* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @conv_frame(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @cmm2yuv4(i8* %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ vt100_EscSeq(int, unsigned char *, long long);
void vt100_CNL(int n) { vt100_EscSeq(n, (unsigned char *)"E", (long long)2); }


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

x86 assembly (clang, -O2):
lea    0xee9(%rip),%rsi
mov    $0x2,%edx
jmp    1030 <vt100_EscSeq@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"E\00"
define void @vt100_CNL(i32 %0) {
%2 = tail call i32 @vt100_EscSeq(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 2)
ret void
}
void _M2_slope_finish(__attribute__((unused)) int argc,
                      __attribute__((unused)) char *argv[]) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void encode_json_str(FILE *fp, const char *label, const char *value,
                     int first) {
  if (!first) {
    fprintf(fp, ",\n");
  }
  fprintf(fp, " \"%s\": \"%s\"", label, value);
}


x86 assembly (clang, -O0):
<encode_json_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1143 <encode_json_str+0x33>
mov    -0x8(%rbp),%rdi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_json_str>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
test   %ecx,%ecx
jne    114b <encode_json_str+0x2b>
lea    0xec7(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c",\0A\00"
@.str.1 = [12 x i8] c" \22%s\22: \22%s\22\00"
define void @encode_json_str(i32* nocapture %0, i8* %1, i8* %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
int test_imm_DAuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xDA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_DAuint64_lowword_mem>:
testb  $0xda,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DAuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 218
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int strlen(s)
char *s;
{
  int i;
  i = 0;
  while (*s++)
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <strlen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
long __attribute__((__const__)) clzl(unsigned long x) {
  return __builtin_clzl(x);
}


x86 assembly (clang, -O0):
<clzl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
bsr    %rax,%rax
xor    $0x3f,%rax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<clzl>:
bsr    %rdi,%rax
xor    $0x3f,%rax
ret

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

LLVM IR (-O2):
define i64 @clzl(i64 %0) {
%2 = tail call i64 @llvm.ctlz.i64(i64 %0, i1 true)
ret i64 %2
}
void sub_fun(char *x) {
  *x = *x + 1;
  *x = *x + 1;
}


x86 assembly (clang, -O0):
<sub_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0x1,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0x1,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_fun>:
addb   $0x2,(%rdi)
ret

LLVM IR (-O0):
define void @sub_fun(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
%6 = add nsw i32 %5, 1
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %2
store i8 %7, i8* %8
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = add nsw i32 %11, 1
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %2
store i8 %13, i8* %14
ret void
}

LLVM IR (-O2):
define void @sub_fun(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, 2
store i8 %3, i8* %0
ret void
}
double f3() {
  double x, y;
  asm("" : "=r,r"(x), "=r,r"(y) : "%0,0"(x), "r,r"(0));
  return x;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
xor    %ecx,%ecx
movq   %rcx,%xmm0
movq   %rax,%xmm1
movsd  %xmm1,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
xor    %eax,%eax
movq   %rax,%xmm0
ret

LLVM IR (-O0):
define double @f3() {
%1 = alloca double
%2 = alloca double
%3 = load double, double* %1
%4 = call { double, double } asm "", "=r|r,=r|r,%0|0,r|r,~{dirflag},~{fpsr},~{flags}"(double %3, i32 0)
%5 = extractvalue { double, double } %4, 0
%6 = extractvalue { double, double } %4, 1
store double %5, double* %1
store double %6, double* %2
%7 = load double, double* %1
ret double %7
}

LLVM IR (-O2):
define double @f3() {
%1 = tail call { double, double } asm "", "=r|r,=r|r,%0|0,r|r,~{dirflag},~{fpsr},~{flags}"(double undef, i32 0)
%2 = extractvalue { double, double } %1, 0
ret double %2
}
/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  int n1 = 20;
  int n2;
  int *p;
  int *q;
  n1 = 10;
  n2 = 20;
  p = malloc(sizeof(int));
  *p = 30;
  q = &n2;
  n2 = 40;
  p = q;
  printf("n1=%d n2=%d *p=%d *q=%d\n", n1, n2, *p, *q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1e,(%rax)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x28,-0xc(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    (%rax),%r8d
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
lea    0xece(%rip),%rdi
mov    $0xa,%esi
mov    $0x28,%edx
mov    $0x28,%ecx
mov    $0x28,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"n1=%d n2=%d *p=%d *q=%d\0A\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 20, i32* %2
store i32 10, i32* %2
store i32 20, i32* %3
%6 = call i32* @malloc(i32 4)
store i32* %6, i32** %4
%7 = load i32*, i32** %4
store i32 30, i32* %7
store i32* %3, i32** %5
store i32 40, i32* %3
%8 = load i32*, i32** %5
store i32* %8, i32** %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %12, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"n1=%d n2=%d *p=%d *q=%d\0A\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 10, i32 40, i32 40, i32 40)
ret i32 0
}
int test7(int y) {
  int x;
  if (y)
    x = 1;
  return x;
}


x86 assembly (clang, -O0):
<test7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1118 <test7+0x18>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test7(i32 %0) {
ret i32 1
}
/* Variables and functions */
char EOF;
char getchar();
void purge_buffer() {
  char c;
  while ((c = getchar()) != '\n' && c != EOF)
    ;
}


x86 assembly (clang, -O0):
<purge_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     1149 <purge_buffer+0x39>
movsbl -0x1(%rbp),%eax
mov    0x2eaa(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1159 <purge_buffer+0x49>
jmp    115e <purge_buffer+0x4e>
jmp    1118 <purge_buffer+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<purge_buffer>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     112f <purge_buffer+0x1f>
cmp    (%rbx),%al
jne    1120 <purge_buffer+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @purge_buffer() {
%1 = alloca i8
br label %2
2: ; preds = %14, %0
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 10
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = load i8, i8* @EOF
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %8, %10
br label %12
12: ; preds = %6, %2
%13 = phi i1 [ false, %2 ], [ %11, %6 ]
br i1 %13, label %14, label %15
14: ; preds = %12
br label %2
15: ; preds = %12
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @purge_buffer() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp ne i8 %2, 10
%4 = load i8, i8* @EOF
%5 = icmp ne i8 %2, %4
%6 = select i1 %3, i1 %5, i1 false
br i1 %6, label %1, label %7
7: ; preds = %1
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void USBULPIEnable(uint32_t ui32Base) {
  (*((volatile uint32_t *)(ui32Base + 0x00000FC4))) |= 0x00010000;
}


x86 assembly (clang, -O0):
<USBULPIEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfc4,%eax
cltq
mov    (%rax),%ecx
or     $0x10000,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBULPIEnable>:
movslq %edi,%rax
orl    $0x10000,0xfc4(%rax)
ret

LLVM IR (-O0):
define void @USBULPIEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 4036
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 65536
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @USBULPIEnable(i32 %0) {
%2 = add nsw i32 %0, 4036
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = or i32 %5, 65536
store volatile i32 %6, i32* %4
ret void
}