xunge/DecIR huggingface dataset:
unsigned long insert_ram(unsigned long insn, long value, const char **errmsg) {
  if (value >= ((insn >> 21) & 0x1f))
    *errmsg = "index register in load range";
  return insn | ((value & 0x1f) << 16);
}


x86 assembly (clang, -O0):
<insert_ram>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x15,%rcx
and    $0x1f,%rcx
cmp    %rcx,%rax
jb     1137 <insert_ram+0x37>
mov    -0x18(%rbp),%rax
lea    0xecc(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_ram>:
mov    %rsi,%rax
mov    %edi,%ecx
shr    $0x15,%ecx
and    $0x1f,%ecx
cmp    %rsi,%rcx
ja     111a <insert_ram+0x1a>
lea    0xee9(%rip),%rcx
mov    %rcx,(%rdx)
and    $0x1f,%eax
shl    $0x10,%rax
or     %rdi,%rax
ret

LLVM IR (-O0):
@.str = [29 x i8] c"index register in load range\00"
define i64 @insert_ram(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = lshr i64 %8, 21
%10 = and i64 %9, 31
%11 = icmp uge i64 %7, %10
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load i8**, i8*** %6
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %13
br label %14
14: ; preds = %12, %3
%15 = load i64, i64* %4
%16 = load i64, i64* %5
%17 = and i64 %16, 31
%18 = shl i64 %17, 16
%19 = or i64 %15, %18
ret i64 %19
}

LLVM IR (-O2):
@.str = [29 x i8] c"index register in load range\00"
define i64 @insert_ram(i64 %0, i64 %1, i8** nocapture writeonly %2) {
%4 = lshr i64 %0, 21
%5 = and i64 %4, 31
%6 = icmp ugt i64 %5, %1
br i1 %6, label %8, label %7
7: ; preds = %3
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %3
%9 = shl i64 %1, 16
%10 = and i64 %9, 2031616
%11 = or i64 %10, %0
ret i64 %11
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *xstrdup(const char *str) {
  char *cpy = NULL;
  if (str != NULL) {
    cpy = (char *)malloc(strlen(str) + 1);
    if (cpy != NULL)
      strcpy(cpy, str);
  }
  return cpy;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1185 <xstrdup+0x55>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1180 <xstrdup+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1185 <xstrdup+0x55>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115f <xstrdup+0x2f>
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115f <xstrdup+0x2f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1161 <xstrdup+0x31>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %19
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
%9 = add nsw i64 %8, 1
%10 = call i64 @malloc(i64 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %6
%15 = load i8*, i8** %3
%16 = load i8*, i8** %2
%17 = call i32 @strcpy(i8* %15, i8* %16)
br label %18
18: ; preds = %14, %6
br label %19
19: ; preds = %18, %1
%20 = load i8*, i8** %3
ret i8* %20
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = add nsw i64 %4, 1
%6 = tail call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to i8*
%8 = icmp eq i64 %6, 0
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i32 @strcpy(i8* %7, i8* %0)
br label %11
11: ; preds = %3, %9, %1
%12 = phi i8* [ %7, %9 ], [ null, %3 ], [ null, %1 ]
ret i8* %12
}
/* Variables and functions */
int strcoll(char const *, char const *);
int mutt_strcoll(const char *a, const char *b) {
  return strcoll(a ? a : "", b ? b : "");
}


x86 assembly (clang, -O0):
<mutt_strcoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <mutt_strcoll+0x28>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1148 <mutt_strcoll+0x38>
lea    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1148 <mutt_strcoll+0x38>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1168 <mutt_strcoll+0x58>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1178 <mutt_strcoll+0x68>
lea    0xe91(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1178 <mutt_strcoll+0x68>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcoll@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutt_strcoll>:
test   %rdi,%rdi
lea    0xee6(%rip),%rax
cmove  %rax,%rdi
test   %rsi,%rsi
cmove  %rax,%rsi
jmp    1030 <strcoll@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @mutt_strcoll(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i8*, i8** %3
br label %10
9: ; preds = %2
br label %10
10: ; preds = %9, %7
%11 = phi i8* [ %8, %7 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %9 ]
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i8*, i8** %4
br label %17
16: ; preds = %10
br label %17
17: ; preds = %16, %14
%18 = phi i8* [ %15, %14 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %16 ]
%19 = call i32 @strcoll(i8* %11, i8* %18)
ret i32 %19
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @mutt_strcoll(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%5 = icmp eq i8* %1, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %1
%7 = tail call i32 @strcoll(i8* %4, i8* %6)
ret i32 %7
}
void I422AlphaToARGBRow_AVX2() {}


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

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

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

LLVM IR (-O2):
define void @I422AlphaToARGBRow_AVX2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void version() {
  puts("BUILT-IN SELF TEST PROGRAM  v1.03 - ");
  puts("Mar 15 2022");
  puts(" ");
  puts("15:15:41");
  puts("\n");
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"BUILT-IN SELF TEST PROGRAM v1.03 - \00"
@.str.1 = [12 x i8] c"Mar 15 2022\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [9 x i8] c"15:15:41\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @version() {
%1 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"BUILT-IN SELF TEST PROGRAM v1.03 - \00"
@.str.1 = [12 x i8] c"Mar 15 2022\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [9 x i8] c"15:15:41\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}
int checkCPU(void) {
  union w {
    int a;
    char b;
  } c;
  c.a = 1;
  return (1 == c.b);
}


x86 assembly (clang, -O0):
<checkCPU>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
movsbl -0x8(%rbp),%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.w = type { i32 }
define i32 @checkCPU() {
%1 = alloca %union.w
%2 = bitcast %union.w* %1 to i32*
store i32 1, i32* %2
%3 = bitcast %union.w* %1 to i8*
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 1, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @checkCPU() {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ strftime(char *, size_t, char const *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void util_getLocalTime(const char *fmt, char *buf, size_t len) {
  struct tm ltime;
  time_t t = time(NULL);
  localtime_r(&t, &ltime);
  strftime(buf, len, fmt, &ltime);
}


x86 assembly (clang, -O0):
<util_getLocalTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x24(%rbp)
lea    -0x24(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1050 <strftime@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_getLocalTime>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%r12
mov    %r12,%rsi
call   1030 <localtime_r@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1050 <strftime@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @util_getLocalTime(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.tm
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%9 = call i32 @time(i32* null)
store i32 %9, i32* %8
%10 = call i32 @localtime_r(i32* %8, %struct.tm* %7)
%11 = load i8*, i8** %5
%12 = load i64, i64* %6
%13 = load i8*, i8** %4
%14 = call i32 @strftime(i8* %11, i64 %12, i8* %13, %struct.tm* %7)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @util_getLocalTime(i8* %0, i8* %1, i64 %2) {
%4 = alloca %struct.tm
%5 = alloca i32
%6 = bitcast %struct.tm* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = tail call i32 @time(i32* null)
store i32 %8, i32* %5
%9 = call i32 @localtime_r(i32* %5, %struct.tm* %4)
%10 = call i32 @strftime(i8* %1, i64 %2, i8* %0, %struct.tm* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void zmodem_error(int status, int errnum, const char *message, ...) {
  if (status)
    exit(status);
}


x86 assembly (clang, -O0):
<zmodem_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1134 <zmodem_error+0x24>
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zmodem_error>:
test   %edi,%edi
jne    1115 <zmodem_error+0x5>
ret
push   %rax
call   1030 <exit@plt>

LLVM IR (-O0):
define void @zmodem_error(i32 %0, i32 %1, i8* %2, ...) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i32, i32* %4
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @zmodem_error(i32 %0, i32 %1, i8* nocapture readnone %2, ...) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @exit(i32 %0)
unreachable
7: ; preds = %3
ret void
}
/* Variables and functions */
bool gt_is_little_endian(void) {
  int x = 1;
  if (*(char *)&x == 1)
    return true;
  return false;
}


x86 assembly (clang, -O0):
<gt_is_little_endian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
cmp    $0x1,%eax
jne    1124 <gt_is_little_endian+0x24>
movl   $0x1,-0x4(%rbp)
jmp    112b <gt_is_little_endian+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gt_is_little_endian() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %1
br label %9
8: ; preds = %0
store i32 0, i32* %1
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @gt_is_little_endian() {
ret i32 1
}
int SDL_imageFilterAddByteToHalfMMX(unsigned char *Src1, unsigned char *Dest,
                                    unsigned int SrcLength, unsigned char C,
                                    unsigned char *Mask) {
  return (-1);
}


x86 assembly (clang, -O0):
<SDL_imageFilterAddByteToHalfMMX>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    %r8,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SDL_imageFilterAddByteToHalfMMX(i8* %0, i8* %1, i32 %2, i8 zeroext %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8 %3, i8* %9
store i8* %4, i8** %10
ret i32 -1
}

LLVM IR (-O2):
define i32 @SDL_imageFilterAddByteToHalfMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i8 zeroext %3, i8* nocapture readnone %4) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void pexit(char *message) {
  printf("%s\n", message);
  exit(1);
}


x86 assembly (clang, -O0):
<pexit>:
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):
<pexit>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @pexit(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
int example_bad_ptr(long i) {
  int *memory_at_address_i = (int *)i;
  return *memory_at_address_i;
}


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

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

LLVM IR (-O0):
define i32 @example_bad_ptr(i64 %0) {
%2 = alloca i64
%3 = alloca i32*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @example_bad_ptr(i64 %0) {
%2 = inttoptr i64 %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
int cmp_double_gt(const void *a, const void *b) {
  double a_ = *(double *)a;
  double b_ = *(double *)b;
  if (a_ > b_)
    return -1;
  if (a_ < b_)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp_double_gt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1142 <cmp_double_gt+0x42>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <cmp_double_gt+0x69>
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1162 <cmp_double_gt+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1169 <cmp_double_gt+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_double_gt>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
ucomisd %xmm1,%xmm0
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_double_gt(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp olt double %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
char *IEC_Config(char *);
char *GetTelnetKey() { return IEC_Config("s_telnetkey"); }


x86 assembly (clang, -O0):
<GetTelnetKey>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <IEC_Config@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"s_telnetkey\00"
define i8* @GetTelnetKey() {
%1 = call i8* @IEC_Config(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [12 x i8] c"s_telnetkey\00"
define i8* @GetTelnetKey() {
%1 = tail call i8* @IEC_Config(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ VIDEO_FAST_FORWARD;
int ioctl(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int videoFastForward(int fd, int nframes) {
  int ans;
  if ((ans = ioctl(fd, VIDEO_FAST_FORWARD, nframes)) < 0) {
    perror("VIDEO FAST FORWARD: ");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<videoFastForward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
call   1030 <ioctl@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    1166 <videoFastForward+0x46>
lea    0xeab(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <videoFastForward+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<videoFastForward>:
push   %rax
mov    %esi,%edx
mov    0x2ebe(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
js     113b <videoFastForward+0x1b>
pop    %rcx
ret
lea    0xebe(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@VIDEO_FAST_FORWARD = global i32 0
@.str = [21 x i8] c"VIDEO FAST FORWARD: \00"
define i32 @videoFastForward(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* @VIDEO_FAST_FORWARD
%9 = load i32, i32* %5
%10 = call i32 @ioctl(i32 %7, i32 %8, i32 %9)
store i32 %10, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %15
14: ; preds = %2
store i32 0, i32* %3
br label %15
15: ; preds = %14, %12
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@VIDEO_FAST_FORWARD = global i32 0
@.str = [21 x i8] c"VIDEO FAST FORWARD: \00"
define i32 @videoFastForward(i32 %0, i32 %1) {
%3 = load i32, i32* @VIDEO_FAST_FORWARD
%4 = tail call i32 @ioctl(i32 %0, i32 %3, i32 %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
void *dlsym(void *, char const *);
void *loadSymbol(void *handle, const char *symName) {
  if (handle != NULL) {
    return dlsym(handle, symName);
  } else {
    return NULL;
  }
}


x86 assembly (clang, -O0):
<loadSymbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1141 <loadSymbol+0x31>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <dlsym@plt>
mov    %rax,-0x8(%rbp)
jmp    1149 <loadSymbol+0x39>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadSymbol>:
test   %rdi,%rdi
je     111a <loadSymbol+0xa>
jmp    1030 <dlsym@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @loadSymbol(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i8* @dlsym(i8* %9, i8* %10)
store i8* %11, i8** %3
br label %13
12: ; preds = %2
store i8* null, i8** %3
br label %13
13: ; preds = %12, %8
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @loadSymbol(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i8* @dlsym(i8* %0, i8* %1)
br label %6
6: ; preds = %2, %4
%7 = phi i8* [ %5, %4 ], [ null, %2 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ init_pair(int, int, int);
void define_colors(void) {
  for (int i = 1; i <= 10; ++i) {
    init_pair(i, i, -1);
  }
}


x86 assembly (clang, -O0):
<define_colors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jg     1147 <define_colors+0x37>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <define_colors+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<define_colors>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x2,%edi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x4,%edi
mov    $0x4,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x5,%edi
mov    $0x5,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x6,%edi
mov    $0x6,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x7,%edi
mov    $0x7,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x8,%edi
mov    $0x8,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0x9,%edi
mov    $0x9,%esi
mov    $0xffffffff,%edx
call   1030 <init_pair@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    $0xffffffff,%edx
pop    %rax
jmp    1030 <init_pair@plt>

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

LLVM IR (-O2):
define void @define_colors() {
%1 = tail call i32 @init_pair(i32 1, i32 1, i32 -1)
%2 = tail call i32 @init_pair(i32 2, i32 2, i32 -1)
%3 = tail call i32 @init_pair(i32 3, i32 3, i32 -1)
%4 = tail call i32 @init_pair(i32 4, i32 4, i32 -1)
%5 = tail call i32 @init_pair(i32 5, i32 5, i32 -1)
%6 = tail call i32 @init_pair(i32 6, i32 6, i32 -1)
%7 = tail call i32 @init_pair(i32 7, i32 7, i32 -1)
%8 = tail call i32 @init_pair(i32 8, i32 8, i32 -1)
%9 = tail call i32 @init_pair(i32 9, i32 9, i32 -1)
%10 = tail call i32 @init_pair(i32 10, i32 10, i32 -1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void xperror(char *str) {
  perror(str);
  exit(1);
}


x86 assembly (clang, -O0):
<xperror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<xperror>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @xperror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @xperror(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
int multipleBy19(int inputNum) {
  int result = inputNum % 19;
  if (result == 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<multipleBy19>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x13,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    112b <multipleBy19+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1132 <multipleBy19+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<multipleBy19>:
imul   $0x286bca1b,%edi,%ecx
add    $0x6bca1af,%ecx
xor    %eax,%eax
cmp    $0xd79435f,%ecx
setb   %al
ret

LLVM IR (-O0):
define i32 @multipleBy19(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = srem i32 %5, 19
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 1, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @multipleBy19(i32 %0) {
%2 = srem i32 %0, 19
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void fun(int i, int *a) {
  i = 234;
  a[i] = 12123;
  i = 290;
  a[i] = 12123;
  i = 236;
  a[i] = 12123;
  i = 228;
  a[i] = 12123;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xea,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movl   $0x2f5b,(%rax,%rcx,4)
movl   $0x122,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movl   $0x2f5b,(%rax,%rcx,4)
movl   $0xec,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movl   $0x2f5b,(%rax,%rcx,4)
movl   $0xe4,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movl   $0x2f5b,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
movl   $0x2f5b,0x3a8(%rsi)
movl   $0x2f5b,0x488(%rsi)
movl   $0x2f5b,0x3b0(%rsi)
movl   $0x2f5b,0x390(%rsi)
ret

LLVM IR (-O0):
define void @fun(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32 234, i32* %3
%5 = load i32*, i32** %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
store i32 12123, i32* %8
store i32 290, i32* %3
%9 = load i32*, i32** %4
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
store i32 12123, i32* %12
store i32 236, i32* %3
%13 = load i32*, i32** %4
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
store i32 12123, i32* %16
store i32 228, i32* %3
%17 = load i32*, i32** %4
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 12123, i32* %20
ret void
}

LLVM IR (-O2):
define void @fun(i32 %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i32, i32* %1, i64 234
store i32 12123, i32* %3
%4 = getelementptr inbounds i32, i32* %1, i64 290
store i32 12123, i32* %4
%5 = getelementptr inbounds i32, i32* %1, i64 236
store i32 12123, i32* %5
%6 = getelementptr inbounds i32, i32* %1, i64 228
store i32 12123, i32* %6
ret void
}
void __attribute__((no)) HEX00_subexesInit(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @HEX00_subexesInit() {
ret void
}
char *skip_initial_spaces(char *sptr) {
  while ((*sptr == ' ') || (*sptr == '\t')) {
    sptr++;
  }
  return sptr;
}


x86 assembly (clang, -O0):
<skip_initial_spaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     112d <skip_initial_spaces+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <skip_initial_spaces+0x3d>
jmp    114e <skip_initial_spaces+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip_initial_spaces+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_initial_spaces>:
mov    %rdi,%rax
jmp    1114 <skip_initial_spaces+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <skip_initial_spaces+0x10>
cmp    $0x9,%cl
je     1110 <skip_initial_spaces+0x10>
ret

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

LLVM IR (-O2):
define i8* @skip_initial_spaces(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void const *, int);
char *mongo_data_append(char *start, const void *data, int len) {
  memcpy(start, data, len);
  return start + len;
}


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

x86 assembly (clang, -O2):
<mongo_data_append>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rdi,%r14
call   1030 <memcpy@plt>
movslq %ebx,%rax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @mongo_data_append(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @memcpy(i8* %0, i8* %1, i32 %2)
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ arrels_legendre(int, int, int);
int main() {
  int i;
  arrels_legendre(9, 1e-14, 15);
  arrels_legendre(8, 1e-14, 15);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
xor    %esi,%esi
mov    $0xf,%edx
call   1030 <arrels_legendre@plt>
mov    $0x8,%edi
xor    %esi,%esi
mov    $0xf,%edx
call   1030 <arrels_legendre@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @arrels_legendre(i32 9, i32 0, i32 15)
%4 = call i32 @arrels_legendre(i32 8, i32 0, i32 15)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @arrels_legendre(i32 9, i32 0, i32 15)
%2 = tail call i32 @arrels_legendre(i32 8, i32 0, i32 15)
ret i32 0
}
void removeBlanks(char *string) {
  char *inPtr, *outPtr;
  inPtr = string;
  outPtr = string;
  for (; *inPtr != '\0';) {
    if (*inPtr != ' ')
      *(outPtr++) = *(inPtr++);
    else
      inPtr++;
  }
  *outPtr = '\0';
}


x86 assembly (clang, -O0):
<removeBlanks>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1170 <removeBlanks+0x70>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     115f <removeBlanks+0x5f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    116b <removeBlanks+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <removeBlanks+0x18>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeBlanks>:
mov    %rdi,%rax
jmp    1114 <removeBlanks+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x20,%cl
je     1110 <removeBlanks+0x10>
test   %cl,%cl
je     1128 <removeBlanks+0x28>
mov    %cl,(%rax)
add    $0x1,%rax
jmp    1110 <removeBlanks+0x10>
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define void @removeBlanks(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i8* [ %0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 0, label %11
i8 32, label %8
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %5, i8* %4
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
store i8 0, i8* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: link file1 file2\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"usage: link file1 file2\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"usage: link file1 file2\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
struct slRef {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ refAdd(struct slRef **, void *);
void addRefWithContext(void *item, void *context) {
  struct slRef **pList = context;
  refAdd(pList, item);
}


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

x86 assembly (clang, -O2):
<addRefWithContext>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <refAdd@plt>

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

LLVM IR (-O2):
%struct.slRef = type { i32 }
define void @addRefWithContext(i8* %0, i8* %1) {
%3 = bitcast i8* %1 to %struct.slRef**
%4 = tail call i32 @refAdd(%struct.slRef** %3, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die(char *, size_t);
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *ret = malloc(size);
  if (!ret)
    die("OOM when allocating %ul bytes\n", size);
  return ret;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <xmalloc+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <xmalloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <die@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"OOM when allocating %ul bytes\0A\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i64, i64* %2
%10 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %9)
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [31 x i8] c"OOM when allocating %ul bytes\0A\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
int main() {
  int x;
  x = 0;
  x += 2;
  x += 2;
  if (x != 4)
    return 1;
  x -= 3;
  if (x != 1)
    return 2;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     113a <main+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1160 <main+0x60>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     1159 <main+0x59>
movl   $0x2,-0x4(%rbp)
jmp    1160 <main+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t bytes) {
  void *ptr;
  if ((ptr = malloc(bytes)) == NULL) {
    fprintf(stderr, "malloc failed to get %lu bytes.\n", bytes);
    exit(1);
  }
  return (ptr);
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1176 <xmalloc+0x46>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe99(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"malloc failed to get %lu bytes.\0A\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = load i64, i64* %2
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"malloc failed to get %lu bytes.\0A\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
void s5pv310_default_sdhci1(void) {}


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

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

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

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