xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ PlayLevelSound(int, int, int);
void RunTimegateWheel(int x, int y) { PlayLevelSound(x, y, 137); }


x86 assembly (clang, -O0):
<RunTimegateWheel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x89,%edx
call   1030 <PlayLevelSound@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RunTimegateWheel>:
mov    $0x89,%edx
jmp    1030 <PlayLevelSound@plt>

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

LLVM IR (-O2):
define void @RunTimegateWheel(i32 %0, i32 %1) {
%3 = tail call i32 @PlayLevelSound(i32 %0, i32 %1, i32 137)
ret void
}
/* Variables and functions */
double acos(double);
double math__Float__acos(double self) {
  double var;
  double var1;
  var1 = acos(self);
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


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

x86 assembly (clang, -O2):
<math__Float__acos>:
jmp    1030 <acos@plt>

LLVM IR (-O0):
define double @math__Float__acos(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = call double @acos(double %5)
store double %6, double* %4
%7 = load double, double* %4
store double %7, double* %3
br label %8
8: ; preds = %1
%9 = load double, double* %3
ret double %9
}

LLVM IR (-O2):
define double @math__Float__acos(double %0) {
%2 = tail call double @acos(double %0)
ret double %2
}
/* Variables and functions */
int __builtin_arm_rbit(unsigned int);
unsigned rbit(unsigned a) { return __builtin_arm_rbit(a); }


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

x86 assembly (clang, -O2):
<rbit>:
jmp    1030 <__builtin_arm_rbit@plt>

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

LLVM IR (-O2):
define i32 @rbit(i32 %0) {
%2 = tail call i32 @__builtin_arm_rbit(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ uart_write(unsigned char const *, int /*<<< orphan*/);
void uart_puts(const char *str) {
  uart_write((const unsigned char *)str, strlen(str));
}


x86 assembly (clang, -O0):
<uart_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <uart_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_puts>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <uart_write@plt>

LLVM IR (-O0):
define void @uart_puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @uart_write(i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @uart_puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @uart_write(i8* %0, i32 %2)
ret void
}
__attribute__((always_)) void pci_create_legacy_files(struct pci_bus *bus) {
  return;
}


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

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

LLVM IR (-O0):
%struct.pci_bus = type opaque
define void @pci_create_legacy_files(%struct.pci_bus* %0) {
%2 = alloca %struct.pci_bus*
store %struct.pci_bus* %0, %struct.pci_bus** %2
ret void
}

LLVM IR (-O2):
%struct.pci_bus = type opaque
define void @pci_create_legacy_files(%struct.pci_bus* nocapture %0) {
ret void
}
void i2c_ASN1_INTEGER(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @boaFormDefineUserMgmt() {
ret void
}
/* Variables and functions */
int sq_size_impl();
int sq_size() { return sq_size_impl(); }


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

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

LLVM IR (-O0):
define i32 @sq_size() {
%1 = call i32 (...) @sq_size_impl()
ret i32 %1
}

LLVM IR (-O2):
define i32 @sq_size() {
%1 = tail call i32 (...) @sq_size_impl()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, char, char);
int main() {
  char c1 = 'E';
  char c2 = 'M';
  char c3 = 'I';
  char c4 = 'L';
  printf("%c %c %c %c\n", c1, c2, c3, c4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x45,-0x5(%rbp)
movb   $0x4d,-0x6(%rbp)
movb   $0x49,-0x7(%rbp)
movb   $0x4c,-0x8(%rbp)
mov    -0x5(%rbp),%dl
mov    -0x6(%rbp),%cl
mov    -0x7(%rbp),%al
lea    0xec1(%rip),%rdi
movsbl %dl,%esi
movsbl %cl,%edx
movsbl %al,%ecx
movsbl -0x8(%rbp),%r8d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x45,%esi
mov    $0x4d,%edx
mov    $0x49,%ecx
mov    $0x4c,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%c %c %c %c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8 signext 69, i8 signext 77, i8 signext 73, i8 signext 76)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main() {
  printf("stdout\n");
  fprintf(stderr, "stderr\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [8 x i8] c"stderr\0A\00"
@str = [7 x i8] c"stdout\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void bad() {
  printf("Fail...");
  fflush(stdout);
  exit(999);
}


x86 assembly (clang, -O0):
<bad>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x3e7,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<bad>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x3e7,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Fail...\00"
@stdout = global i32 0
define void @bad() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
%4 = call i32 @exit(i32 999)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"Fail...\00"
@stdout = global i32 0
define void @bad() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 @exit(i32 999)
unreachable
}
int AdditiveSequence(int n, int t0, int t1, int *counter) {
  (*counter)++;
  if (n == 0)
    return t0;
  if (n == 1)
    return t1;
  return AdditiveSequence(n - 1, t1, t0 + t1, counter);
}


x86 assembly (clang, -O0):
<AdditiveSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
cmpl   $0x0,-0x8(%rbp)
jne    1145 <AdditiveSequence+0x35>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1175 <AdditiveSequence+0x65>
cmpl   $0x1,-0x8(%rbp)
jne    115a <AdditiveSequence+0x4a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1175 <AdditiveSequence+0x65>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
add    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <AdditiveSequence@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AdditiveSequence>:
mov    %esi,%eax
mov    (%rcx),%r8d
add    $0x1,%r8d
test   %edi,%edi
je     1128 <AdditiveSequence+0x28>
nopl   (%rax)
cmp    $0x1,%edi
je     112c <AdditiveSequence+0x2c>
add    $0xffffffff,%edi
mov    %eax,%esi
add    %edx,%esi
add    $0x1,%r8d
mov    %edx,%eax
mov    %esi,%edx
test   %edi,%edi
jne    1110 <AdditiveSequence+0x10>
mov    %r8d,(%rcx)
ret
mov    %edx,%eax
mov    %r8d,(%rcx)
ret

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

LLVM IR (-O2):
define i32 @AdditiveSequence(i32 %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = load i32, i32* %3
br label %6
6: ; preds = %12, %4
%7 = phi i32 [ %5, %4 ], [ %11, %12 ]
%8 = phi i32 [ %0, %4 ], [ %13, %12 ]
%9 = phi i32 [ %1, %4 ], [ %10, %12 ]
%10 = phi i32 [ %2, %4 ], [ %14, %12 ]
%11 = add nsw i32 %7, 1
switch i32 %8, label %12 [
i32 0, label %16
i32 1, label %15
]
12: ; preds = %6
%13 = add nsw i32 %8, -1
%14 = add nsw i32 %10, %9
br label %6
15: ; preds = %6
br label %16
16: ; preds = %6, %15
%17 = phi i32 [ %10, %15 ], [ %9, %6 ]
store i32 %11, i32* %3
ret i32 %17
}
/* Variables and functions */
int f9(int *);
int f10(int *p) { return f9(p); }


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

x86 assembly (clang, -O2):
<f10>:
jmp    1030 <f9@plt>

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

LLVM IR (-O2):
define i32 @f10(i32* %0) {
%2 = tail call i32 @f9(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int main() {
  int i;
  free(&i);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @free(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ warnx(char *);
void badformat(void) {
  warnx("illegal time format");
  (void)fprintf(stderr, "usage: %s [[[[[cc]yy]mm]dd]HH]\n", getprogname());
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<badformat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <warnx@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea0(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<badformat>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1040 <warnx@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb0(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"illegal time format\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"usage: %s [[[[[cc]yy]mm]dd]HH]\0A\00"
@EXIT_FAILURE = global i32 0
define void @badformat() {
%1 = call i32 @warnx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stderr
%3 = call i8* (...) @getprogname()
%4 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [20 x i8] c"illegal time format\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"usage: %s [[[[[cc]yy]mm]dd]HH]\0A\00"
@EXIT_FAILURE = global i32 0
define void @badformat() {
%1 = tail call i32 @warnx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stderr
%3 = tail call i8* (...) @getprogname()
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ readln(int);
void waitkey() { readln(10); }


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

x86 assembly (clang, -O2):
<waitkey>:
mov    $0xa,%edi
jmp    1030 <readln@plt>

LLVM IR (-O0):
define void @waitkey() {
%1 = call i32 @readln(i32 10)
ret void
}

LLVM IR (-O2):
define void @waitkey() {
%1 = tail call i32 @readln(i32 10)
ret void
}
/* Type definitions */
struct epoll_event {
  int dummy;
};

/* Variables and functions */
int syscall(int, int, int, int, struct epoll_event *);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) {
  return (syscall(255, epfd, op, fd, event));
}


x86 assembly (clang, -O0):
<epoll_ctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    $0xff,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epoll_ctl>:
mov    %rcx,%r8
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    $0xff,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
%struct.epoll_event = type { i32 }
define i32 @epoll_ctl(i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3) {
%5 = tail call i32 @syscall(i32 255, i32 %0, i32 %1, i32 %2, %struct.epoll_event* %3)
ret i32 %5
}
int foo(unsigned int x) { return __builtin_parity(x); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%ecx
mov    %ecx,%eax
and    $0x33333333,%eax
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%ecx
shr    $0x10,%ecx
xor    %edi,%ecx
xor    %eax,%eax
xor    %ch,%cl
setnp  %al
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.ctpop.i32(i32 %3)
%5 = and i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = and i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int int64_t;

/* Variables and functions */
int AV_RB16(int const *);
int64_t ff_parse_pes_pts(const uint8_t *buf) {
  return (int64_t)(*buf & 0x0e) << 29 | (AV_RB16(buf + 1) >> 1) << 15 |
         AV_RB16(buf + 3) >> 1;
}


x86 assembly (clang, -O0):
<ff_parse_pes_pts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xe,%eax
shl    $0x1d,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1030 <AV_RB16@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
sar    $0x1,%ecx
shl    $0xf,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0xc,%rdi
call   1030 <AV_RB16@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sar    $0x1,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff_parse_pes_pts>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%r14d
and    $0xfffffffe,%r14d
shl    $0x1d,%r14d
add    $0x4,%rdi
call   1030 <AV_RB16@plt>
mov    %eax,%ebp
and    $0xfffffffe,%ebp
shl    $0xe,%ebp
add    $0xc,%rbx
mov    %rbx,%rdi
call   1030 <AV_RB16@plt>
sar    %eax
or     %ebp,%eax
or     %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ff_parse_pes_pts(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 14
%6 = shl i32 %5, 29
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = call i32 @AV_RB16(i32* %8)
%10 = ashr i32 %9, 1
%11 = shl i32 %10, 15
%12 = or i32 %6, %11
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 3
%15 = call i32 @AV_RB16(i32* %14)
%16 = ashr i32 %15, 1
%17 = or i32 %12, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @ff_parse_pes_pts(i32* %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 29
%4 = and i32 %3, -1073741824
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = tail call i32 @AV_RB16(i32* %5)
%7 = shl i32 %6, 14
%8 = and i32 %7, -32768
%9 = or i32 %8, %4
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = tail call i32 @AV_RB16(i32* %10)
%12 = ashr i32 %11, 1
%13 = or i32 %9, %12
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ as_abort(char *);
void usage(void) {
  as_abort("usage: as [-guw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s "
           "sym] src");
}


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

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

LLVM IR (-O0):
@.str = [73 x i8] c"usage: as [-guw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src\00"
define void @usage() {
%1 = call i32 @as_abort(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [73 x i8] c"usage: as [-guw] [-b [bin]] [-lm [list]] [-n name] [-o obj] [-s sym] src\00"
define void @usage() {
%1 = tail call i32 @as_abort(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}
void __CUT_TAKEDOWN__heap() {}


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

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

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

LLVM IR (-O2):
define void @__CUT_TAKEDOWN__heap() {
ret void
}
/* Type definitions */
struct S {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ non_existent(struct S *, int);
void hooray2(struct S *p) { non_existent(p, 2); }


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

x86 assembly (clang, -O2):
<hooray2>:
mov    $0x2,%esi
jmp    1030 <non_existent@plt>

LLVM IR (-O0):
%struct.S = type { i32 }
define void @hooray2(%struct.S* %0) {
%2 = alloca %struct.S*
store %struct.S* %0, %struct.S** %2
%3 = load %struct.S*, %struct.S** %2
%4 = call i32 @non_existent(%struct.S* %3, i32 2)
ret void
}

LLVM IR (-O2):
%struct.S = type { i32 }
define void @hooray2(%struct.S* %0) {
%2 = tail call i32 @non_existent(%struct.S* %0, i32 2)
ret void
}
int resta(int op1, int op2) { return op1 - op2; }


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

x86 assembly (clang, -O2):
<resta>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @resta(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @resta(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *empty_string();
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
char *slurp(int /*<<< orphan*/ *);
char *slurp_command(char *command) {
  char *result;
  FILE *p = popen(command, "r");
  if (!p)
    return empty_string();
  result = slurp(p);
  pclose(p);
  return result;
}


x86 assembly (clang, -O0):
<slurp_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1060 <popen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    117b <slurp_command+0x3b>
mov    $0x0,%al
call   1030 <empty_string@plt>
mov    %rax,-0x8(%rbp)
jmp    1199 <slurp_command+0x59>
mov    -0x20(%rbp),%rdi
call   1040 <slurp@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slurp_command>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rsi
call   1060 <popen@plt>
test   %rax,%rax
je     1176 <slurp_command+0x36>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <slurp@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <pclose@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <empty_string@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i8* @slurp_command(i8* nocapture %0) {
%2 = tail call i32* @popen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* (...) @empty_string()
br label %9
6: ; preds = %1
%7 = tail call i8* @slurp(i32* %2)
%8 = tail call i32 @pclose(i32* %2)
br label %9
9: ; preds = %6, %4
%10 = phi i8* [ %7, %6 ], [ %5, %4 ]
ret i8* %10
}
/* Type definitions */
struct sha256 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sha256_init(struct sha256 *);
int SHA256_Init(struct sha256 *s) {
  sha256_init(s);
  return 1;
}


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

x86 assembly (clang, -O2):
<SHA256_Init>:
push   %rax
call   1030 <sha256_init@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sha256 = type { i32 }
define i32 @SHA256_Init(%struct.sha256* %0) {
%2 = alloca %struct.sha256*
store %struct.sha256* %0, %struct.sha256** %2
%3 = load %struct.sha256*, %struct.sha256** %2
%4 = call i32 @sha256_init(%struct.sha256* %3)
ret i32 1
}

LLVM IR (-O2):
%struct.sha256 = type { i32 }
define i32 @SHA256_Init(%struct.sha256* %0) {
%2 = tail call i32 @sha256_init(%struct.sha256* %0)
ret i32 1
}
unsigned char rev8(unsigned char n) {
  return ((n * 0x000202020202ULL) & 0x010884422010ULL) % 1023;
}


x86 assembly (clang, -O0):
<rev8>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
movabs $0x202020202,%rcx
imul   %rcx,%rax
movabs $0x10884422010,%rcx
and    %rcx,%rax
mov    $0x3ff,%ecx
xor    %edx,%edx
div    %rcx
mov    %dl,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev8>:
mov    %edi,%eax
movabs $0x202020202,%rdx
imul   %rax,%rdx
movabs $0x10884422010,%rcx
and    %rdx,%rcx
movabs $0x40100401004011,%rdx
mov    %rcx,%rax
mul    %rdx
mov    %ecx,%eax
sub    %edx,%eax
shr    %eax
add    %edx,%eax
shr    $0x9,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @rev8(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i64
%5 = mul i64 %4, 8623620610
%6 = and i64 %5, 1136090292240
%7 = urem i64 %6, 1023
%8 = trunc i64 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @rev8(i8 zeroext %0) {
%2 = zext i8 %0 to i64
%3 = mul nuw nsw i64 %2, 8623620610
%4 = and i64 %3, 1136090292240
%5 = urem i64 %4, 1023
%6 = trunc i64 %5 to i8
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ cgi_end();
int /*<<< orphan*/ cgi_init_headers();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char const *);
void cgi_fatal(const char *msg) {
  cgi_init_headers();
  puts(msg);
  cgi_end();
  exit(1);
}


x86 assembly (clang, -O0):
<cgi_fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <cgi_init_headers@plt>
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <cgi_end@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<cgi_fatal>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <cgi_init_headers@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <cgi_end@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @cgi_fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @cgi_init_headers()
%4 = load i8*, i8** %2
%5 = call i32 @puts(i8* %4)
%6 = call i32 (...) @cgi_end()
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @cgi_fatal(i8* nocapture %0) {
%2 = tail call i32 (...) @cgi_init_headers()
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 (...) @cgi_end()
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ pthread_self();
void *thr_demo(void *args) {
  printf("this is thr_demo thread, pid: %d, tid: %lu\n", getpid(),
         pthread_self());
  printf("args: %d\n", *(int *)args);
  return (void *)10;
}


x86 assembly (clang, -O0):
<thr_demo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thr_demo>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xeb3(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%esi
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"this is thr_demo thread, pid: %d, tid: %lu\0A\00"
@.str.1 = [10 x i8] c"args: %d\0A\00"
define i8* @thr_demo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @getpid()
%4 = call i32 (...) @pthread_self()
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i8* inttoptr (i64 10 to i8*)
}

LLVM IR (-O2):
@.str = [44 x i8] c"this is thr_demo thread, pid: %d, tid: %lu\0A\00"
@.str.1 = [10 x i8] c"args: %d\0A\00"
define i8* @thr_demo(i8* nocapture %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @pthread_self()
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i8* inttoptr (i64 10 to i8*)
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ ck_bt_stderr(char const *, unsigned int, char const *,
                                char *);
__attribute__((__noreturn__)) void
ck_assert_failed(const char *filename, unsigned int line, const char *msg) {
  ck_bt_stderr(filename, line, msg, "%s.%u: assertion failed: %s\n");
  abort();
}


x86 assembly (clang, -O0):
<ck_assert_failed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xebb(%rip),%rcx
call   1040 <ck_bt_stderr@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<ck_assert_failed>:
push   %rax
lea    0xed8(%rip),%rcx
call   1040 <ck_bt_stderr@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"%s.%u: assertion failed: %s\0A\00"
define void @ck_assert_failed(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @ck_bt_stderr(i8* %7, i32 %8, i8* %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [29 x i8] c"%s.%u: assertion failed: %s\0A\00"
define void @ck_assert_failed(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @ck_bt_stderr(i8* %0, i32 %1, i8* %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int hash32_partial_unicode(int const *, size_t);
uint32_t hash32_partial_unicode_suffix(const uint32_t *p, size_t len,
                                       size_t suffix_len, size_t min_stem) {
  if (min_stem + suffix_len > len)
    return 0x34b020cc;
  return hash32_partial_unicode(p + (len - suffix_len), suffix_len);
}


x86 assembly (clang, -O0):
<hash32_partial_unicode_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1146 <hash32_partial_unicode_suffix+0x36>
movl   $0x34b020cc,-0x4(%rbp)
jmp    1165 <hash32_partial_unicode_suffix+0x55>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
call   1030 <hash32_partial_unicode@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash32_partial_unicode_suffix>:
add    %rdx,%rcx
cmp    %rsi,%rcx
jbe    111e <hash32_partial_unicode_suffix+0xe>
mov    $0x34b020cc,%eax
ret
sub    %rdx,%rsi
lea    (%rdi,%rsi,4),%rdi
mov    %rdx,%rsi
jmp    1030 <hash32_partial_unicode@plt>

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

LLVM IR (-O2):
define i32 @hash32_partial_unicode_suffix(i32* %0, i64 %1, i64 %2, i64 %3) {
%5 = add i64 %3, %2
%6 = icmp ugt i64 %5, %1
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = sub i64 %1, %2
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = tail call i32 @hash32_partial_unicode(i32* %9, i64 %2)
br label %11
11: ; preds = %4, %7
%12 = phi i32 [ %10, %7 ], [ 883957964, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
void sig_chld(int signo) {
  int stat;
  while (waitpid(-1, &stat, WNOHANG) > 0)
    ;
  return;
}


x86 assembly (clang, -O0):
<sig_chld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    1141 <sig_chld+0x31>
jmp    111b <sig_chld+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_chld>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
lea    0x4(%rsp),%rbx
mov    (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1120 <sig_chld+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* @WNOHANG
%6 = call i64 @waitpid(i32 -1, i32* %3, i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = load i32, i32* @WNOHANG
%6 = call i64 @waitpid(i32 -1, i32* %2, i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
void SysTickIntRegister(void *ptr) {}


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

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

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

LLVM IR (-O2):
define void @SysTickIntRegister(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void mpgedit_edit_files_free(void *play_ctx) {
  if (play_ctx) {
    free(play_ctx);
  }
}


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

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

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

LLVM IR (-O2):
define void @mpgedit_edit_files_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void IO_sys_yield() {
  (*(volatile unsigned long *)0xe000e018) = 0;
  (*(volatile unsigned long *)0xe000ed04) = 0x04000000;
}


x86 assembly (clang, -O0):
<IO_sys_yield>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe000e018,%eax
movq   $0x0,(%rax)
mov    $0xe000ed04,%eax
movq   $0x4000000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_sys_yield>:
mov    $0xe000e018,%eax
movq   $0x0,(%rax)
movq   $0x4000000,0xcec(%rax)
ret

LLVM IR (-O0):
define void @IO_sys_yield() {
store volatile i64 0, i64* inttoptr (i64 3758153752 to i64*)
store volatile i64 67108864, i64* inttoptr (i64 3758157060 to i64*)
ret void
}

LLVM IR (-O2):
define void @IO_sys_yield() {
store volatile i64 0, i64* inttoptr (i64 3758153752 to i64*)
store volatile i64 67108864, i64* inttoptr (i64 3758157060 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void *, size_t);
void swapAnyThing(void *a, void *b, size_t val_size) {
  void *ptr = malloc(val_size);
  memcpy(ptr, a, val_size);
  memcpy(a, b, val_size);
  memcpy(b, ptr, val_size);
  free(ptr);
}


x86 assembly (clang, -O0):
<swapAnyThing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapAnyThing>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @swapAnyThing(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = load i8*, i8** %4
%12 = load i64, i64* %6
%13 = call i32 @memcpy(i8* %10, i8* %11, i64 %12)
%14 = load i8*, i8** %4
%15 = load i8*, i8** %5
%16 = load i64, i64* %6
%17 = call i32 @memcpy(i8* %14, i8* %15, i64 %16)
%18 = load i8*, i8** %5
%19 = load i8*, i8** %7
%20 = load i64, i64* %6
%21 = call i32 @memcpy(i8* %18, i8* %19, i64 %20)
%22 = load i8*, i8** %7
%23 = call i32 @free(i8* %22)
ret void
}

LLVM IR (-O2):
define void @swapAnyThing(i8* %0, i8* %1, i64 %2) {
%4 = tail call i8* @malloc(i64 %2)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %2)
%6 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
%7 = tail call i32 @memcpy(i8* %1, i8* %4, i64 %2)
%8 = tail call i32 @free(i8* %4)
ret void
}
int plat_get_bat_capacity(void) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @plat_get_bat_capacity() {
ret i32 -1
}
void port_wait_for_interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @port_wait_for_interrupt() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
long sys_getpid(va_list ap) { return 0; }


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

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

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

LLVM IR (-O2):
define i64 @sys_getpid(i32 %0) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void perror(const char *s) {
  fprintf(stderr, "%s: %s\n", (s != NULL ? s : ""), strerror(errno));
}


x86 assembly (clang, -O0):
<perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1150 <perror+0x30>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <perror+0x40>
lea    0xeb0(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <perror+0x40>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    %rax,%rcx
lea    0xe79(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perror>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eb6(%rip),%rax
mov    (%rax),%ebp
test   %rdi,%rdi
lea    0xed1(%rip),%rbx
cmovne %rdi,%rbx
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xeb1(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@errno = global i32 0
define void @perror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i8*, i8** %2
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %6
%10 = phi i8* [ %7, %6 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %8 ]
%11 = load i32, i32* @errno
%12 = call i8* @strerror(i32 %11)
%13 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %12)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@errno = global i32 0
define void @perror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = icmp eq i8* %0, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %0
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
ret void
}
int test_imm_03uint8_mem(unsigned char *val) {
  return ((*val) & (0x03 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_03uint8_mem>:
testb  $0x3,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_03uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 3
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "TODO\n");
  exit(255);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"TODO\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 255)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"TODO\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 255)
unreachable
}