// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdi), %rax
cmpq %rax, 0x18(%rdi)
je 0x6386
movq %rax, 0x18(%rbx)
leaq 0x28(%rbx), %rdi
movq %rdi, 0x40(%rsp)
callq 0x8436
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0x5320
leaq 0x1a452(%rip), %rsi     # 0x2080b
leaq 0x48(%rsp), %rdi
callq 0x6357
testb %al, %al
je 0x642d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5190
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x5190
movslq (%rbx), %r14
movl %r14d, %edi
imull %edi, %edi
shlq $0x2, %rdi
callq 0x5030
movq %rax, 0x40(%rbx)
xorl %ecx, %ecx
testl %r14d, %r14d
movl $0x0, %edx
cmovgl %r14d, %edx
movl %r14d, %esi
leaq (,%r14,4), %rdi
cmpq %rdx, %rcx
je 0x644d
xorl %r8d, %r8d
cmpq %r8, %rsi
je 0x6425
orl $-0x1, (%rax,%r8,4)
incq %r8
jmp 0x6416
incq %rcx
addq %rdi, %rax
jmp 0x640e
movq 0x2eba4(%rip), %rdi     # 0x34fd8
leaq 0x19f02(%rip), %rsi     # 0x2033d
callq 0x5290
movq %rax, %rdi
callq 0x5130
jmp 0x6712
movq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x843e
xorl %r13d, %r13d
leaq 0x48(%rsp), %r12
leaq 0x1c(%rsp), %r14
leaq 0x20(%rsp), %rbp
cmpl 0x10(%rsp), %r13d
jge 0x650e
movq %r15, %rdi
movq %r12, %rsi
callq 0x5320
movq %r12, %rdi
leaq 0x1c365(%rip), %rsi     # 0x227f1
callq 0x6357
testb %al, %al
je 0x66f7
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0x5190
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x5190
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x5480
movq %rax, %rdi
movq %r14, %rsi
callq 0x5190
movl 0xc(%rsp), %eax
decl %eax
movl %eax, 0xc(%rsp)
movl 0x8(%rsp), %ecx
decl %ecx
movl %ecx, 0x8(%rsp)
movl 0x1c(%rsp), %edx
movss 0x18(%rsp), %xmm0
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movl %edx, 0x28(%rsp)
movss %xmm0, 0x2c(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x8474
incl %r13d
jmp 0x646c
cmpb $0x1, 0x8(%rbx)
jne 0x655e
movq 0x2eabd(%rip), %rdi     # 0x34fd8
leaq 0x19e52(%rip), %rsi     # 0x20374
callq 0x5290
movl 0xc(%rbx), %esi
movq %rax, %rdi
callq 0x5400
movq %rax, %rdi
callq 0x5130
movl (%rbx), %eax
movl 0xc(%rbx), %ecx
leaq 0x20(%rsp), %rsi
andl $0x0, (%rsi)
decl %eax
movl %eax, 0x4(%rsi)
movl %ecx, 0x8(%rsi)
movl $0x3f800000, 0xc(%rsi)  # imm = 0x3F800000
movq %rbx, %rdi
callq 0x8474
movq 0x2ea73(%rip), %rdi     # 0x34fd8
leaq 0x19e2d(%rip), %rsi     # 0x20399
callq 0x5290
movl (%rbx), %esi
movq %rax, %rdi
callq 0x5400
leaq 0x19e25(%rip), %rsi     # 0x203a7
movq %rax, %rdi
callq 0x5290
movl 0x4(%rbx), %esi
movq %rax, %rdi
callq 0x5400
leaq 0x19e15(%rip), %rsi     # 0x203b1
movq %rax, %rdi
callq 0x5290
movq %rax, %r14
movq %rbx, %rdi
callq 0x8520
movq %r14, %rdi
movl %eax, %esi
callq 0x5400
movq %rax, %rdi
callq 0x5130
movslq (%rbx), %r12
leaq (,%r12,4), %rax
testq %r12, %r12
pushq $-0x1
popq %r15
cmovnsq %rax, %r15
movq %r15, %rdi
callq 0x5030
movq %rax, %r14
movq %rax, 0x48(%rbx)
movq %r15, %rdi
callq 0x5030
movq %rax, 0x50(%rbx)
xorl %eax, %eax
testl %r12d, %r12d
movl $0x0, %ecx
cmovgl %r12d, %ecx
cmpq %rax, %rcx
je 0x6612
movl $0x7fffffff, (%r14,%rax,4) # imm = 0x7FFFFFFF
incq %rax
jmp 0x6600
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
andq $0x0, 0x10(%rdi)
movaps %xmm0, (%rdi)
andl $0x0, -0x4(%r14,%r12,4)
decq %r12
movl %r12d, %eax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
callq 0x8552
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
je 0x66e9
movslq (%rax), %r13
movl 0x4(%rax), %ebp
leaq 0x20(%rsp), %rdi
callq 0x8568
movq 0x48(%rbx), %rax
cmpl (%rax,%r13,4), %ebp
jg 0x663b
movq 0x40(%rsp), %rax
movq (%rax), %rax
imulq $0x18, %r13, %r12
movq 0x8(%rax,%r12), %r15
subq (%rax,%r12), %r15
shrq $0x2, %r15
testl %r15d, %r15d
movl $0x0, %eax
cmovlel %eax, %r15d
xorl %r14d, %r14d
cmpq %r14, %r15
je 0x663b
movq 0x10(%rbx), %rax
movq 0x28(%rbx), %rcx
movq (%rcx,%r12), %rcx
movslq (%rcx,%r14,4), %rcx
shlq $0x4, %rcx
movl (%rax,%rcx), %edx
cmpl %r13d, %edx
jne 0x66b2
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 0x66e4
movl %eax, (%rsi,%rcx,4)
shlq $0x20, %rax
movl %ecx, %ecx
orq %rax, %rcx
movq %rcx, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8552
incq %r14
jmp 0x668d
leaq 0x20(%rsp), %rdi
callq 0x8d1c
movb $0x1, %bl
jmp 0x6714
movq 0x2e8da(%rip), %rdi     # 0x34fd8
leaq 0x19c01(%rip), %rsi     # 0x20306
callq 0x5290
movq %rax, %rdi
callq 0x5130
xorl %ebx, %ebx
leaq 0x48(%rsp), %rdi
callq 0x5120
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x673f
jmp 0x6744
jmp 0x673f
jmp 0x673f
jmp 0x673f
jmp 0x673f
jmp 0x6744
jmp 0x673f
movq %rax, %rbx
jmp 0x6751
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8d1c
leaq 0x48(%rsp), %rdi
callq 0x5120
movq %rbx, %rdi
callq 0x5410