// File: 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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5dab0
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl -0xc(%rbp), %ecx
movb %al, -0x3d(%rbp)
jg 0xab90d
movl -0xc(%rbp), %eax
cmpl -0x1c(%rbp), %eax
setle %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
movzbl %al, %edi
andl $0x1, %edi
callq 0x78790
testb $0x1, %al
jne 0xab921
jmp 0xab926
jmp 0xab9e9
leaq 0x241e3(%rip), %rdx     # 0xcfb10
leaq -0x20(%rbp), %rdi
movq %rdi, -0x50(%rbp)
movl $0x3, %esi
movl $0x133, %ecx            # imm = 0x133
callq 0x7d880
movq -0x50(%rbp), %rdi
callq 0x1f280
movq %rax, %rdi
leaq 0x2482b(%rip), %rsi     # 0xd0182
callq 0x10720
movq %rax, -0x48(%rbp)
jmp 0xab962
movq -0x48(%rbp), %rdi
leaq 0x24844(%rip), %rsi     # 0xd01b1
callq 0x10720
movq %rax, -0x58(%rbp)
jmp 0xab978
movq -0x58(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x10de0
movq %rax, -0x60(%rbp)
jmp 0xab98a
movq -0x60(%rbp), %rdi
leaq 0x24839(%rip), %rsi     # 0xd01ce
callq 0x10720
movq %rax, -0x68(%rbp)
jmp 0xab9a0
movq -0x68(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x10de0
movq %rax, -0x70(%rbp)
jmp 0xab9b2
movq -0x70(%rbp), %rdi
leaq 0x245d8(%rip), %rsi     # 0xcff95
callq 0x10720
jmp 0xab9c4
leaq -0x20(%rbp), %rdi
callq 0x7d9c0
jmp 0xab9e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7d9c0
jmp 0xabbb1
movl -0xc(%rbp), %ecx
xorl %eax, %eax
cmpl -0x10(%rbp), %ecx
movb %al, -0x71(%rbp)
jg 0xaba02
movl -0x10(%rbp), %eax
cmpl -0x1c(%rbp), %eax
setle %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
movzbl %al, %edi
andl $0x1, %edi
callq 0x78790
testb $0x1, %al
jne 0xaba16
jmp 0xaba1b
jmp 0xabb30
leaq 0x240ee(%rip), %rdx     # 0xcfb10
leaq -0x30(%rbp), %rdi
movq %rdi, -0x88(%rbp)
movl $0x3, %esi
movl $0x136, %ecx            # imm = 0x136
callq 0x7d880
movq -0x88(%rbp), %rdi
callq 0x1f280
movq %rax, %rdi
leaq 0x24794(%rip), %rsi     # 0xd01e6
callq 0x10720
movq %rax, -0x80(%rbp)
jmp 0xaba5d
movq -0x80(%rbp), %rdi
leaq 0x247ad(%rip), %rsi     # 0xd0215
callq 0x10720
movq %rax, -0x90(%rbp)
jmp 0xaba76
movq -0x90(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x10de0
movq %rax, -0x98(%rbp)
jmp 0xaba8e
movq -0x98(%rbp), %rdi
leaq 0x24797(%rip), %rsi     # 0xd0233
callq 0x10720
movq %rax, -0xa0(%rbp)
jmp 0xabaaa
movq -0xa0(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x10de0
movq %rax, -0xa8(%rbp)
jmp 0xabac2
movq -0xa8(%rbp), %rdi
leaq 0x24713(%rip), %rsi     # 0xd01e3
callq 0x10720
movq %rax, -0xb0(%rbp)
jmp 0xabade
movq -0xb0(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x10de0
movq %rax, -0xb8(%rbp)
jmp 0xabaf6
movq -0xb8(%rbp), %rdi
leaq 0x24491(%rip), %rsi     # 0xcff95
callq 0x10720
jmp 0xabb0b
leaq -0x30(%rbp), %rdi
callq 0x7d9c0
jmp 0xabb30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x7d9c0
jmp 0xabbb1
movl -0x10(%rbp), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jl 0xabba8
movl -0xc(%rbp), %eax
addl -0x34(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0xc4(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x80390
movl %eax, %ecx
movl -0xc4(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
callq 0xa8fc0
movq %rax, -0xc0(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x38(%rbp), %rsi
callq 0xa8fc0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0xc7d20
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xabb39
addq $0xd0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x10e00
nopw (%rax,%rax)