// File: /workspace/github_cpp_makefile_star2_O1/ekg[P]sgd2/src/sgd2.hpp
// Function: sgd2::build_graph_unweighted(unsigned long, unsigned long, unsigned long*, unsigned long*)
std::vector<std::vector<uint64_t>> build_graph_unweighted(uint64_t n, uint64_t m, uint64_t* I, uint64_t* J)
{
    // used to make graph undirected, in case it is not already
    std::vector<std::unordered_set<uint64_t>> undirected(n);
    std::vector<std::vector<uint64_t>> graph(n);

    for (uint64_t ij=0; ij<m; ij++)
    {
        uint64_t i = I[ij], j = J[ij];
        if (i >= n || j >= n)
            throw "i or j bigger than n";

        if (i != j && undirected[j].find(i) == undirected[j].end()) // if edge not seen
        {
            undirected[i].insert(j);
            undirected[j].insert(i);
            graph[i].push_back(j);
            graph[j].push_back(i);
        }
    }
    return graph;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq -0x60(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x798c
leaq -0x38(%rbp), %rdx
movq %rbx, -0x40(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7a36
testq %r12, %r12
je 0x2a67
xorl %ebx, %ebx
movq (%r15,%rbx,8), %rcx
movq %rcx, -0x48(%rbp)
movq (%r14,%rbx,8), %rax
movq %rax, -0x30(%rbp)
cmpq %r13, %rcx
jae 0x2a83
cmpq %r13, %rax
jae 0x2a83
cmpq %rax, %rcx
je 0x2a5b
movq -0x60(%rbp), %rdi
imulq $0x38, %rax, %rax
movq (%rdi,%rax), %r8
movq 0x8(%rdi,%rax), %r9
movq %rcx, %rax
xorl %edx, %edx
divq %r9
movq %rdx, %rsi
movq (%r8,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x29ac
movq (%rdx), %r10
movq %rdx, %rax
cmpq 0x8(%r10), %rcx
je 0x29ac
movq %r10, %r11
movq (%r10), %r10
testq %r10, %r10
je 0x29aa
movq 0x8(%r10), %r8
movq %r8, %rax
xorl %edx, %edx
divq %r9
movl $0x0, %eax
cmpq %rsi, %rdx
jne 0x29ac
movq %r11, %rax
cmpq %r8, %rcx
jne 0x297f
jmp 0x29ac
xorl %eax, %eax
testq %rax, %rax
je 0x29bb
cmpq $0x0, (%rax)
jne 0x2a5b
imulq $0x38, %rcx, %rax
addq %rax, %rdi
movq %rdi, -0x38(%rbp)
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x8ade
imulq $0x38, -0x30(%rbp), %rdi
addq -0x60(%rbp), %rdi
movq %rdi, -0x38(%rbp)
leaq -0x48(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x8ade
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rcx), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x2a1b
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2a24
leaq -0x30(%rbp), %rdx
callq 0x8d8e
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rcx), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x2a52
movq -0x48(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2a5b
leaq -0x48(%rbp), %rdx
callq 0x8d8e
incq %rbx
cmpq %r12, %rbx
jne 0x291e
leaq -0x60(%rbp), %rdi
callq 0x7b24
movq -0x40(%rbp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x2080
leaq 0x8618(%rip), %rcx      # 0xb0ac
movq %rcx, (%rax)
movq 0xc522(%rip), %rsi      # 0xefc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x2230
movq %rax, %r14
jmp 0x2abb
jmp 0x2aaf
movq %rax, %r14
movq -0x40(%rbp), %rdi
callq 0x7ac8
leaq -0x60(%rbp), %rdi
callq 0x7b24
movq %r14, %rdi
callq 0x2240