xunge/DecIR huggingface dataset:
int getSum(int a, int b) {
  if (b == 0) {
    return a;
  }
  const int sum = a ^ b;
  const int carry = (a & b) << 1;
  return getSum(sum, carry);
}


x86 assembly (clang, -O0):
<getSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <getSum+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <getSum+0x46>
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <getSum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSum>:
test   %esi,%esi
je     111d <getSum+0x1d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %esi,%eax
xor    %edi,%eax
and    %edi,%esi
mov    %eax,%edi
add    %esi,%esi
jne    1110 <getSum+0x10>
ret
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @getSum(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %1, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = xor i32 %5, %6
%8 = and i32 %5, %6
%9 = shl i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ %0, %2 ], [ %7, %4 ]
ret i32 %12
}
int is_digit(char c) {
  if (c >= '0' && c <= '9') {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<is_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1130 <is_digit+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1130 <is_digit+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <is_digit+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_digit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_digit(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7, %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @is_digit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int64_t max_int64(int64_t i1, int64_t i2) {
  if (i1 > i2)
    return i1;
  return i2;
}


x86 assembly (clang, -O0):
<max_int64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1127 <max_int64+0x27>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112f <max_int64+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_int64>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @max_int64(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = icmp sgt i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i64, i64* %4
store i64 %10, i64* %3
br label %13
11: ; preds = %2
%12 = load i64, i64* %5
store i64 %12, i64* %3
br label %13
13: ; preds = %11, %9
%14 = load i64, i64* %3
ret i64 %14
}

LLVM IR (-O2):
define i64 @max_int64(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *);
void *sbrk(int /*<<< orphan*/);
void showcur() {
  void *p = sbrk(0);
  printf("current:%p\n", p);
}


x86 assembly (clang, -O0):
<showcur>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <sbrk@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showcur>:
push   %rax
xor    %edi,%edi
call   1040 <sbrk@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"current:%p\0A\00"
define void @showcur() {
%1 = alloca i8*
%2 = call i8* @sbrk(i32 0)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"current:%p\0A\00"
define void @showcur() {
%1 = tail call i8* @sbrk(i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ leer();
int main() {
  leer();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @leer()
ret i32 0
}
/* Variables and functions */
char *strchr(const char *str, int c) {
  do {
    if (*str == c) {
      return (char *)str;
    }
  } while (*str++);
  return NULL;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1128 <strchr+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114d <strchr+0x4d>
jmp    112d <strchr+0x2d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = icmp eq i8 %5, 0
br i1 %10, label %11, label %3
11: ; preds = %8, %3
%12 = phi i8* [ %4, %3 ], [ null, %8 ]
ret i8* %12
}
/* Type definitions */
typedef int /*<<< orphan*/ link;

/* Variables and functions */
int PATH_MAX;
int readlink(char *, char *, int);
char *exe_path(char *path) {
  char link[PATH_MAX];
  char *result;
  int len = readlink(path, link, sizeof(link));
  link[len] = '\0';
  result = link;
  return result;
}


x86 assembly (clang, -O0):
<exe_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x30(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    %eax,%edx
call   1030 <readlink@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,-0x24(%rbp)
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exe_path>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    0x2ed3(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rsi
call   1030 <readlink@plt>
mov    %rbx,%rax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
define i8* @exe_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca i8, i64 %8
store i64 %8, i64* %4
%11 = load i8*, i8** %2
%12 = trunc i64 %8 to i32
%13 = call i32 @readlink(i8* %11, i8* %10, i32 %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %10, i64 %15
store i8 0, i8* %16
store i8* %10, i8** %5
%17 = load i8*, i8** %5
%18 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
define noalias i8* @exe_path(i8* nocapture %0) {
%2 = load i32, i32* @PATH_MAX
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = call i32 @readlink(i8* %0, i8* %4, i32 %2)
ret i8* %4
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
int htonl(int);
uint64_t htonll(uint64_t value) {
  int num = 42;
  if (*(char *)&num == 42) {
    uint32_t high_part = htonl((uint32_t)(value >> 32));
    uint32_t low_part = htonl((uint32_t)(value & 0xFFFFFFFFLL));
    return (((uint64_t)low_part) << 32) | high_part;
  } else {
    return value;
  }
}


x86 assembly (clang, -O0):
<htonll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x2a,-0xc(%rbp)
movsbl -0xc(%rbp),%eax
cmp    $0x2a,%eax
jne    1171 <htonll+0x61>
mov    -0x8(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <htonl@plt>
mov    %eax,-0x10(%rbp)
movslq -0x8(%rbp),%rax
movabs $0xffffffff,%rcx
and    %rcx,%rax
mov    %eax,%edi
call   1030 <htonl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <htonll+0x67>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htonll>:
push   %rbx
mov    %edi,%ebx
call   1030 <htonl@plt>
mov    %ebx,%edi
call   1030 <htonl@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @htonll(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 42, i32* %4
%7 = bitcast i32* %4 to i8*
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 42
br i1 %10, label %11, label %24
11: ; preds = %1
%12 = load i32, i32* %3
%13 = ashr i32 %12, 32
%14 = call i32 @htonl(i32 %13)
store i32 %14, i32* %5
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = and i64 %16, 4294967295
%18 = trunc i64 %17 to i32
%19 = call i32 @htonl(i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = shl i32 %20, 32
%22 = load i32, i32* %5
%23 = or i32 %21, %22
store i32 %23, i32* %2
br label %26
24: ; preds = %1
%25 = load i32, i32* %3
store i32 %25, i32* %2
br label %26
26: ; preds = %24, %11
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @htonll(i32 returned %0) {
%2 = tail call i32 @htonl(i32 poison)
%3 = tail call i32 @htonl(i32 %0)
ret i32 %0
}
int double_compare(const void *this, const void *that) {
  double *a = (double *)this;
  double *b = (double *)that;
  if (*a < *b)
    return -1;
  else if (*a == *b)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<double_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1142 <double_compare+0x42>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <double_compare+0x71>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jne    116a <double_compare+0x6a>
jp     116a <double_compare+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1171 <double_compare+0x71>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_compare>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movapd %xmm0,%xmm2
cmpneqsd %xmm1,%xmm2
movq   %xmm2,%rcx
and    $0x1,%ecx
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @double_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = fcmp une double %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ ptrdiff_t;

/* Variables and functions */
void *field_ref(ptrdiff_t pos, void *base) {
  return (void *)(((unsigned char *)base) + pos);
}


x86 assembly (clang, -O0):
<field_ref>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<field_ref>:
movslq %edi,%rax
add    %rsi,%rax
ret

LLVM IR (-O0):
define i8* @field_ref(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
ret i8* %8
}

LLVM IR (-O2):
define i8* @field_ref(i32 %0, i8* readnone %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i8, i8* %1, i64 %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *);
char *displayError(char *respond_to_msg) {
  memset(respond_to_msg, 0, sizeof(char) * 1024);
  sprintf(respond_to_msg,
          "Invalid command: Please see \"help\" for list of valid commands.\n");
  return respond_to_msg;
}


x86 assembly (clang, -O0):
<displayError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayError>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
movups 0xed9(%rip),%xmm0
movups %xmm0,(%rbx)
movups 0xedf(%rip),%xmm0
movups %xmm0,0x10(%rbx)
movups 0xee4(%rip),%xmm0
movups %xmm0,0x20(%rbx)
movups 0xee9(%rip),%xmm0
movups %xmm0,0x30(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [64 x i8] c"Invalid command: Please see \22help\22 for list of valid commands.\0A\00"
define i8* @displayError(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @memset(i8* %3, i32 0, i32 1024)
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [64 x i8] c"Invalid command: Please see \22help\22 for list of valid commands.\0A\00"
define i8* @displayError(i8* returned %0) {
%2 = tail call i32 @memset(i8* %0, i32 0, i32 1024)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(64) %0, i8* align 1 dereferenceable(64) getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i64 64, i1 false)
ret i8* %0
}
int main(void) {
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int *intdup(int i) {
  int *r = (int *)malloc(sizeof(int));
  *r = i;
  return r;
}


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

x86 assembly (clang, -O2):
<intdup>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i32* @intdup(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %3
%6 = load i32, i32* %2
%7 = load i32*, i32** %3
store i32 %6, i32* %7
%8 = load i32*, i32** %3
ret i32* %8
}

LLVM IR (-O2):
define i32* @intdup(i32 %0) {
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32 %0, i32* %3
ret i32* %3
}
int c014(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @c014() {
ret i32 0
}

LLVM IR (-O2):
define i32 @c014() {
ret i32 0
}
short test_short_9(short a, short b, short c, short d, short e, short f,
                   short g, short h, short i) {
  return -2482;
}


x86 assembly (clang, -O0):
<test_short_9>:
push   %rbp
mov    %rsp,%rbp
mov    %r8d,-0x1c(%rbp)
mov    %ecx,%eax
mov    -0x1c(%rbp),%ecx
mov    %eax,-0x18(%rbp)
mov    %edx,%eax
mov    -0x18(%rbp),%edx
mov    %eax,-0x14(%rbp)
mov    %esi,%eax
mov    -0x14(%rbp),%esi
mov    %eax,-0x10(%rbp)
mov    %edi,%r8d
mov    -0x10(%rbp),%edi
mov    %r9w,%ax
mov    0x20(%rbp),%r9w
mov    0x18(%rbp),%r9w
mov    0x10(%rbp),%r9w
mov    %r8w,-0x2(%rbp)
mov    %di,-0x4(%rbp)
mov    %si,-0x6(%rbp)
mov    %dx,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    $0xf64e,%ax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_short_9>:
mov    $0xf64e,%ax
ret

LLVM IR (-O0):
define signext i16 @test_short_9(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i16 signext %4, i16 signext %5, i16 signext %6, i16 signext %7, i16 signext %8) {
%10 = alloca i16
%11 = alloca i16
%12 = alloca i16
%13 = alloca i16
%14 = alloca i16
%15 = alloca i16
%16 = alloca i16
%17 = alloca i16
%18 = alloca i16
store i16 %0, i16* %10
store i16 %1, i16* %11
store i16 %2, i16* %12
store i16 %3, i16* %13
store i16 %4, i16* %14
store i16 %5, i16* %15
store i16 %6, i16* %16
store i16 %7, i16* %17
store i16 %8, i16* %18
ret i16 -2482
}

LLVM IR (-O2):
define signext i16 @test_short_9(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i16 signext %4, i16 signext %5, i16 signext %6, i16 signext %7, i16 signext %8) {
ret i16 -2482
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("\nhello world ");
  printf("\ngoodbye world \n\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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"\0Ahello world \00"
@.str.1 = [18 x i8] c"\0Agoodbye world \0A\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 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0Ahello world \00"
@str = [17 x i8] c"\0Agoodbye world \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test(int x, int (*f)(int)) { return (*f)(-x); }


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xor    %edi,%edi
sub    -0x4(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
neg    %edi
jmp    *%rsi

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

LLVM IR (-O2):
define i32 @test(i32 %0, i32 (i32)* nocapture %1) {
%3 = sub nsw i32 0, %0
%4 = tail call i32 %1(i32 %3)
ret i32 %4
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME_COARSE;
int INT64_C(int);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int64_t msec_time() {
  int64_t msecs;
  struct timespec t;
  clock_gettime(CLOCK_REALTIME_COARSE, &t);
  msecs = t.tv_sec * INT64_C(1000) + t.tv_nsec / 1000000;
  return msecs;
}


x86 assembly (clang, -O0):
<msec_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x3e8,%edi
call   1040 <INT64_C@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msec_time>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
mov    0x8(%rsp),%ebx
mov    $0x3e8,%edi
call   1040 <INT64_C@plt>
imul   %ebx,%eax
movslq 0xc(%rsp),%rcx
imul   $0x431bde83,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_REALTIME_COARSE = global i32 0
define i32 @msec_time() {
%1 = alloca i32
%2 = alloca %struct.timespec
%3 = load i32, i32* @CLOCK_REALTIME_COARSE
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %2)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 @INT64_C(i32 1000)
%8 = mul nsw i32 %6, %7
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000000
%12 = add nsw i32 %8, %11
store i32 %12, i32* %1
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_REALTIME_COARSE = global i32 0
define i32 @msec_time() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME_COARSE
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 @INT64_C(i32 1000)
%8 = mul nsw i32 %7, %6
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000000
%12 = add nsw i32 %11, %8
ret i32 %12
}
/* Variables and functions */
int rand();
void tabInit(int *tab, int size) {
  for (int i = 0; i < size; i++)
    tab[i] = rand() % 100;
}


x86 assembly (clang, -O0):
<tabInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <tabInit+0x4a>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <tabInit+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tabInit>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    115f <tabInit+0x4f>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <tabInit+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @tabInit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 100
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%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* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @tabInit(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 100
%11 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 %10, i32* %11
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
int send_command(int out_pipe, char *command) {
  return write(out_pipe, command, strlen(command));
}


x86 assembly (clang, -O0):
<send_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_command>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @send_command(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret i32 %4
}
long long power(long long a, long long n) {
  long long printf = 1;
  while (n > 0) {
    if (n % 2) {
      printf = printf * a;
    }
    n >>= 1;
    a *= a;
  }
  return printf;
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    1162 <power+0x62>
mov    -0x10(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     1144 <power+0x44>
mov    -0x18(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <power+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
test   %rsi,%rsi
jle    1140 <power+0x40>
mov    $0x1,%r8d
mov    $0x1,%eax
mov    %rsi,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   $0x1,%sil
mov    %rdi,%rcx
cmove  %r8,%rcx
imul   %rcx,%rax
shr    %rdx
imul   %rdi,%rdi
cmp    $0x1,%rsi
mov    %rdx,%rsi
ja     1120 <power+0x20>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i64 @power(i64 %0, i64 %1) {
%3 = icmp sgt i64 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2, %4
%5 = phi i64 [ %11, %4 ], [ 1, %2 ]
%6 = phi i64 [ %12, %4 ], [ %1, %2 ]
%7 = phi i64 [ %13, %4 ], [ %0, %2 ]
%8 = and i64 %6, 1
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i64 1, i64 %7
%11 = mul nsw i64 %10, %5
%12 = lshr i64 %6, 1
%13 = mul nsw i64 %7, %7
%14 = icmp ult i64 %6, 2
br i1 %14, label %15, label %4
15: ; preds = %4, %2
%16 = phi i64 [ 1, %2 ], [ %11, %4 ]
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ wFileExists(char *);
int /*<<< orphan*/ wFree(char *);
char *wPopString();
int /*<<< orphan*/ wPushNumber(int /*<<< orphan*/);
void wBasFileExists() {
  char *fname;
  fname = wPopString();
  wPushNumber(wFileExists(fname));
  wFree(fname);
}


x86 assembly (clang, -O0):
<wBasFileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <wPopString@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <wFileExists@plt>
mov    %eax,%edi
call   1040 <wPushNumber@plt>
mov    -0x8(%rbp),%rdi
call   1060 <wFree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasFileExists>:
push   %rbx
xor    %eax,%eax
call   1030 <wPopString@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <wFileExists@plt>
mov    %eax,%edi
call   1040 <wPushNumber@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <wFree@plt>

LLVM IR (-O0):
define void @wBasFileExists() {
%1 = alloca i8*
%2 = call i8* (...) @wPopString()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @wFileExists(i8* %3)
%5 = call i32 @wPushNumber(i32 %4)
%6 = load i8*, i8** %1
%7 = call i32 @wFree(i8* %6)
ret void
}

LLVM IR (-O2):
define void @wBasFileExists() {
%1 = tail call i8* (...) @wPopString()
%2 = tail call i32 @wFileExists(i8* %1)
%3 = tail call i32 @wPushNumber(i32 %2)
%4 = tail call i32 @wFree(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int X;
  float km, Y;
  scanf("%d", &X);
  scanf("%f", &Y);
  km = X / Y;
  printf("%.3f km/l\n", km);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebb(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cvtsi2ssl 0x4(%rsp),%xmm0
divss  (%rsp),%xmm0
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [11 x i8] c"%.3f km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to float
%9 = load float, float* %4
%10 = fdiv float %8, %9
store float %10, float* %3
%11 = load float, float* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [11 x i8] c"%.3f km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = load i32, i32* %1
%8 = sitofp i32 %7 to float
%9 = load float, float* %2
%10 = fdiv float %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), float %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ editorProcessKeypress();
int /*<<< orphan*/ editorRefreshScreen();
int /*<<< orphan*/ enableRawMode();
int /*<<< orphan*/ initEditor();
int main() {
  enableRawMode();
  initEditor();
  while (1) {
    editorRefreshScreen();
    editorProcessKeypress();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <enableRawMode@plt>
mov    $0x0,%al
call   1060 <initEditor@plt>
mov    $0x0,%al
call   1040 <editorRefreshScreen@plt>
mov    $0x0,%al
call   1050 <editorProcessKeypress@plt>
jmp    115d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <enableRawMode@plt>
xor    %eax,%eax
call   1060 <initEditor@plt>
nop
xor    %eax,%eax
call   1040 <editorRefreshScreen@plt>
xor    %eax,%eax
call   1050 <editorProcessKeypress@plt>
jmp    1150 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @enableRawMode()
%3 = call i32 (...) @initEditor()
br label %4
4: ; preds = %0, %4
%5 = call i32 (...) @editorRefreshScreen()
%6 = call i32 (...) @editorProcessKeypress()
br label %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @enableRawMode()
%2 = tail call i32 (...) @initEditor()
br label %3
3: ; preds = %0, %3
%4 = tail call i32 (...) @editorRefreshScreen()
%5 = tail call i32 (...) @editorProcessKeypress()
br label %3
}
void testClosureIDrV(void (*closure)(int, double), int a1, double a2) {
  (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureIDrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureIDrV>:
mov    %rdi,%rax
mov    %esi,%edi
jmp    *%rax

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

LLVM IR (-O2):
define void @testClosureIDrV(void (i32, double)* nocapture %0, i32 %1, double %2) {
tail call void %0(i32 %1, double %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ps_daemon_main(int);
int ps_daemon_main_wrapper(void *data) {
  int fd_initdata = *((int *)data);
  ps_daemon_main(fd_initdata);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @ps_daemon_main_wrapper(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @ps_daemon_main(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @ps_daemon_main_wrapper(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @ps_daemon_main(i32 %3)
ret i32 0
}
void fs_posix_free(void) { return; }


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

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

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

LLVM IR (-O2):
define void @fs_posix_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ read_attr_file(char *, int *);
int libid2_get_power_state(void) {
  int pResult = 0;
  read_attr_file("/sys/class/gpio/gpio45/value", &pResult);
  if (pResult == 1) {
    return 1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<libid2_get_power_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <read_attr_file@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1145 <libid2_get_power_state+0x35>
movl   $0x1,-0x4(%rbp)
jmp    114c <libid2_get_power_state+0x3c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libid2_get_power_state>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <read_attr_file@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"/sys/class/gpio/gpio45/value\00"
define i32 @libid2_get_power_state() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
%3 = call i32 @read_attr_file(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 1, i32* %1
br label %8
7: ; preds = %0
store i32 1, i32* %1
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [29 x i8] c"/sys/class/gpio/gpio45/value\00"
define i32 @libid2_get_power_state() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @read_attr_file(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32* %1)
ret i32 1
}
/* Type definitions */
struct timespec {
  unsigned long long tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
unsigned long long diff_ns(struct timespec first, struct timespec second) {
  unsigned long long temp = (second.tv_sec - first.tv_sec) * 1000000000ull;
  temp += (second.tv_nsec - first.tv_nsec);
  return temp;
}


x86 assembly (clang, -O0):
<diff_ns>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x10(%rbp),%rax
imul   $0x3b9aca00,%rax,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x8(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff_ns>:
sub    %rdi,%rdx
imul   $0x3b9aca00,%rdx,%rax
sub    %rsi,%rcx
add    %rcx,%rax
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i64 @diff_ns(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca %struct.timespec
%6 = alloca %struct.timespec
%7 = alloca i64
%8 = bitcast %struct.timespec* %5 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = bitcast %struct.timespec* %6 to { i64, i64 }*
%12 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 0
store i64 %2, i64* %12
%13 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 1
store i64 %3, i64* %13
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%15 = load i64, i64* %14
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%17 = load i64, i64* %16
%18 = sub i64 %15, %17
%19 = mul i64 %18, 1000000000
store i64 %19, i64* %7
%20 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
%21 = load i64, i64* %20
%22 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%23 = load i64, i64* %22
%24 = sub nsw i64 %21, %23
%25 = load i64, i64* %7
%26 = add i64 %25, %24
store i64 %26, i64* %7
%27 = load i64, i64* %7
ret i64 %27
}

LLVM IR (-O2):
define i64 @diff_ns(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = sub i64 %2, %0
%6 = mul i64 %5, 1000000000
%7 = sub i64 %3, %1
%8 = add i64 %7, %6
ret i64 %8
}
void disable_int() { asm("cli"); }


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

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

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

LLVM IR (-O2):
define void @disable_int() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int test_imm_01int32_mem(int *val) {
  return ((*val) & (0x01 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_01int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int map_char(void *udata, int codepoint) {
  if (codepoint >= (int)'a' && codepoint <= (int)'z') {
    return codepoint - (int)'a' + (int)'A';
  } else if (codepoint == 0x1234) {
    return (int)'X';
  }
  return codepoint;
}


x86 assembly (clang, -O0):
<map_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x61,-0x14(%rbp)
jl     1130 <map_char+0x30>
cmpl   $0x7a,-0x14(%rbp)
jg     1130 <map_char+0x30>
mov    -0x14(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <map_char+0x54>
cmpl   $0x1234,-0x14(%rbp)
jne    1149 <map_char+0x49>
movl   $0x58,-0x4(%rbp)
jmp    1154 <map_char+0x54>
jmp    114e <map_char+0x4e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_char>:
lea    -0x61(%rsi),%ecx
cmp    $0x1234,%esi
mov    $0x58,%eax
cmovne %esi,%eax
lea    -0x20(%rsi),%edx
cmp    $0x1a,%ecx
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define i32 @map_char(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sge i32 %6, 97
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 97
%14 = add nsw i32 %13, 65
store i32 %14, i32* %3
br label %22
15: ; preds = %8, %2
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 4660
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 88, i32* %3
br label %22
19: ; preds = %15
br label %20
20: ; preds = %19
%21 = load i32, i32* %5
store i32 %21, i32* %3
br label %22
22: ; preds = %20, %18, %11
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @map_char(i8* nocapture readnone %0, i32 %1) {
%3 = add i32 %1, -97
%4 = icmp ult i32 %3, 26
%5 = add nsw i32 %1, -32
%6 = icmp eq i32 %1, 4660
%7 = select i1 %6, i32 88, i32 %1
%8 = select i1 %4, i32 %5, i32 %7
ret i32 %8
}