xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ ptrdiff_t;

/* Variables and functions */
scalar_t__ INT_MAX;
unsigned char *malloc(unsigned int);
int main(void) {
  if (sizeof(ptrdiff_t) == sizeof(int)) {
    unsigned char *ptr0 = malloc(((unsigned)INT_MAX) + 1);
    unsigned char *ptr1 = ptr0 + (unsigned)INT_MAX;
    ptr1 - ptr0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edi
add    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ea6(%rip),%rcx
mov    (%rcx),%rcx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@INT_MAX = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = load i64, i64* @INT_MAX
%5 = trunc i64 %4 to i32
%6 = add i32 %5, 1
%7 = call i8* @malloc(i32 %6)
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = load i64, i64* @INT_MAX
%10 = trunc i64 %9 to i32
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void SAR_L_IMM(int reg, int count) {
  if (reg & 8)
    addbyte(0x41);
  addbyte(0xc1);
  addbyte(0xc0 | (reg & 7) | 0x38);
  addbyte(count);
}


x86 assembly (clang, -O0):
<SAR_L_IMM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1137 <SAR_L_IMM+0x27>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0xc1,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xc0,%edi
or     $0x38,%edi
call   1030 <addbyte@plt>
mov    -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SAR_L_IMM>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
test   $0x8,%bpl
je     1127 <SAR_L_IMM+0x17>
mov    $0x41,%edi
call   1030 <addbyte@plt>
mov    $0xc1,%edi
call   1030 <addbyte@plt>
or     $0xf8,%ebp
movzbl %bpl,%edi
call   1030 <addbyte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @SAR_L_IMM(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 = and i32 %5, 8
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @addbyte(i32 65)
br label %10
10: ; preds = %8, %2
%11 = call i32 @addbyte(i32 193)
%12 = load i32, i32* %3
%13 = and i32 %12, 7
%14 = or i32 192, %13
%15 = or i32 %14, 56
%16 = call i32 @addbyte(i32 %15)
%17 = load i32, i32* %4
%18 = call i32 @addbyte(i32 %17)
ret void
}

LLVM IR (-O2):
define void @SAR_L_IMM(i32 %0, i32 %1) {
%3 = and i32 %0, 8
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @addbyte(i32 65)
br label %7
7: ; preds = %5, %2
%8 = tail call i32 @addbyte(i32 193)
%9 = and i32 %0, 7
%10 = or i32 %9, 248
%11 = tail call i32 @addbyte(i32 %10)
%12 = tail call i32 @addbyte(i32 %1)
ret void
}
/* Variables and functions */
char *strstr(char *, char *);
extern int str_rm_and_after(char *s, char *t) {
  char *p = strstr(s, t);
  if (!p)
    return 0;
  *p = 0;
  return 1;
}


x86 assembly (clang, -O0):
<str_rm_and_after>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1148 <str_rm_and_after+0x38>
movl   $0x0,-0x4(%rbp)
jmp    1156 <str_rm_and_after+0x46>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_rm_and_after>:
push   %rax
call   1030 <strstr@plt>
test   %rax,%rax
je     1125 <str_rm_and_after+0x15>
movb   $0x0,(%rax)
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @str_rm_and_after(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %2
store i8 0, i8* %3
br label %6
6: ; preds = %2, %5
%7 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %7
}
/* Variables and functions */
int simple_match(void const *, void const *, size_t, int);
int bu_equal(const void *left, const void *right, size_t n) {
  return simple_match(left, right, n, ((1 << 0) | 0 | 0 | (1 << 3)));
}


x86 assembly (clang, -O0):
<bu_equal>:
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
mov    $0x9,%ecx
call   1030 <simple_match@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bu_equal>:
mov    $0x9,%ecx
jmp    1030 <simple_match@plt>

LLVM IR (-O0):
define i32 @bu_equal(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @simple_match(i8* %7, i8* %8, i64 %9, i32 9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @bu_equal(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @simple_match(i8* %0, i8* %1, i64 %2, i32 9)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ InitLeds();
int /*<<< orphan*/ InstallInterruptHandlers();
int /*<<< orphan*/ Phaser();
int main() {
  InitLeds();
  InstallInterruptHandlers();
  Phaser();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @InitLeds()
%2 = tail call i32 (...) @InstallInterruptHandlers()
%3 = tail call i32 (...) @Phaser()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  printf("Keep looking!");
  printf("You\'ll find it\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Keep looking!\00"
@.str.1 = [16 x i8] c"You'll find it\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Keep looking!\00"
@str = [15 x i8] c"You'll find it\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ X(char **, char **, int *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  char *phdr;
  char *data = (char *)0x40164000;
  int phoff = 0x34;
  X(&phdr, &data, &phoff);
  if (phdr != (char *)0x40164034)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x40164000,%eax
mov    %rax,-0x18(%rbp)
movl   $0x34,-0x1c(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <X@plt>
mov    $0x40164034,%eax
cmp    %rax,-0x10(%rbp)
je     1176 <main+0x46>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movq   $0x40164000,0x8(%rsp)
16 40
movl   $0x34,0x4(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1040 <X@plt>
cmpq   $0x40164034,0x10(%rsp)
16 40
jne    116b <main+0x3b>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i8* inttoptr (i64 1075200000 to i8*), i8** %3
store i32 52, i32* %4
%5 = call i32 @X(i8** %2, i8** %3, i32* %4)
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, inttoptr (i64 1075200052 to i8*)
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %0
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = bitcast i8** %1 to i8*
%5 = bitcast i8** %2 to i8*
store i8* inttoptr (i64 1075200000 to i8*), i8** %2
%6 = bitcast i32* %3 to i8*
store i32 52, i32* %3
%7 = call i32 @X(i8** %1, i8** %2, i32* %3)
%8 = load i8*, i8** %1
%9 = icmp eq i8* %8, inttoptr (i64 1075200052 to i8*)
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %0
%13 = call i32 @exit(i32 0)
unreachable
}
double gbytes_per_sec(double cycles_per_byte, double clockrate) {
  return clockrate / cycles_per_byte;
}


x86 assembly (clang, -O0):
<gbytes_per_sec>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<gbytes_per_sec>:
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @gbytes_per_sec(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @gbytes_per_sec(double %0, double %1) {
%3 = fdiv double %1, %0
ret double %3
}
/* Variables and functions */
int c(char);
int f(int);
int /*<<< orphan*/ printf(char *, int, int, float, int);
void main() {
  int m, n, d = 5;
  float p;
  m = f(2);
  n = c('A');
  p = d;
  printf("%d %d %f %f", m, n, p, d);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0xc(%rbp)
mov    $0x2,%edi
call   1030 <f@plt>
mov    %eax,-0x4(%rbp)
mov    $0x41,%edi
call   1050 <c@plt>
mov    %eax,-0x8(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
movss  -0x10(%rbp),%xmm0
mov    -0xc(%rbp),%ecx
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2,%edi
call   1030 <f@plt>
mov    %eax,%ebx
mov    $0x41,%edi
call   1050 <c@plt>
lea    0xeb6(%rip),%rdi
movss  0xeaa(%rip),%xmm0
mov    %ebx,%esi
mov    %eax,%edx
mov    $0x5,%ecx
pop    %rbx
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %f %f\00"
define void @main() {
%1 = tail call i32 @f(i32 2)
%2 = tail call i32 @c(i8 signext 65)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, float 5.000000e+00, i32 5)
ret void
}
void RTLdrGetSymbolEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLdrGetSymbolEx() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ file_append_cleanup();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t);
void *malloc(size_t);
int /*<<< orphan*/ mmap_cleanup();
int /*<<< orphan*/ stderr;
void *umalloc(size_t size) {
  void *const addr = malloc(size);
  if (addr == 0) {
    fprintf(stderr, "malloc failed: %zu bytes\n", size);
    file_append_cleanup();
    mmap_cleanup();
    return NULL;
  }
  return addr;
}


x86 assembly (clang, -O0):
<umalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1198 <umalloc+0x58>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1060 <file_append_cleanup@plt>
mov    $0x0,%al
call   1030 <mmap_cleanup@plt>
movq   $0x0,-0x8(%rbp)
jmp    11a0 <umalloc+0x60>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    117a <umalloc+0x3a>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1060 <file_append_cleanup@plt>
xor    %eax,%eax
call   1030 <mmap_cleanup@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"malloc failed: %zu bytes\0A\00"
define i8* @umalloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = load i64, i64* %3
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = call i32 (...) @file_append_cleanup()
%14 = call i32 (...) @mmap_cleanup()
store i8* null, i8** %2
br label %17
15: ; preds = %1
%16 = load i8*, i8** %4
store i8* %16, i8** %2
br label %17
17: ; preds = %15, %9
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"malloc failed: %zu bytes\0A\00"
define noalias i8* @umalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 (...) @file_append_cleanup()
%8 = tail call i32 (...) @mmap_cleanup()
br label %9
9: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int nwd(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() { printf("NWD liczb %d i %d = %d\n", 1989, 867, nwd(1989, 867)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7c5,%edi
mov    $0x363,%esi
call   1030 <nwd@plt>
mov    %eax,%ecx
lea    0xec4(%rip),%rdi
mov    $0x7c5,%esi
mov    $0x363,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"NWD liczb %d i %d = %d\0A\00"
define i32 @main() {
%1 = call i32 @nwd(i32 1989, i32 867)
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1989, i32 867, i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"NWD liczb %d i %d = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @nwd(i32 1989, i32 867)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1989, i32 867, i32 %1)
ret i32 0
}
int flockfile() { return -1; }


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

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

LLVM IR (-O0):
define i32 @flockfile() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @flockfile() {
ret i32 -1
}
/* Type definitions */
struct dll {
  int dummy;
};

/* Variables and functions */
struct dll *create();
int /*<<< orphan*/ insertHead(struct dll *, int);
int main(void) {
  struct dll *dll = create();
  insertHead(dll, 1);
  insertHead(dll, 2);
  insertHead(dll, 3);
  insertHead(dll, 4);
  insertHead(dll, 5);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <insertHead@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <insertHead@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <insertHead@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1040 <insertHead@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1040 <insertHead@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <insertHead@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <insertHead@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <insertHead@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <insertHead@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <insertHead@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.dll = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.dll*
store i32 0, i32* %1
%3 = call %struct.dll* (...) @create()
store %struct.dll* %3, %struct.dll** %2
%4 = load %struct.dll*, %struct.dll** %2
%5 = call i32 @insertHead(%struct.dll* %4, i32 1)
%6 = load %struct.dll*, %struct.dll** %2
%7 = call i32 @insertHead(%struct.dll* %6, i32 2)
%8 = load %struct.dll*, %struct.dll** %2
%9 = call i32 @insertHead(%struct.dll* %8, i32 3)
%10 = load %struct.dll*, %struct.dll** %2
%11 = call i32 @insertHead(%struct.dll* %10, i32 4)
%12 = load %struct.dll*, %struct.dll** %2
%13 = call i32 @insertHead(%struct.dll* %12, i32 5)
ret i32 0
}

LLVM IR (-O2):
%struct.dll = type { i32 }
define i32 @main() {
%1 = tail call %struct.dll* (...) @create()
%2 = tail call i32 @insertHead(%struct.dll* %1, i32 1)
%3 = tail call i32 @insertHead(%struct.dll* %1, i32 2)
%4 = tail call i32 @insertHead(%struct.dll* %1, i32 3)
%5 = tail call i32 @insertHead(%struct.dll* %1, i32 4)
%6 = tail call i32 @insertHead(%struct.dll* %1, i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ MADV_RANDOM;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ madvise(char *, int, int /*<<< orphan*/);
char *malloc(int);
void test_madvise() {
  char *x = malloc(10);
  madvise(x, 10, MADV_RANDOM);
  free(x);
}


x86 assembly (clang, -O0):
<test_madvise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1050 <madvise@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_madvise>:
push   %rbx
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <madvise@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@MADV_RANDOM = global i32 0
define void @test_madvise() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 10)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = load i32, i32* @MADV_RANDOM
%5 = call i32 @madvise(i8* %3, i32 10, i32 %4)
%6 = load i8*, i8** %1
%7 = call i32 @free(i8* %6)
ret void
}

LLVM IR (-O2):
@MADV_RANDOM = global i32 0
define void @test_madvise() {
%1 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%2 = load i32, i32* @MADV_RANDOM
%3 = tail call i32 @madvise(i8* %1, i32 10, i32 %2)
%4 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
bool bitmap_test_opaque(void *bitmap) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @bitmap_test_opaque(i8* nocapture readnone %0) {
ret i32 0
}
QM_ISR_DECLARE(irq_dummy_routine) {}


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

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

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

LLVM IR (-O2):
define i32 @QM_ISR_DECLARE(i32 %0) {
ret i32 undef
}
/* Variables and functions */
scalar_t__ dcac_mask_ops(int, int);
unsigned short dcac_get_mask(void) {
  return (unsigned short)dcac_mask_ops(45, -1);
}


x86 assembly (clang, -O0):
<dcac_get_mask>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2d,%edi
mov    $0xffffffff,%esi
call   1030 <dcac_mask_ops@plt>
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcac_get_mask>:
push   %rax
mov    $0x2d,%edi
mov    $0xffffffff,%esi
call   1030 <dcac_mask_ops@plt>
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i16 @dcac_get_mask() {
%1 = call i64 @dcac_mask_ops(i32 45, i32 -1)
%2 = trunc i64 %1 to i16
ret i16 %2
}

LLVM IR (-O2):
define zeroext i16 @dcac_get_mask() {
%1 = tail call i64 @dcac_mask_ops(i32 45, i32 -1)
%2 = trunc i64 %1 to i16
ret i16 %2
}
int get_pin_value(void) {
  int v;
  unsigned long tmp;
  tmp = (*(volatile unsigned long *)0xE0200C24);
  v = !!(tmp & (1 << 2));
  return v;
}


x86 assembly (clang, -O0):
<get_pin_value>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0200c24,%eax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x4,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pin_value>:
mov    $0xe0200c24,%eax
mov    (%rax),%rax
shr    $0x2,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @get_pin_value() {
%1 = alloca i32
%2 = alloca i64
%3 = load volatile i64, i64* inttoptr (i64 3760196644 to i64*)
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = and i64 %4, 4
%6 = icmp ne i64 %5, 0
%7 = xor i1 %6, true
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
store i32 %9, i32* %1
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @get_pin_value() {
%1 = load volatile i64, i64* inttoptr (i64 3760196644 to i64*)
%2 = trunc i64 %1 to i32
%3 = lshr i32 %2, 2
%4 = and i32 %3, 1
ret i32 %4
}
unsigned long ary_2d_get_at(unsigned long *ary, unsigned long ridx,
                            unsigned long cidx, unsigned long ncols) {
  return ary[(ridx * ncols) + cidx];
}


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

x86 assembly (clang, -O2):
<ary_2d_get_at>:
imul   %rcx,%rsi
add    %rdx,%rsi
mov    (%rdi,%rsi,8),%rax
ret

LLVM IR (-O0):
define i64 @ary_2d_get_at(i64* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64* %0, i64** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64*, i64** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %8
%12 = mul i64 %10, %11
%13 = load i64, i64* %7
%14 = add i64 %12, %13
%15 = getelementptr inbounds i64, i64* %9, i64 %14
%16 = load i64, i64* %15
ret i64 %16
}

LLVM IR (-O2):
define i64 @ary_2d_get_at(i64* nocapture %0, i64 %1, i64 %2, i64 %3) {
%5 = mul i64 %3, %1
%6 = add i64 %5, %2
%7 = getelementptr inbounds i64, i64* %0, i64 %6
%8 = load i64, i64* %7
ret i64 %8
}
float power(float x, unsigned y) {
  float res = x;
  unsigned i;
  for (i = 1; i < y; i++)
    res *= x;
  return res;
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1146 <power+0x46>
movss  -0x4(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111d <power+0x1d>
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
cmp    $0x2,%edi
jb     115c <power+0x5c>
lea    -0x1(%rdi),%ecx
add    $0xfffffffe,%edi
mov    %ecx,%eax
and    $0x7,%eax
movaps %xmm0,%xmm1
cmp    $0x7,%edi
jb     1145 <power+0x45>
and    $0xfffffff8,%ecx
movaps %xmm0,%xmm1
xchg   %ax,%ax
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
add    $0xfffffff8,%ecx
jne    1120 <power+0x20>
test   %eax,%eax
je     1159 <power+0x59>
nopl   0x0(%rax)
mulss  %xmm0,%xmm1
add    $0xffffffff,%eax
jne    1150 <power+0x50>
movaps %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @power(float %0, i32 %1) {
%3 = icmp ugt i32 %1, 1
br i1 %3, label %4, label %34
4: ; preds = %2
%5 = add i32 %1, -1
%6 = add i32 %1, -2
%7 = and i32 %5, 7
%8 = icmp ult i32 %6, 7
br i1 %8, label %24, label %9
9: ; preds = %4
%10 = and i32 %5, -8
br label %11
11: ; preds = %11, %9
%12 = phi float [ %0, %9 ], [ %21, %11 ]
%13 = phi i32 [ 0, %9 ], [ %22, %11 ]
%14 = fmul float %12, %0
%15 = fmul float %14, %0
%16 = fmul float %15, %0
%17 = fmul float %16, %0
%18 = fmul float %17, %0
%19 = fmul float %18, %0
%20 = fmul float %19, %0
%21 = fmul float %20, %0
%22 = add i32 %13, 8
%23 = icmp eq i32 %22, %10
br i1 %23, label %24, label %11
24: ; preds = %11, %4
%25 = phi float [ undef, %4 ], [ %21, %11 ]
%26 = phi float [ %0, %4 ], [ %21, %11 ]
%27 = icmp eq i32 %7, 0
br i1 %27, label %34, label %28
28: ; preds = %24, %28
%29 = phi float [ %31, %28 ], [ %26, %24 ]
%30 = phi i32 [ %32, %28 ], [ 0, %24 ]
%31 = fmul float %29, %0
%32 = add i32 %30, 1
%33 = icmp eq i32 %32, %7
br i1 %33, label %34, label %28
34: ; preds = %24, %28, %2
%35 = phi float [ %0, %2 ], [ %25, %24 ], [ %31, %28 ]
ret float %35
}
/* Variables and functions */
long fvecs_fsize(char const *, int *, int *);
long ivecs_fsize(const char *fname, int *d_out, int *n_out) {
  return fvecs_fsize(fname, d_out, n_out);
}


x86 assembly (clang, -O0):
<ivecs_fsize>:
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 <fvecs_fsize@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivecs_fsize>:
jmp    1030 <fvecs_fsize@plt>

LLVM IR (-O0):
define i64 @ivecs_fsize(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32*, i32** %5
%9 = load i32*, i32** %6
%10 = call i64 @fvecs_fsize(i8* %7, i32* %8, i32* %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @ivecs_fsize(i8* %0, i32* %1, i32* %2) {
%4 = tail call i64 @fvecs_fsize(i8* %0, i32* %1, i32* %2)
ret i64 %4
}
/* Variables and functions */
int close(int);
int bot_serial_close(int fd) { return close(fd); }


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

x86 assembly (clang, -O2):
<bot_serial_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @bot_serial_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Putb(int, int);
extern void DoBlitDontWait(void) { Putb(0x24, 1); }


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

x86 assembly (clang, -O2):
<DoBlitDontWait>:
mov    $0x24,%edi
mov    $0x1,%esi
jmp    1030 <Putb@plt>

LLVM IR (-O0):
define void @DoBlitDontWait() {
%1 = call i32 @Putb(i32 36, i32 1)
ret void
}

LLVM IR (-O2):
define void @DoBlitDontWait() {
%1 = tail call i32 @Putb(i32 36, i32 1)
ret void
}
/* Variables and functions */
double cube(int);
int /*<<< orphan*/ printf(char *, int, double);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  double result = cube(n);
  printf("%d^3 = %.2f\n", n, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <cube@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <cube@plt>
mov    0x4(%rsp),%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"%d^3 = %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call double @cube(i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %6, double %5)
ret i32 0
}
int test_imm_E3int8_reg(signed char val) {
  return ((val) & (0xE3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E3int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xe3,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_E3int8_reg(i8 signext %0) {
%2 = and i8 %0, -29
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void RTLockValidatorRecMakeSiblings(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLockValidatorRecMakeSiblings() {
ret void
}
int kbd_defleds(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @kbd_defleds() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ receiver(void *);
void *receiver_t(void *data) {
  receiver(data);
  return 0;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @receiver_t(i8* %0) {
%2 = tail call i32 @receiver(i8* %0)
ret i8* null
}
void ff_me_cmp_init_alpha() {}


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

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

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

LLVM IR (-O2):
define void @ff_me_cmp_init_alpha() {
ret void
}
unsigned int string_hash(string)
char *string;
{
  unsigned int hindex;
  char *pc = string;
  hindex = *pc;
  while (*pc) {
    hindex = ((hindex << 9) ^ *pc++) % 6007;
  }
  return hindex;
}


x86 assembly (clang, -O0):
<string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <string_hash+0x52>
mov    -0xc(%rbp),%eax
shl    $0x9,%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    $0x1777,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0xc(%rbp)
jmp    111a <string_hash+0x1a>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_hash>:
movsbl (%rdi),%edx
test   %edx,%edx
je     1149 <string_hash+0x49>
add    $0x1,%rdi
mov    $0xae8f1b93,%esi
mov    %edx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
shl    $0x9,%edx
movsbl %cl,%eax
xor    %edx,%eax
mov    %rax,%rcx
imul   %rsi,%rcx
shr    $0x2c,%rcx
imul   $0x1777,%ecx,%ecx
sub    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1120 <string_hash+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @string_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = sext i8 %2 to i32
br label %6
6: ; preds = %4, %6
%7 = phi i8* [ %11, %6 ], [ %0, %4 ]
%8 = phi i32 [ %14, %6 ], [ %5, %4 ]
%9 = phi i8 [ %15, %6 ], [ %2, %4 ]
%10 = shl nsw i32 %8, 9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = sext i8 %9 to i32
%13 = xor i32 %10, %12
%14 = urem i32 %13, 6007
%15 = load i8, i8* %11
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %6, %1
%18 = phi i32 [ 0, %1 ], [ %14, %6 ]
ret i32 %18
}
/* Type definitions */
struct macioDevice {
  int dummy;
};
struct device {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ writeDevice(int /*<<< orphan*/ *, struct device *);
void macioWriteDevice(FILE *file, struct macioDevice *dev) {
  writeDevice(file, (struct device *)dev);
}


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

x86 assembly (clang, -O2):
<macioWriteDevice>:
jmp    1030 <writeDevice@plt>

LLVM IR (-O0):
%struct.macioDevice = type { i32 }
%struct.device = type { i32 }
define void @macioWriteDevice(i32* %0, %struct.macioDevice* %1) {
%3 = alloca i32*
%4 = alloca %struct.macioDevice*
store i32* %0, i32** %3
store %struct.macioDevice* %1, %struct.macioDevice** %4
%5 = load i32*, i32** %3
%6 = load %struct.macioDevice*, %struct.macioDevice** %4
%7 = bitcast %struct.macioDevice* %6 to %struct.device*
%8 = call i32 @writeDevice(i32* %5, %struct.device* %7)
ret void
}

LLVM IR (-O2):
%struct.macioDevice = type { i32 }
%struct.device = type { i32 }
define void @macioWriteDevice(i32* %0, %struct.macioDevice* %1) {
%3 = bitcast %struct.macioDevice* %1 to %struct.device*
%4 = tail call i32 @writeDevice(i32* %0, %struct.device* %3)
ret void
}
int Get4(unsigned char *mem) {
  return (mem[0] + (mem[1] * 256) + (mem[2] * 256 * 256) +
          (mem[3] * 256 * 256 * 256));
}


x86 assembly (clang, -O0):
<Get4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x8,%ecx
shl    $0x8,%ecx
shl    $0x8,%ecx
add    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @Get4(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 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = mul nsw i32 %10, 256
%12 = add nsw i32 %6, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = mul nsw i32 %16, 256
%18 = mul nsw i32 %17, 256
%19 = add nsw i32 %12, %18
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 3
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = mul nsw i32 %23, 256
%25 = mul nsw i32 %24, 256
%26 = mul nsw i32 %25, 256
%27 = add nsw i32 %19, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @Get4(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw nsw i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_UTCTIME;

/* Variables and functions */
int /*<<< orphan*/ ASN1_UTCTIME_it;
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_UTCTIME_it);
}


x86 assembly (clang, -O0):
<i2d_ASN1_UTCTIME>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2eb9(%rip),%rdx
call   1030 <ASN1_item_i2d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2d_ASN1_UTCTIME>:
mov    0x2ed1(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

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

LLVM IR (-O2):
@ASN1_UTCTIME_it = global i32 0
define i32 @i2d_ASN1_UTCTIME(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @ASN1_UTCTIME_it)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int strerror_r(int, char *, int);
char *str_error(int err, char *dst, int len) {
  int ret = strerror_r(err, dst, len);
  if (ret)
    snprintf(dst, len, "ERROR: strerror_r(%d)=%d", err, ret);
  return dst;
}


x86 assembly (clang, -O0):
<str_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <strerror_r@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1168 <str_error+0x48>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xe9d(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_error>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <strerror_r@plt>
test   %eax,%eax
je     114c <str_error+0x2c>
lea    0xec4(%rip),%rdx
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%ecx
mov    %eax,%r8d
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"ERROR: strerror_r(%d)=%d\00"
define i8* @str_error(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @strerror_r(i32 %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = load i32, i32* %7
%19 = call i32 @snprintf(i8* %15, i32 %16, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
br label %20
20: ; preds = %14, %3
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
@.str = [25 x i8] c"ERROR: strerror_r(%d)=%d\00"
define i8* @str_error(i32 %0, i8* returned %1, i32 %2) {
%4 = tail call i32 @strerror_r(i32 %0, i8* %1, i32 %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
br label %8
8: ; preds = %6, %3
ret i8* %1
}
int d7(int a) { return a % 7; }


x86 assembly (clang, -O0):
<d7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d7>:
movslq %edi,%rcx
imul   $0xffffffff92492493,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x2,%eax
add    %edx,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @d7(i32 %0) {
%2 = srem i32 %0, 7
ret i32 %2
}
int HelpItem65(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem65() {
ret i32 0
}
void uartPutc(unsigned char c) {
  while (1) {
    if (((*(volatile unsigned int *)(0x7F005010)) & 6) == 6)
      break;
  }
  (*(volatile unsigned int *)(0x7F005020)) = c;
  return;
}


x86 assembly (clang, -O0):
<uartPutc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x7f005010,%eax
mov    (%rax),%eax
and    $0x6,%eax
cmp    $0x6,%eax
jne    1122 <uartPutc+0x22>
jmp    1127 <uartPutc+0x27>
jmp    110a <uartPutc+0xa>
movzbl -0x1(%rbp),%ecx
mov    $0x7f005020,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uartPutc>:
mov    0x7f005010,%eax
not    %eax
test   $0x6,%al
jne    1100 <uartPutc>
movzbl %dil,%eax
mov    %eax,0x7f005020
ret

LLVM IR (-O0):
define void @uartPutc(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %1, %8
%4 = load volatile i32, i32* inttoptr (i64 2130726928 to i32*)
%5 = and i32 %4, 6
%6 = icmp eq i32 %5, 6
br i1 %6, label %7, label %8
7: ; preds = %3
br label %9
8: ; preds = %3
br label %3
9: ; preds = %7
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
store volatile i32 %11, i32* inttoptr (i64 2130726944 to i32*)
ret void
}

LLVM IR (-O2):
define void @uartPutc(i8 zeroext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 2130726928 to i32*)
%4 = and i32 %3, 6
%5 = icmp eq i32 %4, 6
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = zext i8 %0 to i32
store volatile i32 %7, i32* inttoptr (i64 2130726944 to i32*)
ret void
}