xunge/DecIR huggingface dataset:
unsigned int bitReverse(unsigned int x, unsigned int length) {
  x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
  x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
  x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
  x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
  x = (x >> 16) | (x << 16);
  return (x >> (32 - length));
}


x86 assembly (clang, -O0):
<bitReverse>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaaaaaa,%eax
shr    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x55555555,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xcccccccc,%eax
shr    $0x2,%eax
mov    -0x4(%rbp),%ecx
and    $0x33333333,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0f0f0f0,%eax
shr    $0x4,%eax
mov    -0x4(%rbp),%ecx
and    $0xf0f0f0f,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00ff00,%eax
shr    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00ff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
mov    -0x4(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shr    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitReverse>:
mov    %esi,%ecx
bswap  %edi
mov    %edi,%eax
and    $0xf0f0f0f,%eax
shl    $0x4,%eax
shr    $0x4,%edi
and    $0xf0f0f0f,%edi
or     %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
lea    (%rdi,%rax,4),%eax
mov    %eax,%edx
and    $0x55555555,%edx
shr    %eax
and    $0x55555555,%eax
lea    (%rax,%rdx,2),%eax
neg    %cl
shr    %cl,%eax
ret

LLVM IR (-O0):
define i32 @bitReverse(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 = and i32 %5, -1431655766
%7 = lshr i32 %6, 1
%8 = load i32, i32* %3
%9 = and i32 %8, 1431655765
%10 = shl i32 %9, 1
%11 = or i32 %7, %10
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = and i32 %12, -858993460
%14 = lshr i32 %13, 2
%15 = load i32, i32* %3
%16 = and i32 %15, 858993459
%17 = shl i32 %16, 2
%18 = or i32 %14, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = and i32 %19, -252645136
%21 = lshr i32 %20, 4
%22 = load i32, i32* %3
%23 = and i32 %22, 252645135
%24 = shl i32 %23, 4
%25 = or i32 %21, %24
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = and i32 %26, -16711936
%28 = lshr i32 %27, 8
%29 = load i32, i32* %3
%30 = and i32 %29, 16711935
%31 = shl i32 %30, 8
%32 = or i32 %28, %31
store i32 %32, i32* %3
%33 = load i32, i32* %3
%34 = lshr i32 %33, 16
%35 = load i32, i32* %3
%36 = shl i32 %35, 16
%37 = or i32 %34, %36
store i32 %37, i32* %3
%38 = load i32, i32* %3
%39 = load i32, i32* %4
%40 = sub i32 32, %39
%41 = lshr i32 %38, %40
ret i32 %41
}

LLVM IR (-O2):
define i32 @bitReverse(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.bitreverse.i32(i32 %0)
%4 = sub i32 32, %1
%5 = lshr i32 %3, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ psZeromem(unsigned char *, int);
void psBurnStack(unsigned long len) {
  unsigned char buf[32];
  psZeromem(buf, sizeof(buf));
  if (len > (unsigned long)sizeof(buf)) {
    psBurnStack(len - sizeof(buf));
  }
}


x86 assembly (clang, -O0):
<psBurnStack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1040 <psZeromem@plt>
cmpq   $0x20,-0x8(%rbp)
jbe    1152 <psBurnStack+0x32>
mov    -0x8(%rbp),%rdi
sub    $0x20,%rdi
call   1030 <psBurnStack@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psBurnStack>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    $0x20,%esi
call   1040 <psZeromem@plt>
cmp    $0x21,%rbx
jb     1147 <psBurnStack+0x27>
add    $0xffffffffffffffe0,%rbx
mov    %rbx,%rdi
call   1030 <psBurnStack@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @psBurnStack(i64 %0) {
%2 = alloca i64
%3 = alloca [32 x i8]
store i64 %0, i64* %2
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = call i32 @psZeromem(i8* %4, i32 32)
%6 = load i64, i64* %2
%7 = icmp ugt i64 %6, 32
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i64, i64* %2
%10 = sub i64 %9, 32
br label %11
11: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @psBurnStack(i64 %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = call i32 @psZeromem(i8* %3, i32 32)
%5 = icmp ugt i64 %0, 32
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = add i64 %0, -32
br label %8
8: ; preds = %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ draw_fillrect(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 int, int, int, int, int);
void initscreens() {
  draw_fillrect(0, 0, 320, 240, 90, 100, 225, 2);
  draw_fillrect(0, 0, 400, 240, 90, 100, 225, 1);
}


x86 assembly (clang, -O0):
<initscreens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %esi,%esi
mov    $0x140,%edx
mov    $0xf0,%ecx
mov    $0x5a,%r8d
mov    $0x64,%r9d
mov    %esi,%edi
movl   $0xe1,(%rsp)
movl   $0x2,0x8(%rsp)
call   1030 <draw_fillrect@plt>
xor    %esi,%esi
mov    $0x190,%edx
mov    $0xf0,%ecx
mov    $0x5a,%r8d
mov    $0x64,%r9d
mov    %esi,%edi
movl   $0xe1,(%rsp)
movl   $0x1,0x8(%rsp)
call   1030 <draw_fillrect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initscreens>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
mov    $0x140,%edx
mov    $0xf0,%ecx
mov    $0x5a,%r8d
mov    $0x64,%r9d
push   $0x2
push   $0xe1
call   1030 <draw_fillrect@plt>
add    $0x10,%rsp
xor    %edi,%edi
xor    %esi,%esi
mov    $0x190,%edx
mov    $0xf0,%ecx
mov    $0x5a,%r8d
mov    $0x64,%r9d
push   $0x1
push   $0xe1
call   1030 <draw_fillrect@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
define void @initscreens() {
%1 = call i32 @draw_fillrect(i32 0, i32 0, i32 320, i32 240, i32 90, i32 100, i32 225, i32 2)
%2 = call i32 @draw_fillrect(i32 0, i32 0, i32 400, i32 240, i32 90, i32 100, i32 225, i32 1)
ret void
}

LLVM IR (-O2):
define void @initscreens() {
%1 = tail call i32 @draw_fillrect(i32 0, i32 0, i32 320, i32 240, i32 90, i32 100, i32 225, i32 2)
%2 = tail call i32 @draw_fillrect(i32 0, i32 0, i32 400, i32 240, i32 90, i32 100, i32 225, i32 1)
ret void
}
int EhBisexto(int ano) {
  int result;
  if ((ano % 4 == 0 && ano % 100 != 0) || (ano % 400 == 0)) {
    result = 1;
  } else {
    result = 2;
  }
  return result;
}


x86 assembly (clang, -O0):
<EhBisexto>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    112f <EhBisexto+0x2f>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1143 <EhBisexto+0x43>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <EhBisexto+0x4f>
movl   $0x1,-0x8(%rbp)
jmp    1156 <EhBisexto+0x56>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EhBisexto>:
test   $0x3,%dil
sete   %al
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
cmp    $0x28f5c29,%edx
setae  %dl
and    %al,%dl
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
setb   %al
or     %dl,%al
movzbl %al,%ecx
mov    $0x2,%eax
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @EhBisexto(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp ne i32 %4, 0
%6 = and i1 %3, %5
%7 = srem i32 %0, 400
%8 = icmp eq i32 %7, 0
%9 = or i1 %8, %6
%10 = select i1 %9, i32 1, i32 2
ret i32 %10
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *exeknow_getfilename(char const *path) {
  char *s = strrchr(path, '/');
  if (s == NULL)
    return path;
  return s + 1;
}


x86 assembly (clang, -O0):
<exeknow_getfilename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1146 <exeknow_getfilename+0x36>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <exeknow_getfilename+0x42>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exeknow_getfilename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @exeknow_getfilename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 47)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %3
store i8* %10, i8** %2
br label %14
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %2
br label %14
14: ; preds = %11, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
define i8* @exeknow_getfilename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ write_reg(int, int);
void capture(void) { write_reg(0x04, 0x02); }


x86 assembly (clang, -O0):
<capture>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
mov    $0x2,%esi
call   1030 <write_reg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<capture>:
mov    $0x4,%edi
mov    $0x2,%esi
jmp    1030 <write_reg@plt>

LLVM IR (-O0):
define void @capture() {
%1 = call i32 @write_reg(i32 4, i32 2)
ret void
}

LLVM IR (-O2):
define void @capture() {
%1 = tail call i32 @write_reg(i32 4, i32 2)
ret void
}
double greater(double a, double b) { return a > b; }


x86 assembly (clang, -O0):
<greater>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<greater>:
cmpltsd %xmm0,%xmm1
movsd  0xef3(%rip),%xmm0
andpd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @greater(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = uitofp i1 %3 to double
ret double %4
}
/* Variables and functions */
int smallest_diff(int *, int, int /*<<< orphan*/, int /*<<< orphan*/);
int test_unsorted_empty_array() {
  int a[] = {23, 65, 2, 18, 5};
  return -1 == smallest_diff(a, 5, 0, 0);
}


x86 assembly (clang, -O0):
<test_unsorted_empty_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <smallest_diff@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unsorted_empty_array>:
sub    $0x18,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <smallest_diff@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
mov    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_unsorted_empty_array.a = [5 x i32] [i32 23, i32 65, i32 2, i32 18, i32 5]
define i32 @test_unsorted_empty_array() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @smallest_diff(i32* %3, i32 5, i32 0, i32 0)
%5 = icmp eq i32 -1, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@__const.test_unsorted_empty_array.a = [5 x i32] [i32 23, i32 65, i32 2, i32 18, i32 5]
define i32 @test_unsorted_empty_array() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @smallest_diff(i32* %3, i32 5, i32 0, i32 0)
%5 = icmp eq i32 %4, -1
%6 = zext i1 %5 to i32
ret i32 %6
}
int main() {
  int a;
  int *b;
  if (1 == 2) {
    b = &a;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct cec_msg {
  int len;
  int /*<<< orphan*/ *msg;
};

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_IMAGE_VIEW_ON;
void cec_msg_image_view_on(struct cec_msg *msg) {
  msg->len = 2;
  msg->msg[1] = CEC_MSG_IMAGE_VIEW_ON;
}


x86 assembly (clang, -O0):
<cec_msg_image_view_on>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    0x2ec7(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_image_view_on>:
movl   $0x2,(%rdi)
mov    0x2ed3(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rcx
mov    %eax,0x4(%rcx)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_IMAGE_VIEW_ON = global i32 0
define void @cec_msg_image_view_on(%struct.cec_msg* %0) {
%2 = alloca %struct.cec_msg*
store %struct.cec_msg* %0, %struct.cec_msg** %2
%3 = load %struct.cec_msg*, %struct.cec_msg** %2
%4 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %3, i32 0, i32 0
store i32 2, i32* %4
%5 = load i32, i32* @CEC_MSG_IMAGE_VIEW_ON
%6 = load %struct.cec_msg*, %struct.cec_msg** %2
%7 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %6, i32 0, i32 1
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_IMAGE_VIEW_ON = global i32 0
define void @cec_msg_image_view_on(%struct.cec_msg* nocapture %0) {
%2 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 2, i32* %2
%3 = load i32, i32* @CEC_MSG_IMAGE_VIEW_ON
%4 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %3, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rbtree_test_exit();
int /*<<< orphan*/ rbtree_test_init();
int main(void) {
  rbtree_test_init();
  rbtree_test_exit();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @rbtree_test_init()
%2 = tail call i32 (...) @rbtree_test_exit()
ret i32 0
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 32;
  char buf[6] = {'0', '0', '0', '3', '2', '0'};
  char b = (char)a;
  printf("%d\n", b);
  printf("buf:%d\n", atoi(buf));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x20,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0xb(%rbp)
movsbl -0xb(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
mov    $0x20,%esi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0x140,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.buf = [6 x i8] c"000320"
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [8 x i8] c"buf:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca i8
store i32 32, i32* %1
%4 = bitcast [6 x i8]* %2 to i8*
%5 = load i32, i32* %1
%6 = trunc i32 %5 to i8
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%11 = call i32 @atoi(i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [8 x i8] c"buf:%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 32)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 320)
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *concat(char *one, char *two) {
  char *vrom = (char *)malloc(strlen(one) + strlen(two) + 1);
  strcpy(vrom, one);
  strcat(vrom, two);
  return vrom;
}


x86 assembly (clang, -O0):
<concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @concat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 1
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
define i8* @concat(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1
%6 = add i64 %5, %4
%7 = tail call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @strcpy(i8* %8, i8* %0)
%10 = tail call i32 @strcat(i8* %8, i8* %1)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void sig_handler(int signum) { exit(0); }


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sig_handler(i32 %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void flex_print_int(int value) { printf("%d", value); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @flex_print_int(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
scalar_t__ coordinatesAreInsideBoard(int, int);
int /*<<< orphan*/ sb_printChar(char, int, int);
void printCharOnBoardXY(char c, int x, int y) {
  if (coordinatesAreInsideBoard(x, y)) {
    sb_printChar(c, x, y);
  }
}


x86 assembly (clang, -O0):
<printCharOnBoardXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <coordinatesAreInsideBoard@plt>
cmp    $0x0,%rax
je     115a <printCharOnBoardXY+0x3a>
mov    -0x1(%rbp),%al
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movsbl %al,%edi
call   1040 <sb_printChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printCharOnBoardXY>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
mov    %esi,%edi
mov    %edx,%esi
call   1030 <coordinatesAreInsideBoard@plt>
test   %rax,%rax
je     114a <printCharOnBoardXY+0x2a>
movsbl %r14b,%edi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <sb_printChar@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @printCharOnBoardXY(i8 signext %0, i32 %1, i32 %2) {
%4 = tail call i64 @coordinatesAreInsideBoard(i32 %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @sb_printChar(i8 signext %0, i32 %1, i32 %2)
br label %8
8: ; preds = %6, %3
ret void
}
int abs(register int i) { return i >= 0 ? i : -i; }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     111c <abs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @abs(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 %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Type definitions */
struct dm_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dm_list_add(struct dm_list *, struct dm_list *);
int /*<<< orphan*/ dm_list_del(struct dm_list *);
void dm_list_move(struct dm_list *head, struct dm_list *elem) {
  {
    {
      dm_list_del(elem);
      dm_list_add(head, elem);
    }
    return;
  }
}


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

x86 assembly (clang, -O2):
<dm_list_move>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <dm_list_del@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <dm_list_add@plt>

LLVM IR (-O0):
%struct.dm_list = type { i32 }
define void @dm_list_move(%struct.dm_list* %0, %struct.dm_list* %1) {
%3 = alloca %struct.dm_list*
%4 = alloca %struct.dm_list*
store %struct.dm_list* %0, %struct.dm_list** %3
store %struct.dm_list* %1, %struct.dm_list** %4
%5 = load %struct.dm_list*, %struct.dm_list** %4
%6 = call i32 @dm_list_del(%struct.dm_list* %5)
%7 = load %struct.dm_list*, %struct.dm_list** %3
%8 = load %struct.dm_list*, %struct.dm_list** %4
%9 = call i32 @dm_list_add(%struct.dm_list* %7, %struct.dm_list* %8)
ret void
}

LLVM IR (-O2):
%struct.dm_list = type { i32 }
define void @dm_list_move(%struct.dm_list* %0, %struct.dm_list* %1) {
%3 = tail call i32 @dm_list_del(%struct.dm_list* %1)
%4 = tail call i32 @dm_list_add(%struct.dm_list* %0, %struct.dm_list* %1)
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int locked_mods;
};
typedef TYPE_1__ XkbStateRec;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XkbGetState(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               TYPE_1__ *);
int /*<<< orphan*/ XkbUseCoreKbd;
int get_modifier(int mod) {
  XkbStateRec xkbState;
  Display *display = XOpenDisplay(NULL);
  XkbGetState(display, XkbUseCoreKbd, &xkbState);
  XCloseDisplay(display);
  return xkbState.locked_mods & mod;
}


x86 assembly (clang, -O0):
<get_modifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <XOpenDisplay@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1030 <XkbGetState@plt>
mov    -0x10(%rbp),%rdi
call   1050 <XCloseDisplay@plt>
mov    -0x8(%rbp),%eax
and    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_modifier>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %edi,%edi
call   1040 <XOpenDisplay@plt>
mov    %rax,%r14
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %r14,%rdi
call   1030 <XkbGetState@plt>
mov    %r14,%rdi
call   1050 <XCloseDisplay@plt>
and    (%rsp),%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@XkbUseCoreKbd = global i32 0
define i32 @get_modifier(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.TYPE_3__
%4 = alloca i32*
store i32 %0, i32* %2
%5 = call i32* @XOpenDisplay(i32* null)
store i32* %5, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* @XkbUseCoreKbd
%8 = call i32 @XkbGetState(i32* %6, i32 %7, %struct.TYPE_3__* %3)
%9 = load i32*, i32** %4
%10 = call i32 @XCloseDisplay(i32* %9)
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%12 = load i32, i32* %11
%13 = load i32, i32* %2
%14 = and i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@XkbUseCoreKbd = global i32 0
define i32 @get_modifier(i32 %0) {
%2 = alloca %struct.TYPE_3__
%3 = bitcast %struct.TYPE_3__* %2 to i8*
%4 = tail call i32* @XOpenDisplay(i32* null)
%5 = load i32, i32* @XkbUseCoreKbd
%6 = call i32 @XkbGetState(i32* %4, i32 %5, %struct.TYPE_3__* %2)
%7 = call i32 @XCloseDisplay(i32* %4)
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i64 0, i32 0
%9 = load i32, i32* %8
%10 = and i32 %9, %0
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ PM_STR;
char *nl_langinfo(int /*<<< orphan*/);
char *langinfo_pmstr() { return nl_langinfo(PM_STR); }


x86 assembly (clang, -O0):
<langinfo_pmstr>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <nl_langinfo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<langinfo_pmstr>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <nl_langinfo@plt>

LLVM IR (-O0):
@PM_STR = global i32 0
define i8* @langinfo_pmstr() {
%1 = load i32, i32* @PM_STR
%2 = call i8* @nl_langinfo(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
@PM_STR = global i32 0
define i8* @langinfo_pmstr() {
%1 = load i32, i32* @PM_STR
%2 = tail call i8* @nl_langinfo(i32 %1)
ret i8* %2
}
void spi_init() {}


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

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

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

LLVM IR (-O2):
define void @spi_init() {
ret void
}
void free_double_int(int **double_int, int a) {
  int i;
  for (i = 0; i < a; i++) {
    free(double_int[i]);
  }
  free(double_int);
}


x86 assembly (clang, -O0):
<free_double_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_double_int+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_double_int+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_double_int>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_double_int+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_double_int+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_double_int(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = bitcast i32** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast i32** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Variables and functions */
void *leaky_malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *leaky_calloc(size_t nmemb, size_t size) {
  size_t size_ = size * nmemb;
  void *new_memory = leaky_malloc(size_);
  memset(new_memory, 0, size_);
  return new_memory;
}


x86 assembly (clang, -O0):
<leaky_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <leaky_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leaky_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1030 <leaky_malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1040 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @leaky_calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %4
%8 = load i64, i64* %3
%9 = mul i64 %7, %8
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = call i8* @leaky_malloc(i64 %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = load i64, i64* %5
%14 = call i32 @memset(i8* %12, i32 0, i64 %13)
%15 = load i8*, i8** %6
ret i8* %15
}

LLVM IR (-O2):
define i8* @leaky_calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @leaky_malloc(i64 %3)
%5 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
ret i8* %4
}
/* Type definitions */
struct vec2 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vec2(float *, float, float);
__attribute__((always_)) struct vec2 *psvec2(struct vec2 *result, float x,
                                             float y) {
  vec2((float *)result, x, y);
  return result;
}


x86 assembly (clang, -O0):
<psvec2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1030 <vec2@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec2>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec2@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec2 = type { i32 }
define %struct.vec2* @psvec2(%struct.vec2* %0, float %1, float %2) {
%4 = alloca %struct.vec2*
%5 = alloca float
%6 = alloca float
store %struct.vec2* %0, %struct.vec2** %4
store float %1, float* %5
store float %2, float* %6
%7 = load %struct.vec2*, %struct.vec2** %4
%8 = bitcast %struct.vec2* %7 to float*
%9 = load float, float* %5
%10 = load float, float* %6
%11 = call i32 @vec2(float* %8, float %9, float %10)
%12 = load %struct.vec2*, %struct.vec2** %4
ret %struct.vec2* %12
}

LLVM IR (-O2):
%struct.vec2 = type { i32 }
define %struct.vec2* @psvec2(%struct.vec2* returned %0, float %1, float %2) {
%4 = bitcast %struct.vec2* %0 to float*
%5 = tail call i32 @vec2(float* %4, float %1, float %2)
ret %struct.vec2* %0
}
int main(void) {
  extern void foo_zen(void);
  extern void bar_zen(void);
  foo_zen();
  bar_zen();
  extern void foo_hah(void);
  extern void bar_hah(void);
  foo_hah();
  bar_hah();
  extern void foo_duang(void);
  extern void bar_duang(void);
  foo_duang();
  bar_duang();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
call   1040 <foo_zen@plt>
call   1050 <bar_zen@plt>
call   1070 <foo_hah@plt>
call   1030 <bar_hah@plt>
call   1080 <foo_duang@plt>
call   1060 <bar_duang@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1040 <foo_zen@plt>
call   1050 <bar_zen@plt>
call   1070 <foo_hah@plt>
call   1030 <bar_hah@plt>
call   1080 <foo_duang@plt>
call   1060 <bar_duang@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
tail call void @foo_zen()
tail call void @bar_zen()
tail call void @foo_hah()
tail call void @bar_hah()
tail call void @foo_duang()
tail call void @bar_duang()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ copy_sys_bios();
int /*<<< orphan*/ memset(void *, int, int);
int /*<<< orphan*/ strcpy(char *, char *);
int setup_system_bios(void) {
  char *date = "06/01/99";
  char *eisa_ident = "PCI/ISA";
  if (!copy_sys_bios())
    return 0;
  return 1;
  memset((void *)0xF0000, 0xf4, 0x10000);
  strcpy((char *)0xFFFF5, date);
  strcpy((char *)0xFFFD9, eisa_ident);
  ((char *)0)[0xFFFFE] = 0xfc;
  return 1;
}


x86 assembly (clang, -O0):
<setup_system_bios>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xedf(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <copy_sys_bios@plt>
cmp    $0x0,%eax
jne    114a <setup_system_bios+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1151 <setup_system_bios+0x41>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_system_bios>:
push   %rax
xor    %eax,%eax
call   1030 <copy_sys_bios@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @setup_system_bios() {
%1 = tail call i32 (...) @copy_sys_bios()
%2 = icmp ne i32 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) {}


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

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

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

LLVM IR (-O2):
%struct.ieee80211_sub_if_data = type opaque
define void @ieee80211_debugfs_rename_netdev(%struct.ieee80211_sub_if_data* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *progname) {
  fprintf(stderr,
          "usage:  %s [-n] [stream|dgram] port\n"
          "\nWhere:\n\t"
          "-n      No peer context will be available therefore send\n\t"
          "        \"nopeer\" message to client, otherwise the peer context\n\t"
          "        will be retrieved and sent to client.\n\t"
          "stream  Use TCP protocol or:\n\t"
          "dgram   use UDP protocol.\n\t"
          "port    Listening port\n",
          progname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [295 x i8] c"usage: %s [-n] [stream|dgram] port\0A\0AWhere:\0A\09-n No peer context will be available therefore send\0A\09 \22nopeer\22 message to client, otherwise the peer context\0A\09 will be retrieved and sent to client.\0A\09stream Use TCP protocol or:\0A\09dgram use UDP protocol.\0A\09port Listening port\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([295 x i8], [295 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [295 x i8] c"usage: %s [-n] [stream|dgram] port\0A\0AWhere:\0A\09-n No peer context will be available therefore send\0A\09 \22nopeer\22 message to client, otherwise the peer context\0A\09 will be retrieved and sent to client.\0A\09stream Use TCP protocol or:\0A\09dgram use UDP protocol.\0A\09port Listening port\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([295 x i8], [295 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
unsigned long WatchdogReloadGet(unsigned long ulBase) {
  DEBUG_ASSERT((ulBase == 0x40000000) || (ulBase == 0x40001000));
  return ((*((volatile unsigned long *)(ulBase + 0x00000000))));
}


x86 assembly (clang, -O0):
<WatchdogReloadGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%al
cmpq   $0x40000000,-0x8(%rbp)
40
mov    %al,-0x9(%rbp)
je     113d <WatchdogReloadGet+0x2d>
cmpq   $0x40001000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogReloadGet>:
push   %rbx
mov    %rdi,%rbx
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40000000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    (%rbx),%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @WatchdogReloadGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 1073741824
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i64, i64* %2
%7 = icmp eq i64 %6, 1073745920
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @DEBUG_ASSERT(i32 %10)
%12 = load i64, i64* %2
%13 = add i64 %12, 0
%14 = inttoptr i64 %13 to i64*
%15 = load volatile i64, i64* %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @WatchdogReloadGet(i64 %0) {
%2 = and i64 %0, -4097
%3 = icmp eq i64 %2, 1073741824
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = inttoptr i64 %0 to i64*
%7 = load volatile i64, i64* %6
ret i64 %7
}
/* Variables and functions */
size_t strlen(char const *);
scalar_t__ strncmp(char const *, char const *, size_t const);
size_t json_parse_literal(const char *line, const char *literal) {
  const size_t len = strlen(literal);
  if (strncmp(line, literal, len) != 0)
    return 0;
  return len;
}


x86 assembly (clang, -O0):
<json_parse_literal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1165 <json_parse_literal+0x45>
movq   $0x0,-0x8(%rbp)
jmp    116d <json_parse_literal+0x4d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_parse_literal>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
cmove  %r15,%rcx
mov    %rcx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @json_parse_literal(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i64 %3)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i64 %3, i64 0
ret i64 %6
}
int getPrec(char op) {
  switch (op) {
  case '+':
  case '-':
    return 1;
  case '*':
  case '/':
    return 2;
  case '(':
  case ')':
    return 3;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<getPrec>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd8,%eax
sub    $0x2,%eax
jb     117e <getPrec+0x7e>
jmp    1122 <getPrec+0x22>
mov    -0xc(%rbp),%eax
sub    $0x2a,%eax
je     1172 <getPrec+0x72>
jmp    1133 <getPrec+0x33>
mov    -0xc(%rbp),%eax
sub    $0x2b,%eax
je     1166 <getPrec+0x66>
jmp    1144 <getPrec+0x44>
mov    -0xc(%rbp),%eax
sub    $0x2d,%eax
je     1166 <getPrec+0x66>
jmp    1155 <getPrec+0x55>
mov    -0xc(%rbp),%eax
sub    $0x2f,%eax
je     1172 <getPrec+0x72>
jmp    118a <getPrec+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    1191 <getPrec+0x91>
movl   $0x2,-0x4(%rbp)
jmp    1191 <getPrec+0x91>
movl   $0x3,-0x4(%rbp)
jmp    1191 <getPrec+0x91>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPrec>:
add    $0xffffffd8,%edi
xor    %eax,%eax
cmp    $0x7,%edi
ja     1117 <getPrec+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table.getPrec = [8 x i32] [i32 3, i32 3, i32 2, i32 1, i32 0, i32 1, i32 0, i32 2]
define i32 @getPrec(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -40
%4 = icmp ult i32 %3, 8
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.getPrec, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}