xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ foo();
int main(int argc, char **argv) {
  if (argc >= 2) {
    foo();
  } else {
    foo();
  }
}


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)
cmpl   $0x2,-0x8(%rbp)
jl     113c <main+0x2c>
mov    $0x0,%al
call   1030 <foo@plt>
jmp    1143 <main+0x33>
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @foo()
ret i32 0
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *xbasename(const char *path) {
  const char *ret = strrchr(path, '/');
  if (!ret)
    ret = path;
  else
    ++ret;
  return ret;
}


x86 assembly (clang, -O0):
<xbasename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <xbasename+0x36>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <xbasename+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @xbasename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ pv_header(void **);
int /*<<< orphan*/ safe_free(int /*<<< orphan*/);
void delete_ptr_vector(void **v) {
  if (v != NULL) {
    safe_free(pv_header(v));
  }
}


x86 assembly (clang, -O0):
<delete_ptr_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1147 <delete_ptr_vector+0x27>
mov    -0x8(%rbp),%rdi
call   1040 <pv_header@plt>
mov    %eax,%edi
call   1030 <safe_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_ptr_vector>:
test   %rdi,%rdi
je     1133 <delete_ptr_vector+0x13>
push   %rax
call   1040 <pv_header@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <safe_free@plt>
ret

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

LLVM IR (-O2):
define void @delete_ptr_vector(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @pv_header(i8** %0)
%5 = tail call i32 @safe_free(i32 %4)
br label %6
6: ; preds = %3, %1
ret void
}
int *fcalloc_fails() {
  static int result = 0;
  return &result;
}


x86 assembly (clang, -O0):
<fcalloc_fails>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f19(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcalloc_fails>:
lea    0x2f1d(%rip),%rax
ret

LLVM IR (-O0):
@fcalloc_fails.result = internal global i32 0
define i32* @fcalloc_fails() {
ret i32* @fcalloc_fails.result
}

LLVM IR (-O2):
@fcalloc_fails.result = internal global i32 0
define i32* @fcalloc_fails() {
ret i32* @fcalloc_fails.result
}
/* Variables and functions */
scalar_t__ is_alpha(char);
scalar_t__ is_numeric(char);
int is_alpha_numeric(char c) { return is_alpha(c) || is_numeric(c); }


x86 assembly (clang, -O0):
<is_alpha_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <is_alpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <is_alpha_numeric+0x3c>
movsbl -0x1(%rbp),%edi
call   1030 <is_numeric@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alpha_numeric>:
push   %rbx
mov    %edi,%ebx
call   1040 <is_alpha@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <is_alpha_numeric+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <is_numeric@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_alpha_numeric(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @is_alpha(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @is_numeric(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_alpha_numeric(i8 signext %0) {
%2 = tail call i64 @is_alpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @is_numeric(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
int integer_sort(const void *a, const void *b) { return *(int *)a - *(int *)b; }


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

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

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

LLVM IR (-O2):
define i32 @integer_sort(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
int test_imm_C9uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xC9 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_C9uint64_highword_reg>:
movabs $0xc900000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C9uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 863288426496
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int mount_a() {
  system("mount -a");
  system("mount -o remount,rw /");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"mount -a\00"
@.str.1 = [22 x i8] c"mount -o remount,rw /\00"
define i32 @mount_a() {
%1 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"mount -a\00"
@.str.1 = [22 x i8] c"mount -o remount,rw /\00"
define i32 @mount_a() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ UserAdjudicationEvent(int);
void AdjuWhiteProc() { UserAdjudicationEvent(+1); }


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

x86 assembly (clang, -O2):
<AdjuWhiteProc>:
mov    $0x1,%edi
jmp    1030 <UserAdjudicationEvent@plt>

LLVM IR (-O0):
define void @AdjuWhiteProc() {
%1 = call i32 @UserAdjudicationEvent(i32 1)
ret void
}

LLVM IR (-O2):
define void @AdjuWhiteProc() {
%1 = tail call i32 @UserAdjudicationEvent(i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t motorcontrol_set_motors(uint8_t motor_a, uint8_t motor_b,
                                uint8_t motor_c, uint8_t motor_d) {
  return 0;
}


x86 assembly (clang, -O0):
<motorcontrol_set_motors>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @motorcontrol_set_motors(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @motorcontrol_set_motors(i32 %0, i32 %1, i32 %2, i32 %3) {
ret i32 0
}
int find(int *a, int size, int x) {
  int i = 0;
  while (i < size) {
    if (a[i] == x)
      return i;
    i++;
  }
  return -1;
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    114e <find+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1140 <find+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <find+0x55>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <find+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <find+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <find+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <find+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @find(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
double pow(int, int);
double Nm2Invcm(double N) {
  double invCm;
  invCm = 1 / (N * pow(10, -7));
  return invCm;
}


x86 assembly (clang, -O0):
<Nm2Invcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0xa,%edi
mov    $0xfffffff9,%esi
call   1030 <pow@plt>
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xeb9(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Nm2Invcm>:
push   %rax
movsd  %xmm0,(%rsp)
mov    $0xa,%edi
mov    $0xfffffff9,%esi
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  0xece(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @Nm2Invcm(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @pow(i32 10, i32 -7)
%6 = fmul double %4, %5
%7 = fdiv double 1.000000e+00, %6
store double %7, double* %3
%8 = load double, double* %3
ret double %8
}

LLVM IR (-O2):
define double @Nm2Invcm(double %0) {
%2 = tail call double @pow(i32 10, i32 -7)
%3 = fmul double %2, %0
%4 = fdiv double 1.000000e+00, %3
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
size_t rand();
int /*<<< orphan*/ read(int const, char *, size_t);
ssize_t do_rnd_read(const int fd, char *buf, const size_t len) {
  size_t cap = rand();
  cap &= 0xffff;
  if (cap == 0)
    cap = 1;
  else if (cap > len)
    cap = len;
  return read(fd, buf, cap);
}


x86 assembly (clang, -O0):
<do_rnd_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
and    $0xffff,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1164 <do_rnd_read+0x44>
movq   $0x1,-0x20(%rbp)
jmp    117f <do_rnd_read+0x5f>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    117a <do_rnd_read+0x5a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    117f <do_rnd_read+0x5f>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_rnd_read>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
movzwl %ax,%eax
cmp    %rbx,%rax
cmovbe %rax,%rbx
test   %rax,%rax
mov    $0x1,%edx
cmovne %rbx,%rdx
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @do_rnd_read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 (...) @rand()
%5 = and i64 %4, 65535
%6 = icmp eq i64 %5, 0
%7 = icmp ugt i64 %5, %2
%8 = select i1 %7, i64 %2, i64 %5
%9 = select i1 %6, i64 1, i64 %8
%10 = tail call i32 @read(i32 %0, i8* %1, i64 %9)
ret i32 %10
}
int __isatty(int fd) {
  if (fd < 3)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<__isatty>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    111d <__isatty+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1124 <__isatty+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__isatty>:
xor    %eax,%eax
cmp    $0x3,%edi
setl   %al
ret

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

LLVM IR (-O2):
define i32 @__isatty(i32 %0) {
%2 = icmp slt i32 %0, 3
%3 = zext i1 %2 to i32
ret i32 %3
}
int ft_isupper(int c) {
  if ('A' <= c && c <= 'Z')
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    $0x41,%eax
cmp    -0x8(%rbp),%eax
jg     112b <ft_isupper+0x2b>
cmpl   $0x5a,-0x8(%rbp)
jg     112b <ft_isupper+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1132 <ft_isupper+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 65, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
void **malloc(int);
void **root_new(void) {
  void **root;
  if ((root = malloc(sizeof(void *))) == NULL)
    return NULL;
  *root = NULL;
  return root;
}


x86 assembly (clang, -O0):
<root_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    113d <root_new+0x2d>
movq   $0x0,-0x8(%rbp)
jmp    1150 <root_new+0x40>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<root_new>:
push   %rax
mov    $0x8,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1127 <root_new+0x17>
movq   $0x0,(%rax)
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8** @root_new() {
%1 = tail call i8** @malloc(i32 8)
%2 = icmp eq i8** %1, null
br i1 %2, label %4, label %3
3: ; preds = %0
store i8* null, i8** %1
br label %4
4: ; preds = %0, %3
ret i8** %1
}
int param_get_ushort(char *buffer, struct kernel_param *kp) { return 0; }


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

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

LLVM IR (-O0):
%struct.kernel_param = type opaque
define i32 @param_get_ushort(i8* %0, %struct.kernel_param* %1) {
%3 = alloca i8*
%4 = alloca %struct.kernel_param*
store i8* %0, i8** %3
store %struct.kernel_param* %1, %struct.kernel_param** %4
ret i32 0
}

LLVM IR (-O2):
%struct.kernel_param = type opaque
define i32 @param_get_ushort(i8* nocapture readnone %0, %struct.kernel_param* nocapture readnone %1) {
ret i32 0
}
int B(int x) { return x + 20; }


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

x86 assembly (clang, -O2):
<B>:
lea    0x14(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @B(i32 %0) {
%2 = add nsw i32 %0, 20
ret i32 %2
}
void getkanji(kanji, s) char *kanji;
char *s;
{
  s++;
  while (*s) {
    if (*s == '"') {
      *kanji = '\0';
      break;
    }
    *kanji = *s;
    kanji++;
    s++;
  }
}


x86 assembly (clang, -O0):
<getkanji>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116a <getkanji+0x6a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1141 <getkanji+0x41>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    116a <getkanji+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <getkanji+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getkanji>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%rsi,%rax,1),%ecx
test   %cl,%cl
je     112b <getkanji+0x2b>
cmp    $0x22,%cl
je     1127 <getkanji+0x27>
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
jmp    1110 <getkanji+0x10>
movb   $0x0,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define void @getkanji(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i8* [ %0, %2 ], [ %10, %9 ]
%5 = phi i8* [ %1, %2 ], [ %6, %9 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %6
switch i8 %7, label %9 [
i8 0, label %11
i8 34, label %8
]
8: ; preds = %3
store i8 0, i8* %4
br label %11
9: ; preds = %3
store i8 %7, i8* %4
%10 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
11: ; preds = %3, %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ depth_4();
int main() {
  depth_4();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @depth_4()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ wFree(char *);
char *wPopString();
int /*<<< orphan*/ wPushNumber(int /*<<< orphan*/);
void wBasKill() {
  char *name = wPopString();
  remove(name);
  wFree(name);
  wPushNumber(0);
}


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

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

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

LLVM IR (-O2):
define void @wBasKill() {
%1 = tail call i8* (...) @wPopString()
%2 = tail call i32 @remove(i8* %1)
%3 = tail call i32 @wFree(i8* %1)
%4 = tail call i32 @wPushNumber(i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
int /*<<< orphan*/ _mm_cvtps_epi32(int /*<<< orphan*/);
__m128i test_mm_cvtps_epi32(__m128 A) { return _mm_cvtps_epi32(A); }


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

x86 assembly (clang, -O2):
<test_mm_cvtps_epi32>:
jmp    1030 <_mm_cvtps_epi32@plt>

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

LLVM IR (-O2):
define i32 @test_mm_cvtps_epi32(i32 %0) {
%2 = tail call i32 @_mm_cvtps_epi32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void test_warning(const char *section) {
  printf("\x1b[93m"
         "%s"
         "\x1b[0m"
         "\r\n",
         section);
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"\1B[93m%s\1B[0m\0D\0A\00"
define void @test_warning(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\1B[93m%s\1B[0m\0D\0A\00"
define void @test_warning(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
bool multimap_isPowerOfTwo64(uint64_t value) {
  return (value & (value - 1)) == 0;
}


x86 assembly (clang, -O0):
<multimap_isPowerOfTwo64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<multimap_isPowerOfTwo64>:
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @multimap_isPowerOfTwo64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 1
%6 = and i32 %3, %5
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @multimap_isPowerOfTwo64(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = icmp ult i32 %2, 2
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int any_decrqss(char const *, char *);
int rpt_DECSTGLT(const char *the_title) { return any_decrqss(the_title, "){"); }


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

x86 assembly (clang, -O2):
<rpt_DECSTGLT>:
lea    0xee9(%rip),%rsi
jmp    1030 <any_decrqss@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"){\00"
define i32 @rpt_DECSTGLT(i8* %0) {
%2 = tail call i32 @any_decrqss(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMRAB_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMRAB_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMRAB_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strdup(const char *s) {
  char *str = (char *)malloc(strlen(s) + 1);
  if (!str)
    return NULL;
  strcpy(str, s);
  return str;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116d <strdup+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1182 <strdup+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115a <strdup+0x2a>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    115c <strdup+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %1
store i8* null, i8** %2
br label %18
13: ; preds = %1
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %4
store i8* %17, i8** %2
br label %18
18: ; preds = %13, %12
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %5, i8* %0)
br label %9
9: ; preds = %1, %7
%10 = phi i8* [ %5, %7 ], [ null, %1 ]
ret i8* %10
}
/* Variables and functions */
float powf(float, float);
float cbrtf(float x) { return powf(x, 1.f / 3.f); }


x86 assembly (clang, -O0):
<cbrtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xed6(%rip),%xmm1
call   1030 <powf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbrtf>:
movss  0xee8(%rip),%xmm1
jmp    1030 <powf@plt>

LLVM IR (-O0):
define float @cbrtf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @powf(float %3, float 0x3FD5555560000000)
ret float %4
}

LLVM IR (-O2):
define float @cbrtf(float %0) {
%2 = tail call float @powf(float %0, float 0x3FD5555560000000)
ret float %2
}
/* Variables and functions */
unsigned int *memmove(unsigned int *, unsigned int *, int);
unsigned int *umemmove(unsigned int *dest, unsigned int *src, int count) {
  return memmove(dest, src, count * sizeof(unsigned int));
}


x86 assembly (clang, -O0):
<umemmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umemmove>:
shl    $0x2,%edx
jmp    1030 <memmove@plt>

LLVM IR (-O0):
define i32* @umemmove(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = call i32* @memmove(i32* %7, i32* %8, i32 %12)
ret i32* %13
}

LLVM IR (-O2):
define i32* @umemmove(i32* %0, i32* %1, i32 %2) {
%4 = shl i32 %2, 2
%5 = tail call i32* @memmove(i32* %0, i32* %1, i32 %4)
ret i32* %5
}
/* Variables and functions */
int makeDynamic(int /*<<< orphan*/);
__attribute__((no)) int test4(int a, int b) {
  int i = makeDynamic(0);
  for (; i < a; i++)
    b += i;
  return b;
}


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <makeDynamic@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114b <test4+0x3b>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <test4+0x18>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
call   1030 <makeDynamic@plt>
cmp    %ebx,%eax
jge    1140 <test4+0x30>
mov    %eax,%ecx
not    %ecx
add    %ebx,%ecx
lea    0x1(%rax),%edx
imul   %ecx,%edx
sub    %eax,%ebx
add    $0xfffffffe,%ebx
imul   %rcx,%rbx
shr    %rbx
add    %eax,%ebp
add    %edx,%ebp
add    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @test4(i32 %0, i32 %1) {
%3 = tail call i32 @makeDynamic(i32 0)
%4 = icmp slt i32 %3, %0
br i1 %4, label %5, label %20
5: ; preds = %2
%6 = xor i32 %3, -1
%7 = add i32 %6, %0
%8 = add nsw i32 %3, 1
%9 = mul i32 %7, %8
%10 = zext i32 %7 to i33
%11 = add i32 %0, -2
%12 = sub i32 %11, %3
%13 = zext i32 %12 to i33
%14 = mul i33 %10, %13
%15 = lshr i33 %14, 1
%16 = trunc i33 %15 to i32
%17 = add i32 %3, %1
%18 = add i32 %17, %9
%19 = add i32 %18, %16
br label %20
20: ; preds = %5, %2
%21 = phi i32 [ %1, %2 ], [ %19, %5 ]
ret i32 %21
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRB6_get(void) { return U_WMRCORENONE_get("U_WMRB6"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRB6\00"
define i32 @U_WMRB6_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRB6\00"
define i32 @U_WMRB6_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
int ignore_line(char *line) {
  int i = 0;
  while (line[i] != '\n')
    i++;
  return ++i;
}


x86 assembly (clang, -O0):
<ignore_line>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1132 <ignore_line+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ignore_line+0xf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ignore_line>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0xa,(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <ignore_line+0x10>
ret

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

LLVM IR (-O2):
define i32 @ignore_line(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 10
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
%10 = add nuw nsw i32 %9, 1
ret i32 %10
}
int func4(void) { return 4; }


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

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

LLVM IR (-O0):
define i32 @func4() {
ret i32 4
}

LLVM IR (-O2):
define i32 @func4() {
ret i32 4
}
/* Variables and functions */
int const rand();
int random_integer(const int min, const int max) {
  if (max == min)
    return min;
  return rand() % (max - min + 1) + min;
}


x86 assembly (clang, -O0):
<random_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1135 <random_integer+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114e <random_integer+0x3e>
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0xc(%rbp),%ecx
sub    -0x8(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_integer>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%eax
mov    %esi,%ebp
sub    %edi,%ebp
je     112e <random_integer+0x1e>
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
add    $0x1,%ebp
cltd
idiv   %ebp
mov    %edx,%eax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_integer(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %4
store i32 %10, i32* %3
br label %20
11: ; preds = %2
%12 = call i32 (...) @rand()
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = sub nsw i32 %13, %14
%16 = add nsw i32 %15, 1
%17 = srem i32 %12, %16
%18 = load i32, i32* %4
%19 = add nsw i32 %17, %18
store i32 %19, i32* %3
br label %20
20: ; preds = %11, %9
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @random_integer(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, %0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i32 (...) @rand()
%6 = sub i32 1, %0
%7 = add i32 %6, %1
%8 = srem i32 %5, %7
%9 = add nsw i32 %8, %0
br label %10
10: ; preds = %2, %4
%11 = phi i32 [ %9, %4 ], [ %1, %2 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dot_header(char *s) {
  printf("graph %s {\n", s);
  printf("ranksep=\"0.25 equally\";\n");
  printf("node [shape=plaintext, fontname=\"courier\"]\n");
}


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

x86 assembly (clang, -O2):
<dot_header>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"graph %s {\0A\00"
@.str.1 = [25 x i8] c"ranksep=\220.25 equally\22;\0A\00"
@.str.2 = [44 x i8] c"node [shape=plaintext, fontname=\22courier\22]\0A\00"
define void @dot_header(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"graph %s {\0A\00"
@str = [24 x i8] c"ranksep=\220.25 equally\22;\00"
@str.3 = [43 x i8] c"node [shape=plaintext, fontname=\22courier\22]\00"
define void @dot_header(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.3, i64 0, i64 0))
ret void
}
int cmp_less_fp64(const void *p, const void *q) {
  const double a = *(const double *)p;
  const double b = *(const double *)q;
  if (a > b)
    return +1;
  if (b > a)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp_less_fp64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1142 <cmp_less_fp64+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1165 <cmp_less_fp64+0x65>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    115e <cmp_less_fp64+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1165 <cmp_less_fp64+0x65>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_less_fp64>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomisd %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp_less_fp64(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*
%10 = load double, double* %9
store double %10, double* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %24
18: ; preds = %2
%19 = load double, double* %7
%20 = load double, double* %6
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 -1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @cmp_less_fp64(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp ogt double %6, %4
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ ary_xfree(void *);
void ary_cb_freevoidptr(void *buf, void *userp) {
  (void)userp;
  ary_xfree(*(void **)buf);
}


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

x86 assembly (clang, -O2):
<ary_cb_freevoidptr>:
mov    (%rdi),%rdi
jmp    1030 <ary_xfree@plt>

LLVM IR (-O0):
define void @ary_cb_freevoidptr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
%8 = load i8*, i8** %7
%9 = call i32 @ary_xfree(i8* %8)
ret void
}

LLVM IR (-O2):
define void @ary_cb_freevoidptr(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = tail call i32 @ary_xfree(i8* %4)
ret void
}