xunge/DecIR huggingface dataset:
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *vecalloc(size_t size) {
  void *memblock = malloc(size);
  if (memblock) {
    memset(memblock, 0, size);
  }
  return memblock;
}


x86 assembly (clang, -O0):
<vecalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1153 <vecalloc+0x33>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vecalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1141 <vecalloc+0x21>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @vecalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
float __ocml_sqrt_f32(float);
float sqrtf(float x) { return __ocml_sqrt_f32(x); }


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

x86 assembly (clang, -O2):
<sqrtf>:
jmp    1030 <__ocml_sqrt_f32@plt>

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

LLVM IR (-O2):
define float @sqrtf(float %0) {
%2 = tail call float @__ocml_sqrt_f32(float %0)
ret float %2
}
char int_to_char(int a) { return a + '0'; }


x86 assembly (clang, -O0):
<int_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_char>:
lea    0x30(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @int_to_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 48
%5 = trunc i32 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @int_to_char(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 48
ret i8 %3
}
void wifi_rsp_https_enable(const struct wifi_msg_https_enable_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_https_enable_rsp_t = type opaque
define void @wifi_rsp_https_enable(%struct.wifi_msg_https_enable_rsp_t* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int keccak_256(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *, size_t);
int ukeccak256(uint8_t *in, size_t inlen, uint8_t *out, size_t outlen) {
  if (!(outlen == 32))
    return -1;
  return keccak_256(out, 32, in, inlen);
}


x86 assembly (clang, -O0):
<ukeccak256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x20,-0x28(%rbp)
je     113f <ukeccak256+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <ukeccak256+0x48>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x20,%esi
call   1030 <keccak_256@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ukeccak256>:
cmp    $0x20,%rcx
jne    112f <ukeccak256+0x1f>
mov    %rsi,%r8
mov    %rdi,%rax
mov    %rdx,%rdi
mov    $0x20,%esi
mov    %rax,%rdx
mov    %r8,%rcx
jmp    1030 <keccak_256@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @ukeccak256(i32* %0, i64 %1, i32* %2, i64 %3) {
%5 = icmp eq i64 %3, 32
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @keccak_256(i32* %2, i32 32, i32* %0, i64 %1)
br label %8
8: ; preds = %4, %6
%9 = phi i32 [ %7, %6 ], [ -1, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ init();
int x_munmap(void *, size_t);
int v4l2_munmap(void *addr, size_t length) {
  init();
  return x_munmap(addr, length);
}


x86 assembly (clang, -O0):
<v4l2_munmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <init@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <x_munmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @v4l2_munmap(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = call i32 (...) @init()
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i32 @x_munmap(i8* %6, i64 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @v4l2_munmap(i8* %0, i64 %1) {
%3 = tail call i32 (...) @init()
%4 = tail call i32 @x_munmap(i8* %0, i64 %1)
ret i32 %4
}
/* Type definitions */
struct emuState {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ TerminalEmulator_writeStr(struct emuState *, char *);
void do_VT52_ident(struct emuState *S) { TerminalEmulator_writeStr(S, "\e/Z"); }


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

x86 assembly (clang, -O2):
<do_VT52_ident>:
lea    0xee9(%rip),%rsi
jmp    1030 <TerminalEmulator_writeStr@plt>

LLVM IR (-O0):
%struct.emuState = type { i32 }
@.str = [4 x i8] c"\1B/Z\00"
define void @do_VT52_ident(%struct.emuState* %0) {
%2 = alloca %struct.emuState*
store %struct.emuState* %0, %struct.emuState** %2
%3 = load %struct.emuState*, %struct.emuState** %2
%4 = call i32 @TerminalEmulator_writeStr(%struct.emuState* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.emuState = type { i32 }
@.str = [4 x i8] c"\1B/Z\00"
define void @do_VT52_ident(%struct.emuState* %0) {
%2 = tail call i32 @TerminalEmulator_writeStr(%struct.emuState* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
int is_time_to_add_a_poison() { return (rand() % 100 < 5); }


x86 assembly (clang, -O0):
<is_time_to_add_a_poison>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x5,%edx
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_time_to_add_a_poison>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
setl   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_time_to_add_a_poison() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 100
%3 = icmp slt i32 %2, 5
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @is_time_to_add_a_poison() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 100
%3 = icmp slt i32 %2, 5
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
double exp(double);
double runif();
int rpoiss(double lambda) {
  double L = exp(-lambda);
  int k = 0;
  double tmp = 1.0;
  double u;
  do {
    k += 1;
    u = runif();
    tmp *= u;
  } while (tmp > L);
  return (k - 1);
}


x86 assembly (clang, -O0):
<rpoiss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <runif@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1167 <rpoiss+0x47>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpoiss>:
push   %rbx
sub    $0x10,%rsp
xorps  0xed4(%rip),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xed1(%rip),%xmm0
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <runif@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%ebx
ucomisd 0x8(%rsp),%xmm0
ja     1150 <rpoiss+0x30>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rpoiss(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store double %0, double* %2
%7 = load double, double* %2
%8 = fneg double %7
%9 = call double @exp(double %8)
store double %9, double* %3
store i32 0, i32* %4
store double 1.000000e+00, double* %5
br label %10
10: ; preds = %17, %1
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = call double (...) @runif()
store double %13, double* %6
%14 = load double, double* %6
%15 = load double, double* %5
%16 = fmul double %15, %14
store double %16, double* %5
br label %17
17: ; preds = %10
%18 = load double, double* %5
%19 = load double, double* %3
%20 = fcmp ogt double %18, %19
br i1 %20, label %10, label %21
21: ; preds = %17
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
ret i32 %23
}

LLVM IR (-O2):
define i32 @rpoiss(double %0) {
%2 = fneg double %0
%3 = tail call double @exp(double %2)
br label %4
4: ; preds = %4, %1
%5 = phi double [ 1.000000e+00, %1 ], [ %9, %4 ]
%6 = phi i32 [ 0, %1 ], [ %7, %4 ]
%7 = add nuw nsw i32 %6, 1
%8 = tail call double (...) @runif()
%9 = fmul double %5, %8
%10 = fcmp ogt double %9, %3
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %6
}
reg0adr1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if (r0 <= (*((double *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<reg0adr1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
mov    $0xa98ac7,%eax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1140 <reg0adr1+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1147 <reg0adr1+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg0adr1>:
movsd  0xa98ac7,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setae  %al
ret

LLVM IR (-O0):
define i32 @reg0adr1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double, double* %8
%15 = load double, double* inttoptr (i64 11111111 to double*)
%16 = fcmp ole double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %6
store i32 1, i32* %7
br label %19
18: ; preds = %6
store i32 0, i32* %7
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @reg0adr1(double %0, double %1, i32 %2, i32 %3, double* nocapture readnone %4, double* nocapture readnone %5) {
%7 = load double, double* inttoptr (i64 11111111 to double*)
%8 = fcmp oge double %7, %0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo(void) { printf("hello\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define void @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
void pq2_init_pci(void) {}


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

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

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

LLVM IR (-O2):
define void @pq2_init_pci() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void equation(int a, int b, int c, int d) {
  int first, second, third;
  first = a * c;
  second = (a * d) + (b * c);
  third = b * d;
  printf("(%d)X*X + (%d)X + (%d)\n", first, second, third);
}


x86 assembly (clang, -O0):
<equation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equation>:
mov    %edx,%eax
imul   %edi,%eax
imul   %ecx,%edi
imul   %esi,%edx
add    %edi,%edx
imul   %esi,%ecx
lea    0xed9(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"(%d)X*X + (%d)X + (%d)\0A\00"
define void @equation(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = mul nsw i32 %12, %13
store i32 %14, i32* %9
%15 = load i32, i32* %5
%16 = load i32, i32* %8
%17 = mul nsw i32 %15, %16
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = mul nsw i32 %18, %19
%21 = add nsw i32 %17, %20
store i32 %21, i32* %10
%22 = load i32, i32* %6
%23 = load i32, i32* %8
%24 = mul nsw i32 %22, %23
store i32 %24, i32* %11
%25 = load i32, i32* %9
%26 = load i32, i32* %10
%27 = load i32, i32* %11
%28 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"(%d)X*X + (%d)X + (%d)\0A\00"
define void @equation(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %2, %0
%6 = mul nsw i32 %3, %0
%7 = mul nsw i32 %2, %1
%8 = add nsw i32 %6, %7
%9 = mul nsw i32 %3, %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8, i32 %9)
ret void
}
void I420ToRGB565Matrix() {}


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

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

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

LLVM IR (-O2):
define void @I420ToRGB565Matrix() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_RAW;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int raw_socket() {
  int fd;
  fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
  if (fd < 0)
    perror("socket(raw)");
  return fd;
}


x86 assembly (clang, -O0):
<raw_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
call   1040 <socket@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1161 <raw_socket+0x41>
lea    0xea4(%rip),%rdi
call   1030 <perror@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_socket>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
call   1040 <socket@plt>
mov    %eax,%ebx
test   %eax,%eax
js     114b <raw_socket+0x2b>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeae(%rip),%rdi
call   1030 <perror@plt>
jmp    1147 <raw_socket+0x27>

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_RAW = global i32 0
@.str = [12 x i8] c"socket(raw)\00"
define i32 @raw_socket() {
%1 = alloca i32
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_RAW
%4 = load i32, i32* @IPPROTO_RAW
%5 = call i32 @socket(i32 %2, i32 %3, i32 %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_RAW = global i32 0
@.str = [12 x i8] c"socket(raw)\00"
define i32 @raw_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_RAW
%3 = load i32, i32* @IPPROTO_RAW
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret i32 %4
}
/* Variables and functions */
void *malloc(size_t);
void *malloc_array_nc(size_t n, size_t size) { return malloc(n * size); }


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

x86 assembly (clang, -O2):
<malloc_array_nc>:
imul   %rsi,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @malloc_array_nc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = mul i64 %5, %6
%8 = call i8* @malloc(i64 %7)
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @malloc_array_nc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @malloc(i64 %3)
ret i8* %4
}
void close_dcd_read(int *indexes, float *fixedcoords) {
  free(indexes);
  free(fixedcoords);
}


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

x86 assembly (clang, -O2):
<close_dcd_read>:
push   %rbx
mov    %rsi,%rbx
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @close_dcd_read(i32* %0, float* %1) {
%3 = alloca i32*
%4 = alloca float*
store i32* %0, i32** %3
store float* %1, float** %4
%5 = load i32*, i32** %3
%6 = bitcast i32* %5 to i8*
%7 = load float*, float** %4
%8 = bitcast float* %7 to i8*
ret void
}

LLVM IR (-O2):
define void @close_dcd_read(i32* nocapture %0, float* nocapture %1) {
%3 = bitcast i32* %0 to i8*
tail call void @free(i8* %3)
%4 = bitcast float* %1 to i8*
tail call void @free(i8* %4)
ret void
}
int soma(int n, int v[]) {
  if (n == 1) {
    return v[0];
  } else {
    int x = soma(n - 1, v);
    return x += v[n - 1];
  }
}


x86 assembly (clang, -O0):
<soma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1137 <soma+0x27>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <soma+0x52>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1030 <soma@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<soma>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x1,%edi
jne    1121 <soma+0x11>
mov    (%r14),%eax
jmp    1136 <soma+0x26>
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
mov    %r14,%rsi
call   1030 <soma@plt>
movslq %ebx,%rcx
add    -0x4(%r14,%rcx,4),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @soma(i32 %0, i32* nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* %1
br label %6
6: ; preds = %4, %8
%7 = phi i32 [ %14, %8 ], [ %5, %4 ]
ret i32 %7
8: ; preds = %2
%9 = add nsw i32 %0, -1
%10 = tail call i32 @soma(i32 %9, i32* %1)
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds i32, i32* %1, i64 %11
%13 = load i32, i32* %12
%14 = add nsw i32 %13, %10
br label %6
}
unsigned int fons__hashint(unsigned int a) {
  a += ~(a << 15);
  a ^= (a >> 10);
  a += (a << 3);
  a ^= (a >> 6);
  a += ~(a << 11);
  a ^= (a >> 16);
  return a;
}


x86 assembly (clang, -O0):
<fons__hashint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xf,%eax
xor    $0xffffffff,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xa,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x6,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xb,%eax
xor    $0xffffffff,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fons__hashint>:
mov    %edi,%eax
shl    $0xf,%eax
not    %eax
add    %edi,%eax
mov    %eax,%ecx
shr    $0xa,%ecx
xor    %eax,%ecx
lea    (%rcx,%rcx,8),%eax
mov    %eax,%ecx
shr    $0x6,%ecx
xor    %eax,%ecx
mov    %ecx,%edx
shl    $0xb,%edx
not    %edx
add    %ecx,%edx
mov    %edx,%eax
shr    $0x10,%eax
xor    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @fons__hashint(i32 %0) {
%2 = shl i32 %0, 15
%3 = xor i32 %2, -1
%4 = add i32 %3, %0
%5 = lshr i32 %4, 10
%6 = xor i32 %5, %4
%7 = mul i32 %6, 9
%8 = lshr i32 %7, 6
%9 = xor i32 %8, %7
%10 = shl i32 %9, 11
%11 = xor i32 %10, -1
%12 = add i32 %9, %11
%13 = lshr i32 %12, 16
%14 = xor i32 %13, %12
ret i32 %14
}
void rpn_nn_learn() {}


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

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

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

LLVM IR (-O2):
define void @rpn_nn_learn() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void Derotator(int rotate) {
  rotate = rotate;
  fprintf(stderr, "NexStar does not support an image derotator.\n");
}


x86 assembly (clang, -O0):
<Derotator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Derotator>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"NexStar does not support an image derotator.\0A\00"
define void @Derotator(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store i32 %3, i32* %2
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"NexStar does not support an image derotator.\0A\00"
define void @Derotator(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int int16ToUnsigned32(short s) {
  uint32_t d = (uint32_t)s;
  return (int)d;
}


x86 assembly (clang, -O0):
<int16ToUnsigned32>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswq -0x2(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @int16ToUnsigned32(i16 signext %0) {
%2 = alloca i16
%3 = alloca i64
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = sext i16 %4 to i64
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @int16ToUnsigned32(i16 signext %0) {
%2 = sext i16 %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void var_scope_test() {
  int a = 10;
  printf("a=%d\n", a);
  {
    int a = 20;
    printf("a=%d\n", a);
    {
      int a = 30;
      printf("a=%d\n", a);
    }
    printf("a=%d\n", a);
  }
  printf("a=%d\n", a);
}


x86 assembly (clang, -O0):
<var_scope_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x14,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1e,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<var_scope_test>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"a=%d\0A\00"
define void @var_scope_test() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 30)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 20)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
void *list_extract(struct list *, int);
void *list_popend(struct list *list) { return list_extract(list, -1); }


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

x86 assembly (clang, -O2):
<list_popend>:
mov    $0xffffffff,%esi
jmp    1030 <list_extract@plt>

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

LLVM IR (-O2):
%struct.list = type { i32 }
define i8* @list_popend(%struct.list* %0) {
%2 = tail call i8* @list_extract(%struct.list* %0, i32 -1)
ret i8* %2
}
void INT_Excep_SCI2_ERI2(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI2_ERI2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int strcmp(char *, char const *);
int xstrcmp(char *s1, const char *s2, int frees1) {
  int ret = strcmp(s1, s2);
  if (frees1)
    free(s1);
  return ret;
}


x86 assembly (clang, -O0):
<xstrcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1156 <xstrcmp+0x36>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrcmp>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rdi,%rbx
call   1040 <strcmp@plt>
mov    %eax,%r14d
test   %ebp,%ebp
je     113d <xstrcmp+0x1d>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @xstrcmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%5 = icmp eq i32 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @free(i8* %0)
br label %8
8: ; preds = %6, %3
ret i32 %4
}
unsigned short bswap_short(unsigned short s) {
  return (unsigned short)((s >> 8) & 0x00FF) | ((s << 8) & 0xFF00);
}


x86 assembly (clang, -O0):
<bswap_short>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movzwl %ax,%eax
movzwl -0x2(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap_short>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @bswap_short(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = and i32 %5, 255
%7 = trunc i32 %6 to i16
%8 = zext i16 %7 to i32
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = shl i32 %10, 8
%12 = and i32 %11, 65280
%13 = or i32 %8, %12
%14 = trunc i32 %13 to i16
ret i16 %14
}

LLVM IR (-O2):
define zeroext i16 @bswap_short(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("pass\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
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 = [6 x i8] c"pass\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"pass\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
double ceil(int);
int B64_encoded_l(int decoded_lenght) {
  return ceil(decoded_lenght / 3.0) * 4.0;
}


x86 assembly (clang, -O0):
<B64_encoded_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xee0(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <ceil@plt>
movsd  0xec3(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<B64_encoded_l>:
push   %rax
cvtsi2sd %edi,%xmm0
divsd  0xee3(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <ceil@plt>
mulsd  0xeda(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @B64_encoded_l(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 3.000000e+00
%6 = fptosi double %5 to i32
%7 = call double @ceil(i32 %6)
%8 = fmul double %7, 4.000000e+00
%9 = fptosi double %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @B64_encoded_l(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fdiv double %2, 3.000000e+00
%4 = fptosi double %3 to i32
%5 = tail call double @ceil(i32 %4)
%6 = fmul double %5, 4.000000e+00
%7 = fptosi double %6 to i32
ret i32 %7
}
unsigned short GetBit(unsigned short port, unsigned char number) {
  return (port & (0x0001 << number));
}


x86 assembly (clang, -O0):
<GetBit>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
movzbl -0x3(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetBit>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @GetBit(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = shl i32 1, %8
%10 = and i32 %6, %9
%11 = trunc i32 %10 to i16
ret i16 %11
}

LLVM IR (-O2):
define zeroext i16 @GetBit(i16 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = shl nuw i32 1, %3
%5 = trunc i32 %4 to i16
%6 = and i16 %5, %0
ret i16 %6
}
/* Variables and functions */
int /*<<< orphan*/ test_edge();
int main() {
  test_edge();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_edge()
ret i32 0
}
char Char_copy(char *c) { return *c; }


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

x86 assembly (clang, -O2):
<Char_copy>:
mov    (%rdi),%al
ret

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

LLVM IR (-O2):
define signext i8 @Char_copy(i8* nocapture %0) {
%2 = load i8, i8* %0
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int fibonacci_test(void) {
  printf("begin fact_test\n");
  printf("passed fact_test!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"begin fact_test\0A\00"
@.str.1 = [19 x i8] c"passed fact_test!\0A\00"
define i32 @fibonacci_test() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"begin fact_test\00"
@str.2 = [18 x i8] c"passed fact_test!\00"
define i32 @fibonacci_test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
double V_blendIndexed(int i, double *L) { return L[i]; }


x86 assembly (clang, -O0):
<V_blendIndexed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<V_blendIndexed>:
movslq %edi,%rax
movsd  (%rsi,%rax,8),%xmm0
ret

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

LLVM IR (-O2):
define double @V_blendIndexed(i32 %0, double* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds double, double* %1, i64 %3
%5 = load double, double* %4
ret double %5
}
/* Variables and functions */
char const *ERR_getErrorName(size_t);
const char *FSEv05_getErrorName(size_t code) { return ERR_getErrorName(code); }


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

x86 assembly (clang, -O2):
<FSEv05_getErrorName>:
jmp    1030 <ERR_getErrorName@plt>

LLVM IR (-O0):
define i8* @FSEv05_getErrorName(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @ERR_getErrorName(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @FSEv05_getErrorName(i64 %0) {
%2 = tail call i8* @ERR_getErrorName(i64 %0)
ret i8* %2
}
const char *get_system_type(void) { return "Victor MP-C303/304"; }


x86 assembly (clang, -O0):
<get_system_type>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_system_type>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Victor MP-C303/304\00"
define i8* @get_system_type() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [19 x i8] c"Victor MP-C303/304\00"
define i8* @get_system_type() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void scm_i_pthread_exit(void *retval) { exit(EXIT_SUCCESS); }


x86 assembly (clang, -O0):
<scm_i_pthread_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<scm_i_pthread_exit>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define void @scm_i_pthread_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define void @scm_i_pthread_exit(i8* nocapture readnone %0) {
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
int is_number(const char *p) {
  do {
    if (!((unsigned)((*p) - '0') <= 9))
      return 0;
  } while (*++p != '\0');
  return 1;
}


x86 assembly (clang, -O0):
<is_number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
cmp    $0x9,%eax
jbe    1127 <is_number+0x27>
movl   $0x0,-0x4(%rbp)
jmp    114f <is_number+0x4f>
jmp    112c <is_number+0x2c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1108 <is_number+0x8>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_number>:
mov    (%rdi),%al
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     112c <is_number+0x2c>
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <is_number+0x10>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_number(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %9, %1
%4 = phi i8 [ %2, %1 ], [ %11, %9 ]
%5 = phi i8* [ %0, %1 ], [ %10, %9 ]
%6 = sext i8 %4 to i32
%7 = add nsw i32 %6, -48
%8 = icmp ult i32 %7, 10
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %3
13: ; preds = %9, %3
%14 = phi i32 [ 0, %3 ], [ 1, %9 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(int);
int /*<<< orphan*/ printf(char *, char *, int);
void *safe_malloc(int n, char *file, int line) {
  void *addr = malloc(n);
  if (addr == NULL) {
    printf("Failed to allocate memory: %s (%d)\n", file, line);
    exit(-1);
  }
  return addr;
}


x86 assembly (clang, -O0):
<safe_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1176 <safe_malloc+0x46>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_malloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1149 <safe_malloc+0x19>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Failed to allocate memory: %s (%d)\0A\00"
define i8* @safe_malloc(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14)
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %3
%18 = load i8*, i8** %7
ret i8* %18
}

LLVM IR (-O2):
@.str = [36 x i8] c"Failed to allocate memory: %s (%d)\0A\00"
define noalias i8* @safe_malloc(i32 %0, i8* %1, i32 %2) {
%4 = tail call i8* @malloc(i32 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2)
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %3
ret i8* %4
}