xunge/DecIR huggingface dataset:
void map_left(double x_in, double y_in, double *x_out, double *y_out,
              double *z_out) {
  *x_out = -1;
  *y_out = 2 * x_in - 1;
  *z_out = 1 - 2 * y_in;
}


x86 assembly (clang, -O0):
<map_left>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xee2(%rip),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xecd(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xea8(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_left>:
movabs $0xbff0000000000000,%rax
mov    %rax,(%rdi)
addsd  %xmm0,%xmm0
addsd  0xee7(%rip),%xmm0
movsd  %xmm0,(%rsi)
addsd  %xmm1,%xmm1
movsd  0xedf(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define void @map_left(double %0, double %1, double* %2, double* %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
store double %0, double* %6
store double %1, double* %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%11 = load double*, double** %8
store double -1.000000e+00, double* %11
%12 = load double, double* %6
%13 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %12, double -1.000000e+00)
%14 = load double*, double** %9
store double %13, double* %14
%15 = load double, double* %7
%16 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %15, double 1.000000e+00)
%17 = load double*, double** %10
store double %16, double* %17
ret void
}

LLVM IR (-O2):
define void @map_left(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
store double -1.000000e+00, double* %2
%6 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -1.000000e+00)
store double %6, double* %3
%7 = tail call double @llvm.fmuladd.f64(double %1, double -2.000000e+00, double 1.000000e+00)
store double %7, double* %4
ret void
}
/* Variables and functions */
char *calloc(size_t, int);
int /*<<< orphan*/ snprintf(char *, size_t, char *, char const *, int,
                            char const *, char const *);
const char *shader_load_error_str(const char *file, int line, const char *error,
                                  const char *error_desc) {
  size_t buf_sz = 512;
  char *buf = calloc(buf_sz, 1);
  snprintf(buf, buf_sz, "Error(%s:%d): %s %s", file, line, error, error_desc);
  return buf;
}


x86 assembly (clang, -O0):
<shader_load_error_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x200,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%rax
lea    0xe90(%rip),%rdx
mov    %rax,(%rsp)
call   1030 <snprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shader_load_error_str>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%r12
mov    $0x200,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbp
mov    %rbx,(%rsp)
lea    0xeab(%rip),%rdx
mov    $0x200,%esi
mov    %rax,%rdi
mov    %r12,%rcx
mov    %r15d,%r8d
mov    %r14,%r9
call   1030 <snprintf@plt>
mov    %rbp,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Error(%s:%d): %s %s\00"
define i8* @shader_load_error_str(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i64 512, i64* %9
%11 = load i64, i64* %9
%12 = call i8* @calloc(i64 %11, i32 1)
store i8* %12, i8** %10
%13 = load i8*, i8** %10
%14 = load i64, i64* %9
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = load i8*, i8** %7
%18 = load i8*, i8** %8
%19 = call i32 @snprintf(i8* %13, i64 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %16, i8* %17, i8* %18)
%20 = load i8*, i8** %10
ret i8* %20
}

LLVM IR (-O2):
@.str = [20 x i8] c"Error(%s:%d): %s %s\00"
define i8* @shader_load_error_str(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i8* @calloc(i64 512, i32 1)
%6 = tail call i32 @snprintf(i8* %5, i64 512, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2, i8* %3)
ret i8* %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t flashfsGetWriteBufferSize(void) { return (128 - 1); }


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

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

LLVM IR (-O0):
define i32 @flashfsGetWriteBufferSize() {
ret i32 127
}

LLVM IR (-O2):
define i32 @flashfsGetWriteBufferSize() {
ret i32 127
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("%s\n", "Hello World!");
  printf("size of LONG=%ld\n", sizeof(int));
  printf("If the above value is not 4, then you need to edit acts.h\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [13 x i8] c"Hello World!\00"
@.str.2 = [18 x i8] c"size of LONG=%ld\0A\00"
@.str.3 = [59 x i8] c"If the above value is not 4, then you need to edit acts.h\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 4)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"Hello World!\00"
@.str.2 = [18 x i8] c"size of LONG=%ld\0A\00"
@str = [58 x i8] c"If the above value is not 4, then you need to edit acts.h\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 4)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
unsigned int bsR(int);
int bsGetUInt32(void) {
  unsigned int u;
  u = 0;
  u = (u << 8) | bsR(8);
  u = (u << 8) | bsR(8);
  u = (u << 8) | bsR(8);
  u = (u << 8) | bsR(8);
  return u;
}


x86 assembly (clang, -O0):
<bsGetUInt32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    $0x8,%edi
call   1030 <bsR@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    $0x8,%edi
call   1030 <bsR@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    $0x8,%edi
call   1030 <bsR@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    $0x8,%edi
call   1030 <bsR@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsGetUInt32>:
push   %rbp
push   %rbx
push   %rax
mov    $0x8,%edi
call   1030 <bsR@plt>
mov    %eax,%ebx
mov    $0x8,%edi
call   1030 <bsR@plt>
mov    %eax,%ebp
shl    $0x10,%ebx
shl    $0x8,%ebp
or     %ebx,%ebp
mov    $0x8,%edi
call   1030 <bsR@plt>
mov    %eax,%ebx
or     %ebp,%ebx
shl    $0x8,%ebx
mov    $0x8,%edi
call   1030 <bsR@plt>
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @bsGetUInt32() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* %1
%3 = shl i32 %2, 8
%4 = call i32 @bsR(i32 8)
%5 = or i32 %3, %4
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = shl i32 %6, 8
%8 = call i32 @bsR(i32 8)
%9 = or i32 %7, %8
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = shl i32 %10, 8
%12 = call i32 @bsR(i32 8)
%13 = or i32 %11, %12
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = shl i32 %14, 8
%16 = call i32 @bsR(i32 8)
%17 = or i32 %15, %16
store i32 %17, i32* %1
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @bsGetUInt32() {
%1 = tail call i32 @bsR(i32 8)
%2 = tail call i32 @bsR(i32 8)
%3 = shl i32 %1, 16
%4 = shl i32 %2, 8
%5 = or i32 %4, %3
%6 = tail call i32 @bsR(i32 8)
%7 = or i32 %5, %6
%8 = shl i32 %7, 8
%9 = tail call i32 @bsR(i32 8)
%10 = or i32 %8, %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void bar(int x) {
  if (x != 42)
    abort();
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2a,-0x4(%rbp)
je     112c <bar+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
cmp    $0x2a,%edi
jne    1116 <bar+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @bar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 42
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @bar(i32 %0) {
%2 = icmp eq i32 %0, 42
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
int odd(long n) { return (int)(n & 1); }


x86 assembly (clang, -O0):
<odd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<odd>:
mov    %rdi,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @odd(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 1
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @odd(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = and i32 %2, 1
ret i32 %3
}
/* Type definitions */
struct cec_msg {
  int *msg;
};
typedef int __u16;

/* Variables and functions */
void cec_ops_cdc_hec_discover(const struct cec_msg *msg, __u16 *phys_addr) {
  *phys_addr = (msg->msg[2] << 8) | msg->msg[3];
}


x86 assembly (clang, -O0):
<cec_ops_cdc_hec_discover>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%ecx
shl    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
or     0xc(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_ops_cdc_hec_discover>:
mov    (%rdi),%rax
mov    0x8(%rax),%ecx
shl    $0x8,%ecx
or     0xc(%rax),%ecx
mov    %ecx,(%rsi)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32* }
define void @cec_ops_cdc_hec_discover(%struct.cec_msg* %0, i32* %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca i32*
store %struct.cec_msg* %0, %struct.cec_msg** %3
store i32* %1, i32** %4
%5 = load %struct.cec_msg*, %struct.cec_msg** %3
%6 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %5, i32 0, i32 0
%7 = load i32*, i32** %6
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = load %struct.cec_msg*, %struct.cec_msg** %3
%12 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %11, i32 0, i32 0
%13 = load i32*, i32** %12
%14 = getelementptr inbounds i32, i32* %13, i64 3
%15 = load i32, i32* %14
%16 = or i32 %10, %15
%17 = load i32*, i32** %4
store i32 %16, i32* %17
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32* }
define void @cec_ops_cdc_hec_discover(%struct.cec_msg* nocapture %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
%4 = load i32*, i32** %3
%5 = getelementptr inbounds i32, i32* %4, i64 2
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = getelementptr inbounds i32, i32* %4, i64 3
%9 = load i32, i32* %8
%10 = or i32 %7, %9
store i32 %10, i32* %1
ret void
}
/* Variables and functions */
int popcount(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int x;
  scanf("%d", &x);
  printf("%d\n", popcount(x));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @popcount(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int partition(int *, int, int);
void quicksort(int numbers[], int first, int last) {
  if (first < last) {
    int i = partition(numbers, first, last);
    quicksort(numbers, first, i - 1);
    quicksort(numbers, i + 1, last);
  }
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quicksort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quicksort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quicksort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quicksort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MIDI_QueueNoteMsg(int, unsigned int, unsigned int);
void MIDI_QueueNoteOff(unsigned int channel, unsigned int note,
                       unsigned int velocity) {
  MIDI_QueueNoteMsg((0x80) | channel, note, velocity);
}


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

x86 assembly (clang, -O2):
<MIDI_QueueNoteOff>:
or     $0x80,%edi
jmp    1030 <MIDI_QueueNoteMsg@plt>

LLVM IR (-O0):
define void @MIDI_QueueNoteOff(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = or i32 128, %7
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @MIDI_QueueNoteMsg(i32 %8, i32 %9, i32 %10)
ret void
}

LLVM IR (-O2):
define void @MIDI_QueueNoteOff(i32 %0, i32 %1, i32 %2) {
%4 = or i32 %0, 128
%5 = tail call i32 @MIDI_QueueNoteMsg(i32 %4, i32 %1, i32 %2)
ret void
}
void ff_hevc_put_hevc_pel_pixels4_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_pel_pixels4_8_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ storePhysicalMemory(int /*<<< orphan*/, int);
int /*<<< orphan*/ tlb(int *, int);
void storeVirtualMemory(int *table, int vaddr, int data) {
  storePhysicalMemory(tlb(table, vaddr), data);
}


x86 assembly (clang, -O0):
<storeVirtualMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <tlb@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%esi
call   1030 <storePhysicalMemory@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<storeVirtualMemory>:
push   %rbx
mov    %edx,%ebx
call   1040 <tlb@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <storePhysicalMemory@plt>

LLVM IR (-O0):
define void @storeVirtualMemory(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = call i32 @tlb(i32* %7, i32 %8)
%10 = load i32, i32* %6
%11 = call i32 @storePhysicalMemory(i32 %9, i32 %10)
ret void
}

LLVM IR (-O2):
define void @storeVirtualMemory(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @tlb(i32* %0, i32 %1)
%5 = tail call i32 @storePhysicalMemory(i32 %4, i32 %2)
ret void
}
void XauDisposeAuth() {}


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

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

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

LLVM IR (-O2):
define void @XauDisposeAuth() {
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int errno;
scalar_t__ stat(char const *, struct stat *);
int path_is_dir(const char *path) {
  struct stat st_buf;
  if (stat(path, &st_buf) < 0) {
    return -errno;
  }
  if (S_ISDIR(st_buf.st_mode))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<path_is_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jge    1156 <path_is_dir+0x36>
xor    %eax,%eax
mov    0x2e94(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <path_is_dir+0x5b>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1174 <path_is_dir+0x54>
movl   $0x1,-0x4(%rbp)
jmp    117b <path_is_dir+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_is_dir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
js     1143 <path_is_dir+0x23>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
mov    0x2e96(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@errno = global i32 0
define i32 @path_is_dir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @errno
%10 = sub nsw i32 0, %9
store i32 %10, i32* %2
br label %18
11: ; preds = %1
%12 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i64 @S_ISDIR(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 1, i32* %2
br label %18
17: ; preds = %11
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16, %8
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@errno = global i32 0
define i32 @path_is_dir(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @errno
%8 = sub nsw i32 0, %7
br label %15
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%11 = load i32, i32* %10
%12 = call i64 @S_ISDIR(i32 %11)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %9, %6
%16 = phi i32 [ %8, %6 ], [ %14, %9 ]
ret i32 %16
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t sd_get_base_clock_hz() { return 250000000; }


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

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

LLVM IR (-O0):
define i32 @sd_get_base_clock_hz() {
ret i32 250000000
}

LLVM IR (-O2):
define i32 @sd_get_base_clock_hz() {
ret i32 250000000
}
/* Variables and functions */
int printf(char *, unsigned short);
int print_ushort(unsigned short v) { return printf("%u", v); }


x86 assembly (clang, -O0):
<print_ushort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    0xeda(%rip),%rdi
movzwl -0x2(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ushort>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
define i32 @print_ushort(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 zeroext %3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define i32 @print_ushort(i16 zeroext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i16 zeroext %0)
ret i32 %2
}
int fun1369() { return 1369; }


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

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

LLVM IR (-O0):
define i32 @fun1369() {
ret i32 1369
}

LLVM IR (-O2):
define i32 @fun1369() {
ret i32 1369
}
unsigned long SchedulerElapsedTicksCalc(unsigned long ulTickStart,
                                        unsigned long ulTickEnd) {
  return ((ulTickEnd > ulTickStart)
              ? (ulTickEnd - ulTickStart)
              : ((0xFFFFFFFF - ulTickStart) + ulTickEnd + 1));
}


x86 assembly (clang, -O0):
<SchedulerElapsedTicksCalc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jbe    112b <SchedulerElapsedTicksCalc+0x2b>
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1140 <SchedulerElapsedTicksCalc+0x40>
mov    $0xffffffff,%eax
sub    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SchedulerElapsedTicksCalc>:
xor    %eax,%eax
cmp    %rdi,%rsi
setbe  %al
shl    $0x20,%rax
sub    %rdi,%rax
add    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @SchedulerElapsedTicksCalc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = icmp ugt i64 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i64, i64* %4
%10 = load i64, i64* %3
%11 = sub i64 %9, %10
br label %18
12: ; preds = %2
%13 = load i64, i64* %3
%14 = sub i64 4294967295, %13
%15 = load i64, i64* %4
%16 = add i64 %14, %15
%17 = add i64 %16, 1
br label %18
18: ; preds = %12, %8
%19 = phi i64 [ %11, %8 ], [ %17, %12 ]
ret i64 %19
}

LLVM IR (-O2):
define i64 @SchedulerElapsedTicksCalc(i64 %0, i64 %1) {
%3 = icmp ugt i64 %1, %0
%4 = select i1 %3, i64 0, i64 4294967296
%5 = sub i64 %4, %0
%6 = add i64 %5, %1
ret i64 %6
}
/* Variables and functions */
int fwrite(char *, int, int, void *);
int strlen(char *);
int fputs(char *pszLine, void *hf) {
  int iLen;
  iLen = strlen(pszLine);
  return fwrite(pszLine, 1, iLen, hf);
}


x86 assembly (clang, -O0):
<fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fputs(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @fwrite(i8* %0, i32 1, i32 %3, i8* %1)
ret i32 %4
}
int test_imm_E4uint8_mem(unsigned char *val) {
  return ((*val) & (-0xE4 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E4uint8_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, -228
%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_E4uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 28
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int precidence(char c) {
  switch (c) {
  case '(':
    return 1;
  case ')':
    return 1;
  case '|':
    return 2;
  case '&':
    return 3;
  case '?':
  case '*':
  case '+':
    return 5;
  }
  return 6;
}


x86 assembly (clang, -O0):
<precidence>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x26,%eax
je     119b <precidence+0x9b>
jmp    111f <precidence+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x28,%eax
je     1177 <precidence+0x77>
jmp    1130 <precidence+0x30>
mov    -0xc(%rbp),%eax
sub    $0x29,%eax
je     1183 <precidence+0x83>
jmp    1141 <precidence+0x41>
mov    -0xc(%rbp),%eax
add    $0xffffffd6,%eax
sub    $0x2,%eax
jb     11a7 <precidence+0xa7>
jmp    1155 <precidence+0x55>
mov    -0xc(%rbp),%eax
sub    $0x3f,%eax
je     11a7 <precidence+0xa7>
jmp    1166 <precidence+0x66>
mov    -0xc(%rbp),%eax
sub    $0x7c,%eax
je     118f <precidence+0x8f>
jmp    11b3 <precidence+0xb3>
movl   $0x1,-0x4(%rbp)
jmp    11ba <precidence+0xba>
movl   $0x1,-0x4(%rbp)
jmp    11ba <precidence+0xba>
movl   $0x2,-0x4(%rbp)
jmp    11ba <precidence+0xba>
movl   $0x3,-0x4(%rbp)
jmp    11ba <precidence+0xba>
movl   $0x5,-0x4(%rbp)
jmp    11ba <precidence+0xba>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<precidence>:
cmp    $0x3f,%edi
ja     113f <precidence+0x3f>
mov    %edi,%ecx
movabs $0x80000c0000000000,%rax
bt     %rcx,%rax
jb     112d <precidence+0x2d>
mov    $0x1,%eax
movabs $0x30000000000,%rdx
bt     %rcx,%rdx
jae    1133 <precidence+0x33>
ret
mov    $0x5,%eax
ret
cmp    $0x26,%rcx
jne    113f <precidence+0x3f>
mov    $0x3,%eax
ret
cmp    $0x7c,%edi
jne    114a <precidence+0x4a>
mov    $0x2,%eax
ret
mov    $0x6,%eax
ret

LLVM IR (-O0):
define i32 @precidence(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 40, label %6
i32 41, label %7
i32 124, label %8
i32 38, label %9
i32 63, label %10
i32 42, label %10
i32 43, label %10
]
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
store i32 1, i32* %2
br label %12
8: ; preds = %1
store i32 2, i32* %2
br label %12
9: ; preds = %1
store i32 3, i32* %2
br label %12
10: ; preds = %1, %1, %1
store i32 5, i32* %2
br label %12
11: ; preds = %1
store i32 6, i32* %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @precidence(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %6 [
i32 40, label %7
i32 41, label %7
i32 124, label %3
i32 38, label %4
i32 63, label %5
i32 42, label %5
i32 43, label %5
]
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1, %1, %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %1, %6, %5, %4, %3
%8 = phi i32 [ 6, %6 ], [ 5, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ICPrintMama() { printf("Hello, mama!\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello, mama!\00"
define void @ICPrintMama() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
int limit(int val, int max, int min) {
  if (val > max)
    val = max;
  else if (val < min)
    val = min;
  return val;
}


x86 assembly (clang, -O0):
<limit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1124 <limit+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <limit+0x3b>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1136 <limit+0x36>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <limit+0x3b>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @limit(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = icmp slt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  unsigned int i;
  i = 0;
  while (s[i] != '\0') {
    (*f)(i, &s[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114c <ft_striteri+0x4c>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%ecx
add    %rcx,%rsi
call   *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <ft_striteri+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striteri>:
push   %r15
push   %r14
push   %rbx
cmpb   $0x0,(%rdi)
je     1133 <ft_striteri+0x33>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
mov    %rdi,%rsi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   *%r14
add    $0x1,%ebx
lea    (%r15,%rbx,1),%rsi
cmpb   $0x0,(%r15,%rbx,1)
jne    1120 <ft_striteri+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striteri(i8* %0, void (i32, i8*)* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %10, %5 ], [ %0, %2 ]
%7 = phi i32 [ %8, %5 ], [ 0, %2 ]
tail call void %1(i32 %7, i8* %6)
%8 = add i32 %7, 1
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ output(char *, int);
int /*<<< orphan*/ sscanf(char const *, char *, int *);
void print24DiskWBlkInfo(const char *cmd) {
  int id;
  sscanf(cmd + 9, "%d", &id);
  output("Disk %d Write Data\t0\t0\tKB/s\n", id);
}


x86 assembly (clang, -O0):
<print24DiskWBlkInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x9,%rdi
lea    0xec5(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print24DiskWBlkInfo>:
push   %rax
add    $0x9,%rdi
lea    0xed4(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x4(%rsp),%esi
lea    0xec2(%rip),%rdi
call   1030 <output@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"Disk %d Write Data\090\090\09KB/s\0A\00"
define void @print24DiskWBlkInfo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 9
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @output(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"Disk %d Write Data\090\090\09KB/s\0A\00"
define void @print24DiskWBlkInfo(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8, i8* %0, i64 9
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @output(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}
unsigned long long int llsr(unsigned long long int val, unsigned int shift) {
  union {
    unsigned long long int ll;
    unsigned int w[2];
  } u;
  u.ll = val;
  u.w[0] >>= shift;
  u.w[0] |= u.w[1] << (32 - shift);
  u.w[1] >>= shift;
  return u.ll;
}


x86 assembly (clang, -O0):
<llsr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%eax
shr    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x20,%ecx
sub    -0xc(%rbp),%ecx
shl    %cl,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%eax
shr    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llsr>:
mov    %esi,%ecx
mov    %rdi,%rax
mov    %rdi,%rdx
shr    $0x20,%rdx
shrd   %cl,%edx,%eax
shr    %cl,%edx
shl    $0x20,%rdx
or     %rdx,%rax
ret

LLVM IR (-O0):
%union.anon = type { i64 }
define i64 @llsr(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca %union.anon
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i64, i64* %3
%7 = bitcast %union.anon* %5 to i64*
store i64 %6, i64* %7
%8 = load i32, i32* %4
%9 = bitcast %union.anon* %5 to [2 x i32]*
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%11 = load i32, i32* %10
%12 = lshr i32 %11, %8
store i32 %12, i32* %10
%13 = bitcast %union.anon* %5 to [2 x i32]*
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
%15 = load i32, i32* %14
%16 = load i32, i32* %4
%17 = sub i32 32, %16
%18 = shl i32 %15, %17
%19 = bitcast %union.anon* %5 to [2 x i32]*
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %19, i64 0, i64 0
%21 = load i32, i32* %20
%22 = or i32 %21, %18
store i32 %22, i32* %20
%23 = load i32, i32* %4
%24 = bitcast %union.anon* %5 to [2 x i32]*
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %24, i64 0, i64 1
%26 = load i32, i32* %25
%27 = lshr i32 %26, %23
store i32 %27, i32* %25
%28 = bitcast %union.anon* %5 to i64*
%29 = load i64, i64* %28
ret i64 %29
}

LLVM IR (-O2):
define i64 @llsr(i64 %0, i32 %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = lshr i32 %3, %1
%7 = sub i32 32, %1
%8 = shl i32 %5, %7
%9 = or i32 %8, %6
%10 = lshr i32 %5, %1
%11 = zext i32 %10 to i64
%12 = shl nuw i64 %11, 32
%13 = zext i32 %9 to i64
%14 = or i64 %12, %13
ret i64 %14
}
int myFunction1() { return 5; }


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

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

LLVM IR (-O0):
define i32 @myFunction1() {
ret i32 5
}

LLVM IR (-O2):
define i32 @myFunction1() {
ret i32 5
}
/* Variables and functions */
int from_gps(int);
int ch_code_DCO_phase(int ch) { return (from_gps((ch << 3) + 5)); }


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

x86 assembly (clang, -O2):
<ch_code_DCO_phase>:
lea    0x5(,%rdi,8),%edi
jmp    1030 <from_gps@plt>

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

LLVM IR (-O2):
define i32 @ch_code_DCO_phase(i32 %0) {
%2 = shl i32 %0, 3
%3 = or i32 %2, 5
%4 = tail call i32 @from_gps(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char const);
void schreibe_zeichenkette(const char zeichenkette[]) {
  for (int i = 0; zeichenkette[i]; i++)
    putchar(zeichenkette[i]);
}


x86 assembly (clang, -O0):
<schreibe_zeichenkette>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1154 <schreibe_zeichenkette+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <schreibe_zeichenkette+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<schreibe_zeichenkette>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <schreibe_zeichenkette+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <schreibe_zeichenkette+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @schreibe_zeichenkette(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = call i32 @putchar(i8 signext %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
ret void
}

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

/* Variables and functions */
int /*<<< orphan*/ drv_D4D_send(char *, int);
void drv_D4D_clear(void) {
  char cmd[] = {'E'};
  drv_D4D_send(cmd, sizeof(cmd));
}


x86 assembly (clang, -O0):
<drv_D4D_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x1(%rbp),%rdi
mov    $0x1,%esi
call   1030 <drv_D4D_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_D4D_clear>:
push   %rax
movb   $0x45,0x7(%rsp)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
call   1030 <drv_D4D_send@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.drv_D4D_clear.cmd = [1 x i8] c"E"
define void @drv_D4D_clear() {
%1 = alloca [1 x i8]
%2 = bitcast [1 x i8]* %1 to i8*
%3 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%4 = call i32 @drv_D4D_send(i8* %3, i32 1)
ret void
}

LLVM IR (-O2):
define void @drv_D4D_clear() {
%1 = alloca [1 x i8]
%2 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
store i8 69, i8* %2
%3 = call i32 @drv_D4D_send(i8* %2, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("I'm a subproject bar.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
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 = [23 x i8] c"I'm a subproject bar.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"I'm a subproject bar.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}