// File: 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
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x98(%rbp)
addq $0x40, %rdi
callq 0x23850
movq %rax, -0x20(%rbp)
movq -0x98(%rbp), %rdi
addq $0x40, %rdi
callq 0x238c0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x23880
testb $0x1, %al
jne 0x22859
jmp 0x2298a
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x244d0
movq -0x98(%rbp), %rsi
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
callq 0x24450
movq -0xa8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x24420
movb %al, -0x99(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4828
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x228ab
jmp 0x228b0
jmp 0x2297c
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq %rax, -0xb0(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x23e90
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jae 0x2297a
leaq -0x20(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x244f0
movq -0x98(%rbp), %rsi
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %edx
leaq -0x78(%rbp), %rdi
callq 0x24510
movq -0xc0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x24420
movb %al, -0xb1(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4828
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x22958
jmp 0x2295a
jmp 0x2296c
movq -0x98(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x22630
jmp 0x2297a
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x228b7
jmp 0x2297c
leaq -0x20(%rbp), %rdi
callq 0x239c0
jmp 0x2282f
movq -0x98(%rbp), %rdi
addq $0x40, %rdi
callq 0x23850
movq %rax, -0x80(%rbp)
movq -0x98(%rbp), %rdi
addq $0x40, %rdi
callq 0x238c0
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x23880
testb $0x1, %al
jne 0x229ce
jmp 0x22ad3
leaq -0x80(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x23e90
cmpq $0x0, %rax
jne 0x22a44
leaq -0x80(%rbp), %rdi
callq 0x238f0
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
jle 0x22a44
jmp 0x229fd
leaq -0x80(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x23e90
cmpq $0x0, %rax
jbe 0x22a42
leaq -0x80(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x244f0
movq -0x98(%rbp), %rdi
movq (%rax), %rsi
callq 0x22630
jmp 0x229fd
jmp 0x22abc
leaq -0x80(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x23e90
cmpq $0x0, %rax
jne 0x22aba
leaq -0x80(%rbp), %rdi
callq 0x238f0
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
jle 0x22aba
jmp 0x22a73
leaq -0x80(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x23e90
cmpq $0x0, %rax
jbe 0x22ab8
leaq -0x80(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x244f0
movq -0x98(%rbp), %rdi
movq (%rax), %rsi
callq 0x22630
jmp 0x22a73
jmp 0x22aba
jmp 0x22abc
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
callq 0x245b0
movq %rax, -0x90(%rbp)
jmp 0x2299e
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)