xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
void *malloc(size_t);
void *realloc(void *, size_t);
void *allocate(void *mem, size_t size) {
  if ((mem = mem == 0 ? malloc(size) : realloc(mem, size)) == 0)
    fatal("malloc()");
  return mem;
}


x86 assembly (clang, -O0):
<allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115d <allocate+0x2d>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
jmp    116e <allocate+0x3e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    118c <allocate+0x5c>
lea    0xe79(%rip),%rdi
call   1050 <fatal@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate>:
push   %rbx
test   %rdi,%rdi
je     113d <allocate+0xd>
call   1040 <realloc@plt>
jmp    1145 <allocate+0x15>
mov    %rsi,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1159 <allocate+0x29>
lea    0xeac(%rip),%rdi
call   1050 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"malloc()\00"
define i8* @allocate(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @malloc(i64 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i64 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
ret i8* %9
}
/* Type definitions */
struct user {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct user *);
void user_free(struct user *u) { free(u); }


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

x86 assembly (clang, -O2):
<user_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.user = type { i32 }
define void @user_free(%struct.user* %0) {
%2 = alloca %struct.user*
store %struct.user* %0, %struct.user** %2
%3 = load %struct.user*, %struct.user** %2
%4 = call i32 @free(%struct.user* %3)
ret void
}

LLVM IR (-O2):
%struct.user = type { i32 }
define void @user_free(%struct.user* nocapture %0) {
%2 = tail call i32 @free(%struct.user* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprint_octet_string(int /*<<< orphan*/ *, unsigned char *,
                                       unsigned char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void fprint_invalid(FILE *f, unsigned char *p, unsigned char *e) {
  fprintf(f, "(invalid ");
  fprint_octet_string(f, p, e);
  fprintf(f, ")");
}


x86 assembly (clang, -O0):
<fprint_invalid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <fprint_octet_string@plt>
mov    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_invalid>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xebb(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <fprint_octet_string@plt>
mov    $0x29,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"(invalid \00"
@.str.1 = [2 x i8] c")\00"
define void @fprint_invalid(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @fprint_octet_string(i32* %9, i8* %10, i8* %11)
%13 = load i32*, i32** %4
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"(invalid \00"
define void @fprint_invalid(i32* %0, i8* %1, i8* %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 9, i64 1, i32* %0)
%5 = tail call i32 @fprint_octet_string(i32* %0, i8* %1, i8* %2)
%6 = tail call i32 @fputc(i32 41, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int /*<<< orphan*/ errno;
int execve(const char *name, char *const *argv, char *const *env) {
  errno = ENOMEM;
  return -1;
}


x86 assembly (clang, -O0):
<execve>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<execve>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i32, i32* @ENOMEM
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @execve(i8* nocapture readnone %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = load i32, i32* @ENOMEM
store i32 %4, i32* @errno
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ time_internal_set(struct tm *);
int /*<<< orphan*/ time_set_nvrram(int /*<<< orphan*/ *, struct tm *);
void time_internal_sync(uint8_t *nvrram) {
  struct tm *cur_time_tm;
  time_t cur_time;
  time(&cur_time);
  cur_time_tm = localtime(&cur_time);
  time_internal_set(cur_time_tm);
  time_set_nvrram(nvrram, cur_time_tm);
}


x86 assembly (clang, -O0):
<time_internal_sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <time_internal_set@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <time_set_nvrram@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_internal_sync>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <time_internal_set@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <time_set_nvrram@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @time_internal_sync(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.tm*
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 @time(i32* %4)
%6 = call %struct.tm* @localtime(i32* %4)
store %struct.tm* %6, %struct.tm** %3
%7 = load %struct.tm*, %struct.tm** %3
%8 = call i32 @time_internal_set(%struct.tm* %7)
%9 = load i32*, i32** %2
%10 = load %struct.tm*, %struct.tm** %3
%11 = call i32 @time_set_nvrram(i32* %9, %struct.tm* %10)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @time_internal_sync(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @time(i32* %2)
%5 = call %struct.tm* @localtime(i32* %2)
%6 = call i32 @time_internal_set(%struct.tm* %5)
%7 = call i32 @time_set_nvrram(i32* %0, %struct.tm* %5)
ret void
}
int encrypt_block(int keytype, const unsigned char *IV,
                  const unsigned char *key, const unsigned char *aad,
                  unsigned int aadlen, const unsigned char *src,
                  unsigned int srclen, unsigned char *dest,
                  unsigned int *destlen) {
  return 0;
}


x86 assembly (clang, -O0):
<encrypt_block>:
push   %rbp
mov    %rsp,%rbp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @encrypt_block(i32 %0, i8* %1, i8* %2, i8* %3, i32 %4, i8* %5, i32 %6, i8* %7, i32* %8) {
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32*
store i32 %0, i32* %10
store i8* %1, i8** %11
store i8* %2, i8** %12
store i8* %3, i8** %13
store i32 %4, i32* %14
store i8* %5, i8** %15
store i32 %6, i32* %16
store i8* %7, i8** %17
store i32* %8, i32** %18
ret i32 0
}

LLVM IR (-O2):
define i32 @encrypt_block(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i32 %4, i8* nocapture readnone %5, i32 %6, i8* nocapture readnone %7, i32* nocapture readnone %8) {
ret i32 0
}
/* Variables and functions */
int core3_swap(char *, int);
int U_EMRSETICMMODE_swap(char *record, int torev) {
  return (core3_swap(record, torev));
}


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

x86 assembly (clang, -O2):
<U_EMRSETICMMODE_swap>:
jmp    1030 <core3_swap@plt>

LLVM IR (-O0):
define i32 @U_EMRSETICMMODE_swap(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 = call i32 @core3_swap(i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @U_EMRSETICMMODE_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core3_swap(i8* %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ *__m128;

/* Variables and functions */
__m128 __attribute__((__always___, __nodebug__))
_mm_sub_ss(__m128 a, __m128 b) {
  a[0] -= b[0];
  return a;
}


x86 assembly (clang, -O0):
<_mm_sub_ss>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
sub    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm_sub_ss>:
mov    %rdi,%rax
mov    (%rsi),%rcx
sub    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i64* @_mm_sub_ss(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
store i64* %0, i64** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = getelementptr inbounds i64, i64* %5, i64 0
%7 = load i64, i64* %6
%8 = load i64*, i64** %3
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = sub nsw i64 %10, %7
store i64 %11, i64* %9
%12 = load i64*, i64** %3
ret i64* %12
}

LLVM IR (-O2):
define i64* @_mm_sub_ss(i64* returned %0, i64* nocapture %1) {
%3 = load i64, i64* %1
%4 = load i64, i64* %0
%5 = sub nsw i64 %4, %3
store i64 %5, i64* %0
ret i64* %0
}
/* Variables and functions */
void *realloc(void *, size_t);
void *qe_realloc(void *pp, size_t size) {
  void *p = realloc(*(void **)pp, size);
  if (p || !size)
    *(void **)pp = p;
  return p;
}


x86 assembly (clang, -O0):
<qe_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114a <qe_realloc+0x3a>
cmpq   $0x0,-0x10(%rbp)
jne    1155 <qe_realloc+0x45>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qe_realloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rdi
call   1030 <realloc@plt>
test   %rbx,%rbx
je     112c <qe_realloc+0x1c>
test   %rax,%rax
je     112f <qe_realloc+0x1f>
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @qe_realloc(i8* nocapture %0, i64 %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = tail call i8* @realloc(i8* %4, i64 %1)
%6 = icmp eq i8* %5, null
%7 = icmp ne i64 %1, 0
%8 = and i1 %7, %6
br i1 %8, label %10, label %9
9: ; preds = %2
store i8* %5, i8** %3
br label %10
10: ; preds = %2, %9
ret i8* %5
}
/* Type definitions */
struct ibuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ibuf_addchar(struct ibuf *, char const);
int strlen(char const *);
void ibuf_add(struct ibuf *s, const char *d) {
  int length = strlen(d), i;
  for (i = 0; i < length; i++)
    ibuf_addchar(s, d[i]);
}


x86 assembly (clang, -O0):
<ibuf_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1172 <ibuf_add+0x52>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1040 <ibuf_addchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <ibuf_add+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ibuf_add>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1156 <ibuf_add+0x36>
mov    %eax,%r12d
xor    %ebx,%ebx
nop
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <ibuf_addchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <ibuf_add+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.ibuf = type { i32 }
define void @ibuf_add(%struct.ibuf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @ibuf_addchar(%struct.ibuf* %0, i8 signext %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %2
ret void
}
char computeCheckCode(char *s) {
  char code = 0;
  while (*s)
    code ^= *s++;
  return *(--s) + code;
}


x86 assembly (clang, -O0):
<computeCheckCode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1139 <computeCheckCode+0x39>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
movsbl -0x9(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x9(%rbp)
jmp    110c <computeCheckCode+0xc>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x8(%rbp)
movsbl -0x1(%rax),%eax
movsbl -0x9(%rbp),%ecx
add    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @computeCheckCode(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = zext i8 %5 to i32
%10 = xor i32 %6, %9
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = trunc i32 %10 to i8
br label %15
15: ; preds = %13, %1
%16 = phi i8* [ %0, %1 ], [ %8, %13 ]
%17 = phi i8 [ 0, %1 ], [ %14, %13 ]
%18 = getelementptr inbounds i8, i8* %16, i64 -1
%19 = load i8, i8* %18
%20 = add i8 %19, %17
ret i8 %20
}
void test_isgraph_macro(void) {
  int i, j;
  for (i = -127; i < 256;)
    j = i, printf("%s: %d -> %d\n", __FUNCTION__, j, isgraph(i++) ? 1 : 0);
}


x86 assembly (clang, -O0):
<test_isgraph_macro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffff81,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1184 <test_isgraph_macro+0x64>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
call   1040 <isgraph@plt>
mov    -0xc(%rbp),%edx
mov    %eax,%esi
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0x0,%esi
cmovne %eax,%ecx
lea    0xe8f(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <test_isgraph_macro+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isgraph_macro>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffff81,%ebx
lea    0xecd(%rip),%r14
lea    0xed4(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%ebp
mov    %ebx,%edi
call   1040 <isgraph@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%ebx
cmp    $0x100,%ebp
jne    1140 <test_isgraph_macro+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isgraph_macro = [19 x i8] c"test_isgraph_macro\00"
define void @test_isgraph_macro() {
%1 = alloca i32
%2 = alloca i32
store i32 -127, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = call i32 @isgraph(i32 %9)
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_isgraph_macro, i64 0, i64 0), i32 %8, i32 %14)
br label %3
16: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isgraph_macro = [19 x i8] c"test_isgraph_macro\00"
define void @test_isgraph_macro() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ -127, %0 ], [ %3, %1 ]
%3 = add nsw i32 %2, 1
%4 = tail call i32 @isgraph(i32 %2)
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_isgraph_macro, i64 0, i64 0), i32 %2, i32 %6)
%8 = icmp eq i32 %3, 256
br i1 %8, label %9, label %1
9: ; preds = %1
ret void
}
void Dummy_Handler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Dummy_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Dummy_Handler+0x9>
jmp    1109 <Dummy_Handler+0x9>

x86 assembly (clang, -O2):
<Dummy_Handler>:
jmp    1100 <Dummy_Handler>

LLVM IR (-O0):
define void @Dummy_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Dummy_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
struct ship {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Write(int, struct ship *, long, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
void send_struck(struct ship *ship, long a) { Write(26, ship, a, 0, 0, 0); }


x86 assembly (clang, -O0):
<send_struck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x1a,%edi
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <Write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_struck>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x1a,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <Write@plt>

LLVM IR (-O0):
%struct.ship = type { i32 }
define void @send_struck(%struct.ship* %0, i64 %1) {
%3 = alloca %struct.ship*
%4 = alloca i64
store %struct.ship* %0, %struct.ship** %3
store i64 %1, i64* %4
%5 = load %struct.ship*, %struct.ship** %3
%6 = load i64, i64* %4
%7 = call i32 @Write(i32 26, %struct.ship* %5, i64 %6, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
%struct.ship = type { i32 }
define void @send_struck(%struct.ship* %0, i64 %1) {
%3 = tail call i32 @Write(i32 26, %struct.ship* %0, i64 %1, i32 0, i32 0, i32 0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool errata_15() {
  if (*(uint32_t *)0x00FF0130 == 0x9ul) {
    if (*(uint32_t *)0x00FF0134 == 0x02ul) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<errata_15>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff0130,%eax
movslq (%rax),%rax
cmp    $0x9,%rax
jne    1139 <errata_15+0x39>
mov    $0xff0134,%eax
movslq (%rax),%rax
cmp    $0x2,%rax
jne    1134 <errata_15+0x34>
movl   $0x1,-0x4(%rbp)
jmp    1140 <errata_15+0x40>
jmp    1139 <errata_15+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<errata_15>:
cmpl   $0x9,0xff0130
09
jne    1119 <errata_15+0x19>
mov    $0x1,%eax
cmpl   $0x2,0xff0134
02
je     111b <errata_15+0x1b>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @errata_15() {
%1 = alloca i32
%2 = load i32, i32* inttoptr (i64 16711984 to i32*)
%3 = sext i32 %2 to i64
%4 = icmp eq i64 %3, 9
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = load i32, i32* inttoptr (i64 16711988 to i32*)
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 1, i32* %1
br label %12
10: ; preds = %5
br label %11
11: ; preds = %10, %0
store i32 0, i32* %1
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @errata_15() {
%1 = load i32, i32* inttoptr (i64 16711984 to i32*)
%2 = icmp eq i32 %1, 9
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* inttoptr (i64 16711988 to i32*)
%5 = icmp eq i32 %4, 2
br i1 %5, label %7, label %6
6: ; preds = %3, %0
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %8
}
int Mx1_is_bold_wrap(struct Mx1 *m, char *start, char **found, int flag) {
  int ret;
  static char bold_wraps[][20] = {"@b{",      "@dfn{",     "@emph{",
                                  "@strong{", "@command{", ""};
  ret = Mx1_is_wrap(m, bold_wraps, start, found, 0);
  return (ret);
}


x86 assembly (clang, -O0):
<Mx1_is_bold_wrap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0x2ef6(%rip),%rsi
xor    %r8d,%r8d
mov    $0x0,%al
call   1030 <Mx1_is_wrap@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mx1_is_bold_wrap>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0x2f13(%rip),%rsi
xor    %r8d,%r8d
xor    %eax,%eax
jmp    1030 <Mx1_is_wrap@plt>

LLVM IR (-O0):
%struct.Mx1 = type opaque
@Mx1_is_bold_wrap.bold_wraps = internal global [6 x [20 x i8]] [[20 x i8] c"@b{\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@dfn{\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@emph{\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@strong{\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@command{\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] zeroinitializer]
define i32 @Mx1_is_bold_wrap(%struct.Mx1* %0, i8* %1, i8** %2, i32 %3) {
%5 = alloca %struct.Mx1*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
store %struct.Mx1* %0, %struct.Mx1** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%10 = load %struct.Mx1*, %struct.Mx1** %5
%11 = load i8*, i8** %6
%12 = load i8**, i8*** %7
%13 = call i32 (%struct.Mx1*, [20 x i8]*, i8*, i8**, i32, ...) bitcast (i32 (...)* @Mx1_is_wrap to i32 (%struct.Mx1*, [20 x i8]*, i8*, i8**, i32, ...)*)(%struct.Mx1* %10, [20 x i8]* getelementptr inbounds ([6 x [20 x i8]], [6 x [20 x i8]]* @Mx1_is_bold_wrap.bold_wraps, i64 0, i64 0), i8* %11, i8** %12, i32 0)
store i32 %13, i32* %9
%14 = load i32, i32* %9
ret i32 %14
}

LLVM IR (-O2):
%struct.Mx1 = type opaque
@Mx1_is_bold_wrap.bold_wraps = internal global [6 x [20 x i8]] [[20 x i8] c"@b{\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@dfn{\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@emph{\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@strong{\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"@command{\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] zeroinitializer]
define i32 @Mx1_is_bold_wrap(%struct.Mx1* %0, i8* %1, i8** %2, i32 %3) {
%5 = tail call i32 (%struct.Mx1*, [20 x i8]*, i8*, i8**, i32, ...) bitcast (i32 (...)* @Mx1_is_wrap to i32 (%struct.Mx1*, [20 x i8]*, i8*, i8**, i32, ...)*)(%struct.Mx1* %0, [20 x i8]* getelementptr inbounds ([6 x [20 x i8]], [6 x [20 x i8]]* @Mx1_is_bold_wrap.bold_wraps, i64 0, i64 0), i8* %1, i8** %2, i32 0)
ret i32 %5
}
void joystick_standard_write(void *p) {}


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

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

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

LLVM IR (-O2):
define void @joystick_standard_write(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int mygetline(char *, int);
int /*<<< orphan*/ print_reverse(char *, int);
int main() {
  int len;
  char line[1000];
  while ((len = mygetline(line, 1000)) > 0) {
    print_reverse(line, len);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <mygetline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1163 <main+0x43>
lea    -0x3f0(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <print_reverse@plt>
jmp    1132 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1030 <mygetline@plt>
test   %eax,%eax
jle    115b <main+0x3b>
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <print_reverse@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <mygetline@plt>
test   %eax,%eax
jg     1140 <main+0x20>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i8]
store i32 0, i32* %1
br label %4
4: ; preds = %8, %0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = call i32 @mygetline(i8* %5, i32 1000)
store i32 %6, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = call i32 @print_reverse(i8* %9, i32 %10)
br label %4
12: ; preds = %4
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @mygetline(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ %3, %0 ]
%7 = call i32 @print_reverse(i8* %2, i32 %6)
%8 = call i32 @mygetline(i8* %2, i32 1000)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dispatcher_run();
void os_run() { dispatcher_run(); }


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

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

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

LLVM IR (-O2):
define void @os_run() {
%1 = tail call i32 (...) @dispatcher_run()
ret void
}
int compare_int(const void *int1, const void *int2) {
  if (*(const int *)int1 > *(const int *)int2)
    return 1;
  if (*(const int *)int1 < *(const int *)int2)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<compare_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    112a <compare_int+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    114f <compare_int+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1148 <compare_int+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    114f <compare_int+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @compare_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
void makeStr(char aChar, char aStr[2]) {
  aStr[0] = aChar;
  aStr[1] = '\0';
}


x86 assembly (clang, -O0):
<makeStr>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeStr>:
mov    %dil,(%rsi)
movb   $0x0,0x1(%rsi)
ret

LLVM IR (-O0):
define void @makeStr(i8 signext %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 = getelementptr inbounds i8, i8* %6, i64 0
store i8 %5, i8* %7
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 0, i8* %9
ret void
}

LLVM IR (-O2):
define void @makeStr(i8 signext %0, i8* nocapture writeonly %1) {
store i8 %0, i8* %1
%3 = getelementptr inbounds i8, i8* %1, i64 1
store i8 0, i8* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ perror(char *);
int execute(char *arglist[]) {
  execvp(arglist[0], arglist);
  perror("execvp() failed");
}


x86 assembly (clang, -O0):
<execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <execvp@plt>
lea    0xebd(%rip),%rdi
call   1030 <perror@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute>:
push   %rax
mov    %rdi,%rsi
mov    (%rdi),%rdi
call   1040 <execvp@plt>
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <perror@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"execvp() failed\00"
define i32 @execute(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = load i8**, i8*** %3
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = load i8**, i8*** %3
%8 = call i32 @execvp(i8* %6, i8** %7)
%9 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [16 x i8] c"execvp() failed\00"
define i32 @execute(i8** %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @execvp(i8* %2, i8** %0)
%4 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
double fabs(double);
double qFabs(double a) { return fabs(a); }


x86 assembly (clang, -O0):
<qFabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<qFabs>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @qFabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fabs.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @qFabs(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
ret double %2
}
__typeof__(strcat(1, "")) test_strcat_146(void) { return strcat(1, ""); }


x86 assembly (clang, -O0):
<test_strcat_146>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
call   1030 <strcat@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @test_strcat_146() {
%1 = call i8* @strcat(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
define i8* @test_strcat_146() {
ret i8* inttoptr (i64 1 to i8*)
}
OP(fd, cd) { op_cd(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_cd()
ret i32 undef
}
int foo(int p) {
  int i;
  i = 10;
  if (p == i) {
  ERROR:
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    112b <foo+0x2b>
jmp    111f <foo+0x1f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1132 <foo+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
cmp    $0xa,%edi
sete   %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 10, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %1
br label %9
9: ; preds = %8
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 @foo(i32 %0) {
%2 = icmp eq i32 %0, 10
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ h_puts(char const *);
int /*<<< orphan*/ h_td_end();
int /*<<< orphan*/ h_td_start(char const *, int);
int /*<<< orphan*/ stdout;
void h_td_str(const char *str, const char *class, int colspan) {
  h_td_start(class, colspan);
  if (str)
    h_puts(str);
  else
    fputs("&nbsp;", stdout);
  h_td_end();
}


x86 assembly (clang, -O0):
<h_td_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <h_td_start@plt>
cmpq   $0x0,-0x8(%rbp)
je     1178 <h_td_str+0x38>
mov    -0x8(%rbp),%rdi
call   1030 <h_puts@plt>
jmp    118d <h_td_str+0x4d>
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
lea    0xe78(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x0,%al
call   1050 <h_td_end@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h_td_str>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %edx,%esi
call   1040 <h_td_start@plt>
test   %rbx,%rbx
je     115d <h_td_str+0x1d>
mov    %rbx,%rdi
call   1030 <h_puts@plt>
jmp    1172 <h_td_str+0x32>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
lea    0xe93(%rip),%rdi
call   1060 <fputs@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <h_td_end@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"&nbsp;\00"
@stdout = global i32 0
define void @h_td_str(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** %5
%8 = load i32, i32* %6
%9 = call i32 @h_td_start(i8* %7, i32 %8)
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = call i32 @h_puts(i8* %13)
br label %18
15: ; preds = %3
%16 = load i32, i32* @stdout
%17 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %12
%19 = call i32 (...) @h_td_end()
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"&nbsp;\00"
@stdout = global i32 0
define void @h_td_str(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @h_td_start(i8* %1, i32 %2)
%5 = icmp eq i8* %0, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @h_puts(i8* %0)
br label %11
8: ; preds = %3
%9 = load i32, i32* @stdout
%10 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %6
%12 = tail call i32 (...) @h_td_end()
ret void
}
/* Variables and functions */
char spi_read(int);
char pfio_read_output(void) { return spi_read(0x12); }


x86 assembly (clang, -O0):
<pfio_read_output>:
push   %rbp
mov    %rsp,%rbp
mov    $0x12,%edi
call   1030 <spi_read@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfio_read_output>:
mov    $0x12,%edi
jmp    1030 <spi_read@plt>

LLVM IR (-O0):
define signext i8 @pfio_read_output() {
%1 = call signext i8 @spi_read(i32 18)
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @pfio_read_output() {
%1 = tail call signext i8 @spi_read(i32 18)
ret i8 %1
}
char char_fetch_nand_seq_cst(char *ptr, int value) {
  return __atomic_fetch_nand(ptr, value, 5);
}


x86 assembly (clang, -O0):
<char_fetch_nand_seq_cst>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    %cl,-0xd(%rbp)
mov    -0xd(%rbp),%cl
mov    %cl,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0xf(%rbp)
mov    -0xf(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%sil
mov    %al,%dl
and    %sil,%dl
mov    %dl,-0x1a(%rbp)
not    %dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xf(%rbp)
jne    1154 <char_fetch_nand_seq_cst+0x54>
jmp    1124 <char_fetch_nand_seq_cst+0x24>
mov    -0x19(%rbp),%al
mov    %al,-0xe(%rbp)
movsbl -0xe(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_fetch_nand_seq_cst>:
mov    (%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
and    %sil,%cl
not    %cl
lock cmpxchg %cl,(%rdi)
jne    1110 <char_fetch_nand_seq_cst+0x10>
ret

LLVM IR (-O0):
define signext i8 @char_fetch_nand_seq_cst(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i8
store i8 %9, i8* %5
%10 = load i8, i8* %5
%11 = atomicrmw nand i8* %7, i8 %10 seq_cst
store i8 %11, i8* %6
%12 = load i8, i8* %6
ret i8 %12
}

LLVM IR (-O2):
define signext i8 @char_fetch_nand_seq_cst(i8* nocapture %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = atomicrmw nand i8* %0, i8 %3 seq_cst
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr,
          "\nusage: prcompress [options] <mcifile>\n\n"
          "  options:\n"
          "\t-o <filename>: output file (default: mcifile with .pr.cuf)\n"
          "\t-d: dump dot file to stdout\n"
          "\t-v: print statistics\n\n");
  exit(1);
}


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    $0x1,%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    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [164 x i8] c"\0Ausage: prcompress [options] <mcifile>\0A\0A options:\0A\09-o <filename>: output file (default: mcifile with .pr.cuf)\0A\09-d: dump dot file to stdout\0A\09-v: print statistics\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [164 x i8] c"\0Ausage: prcompress [options] <mcifile>\0A\0A options:\0A\09-o <filename>: output file (default: mcifile with .pr.cuf)\0A\09-d: dump dot file to stdout\0A\09-v: print statistics\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int sys_arec(unsigned int p1) {
  int a;
  asm volatile("int $0x80" : "=a"(a) : "0"(4), "b"((int)p1));
  return a;
}


x86 assembly (clang, -O0):
<sys_arec>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ebx
mov    $0x4,%eax
int    $0x80
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_arec>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%eax
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sys_arec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 asm sideeffect "int $$0x80", "={ax},0,{bx},~{dirflag},~{fpsr},~{flags}"(i32 4, i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @sys_arec(i32 %0) {
%2 = tail call i32 asm sideeffect "int $$0x80", "={ax},0,{bx},~{dirflag},~{fpsr},~{flags}"(i32 4, i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __NR_getcpu;
int syscall(int /*<<< orphan*/, unsigned int *, unsigned int *,
            int /*<<< orphan*/);
int getcpu(unsigned *cpu, unsigned *node) {
  return syscall(__NR_getcpu, cpu, node, 0);
}


x86 assembly (clang, -O0):
<getcpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcpu>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
xor    %ecx,%ecx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_getcpu = global i32 0
define i32 @getcpu(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @__NR_getcpu
%6 = load i32*, i32** %3
%7 = load i32*, i32** %4
%8 = call i32 @syscall(i32 %5, i32* %6, i32* %7, i32 0)
ret i32 %8
}

LLVM IR (-O2):
@__NR_getcpu = global i32 0
define i32 @getcpu(i32* %0, i32* %1) {
%3 = load i32, i32* @__NR_getcpu
%4 = tail call i32 @syscall(i32 %3, i32* %0, i32* %1, i32 0)
ret i32 %4
}
/* Variables and functions */
int rename(char *, char *);
int LispRename(char *from, char *to) { return (rename(from, to)); }


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

x86 assembly (clang, -O2):
<LispRename>:
jmp    1030 <rename@plt>

LLVM IR (-O0):
define i32 @LispRename(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 = call i32 @rename(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @LispRename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
ret i32 %3
}