// File: /workspace/github_c_makefile_star2_O1/millimat[P]Soft-Heap/run-tests.c
// Function: main
static void forwards_test(int elems[], int results[][2]) {
  printf("----------FORWARDS TEST----------\n");
  printf("Inserting integers 0 to %d into a soft heap...\n", N_ELEMENTS - 1);
  softheap *P = makeheap_empty(EPSILON);
  for(int i = 0; i < N_ELEMENTS; i++) {
    elems[i] = i;
    insert(P, i);
  }
  
  int ckey_corruptions = 0, pos_corruptions = 0;
  printf("Extracting elements with ckeys...\n");
  for(int i = 0; i < N_ELEMENTS; i++) {
    results[i][0] = extract_min_with_ckey(P, &results[i][1]);
    if(results[i][0] < results[i][1]) ckey_corruptions++;
    if(results[i][0] != elems[i]) pos_corruptions++;
  }

  report_corruptions(ckey_corruptions, pos_corruptions, N_ELEMENTS);  
  free(P);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc00008, %rsp         # imm = 0xC00008
leaq 0xf67(%rip), %rdi       # 0x218b
callq 0x1050
leaq 0xde8(%rip), %rdi       # 0x2018
xorl %r14d, %r14d
movl $0xfffff, %esi          # imm = 0xFFFFF
xorl %eax, %eax
callq 0x1070
movsd 0xdc1(%rip), %xmm0      # 0x2008
callq 0x16cf
movq %rax, %rbx
movl %r14d, (%rsp,%r14,4)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x185d
incq %r14
cmpq $0x100000, %r14         # imm = 0x100000
jne 0x124f
leaq 0xfbd(%rip), %rdi       # 0x222e
callq 0x1050
xorl %ebp, %ebp
movl $0x4, %r12d
movq %rsp, %r13
xorl %r14d, %r14d
leaq (%rsp,%r12), %r15
addq $0x400000, %r15         # imm = 0x400000
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b06
movl %eax, -0x4(%r15)
xorl %ecx, %ecx
cmpl (%r15), %eax
setl %cl
addl %ecx, %r14d
xorl %ecx, %ecx
cmpl (%r13), %eax
setne %cl
addl %ecx, %ebp
addq $0x8, %r12
addq $0x4, %r13
cmpq $0x800004, %r12         # imm = 0x800004
jne 0x1284
movl %r14d, %edi
movl %ebp, %esi
callq 0x1655
movq %rbx, %rdi
callq 0x1030
leaq 0xecf(%rip), %rdi       # 0x21ad
callq 0x1050
leaq 0xde6(%rip), %rdi       # 0x20d0
movl $0xfffff, %esi          # imm = 0xFFFFF
xorl %eax, %eax
callq 0x1070
movsd 0xd0a(%rip), %xmm0      # 0x2008
callq 0x16cf
movq %rax, %rbx
movl $0xfffff, %r14d         # imm = 0xFFFFF
movl %r14d, (%rsp,%r14,4)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x185d
addq $-0x1, %r14
jb 0x130c
leaq 0xf06(%rip), %rdi       # 0x222e
callq 0x1050
xorl %ebp, %ebp
movl $0x4, %r12d
movq %rsp, %r13
xorl %r14d, %r14d
leaq (%rsp,%r12), %r15
addq $0x400000, %r15         # imm = 0x400000
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b06
movl %eax, -0x4(%r15)
xorl %ecx, %ecx
cmpl (%r15), %eax
setl %cl
addl %ecx, %r14d
xorl %ecx, %ecx
cmpl (%r13), %eax
setne %cl
addl %ecx, %ebp
addq $0x8, %r12
addq $0x4, %r13
cmpq $0x800004, %r12         # imm = 0x800004
jne 0x133b
movl %r14d, %edi
movl %ebp, %esi
callq 0x1655
movq %rbx, %rdi
callq 0x1030
leaq 0xe3b(%rip), %rdi       # 0x21d0
callq 0x1050
leaq 0xd70(%rip), %rdi       # 0x2111
xorl %r14d, %r14d
movl $0x577, %esi            # imm = 0x577
movl $0x445, %edx            # imm = 0x445
movl $0xfffff, %ecx          # imm = 0xFFFFF
xorl %eax, %eax
callq 0x1070
movsd 0xc46(%rip), %xmm0      # 0x2008
callq 0x16cf
movq %rax, %rbx
xorl %r15d, %r15d
movl %r14d, %eax
imulq $0x77eb638b, %rax, %rax # imm = 0x77EB638B
shrq $0x29, %rax
imull $0x445, %eax, %eax      # imm = 0x445
movl %r14d, %esi
subl %eax, %esi
movl %esi, (%rsp,%r15,4)
movq %rbx, %rdi
callq 0x185d
incq %r15
addl $0x577, %r14d           # imm = 0x577
cmpq $0x100000, %r15         # imm = 0x100000
jne 0x13cd
leaq 0xe05(%rip), %rdi       # 0x2211
callq 0x1050
leaq 0x286(%rip), %rcx       # 0x169e
movq %rsp, %r14
movl $0x4, %r13d
movl $0x100000, %esi         # imm = 0x100000
movl $0x4, %edx
movq %r14, %rdi
callq 0x1060
leaq 0xdf4(%rip), %rdi       # 0x222e
callq 0x1050
xorl %ebp, %ebp
xorl %r15d, %r15d
leaq (%rsp,%r13), %r12
addq $0x400000, %r12         # imm = 0x400000
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b06
movl %eax, -0x4(%r12)
xorl %ecx, %ecx
cmpl (%r12), %eax
setl %cl
addl %ecx, %r15d
xorl %ecx, %ecx
cmpl (%r14), %eax
setne %cl
addl %ecx, %ebp
addq $0x8, %r13
addq $0x4, %r14
cmpq $0x800004, %r13         # imm = 0x800004
jne 0x1444
movl %r15d, %edi
movl %ebp, %esi
callq 0x1655
movq %rbx, %rdi
callq 0x1030
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x10b0
movl %eax, %edi
callq 0x10a0
leaq 0xd41(%rip), %rdi       # 0x21f1
callq 0x1050
leaq 0xc9d(%rip), %rdi       # 0x2159
movl $0x100000, %esi         # imm = 0x100000
xorl %eax, %eax
callq 0x1070
movsd 0xb38(%rip), %xmm0      # 0x2008
callq 0x16cf
movq %rax, %rbx
callq 0x1100
movl %eax, (%rsp,%r14,4)
movq %rbx, %rdi
movl %eax, %esi
callq 0x185d
incq %r14
cmpq $0x100000, %r14         # imm = 0x100000
jne 0x14d8
leaq 0xd13(%rip), %rdi       # 0x2211
callq 0x1050
leaq 0x194(%rip), %rcx       # 0x169e
movq %rsp, %r14
movl $0x4, %r13d
movl $0x100000, %esi         # imm = 0x100000
movl $0x4, %edx
movq %r14, %rdi
callq 0x1060
leaq 0xd02(%rip), %rdi       # 0x222e
callq 0x1050
xorl %ebp, %ebp
xorl %r15d, %r15d
leaq (%rsp,%r13), %r12
addq $0x400000, %r12         # imm = 0x400000
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b06
movl %eax, -0x4(%r12)
xorl %ecx, %ecx
cmpl (%r12), %eax
setl %cl
addl %ecx, %r15d
xorl %ecx, %ecx
cmpl (%r14), %eax
setne %cl
addl %ecx, %ebp
addq $0x8, %r13
addq $0x4, %r14
cmpq $0x800004, %r13         # imm = 0x800004
jne 0x1536
movl %r15d, %edi
movl %ebp, %esi
callq 0x1655
movq %rbx, %rdi
callq 0x1030
leaq 0xcbf(%rip), %rdi       # 0x2250
callq 0x1050
leaq 0xcd5(%rip), %rdi       # 0x2272
callq 0x1050
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x10b0
movl %eax, %edi
callq 0x10a0
movq 0x2a26(%rip), %r15      # 0x3fe0
xorl %ebp, %ebp
cmpl $0x1, %r14d
movl %r14d, %r12d
adcl $0x0, %r12d
movsd 0xa41(%rip), %xmm0      # 0x2010
callq 0x16cf
movq %rax, %rbx
testl %ebp, %ebp
je 0x15ef
callq 0x1100
movq %rbx, %rdi
movl %eax, %esi
callq 0x185d
decl %r12d
jne 0x15db
movq %rbx, %rdi
callq 0x17ce
movl $0x2e, %edi
callq 0x1040
movq (%r15), %rdi
callq 0x10d0
imull $0xcccccccd, %ebp, %eax # imm = 0xCCCCCCCD
addl $0xcccccccb, %eax       # imm = 0xCCCCCCCB
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
jae 0x1627
movl $0xa, %edi
callq 0x1040
incl %ebp
addl $0x28f5, %r14d          # imm = 0x28F5
cmpl $0x64, %ebp
jne 0x15bc
leaq 0xc99(%rip), %rdi       # 0x22d5
callq 0x1050
xorl %eax, %eax
addq $0xc00008, %rsp         # imm = 0xC00008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq