xunge/DecIR huggingface dataset:
unsigned int g3(unsigned int *p, int i) { return p[i]; }


x86 assembly (clang, -O0):
<g3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g3>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @g3(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @g3(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *get_filename_extension(const char *filename) {
  const char *dot = strrchr(filename, '.');
  if (!dot || dot == filename)
    return "";
  return dot + 1;
}


x86 assembly (clang, -O0):
<get_filename_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1147 <get_filename_extension+0x37>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1157 <get_filename_extension+0x47>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1163 <get_filename_extension+0x53>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @get_filename_extension(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 46)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load i8*, i8** %3
%12 = icmp eq i8* %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9, %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %17
14: ; preds = %9
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %2
br label %17
17: ; preds = %14, %13
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @get_filename_extension(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = icmp eq i8* %2, %0
%5 = or i1 %3, %4
%6 = getelementptr inbounds i8, i8* %2, i64 1
%7 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %6
ret i8* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int file_exists(char file_to_check[]) {
  FILE *fp;
  fp = fopen(file_to_check, "r");
  if (fp != NULL)
    fclose(fp);
  return (fp != NULL);
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1154 <file_exists+0x34>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113d <file_exists+0x1d>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @file_exists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %4, %1
%7 = zext i1 %3 to i32
ret i32 %7
}
/* Variables and functions */
void *SCE_Mem_Alloc(char const *, unsigned int, size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *SCE_Mem_Calloc(const char *file, unsigned int line, size_t s, size_t n) {
  void *p = SCE_Mem_Alloc(file, line, s * n);
  if (p)
    memset(p, 0, s * n);
  return p;
}


x86 assembly (clang, -O0):
<SCE_Mem_Calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
imul   -0x20(%rbp),%rdx
call   1040 <SCE_Mem_Alloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     116f <SCE_Mem_Calloc+0x4f>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
imul   -0x20(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Mem_Calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
imul   %rcx,%rbx
mov    %rbx,%rdx
call   1040 <SCE_Mem_Alloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1148 <SCE_Mem_Calloc+0x28>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @SCE_Mem_Calloc(i8* %0, i32 %1, i64 %2, i64 %3) {
%5 = mul i64 %3, %2
%6 = tail call i8* @SCE_Mem_Alloc(i8* %0, i32 %1, i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @memset(i8* %6, i32 0, i64 %5)
br label %10
10: ; preds = %8, %4
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ error(char *);
size_t fwrite(void const *, int, size_t, int /*<<< orphan*/ *);
void Fwrite(const void *ptr, size_t size, FILE *stream) {
  size_t r = fwrite(ptr, 1, size, stream);
  if (r != size)
    error("Can't write a file\n");
}


x86 assembly (clang, -O0):
<Fwrite>:
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),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fwrite@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1168 <Fwrite+0x48>
lea    0xe9d(%rip),%rdi
call   1030 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fwrite>:
push   %rbx
mov    %rdx,%rcx
mov    %rsi,%rbx
mov    $0x1,%esi
mov    %rbx,%rdx
call   1040 <fwrite@plt>
cmp    %rbx,%rax
jne    113b <Fwrite+0x1b>
pop    %rbx
ret
lea    0xebe(%rip),%rdi
pop    %rbx
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Can't write a file\0A\00"
define void @Fwrite(i8* %0, i64 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = load i32*, i32** %6
%11 = call i64 @fwrite(i8* %8, i32 1, i64 %9, i32* %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = load i64, i64* %5
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %3
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Can't write a file\0A\00"
define void @Fwrite(i8* nocapture %0, i64 %1, i32* nocapture %2) {
%4 = tail call i64 @fwrite(i8* %0, i32 1, i64 %1, i32* %2)
%5 = icmp eq i64 %4, %1
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ check_sknobs_init();
char *sknobs_find_file(char *);
char *sknobs_get_string(char *, char *);
char *sknobs_get_filename(char *name, char *defaultValue) {
  char *s = sknobs_get_string(name, defaultValue);
  check_sknobs_init();
  return sknobs_find_file(s);
}


x86 assembly (clang, -O0):
<sknobs_get_filename>:
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   1050 <sknobs_get_string@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <check_sknobs_init@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sknobs_find_file@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sknobs_get_filename>:
push   %rbx
call   1050 <sknobs_get_string@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <check_sknobs_init@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <sknobs_find_file@plt>

LLVM IR (-O0):
define i8* @sknobs_get_filename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @sknobs_get_string(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = call i32 (...) @check_sknobs_init()
%10 = load i8*, i8** %5
%11 = call i8* @sknobs_find_file(i8* %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @sknobs_get_filename(i8* %0, i8* %1) {
%3 = tail call i8* @sknobs_get_string(i8* %0, i8* %1)
%4 = tail call i32 (...) @check_sknobs_init()
%5 = tail call i8* @sknobs_find_file(i8* %3)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ checkSeed();
int uRand(int, int);
float pRand(void) {
  checkSeed();
  return (uRand(1, 100)) / 100;
}


x86 assembly (clang, -O0):
<pRand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <checkSeed@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <uRand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pRand>:
push   %rax
xor    %eax,%eax
call   1040 <checkSeed@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <uRand@plt>
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @pRand() {
%1 = call i32 (...) @checkSeed()
%2 = call i32 @uRand(i32 1, i32 100)
%3 = sdiv i32 %2, 100
%4 = sitofp i32 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @pRand() {
%1 = tail call i32 (...) @checkSeed()
%2 = tail call i32 @uRand(i32 1, i32 100)
%3 = sdiv i32 %2, 100
%4 = sitofp i32 %3 to float
ret float %4
}
/* Type definitions */
struct storage {
  int dummy;
};

/* Variables and functions */
struct storage *get_reg(int /*<<< orphan*/);
int /*<<< orphan*/ get_regclass_bits(unsigned int);
struct storage *temp_from_bits(unsigned int bit_size) {
  return get_reg(get_regclass_bits(bit_size));
}


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

x86 assembly (clang, -O2):
<temp_from_bits>:
push   %rax
call   1040 <get_regclass_bits@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <get_reg@plt>

LLVM IR (-O0):
%struct.storage = type { i32 }
define %struct.storage* @temp_from_bits(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @get_regclass_bits(i32 %3)
%5 = call %struct.storage* @get_reg(i32 %4)
ret %struct.storage* %5
}

LLVM IR (-O2):
%struct.storage = type { i32 }
define %struct.storage* @temp_from_bits(i32 %0) {
%2 = tail call i32 @get_regclass_bits(i32 %0)
%3 = tail call %struct.storage* @get_reg(i32 %2)
ret %struct.storage* %3
}
__attribute__((no, noclone)) unsigned __int128 t175_5sub(signed __int128 x) {
  unsigned __int128 r;
  if (__builtin_sub_overflow(x, (signed __int128)(-5), &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t175_5sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rcx,%r9
sar    $0x3f,%r9
add    $0x5,%rdx
adc    $0x0,%rcx
mov    %r9,%r8
adc    $0x0,%r8
adc    $0x0,%r9
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%esi
mov    %rsi,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    1187 <t175_5sub+0x77>
jmp    118e <t175_5sub+0x7e>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t175_5sub>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0x5,%r14
mov    %rsi,%rbx
adc    $0x0,%rbx
mov    $0xfffffffffffffffa,%rax
cmp    %rdi,%rax
mov    $0xffffffffffffffff,%rax
sbb    %rsi,%rax
jl     113f <t175_5sub+0x2f>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t175_5sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = sext i128 %11 to i129
%13 = call { i129, i1 } @llvm.ssub.with.overflow.i129(i129 %12, i129 -5)
%14 = extractvalue { i129, i1 } %13, 1
%15 = extractvalue { i129, i1 } %13, 0
%16 = trunc i129 %15 to i128
%17 = zext i128 %16 to i129
%18 = icmp ne i129 %15, %17
%19 = or i1 %14, %18
store i128 %16, i128* %6
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @bar()
br label %22
22: ; preds = %20, %2
%23 = load i128, i128* %6
store i128 %23, i128* %3
%24 = bitcast i128* %3 to { i64, i64 }*
%25 = load { i64, i64 }, { i64, i64 }* %24
ret { i64, i64 } %25
}

LLVM IR (-O2):
define { i64, i64 } @t175_5sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = zext i128 %6 to i129
%8 = add nuw i129 %7, 5
%9 = icmp slt i128 %6, -5
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i129 %8 to i64
%14 = lshr i129 %8, 64
%15 = trunc i129 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
chrcnt(s, c) register char *s;
register c;
{
  register n = 0;
  register cc;
  while (cc = *s++)
    if (cc == c)
      n++;
  return n;
}


x86 assembly (clang, -O0):
<chrcnt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <chrcnt+0x4a>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1145 <chrcnt+0x45>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <chrcnt+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @chrcnt(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = phi i32 [ %13, %5 ], [ 0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %6 to i32
%11 = icmp eq i32 %10, %1
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %8, %12
%14 = load i8, i8* %9
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %13, %5 ]
ret i32 %17
}
void zero_vect(double *vect, unsigned long len) {
  unsigned long i;
  for (i = 0; i < len; ++i)
    vect[i] = 0.0;
}


x86 assembly (clang, -O0):
<zero_vect>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1143 <zero_vect+0x43>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <zero_vect+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero_vect>:
test   %rsi,%rsi
je     1128 <zero_vect+0x18>
push   %rax
mov    %rsi,%rdx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @zero_vect(double* %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca i64
store double* %0, double** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %14, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load double*, double** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds double, double* %11, i64 %12
store double 0.000000e+00, double* %13
br label %14
14: ; preds = %10
%15 = load i64, i64* %5
%16 = add i64 %15, 1
store i64 %16, i64* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @zero_vect(double* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = bitcast double* %0 to i8*
%6 = shl nuw i64 %1, 3
br label %7
7: ; preds = %4, %2
ret void
}
int intcmp(const void *item1, const void *item2) {
  int a, b;
  a = *(int *)item1;
  b = *(int *)item2;
  if (a > b)
    return 1;
  else if (a < b)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<intcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <intcmp+0x36>
movl   $0x1,-0x4(%rbp)
jmp    115a <intcmp+0x5a>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    114e <intcmp+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <intcmp+0x5a>
jmp    1153 <intcmp+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcmp>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @intcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
int ElSuiteSparse_version(int version[3]) {
  if (version != ((void *)0)) {
    version[0] = 4;
    version[1] = 4;
    version[2] = 4;
  }
  return (((4) * 1000 + (4)));
}


x86 assembly (clang, -O0):
<ElSuiteSparse_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1133 <ElSuiteSparse_version+0x33>
mov    -0x8(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x4,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x4,0x8(%rax)
mov    $0xfa4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ElSuiteSparse_version>:
test   %rdi,%rdi
je     1119 <ElSuiteSparse_version+0x19>
movabs $0x400000004,%rax
mov    %rax,(%rdi)
movl   $0x4,0x8(%rdi)
mov    $0xfa4,%eax
ret

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

LLVM IR (-O2):
define i32 @ElSuiteSparse_version(i32* writeonly %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
store i32 4, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 4, i32* %4
%5 = getelementptr inbounds i32, i32* %0, i64 2
store i32 4, i32* %5
br label %6
6: ; preds = %3, %1
ret i32 4004
}
void CatchSigHup(int signo) {
  extern void LoadNewConfiguration();
  LoadNewConfiguration();
}


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

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

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

LLVM IR (-O2):
define void @CatchSigHup(i32 %0) {
tail call void (...) @LoadNewConfiguration()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_idxset_remove_by_data() {
  printf("NOT IMPLEMENTED:"
         "pa_idxset_remove_by_data"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [42 x i8] c"NOT IMPLEMENTED:pa_idxset_remove_by_data\0A\00"
define i32 @pa_idxset_remove_by_data() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [41 x i8] c"NOT IMPLEMENTED:pa_idxset_remove_by_data\00"
define i32 @pa_idxset_remove_by_data() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ swap(int *, int *);
int main(void) {
  int num1, num2;
  printf("Please input two number:");
  scanf("%d%d", &num1, &num2);
  swap(&num1, &num2);
  printf("\nOutput is:%d, %d\n", num1, num2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <swap@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <swap@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Please input two number:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [19 x i8] c"\0AOutput is:%d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = call i32 @swap(i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Please input two number:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [19 x i8] c"\0AOutput is:%d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = call i32 @swap(i32* %1, i32* %2)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}
void R_PrecacheGLSLPrograms(void) {}


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

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

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

LLVM IR (-O2):
define void @R_PrecacheGLSLPrograms() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ india();
int /*<<< orphan*/ printf(char *);
void germany() {
  printf("I am in GERMANY.\n");
  india();
  printf("I am back in GERMANY.\n");
}


x86 assembly (clang, -O0):
<germany>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <india@plt>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<germany>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <india@plt>
lea    0xed6(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"I am in GERMANY.\0A\00"
@.str.1 = [23 x i8] c"I am back in GERMANY.\0A\00"
define void @germany() {
%1 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @india()
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"I am in GERMANY.\00"
@str.2 = [22 x i8] c"I am back in GERMANY.\00"
define void @germany() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @india()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0))
ret void
}
int get() { return 9; }


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

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

LLVM IR (-O0):
define i32 @get() {
ret i32 9
}

LLVM IR (-O2):
define i32 @get() {
ret i32 9
}
int test_imm_4Duint16_reg(unsigned short val) {
  return ((val) & (0x4D << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Duint16_reg>:
test   $0x4d,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_4Duint16_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, 77
%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_4Duint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 77
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, long);
void print_constant(const char *name, long value) {
  printf("   %-28s : constant := %ld;\n", name, value);
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c" %-28s : constant := %ld;\0A\00"
define void @print_constant(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c" %-28s : constant := %ld;\0A\00"
define void @print_constant(i8* %0, i64 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
int on_off(const char *msg, const char *realval) {
  fprintf(stderr,
          "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n",
          msg, realval);
  return -1;
}


x86 assembly (clang, -O0):
<on_off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xec8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_off>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [57 x i8] c"Error: argument of \22%s\22 must be \22on\22 or \22off\22, not \22%s\22\0A\00"
define i32 @on_off(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
ret i32 -1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [57 x i8] c"Error: argument of \22%s\22 must be \22on\22 or \22off\22, not \22%s\22\0A\00"
define i32 @on_off(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ foo3(int);
int main(void) {
  foo3(97);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x61,%edi
call   1030 <foo3@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo3(i32 97)
ret i32 0
}
/* Variables and functions */
int get_mdp_major();
int dev2major(int d) {
  if (d >= 0)
    return 9;
  else
    return get_mdp_major();
}


x86 assembly (clang, -O0):
<dev2major>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1131 <dev2major+0x21>
movl   $0x9,-0x4(%rbp)
jmp    113b <dev2major+0x2b>
mov    $0x0,%al
call   1030 <get_mdp_major@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev2major>:
test   %edi,%edi
js     111a <dev2major+0xa>
mov    $0x9,%eax
ret
xor    %eax,%eax
jmp    1030 <get_mdp_major@plt>

LLVM IR (-O0):
define i32 @dev2major(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 9, i32* %2
br label %9
7: ; preds = %1
%8 = call i32 (...) @get_mdp_major()
store i32 %8, i32* %2
br label %9
9: ; preds = %7, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @dev2major(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @get_mdp_major()
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 9, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ sort(int *, int /*<<< orphan*/, int);
void mergeSort(int a[], int n) { sort(a, 0, n - 1); }


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

x86 assembly (clang, -O2):
<mergeSort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <sort@plt>

LLVM IR (-O0):
define void @mergeSort(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 = sub nsw i32 %6, 1
%8 = call i32 @sort(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @sort(i32* %0, i32 0, i32 %3)
ret void
}
/* Variables and functions */
int qsearch(int *, int, int /*<<< orphan*/, int);
int search(int *arr, int size, int value) {
  return qsearch(arr, value, 0, size - 1);
}


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

x86 assembly (clang, -O2):
<search>:
lea    -0x1(%rsi),%ecx
mov    %edx,%esi
xor    %edx,%edx
jmp    1030 <qsearch@plt>

LLVM IR (-O0):
define i32 @search(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* %6
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 1
%11 = call i32 @qsearch(i32* %7, i32 %8, i32 0, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @search(i32* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 @qsearch(i32* %0, i32 %2, i32 0, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void reverse_uint16_t(uint16_t *it, uint16_t *end) {
  uint16_t tmp;
  while (it < end) {
    tmp = *it;
    --end;
    *it++ = *end;
    *end = tmp;
  }
}


x86 assembly (clang, -O0):
<reverse_uint16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1154 <reverse_uint16_t+0x54>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    110c <reverse_uint16_t+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_uint16_t>:
cmp    %rsi,%rdi
jae    1128 <reverse_uint16_t+0x28>
add    $0xfffffffffffffffc,%rsi
nopl   0x0(%rax)
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
add    $0x4,%rdi
mov    %eax,(%rsi)
lea    -0x4(%rsi),%rax
cmp    %rsi,%rdi
mov    %rax,%rsi
jb     1110 <reverse_uint16_t+0x10>
ret

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

LLVM IR (-O2):
define void @reverse_uint16_t(i32* %0, i32* %1) {
%3 = icmp ult i32* %0, %1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32* [ %10, %4 ], [ %0, %2 ]
%6 = phi i32* [ %8, %4 ], [ %1, %2 ]
%7 = load i32, i32* %5
%8 = getelementptr inbounds i32, i32* %6, i64 -1
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %9, i32* %5
store i32 %7, i32* %8
%11 = icmp ult i32* %10, %8
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sqlite3_free(char *);
void db_sqlite3_vmfree(char *query) { sqlite3_free(query); }


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

x86 assembly (clang, -O2):
<db_sqlite3_vmfree>:
jmp    1030 <sqlite3_free@plt>

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

LLVM IR (-O2):
define void @db_sqlite3_vmfree(i8* %0) {
%2 = tail call i32 @sqlite3_free(i8* %0)
ret void
}
int do_951() { return 951; }


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

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

LLVM IR (-O0):
define i32 @do_951() {
ret i32 951
}

LLVM IR (-O2):
define i32 @do_951() {
ret i32 951
}
double celsius_to_kelvin(double celsius_temp) { return celsius_temp + 273.15; }


x86 assembly (clang, -O0):
<celsius_to_kelvin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<celsius_to_kelvin>:
addsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @celsius_to_kelvin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 2.731500e+02
ret double %4
}

LLVM IR (-O2):
define double @celsius_to_kelvin(double %0) {
%2 = fadd double %0, 2.731500e+02
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
int /*<<< orphan*/ grop();
main() {
  do {
    bar(33);
    grop();
  } while (1);
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x21,%edi
call   1030 <bar@plt>
mov    $0x0,%al
call   1040 <grop@plt>
mov    $0x1,%al
test   $0x1,%al
jne    112f <main+0xf>
jmp    114f <main+0x2f>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x21,%edi
call   1030 <bar@plt>
xor    %eax,%eax
call   1040 <grop@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = call i32 @bar(i32 33)
%4 = call i32 (...) @grop()
br label %5
5: ; preds = %2
br i1 true, label %2, label %6
6: ; preds = %5
ret i32 -1
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @bar(i32 33)
%3 = tail call i32 (...) @grop()
br label %1
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int idrnet_accept(int sockfd, void *sockaddr) {
  struct sockaddr *addr = (struct sockaddr *)sockaddr;
  socklen_t addr_size = 0;
  return accept(sockfd, addr, &addr_size);
}


x86 assembly (clang, -O0):
<idrnet_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <accept@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idrnet_accept>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
call   1030 <accept@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @idrnet_accept(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.sockaddr*
%6 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to %struct.sockaddr*
store %struct.sockaddr* %8, %struct.sockaddr** %5
store i32 0, i32* %6
%9 = load i32, i32* %3
%10 = load %struct.sockaddr*, %struct.sockaddr** %5
%11 = call i32 @accept(i32 %9, %struct.sockaddr* %10, i32* %6)
ret i32 %11
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @idrnet_accept(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i8* %1 to %struct.sockaddr*
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = call i32 @accept(i32 %0, %struct.sockaddr* %4, i32* %3)
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t mod(int32_t dividend, int32_t divisor) {
  int32_t rem = dividend % divisor;
  if (rem > 0)
    return rem;
  else
    return rem + divisor;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jle    1132 <mod+0x32>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    113e <mod+0x3e>
mov    -0x20(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1116 <mod+0x16>
cqto
idiv   %rsi
jmp    111a <mod+0x1a>
xor    %edx,%edx
div    %esi
xor    %eax,%eax
test   %rdx,%rdx
cmovg  %rax,%rsi
add    %rdx,%rsi
mov    %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @mod(i64 %0, i64 %1) {
%3 = srem i64 %0, %1
%4 = icmp sgt i64 %3, 0
%5 = select i1 %4, i64 0, i64 %1
%6 = add nsw i64 %5, %3
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ reg_die(char *);
int reg_dec(int c) {
  if (c >= '0' && c <= '9')
    return c - '0';
  reg_die("invalid quantifier");
  return 0;
}


x86 assembly (clang, -O0):
<reg_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
jl     113d <reg_dec+0x2d>
cmpl   $0x39,-0x8(%rbp)
jg     113d <reg_dec+0x2d>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <reg_dec+0x40>
lea    0xebc(%rip),%rdi
call   1030 <reg_die@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_dec>:
mov    %edi,%eax
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     112d <reg_dec+0x1d>
push   %rax
lea    0xede(%rip),%rdi
call   1030 <reg_die@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"invalid quantifier\00"
define i32 @reg_dec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 57
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %2
br label %14
12: ; preds = %6, %1
%13 = call i32 @reg_die(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [19 x i8] c"invalid quantifier\00"
define i32 @reg_dec(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @reg_die(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ %2, %1 ]
ret i32 %7
}