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

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


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

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

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

LLVM IR (-O2):
%struct.ulz = type { i32 }
define void @ulz_free(%struct.ulz* nocapture %0) {
%2 = tail call i32 @free(%struct.ulz* %0)
ret void
}
void op_alu_sbc(char rega[], char regb[], char accumulator[], char flags[]) {}


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

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

LLVM IR (-O0):
define void @op_alu_sbc(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
ret void
}

LLVM IR (-O2):
define void @op_alu_sbc(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2, i8* nocapture %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void destroy_array(int *a) { free(a); }


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

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

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

LLVM IR (-O2):
define void @destroy_array(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
void print_memory() { return; }


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

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

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

LLVM IR (-O2):
define void @print_memory() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WriteInstruction(char *);
void CR_Spawned(void) { WriteInstruction("ld ix,(spptr)"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"ld ix,(spptr)\00"
define void @CR_Spawned() {
%1 = call i32 @WriteInstruction(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"ld ix,(spptr)\00"
define void @CR_Spawned() {
%1 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
void SteamAPI_ReleaseCurrentThreadMemory(void) { xlogf("%s()\n", __func__); }


x86 assembly (clang, -O0):
<SteamAPI_ReleaseCurrentThreadMemory>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee4(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SteamAPI_ReleaseCurrentThreadMemory>:
lea    0xee9(%rip),%rdi
lea    0xee8(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s()\0A\00"
@__func__.SteamAPI_ReleaseCurrentThreadMemory = [36 x i8] c"SteamAPI_ReleaseCurrentThreadMemory\00"
define void @SteamAPI_ReleaseCurrentThreadMemory() {
%1 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @__func__.SteamAPI_ReleaseCurrentThreadMemory, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s()\0A\00"
@__func__.SteamAPI_ReleaseCurrentThreadMemory = [36 x i8] c"SteamAPI_ReleaseCurrentThreadMemory\00"
define void @SteamAPI_ReleaseCurrentThreadMemory() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @__func__.SteamAPI_ReleaseCurrentThreadMemory, i64 0, i64 0))
ret void
}
void jump_start(void *init, void *exit_func, void *entry) {
  register long esp __asm__("esp") = (long)init;
  register long edx __asm__("edx") = (long)exit_func;
  __asm__ __volatile__("jmp *%0\n" : : "r"(entry), "r"(esp), "r"(edx) :);
}


x86 assembly (clang, -O0):
<jump_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    %rcx,%rsp
jmp    *%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jump_start>:
mov    %rdx,%rax
mov    %rsi,%rdx
mov    %rdi,%rsp
jmp    *%rax
ret

LLVM IR (-O0):
define void @jump_start(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
store i64 %10, i64* %7
%11 = load i8*, i8** %5
%12 = ptrtoint i8* %11 to i64
store i64 %12, i64* %8
%13 = load i8*, i8** %6
%14 = load i64, i64* %7
%15 = load i64, i64* %8
ret void
}

LLVM IR (-O2):
define void @jump_start(i8* %0, i8* %1, i8* %2) {
%4 = ptrtoint i8* %0 to i64
%5 = ptrtoint i8* %1 to i64
tail call void asm sideeffect "jmp *$0\0A", "r,{esp},{edx},~{dirflag},~{fpsr},~{flags}"(i8* %2, i64 %4, i64 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PF_INET6;
int /*<<< orphan*/ SOCK_STREAM;
int reflect_6(int /*<<< orphan*/, int /*<<< orphan*/);
int reflect_tcp6(void) { return (reflect_6(PF_INET6, SOCK_STREAM)); }


x86 assembly (clang, -O0):
<reflect_tcp6>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
call   1030 <reflect_6@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reflect_tcp6>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
jmp    1030 <reflect_6@plt>

LLVM IR (-O0):
@PF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
define i32 @reflect_tcp6() {
%1 = load i32, i32* @PF_INET6
%2 = load i32, i32* @SOCK_STREAM
%3 = call i32 @reflect_6(i32 %1, i32 %2)
ret i32 %3
}

LLVM IR (-O2):
@PF_INET6 = global i32 0
@SOCK_STREAM = global i32 0
define i32 @reflect_tcp6() {
%1 = load i32, i32* @PF_INET6
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @reflect_6(i32 %1, i32 %2)
ret i32 %3
}
/* Variables and functions */
scalar_t__ f(char *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i = 2;
  i -= f("ABDGK" + 1);
  printf("%d", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
lea    0xec3(%rip),%rdi
add    $0x1,%rdi
call   1030 <f@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed9(%rip),%rdi
call   1030 <f@plt>
mov    $0x2,%esi
sub    %eax,%esi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"ABDGK\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i64 @f(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 1))
%2 = trunc i64 %1 to i32
%3 = sub i32 2, %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ reverseWords(char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char const *argv[]) {
  char data[] = "   a    b ";
  char *s = data;
  reverseWords(s);
  printf("%s %lu\n", s, strlen(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x1b(%rbp)
mov    0xeb0(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xea8(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x1b(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <reverseWords@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x2020202061202020,%rax
20 20 20
mov    %rax,(%rsp)
movl   $0x206220,0x7(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <reverseWords@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xea6(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.data = [11 x i8] c" a b \00"
@.str = [8 x i8] c"%s %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [11 x i8]
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%5 = call i32 @reverseWords(i8* %4)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char const *);
int main(int argc, const char *argv[]) {
  int i;
  for (i = 0; i < argc; ++i) {
    printf("%d: %s\n", i, argv[i]);
  }
  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)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1162 <main+0x52>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <main+0x37>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32, i32* %6
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %7
22: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 0
}
int wait_for_b(void) { return -1; }


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

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

LLVM IR (-O0):
define i32 @wait_for_b() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @wait_for_b() {
ret i32 -1
}
int victor(int x) { return x + x; }


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

x86 assembly (clang, -O2):
<victor>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @victor(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
int do_247() { return 247; }


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

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

LLVM IR (-O0):
define i32 @do_247() {
ret i32 247
}

LLVM IR (-O2):
define i32 @do_247() {
ret i32 247
}
int checkname(char *s) {
  while (*s)
    s++;
  if (*--s != 'c')
    return (0);
  if (*--s != '.')
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<checkname>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1126 <checkname+0x26>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <checkname+0x8>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x63,%eax
je     114e <checkname+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    117d <checkname+0x7d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movsbl -0x1(%rax),%eax
cmp    $0x2e,%eax
je     1176 <checkname+0x76>
movl   $0x0,-0x4(%rbp)
jmp    117d <checkname+0x7d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkname>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <checkname>
xor    %eax,%eax
cmpb   $0x63,-0x2(%rdi)
jne    111a <checkname+0x1a>
xor    %eax,%eax
cmpb   $0x2e,-0x3(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @checkname(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 -1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 99
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %3, i64 -2
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 46
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %11, %7
%17 = phi i32 [ 0, %7 ], [ %15, %11 ]
ret i32 %17
}
/* Variables and functions */
int fast_inv_sqrt(float);
float fast_sqrt(float n) { return 1 / fast_inv_sqrt(n); }


x86 assembly (clang, -O0):
<fast_sqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fast_inv_sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_sqrt>:
push   %rax
call   1030 <fast_inv_sqrt@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovb  %eax,%edx
xorps  %xmm0,%xmm0
cvtsi2ss %edx,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fast_sqrt(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @fast_inv_sqrt(float %3)
%5 = sdiv i32 1, %4
%6 = sitofp i32 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @fast_sqrt(float %0) {
%2 = tail call i32 @fast_inv_sqrt(float %0)
%3 = add i32 %2, 1
%4 = icmp ult i32 %3, 3
%5 = select i1 %4, i32 %2, i32 0
%6 = sitofp i32 %5 to float
ret float %6
}
int fun291() { return 291; }


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

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

LLVM IR (-O0):
define i32 @fun291() {
ret i32 291
}

LLVM IR (-O2):
define i32 @fun291() {
ret i32 291
}
void ff_hevc_put_hevc_bi_w_epel_h32_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_epel_h32_10_sse4() {
ret void
}
void free_toktable2_db(struct toktable2_db *x) {}


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

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

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

LLVM IR (-O2):
%struct.toktable2_db = type opaque
define void @free_toktable2_db(%struct.toktable2_db* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gmix_column(unsigned char *);
void mix_column(unsigned char *state) {
  for (int i = 0; i < 4; ++i)
    gmix_column(state + (i * 4));
}


x86 assembly (clang, -O0):
<mix_column>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    114f <mix_column+0x3f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rdi
call   1030 <gmix_column@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <mix_column+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mix_column>:
push   %rbx
mov    %rdi,%rbx
call   1030 <gmix_column@plt>
lea    0x4(%rbx),%rdi
call   1030 <gmix_column@plt>
lea    0x8(%rbx),%rdi
call   1030 <gmix_column@plt>
add    $0xc,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <gmix_column@plt>

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

LLVM IR (-O2):
define void @mix_column(i8* %0) {
%2 = tail call i32 @gmix_column(i8* %0)
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = tail call i32 @gmix_column(i8* %3)
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = tail call i32 @gmix_column(i8* %5)
%7 = getelementptr inbounds i8, i8* %0, i64 12
%8 = tail call i32 @gmix_column(i8* %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void use_magic_num(int magic_num) {
  printf("bar.c : magic number is %d \n", magic_num);
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"bar.c : magic number is %d \0A\00"
define void @use_magic_num(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"bar.c : magic number is %d \0A\00"
define void @use_magic_num(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ next_generation(char, char, int);
int main() {
  int length;
  char current[20], next[20];
  next_generation(current[20], next[20], length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%cl
mov    -0x2c(%rbp),%al
mov    -0x8(%rbp),%edx
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <next_generation@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <next_generation@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
store i32 0, i32* %1
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 20
%6 = load i8, i8* %5
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 20
%8 = load i8, i8* %7
%9 = load i32, i32* %2
%10 = call i32 @next_generation(i8 signext %6, i8 signext %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @next_generation(i8 signext poison, i8 signext poison, i32 undef)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SHAMD5IntClear(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;

  ;
  (*((volatile uint32_t *)(ui32Base + 0xFFFFC01C))) =
      (((ui32IntFlags & 0x00010000) >> 14) |
       ((ui32IntFlags & 0x00020000) >> 16) |
       ((ui32IntFlags & 0x00040000) >> 19));
}


x86 assembly (clang, -O0):
<SHAMD5IntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0x10000,%ecx
sar    $0xe,%ecx
mov    -0x8(%rbp),%eax
and    $0x20000,%eax
sar    $0x10,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%eax
and    $0x40000,%eax
sar    $0x13,%eax
or     %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0xffffc01c,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAMD5IntClear>:
mov    %esi,%eax
shr    $0xe,%eax
and    $0x4,%eax
shr    $0x10,%esi
and    $0x2,%esi
or     %eax,%esi
add    $0xffffc01c,%edi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @SHAMD5IntClear(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 = and i32 %5, 65536
%7 = ashr i32 %6, 14
%8 = load i32, i32* %4
%9 = and i32 %8, 131072
%10 = ashr i32 %9, 16
%11 = or i32 %7, %10
%12 = load i32, i32* %4
%13 = and i32 %12, 262144
%14 = ashr i32 %13, 19
%15 = or i32 %11, %14
%16 = load i32, i32* %3
%17 = add i32 %16, -16356
%18 = zext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
store volatile i32 %15, i32* %19
ret void
}

LLVM IR (-O2):
define void @SHAMD5IntClear(i32 %0, i32 %1) {
%3 = lshr i32 %1, 14
%4 = and i32 %3, 4
%5 = lshr i32 %1, 16
%6 = and i32 %5, 2
%7 = or i32 %4, %6
%8 = add i32 %0, -16356
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %7, i32* %10
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef int uint16_t;

/* Variables and functions */
int ncr53c8xx_ram_readb(scalar_t__, void *);
uint16_t ncr53c8xx_ram_readw(uint32_t addr, void *p) {
  uint16_t val;
  val = ncr53c8xx_ram_readb(addr, p);
  val |= ncr53c8xx_ram_readb(addr + 1, p) << 8;
  return val;
}


x86 assembly (clang, -O0):
<ncr53c8xx_ram_readw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
shl    $0x8,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncr53c8xx_ram_readw>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <ncr53c8xx_ram_readb@plt>
mov    %eax,%ebp
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
shl    $0x8,%eax
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ncr53c8xx_ram_readw(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i32
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = load i64, i64* %3
%7 = load i8*, i8** %4
%8 = call i32 @ncr53c8xx_ram_readb(i64 %6, i8* %7)
store i32 %8, i32* %5
%9 = load i64, i64* %3
%10 = add nsw i64 %9, 1
%11 = load i8*, i8** %4
%12 = call i32 @ncr53c8xx_ram_readb(i64 %10, i8* %11)
%13 = shl i32 %12, 8
%14 = load i32, i32* %5
%15 = or i32 %14, %13
store i32 %15, i32* %5
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
define i32 @ncr53c8xx_ram_readw(i64 %0, i8* %1) {
%3 = tail call i32 @ncr53c8xx_ram_readb(i64 %0, i8* %1)
%4 = add nsw i64 %0, 1
%5 = tail call i32 @ncr53c8xx_ram_readb(i64 %4, i8* %1)
%6 = shl i32 %5, 8
%7 = or i32 %6, %3
ret i32 %7
}
void rop3_141_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = T ^ S;
  stk2 = *D | stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_141_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_141_0_0>:
xor    %esi,%edx
or     (%rdi),%dl
xor    %sil,%dl
not    %dl
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_141_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = xor i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %9
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = xor i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = trunc i32 %31 to i8
store i8 %32, i8* %7
%33 = load i8, i8* %7
%34 = load i8*, i8** %4
store i8 %33, i8* %34
ret void
}

LLVM IR (-O2):
define void @rop3_141_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %2, %1
%5 = load i8, i8* %0
%6 = or i8 %5, %4
%7 = xor i8 %6, %1
%8 = xor i8 %7, -1
store i8 %8, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_UNBLOCK;
int /*<<< orphan*/ sigfillset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
void unblock_signals(void) {
  sigset_t mask;
  sigfillset(&mask);
  sigprocmask(SIG_UNBLOCK, &mask, NULL);
}


x86 assembly (clang, -O0):
<unblock_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <sigfillset@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unblock_signals>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sigfillset@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIG_UNBLOCK = global i32 0
define void @unblock_signals() {
%1 = alloca i32
%2 = call i32 @sigfillset(i32* %1)
%3 = load i32, i32* @SIG_UNBLOCK
%4 = call i32 @sigprocmask(i32 %3, i32* %1, i32* null)
ret void
}

LLVM IR (-O2):
@SIG_UNBLOCK = global i32 0
define void @unblock_signals() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigfillset(i32* %1)
%4 = load i32, i32* @SIG_UNBLOCK
%5 = call i32 @sigprocmask(i32 %4, i32* %1, i32* null)
ret void
}
/* Variables and functions */
int syscall3(int, int, int, int);
int write(int file, const char *s, int numChars) {
  return syscall3(4, file, (int)s, numChars);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
mov    $0x4,%edi
call   1030 <syscall3@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x4,%edi
jmp    1030 <syscall3@plt>

LLVM IR (-O0):
define i32 @write(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 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = ptrtoint i8* %8 to i32
%10 = load i32, i32* %6
%11 = call i32 @syscall3(i32 4, i32 %7, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @write(i32 %0, i8* %1, i32 %2) {
%4 = ptrtoint i8* %1 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @syscall3(i32 4, i32 %0, i32 %5, i32 %2)
ret i32 %6
}
int test1(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @test1() {
ret i32 0
}

LLVM IR (-O2):
define i32 @test1() {
ret i32 0
}
long long f(unsigned *a, unsigned *b, int *c) {
  long long d = (((unsigned long long)*a) * *b);
  return d;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
imul   %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    (%rdi),%ecx
mov    (%rsi),%eax
imul   %rcx,%rax
ret

LLVM IR (-O0):
define i64 @f(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = zext i32 %9 to i64
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = zext i32 %12 to i64
%14 = mul i64 %10, %13
store i64 %14, i64* %7
%15 = load i64, i64* %7
ret i64 %15
}

LLVM IR (-O2):
define i64 @f(i32* nocapture %0, i32* nocapture %1, i32* nocapture readnone %2) {
%4 = load i32, i32* %0
%5 = zext i32 %4 to i64
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = mul nuw i64 %7, %5
ret i64 %8
}
long malloc2(unsigned sz) {
  static char buf[256];
  static char *pos;
  char *ret;
  if (!pos)
    pos = buf;
  ret = pos;
  pos += sz;
  return (long)ret;
}


x86 assembly (clang, -O0):
<malloc2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpq   $0x0,0x3021(%rip)
jne    1123 <malloc2+0x23>
lea    0x2f14(%rip),%rax
mov    %rax,0x300d(%rip)
mov    0x3006(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    0x2ff8(%rip),%rax
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,0x2fec(%rip)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc2>:
mov    0x3029(%rip),%rcx
test   %rcx,%rcx
lea    0x2f1f(%rip),%rax
cmovne %rcx,%rax
mov    %edi,%ecx
add    %rax,%rcx
mov    %rcx,0x300f(%rip)
ret

LLVM IR (-O0):
@malloc2.buf = internal global [256 x i8] zeroinitializer
@malloc2.pos = internal global i8* null
define i64 @malloc2(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i8*, i8** @malloc2.pos
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @malloc2.buf, i64 0, i64 0), i8** @malloc2.pos
br label %7
7: ; preds = %6, %1
%8 = load i8*, i8** @malloc2.pos
store i8* %8, i8** %3
%9 = load i32, i32* %2
%10 = load i8*, i8** @malloc2.pos
%11 = zext i32 %9 to i64
%12 = getelementptr inbounds i8, i8* %10, i64 %11
store i8* %12, i8** @malloc2.pos
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %13 to i64
ret i64 %14
}

LLVM IR (-O2):
@malloc2.buf = internal global [256 x i8] zeroinitializer
@malloc2.pos = internal unnamed_addr global i8* null
define i64 @malloc2(i32 %0) {
%2 = load i8*, i8** @malloc2.pos
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @malloc2.buf, i64 0, i64 0), i8* %2
%5 = zext i32 %0 to i64
%6 = getelementptr inbounds i8, i8* %4, i64 %5
store i8* %6, i8** @malloc2.pos
%7 = ptrtoint i8* %4 to i64
ret i64 %7
}
double f(double *x) { return (*x) / (1 + (*x) * (*x)); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xed4(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movsd  (%rdi),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeec(%rip),%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = load double, double* %3
%5 = load double*, double** %2
%6 = load double, double* %5
%7 = load double*, double** %2
%8 = load double, double* %7
%9 = call double @llvm.fmuladd.f64(double %6, double %8, double 1.000000e+00)
%10 = fdiv double %4, %9
ret double %10
}

LLVM IR (-O2):
define double @f(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double %2, double 1.000000e+00)
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int strcmp(char *, char *);
int pid_compare(char *t1, char *t2) { return strcmp(t1, t2); }


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

x86 assembly (clang, -O2):
<pid_compare>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @pid_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
int Reduced_Naive_TableSize(int bw, int m) {
  int i, sum;
  sum = 0;
  for (i = m; i < bw; i++)
    sum += (2 * bw * (bw - i));
  return sum;
}


x86 assembly (clang, -O0):
<Reduced_Naive_TableSize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1146 <Reduced_Naive_TableSize+0x46>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
sub    -0xc(%rbp),%ecx
imul   %ecx,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <Reduced_Naive_TableSize+0x17>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Reduced_Naive_TableSize>:
xor    %eax,%eax
cmp    %edi,%esi
jge    1131 <Reduced_Naive_TableSize+0x31>
lea    (%rdi,%rdi,1),%eax
mov    %esi,%ecx
not    %ecx
add    %edi,%ecx
sub    %esi,%eax
sub    %esi,%eax
add    $0xfffffffe,%eax
imul   %ecx,%eax
lea    (%rax,%rdi,2),%eax
mov    %edi,%edx
sub    %esi,%edx
add    $0xfffffffe,%edx
imul   %ecx,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rsi,2),%ecx
sub    %ecx,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @Reduced_Naive_TableSize(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, %0
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = shl i32 %0, 1
%6 = xor i32 %1, -1
%7 = add i32 %6, %0
%8 = add i32 %5, -2
%9 = shl i32 %1, 1
%10 = sub i32 %8, %9
%11 = mul i32 %7, %10
%12 = add i32 %11, %5
%13 = add i32 %0, -2
%14 = sub i32 %13, %1
%15 = mul i32 %7, %14
%16 = and i32 %15, -2
%17 = add i32 %9, %16
%18 = sub i32 %12, %17
%19 = mul i32 %18, %0
br label %20
20: ; preds = %4, %2
%21 = phi i32 [ 0, %2 ], [ %19, %4 ]
ret i32 %21
}
/* Variables and functions */
int /*<<< orphan*/ TIOCLINUX;
scalar_t__ ioctl(int, int /*<<< orphan*/, char *);
int setconsole(int fd, int vt) {
  char bytes[2] = {11, 0};
  bytes[1] = (char)vt;
  if (ioctl(fd, TIOCLINUX, bytes) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<setconsole>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0xedb(%rip),%ax
mov    %ax,-0xe(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
lea    -0xe(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    115a <setconsole+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1161 <setconsole+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setconsole>:
push   %rax
movw   $0xb,0x6(%rsp)
mov    %sil,0x7(%rsp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
lea    0x6(%rsp),%rdx
call   1030 <ioctl@plt>
sar    $0x3f,%rax
pop    %rcx
ret

LLVM IR (-O0):
@__const.setconsole.bytes = [2 x i8] c"\0B\00"
@TIOCLINUX = global i32 0
define i32 @setconsole(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = bitcast [2 x i8]* %6 to i8*
%8 = load i32, i32* %5
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
store i8 %9, i8* %10
%11 = load i32, i32* %4
%12 = load i32, i32* @TIOCLINUX
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%14 = call i64 @ioctl(i32 %11, i32 %12, i8* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 -1, i32* %3
br label %18
17: ; preds = %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@TIOCLINUX = global i32 0
define i32 @setconsole(i32 %0, i32 %1) {
%3 = alloca i16
%4 = bitcast i16* %3 to [2 x i8]*
%5 = bitcast i16* %3 to i8*
store i16 11, i16* %3
%6 = trunc i32 %1 to i8
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %6, i8* %7
%8 = load i32, i32* @TIOCLINUX
%9 = call i64 @ioctl(i32 %0, i32 %8, i8* %5)
%10 = ashr i64 %9, 63
%11 = trunc i64 %10 to i32
ret i32 %11
}
int smp_id(void) {
  unsigned id;
  asm("mov %%gs:0, %0" : "=r"(id));
  return id;
}


x86 assembly (clang, -O0):
<smp_id>:
push   %rbp
mov    %rsp,%rbp
mov    %gs:0x0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smp_id>:
mov    %gs:0x0,%eax
ret

LLVM IR (-O0):
define i32 @smp_id() {
%1 = alloca i32
%2 = call i32 asm "mov %gs:0, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @smp_id() {
%1 = tail call i32 asm "mov %gs:0, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i32 %1
}
void draw_pixel(int x, int y, int color) {
  volatile int *pixel_buffer =
      (volatile int *)(0x08000000 + (y << 10) + (x << 1));
  *(pixel_buffer) = color;
}


x86 assembly (clang, -O0):
<draw_pixel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0xa,%eax
add    $0x8000000,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_pixel>:
shl    $0xa,%esi
lea    (%rsi,%rdi,2),%eax
add    $0x8000000,%eax
cltq
mov    %edx,(%rax)
ret

LLVM IR (-O0):
define void @draw_pixel(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
%8 = load i32, i32* %5
%9 = shl i32 %8, 10
%10 = add nsw i32 134217728, %9
%11 = load i32, i32* %4
%12 = shl i32 %11, 1
%13 = add nsw i32 %10, %12
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %7
%16 = load i32, i32* %6
%17 = load i32*, i32** %7
store volatile i32 %16, i32* %17
ret void
}

LLVM IR (-O2):
define void @draw_pixel(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 10
%5 = shl i32 %0, 1
%6 = add i32 %5, 134217728
%7 = add i32 %6, %4
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store volatile i32 %2, i32* %9
ret void
}
/* Variables and functions */
void cpzero(char **a, int n) {
  int i;
  for (i = 0; i < n; ++i) {
    a[i] = NULL;
  }
}


x86 assembly (clang, -O0):
<cpzero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <cpzero+0x3c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <cpzero+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpzero>:
test   %esi,%esi
jle    1126 <cpzero+0x16>
push   %rax
mov    %esi,%edx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @cpzero(i8** nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i8** %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 3
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ eprintf(char *);
void show_help() {
  eprintf("|Usage: t[-LCvsdfm?] [...]\n"
          "| t                      list all loaded types\n"
          "| t*                     list types info in r2 commands\n"
          "| t- [name]              delete type by its name.\n"
          "| t-*                    remove all types\n"
          "| t [type]               show given type in 'pf' syntax\n"
          "| to [path]              load types from C header file\n"
          "| to -                   open cfg.editor to load types\n"
          "| td int foo(int a)      parse oneliner type definition\n"
          "| td-foo                 undefine type 'foo'\n"
          "| tf addr                view linked type at given address\n"
          "| ts k=v k=v @ link.addr set fields at given linked type\n"
          "| tl [type] ([addr])     show show / link type to a address\n");
}


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

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

LLVM IR (-O0):
@.str = [666 x i8] c"|Usage: t[-LCvsdfm?] [...]\0A| t list all loaded types\0A| t* list types info in r2 commands\0A| t- [name] delete type by its name.\0A| t-* remove all types\0A| t [type] show given type in 'pf' syntax\0A| to [path] load types from C header file\0A| to - open cfg.editor to load types\0A| td int foo(int a) parse oneliner type definition\0A| td-foo undefine type 'foo'\0A| tf addr view linked type at given address\0A| ts k=v k=v @ link.addr set fields at given linked type\0A| tl [type] ([addr]) show show / link type to a address\0A\00"
define void @show_help() {
%1 = call i32 @eprintf(i8* getelementptr inbounds ([666 x i8], [666 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [666 x i8] c"|Usage: t[-LCvsdfm?] [...]\0A| t list all loaded types\0A| t* list types info in r2 commands\0A| t- [name] delete type by its name.\0A| t-* remove all types\0A| t [type] show given type in 'pf' syntax\0A| to [path] load types from C header file\0A| to - open cfg.editor to load types\0A| td int foo(int a) parse oneliner type definition\0A| td-foo undefine type 'foo'\0A| tf addr view linked type at given address\0A| ts k=v k=v @ link.addr set fields at given linked type\0A| tl [type] ([addr]) show show / link type to a address\0A\00"
define void @show_help() {
%1 = tail call i32 @eprintf(i8* getelementptr inbounds ([666 x i8], [666 x i8]* @.str, i64 0, i64 0))
ret void
}