xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ itoa(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char s[100];
  int n = 500;
  itoa(s, n);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x1f4,-0x74(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1040 <itoa@plt>
lea    -0x70(%rbp),%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1f4,%esi
call   1040 <itoa@plt>
lea    0xec4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i8* %2, i32 500)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int strcmp(char const *, char const *);
int stringCompare(const void *v1, const void *v2) {
  return strcmp(*(const char **)v1, *(const char **)v2);
}


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

x86 assembly (clang, -O2):
<stringCompare>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @stringCompare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @stringCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
__attribute__((weak)) void SysTick_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<SysTick_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <SysTick_Handler+0x9>
jmp    1109 <SysTick_Handler+0x9>

x86 assembly (clang, -O2):
<SysTick_Handler>:
jmp    1100 <SysTick_Handler>

LLVM IR (-O0):
define weak void @SysTick_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @SysTick_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
void dead_result9(int *data) {
  int j;
  j = data[2];
  data[j] = 2;
}


x86 assembly (clang, -O0):
<dead_result9>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x2,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dead_result9>:
movslq 0x8(%rdi),%rax
movl   $0x2,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @dead_result9(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 2
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
store i32 2, i32* %10
ret void
}

LLVM IR (-O2):
define void @dead_result9(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
store i32 2, i32* %5
ret void
}
void buzzer_on(void) { (*(volatile unsigned long *)0xE02000A4) |= 1 << 0; }


x86 assembly (clang, -O0):
<buzzer_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe02000a4,%eax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    $0xe02000a4,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<buzzer_on>:
mov    $0xe02000a4,%eax
orq    $0x1,(%rax)
ret

LLVM IR (-O0):
define void @buzzer_on() {
%1 = load volatile i64, i64* inttoptr (i64 3760193700 to i64*)
%2 = or i64 %1, 1
store volatile i64 %2, i64* inttoptr (i64 3760193700 to i64*)
ret void
}

LLVM IR (-O2):
define void @buzzer_on() {
%1 = load volatile i64, i64* inttoptr (i64 3760193700 to i64*)
%2 = or i64 %1, 1
store volatile i64 %2, i64* inttoptr (i64 3760193700 to i64*)
ret void
}
/* Variables and functions */
int gNot(int /*<<< orphan*/);
int /*<<< orphan*/ gXor(int, int);
int gXnor(int a, int b) { return gNot(gXor(a, b)); }


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

x86 assembly (clang, -O2):
<gXnor>:
push   %rax
call   1040 <gXor@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <gNot@plt>

LLVM IR (-O0):
define i32 @gXnor(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 @gXor(i32 %5, i32 %6)
%8 = call i32 @gNot(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @gXnor(i32 %0, i32 %1) {
%3 = tail call i32 @gXor(i32 %0, i32 %1)
%4 = tail call i32 @gNot(i32 %3)
ret i32 %4
}
void dhvani_debug(const char *srcfile, int lineno, const char *format, ...) {}


x86 assembly (clang, -O0):
<dhvani_debug>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @dhvani_debug(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
ret void
}

LLVM IR (-O2):
define void @dhvani_debug(i8* nocapture %0, i32 %1, i8* nocapture %2, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(void) {
  double d = -12.0;
  long l = (d > 10000) ? (unsigned long)d : (long)d;
  if (l != -12)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1187 <main+0x67>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb0(%rip),%xmm2
movaps %xmm0,%xmm1
subsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rcx
cvttsd2si %xmm0,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    1191 <main+0x71>
cvttsd2si -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0xfffffffffffffff4,-0x18(%rbp)
je     11ab <main+0x8b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i64
store i32 0, i32* %1
store double -1.200000e+01, double* %2
%4 = load double, double* %2
%5 = fcmp ogt double %4, 1.000000e+04
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load double, double* %2
%8 = fptoui double %7 to i64
br label %12
9: ; preds = %0
%10 = load double, double* %2
%11 = fptosi double %10 to i64
br label %12
12: ; preds = %9, %6
%13 = phi i64 [ %8, %6 ], [ %11, %9 ]
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = icmp ne i64 %14, -12
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %12
%19 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void nrerror(char error_text[]) {
  fprintf(stderr, "Numerical Recipes run-time error...\n");
  fprintf(stderr, "%s\n", error_text);
  fprintf(stderr, "...now exiting to system...\n");
  exit(1);
}


x86 assembly (clang, -O0):
<nrerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xebb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<nrerror>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xedc(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Numerical Recipes run-time error...\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [29 x i8] c"...now exiting to system...\0A\00"
define void @nrerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %2
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Numerical Recipes run-time error...\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [29 x i8] c"...now exiting to system...\0A\00"
define void @nrerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
void apic_eoi(uint8_t *baseapic) { *((uint32_t *)&baseapic[0xb0]) = 0; }


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

x86 assembly (clang, -O2):
<apic_eoi>:
movq   $0x0,0x2c0(%rdi)
ret

LLVM IR (-O0):
define void @apic_eoi(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 176
%5 = bitcast i32* %4 to i64*
store i64 0, i64* %5
ret void
}

LLVM IR (-O2):
define void @apic_eoi(i32* nocapture writeonly %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 176
%3 = bitcast i32* %2 to i64*
store i64 0, i64* %3
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t adjust_seed_3(uint32_t seed) { return seed ^ (seed << 3); }


x86 assembly (clang, -O0):
<adjust_seed_3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x3,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjust_seed_3>:
lea    0x0(,%rdi,8),%eax
xor    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @adjust_seed_3(i32 %0) {
%2 = shl i32 %0, 3
%3 = xor i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void argument_missing_error(char *param) {
  fprintf(stderr, "Argument \"%s\" requires argument\n", param);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Argument \22%s\22 requires argument\0A\00"
define void @argument_missing_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Argument \22%s\22 requires argument\0A\00"
define void @argument_missing_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
double min(double x, double y) { return x < y ? x : y; }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <min+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <min+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
minsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @min(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @min(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
float dds_lookupx(scalar_t__);
float dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale,
               int32_t phase) {
  float amp;
  amp = dds_lookupx(*phase_acc + phase) * scale;
  *phase_acc += phase_rate;
  return amp;
}


x86 assembly (clang, -O0):
<dds_modf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
add    -0x20(%rbp),%rdi
call   1030 <dds_lookupx@plt>
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
movss  -0x24(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dds_modf>:
push   %r14
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
add    (%rdi),%rdx
mov    %rdx,%rdi
call   1030 <dds_lookupx@plt>
mulss  0x4(%rsp),%xmm0
add    %r14,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float @dds_modf(i64* %0, i64 %1, float %2, i64 %3) {
%5 = alloca i64*
%6 = alloca i64
%7 = alloca float
%8 = alloca i64
%9 = alloca float
store i64* %0, i64** %5
store i64 %1, i64* %6
store float %2, float* %7
store i64 %3, i64* %8
%10 = load i64*, i64** %5
%11 = load i64, i64* %10
%12 = load i64, i64* %8
%13 = add nsw i64 %11, %12
%14 = call float @dds_lookupx(i64 %13)
%15 = load float, float* %7
%16 = fmul float %14, %15
store float %16, float* %9
%17 = load i64, i64* %6
%18 = load i64*, i64** %5
%19 = load i64, i64* %18
%20 = add nsw i64 %19, %17
store i64 %20, i64* %18
%21 = load float, float* %9
ret float %21
}

LLVM IR (-O2):
define float @dds_modf(i64* nocapture %0, i64 %1, float %2, i64 %3) {
%5 = load i64, i64* %0
%6 = add nsw i64 %5, %3
%7 = tail call float @dds_lookupx(i64 %6)
%8 = fmul float %7, %2
%9 = load i64, i64* %0
%10 = add nsw i64 %9, %1
store i64 %10, i64* %0
ret float %8
}
/* Variables and functions */
int nextEmpty(char **strs, int len) {
  int i;
  for (i = 0; i < len; i++) {
    if (strs[i] == NULL) {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<nextEmpty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    114f <nextEmpty+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    113c <nextEmpty+0x3c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <nextEmpty+0x56>
jmp    1141 <nextEmpty+0x41>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <nextEmpty+0x12>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextEmpty>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    1120 <nextEmpty+0x20>
mov    %esi,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmpq   $0x0,(%rdi,%rcx,8)
je     1121 <nextEmpty+0x21>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <nextEmpty+0x10>
ret
mov    %ecx,%eax
ret

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

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

/* Variables and functions */
void blueLEDToggle(void) { (*((volatile uint32_t *)0x40025010)) ^= 0x04; }


x86 assembly (clang, -O0):
<blueLEDToggle>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40025010,%eax
mov    (%rax),%ecx
xor    $0x4,%ecx
mov    $0x40025010,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<blueLEDToggle>:
xorl   $0x4,0x40025010
04
ret

LLVM IR (-O0):
define void @blueLEDToggle() {
%1 = load volatile i32, i32* inttoptr (i64 1073893392 to i32*)
%2 = xor i32 %1, 4
store volatile i32 %2, i32* inttoptr (i64 1073893392 to i32*)
ret void
}

LLVM IR (-O2):
define void @blueLEDToggle() {
%1 = load volatile i32, i32* inttoptr (i64 1073893392 to i32*)
%2 = xor i32 %1, 4
store volatile i32 %2, i32* inttoptr (i64 1073893392 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ boothroyd(int *, int, int, int (*)(int *, int));
void perm2(int *x, int n, int callback(int *, int)) {
  if (callback)
    callback(x, n);
  boothroyd(x, n, n, callback);
}


x86 assembly (clang, -O0):
<perm2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     113b <perm2+0x2b>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   *%rax
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <boothroyd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perm2>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
test   %rdx,%rdx
je     1128 <perm2+0x18>
mov    %r14,%rdi
mov    %ebp,%esi
call   *%rbx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <boothroyd@plt>

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

LLVM IR (-O2):
define void @perm2(i32* %0, i32 %1, i32 (i32*, i32)* %2) {
%4 = icmp eq i32 (i32*, i32)* %2, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 %2(i32* %0, i32 %1)
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @boothroyd(i32* %0, i32 %1, i32 %1, i32 (i32*, i32)* %2)
ret void
}
int isnan(double x) { return (x != x); }


x86 assembly (clang, -O0):
<isnan>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnan>:
xor    %eax,%eax
ucomisd %xmm0,%xmm0
setp   %al
ret

LLVM IR (-O0):
define i32 @isnan(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fcmp une double %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isnan(double %0) {
%2 = fcmp uno double %0, 0.000000e+00
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ panicbug(char *, char const *, char const *, int,
                            char const *);
void jit_fail(const char *msg, const char *file, int line,
              const char *function) {
  panicbug("JIT failure in function %s from file %s at line %d: %s", function,
           file, line, msg);
  abort();
}


x86 assembly (clang, -O0):
<jit_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8
lea    0xeb3(%rip),%rdi
call   1040 <panicbug@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<jit_fail>:
push   %rax
mov    %edx,%eax
mov    %rsi,%rdx
mov    %rdi,%r8
lea    0xed0(%rip),%rdi
mov    %rcx,%rsi
mov    %eax,%ecx
call   1040 <panicbug@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"JIT failure in function %s from file %s at line %d: %s\00"
define void @jit_fail(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i8*, i8** %5
%13 = call i32 @panicbug(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i32 %11, i8* %12)
%14 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [55 x i8] c"JIT failure in function %s from file %s at line %d: %s\00"
define void @jit_fail(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i32 @panicbug(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %1, i32 %2, i8* %0)
%6 = tail call i32 (...) @abort()
unreachable
}
long hashGlass(long idnumbers[4], long maxhash) {
  long s, h;
  s = idnumbers[0] + idnumbers[1] + idnumbers[2] + idnumbers[3];
  h = s % maxhash;
  return (h);
}


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

x86 assembly (clang, -O2):
<hashGlass>:
movdqu (%rdi),%xmm0
movdqu 0x10(%rdi),%xmm1
paddq  %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddq  %xmm1,%xmm0
movq   %xmm0,%rax
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1130 <hashGlass+0x30>
cqto
idiv   %rsi
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i64 @hashGlass(i64* nocapture %0, i64 %1) {
%3 = bitcast i64* %0 to <4 x i64>*
%4 = load <4 x i64>, <4 x i64>* %3
%5 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %4)
%6 = srem i64 %5, %1
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(const char *argv0) {
  printf("Usage: [-d <dev>] [-i <port>]\n");
  printf("  -d, --ib-dev=<dev>     use IB device <dev> (default first device "
         "found)\n");
  printf("  -i, --ib-port=<port>   use port <port> of IB device (default 1)\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2f(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xf38(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Usage: [-d <dev>] [-i <port>]\0A\00"
@.str.1 = [75 x i8] c" -d, --ib-dev=<dev> use IB device <dev> (default first device found)\0A\00"
@.str.2 = [67 x i8] c" -i, --ib-port=<port> use port <port> of IB device (default 1)\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"Usage: [-d <dev>] [-i <port>]\00"
@str.3 = [74 x i8] c" -d, --ib-dev=<dev> use IB device <dev> (default first device found)\00"
@str.4 = [66 x i8] c" -i, --ib-port=<port> use port <port> of IB device (default 1)\00"
define void @usage(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.4, i64 0, i64 0))
ret void
}
double dot(double *a, double *b) {
  double r = 0;
  int i;
  for (i = 0; i < 2; i++) {
    r += a[i] * b[i];
  }
  return r;
}


x86 assembly (clang, -O0):
<dot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    115f <dot+0x5f>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111b <dot+0x1b>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dot>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
mulsd  (%rsi),%xmm1
xorpd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
mulsd  0x8(%rsi),%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @dot(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
store double 0.000000e+00, double* %5
store i32 0, i32* %6
br label %7
7: ; preds = %23, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %26
10: ; preds = %7
%11 = load double*, double** %3
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
%15 = load double, double* %14
%16 = load double*, double** %4
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = load double, double* %5
%22 = call double @llvm.fmuladd.f64(double %15, double %20, double %21)
store double %22, double* %5
br label %23
23: ; preds = %10
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %7
26: ; preds = %7
%27 = load double, double* %5
ret double %27
}

LLVM IR (-O2):
define double @dot(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = tail call double @llvm.fmuladd.f64(double %3, double %4, double 0.000000e+00)
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = tail call double @llvm.fmuladd.f64(double %7, double %9, double %5)
ret double %10
}
void print_policy_str(char *str) {}


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

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

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

LLVM IR (-O2):
define void @print_policy_str(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ gsitp(char *, int);
void g_ssize_t() { gsitp("ssize_t", sizeof(ssize_t)); }


x86 assembly (clang, -O0):
<g_ssize_t>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
call   1030 <gsitp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_ssize_t>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <gsitp@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"ssize_t\00"
define void @g_ssize_t() {
%1 = call i32 @gsitp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"ssize_t\00"
define void @g_ssize_t() {
%1 = tail call i32 @gsitp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
void pvr_dbg_cleanup(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @print_subgraph_() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
usage(char *progname) {
  fprintf(stderr, "usage: %s [flags] <in.ply >out.ply\n", progname);
  fprintf(stderr, "       -n (flip normals)\n");
  fprintf(stderr, "       -b (flip both normals and vertex order in faces)\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rbx
mov    (%rbx),%edi
lea    0xedc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xefa(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"usage: %s [flags] <in.ply >out.ply\0A\00"
@.str.1 = [26 x i8] c" -n (flip normals)\0A\00"
@.str.2 = [57 x i8] c" -b (flip both normals and vertex order in faces)\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %3
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"usage: %s [flags] <in.ply >out.ply\0A\00"
@.str.1 = [26 x i8] c" -n (flip normals)\0A\00"
@.str.2 = [57 x i8] c" -b (flip both normals and vertex order in faces)\0A\00"
define i32 @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
ret i32 undef
}
int test_imm_65uint8_reg(unsigned char val) {
  return ((val) & (-0x65 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_65uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -101
%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_65uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -101
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void foo817(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo817(i32 %0) {
ret void
}
int test_switch() {
  int value = 0;
  while (value < 100) {
    switch (value) {
      int x = 1;
      x = value + 1;
    case 0:
      break;
    case 1:
      continue;
    case 2:
    default:
      continue;
    }
    value++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_switch>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    116c <test_switch+0x6c>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     114a <test_switch+0x4a>
jmp    1128 <test_switch+0x28>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     114f <test_switch+0x4f>
jmp    1139 <test_switch+0x39>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1154 <test_switch+0x54>
jmp    1159 <test_switch+0x59>
jmp    115e <test_switch+0x5e>
jmp    110b <test_switch+0xb>
jmp    1159 <test_switch+0x59>
jmp    110b <test_switch+0xb>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <test_switch+0xb>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @test_switch() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %12, %11, %9, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = load i32, i32* %1
switch i32 %7, label %11 [
i32 0, label %8
i32 1, label %9
i32 2, label %10
]
8: ; preds = %6
br label %12
9: ; preds = %6
br label %3
10: ; preds = %6
br label %11
11: ; preds = %6, %10
br label %3
12: ; preds = %8
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %3
15: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("[SUCCESS] Hello, world!\n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"[SUCCESS] Hello, world!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"[SUCCESS] Hello, world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int putlong(FILE *outf, unsigned long val) {
  unsigned char buf[4];
  buf[0] = (val >> 24);
  buf[1] = (val >> 16);
  buf[2] = (val >> 8);
  buf[3] = (val >> 0);
  return fwrite(buf, 4, 1, outf);
}


x86 assembly (clang, -O0):
<putlong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x18,%rax
mov    %al,-0x14(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
mov    %al,-0x13(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x0,%rax
mov    %al,-0x11(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putlong>:
push   %rax
mov    %rdi,%rcx
bswap  %esi
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @putlong(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca [4 x i8]
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = lshr i64 %6, 24
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
store i8 %8, i8* %9
%10 = load i64, i64* %4
%11 = lshr i64 %10, 16
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 %12, i8* %13
%14 = load i64, i64* %4
%15 = lshr i64 %14, 8
%16 = trunc i64 %15 to i8
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 %16, i8* %17
%18 = load i64, i64* %4
%19 = lshr i64 %18, 0
%20 = trunc i64 %19 to i8
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 %20, i8* %21
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%23 = load i32*, i32** %3
%24 = call i32 @fwrite(i8* %22, i32 4, i32 1, i32* %23)
ret i32 %24
}

LLVM IR (-O2):
define i32 @putlong(i32* nocapture %0, i64 %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = lshr i64 %1, 24
%6 = trunc i64 %5 to i8
store i8 %6, i8* %4
%7 = lshr i64 %1, 16
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %8, i8* %9
%10 = lshr i64 %1, 8
%11 = trunc i64 %10 to i8
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %11, i8* %12
%13 = trunc i64 %1 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %13, i8* %14
%15 = call i32 @fwrite(i8* %4, i32 4, i32 1, i32* %0)
ret i32 %15
}
/* Type definitions */
struct xlist_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct xlist_t *);
void xlist_destroy(struct xlist_t *list) { free(list); }


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

x86 assembly (clang, -O2):
<xlist_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.xlist_t = type { i32 }
define void @xlist_destroy(%struct.xlist_t* nocapture %0) {
%2 = tail call i32 @free(%struct.xlist_t* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ decrRefCount(void *);
void dictRedisObjectDestructor(void *privdata, void *val) {
  ((void)privdata);
  decrRefCount(val);
}


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

x86 assembly (clang, -O2):
<dictRedisObjectDestructor>:
mov    %rsi,%rdi
jmp    1030 <decrRefCount@plt>

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

LLVM IR (-O2):
define void @dictRedisObjectDestructor(i8* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @decrRefCount(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ConvertLocations();
int /*<<< orphan*/ FillMap();
int /*<<< orphan*/ Initialize();
int /*<<< orphan*/ Manhattan();
int /*<<< orphan*/ PlaceObject();
int main(void) {
  Initialize();
  ConvertLocations();
  PlaceObject();
  Manhattan();
  FillMap();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <Initialize@plt>
mov    $0x0,%al
call   1030 <ConvertLocations@plt>
mov    $0x0,%al
call   1070 <PlaceObject@plt>
mov    $0x0,%al
call   1040 <Manhattan@plt>
mov    $0x0,%al
call   1050 <FillMap@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <Initialize@plt>
xor    %eax,%eax
call   1030 <ConvertLocations@plt>
xor    %eax,%eax
call   1070 <PlaceObject@plt>
xor    %eax,%eax
call   1040 <Manhattan@plt>
xor    %eax,%eax
call   1050 <FillMap@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @Initialize()
%3 = call i32 (...) @ConvertLocations()
%4 = call i32 (...) @PlaceObject()
%5 = call i32 (...) @Manhattan()
%6 = call i32 (...) @FillMap()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @Initialize()
%2 = tail call i32 (...) @ConvertLocations()
%3 = tail call i32 (...) @PlaceObject()
%4 = tail call i32 (...) @Manhattan()
%5 = tail call i32 (...) @FillMap()
ret i32 0
}
int f(unsigned x) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void yyerror(const char *s) {
  fprintf(stderr, "EEK, Parser error! Mensage: %s\n", s);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"EEK, Parser error! Mensage: %s\0A\00"
define void @yyerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"EEK, Parser error! Mensage: %s\0A\00"
define void @yyerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct demod_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ selcall_init(struct demod_state *);
void dzvei_init(struct demod_state *s) { selcall_init(s); }


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

x86 assembly (clang, -O2):
<dzvei_init>:
jmp    1030 <selcall_init@plt>

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

LLVM IR (-O2):
%struct.demod_state = type { i32 }
define void @dzvei_init(%struct.demod_state* %0) {
%2 = tail call i32 @selcall_init(%struct.demod_state* %0)
ret void
}