xunge/DecIR huggingface dataset:
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int lstat(char const *, struct stat *);
int __lxstat(int ver, const char *path, struct stat *buf) {
  return lstat(path, buf);
}


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

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

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @__lxstat(i32 %0, i8* %1, %struct.stat* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.stat*
store i32 %0, i32* %4
store i8* %1, i8** %5
store %struct.stat* %2, %struct.stat** %6
%7 = load i8*, i8** %5
%8 = load %struct.stat*, %struct.stat** %6
%9 = call i32 @lstat(i8* %7, %struct.stat* %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @__lxstat(i32 %0, i8* nocapture %1, %struct.stat* nocapture %2) {
%4 = tail call i32 @lstat(i8* %1, %struct.stat* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ genn1(char *);
int /*<<< orphan*/ strlen(char *);
char *genn2(char *sf) {
  char *ptr;
  genn1(sf);
  ptr += strlen(sf);
  ptr--;
  ptr[0] = '2';
}


x86 assembly (clang, -O0):
<genn2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <genn1@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x32,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genn2>:
push   %rbx
mov    %rdi,%rbx
call   1040 <genn1@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>

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

LLVM IR (-O2):
define noalias i8* @genn2(i8* %0) {
%2 = tail call i32 @genn1(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fSort(int *, int /*<<< orphan*/, int);
void fastSort(int a[], int size) { fSort(a, 0, size - 1); }


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

x86 assembly (clang, -O2):
<fastSort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <fSort@plt>

LLVM IR (-O0):
define void @fastSort(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 = sub nsw i32 %6, 1
%8 = call i32 @fSort(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @fastSort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @fSort(i32* %0, i32 0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int *twoSum(int *, int, int);
int main(void) {
  int x[] = {2, 7, 11, 15};
  int *res;
  res = twoSum(x, 4, 9);
  printf("%d %d\n", res[0], res[1]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
mov    $0x9,%edx
call   1040 <twoSum@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x9,%edx
call   1040 <twoSum@plt>
mov    (%rax),%esi
mov    0x4(%rax),%edx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [4 x i32] [i32 2, i32 7, i32 11, i32 15]
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32* @twoSum(i32* %3, i32 4, i32 9)
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %4, i64 1
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
ret i32 0
}
void CmdIgnore(int code) {}


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

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

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

LLVM IR (-O2):
define void @CmdIgnore(i32 %0) {
ret void
}
float square(float n) { return n * n; }


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
mulss  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define float @square(float %0) {
%2 = fmul float %0, %0
ret float %2
}
void ctl_program(int ch, int val) {}


x86 assembly (clang, -O0):
<ctl_program>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ctl_program(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @ctl_program(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void stq_le_p(void *ptr, uint64_t v) { *(uint64_t *)ptr = v; }


x86 assembly (clang, -O0):
<stq_le_p>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<stq_le_p>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @stq_le_p(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void putch0(char c) {
  __asm__ volatile("movb $0x0E,%ah");
  __asm__ volatile("movb %0,%%al" ::"r"(c) : "%al");
  __asm__ volatile("xorb %bh,%bh");
  __asm__ volatile("int $0x10");
}


x86 assembly (clang, -O0):
<putch0>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xe,%ah
mov    -0x1(%rbp),%cl
mov    %cl,%al
xor    %bh,%bh
int    $0x10
pop    %rbp
ret

x86 assembly (clang, -O2):
<putch0>:
mov    $0xe,%ah
mov    %dil,%al
xor    %bh,%bh
int    $0x10
ret

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

LLVM IR (-O2):
define void @putch0(i8 signext %0) {
tail call void asm sideeffect "movb $$0x0E,%ah", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "movb $0,%al", "r,~{al},~{dirflag},~{fpsr},~{flags}"(i8 %0)
tail call void asm sideeffect "xorb %bh,%bh", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "int $$0x10", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
unsigned long HibernateBatCheckDone(void) {
  return ((*((volatile unsigned long *)(0x400FC010))) & 0x00000400);
}


x86 assembly (clang, -O0):
<HibernateBatCheckDone>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fc010,%eax
mov    (%rax),%rax
and    $0x400,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateBatCheckDone>:
mov    0x400fc010,%rax
40
and    $0x400,%eax
ret

LLVM IR (-O0):
define i64 @HibernateBatCheckDone() {
%1 = load volatile i64, i64* inttoptr (i64 1074774032 to i64*)
%2 = and i64 %1, 1024
ret i64 %2
}

LLVM IR (-O2):
define i64 @HibernateBatCheckDone() {
%1 = load volatile i64, i64* inttoptr (i64 1074774032 to i64*)
%2 = and i64 %1, 1024
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char c;
  scanf("%c", &c);
  char res;
  res = 'z' - (c - 'a');
  printf("%c\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%ecx
sub    $0x61,%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
mov    %al,-0x6(%rbp)
lea    0xeac(%rip),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xdb,%al
sub    0x7(%rsp),%al
movsbl %al,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %6, 97
%8 = sub nsw i32 122, %7
%9 = trunc i32 %8 to i8
store i8 %9, i8* %3
%10 = load i8, i8* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = sub i8 -37, %3
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ state;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ UDP_CORK;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
void set_udp_uncork(int fd) {
  int state = 0;
  setsockopt(fd, IPPROTO_UDP, UDP_CORK, &state, sizeof(state));
}


x86 assembly (clang, -O0):
<set_udp_uncork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_udp_uncork>:
push   %rax
movl   $0x0,0x4(%rsp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rax
ret

LLVM IR (-O0):
@IPPROTO_UDP = global i32 0
@UDP_CORK = global i32 0
define void @set_udp_uncork(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_UDP
%6 = load i32, i32* @UDP_CORK
%7 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
ret void
}

LLVM IR (-O2):
@IPPROTO_UDP = global i32 0
@UDP_CORK = global i32 0
define void @set_udp_uncork(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = load i32, i32* @IPPROTO_UDP
%5 = load i32, i32* @UDP_CORK
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close_patfile();
int /*<<< orphan*/ rts_error(int, int const, int, int, char *, int);
void pattab_error(int name_len, char *file_name, int linenum) {
  extern const int ERR_PATTABSYNTAX;
  close_patfile();
  rts_error(5, ERR_PATTABSYNTAX, 3, name_len, file_name, linenum);
}


x86 assembly (clang, -O0):
<pattab_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <close_patfile@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    -0x14(%rbp),%r9d
mov    $0x5,%edi
mov    $0x3,%edx
call   1040 <rts_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pattab_error>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <close_patfile@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    $0x3,%edx
mov    %ebp,%ecx
mov    %rbx,%r8
mov    %r14d,%r9d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <rts_error@plt>

LLVM IR (-O0):
@ERR_PATTABSYNTAX = external constant i32
define void @pattab_error(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i32 (...) @close_patfile()
%8 = load i32, i32* @ERR_PATTABSYNTAX
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @rts_error(i32 5, i32 %8, i32 3, i32 %9, i8* %10, i32 %11)
ret void
}

LLVM IR (-O2):
@ERR_PATTABSYNTAX = external constant i32
define void @pattab_error(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (...) @close_patfile()
%5 = load i32, i32* @ERR_PATTABSYNTAX
%6 = tail call i32 @rts_error(i32 5, i32 %5, i32 3, i32 %0, i8* %1, i32 %2)
ret void
}
int test_imm_37int64_lowword_reg(long long val) {
  return ((val) & (0x37 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_37int64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x37,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_37int64_lowword_reg>:
test   $0x37,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_37int64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 55
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_37int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 55
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int cons(int a, int b) {
  int *linked = javaNew(8);
  linked[0] = a;
  linked[1] = b;
  return linked;
}


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

x86 assembly (clang, -O2):
<cons>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x8,%edi
xor    %eax,%eax
call   1030 <javaNew@plt>
cltq
mov    %ebp,(%rax)
mov    %ebx,0x4(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cons(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (i32, ...) bitcast (i32 (...)* @javaNew to i32 (i32, ...)*)(i32 8)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %5
%9 = load i32, i32* %3
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %9, i32* %11
%12 = load i32, i32* %4
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
%15 = load i32*, i32** %5
%16 = ptrtoint i32* %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @cons(i32 %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @javaNew to i32 (i32, ...)*)(i32 8)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
store i32 %0, i32* %5
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %1, i32* %6
ret i32 %3
}
dude(n) int n;
{ printf("B: %d\n", -1); }


x86 assembly (clang, -O0):
<dude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xede(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dude>:
lea    0xee9(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"B: %d\0A\00"
define i32 @dude(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 -1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ tprint(char *);
void addokbuf(char *strp) { tprint(strp); }


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

x86 assembly (clang, -O2):
<addokbuf>:
jmp    1030 <tprint@plt>

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

LLVM IR (-O2):
define void @addokbuf(i8* %0) {
%2 = tail call i32 @tprint(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
void expected_abort(int signo) { _exit(0); }


x86 assembly (clang, -O0):
<expected_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<expected_abort>:
push   %rax
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @expected_abort(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @expected_abort(i32 %0) {
%2 = tail call i32 @_exit(i32 0)
unreachable
}
unsigned long cycles1(void) {
  unsigned int hi, lo;
  __asm__ volatile("cpuid\n\t"
                   "rdtsc\n\t"
                   "mov %%edx, %0\n\t"
                   "mov %%eax, %1\n\t"
                   : "=r"(hi), "=r"(lo)::"%rax", "%rbx", "%rcx", "%rdx");
  return ((unsigned long long)lo) | (((unsigned long long)hi) << 32);
}


x86 assembly (clang, -O0):
<cycles1>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
cpuid
rdtsc
mov    %edx,%esi
mov    %eax,%edi
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
mov    %ecx,-0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x20,%rcx
or     %rcx,%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cycles1>:
push   %rbx
cpuid
rdtsc
mov    %edx,%esi
mov    %eax,%edi
mov    %edi,%eax
shl    $0x20,%rsi
or     %rax,%rsi
mov    %rsi,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @cycles1() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "cpuid\0A\09rdtsc\0A\09mov %edx, $0\0A\09mov %eax, $1\0A\09", "=r,=r,~{rax},~{rbx},~{rcx},~{rdx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = load i32, i32* %1
%9 = zext i32 %8 to i64
%10 = shl i64 %9, 32
%11 = or i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @cycles1() {
%1 = tail call { i32, i32 } asm sideeffect "cpuid\0A\09rdtsc\0A\09mov %edx, $0\0A\09mov %eax, $1\0A\09", "=r,=r,~{rax},~{rbx},~{rcx},~{rdx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %3 to i64
%5 = zext i32 %2 to i64
%6 = shl nuw i64 %5, 32
%7 = or i64 %6, %4
ret i64 %7
}
int *funInt(int *x, int *y) {
  if (*x > *y)
    return x;
  else if (*y > *x)
    return y;
  return x;
}


x86 assembly (clang, -O0):
<funInt>:
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    112b <funInt+0x2b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <funInt+0x57>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jle    114a <funInt+0x4a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <funInt+0x57>
jmp    114f <funInt+0x4f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<funInt>:
mov    %rsi,%rax
mov    (%rdi),%ecx
mov    (%rsi),%edx
cmp    %ecx,%edx
cmovle %rdi,%rax
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i32* @funInt(i32* %0, i32* %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp sgt i32 %3, %4
%6 = icmp sgt i32 %4, %3
%7 = select i1 %6, i32* %1, i32* %0
%8 = select i1 %5, i32* %0, i32* %7
ret i32* %8
}
void virtual_mcu_GlobalInterrupts_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @virtual_mcu_GlobalInterrupts_targetInit__I() {
ret void
}
/* Variables and functions */
int f(int);
caller() { return f(3); }


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

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

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

LLVM IR (-O2):
define i32 @caller() {
%1 = tail call i32 @f(i32 3)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0x85() {
  Assert_real((ispunct(133) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              670, ("ispunct should be 0 for 0x85"));
}


x86 assembly (clang, -O0):
<t_ispunct_0x85>:
push   %rbp
mov    %rsp,%rbp
mov    $0x85,%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x29e,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0x85>:
push   %rax
mov    $0x85,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x29e,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0x85\00"
define void @t_ispunct_0x85() {
%1 = call i64 @ispunct(i32 133)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 670, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0x85\00"
define void @t_ispunct_0x85() {
%1 = tail call i64 @ispunct(i32 133)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 670, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_csi(char *, int);
void decsasd(int pn) { do_csi("%d$}", pn); }


x86 assembly (clang, -O0):
<decsasd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <do_csi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decsasd>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <do_csi@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d$}\00"
define void @decsasd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @do_csi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d$}\00"
define void @decsasd(i32 %0) {
%2 = tail call i32 @do_csi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
unsigned int executeHandleMessages(void *, char *, int, unsigned int *,
                                   unsigned int **);
unsigned int retractFacts(void *handle, char *messages,
                          unsigned int *resultsLength, unsigned int **results) {
  return executeHandleMessages(handle, messages, 7, resultsLength, results);
}


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

x86 assembly (clang, -O2):
<retractFacts>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    $0x7,%edx
jmp    1030 <executeHandleMessages@plt>

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

LLVM IR (-O2):
define i32 @retractFacts(i8* %0, i8* %1, i32* %2, i32** %3) {
%5 = tail call i32 @executeHandleMessages(i8* %0, i8* %1, i32 7, i32* %2, i32** %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("Usage: mod2gbt modfile.mod song_name [-speed] [-512-banks]\n\n");
  printf("       -speed      Don't convert speed from 50 Hz to 60 Hz.\n");
  printf("       -512-banks  Prepare for a ROM with more than 256 banks.\n");
  printf("\n\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
call   1030 <printf@plt>
lea    0xf47(%rip),%rdi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"Usage: mod2gbt modfile.mod song_name [-speed] [-512-banks]\0A\0A\00"
@.str.1 = [61 x i8] c" -speed Don't convert speed from 50 Hz to 60 Hz.\0A\00"
@.str.2 = [64 x i8] c" -512-banks Prepare for a ROM with more than 256 banks.\0A\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [60 x i8] c"Usage: mod2gbt modfile.mod song_name [-speed] [-512-banks]\0A\00"
@str.4 = [60 x i8] c" -speed Don't convert speed from 50 Hz to 60 Hz.\00"
@str.5 = [63 x i8] c" -512-banks Prepare for a ROM with more than 256 banks.\00"
@str.6 = [2 x i8] c"\0A\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar_fd(int, int);
int /*<<< orphan*/ ft_putstr_fd(char const *, int);
void ft_putendl_fd(char const *s, int fd) {
  (void)ft_putstr_fd(s, fd);
  (void)ft_putchar_fd(0x0a, fd);
  return;
}


x86 assembly (clang, -O0):
<ft_putendl_fd>:
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 <ft_putstr_fd@plt>
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1040 <ft_putchar_fd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl_fd>:
push   %rbx
mov    %esi,%ebx
call   1030 <ft_putstr_fd@plt>
mov    $0xa,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <ft_putchar_fd@plt>

LLVM IR (-O0):
define void @ft_putendl_fd(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 @ft_putstr_fd(i8* %5, i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @ft_putchar_fd(i32 10, i32 %8)
ret void
}

LLVM IR (-O2):
define void @ft_putendl_fd(i8* %0, i32 %1) {
%3 = tail call i32 @ft_putstr_fd(i8* %0, i32 %1)
%4 = tail call i32 @ft_putchar_fd(i32 10, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ b();
int /*<<< orphan*/ c();
int /*<<< orphan*/ getchar();
void main() {
  b();
  c();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <b@plt>
mov    $0x0,%al
call   1050 <c@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <b@plt>
xor    %eax,%eax
call   1050 <c@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <getchar@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @b()
%2 = call i32 (...) @c()
%3 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @b()
%2 = tail call i32 (...) @c()
%3 = tail call i32 (...) @getchar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void reverse(char *string) {
  if (*string != '\0') {
    reverse(string + 1);
  } else {
    return;
  }
  printf("%c", *string);
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114e <reverse+0x2e>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <reverse@plt>
jmp    1153 <reverse+0x33>
jmp    1166 <reverse+0x46>
mov    -0x8(%rbp),%rax
lea    0xea2(%rip),%rdi
movsbl (%rax),%esi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1142 <reverse+0x22>
mov    %rdi,%rbx
add    $0x1,%rdi
call   1030 <reverse@plt>
movsbl (%rbx),%esi
lea    0xec4(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @reverse(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1, %5
ret void
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
tail call void @reverse(i8* %6)
%7 = load i8, i8* %0
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %7)
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ bitop(int);
int /*<<< orphan*/ emit(char *);
void i_bitop_imm(void) {
  emit("mov cl,[esi]\n");
  emit("add esi,byte 2\n");
  bitop(4);
}


x86 assembly (clang, -O0):
<i_bitop_imm>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <emit@plt>
lea    0xed7(%rip),%rdi
call   1030 <emit@plt>
mov    $0x4,%edi
call   1040 <bitop@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_bitop_imm>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <emit@plt>
lea    0xeda(%rip),%rdi
call   1030 <emit@plt>
mov    $0x4,%edi
pop    %rax
jmp    1040 <bitop@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"mov cl,[esi]\0A\00"
@.str.1 = [16 x i8] c"add esi,byte 2\0A\00"
define void @i_bitop_imm() {
%1 = call i32 @emit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @bitop(i32 4)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"mov cl,[esi]\0A\00"
@.str.1 = [16 x i8] c"add esi,byte 2\0A\00"
define void @i_bitop_imm() {
%1 = tail call i32 @emit(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @emit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @bitop(i32 4)
ret void
}
int isPrimeNumber(int value) {
  int i = 1;
  for (i = 1; i < value; ++i) {
    if (value % i == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPrimeNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1150 <isPrimeNumber+0x50>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113d <isPrimeNumber+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1157 <isPrimeNumber+0x57>
jmp    1142 <isPrimeNumber+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <isPrimeNumber+0x15>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrimeNumber>:
xor    %eax,%eax
cmp    $0x2,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @isPrimeNumber(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %4
store i32 1, 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 @isPrimeNumber(i32 %0) {
%2 = icmp slt i32 %0, 2
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ swim_udelay(int);
void swim_mdelay(unsigned int ms) {
  while (ms--) {
    swim_udelay(1000);
  }
}


x86 assembly (clang, -O0):
<swim_mdelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     113e <swim_mdelay+0x2e>
mov    $0x3e8,%edi
call   1030 <swim_udelay@plt>
jmp    111b <swim_mdelay+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swim_mdelay>:
push   %rbx
test   %edi,%edi
je     112f <swim_mdelay+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x3e8,%edi
call   1030 <swim_udelay@plt>
add    $0xffffffff,%ebx
jne    1120 <swim_mdelay+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @swim_mdelay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @swim_udelay(i32 1000)
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @swim_mdelay(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add i32 %4, -1
%6 = tail call i32 @swim_udelay(i32 1000)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int abs(int);
int _abs(int src1) {
  if ((unsigned)src1 == (unsigned)0x80000000) {
    return 0x7fffffff;
  }
  return abs(src1);
}


x86 assembly (clang, -O0):
<_abs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x80000000,-0x8(%rbp)
jne    1134 <_abs+0x24>
movl   $0x7fffffff,-0x4(%rbp)
jmp    113f <_abs+0x2f>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_abs>:
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
cmp    $0x80000000,%edi
mov    $0x7fffffff,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @_abs(i32 %0) {
%2 = icmp eq i32 %0, -2147483648
%3 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%4 = select i1 %2, i32 2147483647, i32 %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ rputc(char const);
void rputs(const char *str) {
  int i = 0;
  if (str == NULL)
    return;
  while (str[i] != '\0') {
    rputc(str[i]);
    ++i;
  }
}


x86 assembly (clang, -O0):
<rputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1133 <rputs+0x23>
jmp    116c <rputs+0x5c>
jmp    1138 <rputs+0x28>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116c <rputs+0x5c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <rputc@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <rputs+0x28>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rputs>:
push   %rbx
test   %rdi,%rdi
je     1143 <rputs+0x33>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1143 <rputs+0x33>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <rputc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <rputs+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @rputs(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %10, %6 ], [ 0, %3 ]
%8 = phi i8 [ %12, %6 ], [ %4, %3 ]
%9 = tail call i32 @rputc(i8 signext %8)
%10 = add nuw i64 %7, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %3, %1
ret void
}
void pvec_copy(from, to, maxnum) int from[];
int to[];
int maxnum;
{
  int i;
  for (i = 0; i < maxnum; i++) {
    to[i] = from[i];
    if (from[i] == (-1))
      break;
  }
}


x86 assembly (clang, -O0):
<pvec_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1162 <pvec_copy+0x62>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    114f <pvec_copy+0x4f>
jmp    1162 <pvec_copy+0x62>
jmp    1154 <pvec_copy+0x54>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1116 <pvec_copy+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pvec_copy>:
test   %edx,%edx
jle    112b <pvec_copy+0x2b>
mov    %edx,%eax
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
mov    -0x4(%rdi,%rcx,4),%edx
mov    %edx,-0x4(%rsi,%rcx,4)
cmpl   $0xffffffff,-0x4(%rdi,%rcx,4)
je     112b <pvec_copy+0x2b>
lea    0x1(%rcx),%rdx
cmp    %rax,%rcx
mov    %rdx,%rcx
jb     1110 <pvec_copy+0x10>
ret

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

LLVM IR (-O2):
define void @pvec_copy(i32* nocapture %0, i32* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %7, %5
%8 = phi i64 [ %14, %7 ], [ 0, %5 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %1, i64 %8
store i32 %10, i32* %11
%12 = load i32, i32* %9
%13 = icmp ne i32 %12, -1
%14 = add nuw nsw i64 %8, 1
%15 = icmp ult i64 %14, %6
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %7, label %17
17: ; preds = %7, %3
ret void
}
/* Variables and functions */
unsigned long foobarsum(int);
int /*<<< orphan*/ printf(char *, int, unsigned long);
int main(int argc, char *argv[]) {
  unsigned long answer = foobarsum(1000);
  printf("The sum of all multiples of 3 or 5 below %d is: %lu\n", 1000, answer);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [53 x i8] c"The sum of all multiples of 3 or 5 below %d is: %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @foobarsum(i32 1000)
store i64 %7, i64* %6
%8 = load i64, i64* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 1000, i64 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"The sum of all multiples of 3 or 5 below %d is: %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @foobarsum(i32 1000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 1000, i64 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int test_cc(int, int, int, int);
int main(void) {
  int sum = test_cc(1, 2, 3, 4);
  printf("test_cc: %d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1030 <test_cc@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1030 <test_cc@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"test_cc: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @test_cc(i32 1, i32 2, i32 3, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}