// 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&)
void
FactorGraph::remove_arcs(const std::string &remstr)
{
    for (auto node = nodes.begin(); node != nodes.end(); ++node) {
        if (this->get_factor(*node) != remstr) continue;
        while (node->incoming.size() > 0)
            remove_arc(node->incoming[0]);
        while (node->outgoing.size() > 0)
            remove_arc(node->outgoing[0]);
    }

    // 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 $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x60(%rbp)
addq $0x40, %rdi
callq 0x23850
movq %rax, -0x18(%rbp)
movq -0x60(%rbp), %rdi
addq $0x40, %rdi
callq 0x238c0
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x23880
testb $0x1, %al
jne 0x22b2c
jmp 0x22c04
leaq -0x18(%rbp), %rdi
callq 0x244d0
movq -0x60(%rbp), %rsi
movq %rax, %rdx
leaq -0x40(%rbp), %rdi
callq 0x24450
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x24420
movb %al, -0x61(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4828
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x22b67
jmp 0x22b6c
jmp 0x22bf6
jmp 0x22b6e
leaq -0x18(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x23e90
cmpq $0x0, %rax
jbe 0x22bb0
leaq -0x18(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x244f0
movq -0x60(%rbp), %rdi
movq (%rax), %rsi
callq 0x22630
jmp 0x22b6e
jmp 0x22bb2
leaq -0x18(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x23e90
cmpq $0x0, %rax
jbe 0x22bf4
leaq -0x18(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x244f0
movq -0x60(%rbp), %rdi
movq (%rax), %rsi
callq 0x22630
jmp 0x22bb2
jmp 0x22bf6
leaq -0x18(%rbp), %rdi
callq 0x239c0
jmp 0x22b05
movq -0x60(%rbp), %rdi
addq $0x40, %rdi
callq 0x23850
movq %rax, -0x48(%rbp)
movq -0x60(%rbp), %rdi
addq $0x40, %rdi
callq 0x238c0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x23880
testb $0x1, %al
jne 0x22c3c
jmp 0x22d38
leaq -0x48(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x23e90
cmpq $0x0, %rax
jne 0x22caf
leaq -0x48(%rbp), %rdi
callq 0x238f0
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
jle 0x22caf
jmp 0x22c6b
leaq -0x48(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x23e90
cmpq $0x0, %rax
jbe 0x22cad
leaq -0x48(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x244f0
movq -0x60(%rbp), %rdi
movq (%rax), %rsi
callq 0x22630
jmp 0x22c6b
jmp 0x22d24
leaq -0x48(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x23e90
cmpq $0x0, %rax
jne 0x22d22
leaq -0x48(%rbp), %rdi
callq 0x238f0
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
jle 0x22d22
jmp 0x22cde
leaq -0x48(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x23e90
cmpq $0x0, %rax
jbe 0x22d20
leaq -0x48(%rbp), %rdi
callq 0x238f0
movq %rax, %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x244f0
movq -0x60(%rbp), %rdi
movq (%rax), %rsi
callq 0x22630
jmp 0x22cde
jmp 0x22d22
jmp 0x22d24
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x245b0
movq %rax, -0x58(%rbp)
jmp 0x22c15
addq $0x70, %rsp
popq %rbp
retq
nop