xunge/DecIR huggingface dataset:
int d_gt_rm2(double a1, double *a2) { return !(((a1) > (*a2))); }


x86 assembly (clang, -O0):
<d_gt_rm2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_gt_rm2>:
xor    %eax,%eax
ucomisd (%rdi),%xmm0
setbe  %al
ret

LLVM IR (-O0):
define i32 @d_gt_rm2(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 = load double, double* %6
%8 = fcmp ogt double %5, %7
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @d_gt_rm2(double %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = fcmp uge double %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
int __attribute__((no, noclone)) callee(int i) { return i * i; }


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

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

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

LLVM IR (-O2):
define i32 @callee(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
float subf(const float in_A, const float in_B) { return in_A - in_B; }


x86 assembly (clang, -O0):
<subf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<subf>:
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @subf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fsub float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @subf(float %0, float %1) {
%3 = fsub float %0, %1
ret float %3
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, rez;
  scanf("%d", &a);
  rez = exact_square(a);
  printf("%d", rez);
  return rez;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <exact_square@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <exact_square@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
__attribute__((__weak__, __always___)) double
softboundmpx_difftime(time_t time1, time_t time0) {
  return difftime(time1, time0);
}


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

x86 assembly (clang, -O2):
<softboundmpx_difftime>:
jmp    1030 <difftime@plt>

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

LLVM IR (-O2):
define weak double @softboundmpx_difftime(i32 %0, i32 %1) {
%3 = tail call double @difftime(i32 %0, i32 %1)
ret double %3
}
int test_imm_24int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x24 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_24int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 154618822656
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int main() {
  int a = 4, b = 8;
  a += 10;
  a /= 2;
  a += 10;
  a %= 5;
  a *= 2 * 2;
  return (a -= b);
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
store i32 8, i32* %3
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 10
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 2
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 10
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = srem i32 %10, 5
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = mul nsw i32 %12, 4
store i32 %13, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = sub nsw i32 %15, %14
store i32 %16, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int minSubArrayLen(int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x[] = {2, 3, 1, 2, 4, 3};
  printf("%d\n", minSubArrayLen(7, x, sizeof(x) / sizeof(x[0])));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x7,%edi
mov    $0x6,%edx
call   1040 <minSubArrayLen@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x7,%edi
mov    $0x6,%edx
call   1040 <minSubArrayLen@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [6 x i32] [i32 2, i32 3, i32 1, i32 2, i32 4, i32 3]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @minSubArrayLen(i32 7, i32* %3, i32 6)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
c_rawwriter__(fd, bb, n) int *fd, *n;
char bb[];
{
  int i, nn;
  nn = (*n);
  i = write(*fd, bb, nn);
  if (i == nn)
    return (0);
  else
    return (i);
}


x86 assembly (clang, -O0):
<c_rawwriter__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    115c <c_rawwriter__+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1162 <c_rawwriter__+0x52>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_rawwriter__>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdx),%ebx
mov    (%rdi),%edi
xor    %ebp,%ebp
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <write@plt>
cmp    %ebx,%eax
cmove  %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @c_rawwriter__(i32* nocapture %0, i8* %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = load i32, i32* %0
%6 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %5, i8* %1, i32 %4)
%7 = icmp eq i32 %6, %4
%8 = select i1 %7, i32 0, i32 %6
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ getpid();
int procfs_opennode(char const *, int /*<<< orphan*/, char *);
bool procfs_isaccessable(const char *path) {
  int fd;
  fd = procfs_opennode(path, getpid(), "mem");
  if (fd < 0)
    return false;
  close(fd);
  return true;
}


x86 assembly (clang, -O0):
<procfs_isaccessable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
lea    0xea8(%rip),%rdx
call   1050 <procfs_opennode@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1176 <procfs_isaccessable+0x46>
movl   $0x0,-0x4(%rbp)
jmp    1185 <procfs_isaccessable+0x55>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procfs_isaccessable>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeba(%rip),%rdx
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <procfs_opennode@plt>
test   %eax,%eax
js     1160 <procfs_isaccessable+0x30>
mov    %eax,%edi
call   1040 <close@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"mem\00"
define i32 @procfs_isaccessable(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 (...) @getpid()
%7 = call i32 @procfs_opennode(i8* %5, i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %14
11: ; preds = %1
%12 = load i32, i32* %4
%13 = call i32 @close(i32 %12)
store i32 1, i32* %2
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [4 x i8] c"mem\00"
define i32 @procfs_isaccessable(i8* %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @procfs_opennode(i8* %0, i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp slt i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @close(i32 %3)
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ 1, %5 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main() {
  while (1) {
    printf("Hello World\n");
    sleep(5);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 5)
br label %2
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 5)
br label %1
}
void log_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @log_exit() {
ret void
}
__attribute__((always_)) void native_irq_disable(void) {
  asm volatile("cli" : : : "memory");
}


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

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

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

LLVM IR (-O2):
define void @native_irq_disable() {
tail call void asm sideeffect "cli", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
myarbitrary(leng, mess) int leng;
char *mess;
{
  prtime();
  printf("Arb", leng);
  prhex(mess, leng);
}


x86 assembly (clang, -O0):
<myarbitrary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <prtime@plt>
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1040 <prhex@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myarbitrary>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <prtime@plt>
lea    0xeba(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <prhex@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"Arb\00"
define i32 @myarbitrary(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = call i32 (...) @prtime()
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %5
%10 = load i32, i32* %4
%11 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @prhex to i32 (i8*, i32, ...)*)(i8* %9, i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [4 x i8] c"Arb\00"
define i32 @myarbitrary(i32 %0, i8* %1) {
%3 = tail call i32 (...) @prtime()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @prhex to i32 (i8*, i32, ...)*)(i8* %1, i32 %0)
ret i32 undef
}
int urg_serial_is_urg_port(int index) {
  (void)index;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @urg_serial_is_urg_port(i32 %0) {
ret i32 0
}
void die(const char *str) {
  print_emerg(str);
  do {
    asm(" ");
  } while (1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <print_emerg@plt>
mov    $0x1,%al
test   $0x1,%al
jne    1127 <die+0x17>
jmp    1136 <die+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<die>:
push   %rax
xor    %eax,%eax
call   1030 <print_emerg@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <die+0x10>

LLVM IR (-O0):
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @print_emerg to i32 (i8*, ...)*)(i8* %3)
br label %5
5: ; preds = %6, %1
br label %6
6: ; preds = %5
br i1 true, label %5, label %7
7: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @die(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @print_emerg to i32 (i8*, ...)*)(i8* %0)
br label %3
3: ; preds = %3, %1
tail call void asm sideeffect " ", "~{dirflag},~{fpsr},~{flags}"()
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htobe32(int /*<<< orphan*/);
int /*<<< orphan*/ htole32(int /*<<< orphan*/);
uint32_t convert(short int little_endian, uint32_t data) {
  if (little_endian) {
    return htole32(data);
  } else {
    return htobe32(data);
  }
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x6(%rbp)
mov    %esi,-0xc(%rbp)
cmpw   $0x0,-0x6(%rbp)
je     114d <convert+0x2d>
mov    -0xc(%rbp),%edi
call   1030 <htole32@plt>
mov    %eax,-0x4(%rbp)
jmp    1158 <convert+0x38>
mov    -0xc(%rbp),%edi
call   1040 <htobe32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
test   %di,%di
je     112c <convert+0xc>
mov    %esi,%edi
jmp    1030 <htole32@plt>
mov    %esi,%edi
jmp    1040 <htobe32@plt>

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

LLVM IR (-O2):
define i32 @convert(i16 signext %0, i32 %1) {
%3 = icmp eq i16 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @htole32(i32 %1)
br label %8
6: ; preds = %2
%7 = tail call i32 @htobe32(i32 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
/* Type definitions */
struct epoll_event {
  int dummy;
};

/* Variables and functions */
int EPOLL_CTL_DEL;
int epoll_ctl(int, int, int, struct epoll_event *);
int nullPointer_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) {
  (void)epoll_ctl(epfd, op, fd, event);
  return epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL);
}


x86 assembly (clang, -O0):
<nullPointer_epoll_ctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <epoll_ctl@plt>
mov    -0x4(%rbp),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <epoll_ctl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nullPointer_epoll_ctl>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %edi,%ebp
call   1030 <epoll_ctl@plt>
mov    0x2ed5(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %ebx,%edx
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <epoll_ctl@plt>

LLVM IR (-O0):
%struct.epoll_event = type { i32 }
@EPOLL_CTL_DEL = global i32 0
define i32 @nullPointer_epoll_ctl(i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.epoll_event*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store %struct.epoll_event* %3, %struct.epoll_event** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load %struct.epoll_event*, %struct.epoll_event** %8
%13 = call i32 @epoll_ctl(i32 %9, i32 %10, i32 %11, %struct.epoll_event* %12)
%14 = load i32, i32* %5
%15 = load i32, i32* @EPOLL_CTL_DEL
%16 = load i32, i32* %7
%17 = call i32 @epoll_ctl(i32 %14, i32 %15, i32 %16, %struct.epoll_event* null)
ret i32 %17
}

LLVM IR (-O2):
%struct.epoll_event = type { i32 }
@EPOLL_CTL_DEL = global i32 0
define i32 @nullPointer_epoll_ctl(i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3) {
%5 = tail call i32 @epoll_ctl(i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3)
%6 = load i32, i32* @EPOLL_CTL_DEL
%7 = tail call i32 @epoll_ctl(i32 %0, i32 %6, i32 %2, %struct.epoll_event* null)
ret i32 %7
}
int main() {
  int a = -1;
  static int b = -2147483647 - 1;
  static int c = 0;
  int t = a - (b + c * -2);
  if (t != 2147483647)
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ef9(%rip),%ecx
imul   $0xfffffffe,0x2efa(%rip),%edx
add    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7fffffff,-0xc(%rbp)
je     114f <main+0x3f>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@main.b = internal global i32 -2147483648
@main.c = internal global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @main.b
%6 = load i32, i32* @main.c
%7 = mul nsw i32 %6, -2
%8 = add nsw i32 %5, %7
%9 = sub nsw i32 %4, %8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 2147483647
br i1 %11, label %12, label %13
12: ; preds = %0
unreachable
13: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int extract_receive_buffer_header(unsigned short *length,
                                  unsigned char *serial_number,
                                  unsigned char *packet_type,
                                  unsigned char *buffer) {
  unsigned short data;
  data = buffer[0] << 0;
  data |= buffer[1] << 8;
  *length = data;
  *serial_number = buffer[2];
  *packet_type = buffer[3];
  return (*length);
}


x86 assembly (clang, -O0):
<extract_receive_buffer_header>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
shl    $0x0,%eax
mov    %ax,-0x22(%rbp)
mov    -0x20(%rbp),%rax
movzbl 0x1(%rax),%ecx
shl    $0x8,%ecx
movzwl -0x22(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x22(%rbp)
mov    -0x22(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
mov    -0x20(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_receive_buffer_header>:
movzwl (%rcx),%eax
mov    %ax,(%rdi)
mov    0x2(%rcx),%al
mov    %al,(%rsi)
mov    0x3(%rcx),%al
mov    %al,(%rdx)
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @extract_receive_buffer_header(i16* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i16*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i16
store i16* %0, i16** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 0
%15 = trunc i32 %14 to i16
store i16 %15, i16* %9
%16 = load i8*, i8** %8
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i16, i16* %9
%22 = zext i16 %21 to i32
%23 = or i32 %22, %20
%24 = trunc i32 %23 to i16
store i16 %24, i16* %9
%25 = load i16, i16* %9
%26 = load i16*, i16** %5
store i16 %25, i16* %26
%27 = load i8*, i8** %8
%28 = getelementptr inbounds i8, i8* %27, i64 2
%29 = load i8, i8* %28
%30 = load i8*, i8** %6
store i8 %29, i8* %30
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i64 3
%33 = load i8, i8* %32
%34 = load i8*, i8** %7
store i8 %33, i8* %34
%35 = load i16*, i16** %5
%36 = load i16, i16* %35
%37 = zext i16 %36 to i32
ret i32 %37
}

LLVM IR (-O2):
define i32 @extract_receive_buffer_header(i16* nocapture %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2, i8* nocapture %3) {
%5 = load i8, i8* %3
%6 = getelementptr inbounds i8, i8* %3, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i16
%9 = shl nuw i16 %8, 8
%10 = zext i8 %5 to i16
%11 = or i16 %9, %10
store i16 %11, i16* %0
%12 = getelementptr inbounds i8, i8* %3, i64 2
%13 = load i8, i8* %12
store i8 %13, i8* %1
%14 = getelementptr inbounds i8, i8* %3, i64 3
%15 = load i8, i8* %14
store i8 %15, i8* %2
%16 = load i16, i16* %0
%17 = zext i16 %16 to i32
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ HF_strcmp(char const *, char const *, uintptr_t);
void __sanitizer_weak_hook_strcmp(uintptr_t pc, const char *s1, const char *s2,
                                  int result __attribute__((unused))) {
  HF_strcmp(s1, s2, pc);
}


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

x86 assembly (clang, -O2):
<__sanitizer_weak_hook_strcmp>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <HF_strcmp@plt>

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

LLVM IR (-O2):
define void @__sanitizer_weak_hook_strcmp(i64 %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @HF_strcmp(i8* %1, i8* %2, i64 %0)
ret void
}
void av_dv_frame_profile() {}


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

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

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

LLVM IR (-O2):
define void @av_dv_frame_profile() {
ret void
}
int leftmostNotR(char *array, int n) {
  for (int i = 0; i < n; i++) {
    if (array[i] != 'R') {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<leftmostNotR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1151 <leftmostNotR+0x51>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x52,%eax
je     113e <leftmostNotR+0x3e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <leftmostNotR+0x58>
jmp    1143 <leftmostNotR+0x43>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <leftmostNotR+0x12>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leftmostNotR>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111f <leftmostNotR+0x1f>
mov    %esi,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmpb   $0x52,(%rdi,%rcx,1)
jne    1120 <leftmostNotR+0x20>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <leftmostNotR+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @leftmostNotR(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ 0, %4 ], [ %12, %11 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 82
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %16, label %6
14: ; preds = %6
%15 = trunc i64 %7 to i32
br label %16
16: ; preds = %11, %14, %2
%17 = phi i32 [ -1, %2 ], [ %15, %14 ], [ -1, %11 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void san_err(void) { exit(5); }


x86 assembly (clang, -O0):
<san_err>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<san_err>:
push   %rax
mov    $0x5,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @san_err() {
%1 = call i32 @exit(i32 5)
unreachable
}

LLVM IR (-O2):
define void @san_err() {
%1 = tail call i32 @exit(i32 5)
unreachable
}
/* Variables and functions */
long double asin(double);
long double asinl(long double x) { return asin((double)x); }


x86 assembly (clang, -O0):
<asinl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <asin@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <asin@plt>

LLVM IR (-O0):
define x86_fp80 @asinl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call x86_fp80 @asin(double %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @asinl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call x86_fp80 @asin(double %2)
ret x86_fp80 %3
}
void cli_setup_readline() {}


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

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

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

LLVM IR (-O2):
define void @cli_setup_readline() {
ret void
}
int pp2(int bar) { return bar; }


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

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

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

LLVM IR (-O2):
define i32 @pp2(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ redecl1();
void use81() { redecl1(); }


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

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

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

LLVM IR (-O2):
define void @use81() {
%1 = tail call i32 (...) @redecl1()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void callexit() { exit(0); }


x86 assembly (clang, -O0):
<callexit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define void @callexit() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @callexit() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int read(int, void *, size_t);
ssize_t r_read(int fd, void *buf, size_t size) {
  ssize_t retval;
  while (retval = read(fd, buf, size), retval == -1 && errno == EINTR)
    ;
  return retval;
}


x86 assembly (clang, -O0):
<r_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
jne    115f <r_read+0x4f>
mov    0x2e94(%rip),%rax
mov    (%rax),%rax
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    116f <r_read+0x5f>
jmp    1174 <r_read+0x64>
jmp    1123 <r_read+0x13>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_read>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <read@plt>
cmp    $0xffffffff,%eax
jne    114b <r_read+0x3b>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <r_read+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @r_read(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
br label %8
8: ; preds = %21, %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = call i32 @read(i32 %9, i8* %10, i64 %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %19
15: ; preds = %8
%16 = load i64, i64* @errno
%17 = load i64, i64* @EINTR
%18 = icmp eq i64 %16, %17
br label %19
19: ; preds = %15, %8
%20 = phi i1 [ false, %8 ], [ %18, %15 ]
br i1 %20, label %21, label %22
21: ; preds = %19
br label %8
22: ; preds = %19
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @r_read(i32 %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
%6 = icmp eq i32 %5, -1
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %5
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void init_array(int *start) {
  int i;
  srand(time(NULL));
  for (i = 0; i < 3 * 1024 * 1024 / sizeof(int); i++) {
    start[i] = rand() % 5;
  }
}


x86 assembly (clang, -O0):
<init_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0xc0000,%rax
jae    118b <init_array+0x5b>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <init_array+0x23>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_array>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    $0xc0000,%rbx
jne    1150 <init_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @init_array(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
store i32 0, i32* %3
br label %6
6: ; preds = %17, %1
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 786432
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 5
%13 = load i32*, i32** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
store i32 %12, i32* %16
br label %17
17: ; preds = %10
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @init_array(i32* nocapture writeonly %0) {
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
br label %4
4: ; preds = %1, %4
%5 = phi i64 [ 0, %1 ], [ %9, %4 ]
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 5
%8 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 %7, i32* %8
%9 = add nuw nsw i64 %5, 1
%10 = icmp eq i64 %9, 786432
br i1 %10, label %11, label %4
11: ; preds = %4
ret void
}
__attribute__((no)) long
trampoline_delete_code(unsigned long n1, unsigned long n2, unsigned long n3) {
  long ret;
  __asm__ __volatile__("leaq 1f(%%rip), %%r11\n\t"
                       "movq %%r11, %%fs:0x20\n\t"
                       "jmpq *%%gs:0x10000+"
                       "0xF8"
                       "\n\t"
                       "1:\n\t"
                       : "=a"(ret)
                       : "D"(n1), "S"(n2), "d"(n3)
                       : "memory");
  return ret;
}


x86 assembly (clang, -O0):
<trampoline_delete_code>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x100f8
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trampoline_delete_code>:
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x100f8
ret

LLVM IR (-O0):
define i64 @trampoline_delete_code(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0xF8\0A\091:\0A\09", "={ax},{di},{si},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %8, i64 %9, i64 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
ret i64 %12
}

LLVM IR (-O2):
define i64 @trampoline_delete_code(i64 %0, i64 %1, i64 %2) {
%4 = tail call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0xF8\0A\091:\0A\09", "={ax},{di},{si},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2)
ret i64 %4
}
int countTrees(int numKeys) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @countTrees(i32 %0) {
ret i32 1
}
/* Type definitions */
typedef double time_t;

/* Variables and functions */
void dotnet_time_to_time_t(double dotnet, time_t *t, int *ms) {
  *t = (dotnet - 621355968000000000.0) / 10000000.;
}


x86 assembly (clang, -O0):
<dotnet_time_to_time_t>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotnet_time_to_time_t>:
addsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
movsd  %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @dotnet_time_to_time_t(double %0, double* %1, i32* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca i32*
store double %0, double* %4
store double* %1, double** %5
store i32* %2, i32** %6
%7 = load double, double* %4
%8 = fsub double %7, 0x43A13EFFEBEF6B00
%9 = fdiv double %8, 1.000000e+07
%10 = load double*, double** %5
store double %9, double* %10
ret void
}

LLVM IR (-O2):
define void @dotnet_time_to_time_t(double %0, double* nocapture writeonly %1, i32* nocapture readnone %2) {
%4 = fadd double %0, 0xC3A13EFFEBEF6B00
%5 = fdiv double %4, 1.000000e+07
store double %5, double* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
FILE *open_file(char *file_name) {
  FILE *file;
  file = fopen(file_name, "r");
  if (file != NULL) {
    return file;
  } else {
    printf("Filed to open your file");
    return NULL;
  }
}


x86 assembly (clang, -O0):
<open_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1158 <open_file+0x38>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116c <open_file+0x4c>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_file>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1141 <open_file+0x21>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [24 x i8] c"Filed to open your file\00"
define i32* @open_file(i8* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32*, i32** %4
store i32* %10, i32** %2
br label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32* null, i32** %2
br label %13
13: ; preds = %11, %9
%14 = load i32*, i32** %2
ret i32* %14
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [24 x i8] c"Filed to open your file\00"
define noalias i32* @open_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (strcmp("CS50 rocks", argv[1]) == 0) {
    printf("You get an A!\n");
  } else {
    printf("You get a D :-(\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xebb(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1165 <main+0x45>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    1171 <main+0x51>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rsi
lea    0xed4(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xee0(%rip),%rax
lea    0xec9(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"CS50 rocks\00"
@.str.1 = [15 x i8] c"You get an A!\0A\00"
@.str.2 = [17 x i8] c"You get a D :-(\0A\00"
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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %15
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"CS50 rocks\00"
@str = [16 x i8] c"You get a D :-(\00"
@str.3 = [14 x i8] c"You get an A!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
void hcx_physick_stop() {}


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

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

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

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