// File: /workspace/github_cpp_makefile_star2_O1/bonetblai[P]mdp-engine/ctp3/./graph.h
// Function: CTP::graph_t::parse(std::istream&)
bool parse(std::istream &is) {
        // read graph from file
        edge_list_.clear();
        at_.clear();

        std::string token;
        is >> token;
        if( token == "p" ) {
            int n_edges;
            is >> num_nodes_ >> n_edges;

            edges_ = new int[num_nodes_ * num_nodes_];
            for( int n1 = 0; n1 < num_nodes_; ++n1 ) {
                for( int n2 = 0; n2 < num_nodes_; ++n2 )
                    edges_[n1*num_nodes_ + n2] = -1;
            }

            at_.resize(num_nodes_);
            for( int e = 0; e < n_edges; ++e ) {
                is >> token;
                if( token == "e" ) {
                    int from, to, cost;
                    float prob;
                    is >> from >> to >> prob >> cost;
                    --from;
                    --to;
                    add_edge(edge_t(from, to, cost, prob));
                } else {
                    std::cout << "error reading input file: road doesn't start with 'e'." << std::endl;
                    return false;
                }
            }
        } else {
            std::cout << "error reading input file: file doesn't start with 'p'." << std::endl;
            return false;
        }

        // insert shortcut (s,t) edge
        if( with_shortcut_ ) {
            std::cout << "info: adding (s,t) shortcut w/ cost " << shortcut_cost_ << std::endl;
            add_edge(edge_t(0, num_nodes_ - 1, shortcut_cost_, 1.0));
        }

        std::cout << "info: #nodes=" << num_nodes_
                  << ", #edges=" << num_edges_
                  << ", degree=" << degree()
                  << std::endl;

        // compute optimistic shortest-paths to goal
        h_opt_ = new int[num_nodes_];
        in_queue_ = new int[num_nodes_];
        for( int node = 0; node < num_nodes_; ++node )
            h_opt_[node] = INT_MAX;

        std::priority_queue<std::pair<int, int>,
                            std::vector<std::pair<int, int> >,
                            open_list_cmp> queue;

        int goal = num_nodes_ - 1;
        h_opt_[goal] = 0;
        queue.push(std::make_pair(goal, 0));
        while( !queue.empty() ) {
            std::pair<int, int> p = queue.top();
            queue.pop();
            if( p.second <= h_opt_[p.first] ) {
                for( int i = 0, isz = at_[p.first].size(); i < isz; ++i ) {
                    const edge_t &e = edge_list_[at_[p.first][i]];
                    int cost = p.second + e.cost_;
                    int to = e.from_ == p.first ? e.to_ : e.from_;
                    if( cost < h_opt_[to] ) {
                        h_opt_[to] = cost;
                        queue.push(std::make_pair(to, cost));
                    }
                }
            }
        }

        return true;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rdi), %rax
cmpq %rax, 0x18(%rdi)
je 0x7d6e
movq %rax, 0x18(%rbx)
leaq 0x28(%rbx), %rdi
movq %rdi, 0x10(%rsp)
callq 0xaf16
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x58(%rsp), %rsi
movq %r14, %rdi
callq 0x6330
leaq 0x25aac(%rip), %rsi     # 0x2d850
leaq 0x58(%rsp), %rdi
callq 0x60c0
testl %eax, %eax
je 0x7dff
movq 0x3721f(%rip), %rbx     # 0x3efd8
leaq 0x255ad(%rip), %rsi     # 0x2d36d
movl $0x36, %edx
movq %rbx, %rdi
callq 0x62e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq 0x371ed(%rip), %rdi     # 0x3efd8
callq 0x6040
movq %rax, %rdi
callq 0x61e0
xorl %ebx, %ebx
jmp 0x82f5
movq %r14, 0x50(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x61a0
movq %rsp, %rsi
movq %rax, %rdi
callq 0x61a0
movl (%rbx), %edi
imull %edi, %edi
shlq $0x2, %rdi
callq 0x6030
movq %rax, %r14
movq %rax, 0x40(%rbx)
movslq (%rbx), %rax
movq %rax, 0x48(%rsp)
testq %rax, %rax
jle 0x7e6d
movl (%rbx), %ebp
movq %rbp, %r13
shlq $0x2, %r13
xorl %r12d, %r12d
movq 0x48(%rsp), %r15
testl %ebp, %ebp
jle 0x7e65
movl %r12d, %eax
leaq (%r14,%rax,4), %rdi
movl $0xff, %esi
movq %r13, %rdx
callq 0x6180
addl %ebp, %r12d
decq %r15
jne 0x7e4d
movq 0x10(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xaf58
cmpl $0x0, (%rsp)
movq 0x50(%rsp), %r15
jle 0x7f39
xorl %r13d, %r13d
leaq 0x58(%rsp), %r12
leaq 0x1c(%rsp), %r14
leaq 0x20(%rsp), %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x6330
movq %r12, %rdi
leaq 0x279cc(%rip), %rsi     # 0x2f87e
callq 0x60c0
testl %eax, %eax
jne 0x804f
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0x61a0
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x61a0
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x6470
movq %rax, %rdi
movq %r14, %rsi
callq 0x61a0
movl 0xc(%rsp), %eax
decl %eax
movl %eax, 0xc(%rsp)
movl 0x8(%rsp), %ecx
decl %ecx
movl %ecx, 0x8(%rsp)
movl 0x1c(%rsp), %edx
movd 0x18(%rsp), %xmm0
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movl %edx, 0x28(%rsp)
movd %xmm0, 0x2c(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xafda
incl %r13d
cmpl (%rsp), %r13d
jl 0x7e9d
cmpb $0x1, 0x8(%rbx)
jne 0x7fb7
movq 0x37092(%rip), %rdi     # 0x3efd8
leaq 0x25457(%rip), %rsi     # 0x2d3a4
movl $0x24, %edx
callq 0x62e0
movl 0xc(%rbx), %esi
movq 0x37077(%rip), %rdi     # 0x3efd8
callq 0x6400
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61e0
movl (%rbx), %eax
movl 0xc(%rbx), %ecx
decl %eax
leaq 0x20(%rsp), %rsi
movl $0x0, (%rsi)
movl %eax, 0x4(%rsi)
movl %ecx, 0x8(%rsi)
movl $0x3f800000, 0xc(%rsi)  # imm = 0x3F800000
movq %rbx, %rdi
callq 0xafda
movq 0x3701a(%rip), %rdi     # 0x3efd8
leaq 0x25404(%rip), %rsi     # 0x2d3c9
movl $0xd, %edx
callq 0x62e0
movl (%rbx), %esi
movq 0x37000(%rip), %rdi     # 0x3efd8
callq 0x6400
movq %rax, %r14
leaq 0x253f0(%rip), %rsi     # 0x2d3d7
movl $0x9, %edx
movq %rax, %rdi
callq 0x62e0
movl 0x4(%rbx), %esi
movq %r14, %rdi
callq 0x6400
movq %rax, %r14
leaq 0x253d8(%rip), %rsi     # 0x2d3e1
movl $0x9, %edx
movq %rax, %rdi
callq 0x62e0
movslq (%rbx), %rcx
testq %rcx, %rcx
jle 0x809a
movq 0x10(%rsp), %rax
movq (%rax), %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movq 0x8(%rax,%rdx), %rdi
subq (%rax,%rdx), %rdi
shrq $0x2, %rdi
cmpl %esi, %edi
cmovgl %edi, %esi
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0x8032
jmp 0x809c
movq 0x36f82(%rip), %rbx     # 0x3efd8
leaq 0x252d9(%rip), %rsi     # 0x2d336
movl $0x36, %edx
movq %rbx, %rdi
callq 0x62e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq 0x36f50(%rip), %rdi     # 0x3efd8
callq 0x6040
movq %rax, %rdi
callq 0x61e0
jmp 0x7df8
xorl %esi, %esi
movq %r14, %rdi
callq 0x6400
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61e0
movslq (%rbx), %rax
leaq (,%rax,4), %rcx
testq %rax, %rax
movq $-0x1, %r14
cmovnsq %rcx, %r14
movq %r14, %rdi
callq 0x6030
movq %rax, %r15
movq %rax, 0x48(%rbx)
movq %r14, %rdi
callq 0x6030
movq %rax, 0x50(%rbx)
movslq (%rbx), %rax
testq %rax, %rax
jle 0x820f
leal 0x3(%rax), %ecx
leaq -0x1(%rax), %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %ecx
shlq $0x4, %rcx
movdqa 0x24ef2(%rip), %xmm1    # 0x2d020
movdqa 0x24efa(%rip), %xmm2    # 0x2d030
xorl %edx, %edx
movdqa 0x24f00(%rip), %xmm3    # 0x2d040
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x24f00(%rip), %xmm5    # 0x2d050
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0x818d
movl $0x7fffffff, (%r15,%rdx) # imm = 0x7FFFFFFF
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x81a5
movl $0x7fffffff, 0x4(%r15,%rdx) # imm = 0x7FFFFFFF
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %esi
testb $0x1, %sil
je 0x81e6
movl $0x7fffffff, 0x8(%r15,%rdx) # imm = 0x7FFFFFFF
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x81fa
movl $0x7fffffff, 0xc(%r15,%rdx) # imm = 0x7FFFFFFF
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rdx
cmpq %rdx, %rcx
jne 0x8150
pxor %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movdqa %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leal -0x1(%rax), %ecx
movl $0x0, -0x4(%r15,%rax,4)
movq %rsp, %rsi
movq %rcx, (%rsi)
callq 0xb0e6
movq 0x20(%rsp), %rdi
cmpq 0x28(%rsp), %rdi
je 0x82e9
movslq (%rdi), %r14
movl 0x4(%rdi), %ebp
leaq 0x20(%rsp), %rdi
callq 0xb16e
movq 0x48(%rbx), %rax
cmpl (%rax,%r14,4), %ebp
jg 0x823b
movq 0x10(%rsp), %rax
movq (%rax), %rax
leaq (%r14,%r14,2), %r13
movq 0x8(%rax,%r13,8), %r12
subq (%rax,%r13,8), %r12
shrq $0x2, %r12
testl %r12d, %r12d
jle 0x823b
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq 0x28(%rbx), %rcx
movq (%rcx,%r13,8), %rcx
movslq (%rcx,%r15,4), %rcx
shlq $0x4, %rcx
movl (%rax,%rcx), %edx
cmpl %r14d, %edx
jne 0x82ad
movl 0x4(%rax,%rcx), %edx
movl 0x8(%rax,%rcx), %eax
addl %ebp, %eax
movq 0x48(%rbx), %rsi
movslq %edx, %rcx
cmpl (%rsi,%rcx,4), %eax
jge 0x82dc
movl %eax, (%rsi,%rcx,4)
shlq $0x20, %rax
movl %ecx, %ecx
orq %rax, %rcx
movq %rcx, (%rsp)
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xb0e6
incq %r15
cmpq %r15, %r12
jne 0x828d
jmp 0x823b
testq %rdi, %rdi
je 0x82f3
callq 0x6260
movb $0x1, %bl
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x8309
callq 0x6260
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x832a
jmp 0x832f
jmp 0x832a
jmp 0x832a
jmp 0x832a
jmp 0x832a
jmp 0x832f
jmp 0x832a
movq %rax, %rbx
jmp 0x8341
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8341
callq 0x6260
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x8355
callq 0x6260
movq %rbx, %rdi
callq 0x6410
nop