xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ gc1(char *);
int /*<<< orphan*/ gc2(char *);
void gc_(void) {
  gc1("user requested");
  gc2("user requested");
}


x86 assembly (clang, -O0):
<gc_>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <gc1@plt>
lea    0xec9(%rip),%rdi
call   1040 <gc2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gc_>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <gc1@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <gc2@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"user requested\00"
define void @gc_() {
%1 = call i32 @gc1(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @gc2(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"user requested\00"
define void @gc_() {
%1 = tail call i32 @gc1(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @gc2(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nice(int);
int main() {
  nice(20);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @nice(i32 20)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
void _read_word(FILE *f, int *i) {
  char c, d;
  fscanf(f, "%c%c", &c, &d);
  *i = ((int)c) | (((int)d) << 8);
}


x86 assembly (clang, -O0):
<_read_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
lea    -0x11(%rbp),%rdx
lea    -0x12(%rbp),%rcx
call   1030 <fscanf@plt>
movsbl -0x11(%rbp),%ecx
movsbl -0x12(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read_word>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xee1(%rip),%rsi
lea    0xf(%rsp),%rdx
lea    0xe(%rsp),%rcx
call   1030 <fscanf@plt>
movsbl 0xf(%rsp),%eax
movsbl 0xe(%rsp),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%c%c\00"
define void @_read_word(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
%6 = alloca i8
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %3
%8 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = load i8, i8* %6
%12 = sext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = or i32 %10, %13
%15 = load i32*, i32** %4
store i32 %14, i32* %15
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c%c\00"
define void @_read_word(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca i8
%4 = alloca i8
%5 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = shl nsw i32 %9, 8
%11 = or i32 %10, %7
store i32 %11, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_csharp_comment_entities();
int /*<<< orphan*/ test_csharp_comments();
void all_csharp_tests() {
  test_csharp_comments();
  test_csharp_comment_entities();
}


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

x86 assembly (clang, -O2):
<all_csharp_tests>:
push   %rax
xor    %eax,%eax
call   1030 <test_csharp_comments@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <test_csharp_comment_entities@plt>

LLVM IR (-O0):
define void @all_csharp_tests() {
%1 = call i32 (...) @test_csharp_comments()
%2 = call i32 (...) @test_csharp_comment_entities()
ret void
}

LLVM IR (-O2):
define void @all_csharp_tests() {
%1 = tail call i32 (...) @test_csharp_comments()
%2 = tail call i32 (...) @test_csharp_comment_entities()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, ...);
int main() {
  printf("%s:%d\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/hellobbn/C-X_NEW/refs/heads/master/MOOC/"
         "C11.x/C11-2-1.c",
         18);
  printf("%s,%s\n", "Mar 15 2022", "23:13:13");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xeda(%rip),%rsi
mov    $0x12,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf59(%rip),%rdi
lea    0xf59(%rip),%rsi
lea    0xf5e(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee8(%rip),%rsi
mov    $0x12,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf67(%rip),%rdi
lea    0xf67(%rip),%rsi
lea    0xf6c(%rip),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s:%d\0A\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hellobbn/C-X_NEW/refs/heads/master/MOOC/C11.x/C11-2-1.c\00"
@.str.2 = [7 x i8] c"%s,%s\0A\00"
@.str.3 = [12 x i8] c"Mar 15 2022\00"
@.str.4 = [9 x i8] c"23:13:13\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 18)
%3 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s:%d\0A\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hellobbn/C-X_NEW/refs/heads/master/MOOC/C11.x/C11-2-1.c\00"
@.str.2 = [7 x i8] c"%s,%s\0A\00"
@.str.3 = [12 x i8] c"Mar 15 2022\00"
@.str.4 = [9 x i8] c"23:13:13\00"
define i32 @main() {
%1 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 18)
%2 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
int /*<<< orphan*/ usage(char *);
void userErrorIntIntInt(char *format, int var1, int var2, int var3) {
  char userErrorMsg[1000];
  sprintf(userErrorMsg, format, var1, var2, var3);
  usage(userErrorMsg);
}


x86 assembly (clang, -O0):
<userErrorIntIntInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1040 <sprintf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <usage@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<userErrorIntIntInt>:
push   %rbx
sub    $0x3f0,%rsp
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <usage@plt>
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @userErrorIntIntInt(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1000 x i8]
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = call i32 @sprintf(i8* %10, i8* %11, i32 %12, i32 %13, i32 %14)
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%17 = call i32 @usage(i8* %16)
ret void
}

LLVM IR (-O2):
define void @userErrorIntIntInt(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [1000 x i8]
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) %0, i32 %1, i32 %2, i32 %3)
%8 = call i32 @usage(i8* %6)
ret void
}
unsigned short inw(unsigned short port) {
  unsigned short _v;
  __asm__ __volatile__("inw %w1,%0" : "=a"(_v) : "Nd"(port));
  return _v;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
/* Variables and functions */
unsigned int first_frame();
int /*<<< orphan*/ mapped_page(unsigned int, unsigned int);
void nonidentity_page(unsigned int page_index) {
  unsigned int phy_addr = first_frame();
  mapped_page(page_index, phy_addr);
}


x86 assembly (clang, -O0):
<nonidentity_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <first_frame@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <mapped_page@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonidentity_page>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <first_frame@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <mapped_page@plt>

LLVM IR (-O0):
define void @nonidentity_page(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @first_frame()
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @mapped_page(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @nonidentity_page(i32 %0) {
%2 = tail call i32 (...) @first_frame()
%3 = tail call i32 @mapped_page(i32 %0, i32 %2)
ret void
}
/* Variables and functions */
unsigned long fib(unsigned long);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  register unsigned long IMax, value;
  IMax = 30;
  printf("\n");
  printf("Fibonacci Benchmark\n");
  value = fib(IMax);
  printf("\n");
  printf("The %02ld'th Fibonacci Number is: %ld\n", IMax, value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1e,-0x10(%rbp)
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fib@plt>
mov    %rax,-0x18(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1e,%edi
call   1060 <fib@plt>
mov    %rax,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe8b(%rip),%rdi
mov    $0x1e,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [21 x i8] c"Fibonacci Benchmark\0A\00"
@.str.2 = [39 x i8] c"The %02ld'th Fibonacci Number is: %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 30, i64* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%6 = load i64, i64* %2
%7 = call i64 @fib(i64 %6)
store i64 %7, i64* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = load i64, i64* %2
%10 = load i64, i64* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i64 %9, i64 %10)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [39 x i8] c"The %02ld'th Fibonacci Number is: %ld\0A\00"
@str = [20 x i8] c"Fibonacci Benchmark\00"
define i32 @main() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = tail call i64 @fib(i64 30)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i64 30, i64 %3)
ret i32 0
}
int ft_lenword(const char *s, char c) {
  int i;
  i = 0;
  while (s[i] != c && s[i] != '\0')
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<ft_lenword>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
movsbl -0x9(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     1147 <ft_lenword+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1157 <ft_lenword+0x57>
jmp    1165 <ft_lenword+0x65>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1115 <ft_lenword+0x15>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_lenword>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rdi),%ecx
add    $0x1,%eax
cmp    %sil,%cl
je     1123 <ft_lenword+0x23>
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ft_lenword+0x10>
ret

LLVM IR (-O0):
define i32 @ft_lenword(i8* %0, i8 signext %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 = %26, %2
%7 = load i8*, i8** %3
%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 = sext i8 %11 to i32
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %12, %14
br i1 %15, label %16, label %24
16: ; preds = %6
%17 = load i8*, i8** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br label %24
24: ; preds = %16, %6
%25 = phi i1 [ false, %6 ], [ %23, %16 ]
br i1 %25, label %26, label %29
26: ; preds = %24
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %6
29: ; preds = %24
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @ft_lenword(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %10, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, %1
%8 = icmp eq i8 %6, 0
%9 = or i1 %7, %8
%10 = add nuw i64 %4, 1
br i1 %9, label %11, label %3
11: ; preds = %3
%12 = trunc i64 %4 to i32
ret i32 %12
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int KeyItem(uint32_t Item) { return ((Item >> 12) ^ Item) & 0x1FFF; }


x86 assembly (clang, -O0):
<KeyItem>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xc,%eax
xor    -0x4(%rbp),%eax
and    $0x1fff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<KeyItem>:
mov    %edi,%eax
shr    $0xc,%eax
xor    %edi,%eax
and    $0x1fff,%eax
ret

LLVM IR (-O0):
define i32 @KeyItem(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 12
%5 = load i32, i32* %2
%6 = xor i32 %4, %5
%7 = and i32 %6, 8191
ret i32 %7
}

LLVM IR (-O2):
define i32 @KeyItem(i32 %0) {
%2 = lshr i32 %0, 12
%3 = xor i32 %2, %0
%4 = and i32 %3, 8191
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Atm128AlarmC__0__HplAtm128Compare__fired();
void HplAtm128Timer1P__CompareA__fired(void) {
  Atm128AlarmC__0__HplAtm128Compare__fired();
}


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

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

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

LLVM IR (-O2):
define void @HplAtm128Timer1P__CompareA__fired() {
%1 = tail call i32 (...) @Atm128AlarmC__0__HplAtm128Compare__fired()
ret void
}
int go() {
  int i = 1;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @go() {
ret i32 0
}
/* Variables and functions */
int medium_leaf(int);
int medium_func(int arg) {
  int array[20];
  array[arg] = medium_leaf(arg);
  return array[arg];
}


x86 assembly (clang, -O0):
<medium_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <medium_leaf@plt>
mov    %eax,%ecx
movslq -0x4(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
movslq -0x4(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<medium_func>:
jmp    1030 <medium_leaf@plt>

LLVM IR (-O0):
define i32 @medium_func(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @medium_leaf(i32 %4)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %7
store i32 %5, i32* %8
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %10
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @medium_func(i32 %0) {
%2 = tail call i32 @medium_leaf(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_25519_add(uintptr_t, uintptr_t, uintptr_t);
void fiat_25519_add(uint32_t out1[10], const uint32_t arg1[10],
                    const uint32_t arg2[10]) {
  internal_fiat_25519_add((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2);
}


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

x86 assembly (clang, -O2):
<fiat_25519_add>:
jmp    1030 <internal_fiat_25519_add@plt>

LLVM IR (-O0):
define void @fiat_25519_add(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 = ptrtoint i32* %7 to i64
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i32*, i32** %6
%12 = ptrtoint i32* %11 to i64
%13 = call i32 @internal_fiat_25519_add(i64 %8, i64 %10, i64 %12)
ret void
}

LLVM IR (-O2):
define void @fiat_25519_add(i32* %0, i32* %1, i32* %2) {
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = tail call i32 @internal_fiat_25519_add(i64 %4, i64 %5, i64 %6)
ret void
}
int test_imm_48int32_reg(int val) { return ((val) & (0x48 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_48int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x48,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_48int32_reg>:
test   $0x48,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_48int32_reg(i32 %0) {
%2 = and i32 %0, 72
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
float Limit_Pitch(float step, float pitch) {
  if (pitch < (-50 * 0.01745329) && step > 0) {
    step = 0.0;
  }
  if (pitch > (90 * 0.01745329) && step < 0) {
    step = 0.0;
  }
  return step;
}


x86 assembly (clang, -O0):
<Limit_Pitch>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xee1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1142 <Limit_Pitch+0x42>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1142 <Limit_Pitch+0x42>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1172 <Limit_Pitch+0x72>
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1172 <Limit_Pitch+0x72>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Limit_Pitch>:
movaps %xmm0,%xmm2
cvtss2sd %xmm1,%xmm3
movsd  0xef1(%rip),%xmm0
ucomisd %xmm3,%xmm0
xorpd  %xmm0,%xmm0
xorps  %xmm1,%xmm1
cmpltss %xmm2,%xmm1
xorps  %xmm4,%xmm4
ja     1127 <Limit_Pitch+0x27>
movaps %xmm2,%xmm4
andps  %xmm1,%xmm4
andnps %xmm2,%xmm1
orps   %xmm4,%xmm1
ucomisd 0xed0(%rip),%xmm3
ja     113e <Limit_Pitch+0x3e>
movaps %xmm1,%xmm0
ret
maxss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @Limit_Pitch(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = fpext float %5 to double
%7 = fcmp olt double %6, 0xBFEBECDE19FC2A88
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load float, float* %3
%10 = fcmp ogt float %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store float 0.000000e+00, float* %3
br label %12
12: ; preds = %11, %8, %2
%13 = load float, float* %4
%14 = fpext float %13 to double
%15 = fcmp ogt double %14, 0x3FF921FB1762F314
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load float, float* %3
%18 = fcmp olt float %17, 0.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %16
store float 0.000000e+00, float* %3
br label %20
20: ; preds = %19, %16, %12
%21 = load float, float* %3
ret float %21
}

LLVM IR (-O2):
define float @Limit_Pitch(float %0, float %1) {
%3 = fpext float %1 to double
%4 = fcmp olt double %3, 0xBFEBECDE19FC2A88
%5 = fcmp ogt float %0, 0.000000e+00
%6 = and i1 %5, %4
%7 = select i1 %6, float 0.000000e+00, float %0
%8 = fcmp ogt double %3, 0x3FF921FB1762F314
%9 = fcmp olt float %7, 0.000000e+00
%10 = and i1 %8, %9
%11 = select i1 %10, float 0.000000e+00, float %7
ret float %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char *, char *, char *);
int print_version(const char *prog) {
  printf("%s (%s build on %s at %s)\n", prog,
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/master/busio.c",
         "Mar 18 2022", "20:27:02");
  return 0;
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
lea    0xeed(%rip),%rdx
lea    0xf66(%rip),%rcx
lea    0xf6b(%rip),%r8
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
lea    0xef9(%rip),%rdx
lea    0xf72(%rip),%rcx
lea    0xf77(%rip),%r8
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"%s (%s build on %s at %s)\0A\00"
@.str.1 = [128 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/master/busio.c\00"
@.str.2 = [12 x i8] c"Mar 18 2022\00"
@.str.3 = [9 x i8] c"20:27:02\00"
define i32 @print_version(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"%s (%s build on %s at %s)\0A\00"
@.str.1 = [128 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/master/busio.c\00"
@.str.2 = [12 x i8] c"Mar 18 2022\00"
@.str.3 = [9 x i8] c"20:27:02\00"
define i32 @print_version(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
int sumOfDigits(int N) {
  int a, sum = 0;
  while (N > 0) {
    a = N % 10;
    sum += a;
    N /= 10;
  }
  return sum;
}


x86 assembly (clang, -O0):
<sumOfDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1142 <sumOfDigits+0x42>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <sumOfDigits+0xe>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfDigits>:
xor    %eax,%eax
test   %edi,%edi
jle    112d <sumOfDigits+0x2d>
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
add    %ecx,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <sumOfDigits+0x10>
ret

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

LLVM IR (-O2):
define i32 @sumOfDigits(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = urem i32 %5, 10
%7 = add nuw nsw i32 %4, %6
%8 = udiv i32 %5, 10
%9 = icmp ult i32 %5, 10
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Type definitions */
struct lwan_strbuf {
  int dummy;
};

/* Variables and functions */
int lwan_strbuf_append_str(struct lwan_strbuf *, char const *,
                           int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
bool lwan_strbuf_append_strz(struct lwan_strbuf *s1, const char *s2) {
  return lwan_strbuf_append_str(s1, s2, strlen(s2));
}


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

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

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

LLVM IR (-O2):
%struct.lwan_strbuf = type { i32 }
define i32 @lwan_strbuf_append_strz(%struct.lwan_strbuf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @lwan_strbuf_append_str(%struct.lwan_strbuf* %0, i8* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
void *__talloc_steal(void const *, void const *);
int /*<<< orphan*/ lock();
int /*<<< orphan*/ unlock();
void *_talloc_steal(const void *new_ctx, const void *ptr) {
  void *p;
  lock();
  p = __talloc_steal(new_ctx, ptr);
  unlock();
  return p;
}


x86 assembly (clang, -O0):
<_talloc_steal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <lock@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <__talloc_steal@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <unlock@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_talloc_steal>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <lock@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <__talloc_steal@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <unlock@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @_talloc_steal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 (...) @lock()
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i8* @__talloc_steal(i8* %7, i8* %8)
store i8* %9, i8** %5
%10 = call i32 (...) @unlock()
%11 = load i8*, i8** %5
ret i8* %11
}

LLVM IR (-O2):
define i8* @_talloc_steal(i8* %0, i8* %1) {
%3 = tail call i32 (...) @lock()
%4 = tail call i8* @__talloc_steal(i8* %0, i8* %1)
%5 = tail call i32 (...) @unlock()
ret i8* %4
}
void AAS_PrintTravelType(int traveltype) {}


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

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

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

LLVM IR (-O2):
define void @AAS_PrintTravelType(i32 %0) {
ret void
}
extern void pcibios_penalize_isa_irq(int irq) {}


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

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

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

LLVM IR (-O2):
define void @pcibios_penalize_isa_irq(i32 %0) {
ret void
}
double test2(double a) { return __builtin_fabs(a); }


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @test2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fabs.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @test2(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ calltrap(int);
int Reset(void) { calltrap(4); }


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

x86 assembly (clang, -O2):
<Reset>:
mov    $0x4,%edi
jmp    1030 <calltrap@plt>

LLVM IR (-O0):
define i32 @Reset() {
%1 = alloca i32
%2 = call i32 @calltrap(i32 4)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @Reset() {
%1 = tail call i32 @calltrap(i32 4)
ret i32 undef
}
/* Variables and functions */
int isPerfect(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int t;
  for (int i = 1; i < 9999; i++)
    if ((t = isPerfect(i))) {
      printf("It's a perfect number : %d.\n", t);
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x270f,-0x18(%rbp)
jge    1180 <main+0x60>
mov    -0x18(%rbp),%edi
call   1030 <isPerfect@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     116d <main+0x4d>
mov    -0x14(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
jmp    1172 <main+0x52>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xed0(%rip),%r14
jmp    114b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x270f,%ebx
je     1162 <main+0x42>
mov    %ebx,%edi
call   1030 <isPerfect@plt>
test   %eax,%eax
je     1140 <main+0x20>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"It's a perfect number : %d.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
br label %8
8: ; preds = %19, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 9999
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %7
%13 = call i32 @isPerfect(i32 %12)
store i32 %13, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %11
br label %19
19: ; preds = %18
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %8
22: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"It's a perfect number : %d.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %4
3: ; preds = %10
ret i32 0
4: ; preds = %2, %10
%5 = phi i32 [ 1, %2 ], [ %11, %10 ]
%6 = tail call i32 @isPerfect(i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %10
10: ; preds = %4, %8
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, 9999
br i1 %12, label %3, label %4
}
void swap(double *v, int i, int j) {
  double temp = v[i];
  v[i] = v[j];
  v[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
movsd  (%rdi,%rax,8),%xmm0
movslq %edx,%rcx
movsd  (%rdi,%rcx,8),%xmm1
movsd  %xmm1,(%rdi,%rax,8)
movsd  %xmm0,(%rdi,%rcx,8)
ret

LLVM IR (-O0):
define void @swap(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load double*, double** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %8, i64 %10
%12 = load double, double* %11
store double %12, double* %7
%13 = load double*, double** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
store double %17, double* %21
%22 = load double, double* %7
%23 = load double*, double** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double %22, double* %26
ret void
}

LLVM IR (-O2):
define void @swap(double* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = load double, double* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
store double %9, double* %5
store double %6, double* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *new_thread(void *args) {
  printf("New thread starting.  Running infinite loop\n");
  volatile int i = 0;
  while (1) {
    i = (((i * 11) / 7) << 1) >> 1;
  }
}


x86 assembly (clang, -O0):
<new_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   $0xb,%eax,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
sar    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
jmp    112f <new_thread+0x1f>

x86 assembly (clang, -O2):
<new_thread>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x4(%rsp),%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%eax
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
mov    %eax,0x4(%rsp)
jmp    1130 <new_thread+0x20>

LLVM IR (-O0):
@.str = [45 x i8] c"New thread starting. Running infinite loop\0A\00"
define i8* @new_thread(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store volatile i32 0, i32* %3
br label %5
5: ; preds = %1, %5
%6 = load volatile i32, i32* %3
%7 = mul nsw i32 %6, 11
%8 = sdiv i32 %7, 7
%9 = shl i32 %8, 1
%10 = ashr i32 %9, 1
store volatile i32 %10, i32* %3
br label %5
}

LLVM IR (-O2):
@str = [44 x i8] c"New thread starting. Running infinite loop\00"
define noalias i8* @new_thread(i8* nocapture readnone %0) {
%2 = alloca i32
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%4 = bitcast i32* %2 to i8*
store volatile i32 0, i32* %2
br label %5
5: ; preds = %5, %1
%6 = load volatile i32, i32* %2
%7 = mul nsw i32 %6, 11
%8 = sdiv i32 %7, 7
store volatile i32 %8, i32* %2
br label %5
}
void g() { int unused; }


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

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

LLVM IR (-O0):
define void @g() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @g() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
unsigned int ntohl(int);
int /*<<< orphan*/ stderr;
void traps(void) {
  static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
  unsigned int *p = (unsigned int *)test;
  if (*p != ntohl(0x434f4e46)) {
    fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n", *p);
    exit(2);
  }
}


x86 assembly (clang, -O0):
<traps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x2ef9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x434f4e46,%edi
call   1050 <ntohl@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
je     1188 <traps+0x58>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe87(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<traps>:
push   %rax
mov    $0x434f4e46,%edi
call   1050 <ntohl@plt>
cmp    $0x464e4f43,%eax
jne    1144 <traps+0x14>
pop    %rax
ret
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
mov    $0x464e4f43,%edx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@traps.test = internal global [5 x i8] c"CONF\00"
@stderr = global i32 0
@.str = [51 x i8] c"fixdep: sizeof(int) != 4 or wrong endianness? %#x\0A\00"
define void @traps() {
%1 = alloca i32*
store i32* bitcast ([5 x i8]* @traps.test to i32*), i32** %1
%2 = load i32*, i32** %1
%3 = load i32, i32* %2
%4 = call i32 @ntohl(i32 1129270854)
%5 = icmp ne i32 %3, %4
br i1 %5, label %6, label %12
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = load i32*, i32** %1
%9 = load i32, i32* %8
%10 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @exit(i32 2)
unreachable
12: ; preds = %0
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"fixdep: sizeof(int) != 4 or wrong endianness? %#x\0A\00"
define void @traps() {
%1 = tail call i32 @ntohl(i32 1129270854)
%2 = icmp eq i32 %1, 1179537219
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 1179537219)
%6 = tail call i32 @exit(i32 2)
unreachable
7: ; preds = %0
ret void
}
int main(void) {
  int i;
  int array[5];
  for (i = 0; i <= sizeof(array); i++) {
    array[i] = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x14,%rax
ja     113a <main+0x3a>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x20(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned int next_pow2(unsigned int v) {
  v--;
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  return v + 1;
}


x86 assembly (clang, -O0):
<next_pow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_pow2>:
lea    -0x1(%rdi),%eax
mov    %eax,%ecx
shr    %ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x2,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,%edx
shr    $0x8,%edx
or     %ecx,%edx
mov    %edx,%eax
shr    $0x10,%eax
or     %edx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @next_pow2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = lshr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = lshr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = lshr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = lshr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = lshr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add i32 %25, 1
ret i32 %26
}

LLVM IR (-O2):
define i32 @next_pow2(i32 %0) {
%2 = add i32 %0, -1
%3 = lshr i32 %2, 1
%4 = or i32 %3, %2
%5 = lshr i32 %4, 2
%6 = or i32 %5, %4
%7 = lshr i32 %6, 4
%8 = or i32 %7, %6
%9 = lshr i32 %8, 8
%10 = or i32 %9, %8
%11 = lshr i32 %10, 16
%12 = or i32 %11, %10
%13 = add i32 %12, 1
ret i32 %13
}
/* Variables and functions */
double abs(double);
double _distance_r(double r1, double r2) { return abs(r1 - r2); }


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

x86 assembly (clang, -O2):
<_distance_r>:
subsd  %xmm1,%xmm0
jmp    1030 <abs@plt>

LLVM IR (-O0):
define double @_distance_r(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 = fsub double %5, %6
%8 = call double @abs(double %7)
ret double %8
}

LLVM IR (-O2):
define double @_distance_r(double %0, double %1) {
%3 = fsub double %0, %1
%4 = tail call double @abs(double %3)
ret double %4
}
/* Variables and functions */
void test() {
  int *s = NULL;
  *s = 42;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
pop    %rbp
ret

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

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void hangup(int s) { exit(1); }


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

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

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

LLVM IR (-O2):
define void @hangup(i32 %0) {
%2 = tail call i32 @exit(i32 1)
unreachable
}