xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ vtkParse_SkipId(char const *);
size_t vtkParse_SkipQuotes(char const *);
size_t parse_skip_quotes_with_suffix(const char *cp) {
  size_t l = vtkParse_SkipQuotes(cp);
  if (l && cp[l] == '_') {
    l += vtkParse_SkipId(cp + l);
  }
  return l;
}


x86 assembly (clang, -O0):
<parse_skip_quotes_with_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <vtkParse_SkipQuotes@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116e <parse_skip_quotes_with_suffix+0x4e>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
jne    116e <parse_skip_quotes_with_suffix+0x4e>
mov    -0x8(%rbp),%rdi
add    -0x10(%rbp),%rdi
call   1030 <vtkParse_SkipId@plt>
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_skip_quotes_with_suffix>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <vtkParse_SkipQuotes@plt>
test   %rax,%rax
je     114b <parse_skip_quotes_with_suffix+0x2b>
mov    %rax,%rbx
cmpb   $0x5f,(%r14,%rax,1)
jne    114d <parse_skip_quotes_with_suffix+0x2d>
add    %rbx,%r14
mov    %r14,%rdi
call   1030 <vtkParse_SkipId@plt>
add    %rax,%rbx
jmp    114d <parse_skip_quotes_with_suffix+0x2d>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @parse_skip_quotes_with_suffix(i8* %0) {
%2 = tail call i64 @vtkParse_SkipQuotes(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 %2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 95
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = tail call i64 @vtkParse_SkipId(i8* %5)
%10 = add i64 %9, %2
br label %11
11: ; preds = %8, %4, %1
%12 = phi i64 [ %10, %8 ], [ %2, %4 ], [ 0, %1 ]
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void testOffsetDeallocate(int *memoryBlock) { free(&memoryBlock[-1]); }


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

x86 assembly (clang, -O2):
<testOffsetDeallocate>:
add    $0xfffffffffffffffc,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @testOffsetDeallocate(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 -1
%5 = call i32 @free(i32* %4)
ret void
}

LLVM IR (-O2):
define void @testOffsetDeallocate(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -1
%3 = tail call i32 @free(i32* %2)
ret void
}
strcat(s1, s2) char *s1, *s2;
{
  char *os1;
  os1 = s1;
  while (*s1++)
    ;
  *--s1;
  while (*s1++ = *s2++)
    ;
  return (os1);
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1131 <strcat+0x31>
jmp    1114 <strcat+0x14>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     116c <strcat+0x6c>
jmp    113d <strcat+0x3d>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
ret

LLVM IR (-O0):
define i32 @strcat(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
store i8* %6, i8** %5
br label %7
7: ; preds = %12, %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 = icmp ne i8 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %7
br label %7
13: ; preds = %7
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 -1
store i8* %15, i8** %3
%16 = load i8, i8* %15
br label %17
17: ; preds = %24, %13
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
%20 = load i8, i8* %18
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
store i8 %20, i8* %21
%23 = icmp ne i8 %20, 0
br i1 %23, label %24, label %25
24: ; preds = %17
br label %17
25: ; preds = %17
%26 = load i8*, i8** %5
%27 = ptrtoint i8* %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @strcat(i8* %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
%16 = ptrtoint i8* %0 to i64
%17 = trunc i64 %16 to i32
ret i32 %17
}
int afont_ntohl(int n) {
  int buf = 1;
  if (*(char *)(&buf) == 0x01) {
    ((char *)(&buf))[0] = ((char *)(&n))[3];
    ((char *)(&buf))[1] = ((char *)(&n))[2];
    ((char *)(&buf))[2] = ((char *)(&n))[1];
    ((char *)(&buf))[3] = ((char *)(&n))[0];
    return buf;
  } else {
    return n;
  }
}


x86 assembly (clang, -O0):
<afont_ntohl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movsbl -0xc(%rbp),%eax
cmp    $0x1,%eax
jne    113e <afont_ntohl+0x3e>
mov    -0x5(%rbp),%al
mov    %al,-0xc(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0xb(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <afont_ntohl+0x44>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<afont_ntohl>:
mov    %edi,%eax
bswap  %eax
ret

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

LLVM IR (-O2):
define i32 @afont_ntohl(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *msg) {
  printf("%s\n"
         "usage: ondir [-V] <old-directory> [<new-directory>]\n"
         "\n"
         "  -V    Displays version information.\n"
         "\n"
         "  <old-directory> is the last working directory.\n"
         "\n"
         "  <new-directory> is the current working directory. If "
         "<new-directory> is\n"
         "  omitted, the current working directory is obtained via a call to "
         "getcwd().\n"
         "\n",
         msg);
  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 = [298 x i8] c"%s\0Ausage: ondir [-V] <old-directory> [<new-directory>]\0A\0A -V Displays version information.\0A\0A <old-directory> is the last working directory.\0A\0A <new-directory> is the current working directory. If <new-directory> is\0A omitted, the current working directory is obtained via a call to getcwd().\0A\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 ([298 x i8], [298 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [298 x i8] c"%s\0Ausage: ondir [-V] <old-directory> [<new-directory>]\0A\0A -V Displays version information.\0A\0A <old-directory> is the last working directory.\0A\0A <new-directory> is the current working directory. If <new-directory> is\0A omitted, the current working directory is obtained via a call to getcwd().\0A\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([298 x i8], [298 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int open_file_int(char *file_name, char *mode) {
  FILE *f;
  int code = 0;
  f = fopen(file_name, mode);
  if (f)
    fclose(f);
  else
    code = errno;
  return code;
}


x86 assembly (clang, -O0):
<open_file_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <open_file_int+0x41>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    116d <open_file_int+0x4d>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_file_int>:
push   %rax
call   1040 <fopen@plt>
test   %rax,%rax
je     1137 <open_file_int+0x17>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @open_file_int(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @fclose(i32* %3)
br label %9
7: ; preds = %2
%8 = load i32, i32* @errno
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 0, %5 ], [ %8, %7 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ intif_charposreq(int, char *, int /*<<< orphan*/);
int intif_where(int account_id, char *name) {
  intif_charposreq(account_id, name, 0);
  return 0;
}


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

x86 assembly (clang, -O2):
<intif_where>:
push   %rax
xor    %edx,%edx
call   1030 <intif_charposreq@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @intif_where(i32 %0, i8* %1) {
%3 = tail call i32 @intif_charposreq(i32 %0, i8* %1, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ notifyEvent(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/);
void sesc_fast_sim_end() { notifyEvent("sesc_fast_sim_end", 0, 0, 0); }


x86 assembly (clang, -O0):
<sesc_fast_sim_end>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <notifyEvent@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sesc_fast_sim_end>:
lea    0xee9(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <notifyEvent@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"sesc_fast_sim_end\00"
define void @sesc_fast_sim_end() {
%1 = call i32 @notifyEvent(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"sesc_fast_sim_end\00"
define void @sesc_fast_sim_end() {
%1 = tail call i32 @notifyEvent(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
ret void
}
char *cstpcpy(char *to, const char *from) {
  for (; (*to = *from) != '\0'; ++from, ++to)
    ;
  return (to);
}


x86 assembly (clang, -O0):
<cstpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1146 <cstpcpy+0x46>
jmp    1129 <cstpcpy+0x29>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <cstpcpy+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstpcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
test   %cl,%cl
je     1122 <cstpcpy+0x22>
add    $0x1,%rsi
nop
movzbl (%rsi),%ecx
mov    %cl,0x1(%rax)
add    $0x1,%rax
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <cstpcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @cstpcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %8, %5 ], [ %1, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i8* [ %0, %2 ], [ %9, %5 ]
ret i8* %13
}
int compare_chars(const void *l1, const void *l2) {
  const char *la = (const char *)l1;
  const char *lb = (const char *)l2;
  return ((*la > *lb) - (*la < *lb));
}


x86 assembly (clang, -O0):
<compare_chars>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    -0x20(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
mov    -0x20(%rbp),%rdx
movsbl (%rdx),%edx
cmp    %edx,%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_chars>:
mov    (%rdi),%cl
xor    %eax,%eax
xor    %edx,%edx
cmp    (%rsi),%cl
setg   %al
setl   %dl
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @compare_chars(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = load i8*, i8** %6
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp sgt i32 %11, %14
%16 = zext i1 %15 to i32
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = load i8*, i8** %6
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %19, %22
%24 = zext i1 %23 to i32
%25 = sub nsw i32 %16, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @compare_chars(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp sgt i8 %3, %4
%6 = zext i1 %5 to i32
%7 = icmp slt i8 %3, %4
%8 = sext i1 %7 to i32
%9 = add nsw i32 %8, %6
ret i32 %9
}
void vectorScale(int *input, int *scale, int *output) {
  int i;
  for (i = 0; i < 3; i++) {
    output[i] = input[i] * (*scale) / 62;
  }
}


x86 assembly (clang, -O0):
<vectorScale>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1156 <vectorScale+0x56>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
imul   (%rcx),%eax
mov    $0x3e,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <vectorScale+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vectorScale>:
mov    (%rsi),%eax
imul   (%rdi),%eax
cltq
imul   $0xffffffff84210843,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x5,%eax
add    %ecx,%eax
mov    %eax,(%rdx)
mov    (%rsi),%eax
imul   0x4(%rdi),%eax
cltq
imul   $0xffffffff84210843,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x5,%eax
add    %ecx,%eax
mov    %eax,0x4(%rdx)
mov    (%rsi),%eax
imul   0x8(%rdi),%eax
cltq
imul   $0xffffffff84210843,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x5,%eax
add    %ecx,%eax
mov    %eax,0x8(%rdx)
ret

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

LLVM IR (-O2):
define void @vectorScale(i32* nocapture %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %6, 62
store i32 %7, i32* %2
%8 = getelementptr inbounds i32, i32* %0, i64 1
%9 = load i32, i32* %8
%10 = load i32, i32* %1
%11 = mul nsw i32 %10, %9
%12 = sdiv i32 %11, 62
%13 = getelementptr inbounds i32, i32* %2, i64 1
store i32 %12, i32* %13
%14 = getelementptr inbounds i32, i32* %0, i64 2
%15 = load i32, i32* %14
%16 = load i32, i32* %1
%17 = mul nsw i32 %16, %15
%18 = sdiv i32 %17, 62
%19 = getelementptr inbounds i32, i32* %2, i64 2
store i32 %18, i32* %19
ret void
}
/* Variables and functions */
int /*<<< orphan*/ merge(long long, long long, long long, long long);
void sort(long long int l, long long int r) {
  long long int mid = (l + r) / 2;
  if (l == r)
    return;
  else {
    sort(l, mid);
    sort(mid + 1, r);
    merge(l, mid, mid + 1, r);
  }
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1159 <sort+0x39>
jmp    1190 <sort+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <sort@plt>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
mov    -0x10(%rbp),%rcx
call   1040 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
cmp    %rsi,%rdi
jne    1126 <sort+0x6>
ret
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    (%rsi,%rdi,1),%rax
mov    %rax,%rbx
shr    $0x3f,%rbx
add    %rax,%rbx
sar    %rbx
mov    %rbx,%rsi
call   1030 <sort@plt>
lea    0x1(%rbx),%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <sort@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <merge@plt>

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

LLVM IR (-O2):
define void @sort(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
%4 = sdiv i64 %3, 2
%5 = icmp eq i64 %0, %1
br i1 %5, label %6, label %7
6: ; preds = %2, %7
ret void
7: ; preds = %2
tail call void @sort(i64 %0, i64 %4)
%8 = add nsw i64 %4, 1
tail call void @sort(i64 %8, i64 %1)
%9 = tail call i32 @merge(i64 %0, i64 %4, i64 %8, i64 %1)
br label %6
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, unsigned char *, int);
float load_float(unsigned char **bufferp) {
  unsigned char *buffer = *bufferp;
  float f;
  memcpy(&f, buffer, 4);
  *bufferp += 4;
  return f;
}


x86 assembly (clang, -O0):
<load_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_float>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xc(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
addq   $0x4,(%rbx)
movss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define float @load_float(i8** nocapture %0) {
%2 = alloca float
%3 = load i8*, i8** %0
%4 = bitcast float* %2 to i8*
%5 = call i32 @memcpy(float* %2, i8* %3, i32 4)
%6 = load i8*, i8** %0
%7 = getelementptr inbounds i8, i8* %6, i64 4
store i8* %7, i8** %0
%8 = load float, float* %2
ret float %8
}
/* Variables and functions */
int /*<<< orphan*/ svcPanic();
int getpid() { svcPanic(); }


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

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

LLVM IR (-O0):
define i32 @getpid() {
%1 = alloca i32
%2 = call i32 (...) @svcPanic()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @getpid() {
%1 = tail call i32 (...) @svcPanic()
ret i32 undef
}
void YUY2ToUVRow_SSE2() {}


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

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

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

LLVM IR (-O2):
define void @YUY2ToUVRow_SSE2() {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int int16_t;

/* Variables and functions */
int16_t get_16bitBE(uint8_t *p) { return (p[0] << 8) | (p[1]); }


x86 assembly (clang, -O0):
<get_16bitBE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_16bitBE>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_16bitBE(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ uart_putc(int /*<<< orphan*/);
void uart_puts(const char *s) {
  while (*s)
    uart_putc(*s++);
}


x86 assembly (clang, -O0):
<uart_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <uart_puts+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <uart_putc@plt>
jmp    111c <uart_puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <uart_puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <uart_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <uart_puts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @uart_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @uart_putc(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ write_at_be16(void *, int, int);
int /*<<< orphan*/ write_be16(void *, int);
void write_be32(void *dest, uint32_t val) {
  write_be16(dest, val >> 16);
  write_at_be16(dest, val >> 0, sizeof(uint16_t));
}


x86 assembly (clang, -O0):
<write_be32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x10,%esi
call   1030 <write_be16@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x0,%esi
mov    $0x4,%edx
call   1040 <write_at_be16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_be32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
sar    $0x10,%esi
call   1030 <write_be16@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x4,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <write_at_be16@plt>

LLVM IR (-O0):
define void @write_be32(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 16
%8 = call i32 @write_be16(i8* %5, i32 %7)
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = ashr i32 %10, 0
%12 = call i32 @write_at_be16(i8* %9, i32 %11, i32 4)
ret void
}

LLVM IR (-O2):
define void @write_be32(i8* %0, i32 %1) {
%3 = ashr i32 %1, 16
%4 = tail call i32 @write_be16(i8* %0, i32 %3)
%5 = tail call i32 @write_at_be16(i8* %0, i32 %1, i32 4)
ret void
}
void prep_transhuge_page(struct page *page) {}


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

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

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

LLVM IR (-O2):
%struct.page = type opaque
define void @prep_transhuge_page(%struct.page* nocapture %0) {
ret void
}
int oct_to_dec(int n) {
  int res = 0;
  int i = 1;
  while (n) {
    res = res + ((n % 10) * i);
    i = i * 8;
    n = n / 10;
  }
  return res;
}


x86 assembly (clang, -O0):
<oct_to_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1158 <oct_to_dec+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%edx
add    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1115 <oct_to_dec+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<oct_to_dec>:
xor    %eax,%eax
test   %edi,%edi
je     1143 <oct_to_dec+0x43>
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
movslq %edi,%rdx
imul   $0x66666667,%rdx,%rdi
mov    %rdi,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdi
add    %esi,%edi
lea    (%rdi,%rdi,1),%esi
lea    (%rsi,%rsi,4),%r8d
mov    %edx,%esi
sub    %r8d,%esi
imul   %ecx,%esi
add    %esi,%eax
shl    $0x3,%ecx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1110 <oct_to_dec+0x10>
ret

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

LLVM IR (-O2):
define i32 @oct_to_dec(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %10, %3 ], [ 1, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = phi i32 [ %11, %3 ], [ %0, %1 ]
%7 = srem i32 %6, 10
%8 = mul nsw i32 %4, %7
%9 = add nsw i32 %8, %5
%10 = shl nsw i32 %4, 3
%11 = sdiv i32 %6, 10
%12 = add i32 %6, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %3
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %9, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fatal(char *, int /*<<< orphan*/);
char *strdup(char const *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
char *cli_strdup(const char *string) {
  char *copy;
  if ((copy = strdup(string)) == NULL)
    fatal("strdup: %s", strerror(errno));
  return (copy);
}


x86 assembly (clang, -O0):
<cli_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    116f <cli_strdup+0x3f>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
call   1050 <fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_strdup>:
push   %rbx
call   1030 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115a <cli_strdup+0x2a>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xead(%rip),%rdi
mov    %eax,%esi
call   1050 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"strdup: %s\00"
@errno = global i32 0
define i8* @cli_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @errno
%9 = call i32 @strerror(i32 %8)
%10 = call i32 @fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %7, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [11 x i8] c"strdup: %s\00"
@errno = global i32 0
define noalias i8* @cli_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i32 @strerror(i32 %5)
%7 = tail call i32 @fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %4, %1
ret i8* %2
}
float psi(x, sigma)
float x, sigma;
{
  float result;
  result = (2.0 * x) / ((2.0 * sigma * sigma) + (x * x));
  return (result);
}


x86 assembly (clang, -O0):
<psi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x18(%rbp)
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xeb7(%rip),%xmm1
mulsd  %xmm2,%xmm1
movss  -0x8(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movss  -0x4(%rbp),%xmm2
mulss  -0x4(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<psi>:
cvtsd2ss %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm0,%xmm2
addsd  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm1
movaps %xmm1,%xmm3
addsd  %xmm1,%xmm3
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
divsd  %xmm3,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @psi(double %0, double %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = fptrunc double %0 to float
%7 = fptrunc double %1 to float
store float %6, float* %3
store float %7, float* %4
%8 = load float, float* %3
%9 = fpext float %8 to double
%10 = fmul double 2.000000e+00, %9
%11 = load float, float* %4
%12 = fpext float %11 to double
%13 = fmul double 2.000000e+00, %12
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = load float, float* %3
%17 = load float, float* %3
%18 = fmul float %16, %17
%19 = fpext float %18 to double
%20 = call double @llvm.fmuladd.f64(double %13, double %15, double %19)
%21 = fdiv double %10, %20
%22 = fptrunc double %21 to float
store float %22, float* %5
%23 = load float, float* %5
ret float %23
}

LLVM IR (-O2):
define float @psi(double %0, double %1) {
%3 = fptrunc double %0 to float
%4 = fptrunc double %1 to float
%5 = fpext float %3 to double
%6 = fmul double %5, 2.000000e+00
%7 = fpext float %4 to double
%8 = fmul double %7, 2.000000e+00
%9 = fmul float %3, %3
%10 = fpext float %9 to double
%11 = tail call double @llvm.fmuladd.f64(double %8, double %7, double %10)
%12 = fdiv double %6, %11
%13 = fptrunc double %12 to float
ret float %13
}
char *bstrcpy(char *dst, const char *src) {
  while (*src) {
    *dst++ = *src++;
  }
  *dst = 0;
  return dst;
}


x86 assembly (clang, -O0):
<bstrcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1140 <bstrcpy+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    110c <bstrcpy+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bstrcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <bstrcpy+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <bstrcpy+0x10>
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define i8* @bstrcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %14
}
int neg(int n) { return -n; }


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

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

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

LLVM IR (-O2):
define i32 @neg(i32 %0) {
%2 = sub nsw i32 0, %0
ret i32 %2
}
int cmpf_void(const void *key1, const void *key2) { return (key1 != key2); }


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

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

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

LLVM IR (-O2):
define i32 @cmpf_void(i8* readnone %0, i8* readnone %1) {
%3 = icmp ne i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int intcmp(const void *this, const void *that) {
  double *thisint = (double *)this;
  double *thatint = (double *)that;
  return (*thisint > *thatint) - (*thisint < *thatint);
}


x86 assembly (clang, -O0):
<intcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
movsd  (%rcx),%xmm1
mov    -0x20(%rbp),%rcx
movsd  (%rcx),%xmm0
ucomisd %xmm1,%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcmp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @intcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to double*
store double* %8, double** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to double*
store double* %10, double** %6
%11 = load double*, double** %5
%12 = load double, double* %11
%13 = load double*, double** %6
%14 = load double, double* %13
%15 = fcmp ogt double %12, %14
%16 = zext i1 %15 to i32
%17 = load double*, double** %5
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = load double, double* %19
%21 = fcmp olt double %18, %20
%22 = zext i1 %21 to i32
%23 = sub nsw i32 %16, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @intcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
%8 = zext i1 %7 to i32
%9 = fcmp olt double %5, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn11() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn11");
  return result;
}


x86 assembly (clang, -O0):
<fn11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn11>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn11\00"
define i8* @fn11() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn11\00"
define i8* @fn11() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ capture_event(void *, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
uint8_t capture_read_adlib(uint16_t port, void *p) {
  capture_event(p, (3 << 8), 0, port);
  return 0xff;
}


x86 assembly (clang, -O0):
<capture_read_adlib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x300,%esi
xor    %edx,%edx
call   1030 <capture_event@plt>
mov    $0xff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<capture_read_adlib>:
push   %rax
mov    %edi,%ecx
mov    %rsi,%rdi
mov    $0x300,%esi
xor    %edx,%edx
call   1030 <capture_event@plt>
mov    $0xff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @capture_read_adlib(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @capture_event(i8* %5, i32 768, i32 0, i32 %6)
ret i32 255
}

LLVM IR (-O2):
define i32 @capture_read_adlib(i32 %0, i8* %1) {
%3 = tail call i32 @capture_event(i8* %1, i32 768, i32 0, i32 %0)
ret i32 255
}