xunge/DecIR huggingface dataset:
void Log(const char *msg) {}


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

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

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

LLVM IR (-O2):
define void @Log(i8* nocapture %0) {
ret void
}
int musbgm_stopall(int time) {
  printf("%s not implemented\n", __func__);
  return (-1);
}


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

x86 assembly (clang, -O2):
<musbgm_stopall>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xef5(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%s not implemented\0A\00"
@__func__.musbgm_stopall = [15 x i8] c"musbgm_stopall\00"
define i32 @musbgm_stopall(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.musbgm_stopall, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [20 x i8] c"%s not implemented\0A\00"
@__func__.musbgm_stopall = [15 x i8] c"musbgm_stopall\00"
define i32 @musbgm_stopall(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.musbgm_stopall, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char **, char **);
int /*<<< orphan*/ stdin;
int main() {
  char roo[2];
  char knight[2];
  fflush(stdin);
  scanf("%s%s", &roo, &knight);
  printf("%s", roo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    -0x6(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    0xea4(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x6(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xeb6(%rip),%rdi
lea    0xe(%rsp),%rbx
lea    0xc(%rsp),%rdx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xe9f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = alloca [2 x i8]
store i32 0, i32* %1
%4 = load i32, i32* @stdin
%5 = call i32 @fflush(i32 %4)
%6 = bitcast [2 x i8]* %2 to i8**
%7 = bitcast [2 x i8]* %3 to i8**
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6, i8** %7)
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [2 x i8]
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = tail call i32 @fflush(i32 %5)
%7 = bitcast [2 x i8]* %1 to i8**
%8 = bitcast [2 x i8]* %2 to i8**
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %7, i8** %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}
int execute_profil() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_profil() {
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long root;
};
typedef TYPE_1__ XButtonEvent;

/* Variables and functions */
void set_XButtonEvent_root(void *_p, unsigned long _v) {
  ((XButtonEvent *)_p)->root = (unsigned long)_v;
}


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

x86 assembly (clang, -O2):
<set_XButtonEvent_root>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XButtonEvent_root(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XButtonEvent_root(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Type definitions */
typedef scalar_t__ ssize_t;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
scalar_t__ write(int, void const *, size_t);
ssize_t utils_safe_write(int fd, const void *buf, size_t count) {
  ssize_t n;
  do {
    n = write(fd, buf, count);
  } while (n < 0 && errno == EINTR);
  return n;
}


x86 assembly (clang, -O0):
<utils_safe_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
jge    1161 <utils_safe_write+0x51>
mov    0x2e92(%rip),%rax
mov    (%rax),%rax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1123 <utils_safe_write+0x13>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utils_safe_write>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <write@plt>
test   %rax,%rax
jns    114b <utils_safe_write+0x3b>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <utils_safe_write+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i64 @utils_safe_write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = call i64 @write(i32 %9, i8* %10, i64 %11)
store i64 %12, i64* %7
br label %13
13: ; preds = %8
%14 = load i64, i64* %7
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* @errno
%18 = load i64, i64* @EINTR
%19 = icmp eq i64 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
%23 = load i64, i64* %7
ret i64 %23
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i64 @utils_safe_write(i32 %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i64 @write(i32 %0, i8* %1, i64 %2)
%6 = icmp slt i64 %5, 0
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i64 %5
}
/* Variables and functions */
long syscall(int, unsigned int *, unsigned int *, void *);
long sys_getcpu(unsigned *cpu, unsigned *node, void *cache) {
  return syscall(309, cpu, node, cache);
}


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

x86 assembly (clang, -O2):
<sys_getcpu>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x135,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i64 @sys_getcpu(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i8*, i8** %6
%10 = call i64 @syscall(i32 309, i32* %7, i32* %8, i8* %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @sys_getcpu(i32* %0, i32* %1, i8* %2) {
%4 = tail call i64 @syscall(i32 309, i32* %0, i32* %1, i8* %2)
ret i64 %4
}
void session_info_destroy(struct session_info *si) {}


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

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

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

LLVM IR (-O2):
%struct.session_info = type opaque
define void @session_info_destroy(%struct.session_info* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parse_bind(char *);
int /*<<< orphan*/ show_binds(int);
char *skipspace(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void cmd_bind(char *arg) {
  arg = skipspace(arg);
  if (!*arg)
    show_binds(0);
  else if (!strcmp(arg, "edit"))
    show_binds(1);
  else
    parse_bind(arg);
}


x86 assembly (clang, -O0):
<cmd_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <skipspace@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1172 <cmd_bind+0x32>
xor    %edi,%edi
call   1040 <show_binds@plt>
jmp    11a8 <cmd_bind+0x68>
mov    -0x8(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    119a <cmd_bind+0x5a>
mov    $0x1,%edi
call   1040 <show_binds@plt>
jmp    11a3 <cmd_bind+0x63>
mov    -0x8(%rbp),%rdi
call   1030 <parse_bind@plt>
jmp    11a8 <cmd_bind+0x68>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_bind>:
push   %rbx
call   1060 <skipspace@plt>
cmpb   $0x0,(%rax)
je     116a <cmd_bind+0x2a>
mov    %rax,%rbx
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1172 <cmd_bind+0x32>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <parse_bind@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <show_binds@plt>
mov    $0x1,%edi
pop    %rbx
jmp    1040 <show_binds@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"edit\00"
define void @cmd_bind(i8* %0) {
%2 = tail call i8* @skipspace(i8* %0)
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @show_binds(i32 0)
br label %14
7: ; preds = %1
%8 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @show_binds(i32 1)
br label %14
12: ; preds = %7
%13 = tail call i32 @parse_bind(i8* %2)
br label %14
14: ; preds = %10, %12, %5
ret void
}
/* Type definitions */
typedef int const int32_t;

/* Variables and functions */
int32_t div(const int32_t a, const int32_t b) { return a / b; }


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

x86 assembly (clang, -O2):
<div>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @div(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 = sdiv i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @div(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_message_read(void *m, const char *types, ...) {
  return -EINVAL;
}


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

x86 assembly (clang, -O2):
<sd_bus_message_read>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_message_read(i8* %0, i8* %1, ...) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_message_read(i8* nocapture readnone %0, i8* nocapture readnone %1, ...) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
char *gu_str_table_append_size(char *, size_t *, size_t);
char *gu_str_table_set_n_cols(char *str, size_t *off, size_t n) {
  return gu_str_table_append_size(str, off, n);
}


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

x86 assembly (clang, -O2):
<gu_str_table_set_n_cols>:
jmp    1030 <gu_str_table_append_size@plt>

LLVM IR (-O0):
define i8* @gu_str_table_set_n_cols(i8* %0, i64* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64
store i8* %0, i8** %4
store i64* %1, i64** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64*, i64** %5
%9 = load i64, i64* %6
%10 = call i8* @gu_str_table_append_size(i8* %7, i64* %8, i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @gu_str_table_set_n_cols(i8* %0, i64* %1, i64 %2) {
%4 = tail call i8* @gu_str_table_append_size(i8* %0, i64* %1, i64 %2)
ret i8* %4
}
int owHasOverDrive(int portnum) {
  portnum = 0;
  return 1;
}


x86 assembly (clang, -O0):
<owHasOverDrive>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @owHasOverDrive(i32 %0) {
ret i32 1
}
CchFromSz(sz) char *sz;
{
  int cch = 0;
  while (*sz++ != '\0')
    cch++;
  return (cch);
}


x86 assembly (clang, -O0):
<CchFromSz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1138 <CchFromSz+0x38>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <CchFromSz+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CchFromSz>:
cmpb   $0x0,(%rdi)
je     111c <CchFromSz+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <CchFromSz+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @CchFromSz(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
long function(char t1[4]) { return t1 == "asdf"; }


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
cmp    %rax,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
lea    0xef9(%rip),%rcx
xor    %eax,%eax
cmp    %rcx,%rdi
sete   %al
ret

LLVM IR (-O0):
@.str = [5 x i8] c"asdf\00"
define i64 @function(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
%5 = zext i1 %4 to i32
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"asdf\00"
define i64 @function(i8* readnone %0) {
%2 = icmp eq i8* %0, getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
%3 = zext i1 %2 to i64
ret i64 %3
}
/* Variables and functions */
scalar_t__ fabs(double);
double fabs_max(double a, double b) {
  if (fabs(a) > fabs(b))
    return a;
  else
    return b;
}


x86 assembly (clang, -O0):
<fabs_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jle    1159 <fabs_max+0x49>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1163 <fabs_max+0x53>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs_max>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <fabs@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
call   1030 <fabs@plt>
movsd  0x8(%rsp),%xmm0
cmp    %rax,%rbx
jg     1142 <fabs_max+0x32>
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @fabs_max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = call i64 @fabs(double %6)
%8 = load double, double* %5
%9 = call i64 @fabs(double %8)
%10 = icmp sgt i64 %7, %9
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load double, double* %4
store double %12, double* %3
br label %15
13: ; preds = %2
%14 = load double, double* %5
store double %14, double* %3
br label %15
15: ; preds = %13, %11
%16 = load double, double* %3
ret double %16
}

LLVM IR (-O2):
define double @fabs_max(double %0, double %1) {
%3 = tail call i64 @fabs(double %0)
%4 = tail call i64 @fabs(double %1)
%5 = icmp sgt i64 %3, %4
%6 = select i1 %5, double %0, double %1
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ debug();
void cmd_debug(char *str) { debug(); }


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

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

LLVM IR (-O0):
define void @cmd_debug(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @debug()
ret void
}

LLVM IR (-O2):
define void @cmd_debug(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @debug()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int initialize_me(void *p) {
  puts("initializing!");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"initializing!\00"
define i32 @initialize_me(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"initializing!\00"
define i32 @initialize_me(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void parseScanCursorOrReply(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               96, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<parseScanCursorOrReply>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x60,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseScanCursorOrReply>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x60,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.parseScanCursorOrReply = [23 x i8] c"parseScanCursorOrReply\00"
define void @parseScanCursorOrReply() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 96, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__func__.parseScanCursorOrReply, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.parseScanCursorOrReply = [23 x i8] c"parseScanCursorOrReply\00"
define void @parseScanCursorOrReply() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 96, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__func__.parseScanCursorOrReply, i64 0, i64 0))
ret void
}
void sys_sanitize(char *s) {
  int i;
  for (i = 0; s[i]; i++)
    if (s[i] == '\\')
      s[i] = '/';
}


x86 assembly (clang, -O0):
<sys_sanitize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1155 <sys_sanitize+0x55>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    1142 <sys_sanitize+0x42>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
jmp    1147 <sys_sanitize+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <sys_sanitize+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_sanitize>:
jmp    1117 <sys_sanitize+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x2f,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x5c,%al
je     1110 <sys_sanitize+0x10>
test   %al,%al
jne    1113 <sys_sanitize+0x13>
ret

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

LLVM IR (-O2):
define void @sys_sanitize(i8* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i64 [ %8, %7 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %7 [
i8 0, label %9
i8 92, label %6
]
6: ; preds = %2
store i8 47, i8* %4
br label %7
7: ; preds = %2, %6
%8 = add nuw i64 %3, 1
br label %2
9: ; preds = %2
ret void
}
int arrLen(int *a) {
  int l = 0;
  while (*a++)
    l++;
  return l;
}


x86 assembly (clang, -O0):
<arrLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
cmpl   $0x0,(%rax)
je     1135 <arrLen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <arrLen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrLen>:
cmpl   $0x0,(%rdi)
je     111c <arrLen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpl   $0x0,0x4(%rdi,%rax,4)
lea    0x1(%rax),%rax
jne    1110 <arrLen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @arrLen(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
void dml_start_xfer(struct mmci_host *host, struct mmc_data *data) {}


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

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

LLVM IR (-O0):
%struct.mmci_host = type opaque
%struct.mmc_data = type opaque
define void @dml_start_xfer(%struct.mmci_host* %0, %struct.mmc_data* %1) {
%3 = alloca %struct.mmci_host*
%4 = alloca %struct.mmc_data*
store %struct.mmci_host* %0, %struct.mmci_host** %3
store %struct.mmc_data* %1, %struct.mmc_data** %4
ret void
}

LLVM IR (-O2):
%struct.mmci_host = type opaque
%struct.mmc_data = type opaque
define void @dml_start_xfer(%struct.mmci_host* nocapture %0, %struct.mmc_data* nocapture %1) {
ret void
}
int globalvar_add(const char *name,
                  int (*set)(struct device_d *dev, struct param_d *p,
                             const char *val),
                  const char *(*get)(struct device_d *, struct param_d *p),
                  unsigned long flags) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.device_d = type opaque
%struct.param_d = type opaque
%struct.device_d.0 = type opaque
%struct.param_d.1 = type opaque
define i32 @globalvar_add(i8* %0, i32 (%struct.device_d*, %struct.param_d*, i8*)* %1, i8* (%struct.device_d.0*, %struct.param_d.1*)* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i32 (%struct.device_d*, %struct.param_d*, i8*)*
%7 = alloca i8* (%struct.device_d.0*, %struct.param_d.1*)*
%8 = alloca i64
store i8* %0, i8** %5
store i32 (%struct.device_d*, %struct.param_d*, i8*)* %1, i32 (%struct.device_d*, %struct.param_d*, i8*)** %6
store i8* (%struct.device_d.0*, %struct.param_d.1*)* %2, i8* (%struct.device_d.0*, %struct.param_d.1*)** %7
store i64 %3, i64* %8
ret i32 0
}

LLVM IR (-O2):
%struct.device_d = type opaque
%struct.param_d = type opaque
%struct.device_d.0 = type opaque
%struct.param_d.1 = type opaque
define i32 @globalvar_add(i8* nocapture readnone %0, i32 (%struct.device_d*, %struct.param_d*, i8*)* nocapture readnone %1, i8* (%struct.device_d.0*, %struct.param_d.1*)* nocapture readnone %2, i64 %3) {
ret i32 0
}
/* Type definitions */
struct hitstack_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct hitstack_s *);
scalar_t__ pop_hitstack(struct hitstack_s *, int *, int *, double *);
void free_hitstack(struct hitstack_s *hstack) {
  int left, right;
  double score;
  while (pop_hitstack(hstack, &left, &right, &score) != 0)
    ;
  free(hstack);
}


x86 assembly (clang, -O0):
<free_hitstack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <pop_hitstack@plt>
cmp    $0x0,%rax
je     1150 <free_hitstack+0x30>
jmp    112c <free_hitstack+0xc>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_hitstack>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%r12
nopl   (%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <pop_hitstack@plt>
test   %rax,%rax
jne    1140 <free_hitstack+0x20>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.hitstack_s = type { i32 }
define void @free_hitstack(%struct.hitstack_s* %0) {
%2 = alloca %struct.hitstack_s*
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store %struct.hitstack_s* %0, %struct.hitstack_s** %2
br label %6
6: ; preds = %10, %1
%7 = load %struct.hitstack_s*, %struct.hitstack_s** %2
%8 = call i64 @pop_hitstack(%struct.hitstack_s* %7, i32* %3, i32* %4, double* %5)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = load %struct.hitstack_s*, %struct.hitstack_s** %2
%13 = call i32 @free(%struct.hitstack_s* %12)
ret void
}

LLVM IR (-O2):
%struct.hitstack_s = type { i32 }
define void @free_hitstack(%struct.hitstack_s* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast double* %4 to i8*
br label %8
8: ; preds = %8, %1
%9 = call i64 @pop_hitstack(%struct.hitstack_s* %0, i32* %2, i32* %3, double* %4)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %8
11: ; preds = %8
%12 = call i32 @free(%struct.hitstack_s* %0)
ret void
}
int NameStartsWithA(const char *id, const char *name, int purchase) {
  if (*name == 'A')
    return purchase;
  else
    return 0;
}


x86 assembly (clang, -O0):
<NameStartsWithA>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jne    112a <NameStartsWithA+0x2a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1131 <NameStartsWithA+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NameStartsWithA>:
xor    %eax,%eax
cmpb   $0x41,(%rsi)
cmove  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @NameStartsWithA(i8* nocapture readnone %0, i8* nocapture %1, i32 %2) {
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 65
%6 = select i1 %5, i32 %2, i32 0
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ sub1();
int /*<<< orphan*/ sub2();
main() {
  sub1();
  sub2();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <sub1@plt>
mov    $0x0,%al
call   1030 <sub2@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @sub1()
%2 = call i32 (...) @sub2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @sub1()
%2 = tail call i32 (...) @sub2()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_bad_scalar();
int /*<<< orphan*/ test_ecdh_generator_basepoint();
void run_ecdh_tests(void) {
  test_ecdh_generator_basepoint();
  test_bad_scalar();
}


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

x86 assembly (clang, -O2):
<run_ecdh_tests>:
push   %rax
xor    %eax,%eax
call   1030 <test_ecdh_generator_basepoint@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <test_bad_scalar@plt>

LLVM IR (-O0):
define void @run_ecdh_tests() {
%1 = call i32 (...) @test_ecdh_generator_basepoint()
%2 = call i32 (...) @test_bad_scalar()
ret void
}

LLVM IR (-O2):
define void @run_ecdh_tests() {
%1 = tail call i32 (...) @test_ecdh_generator_basepoint()
%2 = tail call i32 (...) @test_bad_scalar()
ret void
}
int *ptr(int *p) { return p; }


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

x86 assembly (clang, -O2):
<ptr>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i32* @ptr(i32* readnone returned %0) {
ret i32* %0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ testSelectionSort();
int main(void) {
  testSelectionSort();
  return EXIT_SUCCESS;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <testSelectionSort@plt>
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @testSelectionSort()
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
const char *Show_Name(void) { return "Show"; }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"Show\00"
define i8* @Show_Name() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [5 x i8] c"Show\00"
define i8* @Show_Name() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ triple(char *);
int main() {
  triple("/testbin/matmult");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"/testbin/matmult\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @triple(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"/testbin/matmult\00"
define i32 @main() {
%1 = tail call i32 @triple(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int hash_str(char *key) {
  int hash = 0;
  char *cur = key;
  while (*(cur++) != '\0') {
    hash += *cur;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1144 <hash_str+0x44>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <hash_str+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_str>:
cmpb   $0x0,(%rdi)
je     111e <hash_str+0x1e>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movsbl (%rdi),%ecx
add    %ecx,%eax
add    $0x1,%rdi
test   %ecx,%ecx
jne    1110 <hash_str+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %7, %4 ], [ %0, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = add nsw i32 %6, %9
%11 = icmp eq i8 %8, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void fail_and_notify(void) {
  fprintf(stderr, "Allocation of memory for json object failed, aborting.\n");
  abort();
}


x86 assembly (clang, -O0):
<fail_and_notify>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"Allocation of memory for json object failed, aborting.\0A\00"
define void @fail_and_notify() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"Allocation of memory for json object failed, aborting.\0A\00"
define void @fail_and_notify() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}
int priority(char c) {
  if (c == '+' || c == '-')
    return 0;
  if (c == '*' || c == '/' || c == '%')
    return 1;
  if (c == '^')
    return 2;
  if (c == '(')
    return 3;
  return -1;
}


x86 assembly (clang, -O0):
<priority>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
je     1124 <priority+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    1130 <priority+0x30>
movl   $0x0,-0x4(%rbp)
jmp    119c <priority+0x9c>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     1157 <priority+0x57>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
je     1157 <priority+0x57>
movsbl -0x5(%rbp),%eax
cmp    $0x25,%eax
jne    1163 <priority+0x63>
movl   $0x1,-0x4(%rbp)
jmp    119c <priority+0x9c>
movsbl -0x5(%rbp),%eax
cmp    $0x5e,%eax
jne    117c <priority+0x7c>
movl   $0x2,-0x4(%rbp)
jmp    119c <priority+0x9c>
movsbl -0x5(%rbp),%eax
cmp    $0x28,%eax
jne    1195 <priority+0x95>
movl   $0x3,-0x4(%rbp)
jmp    119c <priority+0x9c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<priority>:
add    $0xdb,%dil
cmp    $0x39,%dil
ja     1126 <priority+0x26>
xor    %eax,%eax
movzbl %dil,%ecx
lea    0xee9(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%eax
ret
mov    $0xffffffff,%eax
ret
mov    $0x3,%eax
ret
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @priority(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 43
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 45
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 0, i32* %2
br label %36
12: ; preds = %7
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 42
br i1 %15, label %24, label %16
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 47
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 37
br i1 %23, label %24, label %25
24: ; preds = %20, %16, %12
store i32 1, i32* %2
br label %36
25: ; preds = %20
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 94
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 2, i32* %2
br label %36
30: ; preds = %25
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 40
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 3, i32* %2
br label %36
35: ; preds = %30
store i32 -1, i32* %2
br label %36
36: ; preds = %35, %34, %29, %24, %11
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
define i32 @priority(i8 signext %0) {
switch i8 %0, label %4 [
i8 45, label %6
i8 43, label %6
i8 47, label %5
i8 42, label %5
i8 37, label %5
i8 94, label %2
i8 40, label %3
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1, %1, %1
br label %6
6: ; preds = %1, %1, %5, %4, %3, %2
%7 = phi i32 [ 2, %2 ], [ 3, %3 ], [ -1, %4 ], [ 0, %1 ], [ 0, %1 ], [ 1, %5 ]
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ __syscall_umask(int /*<<< orphan*/);
mode_t umask(mode_t mode) { return (__syscall_umask(mode)); }


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

x86 assembly (clang, -O2):
<umask>:
jmp    1030 <__syscall_umask@plt>

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

LLVM IR (-O2):
define i32 @umask(i32 %0) {
%2 = tail call i32 @__syscall_umask(i32 %0)
ret i32 %2
}
/* Variables and functions */
int portWrite(char *);
int set_TemmaStandbyState(int on) {
  if (on) {
    return portWrite("STN-ON");
  } else {
    return portWrite("STN-OFF");
  }
  return 0;
}


x86 assembly (clang, -O0):
<set_TemmaStandbyState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1139 <set_TemmaStandbyState+0x29>
lea    0xed4(%rip),%rdi
call   1030 <portWrite@plt>
mov    %eax,-0x4(%rbp)
jmp    1148 <set_TemmaStandbyState+0x38>
lea    0xec7(%rip),%rdi
call   1030 <portWrite@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_TemmaStandbyState>:
test   %edi,%edi
lea    0xeee(%rip),%rax
lea    0xee0(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <portWrite@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"STN-ON\00"
@.str.1 = [8 x i8] c"STN-OFF\00"
define i32 @set_TemmaStandbyState(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @portWrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %2
br label %10
8: ; preds = %1
%9 = call i32 @portWrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 %9, i32* %2
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@.str = [7 x i8] c"STN-ON\00"
@.str.1 = [8 x i8] c"STN-OFF\00"
define i32 @set_TemmaStandbyState(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
%4 = tail call i32 @portWrite(i8* %3)
ret i32 %4
}