xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "usage: pac [-Pprinter] [-pprice] [-s] [-c] [-r] [-m] [user ...]\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [65 x i8] c"usage: pac [-Pprinter] [-pprice] [-s] [-c] [-r] [-m] [user ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [65 x i8] c"usage: pac [-Pprinter] [-pprice] [-s] [-c] [-r] [-m] [user ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ IFF_PROMISC;
int set_if_flag(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int if_no_promisc(char *ifname) { return set_if_flag(ifname, IFF_PROMISC, 0); }


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

x86 assembly (clang, -O2):
<if_no_promisc>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <set_if_flag@plt>

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

LLVM IR (-O2):
@IFF_PROMISC = global i32 0
define i32 @if_no_promisc(i8* %0) {
%2 = load i32, i32* @IFF_PROMISC
%3 = tail call i32 @set_if_flag(i8* %0, i32 %2, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void rserror(char const *s) { fprintf(stderr, "%s\n", s); }


x86 assembly (clang, -O0):
<rserror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rserror>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @rserror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int syscall3(int, unsigned int, short);
int chmod(const char *path, short mode) {
  return syscall3(15, (unsigned int)path, mode);
}


x86 assembly (clang, -O0):
<chmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
mov    $0xf,%edi
movswl -0xa(%rbp),%edx
call   1030 <syscall3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chmod>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0xf,%edi
jmp    1030 <syscall3@plt>

LLVM IR (-O0):
define i32 @chmod(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i32
%7 = load i16, i16* %4
%8 = call i32 @syscall3(i32 15, i32 %6, i16 signext %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @chmod(i8* %0, i16 signext %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @syscall3(i32 15, i32 %4, i16 signext %1)
ret i32 %5
}
/* Variables and functions */
double exp(double);
double sqrt(int);
int q7(int tu) {
  double a = 97.34, b = -0.0139, c = -0.04917, q7;
  q7 = a * exp((b * tu) + (c * sqrt(tu)));
}


x86 assembly (clang, -O0):
<q7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x8(%rbp)
movsd  0xedd(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <sqrt@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q7>:
push   %rax
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm1
mulsd  0xec4(%rip),%xmm0
mulsd  0xec4(%rip),%xmm1
addsd  %xmm0,%xmm1
ucomisd 0xec0(%rip),%xmm1
ja     1162 <q7+0x42>
movsd  0xebe(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1162 <q7+0x42>
pop    %rcx
ret
movapd %xmm1,%xmm0
call   1030 <exp@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @q7(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %3
store double 9.734000e+01, double* %4
store double -1.390000e-02, double* %5
store double -4.917000e-02, double* %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = load i32, i32* %3
%11 = sitofp i32 %10 to double
%12 = load double, double* %6
%13 = load i32, i32* %3
%14 = call double @sqrt(i32 %13)
%15 = fmul double %12, %14
%16 = call double @llvm.fmuladd.f64(double %9, double %11, double %15)
%17 = call double @exp(double %16)
%18 = fmul double %8, %17
store double %18, double* %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @q7(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call double @sqrt(i32 %0)
%4 = fmul double %3, -4.917000e-02
%5 = tail call double @llvm.fmuladd.f64(double %2, double -1.390000e-02, double %4)
%6 = fcmp olt double %5, -7.450000e+02
%7 = fcmp ogt double %5, 7.090000e+02
%8 = or i1 %7, %6
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = tail call double @exp(double %5)
br label %11
11: ; preds = %1, %9
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void alarm_handler(int sig) {
  printf("signal %d caught\n", sig);
  exit(0);
}


x86 assembly (clang, -O0):
<alarm_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<alarm_handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"signal %d caught\0A\00"
define void @alarm_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"signal %d caught\0A\00"
define void @alarm_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ x_root;
};
typedef TYPE_1__ XEnterWindowEvent;

/* Variables and functions */
int get_XEnterWindowEvent_x_root(void *_p) {
  return (int)((XEnterWindowEvent *)_p)->x_root;
}


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

x86 assembly (clang, -O2):
<get_XEnterWindowEvent_x_root>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_XEnterWindowEvent_x_root(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int FiveTimes(int);
int /*<<< orphan*/ printf(char *, char *, int);
int main() {
  printf("%s : %d\n", "FiveTimes(1)", (FiveTimes(1)));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <FiveTimes@plt>
lea    0xece(%rip),%rdi
lea    0xed0(%rip),%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%s : %d\0A\00"
@.str.1 = [13 x i8] c"FiveTimes(1)\00"
define i32 @main() {
%1 = tail call i32 @FiveTimes(i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
scalar_t__ KIONIX_ACCEL_write_byte(int, int);
int KIONIX_ACCEL_wuf_thresh(int wuf_thresh) {
  int status;
  if (KIONIX_ACCEL_write_byte(0x5A, wuf_thresh) == 0) {
    status = 0;
  } else
    status = 1;
  return status;
}


x86 assembly (clang, -O0):
<KIONIX_ACCEL_wuf_thresh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x5a,%edi
call   1030 <KIONIX_ACCEL_write_byte@plt>
cmp    $0x0,%rax
jne    113e <KIONIX_ACCEL_wuf_thresh+0x2e>
movl   $0x0,-0x8(%rbp)
jmp    1145 <KIONIX_ACCEL_wuf_thresh+0x35>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KIONIX_ACCEL_wuf_thresh>:
push   %rax
mov    %edi,%esi
mov    $0x5a,%edi
call   1030 <KIONIX_ACCEL_write_byte@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @KIONIX_ACCEL_wuf_thresh(i32 %0) {
%2 = tail call i64 @KIONIX_ACCEL_write_byte(i32 90, i32 %0)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
long lseek(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, long);
int make_boot(int fd, int boot_size) {
  long int pos;
  pos = lseek(fd, boot_size, SEEK_SET);
  printf("Boot Block End == %ld\n", pos);
  return pos;
}


x86 assembly (clang, -O0):
<make_boot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
call   1040 <lseek@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_boot>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%edx
call   1040 <lseek@plt>
mov    %rax,%rbx
lea    0xec7(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [23 x i8] c"Boot Block End == %ld\0A\00"
define i32 @make_boot(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = load i32, i32* @SEEK_SET
%9 = call i64 @lseek(i32 %6, i32 %7, i32 %8)
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [23 x i8] c"Boot Block End == %ld\0A\00"
define i32 @make_boot(i32 %0, i32 %1) {
%3 = load i32, i32* @SEEK_SET
%4 = tail call i64 @lseek(i32 %0, i32 %1, i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = trunc i64 %4 to i32
ret i32 %6
}
void empty(struct pkt_buff *pkt __attribute__((__unused__))) {}


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

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

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

LLVM IR (-O2):
%struct.pkt_buff = type opaque
define void @empty(%struct.pkt_buff* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int uptime(void) {
  printf("uptime() not implemented\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<uptime>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<uptime>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"uptime() not implemented\0A\00"
define i32 @uptime() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [25 x i8] c"uptime() not implemented\00"
define i32 @uptime() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
void nvtx_pop_range(const char name[]) {}


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

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

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

LLVM IR (-O2):
define void @nvtx_pop_range(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dot(int, int, int, int);
void maru(int x, int y, int color) { dot(x, y, color, 10); }


x86 assembly (clang, -O0):
<maru>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0xa,%ecx
call   1030 <dot@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maru>:
mov    $0xa,%ecx
jmp    1030 <dot@plt>

LLVM IR (-O0):
define void @maru(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @dot(i32 %7, i32 %8, i32 %9, i32 10)
ret void
}

LLVM IR (-O2):
define void @maru(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @dot(i32 %0, i32 %1, i32 %2, i32 10)
ret void
}
const char *opj_version(void) { return "1.3.0"; }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"1.3.0\00"
define i8* @opj_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int string_hash(void *self, int seed, char *obj) {
  int hash = seed;
  while (*obj) {
    hash *= 31;
    hash += *obj;
    obj++;
  }
  return hash;
}


x86 assembly (clang, -O0):
<string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <string_hash+0x47>
imul   $0x1f,-0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1115 <string_hash+0x15>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_hash>:
mov    %esi,%eax
mov    (%rdx),%cl
test   %cl,%cl
je     1127 <string_hash+0x27>
add    $0x1,%rdx
nopl   0x0(%rax)
mov    %eax,%esi
shl    $0x5,%esi
sub    %eax,%esi
movsbl %cl,%eax
add    %esi,%eax
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <string_hash+0x10>
ret

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

LLVM IR (-O2):
define i32 @string_hash(i8* nocapture readnone %0, i32 %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %14, %6 ], [ %4, %3 ]
%8 = phi i32 [ %12, %6 ], [ %1, %3 ]
%9 = phi i8* [ %13, %6 ], [ %2, %3 ]
%10 = mul nsw i32 %8, 31
%11 = sext i8 %7 to i32
%12 = add nsw i32 %10, %11
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %3
%17 = phi i32 [ %1, %3 ], [ %12, %6 ]
ret i32 %17
}
/* Type definitions */
typedef int /*<<< orphan*/ u_char;

/* Variables and functions */
int sudp_vis(u_char *data, int len) { return (len); }


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

x86 assembly (clang, -O2):
<sudp_vis>:
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @sudp_vis(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
ret i32 %5
}

LLVM IR (-O2):
define i32 @sudp_vis(i32* nocapture readnone %0, i32 returned %1) {
ret i32 %1
}
int runfunc(int (*h)(), int a) {
  int b;
  b = (*h)(a);
  return b;
}


x86 assembly (clang, -O0):
<runfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   *%rcx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runfunc>:
mov    %rdi,%rcx
mov    %esi,%edi
xor    %eax,%eax
jmp    *%rcx

LLVM IR (-O0):
define i32 @runfunc(i32 (...)* %0, i32 %1) {
%3 = alloca i32 (...)*
%4 = alloca i32
%5 = alloca i32
store i32 (...)* %0, i32 (...)** %3
store i32 %1, i32* %4
%6 = load i32 (...)*, i32 (...)** %3
%7 = load i32, i32* %4
%8 = bitcast i32 (...)* %6 to i32 (i32, ...)*
%9 = call i32 (i32, ...) %8(i32 %7)
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @runfunc(i32 (...)* nocapture %0, i32 %1) {
%3 = bitcast i32 (...)* %0 to i32 (i32, ...)*
%4 = tail call i32 (i32, ...) %3(i32 %1)
ret i32 %4
}
int x29_process_synack(struct mypacket *packet) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.mypacket = type opaque
define i32 @x29_process_synack(%struct.mypacket* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double wallt() {
  struct timeval tv;
  gettimeofday(&tv, (struct timezone *)0);
  return tv.tv_sec + tv.tv_usec * 1e-6;
}


x86 assembly (clang, -O0):
<wallt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wallt>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
mulsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
%struct.timezone = type { i32 }
define double @wallt() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to double
%8 = call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %4)
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, i32 }
%struct.timezone = type { i32 }
define double @wallt() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}
void mdp4_writeback_overlay(struct msm_fb_data_type *mfd) {}


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

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

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

LLVM IR (-O2):
%struct.msm_fb_data_type = type opaque
define void @mdp4_writeback_overlay(%struct.msm_fb_data_type* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ debug(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void vmefail() {
  debug("Memory allocation failed.\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<vmefail>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <debug@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<vmefail>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <debug@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Memory allocation failed.\0A\00"
@EXIT_FAILURE = global i32 0
define void @vmefail() {
%1 = call i32 @debug(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"Memory allocation failed.\0A\00"
@EXIT_FAILURE = global i32 0
define void @vmefail() {
%1 = tail call i32 @debug(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memory_exhausted();
void *jv_mem_alloc(size_t sz) {
  void *p = malloc(sz);
  if (!p) {
    memory_exhausted();
  }
  return p;
}


x86 assembly (clang, -O0):
<jv_mem_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <jv_mem_alloc+0x2b>
mov    $0x0,%al
call   1040 <memory_exhausted@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jv_mem_alloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <jv_mem_alloc+0x15>
xor    %eax,%eax
call   1040 <memory_exhausted@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @jv_mem_alloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 (...) @memory_exhausted()
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @jv_mem_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @memory_exhausted()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef int int32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t __SMUAD(uint32_t x, uint32_t y) {
  return ((uint32_t)(((((int32_t)x << 16) >> 16) * (((int32_t)y << 16) >> 16)) +
                     ((((int32_t)x) >> 16) * (((int32_t)y) >> 16))));
}


x86 assembly (clang, -O0):
<__SMUAD>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x10,%eax
sar    $0x10,%eax
mov    -0x10(%rbp),%rcx
shl    $0x10,%ecx
sar    $0x10,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%rcx
sar    $0x10,%ecx
mov    -0x10(%rbp),%rdx
sar    $0x10,%edx
imul   %edx,%ecx
add    %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<__SMUAD>:
movswl %di,%eax
movswl %si,%ecx
imul   %eax,%ecx
sar    $0x10,%edi
sar    $0x10,%esi
imul   %edi,%esi
add    %ecx,%esi
movslq %esi,%rax
ret

LLVM IR (-O0):
define i64 @__SMUAD(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 16
%8 = ashr i32 %7, 16
%9 = load i64, i64* %4
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 16
%12 = ashr i32 %11, 16
%13 = mul nsw i32 %8, %12
%14 = load i64, i64* %3
%15 = trunc i64 %14 to i32
%16 = ashr i32 %15, 16
%17 = load i64, i64* %4
%18 = trunc i64 %17 to i32
%19 = ashr i32 %18, 16
%20 = mul nsw i32 %16, %19
%21 = add nsw i32 %13, %20
%22 = sext i32 %21 to i64
ret i64 %22
}

LLVM IR (-O2):
define i64 @__SMUAD(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = shl i32 %3, 16
%5 = ashr exact i32 %4, 16
%6 = trunc i64 %1 to i32
%7 = shl i32 %6, 16
%8 = ashr exact i32 %7, 16
%9 = mul nsw i32 %8, %5
%10 = ashr i32 %3, 16
%11 = ashr i32 %6, 16
%12 = mul nsw i32 %11, %10
%13 = add nsw i32 %9, %12
%14 = sext i32 %13 to i64
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ emq_queue_release(void *);
void emq_queue_list_free_handler(void *value) { emq_queue_release(value); }


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

x86 assembly (clang, -O2):
<emq_queue_list_free_handler>:
jmp    1030 <emq_queue_release@plt>

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

LLVM IR (-O2):
define void @emq_queue_list_free_handler(i8* %0) {
%2 = tail call i32 @emq_queue_release(i8* %0)
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ nasm_error(int, char *);
void *realloc(void *, size_t);
void *nasm_realloc(void *q, size_t size) {
  void *p = q ? realloc(q, size) : malloc(size);
  if (!p)
    nasm_error(0x00000002 | 0x00000010, "out of memory");
  return p;
}


x86 assembly (clang, -O0):
<nasm_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1161 <nasm_realloc+0x31>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x20(%rbp)
jmp    116e <nasm_realloc+0x3e>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1192 <nasm_realloc+0x62>
mov    $0x12,%edi
lea    0xe73(%rip),%rsi
call   1050 <nasm_error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nasm_realloc>:
push   %rbx
test   %rdi,%rdi
je     113d <nasm_realloc+0xd>
call   1040 <realloc@plt>
jmp    1145 <nasm_realloc+0x15>
mov    %rsi,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115e <nasm_realloc+0x2e>
lea    0xeac(%rip),%rsi
mov    $0x12,%edi
call   1050 <nasm_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define i8* @nasm_realloc(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i8* @realloc(i8* %0, i64 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @malloc(i64 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @nasm_error(i32 18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
ret i8* %9
}
int min(a, b) { return (a <= b) ? a : b; }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1121 <min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

LLVM IR (-O0):
define i32 @min(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 = icmp sle i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void version() {
  printf("haitus v0.1: simple virtual machine\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"haitus v0.1: simple virtual machine\0A\00"
@EXIT_SUCCESS = global i32 0
define void @version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [36 x i8] c"haitus v0.1: simple virtual machine\00"
define void @version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0xb1() {
  Assert_real((isascii(177) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              890, ("isascii should be 0 for 0xb1"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xb1\00"
define void @t_isascii_0xb1() {
%1 = tail call i64 @isascii(i32 177)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 890, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
vifram(type) int *type;
{}


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

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

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

LLVM IR (-O2):
define i32 @vifram(i32* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ _s2_priv_textab(float, float, float, int, int, float, float,
                                   char *);
void s2textyzf(float ix, float iy, float iz, float flipy, float flipz,
               char *itext) {
  _s2_priv_textab(ix, iy, iz, 1, 2, flipy, flipz, itext);
}


x86 assembly (clang, -O0):
<s2textyzf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
mov    %rdi,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
movss  -0x14(%rbp),%xmm4
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <_s2_priv_textab@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2textyzf>:
mov    %rdi,%rdx
mov    $0x1,%edi
mov    $0x2,%esi
jmp    1030 <_s2_priv_textab@plt>

LLVM IR (-O0):
define void @s2textyzf(float %0, float %1, float %2, float %3, float %4, i8* %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i8*
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store i8* %5, i8** %12
%13 = load float, float* %7
%14 = load float, float* %8
%15 = load float, float* %9
%16 = load float, float* %10
%17 = load float, float* %11
%18 = load i8*, i8** %12
%19 = call i32 @_s2_priv_textab(float %13, float %14, float %15, i32 1, i32 2, float %16, float %17, i8* %18)
ret void
}

LLVM IR (-O2):
define void @s2textyzf(float %0, float %1, float %2, float %3, float %4, i8* %5) {
%7 = tail call i32 @_s2_priv_textab(float %0, float %1, float %2, i32 1, i32 2, float %3, float %4, i8* %5)
ret void
}
int some_call(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @some_call() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hello_world();
int main(int argc, char *argv[]) {
  hello_world();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @hello_world()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @hello_world()
ret i32 0
}
int main(void) {
  int i = 0;
  int count = 1000000000;
  int a[1000] = {0};
  for (i = 0; i < count; i++) {
    a[i % 1000] = i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x3b9aca00,-0xc(%rbp)
lea    -0xfb0(%rbp),%rdi
xor    %esi,%esi
mov    $0xfa0,%edx
call   1030 <memset@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117c <main+0x6c>
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%eax
mov    $0x3e8,%esi
cltd
idiv   %esi
movslq %edx,%rax
mov    %ecx,-0xfb0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <main+0x3a>
xor    %eax,%eax
add    $0xfb0,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *name) {
  fprintf(stderr, "Usage: %s [ -p <hex file> ]\n", name);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Usage: %s [ -p <hex file> ]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Usage: %s [ -p <hex file> ]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int test_imm_CFint8_reg(signed char val) {
  return ((val) & (0xCF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CFint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xcf,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_CFint8_reg(i8 signext %0) {
%2 = and i8 %0, -49
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void ltop() {}


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

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

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

LLVM IR (-O2):
define void @ltop() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void gf8_muladd_00(uint8_t *out, uint8_t *in, unsigned int width) {
  memcpy(out, in, sizeof(uint64_t) * 8 * width);
}


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

x86 assembly (clang, -O2):
shl    $0x5,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @gf8_muladd_00(i32* %0, i32* %1, i32 %2) {
%4 = shl i32 %2, 5
%5 = tail call i32 @memcpy(i32* %0, i32* %1, i32 %4)
ret void
}
void sysWaitAccess(void) {}


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

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

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

LLVM IR (-O2):
define void @sysWaitAccess() {
ret void
}
int ieee_finite(double x) {
  int hx;
  hx = *(int *)&x;
  return (unsigned)((hx & 0x7fffffff) - 0x7ff00000) >> 31;
}


x86 assembly (clang, -O0):
<ieee_finite>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
sub    $0x7ff00000,%eax
shr    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee_finite>:
movq   %xmm0,%rax
and    $0x7fffffff,%eax
add    $0x80100000,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @ieee_finite(double %0) {
%2 = alloca double
%3 = alloca i32
store double %0, double* %2
%4 = bitcast double* %2 to i32*
%5 = load i32, i32* %4
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, 2147483647
%8 = sub nsw i32 %7, 2146435072
%9 = lshr i32 %8, 31
ret i32 %9
}

LLVM IR (-O2):
define i32 @ieee_finite(double %0) {
%2 = bitcast double %0 to i64
%3 = trunc i64 %2 to i32
%4 = and i32 %3, 2147483647
%5 = add nsw i32 %4, -2146435072
%6 = lshr i32 %5, 31
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void foo() {
  FILE *x = fopen("xyz", "r");
  if (x)
    fclose(x);
  else
    return;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xece(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1158 <foo+0x38>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
jmp    115d <foo+0x3d>
jmp    115d <foo+0x3d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1142 <foo+0x22>
mov    %rax,%rdi
pop    %rax
jmp    1030 <fclose@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"xyz\00"
@.str.1 = [2 x i8] c"r\00"
define void @foo() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32*, i32** %1
%7 = call i32 @fclose(i32* %6)
br label %9
8: ; preds = %0
br label %9
9: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"xyz\00"
@.str.1 = [2 x i8] c"r\00"
define void @foo() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @fclose(i32* %1)
br label %5
5: ; preds = %0, %3
ret void
}