xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strstr(char const *, char *);
int libsndfile_str_count(const char *str) {
  const char *cptr;
  if ((cptr = strstr(str, "libsndfile")) == NULL)
    return 0;
  if ((cptr = strstr(cptr + 1, "libsndfile")) == NULL)
    return 1;
  return 2;
}


x86 assembly (clang, -O0):
<libsndfile_str_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1146 <libsndfile_str_count+0x36>
movl   $0x0,-0x4(%rbp)
jmp    117b <libsndfile_str_count+0x6b>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
lea    0xeab(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1174 <libsndfile_str_count+0x64>
movl   $0x1,-0x4(%rbp)
jmp    117b <libsndfile_str_count+0x6b>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libsndfile_str_count>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
test   %rax,%rax
je     1143 <libsndfile_str_count+0x33>
add    $0x1,%rax
lea    0xed3(%rip),%rsi
mov    %rax,%rdi
call   1030 <strstr@plt>
cmp    $0x1,%rax
mov    $0x2,%eax
sbb    $0x0,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"libsndfile\00"
define i32 @libsndfile_str_count(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = tail call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
%8 = select i1 %7, i32 1, i32 2
br label %9
9: ; preds = %4, %1
%10 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %10
}
/* Variables and functions */
int **create_2D_array(int, int);
scalar_t__ realloc(int ***, int);
void add_to_3D_array(int ***array, int new_array_size, int chessboard_size) {
  array = (int ***)realloc(array, new_array_size * sizeof(int ***));
  array[new_array_size - 1] = create_2D_array(chessboard_size, chessboard_size);
}


x86 assembly (clang, -O0):
<add_to_3D_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <create_2D_array@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_to_3D_array>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
lea    0x0(,%r14,8),%esi
call   1030 <realloc@plt>
mov    %rax,%r15
mov    %ebx,%edi
mov    %ebx,%esi
call   1040 <create_2D_array@plt>
movslq %r14d,%rcx
mov    %rax,-0x8(%r15,%rcx,8)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @add_to_3D_array(i32*** %0, i32 %1, i32 %2) {
%4 = alloca i32***
%5 = alloca i32
%6 = alloca i32
store i32*** %0, i32**** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32***, i32**** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 8
%11 = trunc i64 %10 to i32
%12 = call i64 @realloc(i32*** %7, i32 %11)
%13 = inttoptr i64 %12 to i32***
store i32*** %13, i32**** %4
%14 = load i32, i32* %6
%15 = load i32, i32* %6
%16 = call i32** @create_2D_array(i32 %14, i32 %15)
%17 = load i32***, i32**** %4
%18 = load i32, i32* %5
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32**, i32*** %17, i64 %20
store i32** %16, i32*** %21
ret void
}

LLVM IR (-O2):
define void @add_to_3D_array(i32*** %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 3
%5 = tail call i64 @realloc(i32*** %0, i32 %4)
%6 = inttoptr i64 %5 to i32***
%7 = tail call i32** @create_2D_array(i32 %2, i32 %2)
%8 = add nsw i32 %1, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32**, i32*** %6, i64 %9
store i32** %7, i32*** %10
ret void
}
void LSM6DS0_IO_ITConfig(void) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @ARGBUnattenuateRow_C() {
ret void
}
int foo(int x, int y) { return x + y; }


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

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

LLVM IR (-O0):
define i32 @foo(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
void longlong_to_str8(unsigned long long i, unsigned char *s) {
  int loop = 8;
  while (loop--) {
    *s++ = i >> 56;
    i <<= 8;
  }
  *s = '\0';
  return;
}


x86 assembly (clang, -O0):
<longlong_to_str8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x8,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     1153 <longlong_to_str8+0x53>
mov    -0x8(%rbp),%rax
shr    $0x38,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <longlong_to_str8+0x13>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<longlong_to_str8>:
mov    %rdi,%rax
mov    %rdi,%rcx
shr    $0x38,%rcx
mov    %cl,(%rsi)
mov    %rdi,%rcx
shr    $0x30,%rcx
mov    %cl,0x1(%rsi)
mov    %rdi,%rcx
shr    $0x28,%rcx
mov    %cl,0x2(%rsi)
mov    %rdi,%rcx
shr    $0x20,%rcx
mov    %cl,0x3(%rsi)
mov    %rdi,%rcx
shr    $0x18,%rcx
mov    %cl,0x4(%rsi)
mov    %rdi,%rcx
shr    $0x10,%rcx
mov    %cl,0x5(%rsi)
mov    %ah,0x6(%rsi)
mov    %al,0x7(%rsi)
movb   $0x0,0x8(%rsi)
ret

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

LLVM IR (-O2):
define void @longlong_to_str8(i64 %0, i8* nocapture writeonly %1) {
%3 = lshr i64 %0, 56
%4 = trunc i64 %3 to i8
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %4, i8* %1
%6 = lshr i64 %0, 48
%7 = trunc i64 %6 to i8
%8 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %7, i8* %5
%9 = lshr i64 %0, 40
%10 = trunc i64 %9 to i8
%11 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %10, i8* %8
%12 = lshr i64 %0, 32
%13 = trunc i64 %12 to i8
%14 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %13, i8* %11
%15 = lshr i64 %0, 24
%16 = trunc i64 %15 to i8
%17 = getelementptr inbounds i8, i8* %1, i64 5
store i8 %16, i8* %14
%18 = lshr i64 %0, 16
%19 = trunc i64 %18 to i8
%20 = getelementptr inbounds i8, i8* %1, i64 6
store i8 %19, i8* %17
%21 = lshr i64 %0, 8
%22 = trunc i64 %21 to i8
%23 = getelementptr inbounds i8, i8* %1, i64 7
store i8 %22, i8* %20
%24 = trunc i64 %0 to i8
%25 = getelementptr inbounds i8, i8* %1, i64 8
store i8 %24, i8* %23
store i8 0, i8* %25
ret void
}
int test_00(unsigned short tab[], int index) { return tab[index + 1]; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzwl (%rax,%rcx,2),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
movslq %esi,%rax
movzwl 0x2(%rdi,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @test_00(i16* %0, i32 %1) {
%3 = alloca i16*
%4 = alloca i32
store i16* %0, i16** %3
store i32 %1, i32* %4
%5 = load i16*, i16** %3
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i16, i16* %5, i64 %8
%10 = load i16, i16* %9
%11 = zext i16 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @test_00(i16* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i16, i16* %0, i64 %4
%6 = load i16, i16* %5
%7 = zext i16 %6 to i32
ret i32 %7
}
void processArguments() {}


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

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

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

LLVM IR (-O2):
define void @processArguments() {
ret void
}
int f12b(int y) {
  int x __attribute__((unused)) = y;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @f12b(i32 %0) {
ret i32 1
}
int repeat_searcher(const void *p, const void *v) { return (p == v); }


x86 assembly (clang, -O0):
<repeat_searcher>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeat_searcher>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @repeat_searcher(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @repeat_searcher(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ pthread_sched_disable();
extern void pthread_suspend_all_np(void) { pthread_sched_disable(); }


x86 assembly (clang, -O0):
<pthread_suspend_all_np>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <pthread_sched_disable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_suspend_all_np>:
xor    %eax,%eax
jmp    1030 <pthread_sched_disable@plt>

LLVM IR (-O0):
define void @pthread_suspend_all_np() {
%1 = call i32 (...) @pthread_sched_disable()
ret void
}

LLVM IR (-O2):
define void @pthread_suspend_all_np() {
%1 = tail call i32 (...) @pthread_sched_disable()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fsize(char *);
int main(int argc, char *argv[]) {
  size_t i;
  for (i = 1; i < argc; i++) {
    fsize(argv[i]);
  }
  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)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jae    1161 <main+0x51>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <fsize@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112e <main+0x1e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jb     1142 <main+0x32>
mov    %rsi,%r14
movslq %edi,%r15
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <fsize@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = sext i32 %0 to i64
%4 = icmp ugt i32 %0, 1
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 1, %2 ]
%7 = getelementptr inbounds i8*, i8** %1, i64 %6
%8 = load i8*, i8** %7
%9 = tail call i32 @fsize(i8* %8)
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %3
br i1 %11, label %12, label %5
12: ; preds = %5, %2
ret i32 0
}
void exit(int status) {
  while (1) {
    __asm__ __volatile__("\tmov $1, %%eax\n"
                         "\tint $0x80\n" ::"b"(status)
                         : "memory");
  }
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ebx
mov    $0x1,%eax
int    $0x80
jmp    1108 <exit+0x8>

x86 assembly (clang, -O2):
<exit>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%eax
int    $0x80
jmp    1110 <exit+0x10>

LLVM IR (-O0):
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
%4 = load i32, i32* %2
br label %3
}

LLVM IR (-O2):
define void @exit(i32 %0) {
br label %2
2: ; preds = %1, %2
tail call void asm sideeffect "\09mov $$1, %eax\0A\09int $$0x80\0A", "{bx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 %0)
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ test_crc16_empty();
int /*<<< orphan*/ test_crc16_fail();
int /*<<< orphan*/ test_crc16_pass();
int /*<<< orphan*/ test_crc16_progressive();
int main(int argc, char *argv[]) {
  test_crc16_pass();
  test_crc16_progressive();
  test_crc16_fail();
  test_crc16_empty();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <test_crc16_pass@plt>
mov    $0x0,%al
call   1040 <test_crc16_progressive@plt>
mov    $0x0,%al
call   1030 <test_crc16_fail@plt>
mov    $0x0,%al
call   1050 <test_crc16_empty@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <test_crc16_pass@plt>
xor    %eax,%eax
call   1040 <test_crc16_progressive@plt>
xor    %eax,%eax
call   1030 <test_crc16_fail@plt>
xor    %eax,%eax
call   1050 <test_crc16_empty@plt>
xor    %eax,%eax
pop    %rcx
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 = call i32 (...) @test_crc16_pass()
%7 = call i32 (...) @test_crc16_progressive()
%8 = call i32 (...) @test_crc16_fail()
%9 = call i32 (...) @test_crc16_empty()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_crc16_pass()
%4 = tail call i32 (...) @test_crc16_progressive()
%5 = tail call i32 (...) @test_crc16_fail()
%6 = tail call i32 (...) @test_crc16_empty()
ret i32 0
}
/* Variables and functions */
int M_PI;
float sin(float);
float outSine(float t, float b, float c, float d) {
  return c * sin(t / d * (M_PI / 2)) + b;
}


x86 assembly (clang, -O0):
<outSine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movss  -0x14(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outSine>:
push   %rax
movss  %xmm2,(%rsp)
movss  %xmm1,0x4(%rsp)
divss  %xmm3,%xmm0
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
mulss  %xmm1,%xmm0
call   1030 <sin@plt>
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global i32 0
define float @outSine(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %7
%10 = load float, float* %5
%11 = load float, float* %8
%12 = fdiv float %10, %11
%13 = load i32, i32* @M_PI
%14 = sdiv i32 %13, 2
%15 = sitofp i32 %14 to float
%16 = fmul float %12, %15
%17 = call float @sin(float %16)
%18 = load float, float* %6
%19 = call float @llvm.fmuladd.f32(float %9, float %17, float %18)
ret float %19
}

LLVM IR (-O2):
@M_PI = global i32 0
define float @outSine(float %0, float %1, float %2, float %3) {
%5 = fdiv float %0, %3
%6 = load i32, i32* @M_PI
%7 = sdiv i32 %6, 2
%8 = sitofp i32 %7 to float
%9 = fmul float %5, %8
%10 = tail call float @sin(float %9)
%11 = tail call float @llvm.fmuladd.f32(float %2, float %10, float %1)
ret float %11
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int rand();
int get_rand(int spread) {
  uint16_t r = rand();
  r = (r >> 8) | (r << 8);
  return ((r % spread) + 1);
}


x86 assembly (clang, -O0):
<get_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rand>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ecx
sar    $0x8,%ecx
shl    $0x8,%eax
or     %ecx,%eax
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_rand(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = ashr i32 %5, 8
%7 = load i32, i32* %3
%8 = shl i32 %7, 8
%9 = or i32 %6, %8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = srem i32 %10, %11
%13 = add nsw i32 %12, 1
ret i32 %13
}

LLVM IR (-O2):
define i32 @get_rand(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = ashr i32 %2, 8
%4 = shl i32 %2, 8
%5 = or i32 %3, %4
%6 = srem i32 %5, %0
%7 = add nsw i32 %6, 1
ret i32 %7
}
extern void out_8(volatile unsigned char *addr, char val) {
  ((void)(void)((*(volatile unsigned char *)(addr)) = (val)));
}


x86 assembly (clang, -O0):
<out_8>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_8>:
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @out_8(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8*, i8** %3
store volatile i8 %5, i8* %6
ret void
}

LLVM IR (-O2):
define void @out_8(i8* %0, i8 signext %1) {
store volatile i8 %1, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint8_t;

/* Variables and functions */
uint8_t readb(const void *addr) { return *((volatile uint8_t *)addr); }


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

x86 assembly (clang, -O2):
<readb>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @readb(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = load volatile i32, i32* %2
ret i32 %3
}
/* Type definitions */
typedef int __le16;

/* Variables and functions */
int cpu_to_le16(int);
int ieee80211_is_deauth(__le16 fc) {
  return (fc & cpu_to_le16(0x000c | 0x00f0)) == cpu_to_le16(0x0000 | 0x00C0);
}


x86 assembly (clang, -O0):
<ieee80211_is_deauth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0xfc,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0xc0,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee80211_is_deauth>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xfc,%edi
call   1030 <cpu_to_le16@plt>
mov    %eax,%ebp
and    %ebx,%ebp
mov    $0xc0,%edi
call   1030 <cpu_to_le16@plt>
xor    %ecx,%ecx
cmp    %eax,%ebp
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ieee80211_is_deauth(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cpu_to_le16(i32 252)
%5 = and i32 %3, %4
%6 = call i32 @cpu_to_le16(i32 192)
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @ieee80211_is_deauth(i32 %0) {
%2 = tail call i32 @cpu_to_le16(i32 252)
%3 = and i32 %2, %0
%4 = tail call i32 @cpu_to_le16(i32 192)
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
int do_231() { return 231; }


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

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

LLVM IR (-O0):
define i32 @do_231() {
ret i32 231
}

LLVM IR (-O2):
define i32 @do_231() {
ret i32 231
}
int PyThread_create_key(void) {
  int result;
  return result;
}


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

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

LLVM IR (-O0):
define i32 @PyThread_create_key() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @PyThread_create_key() {
ret i32 undef
}
void ufs_debugfs_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @ufs_debugfs_exit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void display_array(int array[], int size) {
  for (int i = 0; i < size; i++) {
    printf("element:%d --> value:%d\n", i, array[i]);
  }
}


x86 assembly (clang, -O0):
<display_array>:
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    115a <display_array+0x4a>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <display_array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1147 <display_array+0x37>
mov    %rdi,%r14
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <display_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"element:%d --> value:%d\0A\00"
define void @display_array(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 = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"element:%d --> value:%d\0A\00"
define void @display_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %13, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = trunc i64 %8 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %10)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int execve(char const *, char **const, char **const);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void xexecve(const char *path, char **const argv, char **const envp) {
  if (execve(path, argv, envp) == -1)
    perror("Error in execve() : ");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<xexecve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <execve@plt>
cmp    $0xffffffff,%eax
jne    116a <xexecve+0x3a>
lea    0xe9b(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<xexecve>:
push   %rax
call   1030 <execve@plt>
cmp    $0xffffffff,%eax
jne    1147 <xexecve+0x17>
lea    0xebe(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Error in execve() : \00"
@EXIT_FAILURE = global i32 0
define void @xexecve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i8**, i8*** %6
%10 = call i32 @execve(i8* %7, i8** %8, i8** %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %3
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
}

LLVM IR (-O2):
@.str = [21 x i8] c"Error in execve() : \00"
@EXIT_FAILURE = global i32 0
define void @xexecve(i8* %0, i8** %1, i8** %2) {
%4 = tail call i32 @execve(i8* %0, i8** %1, i8** %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
}
int main() {
  int *pa;
  int a;
  pa = &a;
  a = 5;
  int b = 3;
  a = *pa + b;
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0x3,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32* %3, i32** %2
store i32 5, i32* %3
store i32 3, i32* %4
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
/* Type definitions */
typedef int u_int;

/* Variables and functions */
int check_bit(u_int old, u_int new, u_int bit) {
  int mask = 1 << bit;
  if ((old & mask) && !(new &mask))
    return (1);
  if (!(old & mask) && (new &mask))
    return (2);
  return (0);
}


x86 assembly (clang, -O0):
<check_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
and    -0x14(%rbp),%eax
cmp    $0x0,%eax
je     1144 <check_bit+0x44>
mov    -0xc(%rbp),%eax
and    -0x14(%rbp),%eax
cmp    $0x0,%eax
jne    1144 <check_bit+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1175 <check_bit+0x75>
mov    -0x8(%rbp),%eax
and    -0x14(%rbp),%eax
cmp    $0x0,%eax
jne    116e <check_bit+0x6e>
mov    -0xc(%rbp),%eax
and    -0x14(%rbp),%eax
cmp    $0x0,%eax
je     116e <check_bit+0x6e>
movl   $0x2,-0x4(%rbp)
jmp    1175 <check_bit+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_bit>:
mov    %edx,%ecx
mov    $0x1,%r8d
shl    %cl,%r8d
xor    %eax,%eax
test   %esi,%r8d
setne  %al
add    %eax,%eax
xor    %edx,%edx
bt     %ecx,%edi
cmovae %eax,%edx
mov    $0x1,%eax
test   %esi,%r8d
cmovne %edx,%eax
bt     %ecx,%edi
cmovae %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @check_bit(i32 %0, i32 %1, i32 %2) {
%4 = shl nuw i32 1, %2
%5 = and i32 %4, %0
%6 = icmp ne i32 %5, 0
%7 = and i32 %4, %1
%8 = icmp eq i32 %7, 0
%9 = and i1 %6, %8
%10 = or i1 %6, %8
%11 = select i1 %10, i32 0, i32 2
%12 = select i1 %9, i32 1, i32 %11
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void os_close_files(int fd_min, int fd_max) {
  if (fd_min > fd_max)
    return;
  else if (fd_min < 0)
    fd_min = 0;
  for (; fd_min <= fd_max; fd_min++)
    close(fd_min);
}


x86 assembly (clang, -O0):
<os_close_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    112f <os_close_files+0x1f>
jmp    116c <os_close_files+0x5c>
cmpl   $0x0,-0x4(%rbp)
jge    1140 <os_close_files+0x30>
movl   $0x0,-0x4(%rbp)
jmp    1145 <os_close_files+0x35>
jmp    114a <os_close_files+0x3a>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116c <os_close_files+0x5c>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114a <os_close_files+0x3a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_close_files>:
push   %rbp
push   %rbx
push   %rax
cmp    %esi,%edi
jg     113e <os_close_files+0x2e>
mov    %esi,%ebx
xor    %ebp,%ebp
test   %edi,%edi
cmovns %edi,%ebp
cmp    %esi,%ebp
jg     113e <os_close_files+0x2e>
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <close@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <os_close_files+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @os_close_files(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 0
%6 = select i1 %5, i32 %0, i32 0
%7 = icmp sgt i32 %6, %1
br i1 %7, label %13, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %11, %8 ], [ %6, %4 ]
%10 = tail call i32 @close(i32 %9)
%11 = add nuw i32 %9, 1
%12 = icmp eq i32 %9, %1
br i1 %12, label %13, label %8
13: ; preds = %8, %4, %2
ret void
}
/* Variables and functions */
scalar_t__ isPrime(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  printf("Enter a number\n");
  int n;
  scanf("%d", &n);
  if (isPrime(n))
    printf("The entered number is prime\n");
  else
    printf("The entered number is not prime\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     117e <main+0x4e>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    118a <main+0x5a>
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    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <isPrime@plt>
test   %rax,%rax
lea    0xeb1(%rip),%rax
lea    0xeca(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter a number\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"The entered number is prime\0A\00"
@.str.3 = [33 x i8] c"The entered number is not prime\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i64 @isPrime(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [15 x i8] c"Enter a number\00"
@str.4 = [32 x i8] c"The entered number is not prime\00"
@str.5 = [28 x i8] c"The entered number is prime\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i64 @isPrime(i32 %5)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ putchar(scalar_t__);
void print(uint8_t *signal, int offset, int n) {
  for (int i = 0; i < n; i++) {
    putchar('0' + signal[offset + i]);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    115d <print+0x4d>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x30,%rdi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <print+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %rbx
test   %edx,%edx
jle    1146 <print+0x36>
movslq %esi,%rax
mov    %edx,%r14d
lea    (%rdi,%rax,8),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rdi
add    $0x30,%rdi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <print+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @print(i64* %0, i32 %1, i32 %2) {
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i64* %0, i64** %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 i64*, i64** %4
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = add nsw i32 %14, %15
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i64, i64* %13, i64 %17
%19 = load i64, i64* %18
%20 = add nsw i64 48, %19
%21 = call i32 @putchar(i64 %20)
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 @print(i64* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = zext i32 %2 to i64
br label %9
8: ; preds = %9, %3
ret void
9: ; preds = %5, %9
%10 = phi i64 [ 0, %5 ], [ %16, %9 ]
%11 = add nsw i64 %10, %6
%12 = getelementptr inbounds i64, i64* %0, i64 %11
%13 = load i64, i64* %12
%14 = add nsw i64 %13, 48
%15 = tail call i32 @putchar(i64 %14)
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %7
br i1 %17, label %8, label %9
}
/* Type definitions */
struct random {
  int dummy;
};

/* Variables and functions */
int random_int32(struct random *);
long random_genrand_int31(struct random *r) {
  return (long)(random_int32(r) >> 1);
}


x86 assembly (clang, -O0):
<random_genrand_int31>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <random_int32@plt>
sar    $0x1,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_genrand_int31>:
push   %rax
call   1030 <random_int32@plt>
sar    %eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
%struct.random = type { i32 }
define i64 @random_genrand_int31(%struct.random* %0) {
%2 = alloca %struct.random*
store %struct.random* %0, %struct.random** %2
%3 = load %struct.random*, %struct.random** %2
%4 = call i32 @random_int32(%struct.random* %3)
%5 = ashr i32 %4, 1
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
%struct.random = type { i32 }
define i64 @random_genrand_int31(%struct.random* %0) {
%2 = tail call i32 @random_int32(%struct.random* %0)
%3 = ashr i32 %2, 1
%4 = sext i32 %3 to i64
ret i64 %4
}
int dlclose(void *__handle) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @dlclose(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void version(FILE *fp) {
  fprintf(fp, "romcc "
              "0"
              "."
              "80"
              " released "
              "18 November 2015"
              "\n");
}


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

x86 assembly (clang, -O2):
<version>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x25,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"romcc 0.80 released 18 November 2015\0A\00"
define void @version(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"romcc 0.80 released 18 November 2015\0A\00"
define void @version(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 37, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usage(char *);
int help(int argc, char *argv[], void *__attribute__((unused)) config) {
  usage("cmail-admin-permissions");
  return -1;
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <usage@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"cmail-admin-permissions\00"
define i32 @help(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%7 = call i32 @usage(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [24 x i8] c"cmail-admin-permissions\00"
define i32 @help(i32 %0, i8** nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @usage(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void fprint_bgp_file_header(FILE *out) {
  fprintf(out, "V;Proto;BEST;          prefix;              GW;       MED;"
               "LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;\n");
}


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

x86 assembly (clang, -O2):
<fprint_bgp_file_header>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x60,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [97 x i8] c"V;Proto;BEST; prefix; GW; MED;LOCAL_PREF; WEIGHT;ORIGIN;AS_PATH;\0A\00"
define void @fprint_bgp_file_header(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [97 x i8] c"V;Proto;BEST; prefix; GW; MED;LOCAL_PREF; WEIGHT;ORIGIN;AS_PATH;\0A\00"
define void @fprint_bgp_file_header(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0), i64 96, i64 1, i32* %0)
ret void
}
int ed_getcstride(const struct disisa *isa, struct varinfo *varinfo) {
  return (((ed_getcbsz(isa, varinfo)) + (8) - 1) / (8));
}


x86 assembly (clang, -O0):
<ed_getcstride>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <ed_getcbsz@plt>
add    $0x8,%eax
sub    $0x1,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ed_getcstride>:
push   %rax
xor    %eax,%eax
call   1030 <ed_getcbsz@plt>
lea    0x7(%rax),%ecx
add    $0xe,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.disisa = type opaque
%struct.varinfo = type opaque
define i32 @ed_getcstride(%struct.disisa* %0, %struct.varinfo* %1) {
%3 = alloca %struct.disisa*
%4 = alloca %struct.varinfo*
store %struct.disisa* %0, %struct.disisa** %3
store %struct.varinfo* %1, %struct.varinfo** %4
%5 = load %struct.disisa*, %struct.disisa** %3
%6 = load %struct.varinfo*, %struct.varinfo** %4
%7 = call i32 (%struct.disisa*, %struct.varinfo*, ...) bitcast (i32 (...)* @ed_getcbsz to i32 (%struct.disisa*, %struct.varinfo*, ...)*)(%struct.disisa* %5, %struct.varinfo* %6)
%8 = add nsw i32 %7, 8
%9 = sub nsw i32 %8, 1
%10 = sdiv i32 %9, 8
ret i32 %10
}

LLVM IR (-O2):
%struct.disisa = type opaque
%struct.varinfo = type opaque
define i32 @ed_getcstride(%struct.disisa* %0, %struct.varinfo* %1) {
%3 = tail call i32 (%struct.disisa*, %struct.varinfo*, ...) bitcast (i32 (...)* @ed_getcbsz to i32 (%struct.disisa*, %struct.varinfo*, ...)*)(%struct.disisa* %0, %struct.varinfo* %1)
%4 = add nsw i32 %3, 7
%5 = sdiv i32 %4, 8
ret i32 %5
}