// File: 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
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movl $0x0, -0x4(%rbp)
cmpl $0x64, -0x4(%rbp)
jge 0x1c59a6
movslq -0x4(%rbp), %rax
movq %rax, -0x278(%rbp)
leaq -0x21(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x10e30
movq -0x278(%rbp), %rsi
movq -0x270(%rbp), %rdx
leaq -0x20(%rbp), %rdi
callq 0x1c59c0
jmp 0x1c55a0
leaq -0x21(%rbp), %rdi
callq 0x10e50
leaq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x1bd8c0
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x1bd8f0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1c5a30
testb $0x1, %al
jne 0x1c55de
jmp 0x1c5623
leaq -0x48(%rbp), %rdi
callq 0x1be360
movq %rax, -0x58(%rbp)
callq 0x3410
movl $0x64, %ecx
cltd
idivl %ecx
movq -0x58(%rbp), %rax
movl %edx, (%rax)
leaq -0x48(%rbp), %rdi
callq 0x1be320
jmp 0x1c55cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x21(%rbp), %rdi
callq 0x10e50
jmp 0x1c59af
leaq -0x70(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1c5a70
jmp 0x1c5632
leaq -0x88(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1c5a70
jmp 0x1c5644
leaq -0x70(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x1bd8c0
movq -0x280(%rbp), %rdi
movq %rax, -0x90(%rbp)
callq 0x1bd8f0
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x1c5b60
jmp 0x1c5683
leaq -0x88(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x1bd8c0
movq -0x288(%rbp), %rdi
movq %rax, -0xa0(%rbp)
callq 0x1bd8f0
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x1c5ba0
jmp 0x1c56c5
movq $0x0, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x290(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x1c5c50
movq %rax, %rcx
movq -0x290(%rbp), %rax
cmpq %rcx, %rax
jae 0x1c595a
movq -0xb0(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x1bdf70
movl (%rax), %eax
movl %eax, -0x2a0(%rbp)
movq -0xb0(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x1bdf70
movq %rax, %rcx
movl -0x2a0(%rbp), %eax
movl (%rcx), %ecx
subl %ecx, %eax
sete %al
movb %al, -0x299(%rbp)
leaq -0x261(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x33b0
movq -0x298(%rbp), %rdx
leaq 0x37b12(%rip), %rsi     # 0x1fd26e
leaq -0x260(%rbp), %rdi
callq 0x10a90
jmp 0x1c576a
movb -0x299(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rdx
callq 0x10f80
jmp 0x1c578b
leaq 0x17053(%rip), %rsi     # 0x1dc7e5
leaq -0x240(%rbp), %rdi
callq 0x34320
movq %rax, -0x2a8(%rbp)
jmp 0x1c57a7
movq -0x2a8(%rbp), %rdi
leaq 0x37ad4(%rip), %rsi     # 0x1fd289
callq 0x347a0
movq %rax, -0x2b0(%rbp)
jmp 0x1c57c3
movq -0x2b0(%rbp), %rdi
leaq 0x1afdb(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x2b8(%rbp)
jmp 0x1c57df
movq -0xb0(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x1bdf70
movq -0x2b8(%rbp), %rdi
movq %rax, %rsi
callq 0x343a0
movq %rax, -0x2c0(%rbp)
jmp 0x1c5807
movq -0x2c0(%rbp), %rdi
leaq 0x16fd0(%rip), %rsi     # 0x1dc7e5
callq 0x34320
movq %rax, -0x2c8(%rbp)
jmp 0x1c5823
movq -0x2c8(%rbp), %rdi
leaq 0x37a4e(%rip), %rsi     # 0x1fd27f
callq 0x344d0
movq %rax, -0x2d0(%rbp)
jmp 0x1c583f
movq -0x2d0(%rbp), %rdi
leaq 0x1af5f(%rip), %rsi     # 0x1e07ac
callq 0x34320
movq %rax, -0x2d8(%rbp)
jmp 0x1c585b
movq -0xb0(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x1bdf70
movq -0x2d8(%rbp), %rdi
movq %rax, %rsi
callq 0x343a0
movq %rax, -0x2e0(%rbp)
jmp 0x1c5886
movq -0x2e0(%rbp), %rdi
leaq 0x30be7(%rip), %rsi     # 0x1f647b
callq 0x34320
jmp 0x1c589b
leaq -0x240(%rbp), %rdi
callq 0x10ff0
jmp 0x1c58a9
leaq -0x260(%rbp), %rdi
callq 0x3100
leaq -0x261(%rbp), %rdi
callq 0x3290
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
jmp 0x1c56d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1c599b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1c5992
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1c5986
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1c594c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1c5940
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x10ff0
jmp 0x1c593e
jmp 0x1c5940
leaq -0x260(%rbp), %rdi
callq 0x3100
leaq -0x261(%rbp), %rdi
callq 0x3290
jmp 0x1c5986
leaq -0x88(%rbp), %rdi
callq 0x1bd9c0
leaq -0x70(%rbp), %rdi
callq 0x1bd9c0
leaq -0x20(%rbp), %rdi
callq 0x1bd9c0
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x1c5562
leaq -0x88(%rbp), %rdi
callq 0x1bd9c0
leaq -0x70(%rbp), %rdi
callq 0x1bd9c0
leaq -0x20(%rbp), %rdi
callq 0x1bd9c0
jmp 0x1c59af
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0