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

/* Variables and functions */
int ph_rpc(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, unsigned long);
int phAcceptCall2(int cid, void *udata) {
  char reqbuf[64];
  snprintf(reqbuf, sizeof(reqbuf), "ACCEPT CID=%d UDATA=%08lx", cid,
           (unsigned long)udata);
  return ph_rpc(reqbuf);
}


x86 assembly (clang, -O0):
<phAcceptCall2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    $0x40,%esi
lea    0xeba(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x50(%rbp),%rdi
call   1040 <ph_rpc@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phAcceptCall2>:
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%r8
mov    %edi,%ecx
lea    0xecf(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <ph_rpc@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"ACCEPT CID=%d UDATA=%08lx\00"
define i32 @phAcceptCall2(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [64 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
%10 = call i32 @snprintf(i8* %6, i32 64, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %7, i64 %9)
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%12 = call i32 @ph_rpc(i8* %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [26 x i8] c"ACCEPT CID=%d UDATA=%08lx\00"
define i32 @phAcceptCall2(i32 %0, i8* %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = ptrtoint i8* %1 to i64
%6 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0, i64 %5)
%7 = call i32 @ph_rpc(i8* %4)
ret i32 %7
}
void ioa(int id, int value) {}


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

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

LLVM IR (-O0):
define void @ioa(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @ioa(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
float pow(int, int);
scalar_t__ round(float);
unsigned long int dBtoDec(float dB_value) {
  float temp = 0.0;
  unsigned long int return_value;
  temp = pow(10, dB_value / 20);
  temp = temp * pow(2, 23);
  return_value = (unsigned long int)round(temp);
  return return_value;
}


x86 assembly (clang, -O0):
<dBtoDec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xebe(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%esi
mov    $0xa,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    $0x2,%edi
mov    $0x17,%esi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <round@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dBtoDec>:
push   %rax
divss  0xed7(%rip),%xmm0
cvttss2si %xmm0,%esi
mov    $0xa,%edi
call   1030 <pow@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x2,%edi
mov    $0x17,%esi
call   1030 <pow@plt>
mulss  0x4(%rsp),%xmm0
pop    %rax
jmp    1040 <round@plt>

LLVM IR (-O0):
define i64 @dBtoDec(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i64
store float %0, float* %2
store float 0.000000e+00, float* %3
%5 = load float, float* %2
%6 = fdiv float %5, 2.000000e+01
%7 = fptosi float %6 to i32
%8 = call float @pow(i32 10, i32 %7)
store float %8, float* %3
%9 = load float, float* %3
%10 = call float @pow(i32 2, i32 23)
%11 = fmul float %9, %10
store float %11, float* %3
%12 = load float, float* %3
%13 = call i64 @round(float %12)
store i64 %13, i64* %4
%14 = load i64, i64* %4
ret i64 %14
}

LLVM IR (-O2):
define i64 @dBtoDec(float %0) {
%2 = fdiv float %0, 2.000000e+01
%3 = fptosi float %2 to i32
%4 = tail call float @pow(i32 10, i32 %3)
%5 = tail call float @pow(i32 2, i32 23)
%6 = fmul float %4, %5
%7 = tail call i64 @round(float %6)
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
bool offset_is_aligned(void *p, void *q) {
  uintptr_t x, y;
  x = (uintptr_t)p;
  y = (uintptr_t)q;
  assert(x <= y);
  return ((y - x) & (uintptr_t)7) == 0;
}


x86 assembly (clang, -O0):
<offset_is_aligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
and    $0x7,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<offset_is_aligned>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    %r14,%rsi
setae  %dil
call   1030 <assert@plt>
sub    %r14d,%ebx
xor    %eax,%eax
test   $0x7,%bl
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @offset_is_aligned(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i64
store i64 %8, i64* %5
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
store i64 %10, i64* %6
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = icmp ule i64 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i64, i64* %6
%17 = load i64, i64* %5
%18 = sub i64 %16, %17
%19 = and i64 %18, 7
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @offset_is_aligned(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = icmp uge i8* %1, %0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = sub i64 %4, %3
%9 = and i64 %8, 7
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void simd_fpu_fault(void) { panic("exception(fault): FPU SIMD error"); }


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"exception(fault): FPU SIMD error\00"
define void @simd_fpu_fault() {
%1 = call i32 @panic(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"exception(fault): FPU SIMD error\00"
define void @simd_fpu_fault() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}
int pakowanie(int tab[4]) {
  int pak = 0, i;
  for (i = 0; i < 4; i++)
    pak = (pak << 8) | (tab[i] & 255);
  return pak;
}


x86 assembly (clang, -O0):
<pakowanie>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    114a <pakowanie+0x4a>
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <pakowanie+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pakowanie>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%edx
shl    $0x18,%eax
movzbl %cl,%ecx
shl    $0x10,%ecx
or     %eax,%ecx
shl    $0x8,%edx
movzwl %dx,%edx
or     %ecx,%edx
movzbl 0xc(%rdi),%eax
or     %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @pakowanie(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = load i32, i32* %5
%7 = shl i32 %2, 24
%8 = shl i32 %4, 16
%9 = and i32 %8, 16711680
%10 = or i32 %7, %9
%11 = shl i32 %6, 8
%12 = and i32 %11, 65280
%13 = or i32 %10, %12
%14 = getelementptr inbounds i32, i32* %0, i64 3
%15 = load i32, i32* %14
%16 = and i32 %15, 255
%17 = or i32 %16, %13
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ inc(int *);
int /*<<< orphan*/ stderr;
main() {
  int p = 0;
  while (p < 3) {
    fprintf(stderr, "%08X\n", p);
    inc(&p);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1166 <main+0x46>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xead(%rip),%rsi
call   1030 <fprintf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <inc@plt>
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
xor    %edx,%edx
mov    0x2ea6(%rip),%r15
lea    0xebf(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15),%edi
mov    %r14,%rsi
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <inc@plt>
mov    0xc(%rsp),%edx
cmp    $0x3,%edx
jl     1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"%08X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 3
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = load i32, i32* %2
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @inc(i32* %2)
br label %3
11: ; preds = %3
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"%08X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %8, %3 ]
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%7 = call i32 @inc(i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 3
br i1 %9, label %3, label %10
10: ; preds = %3
ret i32 0
}
void lol() { return; }


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

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

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

LLVM IR (-O2):
define void @lol() {
ret void
}
__attribute__((no, noclone)) unsigned short foo(unsigned char x) {
  return x * 255;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
imul   $0xff,%eax,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
shl    $0x8,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @foo(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = mul nsw i32 %4, 255
%6 = trunc i32 %5 to i16
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @foo(i8 zeroext %0) {
%2 = zext i8 %0 to i16
%3 = mul nuw i16 %2, 255
ret i16 %3
}
unsigned int ar_mbox_get(int my_cid) {}


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

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

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

LLVM IR (-O2):
define i32 @ar_mbox_get(i32 %0) {
ret i32 undef
}
_Bool setgt(int X, int Y) { return X > Y; }


x86 assembly (clang, -O0):
<setgt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setgt>:
cmp    %esi,%edi
setg   %al
ret

LLVM IR (-O0):
define zeroext i1 @setgt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
ret i1 %7
}

LLVM IR (-O2):
define zeroext i1 @setgt(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
ret i1 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ V4L2_TYPE_IS_OUTPUT(int /*<<< orphan*/);
char *q_type(uint32_t type) {
  return V4L2_TYPE_IS_OUTPUT(type) ? "Output" : "Capture";
}


x86 assembly (clang, -O0):
<q_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <V4L2_TYPE_IS_OUTPUT@plt>
mov    %rax,%rdx
lea    0xeda(%rip),%rax
lea    0xecc(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q_type>:
push   %rax
call   1030 <V4L2_TYPE_IS_OUTPUT@plt>
test   %rax,%rax
lea    0xee7(%rip),%rcx
lea    0xed9(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Output\00"
@.str.1 = [8 x i8] c"Capture\00"
define i8* @q_type(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @V4L2_TYPE_IS_OUTPUT(i32 %3)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
ret i8* %7
}

LLVM IR (-O2):
@.str = [7 x i8] c"Output\00"
@.str.1 = [8 x i8] c"Capture\00"
define i8* @q_type(i32 %0) {
%2 = tail call i64 @V4L2_TYPE_IS_OUTPUT(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
ret i8* %4
}
/* Variables and functions */
uintptr_t __syscall(int, uintptr_t);
uintptr_t __brk(uintptr_t newbrk) { return __syscall(45, newbrk); }


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

x86 assembly (clang, -O2):
<__brk>:
mov    %rdi,%rsi
mov    $0x2d,%edi
jmp    1030 <__syscall@plt>

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

LLVM IR (-O2):
define i64 @__brk(i64 %0) {
%2 = tail call i64 @__syscall(i32 45, i64 %0)
ret i64 %2
}
/* Variables and functions */
void *aligned_malloc(size_t, unsigned char);
int /*<<< orphan*/ parse_cli(size_t *, unsigned char *, int, char **);
int /*<<< orphan*/ unit_test(void *, size_t);
int main(int argv, char *argc[]) {
  int ret_val = 0;
  size_t alloc_size;
  unsigned char alignment;
  void *buf;
  if (!parse_cli(&alloc_size, &alignment, argv, argc)) {
    ret_val = 1;
    goto Exit;
  }
  buf = aligned_malloc(alloc_size, alignment);
  unit_test(buf, alloc_size);
Exit:
  return ret_val;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    -0x20(%rbp),%rdi
lea    -0x21(%rbp),%rsi
call   1050 <parse_cli@plt>
cmp    $0x0,%eax
jne    1176 <main+0x46>
movl   $0x1,-0x14(%rbp)
jmp    1194 <main+0x64>
mov    -0x20(%rbp),%rdi
movzbl -0x21(%rbp),%esi
call   1030 <aligned_malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <unit_test@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    %rsi,%rcx
mov    %edi,%edx
lea    0x10(%rsp),%rdi
lea    0xf(%rsp),%rsi
call   1050 <parse_cli@plt>
test   %eax,%eax
je     116f <main+0x3f>
mov    0x10(%rsp),%rdi
movzbl 0xf(%rsp),%esi
call   1030 <aligned_malloc@plt>
mov    0x10(%rsp),%rsi
mov    %rax,%rdi
call   1040 <unit_test@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @parse_cli(i64* %7, i8* %8, i32 %10, i8** %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %2
store i32 1, i32* %6
br label %22
15: ; preds = %2
%16 = load i64, i64* %7
%17 = load i8, i8* %8
%18 = call i8* @aligned_malloc(i64 %16, i8 zeroext %17)
store i8* %18, i8** %9
%19 = load i8*, i8** %9
%20 = load i64, i64* %7
%21 = call i32 @unit_test(i8* %19, i64 %20)
br label %22
22: ; preds = %15, %14
%23 = load i32, i32* %6
ret i32 %23
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i64
%4 = alloca i8
%5 = bitcast i64* %3 to i8*
%6 = call i32 @parse_cli(i64* %3, i8* %4, i32 %0, i8** %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i64, i64* %3
%10 = load i8, i8* %4
%11 = call i8* @aligned_malloc(i64 %9, i8 zeroext %10)
%12 = load i64, i64* %3
%13 = call i32 @unit_test(i8* %11, i64 %12)
br label %14
14: ; preds = %2, %8
%15 = phi i32 [ 0, %8 ], [ 1, %2 ]
ret i32 %15
}
int cgio_release_id(int cgio_num, double id) { return 0; }


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

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

LLVM IR (-O0):
define i32 @cgio_release_id(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @cgio_release_id(i32 %0, double %1) {
ret i32 0
}
void enable_mlook(void) {}


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

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

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

LLVM IR (-O2):
define void @enable_mlook() {
ret void
}
const char *xmlBoolToText(int boolval) {
  if (boolval)
    return ("True");
  else
    return ("False");
}


x86 assembly (clang, -O0):
<xmlBoolToText>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1121 <xmlBoolToText+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    112c <xmlBoolToText+0x2c>
lea    0xedd(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlBoolToText>:
test   %edi,%edi
lea    0xefc(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"True\00"
@.str.1 = [6 x i8] c"False\00"
define i8* @xmlBoolToText(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"True\00"
@.str.1 = [6 x i8] c"False\00"
define i8* @xmlBoolToText(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int mntinfo(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Usage: %s <fs name>\n", argv[0]);
    return 1;
  }
  return mntinfo(argv[1]);
}


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)
cmpl   $0x2,-0x8(%rbp)
je     115f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    116f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <mntinfo@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1130 <main+0x10>
mov    0x8(%rsi),%rdi
pop    %rax
jmp    1030 <mntinfo@plt>
mov    (%rsi),%rsi
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Usage: %s <fs name>\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 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 1, i32* %3
br label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @mntinfo(i8* %16)
store i32 %17, i32* %3
br label %18
18: ; preds = %13, %8
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [21 x i8] c"Usage: %s <fs name>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %11
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @mntinfo(i8* %9)
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ 1, %4 ], [ %10, %7 ]
ret i32 %12
}
const struct passwd *cgetpwnam(user, sock) const char *const user;
const int sock;
{ return getpwnam(user); }


x86 assembly (clang, -O0):
<cgetpwnam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <getpwnam@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.passwd = type opaque
define %struct.passwd* @cgetpwnam(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @getpwnam to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to %struct.passwd*
ret %struct.passwd* %8
}

LLVM IR (-O2):
%struct.passwd = type opaque
define %struct.passwd* @cgetpwnam(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getpwnam to i32 (i8*, ...)*)(i8* %0)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to %struct.passwd*
ret %struct.passwd* %5
}
/* Variables and functions */
int M_PI;
scalar_t__ pow(int, int);
float R_from_mass(float Mass, float rho) {
  return (float)pow((3. / (4. * rho * M_PI) * Mass), (1. / 3.));
}


x86 assembly (clang, -O0):
<R_from_mass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed5(%rip),%xmm1
mulsd  %xmm0,%xmm1
mov    0x2eaa(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xeb2(%rip),%xmm0
divsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
xor    %esi,%esi
call   1030 <pow@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<R_from_mass>:
push   %rax
cvtss2sd %xmm1,%xmm1
mulsd  0xee3(%rip),%xmm1
mov    0x2ec4(%rip),%rax
cvtsi2sdl (%rax),%xmm2
mulsd  %xmm1,%xmm2
movsd  0xed4(%rip),%xmm1
divsd  %xmm2,%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
xor    %esi,%esi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global i32 0
define float @R_from_mass(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = fpext float %5 to double
%7 = fmul double 4.000000e+00, %6
%8 = load i32, i32* @M_PI
%9 = sitofp i32 %8 to double
%10 = fmul double %7, %9
%11 = fdiv double 3.000000e+00, %10
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = fmul double %11, %13
%15 = fptosi double %14 to i32
%16 = call i64 @pow(i32 %15, i32 0)
%17 = sitofp i64 %16 to float
ret float %17
}

LLVM IR (-O2):
@M_PI = global i32 0
define float @R_from_mass(float %0, float %1) {
%3 = fpext float %1 to double
%4 = fmul double %3, 4.000000e+00
%5 = load i32, i32* @M_PI
%6 = sitofp i32 %5 to double
%7 = fmul double %4, %6
%8 = fdiv double 3.000000e+00, %7
%9 = fpext float %0 to double
%10 = fmul double %8, %9
%11 = fptosi double %10 to i32
%12 = tail call i64 @pow(i32 %11, i32 0)
%13 = sitofp i64 %12 to float
ret float %13
}
unsigned bitarithm_msb(unsigned v) {
  register unsigned r;
  r = 0;
  while (v >>= 1) {
    r++;
  }
  return r;
}


x86 assembly (clang, -O0):
<bitarithm_msb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     112e <bitarithm_msb+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <bitarithm_msb+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitarithm_msb>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     111c <bitarithm_msb+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <bitarithm_msb+0x10>
ret

LLVM IR (-O0):
define i32 @bitarithm_msb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = lshr i32 %5, 1
store i32 %6, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = add i32 %9, 1
store i32 %10, i32* %3
br label %4
11: ; preds = %4
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @bitarithm_msb(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 4
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ my_fatal(char *, char *, int);
int rank_to_char(int rank) {
  {
    if (!(rank >= 0 && rank < 8))
      my_fatal("file \"%s\", line %d, assertion \""
               "rank>=0&&rank<8"
               "\" failed\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/"
               "master/square.c",
               191);
  };
  return '1' + rank;
}


x86 assembly (clang, -O0):
<rank_to_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     112f <rank_to_char+0x1f>
cmpl   $0x8,-0x4(%rbp)
jl     1147 <rank_to_char+0x37>
lea    0xeca(%rip),%rdi
lea    0xefb(%rip),%rsi
mov    $0xbf,%edx
call   1030 <my_fatal@plt>
mov    -0x4(%rbp),%eax
add    $0x31,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rank_to_char>:
push   %rbx
mov    %edi,%ebx
cmp    $0x8,%edi
jb     1130 <rank_to_char+0x20>
lea    0xee1(%rip),%rdi
lea    0xf12(%rip),%rsi
mov    $0xbf,%edx
call   1030 <my_fatal@plt>
add    $0x31,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"file \22%s\22, line %d, assertion \22rank>=0&&rank<8\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/square.c\00"
define i32 @rank_to_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 8
br i1 %7, label %10, label %8
8: ; preds = %5, %1
%9 = call i32 @my_fatal(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 191)
br label %10
10: ; preds = %8, %5
%11 = load i32, i32* %2
%12 = add nsw i32 49, %11
ret i32 %12
}

LLVM IR (-O2):
@.str = [56 x i8] c"file \22%s\22, line %d, assertion \22rank>=0&&rank<8\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/square.c\00"
define i32 @rank_to_char(i32 %0) {
%2 = icmp ult i32 %0, 8
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @my_fatal(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 191)
br label %5
5: ; preds = %1, %3
%6 = add nsw i32 %0, 49
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ mock_push(int /*<<< orphan*/);
int /*<<< orphan*/ pack_glXGetVideoSyncSGI(int /*<<< orphan*/ *,
                                           unsigned int *);
int glXGetVideoSyncSGI(unsigned int *count) {
  { mock_push(pack_glXGetVideoSyncSGI(NULL, count)); };
  return (int)0;
}


x86 assembly (clang, -O0):
<glXGetVideoSyncSGI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pack_glXGetVideoSyncSGI@plt>
mov    %eax,%edi
call   1030 <mock_push@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glXGetVideoSyncSGI>:
push   %rax
mov    %rdi,%rsi
xor    %edi,%edi
call   1040 <pack_glXGetVideoSyncSGI@plt>
mov    %eax,%edi
call   1030 <mock_push@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @glXGetVideoSyncSGI(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @pack_glXGetVideoSyncSGI(i32* null, i32* %3)
%5 = call i32 @mock_push(i32 %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @glXGetVideoSyncSGI(i32* %0) {
%2 = tail call i32 @pack_glXGetVideoSyncSGI(i32* null, i32* %0)
%3 = tail call i32 @mock_push(i32 %2)
ret i32 0
}
void turn_on_led() {
  (*(volatile unsigned long *)0x01C20810) = 1 << 17;
  (*(volatile unsigned long *)0x01F02C10) = 0xFFF;
}


x86 assembly (clang, -O0):
<turn_on_led>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1c20810,%eax
movq   $0x20000,(%rax)
mov    $0x1f02c10,%eax
movq   $0xfff,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn_on_led>:
movq   $0x20000,0x1c20810
movq   $0xfff,0x1f02c10
ret

LLVM IR (-O0):
define void @turn_on_led() {
store volatile i64 131072, i64* inttoptr (i64 29493264 to i64*)
store volatile i64 4095, i64* inttoptr (i64 32517136 to i64*)
ret void
}

LLVM IR (-O2):
define void @turn_on_led() {
store volatile i64 131072, i64* inttoptr (i64 29493264 to i64*)
store volatile i64 4095, i64* inttoptr (i64 32517136 to i64*)
ret void
}
/* Type definitions */
typedef char *int64_t;

/* Variables and functions */
int64_t neg16(int64_t in) {
  int64_t out;
  asm("neg %%ax" : "=a"(out) : "0"(in));
  return out;
}


x86 assembly (clang, -O0):
<neg16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
neg    %ax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<neg16>:
mov    %rdi,%rax
neg    %ax
ret

LLVM IR (-O0):
define i8* @neg16(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* asm "neg %ax", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define i8* @neg16(i8* readnone %0) {
%2 = tail call i8* asm "neg %ax", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ _panic(char *);
void sys_ipc(void) { _panic("sys_ipc"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"sys_ipc\00"
define void @sys_ipc() {
%1 = tail call i32 @_panic(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
void glStencilMask(void) { return; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t att_event_handle_value_indication_complete_get_attribute_handle(
    const uint8_t *event) {
  return little_endian_read_16(event, 5);
}


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

x86 assembly (clang, -O2):
<att_event_handle_value_indication_complete_get_attribute_handle>:
mov    $0x5,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @att_event_handle_value_indication_complete_get_attribute_handle(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 5)
ret i32 %2
}
void hal_system_start(void *img_start) {
  typedef void jump_fn(void);
  jump_fn *fn = (jump_fn *)img_start;
  fn();
}


x86 assembly (clang, -O0):
<hal_system_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
call   *-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hal_system_start>:
jmp    *%rdi

LLVM IR (-O0):
define void @hal_system_start(i8* %0) {
%2 = alloca i8*
%3 = alloca void ()*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to void ()*
store void ()* %5, void ()** %3
%6 = load void ()*, void ()** %3
ret void
}

LLVM IR (-O2):
define void @hal_system_start(i8* nocapture %0) {
%2 = bitcast i8* %0 to void ()*
tail call void %2()
ret void
}
int HelpItem29(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem29() {
ret i32 0
}
int f_gt_mr1(float *a1, float a2) { return (((*a1) > (a2))); }


x86 assembly (clang, -O0):
<f_gt_mr1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
ucomiss -0xc(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_gt_mr1>:
movss  (%rdi),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define i32 @f_gt_mr1(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float, float* %4
%8 = fcmp ogt float %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @f_gt_mr1(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = fcmp ogt float %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
void sigalrm(int signo) {}


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

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

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

LLVM IR (-O2):
define void @sigalrm(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int raise(int signal) {
  printf("raise(): Not yet implemented!\n");
  return -1;
}


x86 assembly (clang, -O0):
<raise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [31 x i8] c"raise(): Not yet implemented!\0A\00"
define i32 @raise(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@str = [30 x i8] c"raise(): Not yet implemented!\00"
define i32 @raise(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void csf_free(void *buf, int sz) {
  memset(buf, 0, sz);
  free(buf);
}


x86 assembly (clang, -O0):
<csf_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csf_free>:
push   %rbx
mov    %esi,%edx
mov    %rdi,%rbx
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @csf_free(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
%4 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void pl(char *s) { printf("\n%s", s); }


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

x86 assembly (clang, -O2):
<pl>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"\0A%s\00"
define void @pl(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ByteSwap16(int /*<<< orphan*/);
uint16_t ToBE16(uint16_t value) { return ByteSwap16(value); }


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

x86 assembly (clang, -O2):
<ToBE16>:
jmp    1030 <ByteSwap16@plt>

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

LLVM IR (-O2):
define i32 @ToBE16(i32 %0) {
%2 = tail call i32 @ByteSwap16(i32 %0)
ret i32 %2
}
/* Type definitions */
struct ps_summary {
  int dummy;
};
struct obus_server {
  int dummy;
};
struct obus_object {
  int dummy;
};

/* Variables and functions */
int obus_server_unregister_object(struct obus_server *, struct obus_object *);
int ps_summary_unregister(struct obus_server *server,
                          struct ps_summary *object) {
  struct obus_object *obj = (struct obus_object *)object;
  return obus_server_unregister_object(server, obj);
}


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

x86 assembly (clang, -O2):
<ps_summary_unregister>:
jmp    1030 <obus_server_unregister_object@plt>

LLVM IR (-O0):
%struct.obus_server = type { i32 }
%struct.ps_summary = type { i32 }
%struct.obus_object = type { i32 }
define i32 @ps_summary_unregister(%struct.obus_server* %0, %struct.ps_summary* %1) {
%3 = alloca %struct.obus_server*
%4 = alloca %struct.ps_summary*
%5 = alloca %struct.obus_object*
store %struct.obus_server* %0, %struct.obus_server** %3
store %struct.ps_summary* %1, %struct.ps_summary** %4
%6 = load %struct.ps_summary*, %struct.ps_summary** %4
%7 = bitcast %struct.ps_summary* %6 to %struct.obus_object*
store %struct.obus_object* %7, %struct.obus_object** %5
%8 = load %struct.obus_server*, %struct.obus_server** %3
%9 = load %struct.obus_object*, %struct.obus_object** %5
%10 = call i32 @obus_server_unregister_object(%struct.obus_server* %8, %struct.obus_object* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.obus_server = type { i32 }
%struct.ps_summary = type { i32 }
%struct.obus_object = type { i32 }
define i32 @ps_summary_unregister(%struct.obus_server* %0, %struct.ps_summary* %1) {
%3 = bitcast %struct.ps_summary* %1 to %struct.obus_object*
%4 = tail call i32 @obus_server_unregister_object(%struct.obus_server* %0, %struct.obus_object* %3)
ret i32 %4
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int rndu64();
uint64_t rndu64_ranged(uint64_t range) {
  uint64_t max, r;
  r = rndu64();
  if (range == 0) {
    return r;
  }
  max = -(((uint64_t)-range) % range);
  if (max) {
    while (r >= max) {
      r = rndu64();
    }
  }
  return r % range;
}


x86 assembly (clang, -O0):
<rndu64_ranged>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rndu64@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113a <rndu64_ranged+0x2a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1183 <rndu64_ranged+0x73>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
cltd
idivl  -0x8(%rbp)
xor    %eax,%eax
sub    %edx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1179 <rndu64_ranged+0x69>
jmp    1159 <rndu64_ranged+0x49>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1174 <rndu64_ranged+0x64>
mov    $0x0,%al
call   1030 <rndu64@plt>
mov    %eax,-0x10(%rbp)
jmp    1159 <rndu64_ranged+0x49>
jmp    1179 <rndu64_ranged+0x69>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rndu64_ranged>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rndu64@plt>
test   %ebx,%ebx
je     1123 <rndu64_ranged+0x13>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @rndu64_ranged(i32 %0) {
%2 = tail call i32 (...) @rndu64()
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = srem i32 %2, %0
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_rwlock_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_rwlock_init(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_rwlock_rdlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_rwlock_unlock(int /*<<< orphan*/ *);
void build_check(void) {
  pthread_rwlock_t lock;
  pthread_rwlock_init(&lock, NULL);
  pthread_rwlock_rdlock(&lock);
  pthread_rwlock_unlock(&lock);
  pthread_rwlock_destroy(&lock);
}


x86 assembly (clang, -O0):
<build_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <pthread_rwlock_init@plt>
lea    -0x4(%rbp),%rdi
call   1040 <pthread_rwlock_rdlock@plt>
lea    -0x4(%rbp),%rdi
call   1060 <pthread_rwlock_unlock@plt>
lea    -0x4(%rbp),%rdi
call   1030 <pthread_rwlock_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_check>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <pthread_rwlock_init@plt>
mov    %rbx,%rdi
call   1040 <pthread_rwlock_rdlock@plt>
mov    %rbx,%rdi
call   1060 <pthread_rwlock_unlock@plt>
mov    %rbx,%rdi
call   1030 <pthread_rwlock_destroy@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @build_check() {
%1 = alloca i32
%2 = call i32 @pthread_rwlock_init(i32* %1, i32* null)
%3 = call i32 @pthread_rwlock_rdlock(i32* %1)
%4 = call i32 @pthread_rwlock_unlock(i32* %1)
%5 = call i32 @pthread_rwlock_destroy(i32* %1)
ret void
}

LLVM IR (-O2):
define void @build_check() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @pthread_rwlock_init(i32* %1, i32* null)
%4 = call i32 @pthread_rwlock_rdlock(i32* %1)
%5 = call i32 @pthread_rwlock_unlock(i32* %1)
%6 = call i32 @pthread_rwlock_destroy(i32* %1)
ret void
}
/* Variables and functions */
void setUp(void) {}


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

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

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

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