// File: /workspace/github_cpp_makefile_star2_O1/dsharlet[P]array/test/sort.cpp
// Function: nda::test_sort_body()
TEST(sort) {
  for (int size = 0; size < 100; size++) {
    std::vector<int> unordered(size);
    for (int& i : unordered) {
      i = rand() % 100;
    }

    std::vector<int> std_sorted(unordered);
    std::vector<int> sorted(unordered);

    std::sort(std_sorted.begin(), std_sorted.end());
    internal::bubble_sort(sorted.begin(), sorted.end());

    for (size_t i = 0; i < unordered.size(); i++) {
      ASSERT_EQ(std_sorted[i], sorted[i]);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
xorl %esi, %esi
movq %rsp, %rbx
leaq 0x78(%rsp), %rbp
leaq 0x65d2(%rip), %r14      # 0xa1654
leaq 0xa2a1(%rip), %r15      # 0xa532a
movq %rbx, %rdi
movq %rsi, 0x70(%rsp)
movq %rbp, %rdx
callq 0x9b3a4
movq (%rsp), %rbx
movq 0x8(%rsp), %r12
cmpq %r12, %rbx
je 0x9b0cf
callq 0x2330
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x64, %ecx, %ecx
subl %ecx, %eax
movl %eax, (%rbx)
addq $0x4, %rbx
jmp 0x9b0a2
leaq 0x38(%rsp), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x9b42e
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x9b42e
movq 0x38(%rsp), %r12
movq 0x40(%rsp), %rbx
cmpq %rbx, %r12
je 0x9b128
movq %rbx, %rax
subq %r12, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9b4ae
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9b591
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
cmpq %rcx, %rax
je 0x9b155
movq %rax, %rdx
movl (%rdx), %esi
movl (%rax), %edi
cmpl %edi, %esi
jge 0x9b146
movl %esi, (%rax)
movl %edi, (%rdx)
addq $0x4, %rdx
cmpq %rcx, %rdx
jne 0x9b13a
addq $0x4, %rax
jmp 0x9b132
movq 0x8(%rsp), %rax
cmpq (%rsp), %rax
je 0x9b2a6
xorl %ecx, %ecx
movq %r15, %r12
movq %r14, %r15
movq 0x38(%rsp), %rax
movl (%rax,%rcx,4), %ebx
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rsp)
movl (%rax,%rcx,4), %r13d
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x50(%rsp), %r14
movq %r14, %rdi
leaq 0x239a6(%rip), %rsi     # 0xbeb41
leaq 0x239b9(%rip), %rdx     # 0xbeb5b
callq 0xd0b8
xorl %esi, %esi
cmpl %r13d, %ebx
sete %sil
movq %rbp, %rdi
movq %r14, %rdx
callq 0xbf0a
movq %r15, %r14
movq %r12, %r15
movq %rbp, %rdi
movq %r14, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x23986(%rip), %rsi     # 0xbeb5c
callq 0x18b66
movq %rax, %rdi
movq %r15, %rsi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x9b20b
movq 0x38(%rsp), %rax
movq %rbx, %rdi
addq $0x10, %rdi
movq 0x18(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x22f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x23932(%rip), %rsi     # 0xbeb52
callq 0x18a86
movq %rax, %rdi
movq %r15, %rsi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x9b255
movq 0x20(%rsp), %rax
movq %rbx, %rdi
addq $0x10, %rdi
movq 0x18(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x22f0
movq %rbx, %rdi
leaq 0x1d10a(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbp, %rdi
callq 0xbf62
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x9b288
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x18(%rsp), %rcx
incq %rcx
movq 0x8(%rsp), %rax
subq (%rsp), %rax
sarq $0x2, %rax
cmpq %rax, %rcx
jb 0x9b166
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x9b2bd
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
movq %rsp, %rbx
je 0x9b2d7
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x9b2ed
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq 0x70(%rsp), %rsi
incq %rsi
cmpq $0x64, %rsi
jne 0x9b089
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x9b37e
movq %rax, %rbx
jmp 0x9b367
jmp 0x9b31d
movq %rax, %rbx
jmp 0x9b350
movq %rax, %rbx
jmp 0x9b334
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xbf62
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x9b350
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x9b367
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9b37e
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x9b394
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036