xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *readLine_(char const *);
int replaceArg_(char **aArg, const char *aArgFile) {
  int rc = -1;
  char *arg = readLine_(aArgFile);
  if (!arg)
    goto out;
  *aArg = arg;
  rc = 0;
out:
  if (rc)
    free(arg);
  return rc;
}


x86 assembly (clang, -O0):
<replaceArg_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <readLine_@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1154 <replaceArg_+0x34>
jmp    1166 <replaceArg_+0x46>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1179 <replaceArg_+0x59>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replaceArg_>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <readLine_@plt>
test   %rax,%rax
je     1138 <replaceArg_+0x18>
mov    %rax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret
xor    %edi,%edi
call   1030 <free@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @replaceArg_(i8** nocapture writeonly %0, i8* %1) {
%3 = tail call i8* @readLine_(i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %2
store i8* %3, i8** %0
br label %8
6: ; preds = %2
%7 = tail call i32 @free(i8* null)
br label %8
8: ; preds = %5, %6
%9 = phi i32 [ -1, %6 ], [ 0, %5 ]
ret i32 %9
}
/* Variables and functions */
int skill_get_range(int, int);
int guild_skill_get_range(int id, int lv) { return skill_get_range(id, lv); }


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

x86 assembly (clang, -O2):
<guild_skill_get_range>:
jmp    1030 <skill_get_range@plt>

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

LLVM IR (-O2):
define i32 @guild_skill_get_range(i32 %0, i32 %1) {
%3 = tail call i32 @skill_get_range(i32 %0, i32 %1)
ret i32 %3
}
void SCR_BeginLoadingPlaque(void) {}


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

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

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

LLVM IR (-O2):
define void @SCR_BeginLoadingPlaque() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_pin(int, float);
int /*<<< orphan*/ update_pwm();
void set_pwm(int channel, float width) {
  set_pin(channel, width);
  update_pwm();
}


x86 assembly (clang, -O0):
<set_pwm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
call   1030 <set_pin@plt>
mov    $0x0,%al
call   1040 <update_pwm@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @set_pwm(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%5 = load i32, i32* %3
%6 = load float, float* %4
%7 = call i32 @set_pin(i32 %5, float %6)
%8 = call i32 (...) @update_pwm()
ret void
}

LLVM IR (-O2):
define void @set_pwm(i32 %0, float %1) {
%3 = tail call i32 @set_pin(i32 %0, float %1)
%4 = tail call i32 (...) @update_pwm()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ marsaglia_generate(double *, int, double, double);
void random_matrix(double *A, int M, int N) {
  int dim;
  dim = M * N;
  marsaglia_generate(A, dim, 0.0, 1.0);
}


x86 assembly (clang, -O0):
<random_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
xorps  %xmm0,%xmm0
movsd  0xec2(%rip),%xmm1
call   1030 <marsaglia_generate@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_matrix>:
imul   %edx,%esi
movsd  0xee5(%rip),%xmm1
xorps  %xmm0,%xmm0
jmp    1030 <marsaglia_generate@plt>

LLVM IR (-O0):
define void @random_matrix(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = mul nsw i32 %8, %9
store i32 %10, i32* %7
%11 = load double*, double** %4
%12 = load i32, i32* %7
%13 = call i32 @marsaglia_generate(double* %11, i32 %12, double 0.000000e+00, double 1.000000e+00)
ret void
}

LLVM IR (-O2):
define void @random_matrix(double* %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %1
%5 = tail call i32 @marsaglia_generate(double* %0, i32 %4, double 0.000000e+00, double 1.000000e+00)
ret void
}
void _initEmu(void) {}


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

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

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

LLVM IR (-O2):
define void @_initEmu() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endtmesh();
void endtme_() { endtmesh(); }


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

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

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

LLVM IR (-O2):
define void @endtme_() {
%1 = tail call i32 (...) @endtmesh()
ret void
}
/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ strncmp(char const *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int nameFilter(const struct dirent *entry) {
  const char filter[] = "event";
  return !strncmp(filter, entry->d_name, strlen(filter));
}


x86 assembly (clang, -O0):
<nameFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xece(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xec8(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    -0xe(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nameFilter>:
push   %r14
push   %rbx
push   %rax
movw   $0x74,0x4(%rsp)
movl   $0x6e657665,(%rsp)
mov    (%rdi),%ebx
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
@__const.nameFilter.filter = [6 x i8] c"event\00"
define i32 @nameFilter(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
%3 = alloca [6 x i8]
store %struct.dirent* %0, %struct.dirent** %2
%4 = bitcast [6 x i8]* %3 to i8*
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%6 = load %struct.dirent*, %struct.dirent** %2
%7 = getelementptr inbounds %struct.dirent, %struct.dirent* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @strncmp(i8* %5, i32 %8, i32 %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@__const.nameFilter.filter = [6 x i8] c"event\00"
define i32 @nameFilter(%struct.dirent* nocapture %0) {
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @strncmp(i8* %3, i32 %5, i32 %6)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ glutBitmapCharacter(void *, char const);
scalar_t__ strlen(char const *);
void PrintString(void *font, const char *string) {
  int len, i;
  len = (int)strlen(string);
  for (i = 0; i < len; i++)
    glutBitmapCharacter(font, string[i]);
}


x86 assembly (clang, -O0):
<PrintString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1172 <PrintString+0x52>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <PrintString+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintString>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1156 <PrintString+0x36>
mov    %eax,%r12d
xor    %ebx,%ebx
nop
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <glutBitmapCharacter@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <PrintString+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @PrintString(i8* %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = trunc i64 %3 to i32
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = and i64 %3, 4294967295
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @glutBitmapCharacter(i8* %0, i8 signext %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret void
}
void mlx5_accel_ipsec_cleanup(struct mlx5_core_dev *mdev) {}


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

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

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

LLVM IR (-O2):
%struct.mlx5_core_dev = type opaque
define void @mlx5_accel_ipsec_cleanup(%struct.mlx5_core_dev* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ poll2();
int main() {
  poll2();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @poll2()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int MPI_Abort(int comm, int errc) {
  exit(errc);
  return 0;
}


x86 assembly (clang, -O0):
<MPI_Abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<MPI_Abort>:
push   %rax
mov    %esi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @MPI_Abort(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
define i32 @MPI_Abort(i32 %0, i32 %1) {
%3 = tail call i32 @exit(i32 %1)
unreachable
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ display;
};
struct TYPE_4__ {
  TYPE_1__ xbutton;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void *get_XEvent_xbutton_display(void *_p) {
  return (void *)((XEvent *)_p)->xbutton.display;
}


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

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

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

LLVM IR (-O2):
define i8* @get_XEvent_xbutton_display(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int lostlink(char *namelink) {}


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

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

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

LLVM IR (-O2):
define i32 @lostlink(i8* nocapture readnone %0) {
ret i32 undef
}
void sub2(k) int k;
{
#pragma omp parallel shared(k)
  sub3(k);
}


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

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

LLVM IR (-O0):
define void @sub2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @sub3 to i32 (i32, ...)*)(i32 %3)
ret void
}

LLVM IR (-O2):
define void @sub2(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @sub3 to i32 (i32, ...)*)(i32 %0)
ret void
}
void port_exit(void *arg) {}


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

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

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

LLVM IR (-O2):
define void @port_exit(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
int /*<<< orphan*/ print(int *, int);
int /*<<< orphan*/ selection_sort(int *, int);
int main() {
  int nums[] = {2, 10, 3, 14, 15, 6, 3, 9};
  int n = sizeof(nums) / sizeof(nums[0]);
  selection_sort(nums, n);
  print(nums, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <selection_sort@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <selection_sort@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.nums = [8 x i32] [i32 2, i32 10, i32 3, i32 14, i32 15, i32 6, i32 3, i32 9]
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @selection_sort(i32* %5, i32 %6)
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @print(i32* %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [8 x i32] [i32 2, i32 10, i32 3, i32 14, i32 15, i32 6, i32 3, i32 9]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @selection_sort(i32* %3, i32 8)
%5 = call i32 @print(i32* %3, i32 8)
ret i32 0
}
void external_clocks_on() {
  *(volatile unsigned long *)((void *)0xfffffc00 + 0x00) = 0x400;
}


x86 assembly (clang, -O0):
<external_clocks_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffc00,%eax
movq   $0x400,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<external_clocks_on>:
mov    $0xfffffc00,%eax
movq   $0x400,(%rax)
ret

LLVM IR (-O0):
define void @external_clocks_on() {
store volatile i64 1024, i64* inttoptr (i64 4294966272 to i64*)
ret void
}

LLVM IR (-O2):
define void @external_clocks_on() {
store volatile i64 1024, i64* inttoptr (i64 4294966272 to i64*)
ret void
}
int function2(void) {
  static int i, state = 0;
  switch (state) {
  case 0:
    for (i = 0; i < 10; ++i) {
      state = 1;
      return i;
    case 1:;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<function2>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1e(%rip),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     112b <function2+0x2b>
jmp    111a <function2+0x1a>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     115a <function2+0x5a>
jmp    1178 <function2+0x78>
movl   $0x0,0x2eef(%rip)
cmpl   $0xa,0x2ee8(%rip)
jge    1173 <function2+0x73>
movl   $0x1,0x2edc(%rip)
mov    0x2ed2(%rip),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <function2+0x7f>
jmp    115f <function2+0x5f>
mov    0x2ebf(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eb6(%rip)
jmp    1135 <function2+0x35>
jmp    1178 <function2+0x78>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<function2>:
mov    0x2f1e(%rip),%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmpb   $0x0,0x2f16(%rip)
cmovne %eax,%ecx
mov    %ecx,0x2f09(%rip)
mov    $0xffffffff,%eax
cmp    $0x9,%ecx
jg     112e <function2+0x2e>
movb   $0x1,0x2efc(%rip)
mov    %ecx,%eax
ret

LLVM IR (-O0):
@function2.i = internal global i32 0
@function2.state = internal global i32 0
define i32 @function2() {
%1 = alloca i32
%2 = load i32, i32* @function2.state
switch i32 %2, label %14 [
i32 0, label %3
i32 1, label %9
]
3: ; preds = %0
store i32 0, i32* @function2.i
br label %4
4: ; preds = %10, %3
%5 = load i32, i32* @function2.i
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %13
7: ; preds = %4
store i32 1, i32* @function2.state
%8 = load i32, i32* @function2.i
store i32 %8, i32* %1
br label %15
9: ; preds = %0
br label %10
10: ; preds = %9
%11 = load i32, i32* @function2.i
%12 = add nsw i32 %11, 1
store i32 %12, i32* @function2.i
br label %4
13: ; preds = %4
br label %14
14: ; preds = %13, %0
store i32 -1, i32* %1
br label %15
15: ; preds = %14, %7
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@function2.i = internal unnamed_addr global i32 0
@function2.state = internal unnamed_addr global i1 false
define i32 @function2() {
%1 = load i1, i1* @function2.state
%2 = load i32, i32* @function2.i
%3 = add nsw i32 %2, 1
%4 = select i1 %1, i32 %3, i32 0
store i32 %4, i32* @function2.i
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %7
6: ; preds = %0
store i1 true, i1* @function2.state
br label %7
7: ; preds = %0, %6
%8 = phi i32 [ %4, %6 ], [ -1, %0 ]
ret i32 %8
}
void a_barrier() { __asm__ __volatile__(".long 0xf" : : : "memory"); }


x86 assembly (clang, -O0):
<a_barrier>:
push   %rbp
mov    %rsp,%rbp
sldt   (%rax)
add    %bl,-0x3d(%rbp)

x86 assembly (clang, -O2):
<a_barrier>:
sldt   (%rax)
add    %al,%bl

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

LLVM IR (-O2):
define void @a_barrier() {
tail call void asm sideeffect ".long 0xf", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_ioline_set_callback() {
  printf("NOT IMPLEMENTED:"
         "pa_ioline_set_callback"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"NOT IMPLEMENTED:pa_ioline_set_callback\0A\00"
define i32 @pa_ioline_set_callback() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [39 x i8] c"NOT IMPLEMENTED:pa_ioline_set_callback\00"
define i32 @pa_ioline_set_callback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void marker_indirect_call() {}


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

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

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

LLVM IR (-O2):
define void @marker_indirect_call() {
ret void
}
int test_imm_95uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x95 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_95uint64_highword_reg>:
movabs $0x9500000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_95uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 149
%6 = icmp ne i64 %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_95uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 639950127104
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
void *malloc(int);
void *fake_sbrk(int size) {
  void *rv = malloc(size);
  if (rv)
    return rv;
  else
    return (void *)(-1);
}


x86 assembly (clang, -O0):
<fake_sbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     113f <fake_sbrk+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114a <fake_sbrk+0x3a>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fake_sbrk>:
push   %rax
call   1030 <malloc@plt>
cmp    $0x1,%rax
sbb    %rcx,%rcx
or     %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @fake_sbrk(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* inttoptr (i64 -1 to i8*), i8* %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0xb3() {
  Assert_real((isgraph(179) == 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_isgraph.c",
              900, ("isgraph should be 0 for 0xb3"));
}


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

x86 assembly (clang, -O2):
<t_isgraph_0xb3>:
push   %rax
mov    $0xb3,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x384,%edx
pop    %rax
jmp    1030 <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_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xb3\00"
define void @t_isgraph_0xb3() {
%1 = call i64 @isgraph(i32 179)
%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 900, 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_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xb3\00"
define void @t_isgraph_0xb3() {
%1 = tail call i64 @isgraph(i32 179)
%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 900, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CInit();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ runTransition(int /*<<< orphan*/);
int main() {
  printf("[C Code] Running test\n");
  CInit();
  runTransition(0);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"[C Code] Running test\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @CInit()
%4 = call i32 @runTransition(i32 0)
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"[C Code] Running test\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @CInit()
%3 = tail call i32 @runTransition(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int ssiproc(char *token, int sze, void *data) {
  fwrite(token, sze, 1, stdout);
  return 0;
}


x86 assembly (clang, -O0):
<ssiproc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssiproc>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@stdout = global i32 0
define i32 @ssiproc(i8* %0, i32 %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @stdout
%5 = tail call i32 @fwrite(i8* %0, i32 %1, i32 1, i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
void sync(void) { __set_errno(ENOSYS); }


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

x86 assembly (clang, -O2):
<sync>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <__set_errno@plt>

LLVM IR (-O0):
@ENOSYS = global i32 0
define void @sync() {
%1 = load i32, i32* @ENOSYS
%2 = call i32 @__set_errno(i32 %1)
ret void
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define void @sync() {
%1 = load i32, i32* @ENOSYS
%2 = tail call i32 @__set_errno(i32 %1)
ret void
}
float floatMod(float a, float b) {
  int result = (int)(a / b);
  return a - (float)result * b;
}


x86 assembly (clang, -O0):
<floatMod>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
cvtsi2ssl -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatMod>:
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
cvttps2dq %xmm2,%xmm2
cvtdq2ps %xmm2,%xmm2
mulss  %xmm1,%xmm2
subss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @floatMod(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = fdiv float %6, %7
%9 = fptosi float %8 to i32
store i32 %9, i32* %5
%10 = load float, float* %3
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to float
%13 = load float, float* %4
%14 = fneg float %12
%15 = call float @llvm.fmuladd.f32(float %14, float %13, float %10)
ret float %15
}

LLVM IR (-O2):
define float @floatMod(float %0, float %1) {
%3 = fdiv float %0, %1
%4 = fptosi float %3 to i32
%5 = sitofp i32 %4 to float
%6 = fneg float %5
%7 = tail call float @llvm.fmuladd.f32(float %6, float %1, float %0)
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ zsim_magic_op(int);
void zsim_work_end() { zsim_magic_op((1030)); }


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

x86 assembly (clang, -O2):
<zsim_work_end>:
mov    $0x406,%edi
jmp    1030 <zsim_magic_op@plt>

LLVM IR (-O0):
define void @zsim_work_end() {
%1 = call i32 @zsim_magic_op(i32 1030)
ret void
}

LLVM IR (-O2):
define void @zsim_work_end() {
%1 = tail call i32 @zsim_magic_op(i32 1030)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BubbleSort(char *, int);
int clock();
int /*<<< orphan*/ printf(char *, int);
char *rand_str(int);
int main(int argv, char **argc) {
  char *p = rand_str(1024);
  int i = 0;
  int t_beg, t_end;
  t_beg = clock();
  BubbleSort(p, 1024);
  t_end = clock();
  printf("%dms\n", t_end - t_beg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x400,%edi
call   1050 <rand_str@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x400,%esi
call   1060 <BubbleSort@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
sub    -0x20(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x400,%edi
call   1050 <rand_str@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x400,%esi
call   1060 <BubbleSort@plt>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %ebp,%eax
lea    0xe8a(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%dms\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i8* @rand_str(i32 1024)
store i8* %10, i8** %6
store i32 0, i32* %7
%11 = call i32 (...) @clock()
store i32 %11, i32* %8
%12 = load i8*, i8** %6
%13 = call i32 @BubbleSort(i8* %12, i32 1024)
%14 = call i32 (...) @clock()
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i32, i32* %8
%17 = sub nsw i32 %15, %16
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%dms\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @rand_str(i32 1024)
%4 = tail call i32 (...) @clock()
%5 = tail call i32 @BubbleSort(i8* %3, i32 1024)
%6 = tail call i32 (...) @clock()
%7 = sub nsw i32 %6, %4
%8 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Type definitions */
struct derdata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ der_sequence(struct derdata *, int /*<<< orphan*/,
                                int /*<<< orphan*/ *);
struct derdata *der_set(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ der_string(char *);
struct derdata *der_setseqstr(struct derdata *object, char *string) {
  return der_set(der_sequence(object, der_string(string), NULL), NULL);
}


x86 assembly (clang, -O0):
<der_setseqstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <der_string@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <der_sequence@plt>
mov    %eax,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <der_set@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<der_setseqstr>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <der_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1050 <der_sequence@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rbx
jmp    1040 <der_set@plt>

LLVM IR (-O0):
%struct.derdata = type { i32 }
define %struct.derdata* @der_setseqstr(%struct.derdata* %0, i8* %1) {
%3 = alloca %struct.derdata*
%4 = alloca i8*
store %struct.derdata* %0, %struct.derdata** %3
store i8* %1, i8** %4
%5 = load %struct.derdata*, %struct.derdata** %3
%6 = load i8*, i8** %4
%7 = call i32 @der_string(i8* %6)
%8 = call i32 @der_sequence(%struct.derdata* %5, i32 %7, i32* null)
%9 = call %struct.derdata* @der_set(i32 %8, i32* null)
ret %struct.derdata* %9
}

LLVM IR (-O2):
%struct.derdata = type { i32 }
define %struct.derdata* @der_setseqstr(%struct.derdata* %0, i8* %1) {
%3 = tail call i32 @der_string(i8* %1)
%4 = tail call i32 @der_sequence(%struct.derdata* %0, i32 %3, i32* null)
%5 = tail call %struct.derdata* @der_set(i32 %4, i32* null)
ret %struct.derdata* %5
}
/* Variables and functions */
int /*<<< orphan*/ rm_mod_from_ddebug_tables();
int /*<<< orphan*/ rm_mod_from_list();
int /*<<< orphan*/ rm_mod_from_sysfs();
void hide_me(void) {
  rm_mod_from_list();
  rm_mod_from_sysfs();
  rm_mod_from_ddebug_tables();
}


x86 assembly (clang, -O0):
<hide_me>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rm_mod_from_list@plt>
mov    $0x0,%al
call   1050 <rm_mod_from_sysfs@plt>
mov    $0x0,%al
call   1040 <rm_mod_from_ddebug_tables@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hide_me>:
push   %rax
xor    %eax,%eax
call   1030 <rm_mod_from_list@plt>
xor    %eax,%eax
call   1050 <rm_mod_from_sysfs@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <rm_mod_from_ddebug_tables@plt>

LLVM IR (-O0):
define void @hide_me() {
%1 = call i32 (...) @rm_mod_from_list()
%2 = call i32 (...) @rm_mod_from_sysfs()
%3 = call i32 (...) @rm_mod_from_ddebug_tables()
ret void
}

LLVM IR (-O2):
define void @hide_me() {
%1 = tail call i32 (...) @rm_mod_from_list()
%2 = tail call i32 (...) @rm_mod_from_sysfs()
%3 = tail call i32 (...) @rm_mod_from_ddebug_tables()
ret void
}
/* Type definitions */
typedef scalar_t__ const int32_t;

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


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

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

LLVM IR (-O0):
define i64 @sub(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 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @sub(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
ret i64 %3
}
/* Type definitions */
typedef int uint8_t;
struct in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int const, int const, int const,
                           int const);
char *inet_ntoa(struct in_addr addr) {
  static char buf[16];
  const uint8_t *bytes = (const uint8_t *)&addr.s_addr;
  sprintf(buf, "%u.%u.%u.%u", bytes[0], bytes[1], bytes[2], bytes[3]);
  return buf;
}


x86 assembly (clang, -O0):
<inet_ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r9d
lea    0x2ef9(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2ee6(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_ntoa>:
push   %rbx
mov    %edi,%edx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@inet_ntoa.buf = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%u.%u.%u.%u\00"
define i8* @inet_ntoa(i32 %0) {
%2 = alloca %struct.in_addr
%3 = alloca i32*
%4 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
store i32 %0, i32* %4
%5 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 3
%17 = load i32, i32* %16
%18 = call i32 @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.buf, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11, i32 %14, i32 %17)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@inet_ntoa.buf = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%u.%u.%u.%u\00"
define i8* @inet_ntoa(i32 %0) {
%2 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0, i32 poison, i32 poison, i32 poison)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.buf, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int /*<<< orphan*/ errno;
void *malloc(int);
void *rpl_malloc(const size_t size) {
  void *result = NULL;
  result = malloc(size == 0 ? 1 : size);
  if (result == NULL) {
    errno = ENOMEM;
  }
  return result;
}


x86 assembly (clang, -O0):
<rpl_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113d <rpl_malloc+0x2d>
mov    $0x1,%eax
mov    %rax,-0x18(%rbp)
jmp    1145 <rpl_malloc+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <rpl_malloc+0x61>
mov    0x2e7a(%rip),%rax
mov    (%rax),%ecx
mov    0x2e69(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpl_malloc>:
push   %rax
test   %rdi,%rdi
mov    $0x1,%eax
cmove  %eax,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1128 <rpl_malloc+0x18>
pop    %rcx
ret
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2ea0(%rip),%rdx
mov    %ecx,(%rdx)
pop    %rcx
ret

LLVM IR (-O0):
@ENOMEM = global i32 0
@errno = global i32 0
define i8* @rpl_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* null, i8** %3
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = load i64, i64* %2
br label %9
9: ; preds = %7, %6
%10 = phi i64 [ 1, %6 ], [ %8, %7 ]
%11 = trunc i64 %10 to i32
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = load i32, i32* @ENOMEM
store i32 %16, i32* @errno
br label %17
17: ; preds = %15, %9
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define noalias i8* @rpl_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = trunc i64 %0 to i32
%4 = select i1 %2, i32 1, i32 %3
%5 = tail call i8* @malloc(i32 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* @ENOMEM
store i32 %8, i32* @errno
br label %9
9: ; preds = %7, %1
ret i8* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long atoi(int /*<<< orphan*/);
int /*<<< orphan*/ findLine(int /*<<< orphan*/ *, char *);
long parse_recipient(FILE *plr_file) {
  return atoi(findLine(plr_file, "Reci:"));
}


x86 assembly (clang, -O0):
<parse_recipient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <findLine@plt>
mov    %eax,%edi
call   1030 <atoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_recipient>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <findLine@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <atoi@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Reci:\00"
define i64 @parse_recipient(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @findLine(i32* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i64 @atoi(i32 %4)
ret i64 %5
}

LLVM IR (-O2):
@.str = [6 x i8] c"Reci:\00"
define i64 @parse_recipient(i32* %0) {
%2 = tail call i32 @findLine(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @atoi(i32 %2)
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int out_debug(char c, FILE *stream __attribute__((__unused__))) {
  (*((volatile char *)0x20)) = c;
  return 0;
}


x86 assembly (clang, -O0):
<out_debug>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    $0x20,%eax
mov    %cl,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_debug>:
mov    %dil,0x20
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @out_debug(i8 signext %0, i32* %1) {
%3 = alloca i8
%4 = alloca i32*
store i8 %0, i8* %3
store i32* %1, i32** %4
%5 = load i8, i8* %3
store volatile i8 %5, i8* inttoptr (i64 32 to i8*)
ret i32 0
}

LLVM IR (-O2):
define i32 @out_debug(i8 signext %0, i32* nocapture readnone %1) {
store volatile i8 %0, i8* inttoptr (i64 32 to i8*)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ bitw_bit_scan_reverse_64_bsr(int /*<<< orphan*/);
__attribute__((always_)) uint8_t
bitw_bit_scan_reverse_64(uint64_t bit_sequence) {
  return bitw_bit_scan_reverse_64_bsr(bit_sequence);
}


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

x86 assembly (clang, -O2):
<bitw_bit_scan_reverse_64>:
jmp    1030 <bitw_bit_scan_reverse_64_bsr@plt>

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

LLVM IR (-O2):
define i32 @bitw_bit_scan_reverse_64(i32 %0) {
%2 = tail call i32 @bitw_bit_scan_reverse_64_bsr(i32 %0)
ret i32 %2
}
int test_imm_4Cint8_mem(signed char *val) {
  return ((*val) & (-0x4C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_4Cint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffffb4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_4Cint8_mem>:
testb  $0xb4,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_4Cint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -76
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}