// File: ekg[P]sgd2/src/sgd2.hpp
// Function: sgd2::maxmin_bfs_unweighted(std::vector<std::vector<unsigned long, std::allocator<unsigned long>>, std::allocator<std::vector<unsigned long, std::allocator<unsigned long>>>> const&, unsigned long, std::vector<unsigned long, std::allocator<unsigned long>>&, std::vector<unsigned long, std::allocator<unsigned long>>&)
void maxmin_bfs_unweighted(const std::vector<std::vector<uint64_t>>& graph, const uint64_t p, std::vector<uint64_t>& mins, std::vector<uint64_t>& argmins)
{
    uint64_t n = graph.size();
    std::queue<uint64_t> q;
    std::vector<uint64_t> d(n, -1);

    q.push(p);
    d[p] = 0;
    while (!q.empty())
    {
        uint64_t current = q.front();
        q.pop();
        for (uint64_t next : graph[current])
        {
            if (d[next] == -1)
            {
                q.push(next);
                d[next] = d[current] + 1;
                if (d[next] < mins[next])
                {
                    mins[next] = d[next];
                    argmins[next] = p;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0xb050
movq %rax, -0x28(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x9eb0
movq -0x28(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq $-0x1, -0x98(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x9df0
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rcx
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x9e10
jmp 0x51ed
leaq -0x99(%rbp), %rdi
callq 0x9e90
leaq -0x78(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x9f00
jmp 0x5208
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x9ee0
movq $0x0, (%rax)
leaq -0x78(%rbp), %rdi
callq 0x9f30
movb %al, -0xe9(%rbp)
jmp 0x5230
movb -0xe9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5241
jmp 0x5443
leaq -0x78(%rbp), %rdi
callq 0x9f70
movq %rax, -0xf8(%rbp)
jmp 0x5253
movq -0xf8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x9f90
jmp 0x526f
movq -0x8(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0xb0f0
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xb110
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xb140
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb170
testb $0x1, %al
jne 0x52c8
jmp 0x543e
leaq -0xc8(%rbp), %rdi
callq 0xb1b0
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x9ee0
cmpq $-0x1, (%rax)
jne 0x542b
leaq -0x78(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x9f00
jmp 0x530d
movq -0xb8(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x9ee0
movq (%rax), %rax
addq $0x1, %rax
movq %rax, -0x108(%rbp)
movq -0xd8(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x9ee0
movq -0x108(%rbp), %rcx
movq %rcx, (%rax)
movq -0xd8(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x9ee0
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x18(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x9ee0
movq %rax, %rcx
movq -0x100(%rbp), %rax
cmpq (%rcx), %rax
jae 0x5429
movq -0xd8(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x9ee0
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movq -0x18(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x9ee0
movq -0x118(%rbp), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x20(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x9ee0
movq -0x110(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x5429
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x99(%rbp), %rdi
callq 0x9e90
jmp 0x5461
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xa130
jmp 0x5461
jmp 0x542b
jmp 0x542d
leaq -0xc8(%rbp), %rdi
callq 0xb1d0
jmp 0x52ac
jmp 0x521f
leaq -0x90(%rbp), %rdi
callq 0xa130
leaq -0x78(%rbp), %rdi
callq 0xa110
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0xa110
movq -0xa8(%rbp), %rdi
callq 0x22a0
nopw %cs:(%rax,%rax)