// File: /workspace/github_cpp_makefile_star2_O1/aalto-speech[P]ftk/src/FactorGraph.cc
// Function: FactorGraph::remove_arcs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void
FactorGraph::remove_arcs(const std::string &source,
                         const std::string &target)
{
    for (auto node = nodes.begin(); node != nodes.end(); ++node) {
        if (source != this->get_factor(*node)) continue;
        for (unsigned int i=0; i<node->outgoing.size(); i++) {
            FactorGraph::Arc *arc = node->outgoing[i];
            if (target != this->get_factor(arc->target_node)) continue;
            this->remove_arc(arc);
            break;
        }
    }

    // Prune all transitions from non-reachable nodes
    for (auto it = nodes.begin(); it != nodes.end(); it++) {
        if (it->incoming.size() == 0 && it->len > 0) {
            while (it->outgoing.size() > 0)
                remove_arc(it->outgoing[0]);
            continue;
        }
        if (it->outgoing.size() == 0 && it->len > 0) {
            while (it->incoming.size() > 0)
                remove_arc(it->incoming[0]);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, -0x38(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdi, %rbx
movq 0x40(%rdi), %r12
cmpq 0x48(%rdi), %r12
je 0xf95b
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x10332
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movb $0x1, %r15b
cmpq -0x50(%rbp), %rdx
jne 0xf894
testq %rdx, %rdx
je 0xf891
movq -0x58(%rbp), %rsi
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x43a0
testl %eax, %eax
setne %r15b
jmp 0xf894
xorl %r15d, %r15d
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xf8a6
callq 0x4350
testb %r15b, %r15b
jne 0xf94d
movq 0x20(%r12), %rax
cmpq %rax, 0x28(%r12)
je 0xf94d
movl $0x1, %r13d
xorl %ecx, %ecx
movq (%rax,%rcx,8), %r15
movzwl 0x2(%r15), %edx
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x10378
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
movb $0x1, %r14b
cmpq -0x50(%rbp), %rdx
jne 0xf90d
testq %rdx, %rdx
je 0xf90a
movq -0x58(%rbp), %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x43a0
testl %eax, %eax
setne %r14b
jmp 0xf90d
xorl %r14d, %r14d
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xf91f
callq 0x4350
testb %r14b, %r14b
je 0xf942
movl %r13d, %ecx
movq 0x20(%r12), %rax
movq 0x28(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xf8c7
jmp 0xf94d
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf74c
addq $0x38, %r12
cmpq 0x48(%rbx), %r12
jne 0xf854
movq 0x40(%rbx), %r14
cmpq 0x48(%rbx), %r14
je 0xf9bb
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rax
je 0xf997
movq 0x28(%r14), %rax
cmpq 0x20(%r14), %rax
jne 0xf9b5
cmpb $0x0, 0x2(%r14)
je 0xf9b5
movq 0x8(%r14), %rax
cmpq %rax, 0x10(%r14)
je 0xf9b5
movq (%rax), %rsi
movq %rbx, %rdi
callq 0xf74c
jmp 0xf980
cmpb $0x0, 0x2(%r14)
jne 0xf9ab
jmp 0xf96f
movq (%rax), %rsi
movq %rbx, %rdi
callq 0xf74c
movq 0x20(%r14), %rax
cmpq %rax, 0x28(%r14)
jne 0xf9a0
addq $0x38, %r14
jmp 0xf95f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq