// File: /workspace/github_cpp_makefile_star2_O2/ekg[P]sgd2/src/sgd2.hpp
// Function: sgd2::build_graph_weighted(unsigned long, unsigned long, unsigned long*, unsigned long*, double*)
std::vector<std::vector<edge>> build_graph_weighted(uint64_t n, uint64_t m, uint64_t* I, uint64_t* J, double* V)
{
    // used to make graph undirected, in case graph is not already
    std::vector<std::unordered_map<uint64_t, double>> undirected(n);
    std::vector<std::vector<edge>> 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";

        double v = V[ij];
        if (v <= 0)
            throw "v less or equal 0";

        if (i != j && undirected[j].find(i) == undirected[j].end()) // if key not there
        {
            undirected[i].insert({j, v});
            undirected[j].insert({i, v});
            graph[i].push_back(edge(j, v));
            graph[j].push_back(edge(i, v));
        }
        else
        {
            if (undirected[j][i] != v)
                throw "graph weights not symmetric";
        }
    }
    return graph;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, -0x78(%rbp)
movq %r8, -0x80(%rbp)
movq %rcx, -0x88(%rbp)
movq %rdx, -0x90(%rbp)
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x5fc8
leaq -0x50(%rbp), %rdx
movq %r14, -0x30(%rbp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x601a
xorl %r15d, %r15d
leaq 0x87bd(%rip), %rax      # 0xb0fe
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %r13
cmpq %r15, -0x90(%rbp)
je 0x2a70
movq -0x88(%rbp), %rax
movq (%rax,%r15,8), %rax
movq %rax, -0x38(%rbp)
cmpq %rbx, %rax
jae 0x2a8c
movq -0x80(%rbp), %rcx
movq (%rcx,%r15,8), %r12
cmpq %rbx, %r12
jae 0x2a8c
movq -0x78(%rbp), %rcx
movsd (%rcx,%r15,8), %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, -0x40(%rbp)
ucomisd %xmm1, %xmm0
jae 0x2aba
cmpq %r12, %rax
je 0x29ba
imulq $0x38, %r12, %r14
movq -0x70(%rbp), %rdi
addq %r14, %rdi
leaq -0x38(%rbp), %rsi
callq 0x827c
testq %rax, %rax
je 0x29e8
imulq $0x38, %r12, %rdi
addq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x87be
movsd (%rax), %xmm0
ucomisd -0x40(%rbp), %xmm0
jne 0x2aaf
jp 0x2aaf
incq %r15
jmp 0x2949
imulq $0x38, -0x38(%rbp), %rdi
addq -0x70(%rbp), %rdi
movq %r12, -0x50(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq %r13, %rsi
callq 0x8306
addq -0x70(%rbp), %r14
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x8306
imulq $0x18, -0x38(%rbp), %rdi
movq -0x30(%rbp), %r14
addq (%r14), %rdi
movq %r12, -0x50(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq %r13, %rsi
callq 0x8626
imulq $0x18, %r12, %rdi
addq (%r14), %rdi
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq %r13, %rsi
callq 0x8626
jmp 0x29e0
leaq -0x70(%rbp), %rdi
callq 0x6098
movq -0x30(%rbp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x2090
leaq 0x8611(%rip), %rcx      # 0xb0ac
movq %rcx, (%rax)
movq 0xe51b(%rip), %rsi      # 0x10fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x2200
leaq 0x865a(%rip), %rax      # 0xb110
movq %rax, -0x58(%rbp)
pushq $0x8
popq %rdi
callq 0x2090
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
movq 0xe4f0(%rip), %rsi      # 0x10fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x2200
movq %rax, %rbx
jmp 0x2aff
jmp 0x2af3
movq %rax, %rbx
movq %r14, %rdi
jmp 0x2afa
jmp 0x2af3
jmp 0x2af3
jmp 0x2af3
jmp 0x2af3
jmp 0x2af3
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x606c
leaq -0x70(%rbp), %rdi
callq 0x6098
movq %rbx, %rdi
callq 0x2210