// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/test/googletest/googletest/src/gtest-internal-inl.h
// Function: void testing::internal::ShuffleRange<int>(testing::internal::Random*, int, int, std::vector<int, std::allocator<int>>*)
void ShuffleRange(internal::Random* random, int begin, int end,
                  std::vector<E>* v) {
  const int size = static_cast<int>(v->size());
  GTEST_CHECK_(0 <= begin && begin <= size)
      << "Invalid shuffle range start " << begin << ": must be in range [0, "
      << size << "].";
  GTEST_CHECK_(begin <= end && end <= size)
      << "Invalid shuffle range finish " << end << ": must be in range ["
      << begin << ", " << size << "].";

  // Fisher-Yates shuffle, from
  // https://en.wikipedia.org/wiki/Fisher-Yates_shuffle
  for (int range_width = end - begin; range_width >= 2; range_width--) {
    const int last_in_range = begin + range_width - 1;
    const int selected =
        begin +
        static_cast<int>(random->Generate(static_cast<uint32_t>(range_width)));
    std::swap((*v)[static_cast<size_t>(selected)],
              (*v)[static_cast<size_t>(last_in_range)]);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %r12d
movl %esi, %ebp
movq %rdi, %r14
movq 0x8(%rcx), %r15
subq (%rcx), %r15
shrq $0x2, %r15
testl %esi, %esi
js 0x4f055
cmpl %ebp, %r15d
jge 0x4f0cd
leaq 0xe08e(%rip), %rdx      # 0x5d0ea
leaq 0x4(%rsp), %rdi
pushq $0x3
popq %rsi
movl $0x133, %ecx            # imm = 0x133
callq 0x39dd8
movq 0x34f73(%rip), %rdi     # 0x83fe8
leaq 0xe66c(%rip), %rsi      # 0x5d6e8
callq 0xd550
leaq 0xe68f(%rip), %rsi      # 0x5d717
movq %rax, %rdi
callq 0xd550
movq %rax, %rdi
movl %ebp, %esi
callq 0xda80
leaq 0xe693(%rip), %rsi      # 0x5d734
movq %rax, %rdi
callq 0xd550
movq %rax, %rdi
movl %r15d, %esi
callq 0xda80
leaq 0xe478(%rip), %rsi      # 0x5d533
movq %rax, %rdi
callq 0xd550
leaq 0x4(%rsp), %rdi
callq 0x39e9c
movl %r12d, %r13d
subl %ebp, %r13d
jl 0x4f0de
cmpl %r12d, %r15d
jge 0x4f16c
leaq 0xe005(%rip), %rdx      # 0x5d0ea
movq %rsp, %rdi
pushq $0x3
popq %rsi
movl $0x136, %ecx            # imm = 0x136
callq 0x39dd8
movq 0x34eec(%rip), %rdi     # 0x83fe8
leaq 0xe649(%rip), %rsi      # 0x5d74c
callq 0xd550
leaq 0xe66c(%rip), %rsi      # 0x5d77b
movq %rax, %rdi
callq 0xd550
movq %rax, %rdi
movl %r12d, %esi
callq 0xda80
leaq 0xe670(%rip), %rsi      # 0x5d799
movq %rax, %rdi
callq 0xd550
movq %rax, %rdi
movl %ebp, %esi
callq 0xda80
leaq 0xe607(%rip), %rsi      # 0x5d749
movq %rax, %rdi
callq 0xd550
movq %rax, %rdi
movl %r15d, %esi
callq 0xda80
leaq 0xe3d7(%rip), %rsi      # 0x5d533
movq %rax, %rdi
callq 0xd550
movq %rsp, %rdi
callq 0x39e9c
movslq %r13d, %r15
movslq %ebp, %rax
leaq -0x4(,%rax,4), %r12
cmpq $0x1, %r15
jle 0x4f1a9
movq %r14, %rdi
movl %r15d, %esi
callq 0x3b492
addl %ebp, %eax
cltq
movq (%rbx), %rcx
leaq (%rcx,%r12), %rdx
movl (%rcx,%rax,4), %esi
movl (%rdx,%r15,4), %edi
movl %edi, (%rcx,%rax,4)
movl %esi, (%rdx,%r15,4)
decq %r15
jmp 0x4f17a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x4(%rsp), %rdi
jmp 0x4f1c8
movq %rax, %rbx
movq %rsp, %rdi
callq 0x39e9c
movq %rbx, %rdi
callq 0xdaa0