xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t xenviron_allocsz(size_t nr_slots) {
  return (nr_slots + 1) * sizeof(char *);
}


x86 assembly (clang, -O0):
<xenviron_allocsz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
shl    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xenviron_allocsz>:
lea    0x8(,%rdi,8),%rax
ret

LLVM IR (-O0):
define i64 @xenviron_allocsz(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 1
%5 = mul i64 %4, 8
ret i64 %5
}

LLVM IR (-O2):
define i64 @xenviron_allocsz(i64 %0) {
%2 = shl i64 %0, 3
%3 = add i64 %2, 8
ret i64 %3
}
void nseel_asm_xor_op_end(void) {}


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

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

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

LLVM IR (-O2):
define void @nseel_asm_xor_op_end() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free_Tree_storage();
int /*<<< orphan*/ free_basis_s_storage();
int /*<<< orphan*/ free_fg_storage();
int /*<<< orphan*/ free_simplex_storage();
void free_hull_storage(void) {
  free_basis_s_storage();
  free_simplex_storage();
  free_Tree_storage();
  free_fg_storage();
}


x86 assembly (clang, -O0):
<free_hull_storage>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <free_basis_s_storage@plt>
mov    $0x0,%al
call   1050 <free_simplex_storage@plt>
mov    $0x0,%al
call   1060 <free_Tree_storage@plt>
mov    $0x0,%al
call   1040 <free_fg_storage@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_hull_storage>:
push   %rax
xor    %eax,%eax
call   1030 <free_basis_s_storage@plt>
xor    %eax,%eax
call   1050 <free_simplex_storage@plt>
xor    %eax,%eax
call   1060 <free_Tree_storage@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <free_fg_storage@plt>

LLVM IR (-O0):
define void @free_hull_storage() {
%1 = call i32 (...) @free_basis_s_storage()
%2 = call i32 (...) @free_simplex_storage()
%3 = call i32 (...) @free_Tree_storage()
%4 = call i32 (...) @free_fg_storage()
ret void
}

LLVM IR (-O2):
define void @free_hull_storage() {
%1 = tail call i32 (...) @free_basis_s_storage()
%2 = tail call i32 (...) @free_simplex_storage()
%3 = tail call i32 (...) @free_Tree_storage()
%4 = tail call i32 (...) @free_fg_storage()
ret void
}
int HelpItem106(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem106() {
ret i32 0
}
/* Variables and functions */
double M_PI;
double atan(double);
double sqrt(double);
double diffSphereToAlignedRect(double X, double Y) {
  return 0.25 * atan(X * Y / sqrt(1.0 + X * X + Y * Y)) / M_PI;
}


x86 assembly (clang, -O0):
<diffSphereToAlignedRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xeb1(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe72(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    0x2e4f(%rip),%rax
divsd  (%rax),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diffSphereToAlignedRect>:
push   %rax
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm0
addsd  0xecb(%rip),%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     1150 <diffSphereToAlignedRect+0x30>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1163 <diffSphereToAlignedRect+0x43>
movapd %xmm1,%xmm0
movsd  %xmm2,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
call   1030 <atan@plt>
mulsd  0xe90(%rip),%xmm0
mov    0x2e69(%rip),%rax
divsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @diffSphereToAlignedRect(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
%8 = load double, double* %3
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %8, double %9, double 1.000000e+00)
%11 = load double, double* %4
%12 = load double, double* %4
%13 = call double @llvm.fmuladd.f64(double %11, double %12, double %10)
%14 = call double @sqrt(double %13)
%15 = fdiv double %7, %14
%16 = call double @atan(double %15)
%17 = fmul double 2.500000e-01, %16
%18 = load double, double* @M_PI
%19 = fdiv double %17, %18
ret double %19
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @diffSphereToAlignedRect(double %0, double %1) {
%3 = fmul double %0, %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%5 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %4)
%6 = tail call double @sqrt(double %5)
%7 = fdiv double %3, %6
%8 = tail call double @atan(double %7)
%9 = fmul double %8, 2.500000e-01
%10 = load double, double* @M_PI
%11 = fdiv double %9, %10
ret double %11
}
/* Variables and functions */
void putinfo(char *data, size_t info) {
  int i;
  for (i = 0; i < 4; i++) {
    *data++ = (info >> 24) & 0xff;
    info <<= 8;
  }
}


x86 assembly (clang, -O0):
<putinfo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1158 <putinfo+0x58>
mov    -0x10(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <putinfo+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<putinfo>:
bswap  %esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @putinfo(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i64, i64* %4
%11 = lshr i64 %10, 24
%12 = and i64 %11, 255
%13 = trunc i64 %12 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
store i8 %13, i8* %14
%16 = load i64, i64* %4
%17 = shl i64 %16, 8
store i64 %17, i64* %4
br label %18
18: ; preds = %9
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @putinfo(i8* nocapture writeonly %0, i64 %1) {
%3 = lshr i64 %1, 24
%4 = trunc i64 %3 to i8
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %4, i8* %0
%6 = lshr i64 %1, 16
%7 = trunc i64 %6 to i8
%8 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %7, i8* %5
%9 = lshr i64 %1, 8
%10 = trunc i64 %9 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %10, i8* %8
%12 = trunc i64 %1 to i8
store i8 %12, i8* %11
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
size_t list_meter_uint32_t(const void *el) {
  if (el) {
  }
  return sizeof(uint32_t);
}


x86 assembly (clang, -O0):
<list_meter_uint32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1118 <list_meter_uint32_t+0x18>
jmp    1118 <list_meter_uint32_t+0x18>
mov    $0x4,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @list_meter_uint32_t(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 %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
ret i64 4
}

LLVM IR (-O2):
define i64 @list_meter_uint32_t(i8* nocapture readnone %0) {
ret i64 4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("\nusage: mount (/path/to/FLOPPY/IMG)\n\n"); }


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"\0Ausage: mount (/path/to/FLOPPY/IMG)\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [37 x i8] c"\0Ausage: mount (/path/to/FLOPPY/IMG)\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int EOF;
int char2id(int);
int getchar();
int get_next_char(void) {
  for (;;) {
    int input = getchar();
    int id;
    if (input == EOF)
      return -1;
    id = char2id(input);
    if (id >= 0)
      return id;
  }
}


x86 assembly (clang, -O0):
<get_next_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2eac(%rip),%rcx
cmp    (%rcx),%eax
jne    1150 <get_next_char+0x30>
movl   $0xffffffff,-0x4(%rbp)
jmp    1175 <get_next_char+0x55>
mov    -0x8(%rbp),%edi
call   1030 <char2id@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1170 <get_next_char+0x50>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1175 <get_next_char+0x55>
jmp    1128 <get_next_char+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_char>:
push   %rbx
mov    0x2ec0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1148 <get_next_char+0x28>
mov    %eax,%edi
call   1030 <char2id@plt>
test   %eax,%eax
js     1130 <get_next_char+0x10>
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @get_next_char() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
br label %4
4: ; preds = %17, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %4
store i32 -1, i32* %1
br label %18
10: ; preds = %4
%11 = load i32, i32* %2
%12 = call i32 @char2id(i32 %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load i32, i32* %3
store i32 %16, i32* %1
br label %18
17: ; preds = %10
br label %4
18: ; preds = %15, %9
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @get_next_char() {
br label %1
1: ; preds = %5, %0
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @char2id(i32 %2)
%7 = icmp slt i32 %6, 0
br i1 %7, label %1, label %8
8: ; preds = %1, %5
%9 = phi i32 [ %6, %5 ], [ -1, %1 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
scalar_t__ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ unix_error(char *);
void Sigemptyset(sigset_t *set) {
  if (sigemptyset(set) < 0)
    unix_error("Sigemptyset error");
  return;
}


x86 assembly (clang, -O0):
<Sigemptyset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sigemptyset@plt>
cmp    $0x0,%rax
jge    114b <Sigemptyset+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <unix_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sigemptyset>:
push   %rax
call   1030 <sigemptyset@plt>
test   %rax,%rax
js     112d <Sigemptyset+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1040 <unix_error@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Sigemptyset error\00"
define void @Sigemptyset(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @sigemptyset(i32* %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @unix_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Sigemptyset error\00"
define void @Sigemptyset(i32* %0) {
%2 = tail call i64 @sigemptyset(i32* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @unix_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int n = 7;
  int result = 0;
  result = fact(n);
  printf("The factorial of: %d = %d\n", n, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [27 x i8] c"The factorial of: %d = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @fact(i32 7)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 7, i32 %1)
ret i32 0
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ printf(char *);
long long strtol(char *, int /*<<< orphan*/ *, int);
int check_port(char *port) {
  long long ret = strtol(port, NULL, 10);
  if ((ret < 0) || (ret > 32767))
    return -1;
  if (errno) {
    printf("port error\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jl     115b <check_port+0x3b>
cmpq   $0x7fff,-0x18(%rbp)
jle    1167 <check_port+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    1197 <check_port+0x77>
mov    0x2e72(%rip),%rax
cmpq   $0x0,(%rax)
je     1190 <check_port+0x70>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1197 <check_port+0x77>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_port>:
push   %rbx
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
cmp    $0x7fff,%rax
ja     1150 <check_port+0x30>
mov    0x2ea2(%rip),%rax
cmpq   $0x0,(%rax)
je     1155 <check_port+0x35>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i64 0
@.str = [12 x i8] c"port error\0A\00"
define i32 @check_port(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strtol(i8* %5, i32* null, i32 10)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp slt i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i64, i64* %4
%11 = icmp sgt i64 %10, 32767
br i1 %11, label %12, label %13
12: ; preds = %9, %1
store i32 -1, i32* %2
br label %19
13: ; preds = %9
%14 = load i64, i64* @errno
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %19
18: ; preds = %13
store i32 0, i32* %2
br label %19
19: ; preds = %18, %16, %12
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@errno = global i64 0
@str = [11 x i8] c"port error\00"
define i32 @check_port(i8* nocapture %0) {
%2 = tail call i64 @strtol(i8* nocapture %0, i32* null, i32 10)
%3 = icmp ugt i64 %2, 32767
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = load i64, i64* @errno
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %4, %1, %7
%10 = phi i32 [ -1, %7 ], [ -1, %1 ], [ 0, %4 ]
ret i32 %10
}
int gcd(a, b) {
  if (b == 0) {
    return a;
  }
  int a_prime = a % b;
  return gcd(b, a_prime);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <gcd+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <gcd+0x3b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <gcd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int kmp_search(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  char *b = "abcsdfkcabcasdfkgjlab";
  char *c = "sdfkg";
  int *new;
  int i;
  i = kmp_search(b, c);
  printf("result: %d\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xedc(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <kmp_search@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xee7(%rip),%rsi
call   1040 <kmp_search@plt>
lea    0xee1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"abcsdfkcabcasdfkgjlab\00"
@.str.1 = [6 x i8] c"sdfkg\00"
@.str.2 = [12 x i8] c"result: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @kmp_search(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %1)
ret i32 0
}
void ff_hevc_put_hevc_bi_epel_v6_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_v6_10_sse4() {
ret void
}
int main(void) {
  unsigned long int *p = 0;
  *p = 42;
  return 0;
}


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

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64*
store i32 0, i32* %1
store i64* null, i64** %2
%3 = load i64*, i64** %2
store i64 42, i64* %3
ret i32 0
}

LLVM IR (-O2):
double outermost_planet(stellar_mass_ratio)
double stellar_mass_ratio;
{ return (50.0 * pow(stellar_mass_ratio, (1.0 / 3.0))); }


x86 assembly (clang, -O0):
<outermost_planet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xede(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xec6(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outermost_planet>:
push   %rax
movsd  0xee7(%rip),%xmm1
call   1030 <pow@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @outermost_planet(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @pow(double %3, double 0x3FD5555555555555)
%5 = fmul double 5.000000e+01, %4
ret double %5
}

LLVM IR (-O2):
define double @outermost_planet(double %0) {
%2 = tail call double @pow(double %0, double 0x3FD5555555555555)
%3 = fmul double %2, 5.000000e+01
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *cmd) {
  fprintf(stderr,
          "FLEX blank disk image creator\nUsage: %s [-t tracks] [-s sectors] "
          "[-n volname] [-v volnum] [-o filename] [-h]\n\ttracks is an "
          "integer, default 77, min 2\n\tsectors is an integer, default 15, "
          "min 5\n\tvolname is max 11 characters, default empty\n\tvolnum is "
          "an integer, default 0\n\tfilename may be (and defaults to) -, but "
          "won't output to the terminal\n\t-h prints this message\n",
          cmd);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [366 x i8] c"FLEX blank disk image creator\0AUsage: %s [-t tracks] [-s sectors] [-n volname] [-v volnum] [-o filename] [-h]\0A\09tracks is an integer, default 77, min 2\0A\09sectors is an integer, default 15, min 5\0A\09volname is max 11 characters, default empty\0A\09volnum is an integer, default 0\0A\09filename may be (and defaults to) -, but won't output to the terminal\0A\09-h prints this message\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([366 x i8], [366 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [366 x i8] c"FLEX blank disk image creator\0AUsage: %s [-t tracks] [-s sectors] [-n volname] [-v volnum] [-o filename] [-h]\0A\09tracks is an integer, default 77, min 2\0A\09sectors is an integer, default 15, min 5\0A\09volname is max 11 characters, default empty\0A\09volnum is an integer, default 0\0A\09filename may be (and defaults to) -, but won't output to the terminal\0A\09-h prints this message\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([366 x i8], [366 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
scalar_t__ strncasecmp(char *, char *, int);
int _os_strncmp(char *pattern, char *str, int str_len, int size) {
  if (strncasecmp(pattern, str, size) == 0)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<_os_strncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%rax
jne    114c <_os_strncmp+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1153 <_os_strncmp+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_os_strncmp>:
push   %rax
mov    %ecx,%edx
call   1030 <strncasecmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @_os_strncmp(i8* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = tail call i64 @strncasecmp(i8* %0, i8* %1, i32 %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
long unsigned int grecs_grecs_strlen(const char *grecs_grecs_str) {
  long unsigned int grecs_grecs_len;
  for (grecs_grecs_len = 0; grecs_grecs_str[grecs_grecs_len]; grecs_grecs_len++)
    continue;
  return grecs_grecs_len;
}


x86 assembly (clang, -O0):
<grecs_grecs_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1138 <grecs_grecs_strlen+0x38>
jmp    1127 <grecs_grecs_strlen+0x27>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <grecs_grecs_strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @grecs_grecs_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void exxit(int exitcode) { exit(exitcode); }


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

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

LLVM IR (-O0):
define void @exxit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
define void @exxit(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void xfree(void *ptr) {
  if (ptr != NULL)
    free(ptr);
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fwrite(void const *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int Fwrite(const void *ptr, int sizeOfElement, int numElements, FILE *fptr) {
  int retcode;
  retcode = fwrite(ptr, sizeOfElement, numElements, fptr);
  if (retcode != numElements) {
    fprintf(stderr, "Write error! Presume disk is full. Bye!\n");
    exit(2);
  }
  return (retcode);
}


x86 assembly (clang, -O0):
<Fwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1050 <fwrite@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1187 <Fwrite+0x57>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fwrite>:
push   %rbx
mov    %edx,%ebx
call   1050 <fwrite@plt>
cmp    %ebx,%eax
jne    1140 <Fwrite+0x10>
mov    %ebx,%eax
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"Write error! Presume disk is full. Bye!\0A\00"
define i32 @Fwrite(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32*, i32** %8
%14 = call i32 @fwrite(i8* %10, i32 %11, i32 %12, i32* %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i32, i32* %7
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %4
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @exit(i32 2)
unreachable
22: ; preds = %4
%23 = load i32, i32* %9
ret i32 %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"Write error! Presume disk is full. Bye!\0A\00"
define i32 @Fwrite(i8* nocapture %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = tail call i32 @fwrite(i8* %0, i32 %1, i32 %2, i32* %3)
%6 = icmp eq i32 %5, %2
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 2)
unreachable
11: ; preds = %4
ret i32 %2
}
char *simple_basename(char *path) {
  char *ptr;
  for (ptr = path; *ptr != '\0'; ++ptr) {
    if (*ptr == '/') {
      path = ptr + 1;
    }
  }
  return path;
}


x86 assembly (clang, -O0):
<simple_basename>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1152 <simple_basename+0x52>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    113c <simple_basename+0x3c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1141 <simple_basename+0x41>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <simple_basename+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_basename>:
mov    %rdi,%rax
lea    0x1(%rdi),%rcx
jmp    1117 <simple_basename+0x17>
nopl   0x0(%rax)
mov    %rcx,%rax
add    $0x1,%rcx
movzbl -0x1(%rcx),%edx
cmp    $0x2f,%dl
je     1110 <simple_basename+0x10>
test   %dl,%dl
jne    1113 <simple_basename+0x13>
ret

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

LLVM IR (-O2):
define i8* @simple_basename(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %9, %8 ]
%4 = phi i8* [ %0, %1 ], [ %10, %8 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %11
i8 47, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %4, i64 1
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %3, %2 ]
%10 = getelementptr inbounds i8, i8* %4, i64 1
br label %2
11: ; preds = %2
ret i8* %3
}
int setBit(unsigned char c, int i) {
  unsigned char mask = 1 << i;
  return mask | c;
}


x86 assembly (clang, -O0):
<setBit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setBit>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movzbl %al,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @setBit(i8 zeroext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i8
store i8 %0, i8* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = trunc i32 %7 to i8
store i8 %8, i8* %5
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @setBit(i8 zeroext %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = and i32 %3, 255
%5 = zext i8 %0 to i32
%6 = or i32 %4, %5
ret i32 %6
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int printlock_w39_common(struct flashrom_flashctx *, int);
int printlock_w39v040c(struct flashrom_flashctx *flash) {
  return printlock_w39_common(flash, 0xfff2);
}


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

x86 assembly (clang, -O2):
<printlock_w39v040c>:
mov    $0xfff2,%esi
jmp    1030 <printlock_w39_common@plt>

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @printlock_w39v040c(%struct.flashrom_flashctx* %0) {
%2 = alloca %struct.flashrom_flashctx*
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %2
%3 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %2
%4 = call i32 @printlock_w39_common(%struct.flashrom_flashctx* %3, i32 65522)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @printlock_w39v040c(%struct.flashrom_flashctx* %0) {
%2 = tail call i32 @printlock_w39_common(%struct.flashrom_flashctx* %0, i32 65522)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_key_t;

/* Variables and functions */
int errno;
int pthread_key_create(int /*<<< orphan*/ *, void *);
int tosTLS_keyCreate(pthread_key_t *key) {
  int res = 0;
  res = pthread_key_create(key, ((void *)0));
  if (res) {
    errno = res;
    res = -1;
  }
  return res;
}


x86 assembly (clang, -O0):
<tosTLS_keyCreate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <pthread_key_create@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1150 <tosTLS_keyCreate+0x40>
mov    -0xc(%rbp),%ecx
mov    0x2e99(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tosTLS_keyCreate>:
push   %rbx
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <pthread_key_create@plt>
test   %eax,%eax
je     112c <tosTLS_keyCreate+0x1c>
mov    0x2ebb(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @tosTLS_keyCreate(i32* %0) {
%2 = tail call i32 @pthread_key_create(i32* %0, i8* null)
%3 = icmp eq i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %1
store i32 %2, i32* @errno
br label %5
5: ; preds = %4, %1
%6 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *xmalloc(size_t);
char *xstrdup(const char *str) {
  char *p;
  size_t size;
  if (!str)
    return 0;
  size = strlen(str) + 1;
  p = xmalloc(size);
  strcpy(p, str);
  return p;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <xstrdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1188 <xstrdup+0x58>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
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):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115c <xstrdup+0x2c>
mov    %rdi,%rbx
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rdi
call   1050 <xmalloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    115f <xstrdup+0x2f>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = tail call i8* @xmalloc(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
br label %9
9: ; preds = %1, %3
%10 = phi i8* [ %7, %3 ], [ null, %1 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int, int);
void merge_sort(int A[], int p, int r) {
  int q;
  if (p < r) {
    q = (p + r) / 2;
    merge_sort(A, p, q);
    merge_sort(A, q + 1, r);
    merge(A, p, q, r);
  }
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <merge_sort+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    %edx,%esi
jge    1172 <merge_sort+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1040 <merge_sort@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1040 <merge_sort@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <merge@plt>
ret

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

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @merge_sort(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @merge_sort(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
void GC_PRINT() {}


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

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

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

LLVM IR (-O2):
define void @GC_PRINT() {
ret void
}
int test_int_4(int a, int b, int c, int d) { return 200997; }


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

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

LLVM IR (-O0):
define i32 @test_int_4(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 200997
}

LLVM IR (-O2):
define i32 @test_int_4(i32 %0, i32 %1, i32 %2, i32 %3) {
ret i32 200997
}
/* Variables and functions */
int /*<<< orphan*/ getrandom(char *, int);
int main() {
  char *buf;
  int buflen;
  buflen = 1024;
  getrandom(buf, buflen);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x400,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <getrandom@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x400,%esi
call   1030 <getrandom@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
store i32 1024, i32* %2
%3 = load i8*, i8** %1
%4 = load i32, i32* %2
%5 = call i32 @getrandom(i8* %3, i32 %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @getrandom(i8* undef, i32 1024)
ret i32 0
}
/* Variables and functions */
double strtod(char const *, int /*<<< orphan*/ *);
double atof(const char *s) { return strtod(s, NULL); }


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

x86 assembly (clang, -O2):
<atof>:
xor    %esi,%esi
jmp    1030 <strtod@plt>

LLVM IR (-O0):
define double @atof(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call double @strtod(i8* %3, i32* null)
ret double %4
}

LLVM IR (-O2):
define double @atof(i8* nocapture %0) {
%2 = tail call double @strtod(i8* nocapture %0, i32* null)
ret double %2
}
/* Variables and functions */
double exp(float);
float sinhf(float x) { return (exp(x) - exp(-x)) * 0.5; }


x86 assembly (clang, -O0):
<sinhf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xea9(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinhf>:
sub    $0x28,%rsp
movaps %xmm0,0x10(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xece(%rip),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xec7(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @sinhf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call double @exp(float %3)
%5 = load float, float* %2
%6 = fneg float %5
%7 = call double @exp(float %6)
%8 = fsub double %4, %7
%9 = fmul double %8, 5.000000e-01
%10 = fptrunc double %9 to float
ret float %10
}

LLVM IR (-O2):
define float @sinhf(float %0) {
%2 = tail call double @exp(float %0)
%3 = fneg float %0
%4 = tail call double @exp(float %3)
%5 = fsub double %2, %4
%6 = fmul double %5, 5.000000e-01
%7 = fptrunc double %6 to float
ret float %7
}
void ci_hdrc_host_driver_init(void) {}


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

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

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

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