xunge/DecIR huggingface dataset:
void SPIM_1_EnableRxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SPIM_1_EnableRxInt() {
ret void
}
/* Variables and functions */
char *GetWithinSymbols(char *, char *, char, char, int /*<<< orphan*/);
char *Trim(char *output, char *input) {
  return GetWithinSymbols(output, input, ' ', ' ', 0);
}


x86 assembly (clang, -O0):
<Trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x20,%ecx
xor    %r8d,%r8d
mov    %ecx,%edx
call   1030 <GetWithinSymbols@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Trim>:
mov    $0x20,%edx
mov    $0x20,%ecx
xor    %r8d,%r8d
jmp    1030 <GetWithinSymbols@plt>

LLVM IR (-O0):
define i8* @Trim(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 i8* @GetWithinSymbols(i8* %5, i8* %6, i8 signext 32, i8 signext 32, i32 0)
ret i8* %7
}

LLVM IR (-O2):
define i8* @Trim(i8* %0, i8* %1) {
%3 = tail call i8* @GetWithinSymbols(i8* %0, i8* %1, i8 signext 32, i8 signext 32, i32 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *name) {
  fprintf(stderr, "usage: %s [-c] directory ...\n", name);
  exit(1);
}


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

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

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

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

/* Variables and functions */
int obus_object_destroy(int /*<<< orphan*/);
int /*<<< orphan*/ ps_summary_object(struct ps_summary *);
int ps_summary_destroy(struct ps_summary *object) {
  return obus_object_destroy(ps_summary_object(object));
}


x86 assembly (clang, -O0):
<ps_summary_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ps_summary_object@plt>
mov    %eax,%edi
call   1040 <obus_object_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ps_summary = type { i32 }
define i32 @ps_summary_destroy(%struct.ps_summary* %0) {
%2 = alloca %struct.ps_summary*
store %struct.ps_summary* %0, %struct.ps_summary** %2
%3 = load %struct.ps_summary*, %struct.ps_summary** %2
%4 = call i32 @ps_summary_object(%struct.ps_summary* %3)
%5 = call i32 @obus_object_destroy(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.ps_summary = type { i32 }
define i32 @ps_summary_destroy(%struct.ps_summary* %0) {
%2 = tail call i32 @ps_summary_object(%struct.ps_summary* %0)
%3 = tail call i32 @obus_object_destroy(i32 %2)
ret i32 %3
}
/* Variables and functions */
int close(int);
int bt_close(int sck) { return close(sck); }


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

x86 assembly (clang, -O2):
<bt_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @bt_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
void pred(int *array, int elem) {
  printf("Element %d is %d \n", elem, array[elem]);
  printf("Pred element is %d \n", array[elem - 1]);
}


x86 assembly (clang, -O0):
<pred>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pred>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movslq %esi,%rbx
mov    (%rdi,%rbx,4),%edx
lea    0xedc(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%r14,%rbx,4),%esi
lea    0xeda(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Element %d is %d \0A\00"
@.str.1 = [21 x i8] c"Pred element is %d \0A\00"
define void @pred(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %10)
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %12, i64 %15
%17 = load i32, i32* %16
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Element %d is %d \0A\00"
@.str.1 = [21 x i8] c"Pred element is %d \0A\00"
define void @pred(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %5)
%7 = add nsw i32 %1, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret void
}
unsigned int leading_zero_num4(unsigned int x) {
  unsigned int nr;
  if (x == 0)
    return 32;
  nr = 0;
  while ((int)x > 0) {
    ++nr;
    x <<= 1;
  }
  return nr;
}


x86 assembly (clang, -O0):
<leading_zero_num4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <leading_zero_num4+0x1d>
movl   $0x20,-0x4(%rbp)
jmp    114b <leading_zero_num4+0x4b>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1145 <leading_zero_num4+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <leading_zero_num4+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leading_zero_num4>:
test   %edi,%edi
je     111a <leading_zero_num4+0x1a>
jle    1120 <leading_zero_num4+0x20>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
add    %edi,%edi
test   %edi,%edi
jg     1110 <leading_zero_num4+0x10>
ret
mov    $0x20,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @leading_zero_num4(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ 0, %3 ]
%7 = phi i32 [ %9, %5 ], [ %0, %3 ]
%8 = add nuw nsw i32 %6, 1
%9 = shl nuw i32 %7, 1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %3, %1
%12 = phi i32 [ 32, %1 ], [ 0, %3 ], [ %8, %5 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
FILE *tmpfile() {}


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

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

LLVM IR (-O0):
define i32* @tmpfile() {
%1 = alloca i32*
%2 = load i32*, i32** %1
ret i32* %2
}

LLVM IR (-O2):
define noalias i32* @tmpfile() {
ret i32* undef
}
/* Type definitions */
struct io_file {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ F_UNLCK;
int __io_lock_record(struct io_file *, unsigned int, int /*<<< orphan*/);
int io_unlock_record(struct io_file *mf, unsigned int slot) {
  return __io_lock_record(mf, slot, F_UNLCK);
}


x86 assembly (clang, -O0):
<io_unlock_record>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
call   1030 <__io_lock_record@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_unlock_record>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
jmp    1030 <__io_lock_record@plt>

LLVM IR (-O0):
%struct.io_file = type { i32 }
@F_UNLCK = global i32 0
define i32 @io_unlock_record(%struct.io_file* %0, i32 %1) {
%3 = alloca %struct.io_file*
%4 = alloca i32
store %struct.io_file* %0, %struct.io_file** %3
store i32 %1, i32* %4
%5 = load %struct.io_file*, %struct.io_file** %3
%6 = load i32, i32* %4
%7 = load i32, i32* @F_UNLCK
%8 = call i32 @__io_lock_record(%struct.io_file* %5, i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.io_file = type { i32 }
@F_UNLCK = global i32 0
define i32 @io_unlock_record(%struct.io_file* %0, i32 %1) {
%3 = load i32, i32* @F_UNLCK
%4 = tail call i32 @__io_lock_record(%struct.io_file* %0, i32 %1, i32 %3)
ret i32 %4
}
const char *dummyMessage() { return "My Name is hex_to_base64.\n"; }


x86 assembly (clang, -O0):
<dummyMessage>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dummyMessage>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [27 x i8] c"My Name is hex_to_base64.\0A\00"
define i8* @dummyMessage() {
ret i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [27 x i8] c"My Name is hex_to_base64.\0A\00"
define i8* @dummyMessage() {
ret i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
unsigned int ft_strlen(char *);
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  unsigned int i;
  unsigned int j;
  i = 0;
  j = ft_strlen(s);
  while (i < j) {
    f(i, s + i);
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    1160 <ft_striteri+0x50>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%ecx
add    %rcx,%rsi
call   *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <ft_striteri+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striteri>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <ft_strlen@plt>
test   %eax,%eax
je     1142 <ft_striteri+0x32>
mov    %eax,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rsi
mov    %ebx,%edi
call   *%r14
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <ft_striteri+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striteri(i8* %0, void (i32, i8*)* nocapture %1) {
%3 = tail call i32 @ft_strlen(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %11, %7 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = trunc i64 %8 to i32
tail call void %1(i32 %10, i8* %9)
%11 = add nuw nsw i64 %8, 1
%12 = icmp eq i64 %11, %6
br i1 %12, label %13, label %7
13: ; preds = %7, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char const *);
void _logStdout(const char *msg) { (void)puts(msg); }


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

x86 assembly (clang, -O2):
<_logStdout>:
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
define void @_logStdout(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
/* Variables and functions */
unsigned long do_csum(unsigned char *, int);
unsigned int csum_partial(unsigned char *buff, int len, unsigned int sum) {
  unsigned long result = do_csum(buff, len);
  result += sum;
  result = (result & 0xffffffff) + (result >> 32);
  return result;
}


x86 assembly (clang, -O0):
<csum_partial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <do_csum@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0xffffffff,%rax
and    -0x18(%rbp),%rax
mov    -0x18(%rbp),%rcx
shr    $0x20,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_partial>:
push   %rbx
mov    %edx,%ebx
call   1030 <do_csum@plt>
mov    %ebx,%ecx
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @csum_partial(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call i64 @do_csum(i8* %8, i32 %9)
store i64 %10, i64* %7
%11 = load i32, i32* %6
%12 = zext i32 %11 to i64
%13 = load i64, i64* %7
%14 = add i64 %13, %12
store i64 %14, i64* %7
%15 = load i64, i64* %7
%16 = and i64 %15, 4294967295
%17 = load i64, i64* %7
%18 = lshr i64 %17, 32
%19 = add i64 %16, %18
store i64 %19, i64* %7
%20 = load i64, i64* %7
%21 = trunc i64 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @csum_partial(i8* %0, i32 %1, i32 %2) {
%4 = tail call i64 @do_csum(i8* %0, i32 %1)
%5 = zext i32 %2 to i64
%6 = add i64 %4, %5
%7 = lshr i64 %6, 32
%8 = add i64 %7, %6
%9 = trunc i64 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ myfunc(char *, int);
int main(void) {
  char arr[] = {'a', 'b', 'c', 'd'};
  int len = sizeof(arr);
  myfunc(arr, len);
  myfunc(arr, len + 1);
  myfunc(arr, len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <myfunc@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1030 <myfunc@plt>
lea    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <myfunc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x64636261,0xc(%rsp)
64
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <myfunc@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <myfunc@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <myfunc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [4 x i8] c"abcd"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [4 x i8]* %2 to i8*
store i32 4, i32* %3
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @myfunc(i8* %5, i32 %6)
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = call i32 @myfunc(i8* %8, i32 %10)
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = call i32 @myfunc(i8* %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1684234849, i32* %1
%3 = call i32 @myfunc(i8* %2, i32 4)
%4 = call i32 @myfunc(i8* %2, i32 5)
%5 = call i32 @myfunc(i8* %2, i32 4)
ret i32 0
}
/* Variables and functions */
int exampleProgram();
int main() {
  int outcome = exampleProgram();
  return outcome;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @exampleProgram()
store i32 %3, i32* %2
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @exampleProgram()
ret i32 %1
}
/* Variables and functions */
int myhextonum(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char *s = "0x13e";
  int result;
  result = myhextonum(s);
  printf("%d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <myhextonum@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"0x13e\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @myhextonum(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"0x13e\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @myhextonum(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
int port_num_valid(int port_num) { return (port_num >= 0 && port_num < 512); }


x86 assembly (clang, -O0):
<port_num_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1123 <port_num_valid+0x23>
cmpl   $0x200,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_num_valid>:
xor    %eax,%eax
cmp    $0x200,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @port_num_valid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 512
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @port_num_valid(i32 %0) {
%2 = icmp ult i32 %0, 512
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ setDebuggingLevel(int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ testTraversals();
int /*<<< orphan*/ testTreeCreation();
int /*<<< orphan*/ testTreeFind();
int /*<<< orphan*/ testTreeInsertion();
int /*<<< orphan*/ testTreeRemoval();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  setDebuggingLevel(2);
  srand(time(NULL));
  testTreeCreation();
  testTreeInsertion();
  testTreeFind();
  testTraversals();
  testTreeRemoval();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%edi
call   1070 <setDebuggingLevel@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1050 <testTreeCreation@plt>
mov    $0x0,%al
call   10a0 <testTreeInsertion@plt>
mov    $0x0,%al
call   1090 <testTreeFind@plt>
mov    $0x0,%al
call   1060 <testTraversals@plt>
mov    $0x0,%al
call   1030 <testTreeRemoval@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1070 <setDebuggingLevel@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1050 <testTreeCreation@plt>
xor    %eax,%eax
call   10a0 <testTreeInsertion@plt>
xor    %eax,%eax
call   1090 <testTreeFind@plt>
xor    %eax,%eax
call   1060 <testTraversals@plt>
xor    %eax,%eax
call   1030 <testTreeRemoval@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @setDebuggingLevel(i32 2)
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
%8 = call i32 (...) @testTreeCreation()
%9 = call i32 (...) @testTreeInsertion()
%10 = call i32 (...) @testTreeFind()
%11 = call i32 (...) @testTraversals()
%12 = call i32 (...) @testTreeRemoval()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setDebuggingLevel(i32 2)
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (...) @testTreeCreation()
%7 = tail call i32 (...) @testTreeInsertion()
%8 = tail call i32 (...) @testTreeFind()
%9 = tail call i32 (...) @testTraversals()
%10 = tail call i32 (...) @testTreeRemoval()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int func(int auth, char *str) {
  char data[100];
  strcpy(data, str);
  if (auth == 1) {
    printf("Secret!\n");
  } else {
    exit(0);
  }
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1,-0x8(%rbp)
jne    116a <func+0x3a>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
jmp    1171 <func+0x41>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rbx
sub    $0x70,%rsp
mov    %edi,%ebx
mov    %rsp,%rdi
call   1030 <strcpy@plt>
cmp    $0x1,%ebx
jne    1156 <func+0x26>
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
add    $0x70,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Secret!\0A\00"
define i32 @func(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [100 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%8 = load i8*, i8** %5
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %16
14: ; preds = %2
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@str = [8 x i8] c"Secret!\00"
define i32 @func(i32 %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %1)
%6 = icmp eq i32 %0, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 undef
9: ; preds = %2
%10 = call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ zwrite(int, int);
void write16(uint16_t address, uint16_t value) {
  zwrite(address, value >> 8);
  zwrite(address + 1, value);
}


x86 assembly (clang, -O0):
<write16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sar    $0x8,%esi
call   1030 <zwrite@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1030 <zwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write16>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
sar    $0x8,%esi
call   1030 <zwrite@plt>
add    $0x1,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <zwrite@plt>

LLVM IR (-O0):
define void @write16(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 8
%8 = call i32 @zwrite(i32 %5, i32 %7)
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = load i32, i32* %4
%12 = call i32 @zwrite(i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
define void @write16(i32 %0, i32 %1) {
%3 = ashr i32 %1, 8
%4 = tail call i32 @zwrite(i32 %0, i32 %3)
%5 = add nsw i32 %0, 1
%6 = tail call i32 @zwrite(i32 %5, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (sizeof(void *) == 4) {
    printf("Running Win32\n");
  } else if (sizeof(void *) == 8) {
    printf("Running x64\n");
  } else {
    printf("Unexpected platform\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Running x64\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Running x64\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
void *libretro_dummy_retro_get_memory_data(unsigned id) {
  (void)id;
  return NULL;
}


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

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

LLVM IR (-O0):
define i8* @libretro_dummy_retro_get_memory_data(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @libretro_dummy_retro_get_memory_data(i32 %0) {
ret i8* null
}
int helper(void) { return 42; }


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

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

LLVM IR (-O0):
define i32 @helper() {
ret i32 42
}

LLVM IR (-O2):
define i32 @helper() {
ret i32 42
}
void trim_newline(char *line) {
  char *p = line;
  while (*p != '\0' && *p != '\r' && *p != '\n')
    p++;
  *p = '\0';
}


x86 assembly (clang, -O0):
<trim_newline>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     114a <trim_newline+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x11(%rbp)
je     114a <trim_newline+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115a <trim_newline+0x5a>
jmp    116b <trim_newline+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <trim_newline+0x10>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim_newline>:
mov    $0x2401,%eax
jmp    1114 <trim_newline+0x14>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0xd,%rcx
ja     1110 <trim_newline+0x10>
bt     %rcx,%rax
jae    1110 <trim_newline+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @trim_newline(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 13, label %7
i8 10, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2, %2
store i8 0, i8* %3
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int, char *);
int readl(char *);
int main(void) {
  char line[81];
  int nbChars;
  while ((nbChars = readl(line)) != EOF) {
    printf("%d %s\n", nbChars, line);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <readl@plt>
mov    %eax,-0x64(%rbp)
mov    0x2ea6(%rip),%rcx
cmp    (%rcx),%eax
je     1162 <main+0x42>
mov    -0x64(%rbp),%esi
lea    -0x60(%rbp),%rdx
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsp,%rdi
call   1040 <readl@plt>
mov    0x2eb0(%rip),%r15
cmp    (%r15),%eax
je     116a <main+0x4a>
lea    0xebc(%rip),%r14
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <readl@plt>
cmp    (%r15),%eax
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [7 x i8] c"%d %s\0A\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = call i32 @readl(i8* %2)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %9, %6 ], [ %3, %0 ]
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %2)
%9 = call i32 @readl(i8* %2)
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %0
ret i32 0
}
h(volatile void *v) { *v; }


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

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

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

LLVM IR (-O2):
define i32 @h(i8* nocapture readnone %0) {
ret i32 undef
}
void premeshccc(void) {}


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

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

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

LLVM IR (-O2):
define void @premeshccc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *print(void *threadid) {
  long tid;
  tid = (long)threadid;
  printf("Thread Id: #%ld!\n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Thread Id: #%ld!\0A\00"
define i8* @print(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @pthread_exit(i32* null)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [18 x i8] c"Thread Id: #%ld!\0A\00"
define noalias i8* @print(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
int phy_set_power(int dbm) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @phy_set_power(i32 %0) {
ret i32 0
}
/* Variables and functions */
int extern_func_2(int);
int extern_func_usage(void) { return extern_func_2(3); }


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

x86 assembly (clang, -O2):
<extern_func_usage>:
mov    $0x3,%edi
jmp    1030 <extern_func_2@plt>

LLVM IR (-O0):
define i32 @extern_func_usage() {
%1 = call i32 @extern_func_2(i32 3)
ret i32 %1
}

LLVM IR (-O2):
define i32 @extern_func_usage() {
%1 = tail call i32 @extern_func_2(i32 3)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ SPI_SpiInit();
void SPI_Init(void) { SPI_SpiInit(); }


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

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

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

LLVM IR (-O2):
define void @SPI_Init() {
%1 = tail call i32 (...) @SPI_SpiInit()
ret void
}
double compute_intlen(unsigned int *ints) {
  unsigned int m = ints[0];
  if (ints[1] > m)
    m = ints[1];
  if (ints[2] > m)
    m = ints[2];
  return (double)m;
}


x86 assembly (clang, -O0):
<compute_intlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
cmp    -0xc(%rbp),%eax
jbe    112b <compute_intlen+0x2b>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
cmp    -0xc(%rbp),%eax
jbe    1145 <compute_intlen+0x45>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_intlen>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
cmp    %eax,%ecx
cmova  %ecx,%eax
mov    0x8(%rdi),%ecx
cmp    %eax,%ecx
cmova  %ecx,%eax
cvtsi2sd %rax,%xmm0
ret

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

LLVM IR (-O2):
define double @compute_intlen(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = icmp ugt i32 %4, %2
%6 = select i1 %5, i32 %4, i32 %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = icmp ugt i32 %8, %6
%10 = select i1 %9, i32 %8, i32 %6
%11 = uitofp i32 %10 to double
ret double %11
}
int asal_mi(int x) {
  int i;
  for (i = 2; i < x; i++) {
    if (x % i == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<asal_mi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1149 <asal_mi+0x49>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1136 <asal_mi+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1150 <asal_mi+0x50>
jmp    113b <asal_mi+0x3b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <asal_mi+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<asal_mi>:
mov    $0x1,%ecx
cmp    $0x3,%edi
jl     1120 <asal_mi+0x20>
mov    $0x2,%esi
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1123 <asal_mi+0x23>
add    $0x1,%esi
cmp    %esi,%edi
jne    1110 <asal_mi+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @asal_mi(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %5 ]
ret i32 %11
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void be16enc(void *pp, uint16_t u) {
  uint8_t *p = (uint8_t *)pp;
  p[0] = (u >> 8) & 0xff;
  p[1] = u & 0xff;
}


x86 assembly (clang, -O0):
<be16enc>:
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
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<be16enc>:
mov    %esi,%eax
movzbl %ah,%ecx
mov    %ecx,(%rdi)
movzbl %al,%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @be16enc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %4
%9 = ashr i32 %8, 8
%10 = and i32 %9, 255
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 %10, i32* %12
%13 = load i32, i32* %4
%14 = and i32 %13, 255
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 %14, i32* %16
ret void
}

LLVM IR (-O2):
define void @be16enc(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = lshr i32 %1, 8
%5 = and i32 %4, 255
store i32 %5, i32* %3
%6 = and i32 %1, 255
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
ret void
}
void const_mem_pool_destroy(struct const_mem_pool *p) {}


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

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

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

LLVM IR (-O2):
%struct.const_mem_pool = type opaque
define void @const_mem_pool_destroy(%struct.const_mem_pool* nocapture %0) {
ret void
}
int do_254() { return 254; }


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

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

LLVM IR (-O0):
define i32 @do_254() {
ret i32 254
}

LLVM IR (-O2):
define i32 @do_254() {
ret i32 254
}
/* Type definitions */
typedef int /*<<< orphan*/ __m256i;

/* Variables and functions */
int /*<<< orphan*/ _mm256_add_epi32(int /*<<< orphan*/ const,
                                    int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm256_castsi256_si128(int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm256_cvtepi16_epi32(int /*<<< orphan*/);
int /*<<< orphan*/ _mm256_extractf128_si256(int /*<<< orphan*/ const, int);
__m256i sum_to_32bit_avx2(const __m256i sum) {
  const __m256i sum_lo = _mm256_cvtepi16_epi32(_mm256_castsi256_si128(sum));
  const __m256i sum_hi =
      _mm256_cvtepi16_epi32(_mm256_extractf128_si256(sum, 1));
  return _mm256_add_epi32(sum_lo, sum_hi);
}


x86 assembly (clang, -O0):
<sum_to_32bit_avx2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <_mm256_castsi256_si128@plt>
mov    %eax,%edi
call   1060 <_mm256_cvtepi16_epi32@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <_mm256_extractf128_si256@plt>
mov    %eax,%edi
call   1060 <_mm256_cvtepi16_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <_mm256_add_epi32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_to_32bit_avx2>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <_mm256_castsi256_si128@plt>
mov    %eax,%edi
call   1060 <_mm256_cvtepi16_epi32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <_mm256_extractf128_si256@plt>
mov    %eax,%edi
call   1060 <_mm256_cvtepi16_epi32@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <_mm256_add_epi32@plt>

LLVM IR (-O0):
define i32 @sum_to_32bit_avx2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @_mm256_castsi256_si128(i32 %5)
%7 = call i32 @_mm256_cvtepi16_epi32(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = call i32 @_mm256_extractf128_si256(i32 %8, i32 1)
%10 = call i32 @_mm256_cvtepi16_epi32(i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @_mm256_add_epi32(i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @sum_to_32bit_avx2(i32 %0) {
%2 = tail call i32 @_mm256_castsi256_si128(i32 %0)
%3 = tail call i32 @_mm256_cvtepi16_epi32(i32 %2)
%4 = tail call i32 @_mm256_extractf128_si256(i32 %0, i32 1)
%5 = tail call i32 @_mm256_cvtepi16_epi32(i32 %4)
%6 = tail call i32 @_mm256_add_epi32(i32 %3, i32 %5)
ret i32 %6
}
void delay() {
  int i = 0;
  while (i < 2000) {
    i++;
  }
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x7d0,-0x4(%rbp)
jge    1126 <delay+0x26>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <delay+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @delay() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 2000
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1
br label %2
8: ; preds = %2
ret void
}

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