xunge/DecIR huggingface dataset:
/* Variables and functions */
int atoi(char const *);
int readLength(char const **readPtr) {
  int length = atoi(*readPtr);
  *readPtr += 6;
  return length;
}


x86 assembly (clang, -O0):
<readLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x6,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readLength>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rbx
mov    %rbx,%rdi
call   1030 <atoi@plt>
add    $0x6,%rbx
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @readLength(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = call i32 @atoi(i8* %5)
store i32 %6, i32* %3
%7 = load i8**, i8*** %2
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i64 6
store i8* %9, i8** %7
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @readLength(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @atoi(i8* %2)
%4 = getelementptr inbounds i8, i8* %2, i64 6
store i8* %4, i8** %0
ret i32 %3
}
unsigned int ascii_isalpha(char c) {
  if (c >= 'a' && c <= 'z')
    return 1;
  if (c >= 'A' && c <= 'Z')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ascii_isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1130 <ascii_isalpha+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1130 <ascii_isalpha+0x30>
movl   $0x1,-0x4(%rbp)
jmp    115d <ascii_isalpha+0x5d>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1156 <ascii_isalpha+0x56>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1156 <ascii_isalpha+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <ascii_isalpha+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii_isalpha>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @ascii_isalpha(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %22
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 65
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 90
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %2
br label %22
21: ; preds = %16, %12
store i32 0, i32* %2
br label %22
22: ; preds = %21, %20, %11
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @ascii_isalpha(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
void g_string_chunk_free() {}


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

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

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

LLVM IR (-O2):
define void @g_string_chunk_free() {
ret void
}
/* Variables and functions */
int open(char const *, int, int);
int osslib_open(const char *path, int flags, int dummy) {
  return open(path, flags, dummy);
}


x86 assembly (clang, -O0):
<osslib_open>:
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    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osslib_open>:
jmp    1030 <open@plt>

LLVM IR (-O0):
define i32 @osslib_open(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @open(i8* %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @osslib_open(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @open(i8* %0, i32 %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t read_bits(const char *src, uint64_t offs, uint32_t bits) {
  uint64_t *src_w = (uint64_t *)&src[offs >> 3];
  return (*src_w >> (offs & 7)) & ((((uint64_t)1) << bits) - 1);
}


x86 assembly (clang, -O0):
<read_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
sar    %cl,%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bits>:
mov    %esi,%ecx
mov    %esi,%eax
sar    $0x3,%eax
cltq
mov    (%rdi,%rax,1),%esi
and    $0x7,%cl
sar    %cl,%esi
mov    $0xffffffff,%eax
mov    %edx,%ecx
shl    %cl,%eax
not    %eax
and    %esi,%eax
ret

LLVM IR (-O0):
define i32 @read_bits(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = ashr i32 %9, 3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = bitcast i8* %12 to i32*
store i32* %13, i32** %7
%14 = load i32*, i32** %7
%15 = load i32, i32* %14
%16 = load i32, i32* %5
%17 = and i32 %16, 7
%18 = ashr i32 %15, %17
%19 = load i32, i32* %6
%20 = shl i32 1, %19
%21 = sub nsw i32 %20, 1
%22 = and i32 %18, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @read_bits(i8* nocapture %0, i32 %1, i32 %2) {
%4 = ashr i32 %1, 3
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = and i32 %1, 7
%10 = ashr i32 %8, %9
%11 = shl nsw i32 -1, %2
%12 = xor i32 %11, -1
%13 = and i32 %10, %12
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_pstream_set_receive_packet_callback() {
  printf("NOT IMPLEMENTED:"
         "pa_pstream_set_receive_packet_callback"
         "\n");
}


x86 assembly (clang, -O0):
<pa_pstream_set_receive_packet_callback>:
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_pstream_set_receive_packet_callback>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [55 x i8] c"NOT IMPLEMENTED:pa_pstream_set_receive_packet_callback\00"
define i32 @pa_pstream_set_receive_packet_callback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int rl_capitalize_word(count, key)
int count, key __attribute__((unused));
{ return (rl_change_case(count, 3)); }


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

x86 assembly (clang, -O2):
<rl_capitalize_word>:
mov    $0x3,%esi
xor    %eax,%eax
jmp    1030 <rl_change_case@plt>

LLVM IR (-O0):
define i32 @rl_capitalize_word(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @rl_change_case to i32 (i32, i32, ...)*)(i32 %5, i32 3)
ret i32 %6
}

LLVM IR (-O2):
define i32 @rl_capitalize_word(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @rl_change_case to i32 (i32, i32, ...)*)(i32 %0, i32 3)
ret i32 %3
}
/* Variables and functions */
int fwcfg_get_u16(int);
unsigned fwcfg_get_nb_cpus(void) { return fwcfg_get_u16(0x05); }


x86 assembly (clang, -O0):
<fwcfg_get_nb_cpus>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1030 <fwcfg_get_u16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fwcfg_get_nb_cpus>:
mov    $0x5,%edi
jmp    1030 <fwcfg_get_u16@plt>

LLVM IR (-O0):
define i32 @fwcfg_get_nb_cpus() {
%1 = call i32 @fwcfg_get_u16(i32 5)
ret i32 %1
}

LLVM IR (-O2):
define i32 @fwcfg_get_nb_cpus() {
%1 = tail call i32 @fwcfg_get_u16(i32 5)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void usage(int retval) {
  puts("USAGE: subleq_asm_assembler [OPTIONS] -i infile -o outfile\n"
       "  OPTIONS:\n"
       "    -h: Show this help message.\n"
       "    -i: Source file to assemble.\n"
       "    -o: Output binary file.\n"
       "    -v: Verbose (include comments indicating operations).\n"
       "    -c: Clean output: no comments.\n");
  exit(retval);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [257 x i8] c"USAGE: subleq_asm_assembler [OPTIONS] -i infile -o outfile\0A OPTIONS:\0A -h: Show this help message.\0A -i: Source file to assemble.\0A -o: Output binary file.\0A -v: Verbose (include comments indicating operations).\0A -c: Clean output: no comments.\0A\00"
define void @usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @puts(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@.str = [257 x i8] c"USAGE: subleq_asm_assembler [OPTIONS] -i infile -o outfile\0A OPTIONS:\0A -h: Show this help message.\0A -i: Source file to assemble.\0A -o: Output binary file.\0A -v: Verbose (include comments indicating operations).\0A -c: Clean output: no comments.\0A\00"
define void @usage(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([257 x i8], [257 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 %0)
unreachable
}
int words_size(char const *s, char c, int i) {
  int res;
  res = 0;
  while (s[i] != c && s[i] != '\0') {
    res++;
    i++;
  }
  return (res);
}


x86 assembly (clang, -O0):
<words_size>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
movsbl -0x9(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x15(%rbp)
je     114a <words_size+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    115a <words_size+0x5a>
jmp    1171 <words_size+0x71>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1118 <words_size+0x18>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<words_size>:
movslq %edx,%rcx
mov    (%rdi,%rcx,1),%dl
xor    %eax,%eax
cmp    %sil,%dl
je     1131 <words_size+0x31>
test   %dl,%dl
je     1131 <words_size+0x31>
add    %rdi,%rcx
add    $0x1,%rcx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movzbl (%rcx,%rax,1),%edx
add    $0x1,%rax
cmp    %sil,%dl
je     1131 <words_size+0x31>
test   %dl,%dl
jne    1120 <words_size+0x20>
ret

LLVM IR (-O0):
define i32 @words_size(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %28, %3
%9 = load i8*, i8** %4
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %14, %16
br i1 %17, label %18, label %26
18: ; preds = %8
%19 = load i8*, i8** %4
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br label %26
26: ; preds = %18, %8
%27 = phi i1 [ false, %8 ], [ %25, %18 ]
br i1 %27, label %28, label %33
28: ; preds = %26
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %8
33: ; preds = %26
%34 = load i32, i32* %7
ret i32 %34
}

LLVM IR (-O2):
define i32 @words_size(i8* nocapture %0, i8 signext %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, %1
%8 = icmp eq i8 %6, 0
%9 = or i1 %7, %8
br i1 %9, label %20, label %10
10: ; preds = %3, %10
%11 = phi i64 [ %14, %10 ], [ %4, %3 ]
%12 = phi i32 [ %13, %10 ], [ 0, %3 ]
%13 = add nuw nsw i32 %12, 1
%14 = add i64 %11, 1
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, %1
%18 = icmp eq i8 %16, 0
%19 = or i1 %17, %18
br i1 %19, label %20, label %10
20: ; preds = %10, %3
%21 = phi i32 [ 0, %3 ], [ %13, %10 ]
ret i32 %21
}
/* Type definitions */
typedef int time_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int time(int *);
int main(void) {
  time_t a, b;
  a = time(&b);
  assert(1262304000 < a);
  assert(a == b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <time@plt>
mov    %eax,-0x8(%rbp)
mov    $0x4b3d3b00,%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1040 <time@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0x4b3d3b01,%eax
setge  %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    0xc(%rsp),%ebx
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 1262304000, %5
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp eq i32 %9, %10
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = icmp sgt i32 %3, 1262304000
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* %1
%8 = icmp eq i32 %3, %7
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
void getmntent_addopt(char **c, const char *s) {
  int i = strlen(s);
  *(*c)++ = ',';
  strcpy(*c, s);
  *c += i;
}


x86 assembly (clang, -O0):
<getmntent_addopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movb   $0x2c,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmntent_addopt>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movb   $0x2c,(%rax)
mov    (%rbx),%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movslq %ebp,%rax
add    %rax,(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @getmntent_addopt(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
store i8** %0, i8*** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8**, i8*** %3
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %8
store i8 44, i8* %9
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i32, i32* %5
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %16
%18 = sext i32 %15 to i64
%19 = getelementptr inbounds i8, i8* %17, i64 %18
store i8* %19, i8** %16
ret void
}

LLVM IR (-O2):
define void @getmntent_addopt(i8** nocapture %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = load i8*, i8** %0
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %5, i8** %0
store i8 44, i8* %4
%6 = load i8*, i8** %0
%7 = tail call i32 @strcpy(i8* %6, i8* %1)
%8 = load i8*, i8** %0
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i8, i8* %8, i64 %9
store i8* %10, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear();
int /*<<< orphan*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ refresh();
void clear_the_screen(void) {
  clear();
  move(0, 0);
  refresh();
}


x86 assembly (clang, -O0):
<clear_the_screen>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <clear@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <move@plt>
mov    $0x0,%al
call   1030 <refresh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_the_screen>:
push   %rax
xor    %eax,%eax
call   1040 <clear@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <move@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <refresh@plt>

LLVM IR (-O0):
define void @clear_the_screen() {
%1 = call i32 (...) @clear()
%2 = call i32 @move(i32 0, i32 0)
%3 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
define void @clear_the_screen() {
%1 = tail call i32 (...) @clear()
%2 = tail call i32 @move(i32 0, i32 0)
%3 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void showHelp() { fprintf(stderr, "USAGE: svm [-(g|o|X|E)] <input>\n"); }


x86 assembly (clang, -O0):
<showHelp>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<showHelp>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"USAGE: svm [-(g|o|X|E)] <input>\0A\00"
define void @showHelp() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"USAGE: svm [-(g|o|X|E)] <input>\0A\00"
define void @showHelp() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bfnt_draw_char(int, int, int, int, int);
int /*<<< orphan*/ bmp_fill(int, int, int, int, int);
void submenu_key_hint(int x, int y, int fg, int bg, int chr) {
  bmp_fill(bg, x + 12, y + 1, 25, 30);
  bfnt_draw_char(chr, x, y - 5, fg, 0x02);
}


x86 assembly (clang, -O0):
<submenu_key_hint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
add    $0xc,%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
mov    $0x19,%ecx
mov    $0x1e,%r8d
call   1030 <bmp_fill@plt>
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
sub    $0x5,%edx
mov    -0xc(%rbp),%ecx
mov    $0x2,%r8d
call   1040 <bfnt_draw_char@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<submenu_key_hint>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xc(%rbx),%esi
lea    0x1(%rbp),%edx
mov    %ecx,%edi
mov    $0x19,%ecx
mov    $0x1e,%r8d
call   1030 <bmp_fill@plt>
add    $0xfffffffb,%ebp
mov    %r15d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    $0x2,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <bfnt_draw_char@plt>

LLVM IR (-O0):
define void @submenu_key_hint(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 12
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
%16 = call i32 @bmp_fill(i32 %11, i32 %13, i32 %15, i32 25, i32 30)
%17 = load i32, i32* %10
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = sub nsw i32 %19, 5
%21 = load i32, i32* %8
%22 = call i32 @bfnt_draw_char(i32 %17, i32 %18, i32 %20, i32 %21, i32 2)
ret void
}

LLVM IR (-O2):
define void @submenu_key_hint(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %0, 12
%7 = add nsw i32 %1, 1
%8 = tail call i32 @bmp_fill(i32 %3, i32 %6, i32 %7, i32 25, i32 30)
%9 = add nsw i32 %1, -5
%10 = tail call i32 @bfnt_draw_char(i32 %4, i32 %0, i32 %9, i32 %2, i32 2)
ret void
}
/* Type definitions */
struct shash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int shash_find(struct shash *, char *, int, int /*<<< orphan*/ *);
void find_not_exists(struct shash *shash) {
  assert(shash_find(shash, "1", 2, NULL) == -1);
  assert(shash_find(shash, "2", 2, NULL) == -1);
}


x86 assembly (clang, -O0):
<find_not_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <shash_find@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <shash_find@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_not_exists>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1030 <shash_find@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1030 <shash_find@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
pop    %rbx
jmp    1040 <assert@plt>

LLVM IR (-O0):
%struct.shash = type { i32 }
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"2\00"
define void @find_not_exists(%struct.shash* %0) {
%2 = alloca %struct.shash*
store %struct.shash* %0, %struct.shash** %2
%3 = load %struct.shash*, %struct.shash** %2
%4 = call i32 @shash_find(%struct.shash* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 2, i32* null)
%5 = icmp eq i32 %4, -1
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load %struct.shash*, %struct.shash** %2
%9 = call i32 @shash_find(%struct.shash* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2, i32* null)
%10 = icmp eq i32 %9, -1
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret void
}

LLVM IR (-O2):
%struct.shash = type { i32 }
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"2\00"
define void @find_not_exists(%struct.shash* %0) {
%2 = tail call i32 @shash_find(%struct.shash* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 2, i32* null)
%3 = icmp eq i32 %2, -1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @shash_find(%struct.shash* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2, i32* null)
%7 = icmp eq i32 %6, -1
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
ret void
}
free_3d_array(array, N1, N2) char ***array;
int N1, N2;
{
  register int i;
  for (i = 0; i < N1; i++)
    free_2d_array(array[i], N2);
  free((char *)array);
}


x86 assembly (clang, -O0):
<free_3d_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1169 <free_3d_array+0x49>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%esi
mov    $0x0,%al
call   1040 <free_2d_array@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <free_3d_array+0x19>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_3d_array>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
test   %esi,%esi
jle    1157 <free_3d_array+0x37>
mov    %edx,%r14d
mov    %esi,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <free_2d_array@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <free_3d_array+0x20>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define i32 @free_3d_array(i8*** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i8**, i8*** %0, i64 %8
%10 = load i8**, i8*** %9
%11 = tail call i32 (i8**, i32, ...) bitcast (i32 (...)* @free_2d_array to i32 (i8**, i32, ...)*)(i8** %10, i32 %2)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
%15 = bitcast i8*** %0 to i8*
tail call void @free(i8* %15)
ret i32 undef
}
void square_to_str(char *buf, int square) {
  buf[0] = (square % 8) + 'a';
  buf[1] = (square / 8) + '1';
}


x86 assembly (clang, -O0):
<square_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x31,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<square_to_str>:
lea    0x7(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
mov    %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%esi
add    $0x61,%sil
mov    %sil,(%rdi)
sar    $0x3,%eax
add    $0x31,%al
mov    %al,0x1(%rdi)
ret

LLVM IR (-O0):
define void @square_to_str(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = srem i32 %5, 8
%7 = add nsw i32 %6, 97
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = sdiv i32 %11, 8
%13 = add nsw i32 %12, 49
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
ret void
}

LLVM IR (-O2):
define void @square_to_str(i8* nocapture writeonly %0, i32 %1) {
%3 = srem i32 %1, 8
%4 = trunc i32 %3 to i8
%5 = add nsw i8 %4, 97
store i8 %5, i8* %0
%6 = sdiv i32 %1, 8
%7 = trunc i32 %6 to i8
%8 = add i8 %7, 49
%9 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %8, i8* %9
ret void
}
void ostflush(void) {}


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

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

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

LLVM IR (-O2):
define void @ostflush() {
ret void
}
/* Variables and functions */
int linearSearch(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int nums[5] = {6, 3, 9, 1, 20};
  printf("%i\n", linearSearch(nums, 5, 1));
  printf("%i\n", linearSearch(nums, 5, 1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1030 <linearSearch@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1030 <linearSearch@plt>
mov    %eax,%esi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0xee3(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1030 <linearSearch@plt>
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1030 <linearSearch@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.nums = [5 x i32] [i32 6, i32 3, i32 9, i32 1, i32 20]
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = bitcast [5 x i32]* %2 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%5 = call i32 @linearSearch(i32* %4, i32 5, i32 1)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%8 = call i32 @linearSearch(i32* %7, i32 5, i32 1)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [5 x i32] [i32 6, i32 3, i32 9, i32 1, i32 20]
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @linearSearch(i32* %3, i32 5, i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @linearSearch(i32* %3, i32 5, i32 1)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
long long strtoll(char *, char **, int);
void test1(char *array, char *endptr) {
  long long r = strtoll(array, &endptr, 3);
  assert(array + 2 == endptr);
  assert(r == 5);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strtoll@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x5,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsi,(%rsp)
mov    %rsp,%rsi
mov    $0x3,%edx
call   1030 <strtoll@plt>
mov    %rax,%r14
add    $0x2,%rbx
xor    %edi,%edi
cmp    (%rsp),%rbx
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x5,%r14
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <assert@plt>

LLVM IR (-O0):
define void @test1(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strtoll(i8* %6, i8** %4, i32 3)
store i64 %7, i64* %5
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = load i8*, i8** %4
%11 = icmp eq i8* %9, %10
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i64, i64* %5
%15 = icmp eq i64 %14, 5
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
ret void
}

LLVM IR (-O2):
define void @test1(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %1, i8** %3
%4 = call i64 @strtoll(i8* %0, i8** %3, i32 3)
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp eq i64 %4, 5
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
ret void
}
/* Variables and functions */
int rand();
void fillArrayRandomly(double *begin, double *end) {
  while (begin < end) {
    *begin = rand() % 10;
    ++begin;
  }
}


x86 assembly (clang, -O0):
<fillArrayRandomly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115a <fillArrayRandomly+0x4a>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <fillArrayRandomly+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillArrayRandomly>:
push   %r14
push   %rbx
push   %rax
cmp    %rsi,%rdi
jae    1158 <fillArrayRandomly+0x48>
mov    %rsi,%r14
mov    %rdi,%rbx
nop
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
cmp    %r14,%rbx
jb     1120 <fillArrayRandomly+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @fillArrayRandomly(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
br label %5
5: ; preds = %9, %2
%6 = load double*, double** %3
%7 = load double*, double** %4
%8 = icmp ult double* %6, %7
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = call i32 (...) @rand()
%11 = srem i32 %10, 10
%12 = sitofp i32 %11 to double
%13 = load double*, double** %3
store double %12, double* %13
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i32 1
store double* %15, double** %3
br label %5
16: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @fillArrayRandomly(double* writeonly %0, double* readnone %1) {
%3 = icmp ult double* %0, %1
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi double* [ %9, %4 ], [ %0, %2 ]
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 10
%8 = sitofp i32 %7 to double
store double %8, double* %5
%9 = getelementptr inbounds double, double* %5, i64 1
%10 = icmp ult double* %9, %1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void usage(char *prog) {
  printf("usage: %s filein\n", prog);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"usage: %s filein\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ htsmsg_add_s64(void *, char const *, long);
void add_long(void *opaque, void *parent, const char *name, long v) {
  htsmsg_add_s64(parent, name, v);
}


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

x86 assembly (clang, -O2):
<add_long>:
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1030 <htsmsg_add_s64@plt>

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

LLVM IR (-O2):
define void @add_long(i8* nocapture readnone %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i32 @htsmsg_add_s64(i8* %1, i8* %2, i64 %3)
ret void
}
int fz_clampi(int i, int min, int max) {
  return (i > min ? (i < max ? i : max) : min);
}


x86 assembly (clang, -O0):
<fz_clampi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1141 <fz_clampi+0x41>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1130 <fz_clampi+0x30>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <fz_clampi+0x36>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <fz_clampi+0x47>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz_clampi>:
mov    %edx,%eax
cmp    %edx,%edi
cmovl  %edi,%eax
cmp    %esi,%edi
cmovle %esi,%eax
ret

LLVM IR (-O0):
define i32 @fz_clampi(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 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32, i32* %4
br label %18
16: ; preds = %10
%17 = load i32, i32* %6
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %17, %16 ]
br label %22
20: ; preds = %3
%21 = load i32, i32* %5
br label %22
22: ; preds = %20, %18
%23 = phi i32 [ %19, %18 ], [ %21, %20 ]
ret i32 %23
}

LLVM IR (-O2):
define i32 @fz_clampi(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = icmp slt i32 %0, %2
%6 = select i1 %5, i32 %0, i32 %2
%7 = select i1 %4, i32 %6, i32 %1
ret i32 %7
}
void ScaleRowDown34_1_Box_Any_NEON() {}


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

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

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

LLVM IR (-O2):
define void @ScaleRowDown34_1_Box_Any_NEON() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char const);
int is_atom(const char *e) { return !isspace(*e); }


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

x86 assembly (clang, -O2):
<is_atom>:
push   %rax
movsbl (%rdi),%edi
call   1030 <isspace@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_atom(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = call i32 @isspace(i8 signext %4)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_atom(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @isspace(i8 signext %2)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
unsigned int foo(unsigned short x) { return __builtin_popcount(x); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%ecx
mov    %ecx,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%ecx
mov    %ecx,%eax
and    $0x33333333,%eax
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
shr    %eax
and    $0x5555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x3333,%eax
shr    $0x2,%edi
and    $0x3333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f,%eax
mov    %eax,%ecx
shl    $0x8,%ecx
add    %eax,%ecx
movzbl %ch,%eax
ret

LLVM IR (-O0):
define i32 @foo(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = call i32 @llvm.ctpop.i32(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo(i16 zeroext %0) {
%2 = tail call i16 @llvm.ctpop.i16(i16 %0)
%3 = zext i16 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fun(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int ret = 0;
  long nr_of_reductions = 1;
  fun(1);
  printf("RETURNED %d\n", ret);
  if (ret != 53) {
    return 1;
  } else {
    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)
movl   $0x0,-0x14(%rbp)
movq   $0x1,-0x20(%rbp)
mov    $0x1,%edi
call   1030 <fun@plt>
mov    -0x14(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x35,-0x14(%rbp)
je     1174 <main+0x54>
movl   $0x1,-0x4(%rbp)
jmp    117b <main+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"RETURNED %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @fun(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 1
}
/* Variables and functions */
scalar_t__ YabauseExec();
int PERQTHandleEvents(void) {
  if (YabauseExec() != 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<PERQTHandleEvents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <YabauseExec@plt>
cmp    $0x0,%rax
je     1135 <PERQTHandleEvents+0x25>
movl   $0xffffffff,-0x4(%rbp)
jmp    113c <PERQTHandleEvents+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PERQTHandleEvents>:
push   %rax
xor    %eax,%eax
call   1030 <YabauseExec@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @PERQTHandleEvents() {
%1 = alloca i32
%2 = call i64 (...) @YabauseExec()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 -1, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @PERQTHandleEvents() {
%1 = tail call i64 (...) @YabauseExec()
%2 = icmp ne i64 %1, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
int m_upper(c)
int c;
{
  if (c >= 'a' && c <= 'z')
    c += 'A' - 'a';
  return (c);
}


x86 assembly (clang, -O0):
<m_upper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     1124 <m_upper+0x24>
cmpl   $0x7a,-0x4(%rbp)
jg     1124 <m_upper+0x24>
mov    -0x4(%rbp),%eax
add    $0xffffffe0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_upper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @m_upper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}