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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
FILE *fopen_check(char *filename, char *mode) {
  FILE *res = fopen(filename, mode);
  if (!res) {
    fprintf(stderr, "[Error] Failed to open file %s\n", filename);
    exit(2);
  }
  return res;
}


x86 assembly (clang, -O0):
<fopen_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117f <fopen_check+0x4f>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fopen_check>:
push   %rbx
mov    %rdi,%rbx
call   1040 <fopen@plt>
test   %rax,%rax
je     1140 <fopen_check+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"[Error] Failed to open file %s\0A\00"
define i32* @fopen_check(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp ne i32* %9, null
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 2)
unreachable
16: ; preds = %2
%17 = load i32*, i32** %5
ret i32* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"[Error] Failed to open file %s\0A\00"
define noalias i32* @fopen_check(i8* %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 @exit(i32 2)
unreachable
9: ; preds = %2
ret i32* %3
}
void thread_started(void) {}


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

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

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

LLVM IR (-O2):
define void @thread_started() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wait(int /*<<< orphan*/);
void childdie(int sig) { wait(0); }


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

x86 assembly (clang, -O2):
<childdie>:
xor    %edi,%edi
jmp    1030 <wait@plt>

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

LLVM IR (-O2):
define void @childdie(i32 %0) {
%2 = tail call i32 @wait(i32 0)
ret void
}
int bzgetc(void *stream) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @bzgetc(i8* nocapture readnone %0) {
ret i32 0
}
__attribute__((destructor(123))) void E() {}


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

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

LLVM IR (-O0):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 123, void ()* @E, i8* null }]
define void @E() {
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 123, void ()* @E, i8* null }]
define void @E() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ singlespace(char *);
int /*<<< orphan*/ space2underscore(int /*<<< orphan*/);
char *str2lower(int /*<<< orphan*/);
char *str2varname(char *str) {
  return str2lower(space2underscore(singlespace(str)));
}


x86 assembly (clang, -O0):
<str2varname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <singlespace@plt>
mov    %eax,%edi
call   1040 <space2underscore@plt>
mov    %eax,%edi
call   1050 <str2lower@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str2varname>:
push   %rax
call   1030 <singlespace@plt>
mov    %eax,%edi
call   1040 <space2underscore@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <str2lower@plt>

LLVM IR (-O0):
define i8* @str2varname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @singlespace(i8* %3)
%5 = call i32 @space2underscore(i32 %4)
%6 = call i8* @str2lower(i32 %5)
ret i8* %6
}

LLVM IR (-O2):
define i8* @str2varname(i8* %0) {
%2 = tail call i32 @singlespace(i8* %0)
%3 = tail call i32 @space2underscore(i32 %2)
%4 = tail call i8* @str2lower(i32 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
int /*<<< orphan*/ yoffset();
void basYOffset() { pushNumber(yoffset()); }


x86 assembly (clang, -O0):
<basYOffset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <yoffset@plt>
mov    %eax,%edi
call   1040 <pushNumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<basYOffset>:
push   %rax
xor    %eax,%eax
call   1030 <yoffset@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <pushNumber@plt>

LLVM IR (-O0):
define void @basYOffset() {
%1 = call i32 (...) @yoffset()
%2 = call i32 @pushNumber(i32 %1)
ret void
}

LLVM IR (-O2):
define void @basYOffset() {
%1 = tail call i32 (...) @yoffset()
%2 = tail call i32 @pushNumber(i32 %1)
ret void
}
float simplexnoise_grad1(int hash, float x) {
  int h = hash & 15;
  float grad = 1.0f + (h & 7);
  if (h & 8)
    grad = -grad;
  return (grad * x);
}


x86 assembly (clang, -O0):
<simplexnoise_grad1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7,%eax
cvtsi2ss %eax,%xmm1
movss  0xed9(%rip),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1156 <simplexnoise_grad1+0x56>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<simplexnoise_grad1>:
mov    %edi,%eax
and    $0x7,%eax
cvtsi2ss %eax,%xmm1
addss  0xeef(%rip),%xmm1
test   $0x8,%dil
je     111e <simplexnoise_grad1+0x1e>
xorps  0xef2(%rip),%xmm1
mulss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @simplexnoise_grad1(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
%6 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%7 = load i32, i32* %3
%8 = and i32 %7, 15
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = and i32 %9, 7
%11 = sitofp i32 %10 to float
%12 = fadd float 1.000000e+00, %11
store float %12, float* %6
%13 = load i32, i32* %5
%14 = and i32 %13, 8
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load float, float* %6
%18 = fneg float %17
store float %18, float* %6
br label %19
19: ; preds = %16, %2
%20 = load float, float* %6
%21 = load float, float* %4
%22 = fmul float %20, %21
ret float %22
}

LLVM IR (-O2):
define float @simplexnoise_grad1(i32 %0, float %1) {
%3 = and i32 %0, 7
%4 = sitofp i32 %3 to float
%5 = fadd float %4, 1.000000e+00
%6 = and i32 %0, 8
%7 = icmp eq i32 %6, 0
%8 = fneg float %5
%9 = select i1 %7, float %5, float %8
%10 = fmul float %9, %1
ret float %10
}
struct s3c24x0_memctl *s3c24x0_get_base_memctl(void) {
  return (struct s3c24x0_memctl *)0x48000000;
}


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

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

LLVM IR (-O0):
%struct.s3c24x0_memctl = type opaque
define %struct.s3c24x0_memctl* @s3c24x0_get_base_memctl() {
ret %struct.s3c24x0_memctl* inttoptr (i64 1207959552 to %struct.s3c24x0_memctl*)
}

LLVM IR (-O2):
%struct.s3c24x0_memctl = type opaque
define %struct.s3c24x0_memctl* @s3c24x0_get_base_memctl() {
ret %struct.s3c24x0_memctl* inttoptr (i64 1207959552 to %struct.s3c24x0_memctl*)
}
int myHashCodeString(void *a) {
  int re = 0;
  char *aa = (char *)a;
  while (*aa) {
    re += 31 * *aa;
    aa++;
  }
  return re;
}


x86 assembly (clang, -O0):
<myHashCodeString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <myHashCodeString+0x45>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,%eax,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <myHashCodeString+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myHashCodeString>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <myHashCodeString+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
sub    %ecx,%edx
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <myHashCodeString+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @myHashCodeString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %11, %4 ], [ %0, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul nsw i32 %8, 31
%10 = add nsw i32 %9, %7
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
scalar_t__ memcasecmp(unsigned char const *, char const *, unsigned int);
int match(const char *sz, const unsigned char *name, unsigned name_length) {
  if (memcasecmp(name, sz, name_length) == 0 && sz[name_length] == '\0')
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcasecmp@plt>
cmp    $0x0,%rax
jne    115d <match+0x4d>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    115d <match+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1164 <match+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <memcasecmp@plt>
test   %rax,%rax
jne    1130 <match+0x20>
mov    %ebp,%eax
cmpb   $0x0,(%rbx,%rax,1)
je     1139 <match+0x29>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%eax
jmp    1132 <match+0x22>

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

LLVM IR (-O2):
define i32 @match(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @memcasecmp(i8* %1, i8* %0, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = zext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %6, %3
br label %12
12: ; preds = %6, %11
%13 = phi i32 [ 0, %11 ], [ 1, %6 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, k = 0;
  for (i = 0; i < 10; i++)
    k = i;
  printf("%d \n", k);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114b <main+0x3b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ move(int, int);
void movto(int line, int col) { move(line, col); }


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

x86 assembly (clang, -O2):
<movto>:
jmp    1030 <move@plt>

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

LLVM IR (-O2):
define void @movto(i32 %0, i32 %1) {
%3 = tail call i32 @move(i32 %0, i32 %1)
ret void
}
A3_EvalXPath_DOM_ArgsContext() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @A3_EvalXPath_DOM_ArgsContext() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ ExtractByte(int);
void ExtractBytes(int l, uint8_t *buffer, int count) {
  int t;
  for (t = 0; t < count; t++) {
    buffer[t] = ExtractByte(l + t * 8);
  }
}


x86 assembly (clang, -O0):
<ExtractBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1160 <ExtractBytes+0x50>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%eax
shl    $0x3,%eax
add    %eax,%edi
call   1030 <ExtractByte@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1129 <ExtractBytes+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExtractBytes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    1147 <ExtractBytes+0x37>
mov    %rsi,%r14
mov    %edi,%ebp
mov    %edx,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1030 <ExtractByte@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
add    $0x8,%ebp
cmp    %rbx,%r15
jne    1130 <ExtractBytes+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ExtractBytes(i32 %0, i32* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %16
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %14, %7 ]
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 3
%11 = add i32 %10, %0
%12 = tail call i32 @ExtractByte(i32 %11)
%13 = getelementptr inbounds i32, i32* %1, i64 %8
store i32 %12, i32* %13
%14 = add nuw nsw i64 %8, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %16, label %7
16: ; preds = %7, %3
ret void
}
void enable_runfast() {}


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

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

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

LLVM IR (-O2):
define void @enable_runfast() {
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ gcodeFSM(char *);
int main(int argc, char **argv) {
  ;
  gcodeFSM(argv[1]);
  return (EXIT_SUCCESS);
}


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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <gcodeFSM@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <gcodeFSM@plt>
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
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 i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @gcodeFSM(i8* %8)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @gcodeFSM(i8* %4)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
/* Type definitions */
struct sqlConnection {
  int dummy;
};
struct expData {
  int dummy;
};

/* Variables and functions */
struct expData *expDataLoadTableLimit(struct sqlConnection *, char *,
                                      int /*<<< orphan*/);
struct expData *expDataLoadTable(struct sqlConnection *conn, char *table) {
  return expDataLoadTableLimit(conn, table, 0);
}


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

x86 assembly (clang, -O2):
<expDataLoadTable>:
xor    %edx,%edx
jmp    1030 <expDataLoadTableLimit@plt>

LLVM IR (-O0):
%struct.expData = type { i32 }
%struct.sqlConnection = type { i32 }
define %struct.expData* @expDataLoadTable(%struct.sqlConnection* %0, i8* %1) {
%3 = alloca %struct.sqlConnection*
%4 = alloca i8*
store %struct.sqlConnection* %0, %struct.sqlConnection** %3
store i8* %1, i8** %4
%5 = load %struct.sqlConnection*, %struct.sqlConnection** %3
%6 = load i8*, i8** %4
%7 = call %struct.expData* @expDataLoadTableLimit(%struct.sqlConnection* %5, i8* %6, i32 0)
ret %struct.expData* %7
}

LLVM IR (-O2):
%struct.expData = type { i32 }
%struct.sqlConnection = type { i32 }
define %struct.expData* @expDataLoadTable(%struct.sqlConnection* %0, i8* %1) {
%3 = tail call %struct.expData* @expDataLoadTableLimit(%struct.sqlConnection* %0, i8* %1, i32 0)
ret %struct.expData* %3
}
/* Variables and functions */
int /*<<< orphan*/ cctools_fatal(char *);
void *malloc(size_t);
void *xxmalloc(size_t nbytes) {
  void *result = malloc(nbytes);
  if (result) {
    return result;
  } else {
    cctools_fatal("out of memory");
    return 0;
  }
}


x86 assembly (clang, -O0):
<xxmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1151 <xxmalloc+0x31>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1165 <xxmalloc+0x45>
lea    0xea8(%rip),%rdi
call   1030 <cctools_fatal@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xxmalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xxmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <cctools_fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"out of memory\00"
define i8* @xxmalloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %4
store i8* %10, i8** %2
br label %13
11: ; preds = %1
%12 = call i32 @cctools_fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %2
br label %13
13: ; preds = %11, %9
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @xxmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @cctools_fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ empty_fun();
int fun(char x) {
  x = x + 1;
  ;
  x = x + 1;
  {
    int hej = !!empty_fun();
    (void)hej;
  }
  return x;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <empty_fun@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rbx
mov    %edi,%ebx
add    $0x2,%bl
xor    %eax,%eax
call   1030 <empty_fun@plt>
movsbl %bl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fun(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, 1
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, 1
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
%12 = call i32 (...) @empty_fun()
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
%15 = xor i1 %14, true
%16 = zext i1 %15 to i32
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @fun(i8 signext %0) {
%2 = add i8 %0, 2
%3 = tail call i32 (...) @empty_fun()
%4 = sext i8 %2 to i32
ret i32 %4
}
int main(int argc, char **argv) {
  (void *)argv;
  return 0;
}


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

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

LLVM IR (-O0):
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 i8**, i8*** %5
%7 = bitcast i8** %6 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int a = 7, b = 10;
  printf("%d\t%d\t\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d\09%d\09\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int d(int x) { return x * 2; }


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

x86 assembly (clang, -O2):
<d>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @d(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
int test_imm_CBuint16_reg(unsigned short val) {
  return ((val) & (-0xCB << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CBuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff35,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CBuint16_reg>:
test   $0xff35,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CBuint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -203
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_CBuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -203
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int yaffs_open_sharing_reldir(int /*<<< orphan*/, char const *, int, int, int);
int yaffs_open_sharing(const char *path, int oflag, int mode, int sharing) {
  return yaffs_open_sharing_reldir((0), path, oflag, mode, sharing);
}


x86 assembly (clang, -O0):
<yaffs_open_sharing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
xor    %edi,%edi
call   1030 <yaffs_open_sharing_reldir@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yaffs_open_sharing>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <yaffs_open_sharing_reldir@plt>

LLVM IR (-O0):
define i32 @yaffs_open_sharing(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @yaffs_open_sharing_reldir(i32 0, i8* %9, i32 %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @yaffs_open_sharing(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @yaffs_open_sharing_reldir(i32 0, i8* %0, i32 %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
char getchar();
char *myGets(char *start) {
  char *cur = start;
  while (*cur = getchar(), *cur != '\n') {
    ++cur;
  }
  *cur = '\0';
  return start;
}


x86 assembly (clang, -O0):
<myGets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     1154 <myGets+0x44>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <myGets+0x14>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myGets>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1120 <myGets+0x10>
movb   $0x0,-0x1(%rbx)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @myGets(i8* returned writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = tail call signext i8 (...) @getchar()
store i8 %4, i8* %3
%5 = icmp eq i8 %4, 10
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
store i8 0, i8* %3
ret i8* %0
}
unsigned int hweight32(unsigned int w) {
  unsigned int res = w - ((w >> 1) & 0x55555555);
  res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
  res = (res + (res >> 4)) & 0x0F0F0F0F;
  res = res + (res >> 8);
  return (res + (res >> 16)) & 0x000000FF;
}


x86 assembly (clang, -O0):
<hweight32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
and    $0x55555555,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x33333333,%eax
mov    -0x8(%rbp),%ecx
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hweight32>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
add    %ecx,%eax
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @hweight32(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = sub i32 %0, %3
%5 = and i32 %4, 858993459
%6 = lshr i32 %4, 2
%7 = and i32 %6, 858993459
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 252645135
%12 = lshr i32 %11, 8
%13 = add nuw nsw i32 %12, %11
%14 = lshr i32 %13, 16
%15 = add nuw nsw i32 %14, %13
%16 = and i32 %15, 63
ret i32 %16
}
/* Variables and functions */
scalar_t__ kbhit();
unsigned char wait_data_with_timeout() {
  int i;
  for (i = 0; i < (50000000 / 8); i++) {
    if (kbhit())
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<wait_data_with_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x5f5e10,-0x8(%rbp)
jge    1159 <wait_data_with_timeout+0x49>
mov    $0x0,%al
call   1030 <kbhit@plt>
cmp    $0x0,%rax
je     1146 <wait_data_with_timeout+0x36>
movb   $0x1,-0x1(%rbp)
jmp    115d <wait_data_with_timeout+0x4d>
jmp    114b <wait_data_with_timeout+0x3b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <wait_data_with_timeout+0xf>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_data_with_timeout>:
push   %rbx
mov    $0x5f5e10,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <kbhit@plt>
test   %rax,%rax
jne    1135 <wait_data_with_timeout+0x25>
add    $0xffffffff,%ebx
jne    1120 <wait_data_with_timeout+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%al
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @wait_data_with_timeout() {
%1 = alloca i8
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 6250000
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = call i64 (...) @kbhit()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i8 1, i8* %1
br label %15
10: ; preds = %6
br label %11
11: ; preds = %10
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %3
14: ; preds = %3
store i8 0, i8* %1
br label %15
15: ; preds = %14, %9
%16 = load i8, i8* %1
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @wait_data_with_timeout() {
br label %4
1: ; preds = %4
%2 = add nuw nsw i32 %5, 1
%3 = icmp eq i32 %2, 6250000
br i1 %3, label %8, label %4
4: ; preds = %0, %1
%5 = phi i32 [ 0, %0 ], [ %2, %1 ]
%6 = tail call i64 (...) @kbhit()
%7 = icmp eq i64 %6, 0
br i1 %7, label %1, label %8
8: ; preds = %1, %4
%9 = phi i8 [ 1, %4 ], [ 0, %1 ]
ret i8 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ stackBuffer;

/* Variables and functions */
char *malloc(int);
void radar10978247_positive(int myValueSize) {
  char stackBuffer[128];
  char *buffer;
  if (myValueSize <= sizeof(stackBuffer))
    buffer = stackBuffer;
  else
    buffer = malloc(myValueSize);
  if (buffer == stackBuffer)
    return;
  else
    return;
}


x86 assembly (clang, -O0):
<radar10978247_positive>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x80,%rax
ja     1141 <radar10978247_positive+0x31>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
jmp    1150 <radar10978247_positive+0x40>
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
lea    -0x90(%rbp),%rcx
cmp    %rcx,%rax
jne    116c <radar10978247_positive+0x5c>
jmp    1171 <radar10978247_positive+0x61>
jmp    1171 <radar10978247_positive+0x61>
add    $0xa0,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @radar10978247_positive(i32 %0) {
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = icmp ule i64 %6, 128
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
store i8* %9, i8** %4
br label %13
10: ; preds = %1
%11 = load i32, i32* %2
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %4
br label %13
13: ; preds = %10, %8
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%16 = icmp eq i8* %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
br label %19
18: ; preds = %13
br label %19
19: ; preds = %18, %17
ret void
}

LLVM IR (-O2):
define void @radar10978247_positive(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void HelpPrint(char *name) {
  printf("\n");
  printf("Program to extract compressed modules from BIOS images.\n");
  printf("Supports AMI, Award, Asus and Phoenix BIOSes.\n");
  printf("\n");
  printf("Usage:\n\t%s <filename>\n", name);
}


x86 assembly (clang, -O0):
<HelpPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xf43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HelpPrint>:
push   %rbx
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xed2(%rip),%rdi
call   1040 <puts@plt>
lea    0xefe(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [57 x i8] c"Program to extract compressed modules from BIOS images.\0A\00"
@.str.2 = [47 x i8] c"Supports AMI, Award, Asus and Phoenix BIOSes.\0A\00"
@.str.3 = [23 x i8] c"Usage:\0A\09%s <filename>\0A\00"
define void @HelpPrint(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@.str.3 = [23 x i8] c"Usage:\0A\09%s <filename>\0A\00"
@str = [56 x i8] c"Program to extract compressed modules from BIOS images.\00"
@str.4 = [46 x i8] c"Supports AMI, Award, Asus and Phoenix BIOSes.\00"
define void @HelpPrint(i8* %0) {
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int a, b;
  a = atoi(argv[1]);
  b = atoi(argv[2]);
  if (a >= b) {
    printf("%d\n", 0);
  } else {
    printf("%d\n", 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1175 <main+0x55>
lea    0xe97(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
jmp    1186 <main+0x66>
lea    0xe84(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1040 <atoi@plt>
xor    %esi,%esi
cmp    %eax,%ebp
setl   %sil
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %6
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %7
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = icmp sge i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
br label %23
21: ; preds = %2
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
br label %23
23: ; preds = %21, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = icmp slt i32 %5, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_NULL;

/* Variables and functions */
int /*<<< orphan*/ ASN1_NULL_it;
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
ASN1_NULL *ASN1_NULL_new(void) {
  return (ASN1_NULL *)ASN1_item_new(&ASN1_NULL_it);
}


x86 assembly (clang, -O0):
<ASN1_NULL_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_NULL_new>:
mov    0x2ed1(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@ASN1_NULL_it = global i32 0
define i32* @ASN1_NULL_new() {
%1 = call i64 @ASN1_item_new(i32* @ASN1_NULL_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@ASN1_NULL_it = global i32 0
define i32* @ASN1_NULL_new() {
%1 = tail call i64 @ASN1_item_new(i32* @ASN1_NULL_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ VT_Print_Hex_Val(int /*<<< orphan*/);
int /*<<< orphan*/ VT_Transmit(char);
int /*<<< orphan*/ bin2bcd8(int /*<<< orphan*/);
void VT_Pos(uint8_t x, uint8_t y) {
  x = bin2bcd8(x);
  y = bin2bcd8(y);
  VT_Transmit('\x1B');
  VT_Transmit('[');
  VT_Print_Hex_Val(y);
  VT_Transmit(';');
  VT_Print_Hex_Val(x);
  VT_Transmit('H');
}


x86 assembly (clang, -O0):
<VT_Pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <bin2bcd8@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <bin2bcd8@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1b,%edi
call   1030 <VT_Transmit@plt>
mov    $0x5b,%edi
call   1030 <VT_Transmit@plt>
mov    -0x8(%rbp),%edi
call   1050 <VT_Print_Hex_Val@plt>
mov    $0x3b,%edi
call   1030 <VT_Transmit@plt>
mov    -0x4(%rbp),%edi
call   1050 <VT_Print_Hex_Val@plt>
mov    $0x48,%edi
call   1030 <VT_Transmit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VT_Pos>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1040 <bin2bcd8@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <bin2bcd8@plt>
mov    %eax,%ebx
mov    $0x1b,%edi
call   1030 <VT_Transmit@plt>
mov    $0x5b,%edi
call   1030 <VT_Transmit@plt>
mov    %ebx,%edi
call   1050 <VT_Print_Hex_Val@plt>
mov    $0x3b,%edi
call   1030 <VT_Transmit@plt>
mov    %ebp,%edi
call   1050 <VT_Print_Hex_Val@plt>
mov    $0x48,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <VT_Transmit@plt>

LLVM IR (-O0):
define void @VT_Pos(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 = call i32 @bin2bcd8(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @bin2bcd8(i32 %7)
store i32 %8, i32* %4
%9 = call i32 @VT_Transmit(i8 signext 27)
%10 = call i32 @VT_Transmit(i8 signext 91)
%11 = load i32, i32* %4
%12 = call i32 @VT_Print_Hex_Val(i32 %11)
%13 = call i32 @VT_Transmit(i8 signext 59)
%14 = load i32, i32* %3
%15 = call i32 @VT_Print_Hex_Val(i32 %14)
%16 = call i32 @VT_Transmit(i8 signext 72)
ret void
}

LLVM IR (-O2):
define void @VT_Pos(i32 %0, i32 %1) {
%3 = tail call i32 @bin2bcd8(i32 %0)
%4 = tail call i32 @bin2bcd8(i32 %1)
%5 = tail call i32 @VT_Transmit(i8 signext 27)
%6 = tail call i32 @VT_Transmit(i8 signext 91)
%7 = tail call i32 @VT_Print_Hex_Val(i32 %4)
%8 = tail call i32 @VT_Transmit(i8 signext 59)
%9 = tail call i32 @VT_Print_Hex_Val(i32 %3)
%10 = tail call i32 @VT_Transmit(i8 signext 72)
ret void
}
/* Variables and functions */
void *malloc(int);
void *myMalloc(size_t size) {
  return size > (size_t)0 ? malloc(size) : malloc(1);
}


x86 assembly (clang, -O0):
<myMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jbe    113b <myMalloc+0x2b>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
jmp    1149 <myMalloc+0x39>
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myMalloc>:
test   %rdi,%rdi
je     111a <myMalloc+0xa>
jmp    1030 <malloc@plt>
mov    $0x1,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @myMalloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ugt i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i64, i64* %2
%7 = trunc i64 %6 to i32
%8 = call i8* @malloc(i32 %7)
br label %11
9: ; preds = %1
%10 = call i8* @malloc(i32 1)
br label %11
11: ; preds = %9, %5
%12 = phi i8* [ %8, %5 ], [ %10, %9 ]
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @myMalloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = trunc i64 %0 to i32
%5 = tail call i8* @malloc(i32 %4)
br label %8
6: ; preds = %1
%7 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
br label %8
8: ; preds = %6, %3
%9 = phi i8* [ %5, %3 ], [ %7, %6 ]
ret i8* %9
}
int BSEG_GetIncludeHeader(void) { return (1 == 1); }


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

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

LLVM IR (-O0):
define i32 @BSEG_GetIncludeHeader() {
ret i32 1
}

LLVM IR (-O2):
define i32 @BSEG_GetIncludeHeader() {
ret i32 1
}