// File: /workspace/github_cpp_makefile_star2_O1/Kei18[P]pibt/./src/graph/station.cpp
// Function: Station::getRandomStartGoal(int)
Paths Station::getRandomStartGoal(int num) {
  int stNum = stations.size();
  if (std::any_of(stations.begin(), stations.end(),
                  [num, stNum] (Nodes st)
                  { return st.size() * stNum < num; })) {
    std::cout << "error@Station::getStartGoal, over node size" << "\n";
    std::exit(1);
  }

  // preparing shuffled one
  Paths tmpS, tmpG;
  for (auto st : stations) {
    Nodes areaS(st.size()), areaG(st.size());
    std::copy(st.begin(), st.end(), areaS.begin());
    std::copy(st.begin(), st.end(), areaG.begin());
    std::shuffle(areaS.begin(), areaS.end(), *MT);
    std::shuffle(areaG.begin(), areaG.end(), *MT);
    tmpS.push_back(areaS);
    tmpG.push_back(areaG);
  }

  Paths points;
  std::vector<std::vector<int>> indexes;
  std::vector<int> cands;  // choose goal station
  for (int i = 0; i < stNum; ++i) {
    cands.push_back(i);
    indexes.push_back({ 0, 0 });
  }
  int goalSt;

  for (int i = 0; i < num; ++i) {
    // choose start st
    do {
      ++startSt;
      startSt %= stNum;
    } while (indexes[startSt][0] >= stations[startSt].size());

    // choose goal st
    do {
      goalSt = randomChoose(cands, MT);
    } while (goalSt == startSt || indexes[goalSt][1] >= stations[goalSt].size());

    points.push_back({ tmpS[startSt][indexes[startSt][0]],
                       tmpG[goalSt][indexes[goalSt][1]]});
    indexes[startSt][0] += 1;
    indexes[goalSt][1]  += 1;
  }

  return points;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r14
movq %rdi, 0x78(%rsp)
movq 0xc8(%rsi), %rbx
movq 0xd0(%rsi), %r13
movq %r13, 0x68(%rsp)
subq %rbx, %r13
sarq $0x3, %r13
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r13
movq %r13, %rax
shlq $0x20, %rax
movl %edx, 0x74(%rsp)
movl %edx, %ecx
orq %rax, %rcx
movq %rcx, 0x80(%rsp)
movq %r13, %rbp
sarq $0x2, %rbp
testq %rbp, %rbp
jle 0x20811
incq %rbp
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x213b2
testb %al, %al
jne 0x2088e
leaq 0x18(%rbx), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x213b2
testb %al, %al
jne 0x20891
leaq 0x30(%rbx), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x213b2
testb %al, %al
jne 0x20891
leaq 0x48(%rbx), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x213b2
testb %al, %al
jne 0x20891
addq $0x60, %rbx
decq %rbp
cmpq $0x1, %rbp
jg 0x207ac
movq 0x68(%rsp), %r15
movq %r15, %rax
subq %rbx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq $0x1, %rax
je 0x20873
cmpq $0x2, %rax
je 0x2085b
movq %r15, %r12
cmpq $0x3, %rax
jne 0x20896
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
callq 0x213b2
testb %al, %al
jne 0x20889
addq $0x18, %rbx
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
callq 0x213b2
testb %al, %al
jne 0x20889
addq $0x18, %rbx
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
callq 0x213b2
testb %al, %al
cmoveq %r15, %rbx
movq %rbx, %r12
jmp 0x20896
movq %rbx, %r12
movq 0x68(%rsp), %r15
cmpq %r15, %r12
jne 0x20c8c
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
xorl %eax, %eax
movq %rax, 0x90(%rsp)
movq %rax, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq 0xc8(%r14), %r15
movq 0xd0(%r14), %rbp
cmpq %rbp, %r15
je 0x209f3
leaq 0x10(%rsp), %r12
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x19a68
movq 0x38(%rsp), %rsi
subq 0x30(%rsp), %rsi
sarq $0x3, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x1b584
movq 0x38(%rsp), %rsi
subq 0x30(%rsp), %rsi
sarq $0x3, %rsi
movq %rbx, %rdi
leaq 0xa0(%rsp), %rdx
callq 0x1b584
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
subq %rsi, %rdx
je 0x20942
movq 0x10(%rsp), %rdi
callq 0x65b0
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
subq %rsi, %rdx
je 0x2095b
movq 0x50(%rsp), %rdi
callq 0x65b0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x60(%r14), %rdx
callq 0x1b60e
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%r14), %rdx
callq 0x1b60e
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x2140c
leaq 0xb0(%rsp), %rdi
movq %rbx, %rsi
callq 0x2140c
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x209b8
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x209cf
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x209e6
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
addq $0x18, %r15
cmpq %rbp, %r15
jne 0x208e5
movq 0x78(%rsp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
xorl %eax, %eax
movq %rax, 0x10(%rcx)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %rax, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
testl %r13d, %r13d
jle 0x20ab8
leaq 0x50(%rsp), %r12
leaq 0xa0(%rsp), %r15
leaq 0xf(%rsp), %rbp
leaq 0x30(%rsp), %rbx
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x20a59
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x20a68
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2171e
movq $0x0, 0xa0(%rsp)
movl $0x2, %edx
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rcx
callq 0x21438
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2185a
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x20aa9
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movl 0x8(%rsp), %eax
incl %eax
movl %eax, 0x8(%rsp)
cmpl %r13d, %eax
jl 0x20a40
cmpl $0x0, 0x74(%rsp)
jle 0x20c3a
xorl %ebp, %ebp
leaq 0x50(%rsp), %rbx
leaq 0x8(%rsp), %r12
movq 0x30(%rsp), %rcx
movq 0xc8(%r14), %rsi
movl 0xc0(%r14), %edx
incl %edx
movl %edx, %eax
cltd
idivl %r13d
movl %edx, 0xc0(%r14)
movslq %edx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax), %rdi
movslq (%rdi), %rdi
movq 0x8(%rsi,%rax), %r8
subq (%rsi,%rax), %r8
sarq $0x3, %r8
cmpq %rdi, %r8
jbe 0x20ae2
movq 0x60(%r14), %rsi
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
shrq $0x2, %rax
decl %eax
movl $0x0, 0x50(%rsp)
movl %eax, 0x54(%rsp)
movq %rbx, %rdi
movq %rbx, %rdx
callq 0x1fd2e
cltq
movq 0x10(%rsp), %rcx
movslq (%rcx,%rax,4), %rax
movslq 0xc0(%r14), %rdx
cmpl %edx, %eax
je 0x20b15
movq 0x30(%rsp), %rsi
leaq (,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rsi,%rcx), %rdi
movslq 0x4(%rdi), %rdi
movq 0xc8(%r14), %r8
movq 0x8(%r8,%rcx), %r9
subq (%r8,%rcx), %r9
sarq $0x3, %r9
cmpq %rdi, %r9
jbe 0x20b15
addq %rsi, %rcx
movq 0x80(%rsp), %rdi
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rdx
movq (%rsi,%rdx), %rsi
movslq (%rsi), %rsi
movq (%rdi,%rdx), %rdx
movq (%rdx,%rsi,8), %rdx
movq %rdx, 0xa0(%rsp)
movq 0xb0(%rsp), %rdx
leaq (%rax,%rax,2), %r15
movq (%rcx), %rax
movslq 0x4(%rax), %rax
movq (%rdx,%r15,8), %rcx
movq (%rcx,%rax,8), %rax
movq %rax, 0xa8(%rsp)
movl $0x2, %edx
movq %rbx, %rdi
leaq 0xa0(%rsp), %rsi
movq %r12, %rcx
callq 0xb44a
movq 0x78(%rsp), %rdi
movq %rbx, %rsi
callq 0x18be6
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x20c11
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movslq 0xc0(%r14), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %rax
incl (%rax)
movq (%rcx,%r15,8), %rax
incl 0x4(%rax)
incl %ebp
cmpl 0x74(%rsp), %ebp
jne 0x20acf
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x20c51
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
leaq 0x30(%rsp), %rdi
callq 0x2147e
leaq 0xb0(%rsp), %rdi
callq 0xb4ce
leaq 0x80(%rsp), %rdi
callq 0xb4ce
movq 0x78(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x41315(%rip), %rdi     # 0x61fa8
leaq 0x294f7(%rip), %rsi     # 0x4a191
callq 0x6360
leaq 0x278bd(%rip), %rsi     # 0x48563
movq %rax, %rdi
callq 0x6360
movl $0x1, %edi
callq 0x6440
jmp 0x20d38
jmp 0x20cd0
jmp 0x20d38
movq %rax, %rbx
jmp 0x20d66
movq %rax, %rbx
jmp 0x20d1f
movq %rax, %rbx
jmp 0x20d08
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x20d3b
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x20d3b
jmp 0x20d38
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x20d08
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x20d1f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x20d66
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x20d66
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x20d52
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
leaq 0x30(%rsp), %rdi
callq 0x2147e
movq 0x78(%rsp), %rdi
callq 0xb4ce
leaq 0xb0(%rsp), %rdi
callq 0xb4ce
leaq 0x80(%rsp), %rdi
callq 0xb4ce
movq %rbx, %rdi
callq 0x6620