xunge/DecIR huggingface dataset:
/* Variables and functions */
double __ocml_rcbrt_f64(double);
double rcbrt(double x) { return __ocml_rcbrt_f64(x); }


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

x86 assembly (clang, -O2):
<rcbrt>:
jmp    1030 <__ocml_rcbrt_f64@plt>

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

LLVM IR (-O2):
define double @rcbrt(double %0) {
%2 = tail call double @__ocml_rcbrt_f64(double %0)
ret double %2
}
/* Type definitions */
typedef int off;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
void put_be16(FILE *outfile, int off) {
  fputc((off >> 8) & 0xff, outfile);
  fputc((off)&0xff, outfile);
}


x86 assembly (clang, -O0):
<put_be16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
sar    $0x8,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <fputc@plt>
mov    -0xc(%rbp),%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_be16>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @put_be16(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 8
%7 = and i32 %6, 255
%8 = load i32*, i32** %3
%9 = call i32 @fputc(i32 %7, i32* %8)
%10 = load i32, i32* %4
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = call i32 @fputc(i32 %11, i32* %12)
ret void
}

LLVM IR (-O2):
define void @put_be16(i32* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = and i32 %3, 255
%5 = tail call i32 @fputc(i32 %4, i32* %0)
%6 = and i32 %1, 255
%7 = tail call i32 @fputc(i32 %6, i32* %0)
ret void
}
/* Variables and functions */
unsigned int fast_read(char const *, unsigned int);
size_t qlz_size_decompressed(const char *source) {
  unsigned int n, r;
  n = (((*source) & 2) == 2) ? 4 : 1;
  r = fast_read(source + 1 + n, n);
  r = r & (0xffffffff >> ((4 - n) * 8));
  return r;
}


x86 assembly (clang, -O0):
<qlz_size_decompressed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x2,%edx
mov    $0x1,%eax
mov    $0x4,%ecx
cmp    $0x2,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
call   1030 <fast_read@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
sub    -0xc(%rbp),%ecx
shl    $0x3,%ecx
mov    $0xffffffff,%edx
shr    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qlz_size_decompressed>:
push   %rbx
mov    (%rdi),%al
and    $0x2,%al
shr    %al
movzbl %al,%eax
lea    (%rax,%rax,2),%ebx
add    $0x1,%ebx
add    %rbx,%rdi
add    $0x1,%rdi
mov    %ebx,%esi
call   1030 <fast_read@plt>
shl    $0x3,%bl
neg    %bl
mov    %ebx,%ecx
shl    %cl,%eax
shr    %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @qlz_size_decompressed(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = and i32 %7, 2
%9 = icmp eq i32 %8, 2
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 4, i32 1
store i32 %11, i32* %3
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i32, i32* %3
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i32, i32* %3
%18 = call i32 @fast_read(i8* %16, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = sub i32 4, %20
%22 = mul i32 %21, 8
%23 = lshr i32 -1, %22
%24 = and i32 %19, %23
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = zext i32 %25 to i64
ret i64 %26
}

LLVM IR (-O2):
define i64 @qlz_size_decompressed(i8* %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 2
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 1, i32 4
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = zext i32 %5 to i64
%8 = getelementptr inbounds i8, i8* %6, i64 %7
%9 = tail call i32 @fast_read(i8* %8, i32 %5)
%10 = mul nsw i32 %5, -8
%11 = add nsw i32 %10, 32
%12 = lshr i32 -1, %11
%13 = and i32 %12, %9
%14 = zext i32 %13 to i64
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ erreur(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void mauvaisParametre(char *input, char *output, char *commande) {
  printf("** %s %s %s **\n", input, commande, output);
  erreur(32, 0);
}


x86 assembly (clang, -O0):
<mauvaisParametre>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x20,%edi
xor    %esi,%esi
call   1040 <erreur@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mauvaisParametre>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rsi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x20,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <erreur@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"** %s %s %s **\0A\00"
define void @mauvaisParametre(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %6
%9 = load i8*, i8** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %9)
%11 = call i32 @erreur(i32 32, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"** %s %s %s **\0A\00"
define void @mauvaisParametre(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %2, i8* %1)
%5 = tail call i32 @erreur(i32 32, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ heapify(int *, int, int);
void build_heap(int *arr) {
  int i;
  for (i = 100 / 2; i >= 0; i--) {
    heapify(arr, 100, i);
  }
}


x86 assembly (clang, -O0):
<build_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x32,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     114c <build_heap+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x64,%esi
call   1030 <heapify@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <build_heap+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_heap>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x32,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %ebp,%edx
call   1030 <heapify@plt>
add    $0xffffffff,%ebp
jb     1120 <build_heap+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @build_heap(i32* %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 50, %1 ], [ %5, %2 ]
%4 = tail call i32 @heapify(i32* %0, i32 100, i32 %3)
%5 = add nsw i32 %3, -1
%6 = icmp eq i32 %3, 0
br i1 %6, label %7, label %2
7: ; preds = %2
ret void
}
long long foo(int *a, int *b) { return *a + (long long)*b * 10; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
imul   $0xa,%rcx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movslq (%rdi),%rax
movslq (%rsi),%rcx
lea    (%rcx,%rcx,4),%rcx
lea    (%rax,%rcx,2),%rax
ret

LLVM IR (-O0):
define i64 @foo(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = mul nsw i64 %10, 10
%12 = add nsw i64 %7, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @foo(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = mul nsw i64 %6, 10
%8 = add nsw i64 %7, %4
ret i64 %8
}
int do_688() { return 688; }


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

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

LLVM IR (-O0):
define i32 @do_688() {
ret i32 688
}

LLVM IR (-O2):
define i32 @do_688() {
ret i32 688
}
/* Variables and functions */
scalar_t__ isspace(char const);
char *skip_whitespace(const char *s) {
  while (isspace(*s))
    s++;
  return (char *)s;
}


x86 assembly (clang, -O0):
<skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <skip_whitespace+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <skip_whitespace+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <skip_whitespace+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skip_whitespace(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ main_1();
int /*<<< orphan*/ puts(char *);
int main() {
  main_1();
  puts("\n\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @main_1()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void copyStr(char *pa, char *pb) {
  while (*pa != '\0') {
    *pb++ = *pa++;
  }
  *pb = '\0';
}


x86 assembly (clang, -O0):
<copyStr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1143 <copyStr+0x43>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    110c <copyStr+0xc>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyStr>:
mov    (%rdi),%al
test   %al,%al
je     1121 <copyStr+0x21>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rsi)
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <copyStr+0x10>
movb   $0x0,(%rsi)
ret

LLVM IR (-O0):
define void @copyStr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %10, %2
%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 %16
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
store i8 %13, i8* %14
br label %5
16: ; preds = %5
%17 = load i8*, i8** %4
store i8 0, i8* %17
ret void
}

LLVM IR (-O2):
define void @copyStr(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %1, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %7
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %1, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret void
}
void io_wait(void) { __asm__ __volatile__("outb %%al, $0x80" : : "a"(0)); }


x86 assembly (clang, -O0):
<io_wait>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
out    %al,$0x80
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_wait>:
xor    %eax,%eax
out    %al,$0x80
ret

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

LLVM IR (-O2):
define void @io_wait() {
tail call void asm sideeffect "outb %al, $$0x80", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 0)
ret void
}
/* Variables and functions */
int bis(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", bis(5, 4));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @bis(i32 5, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void ChargeDelay_Enable(void) {}


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

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

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

LLVM IR (-O2):
define void @ChargeDelay_Enable() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CountDown(int, int, int, int);
void Watch(int Time) { CountDown(Time, 6, 2, 2); }


x86 assembly (clang, -O0):
<Watch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x6,%esi
mov    $0x2,%ecx
mov    %ecx,%edx
call   1030 <CountDown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Watch>:
mov    $0x6,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
jmp    1030 <CountDown@plt>

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

LLVM IR (-O2):
define void @Watch(i32 %0) {
%2 = tail call i32 @CountDown(i32 %0, i32 6, i32 2, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Bar10(int, int, int, int, int, int, int /*<<< orphan*/, int,
                         int, int);
int main() {
  Bar10(6, 2, 4, 8, 1, 9, 0, 7, 3, 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x8,%ecx
mov    $0x1,%r8d
mov    $0x9,%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
movl   $0x7,0x8(%rsp)
movl   $0x3,0x10(%rsp)
movl   $0x5,0x18(%rsp)
call   1030 <Bar10@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x8,%ecx
mov    $0x1,%r8d
mov    $0x9,%r9d
push   $0x5
push   $0x3
push   $0x7
push   $0x0
call   1030 <Bar10@plt>
add    $0x20,%rsp
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @Bar10(i32 6, i32 2, i32 4, i32 8, i32 1, i32 9, i32 0, i32 7, i32 3, i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ init_bufs();
int /*<<< orphan*/ stop_here();
int main() {
  init_bufs();
  stop_here();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init_bufs()
%2 = tail call i32 (...) @stop_here()
ret i32 0
}
int test_imm_B8int8_mem(signed char *val) {
  return ((*val) & (-0xB8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B8int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff48,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B8int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -184
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
char *strcpy(char *dest, const char *src) {
  int i;
  for (i = 0; src[i]; i++) {
    dest[i] = src[i];
  }
  dest[i] = 0;
  return dest;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1149 <strcpy+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <strcpy+0x13>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1127 <strcpy+0x27>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <strcpy+0x10>
mov    %edx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret
xor    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = and i64 %9, 4294967295
br label %15
15: ; preds = %13, %2
%16 = phi i64 [ 0, %2 ], [ %14, %13 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 0, i8* %17
ret i8* %0
}
/* Variables and functions */
scalar_t__ chdir(char *);
scalar_t__ chroot(char *);
int Privsep_Chroot(char *path) {
  if (chdir(path) < 0)
    return (-1);
  if (chroot(path) < 0)
    return (-1);
  chdir("/");
  return (0);
}


x86 assembly (clang, -O0):
<Privsep_Chroot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <chdir@plt>
cmp    $0x0,%rax
jge    114b <Privsep_Chroot+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    117d <Privsep_Chroot+0x5d>
mov    -0x10(%rbp),%rdi
call   1030 <chroot@plt>
cmp    $0x0,%rax
jge    116a <Privsep_Chroot+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    117d <Privsep_Chroot+0x5d>
lea    0xe8f(%rip),%rdi
call   1040 <chdir@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Privsep_Chroot>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <chdir@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
js     1150 <Privsep_Chroot+0x30>
mov    %rbx,%rdi
call   1030 <chroot@plt>
test   %rax,%rax
js     1150 <Privsep_Chroot+0x30>
lea    0xeb7(%rip),%rdi
call   1040 <chdir@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define i32 @Privsep_Chroot(i8* %0) {
%2 = tail call i64 @chdir(i8* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i64 @chroot(i8* %0)
%6 = icmp slt i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i64 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %4, %1, %7
%10 = phi i32 [ 0, %7 ], [ -1, %1 ], [ -1, %4 ]
ret i32 %10
}
int get_DL_Status() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @get_DL_Status() {
ret i32 0
}
/* Variables and functions */
bool pos_gt_lim(const char *pos, const char *lim) { return pos > lim; }


x86 assembly (clang, -O0):
<pos_gt_lim>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pos_gt_lim>:
xor    %eax,%eax
cmp    %rsi,%rdi
seta   %al
ret

LLVM IR (-O0):
define i32 @pos_gt_lim(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 = load i8*, i8** %4
%7 = icmp ugt i8* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @pos_gt_lim(i8* readnone %0, i8* readnone %1) {
%3 = icmp ugt i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void yaml_get_version(int *major, int *minor, int *patch) {
  *major = 0;
  *minor = 1;
  *patch = 4;
}


x86 assembly (clang, -O0):
<yaml_get_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x4,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<yaml_get_version>:
movl   $0x0,(%rdi)
movl   $0x1,(%rsi)
movl   $0x4,(%rdx)
ret

LLVM IR (-O0):
define void @yaml_get_version(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
store i32 0, i32* %7
%8 = load i32*, i32** %5
store i32 1, i32* %8
%9 = load i32*, i32** %6
store i32 4, i32* %9
ret void
}

LLVM IR (-O2):
define void @yaml_get_version(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store i32 0, i32* %0
store i32 1, i32* %1
store i32 4, i32* %2
ret void
}
/* Variables and functions */
int mmap_tst7_func(char *, int);
int mmap_tst7(char *mnt) {
  int rc;
  rc = mmap_tst7_func(mnt, 0);
  if (rc != 0)
    return rc;
  rc = mmap_tst7_func(mnt, 1);
  return rc;
}


x86 assembly (clang, -O0):
<mmap_tst7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <mmap_tst7_func@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     113f <mmap_tst7+0x2f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <mmap_tst7+0x46>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <mmap_tst7_func@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmap_tst7>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <mmap_tst7_func@plt>
test   %eax,%eax
je     1121 <mmap_tst7+0x11>
pop    %rbx
ret
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <mmap_tst7_func@plt>

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

LLVM IR (-O2):
define i32 @mmap_tst7(i8* %0) {
%2 = tail call i32 @mmap_tst7_func(i8* %0, i32 0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @mmap_tst7_func(i8* %0, i32 1)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ *strncpy(char *, char const *, size_t);
int os_strncpy(char *strDest, size_t numberOfElements, const char *strSource,
               size_t count) {
  if (strncpy(strDest, strSource, count) == NULL) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<os_strncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <strncpy@plt>
cmp    $0x0,%rax
jne    114f <os_strncpy+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <os_strncpy+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_strncpy>:
push   %rax
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <strncpy@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @os_strncpy(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i64 %3, i64* %9
%10 = load i8*, i8** %6
%11 = load i8*, i8** %8
%12 = load i64, i64* %9
%13 = call i32* @strncpy(i8* %10, i8* %11, i64 %12)
%14 = icmp eq i32* %13, null
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_strncpy(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = tail call i32* @strncpy(i8* %0, i8* %2, i64 %3)
%6 = icmp eq i32* %5, null
%7 = sext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void ERROR(const char *msg) { fprintf(stderr, "%s\n", msg); }


x86 assembly (clang, -O0):
<ERROR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ERROR>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @ERROR(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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @ERROR(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
double _now_time();
double getcurrenttime_(void) { return _now_time() / 1.0e+6; }


x86 assembly (clang, -O0):
<getcurrenttime_>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <_now_time@plt>
movsd  0xedd(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcurrenttime_>:
push   %rax
xor    %eax,%eax
call   1030 <_now_time@plt>
divsd  0xee0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @getcurrenttime_() {
%1 = call double (...) @_now_time()
%2 = fdiv double %1, 1.000000e+06
ret double %2
}

LLVM IR (-O2):
define double @getcurrenttime_() {
%1 = tail call double (...) @_now_time()
%2 = fdiv double %1, 1.000000e+06
ret double %2
}
/* Variables and functions */
scalar_t__ cos(double);
float cosf(float x) { return (float)cos((double)x); }


x86 assembly (clang, -O0):
<cosf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <cos@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosf>:
push   %rax
cvtss2sd %xmm0,%xmm0
call   1030 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @cosf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call i64 @cos(double %4)
%6 = sitofp i64 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @cosf(float %0) {
%2 = fpext float %0 to double
%3 = tail call i64 @cos(double %2)
%4 = sitofp i64 %3 to float
ret float %4
}
int lens_dist_value_cmp(const void *lhs, const void *rhs) {
  return *((double *)lhs) - *((double *)rhs);
}


x86 assembly (clang, -O0):
<lens_dist_value_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lens_dist_value_cmp>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @lens_dist_value_cmp(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 double*
%7 = load double, double* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = fptosi double %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @lens_dist_value_cmp(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 = fsub double %4, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Variables and functions */
bool isLocalName(const char *name) { return name[0] >= 'a' && name[0] <= 'z'; }


x86 assembly (clang, -O0):
<isLocalName>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x9(%rbp)
jl     112d <isLocalName+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLocalName>:
mov    (%rdi),%cl
add    $0x9f,%cl
xor    %eax,%eax
cmp    $0x1a,%cl
setb   %al
ret

LLVM IR (-O0):
define i32 @isLocalName(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 97
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sle i32 %12, 122
br label %14
14: ; preds = %8, %1
%15 = phi i1 [ false, %1 ], [ %13, %8 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @isLocalName(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -97
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
int clampi(int x, int min, int max) {
  if (x < min)
    x = min;
  if (x > max)
    x = max;
  return x;
}


x86 assembly (clang, -O0):
<clampi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    111f <clampi+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1131 <clampi+0x31>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clampi>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
cmp    %edx,%eax
cmovg  %edx,%eax
ret

LLVM IR (-O0):
define i32 @clampi(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 = icmp slt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i32, i32* %5
store i32 %11, i32* %4
br label %12
12: ; preds = %10, %3
%13 = load i32, i32* %4
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i32, i32* %6
store i32 %17, i32* %4
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @clampi(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
free_vector(v, nl, nh) int nl, nh;
float *v;
{ free((char *)(v + nl)); }


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

x86 assembly (clang, -O2):
<free_vector>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define i32 @free_vector(float* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32
store float* %0, float** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load float*, float** %5
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds float, float* %8, i64 %10
%12 = bitcast float* %11 to i8*
%13 = load i32, i32* %4
ret i32 %13
}

LLVM IR (-O2):
define i32 @free_vector(float* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds float, float* %0, i64 %4
%6 = bitcast float* %5 to i8*
tail call void @free(i8* %6)
ret i32 undef
}
/* Variables and functions */
int gbser_read_wait(void *, unsigned char *, int, unsigned int);
int gbser_readc_wait(void *handle, unsigned ms) {
  unsigned char buf;
  int rc;
  rc = gbser_read_wait(handle, &buf, 1, ms);
  if (rc > 0) {
    return buf;
  } else if (rc == 0) {
    return -1;
  } else {
    return -3;
  }
}


x86 assembly (clang, -O0):
<gbser_readc_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    -0x15(%rbp),%rsi
mov    $0x1,%edx
call   1030 <gbser_read_wait@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    114d <gbser_readc_wait+0x3d>
movzbl -0x15(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <gbser_readc_wait+0x5a>
cmpl   $0x0,-0x1c(%rbp)
jne    1163 <gbser_readc_wait+0x53>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <gbser_readc_wait+0x5a>
movl   $0xfffffffd,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gbser_readc_wait>:
push   %rax
mov    %esi,%ecx
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <gbser_read_wait@plt>
cmp    $0x1,%eax
sbb    %ecx,%ecx
or     $0xfffffffd,%ecx
test   %eax,%eax
movzbl 0x7(%rsp),%eax
cmovle %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @gbser_readc_wait(i8* %0, i32 %1) {
%3 = alloca i8
%4 = call i32 @gbser_read_wait(i8* %0, i8* %3, i32 1, i32 %1)
%5 = icmp sgt i32 %4, 0
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = icmp eq i32 %4, 0
%9 = select i1 %8, i32 -1, i32 -3
%10 = select i1 %5, i32 %7, i32 %9
ret i32 %10
}
void Sound(int hz) {}


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

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

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

LLVM IR (-O2):
define void @Sound(i32 %0) {
ret void
}
/* Variables and functions */
int sin_fixed(int);
int cos_fixed(int which) {
  which = which + 16;
  return sin_fixed(which);
}


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

x86 assembly (clang, -O2):
<cos_fixed>:
add    $0x10,%edi
jmp    1030 <sin_fixed@plt>

LLVM IR (-O0):
define i32 @cos_fixed(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 16
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @sin_fixed(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @cos_fixed(i32 %0) {
%2 = add nsw i32 %0, 16
%3 = tail call i32 @sin_fixed(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void system_reboot() { system("sleep 5; shutdown -r now"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"sleep 5; shutdown -r now\00"
define void @system_reboot() {
%1 = call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"sleep 5; shutdown -r now\00"
define void @system_reboot() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
void add(int *i, char *c) {
  *i = *i + *c;
  if (*i >= 256) {
    *i = 0;
  }
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x100,(%rax)
jl     113b <add+0x3b>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
movsbl (%rsi),%eax
add    (%rdi),%eax
xor    %ecx,%ecx
cmp    $0x100,%eax
cmovl  %eax,%ecx
mov    %ecx,(%rdi)
ret

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

LLVM IR (-O2):
define void @add(i32* nocapture %0, i8* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = add nsw i32 %3, %5
%7 = icmp sgt i32 %6, 255
%8 = select i1 %7, i32 0, i32 %6
store i32 %8, i32* %0
ret void
}
void disable_netdump(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<disable_netdump>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_netdump>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.disable_netdump = [16 x i8] c"disable_netdump\00"
define void @disable_netdump() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.disable_netdump, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.disable_netdump = [16 x i8] c"disable_netdump\00"
define void @disable_netdump() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.disable_netdump, i64 0, i64 0))
ret void
}
int soma_diagonal_s(int mat[10][10]) {
  int i, j, soma = 0;
  for (i = 0; i < 10; i++) {
    soma += mat[i][(10 - 1) - i];
  }
  return soma;
}


x86 assembly (clang, -O0):
<soma_diagonal_s>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1151 <soma_diagonal_s+0x51>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    $0x9,%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <soma_diagonal_s+0x16>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<soma_diagonal_s>:
mov    0x48(%rdi),%eax
add    0x24(%rdi),%eax
add    0x6c(%rdi),%eax
add    0x90(%rdi),%eax
add    0xb4(%rdi),%eax
add    0xd8(%rdi),%eax
add    0xfc(%rdi),%eax
add    0x120(%rdi),%eax
add    0x144(%rdi),%eax
add    0x168(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @soma_diagonal_s([10 x i32]* nocapture %0) {
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 0, i64 9
%3 = load i32, i32* %2
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 1, i64 8
%5 = load i32, i32* %4
%6 = add nsw i32 %5, %3
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 2, i64 7
%8 = load i32, i32* %7
%9 = add nsw i32 %8, %6
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 3, i64 6
%11 = load i32, i32* %10
%12 = add nsw i32 %11, %9
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 4, i64 5
%14 = load i32, i32* %13
%15 = add nsw i32 %14, %12
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 5, i64 4
%17 = load i32, i32* %16
%18 = add nsw i32 %17, %15
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 6, i64 3
%20 = load i32, i32* %19
%21 = add nsw i32 %20, %18
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 7, i64 2
%23 = load i32, i32* %22
%24 = add nsw i32 %23, %21
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 8, i64 1
%26 = load i32, i32* %25
%27 = add nsw i32 %26, %24
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 9, i64 0
%29 = load i32, i32* %28
%30 = add nsw i32 %29, %27
ret i32 %30
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void qfunc() { printf("qfunc()\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"qfunc()\00"
define void @qfunc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}