// File: /workspace/github_cpp_makefile_star2_O3/aalto-speech[P]ftk/util/str.hh
// Function: str::split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*, bool, unsigned int)
inline std::vector<std::string>
split(const std::string &str, const char *delims, bool group,
      unsigned int num_fields = 0)
{
    std::vector<std::string> fields;
    size_t begin = 0;
    size_t end = 0;

    fields.clear();
    bool delim_pending = false;
    while (begin < str.length()) {
        // If 'fields' fields was requested and, this is the last field,
        // include the rest.
        if (num_fields > 0 && fields.size() == num_fields - 1) {
            delim_pending = false;
            fields.push_back(str.substr(begin));
            break;
        }

        // Find the string before the next delim
        delim_pending = false;
        while (end < str.length()) {
            if (strchr(delims, str[end])) {
                delim_pending = true;
                break;
            }
            end++;
        }
        fields.push_back(str.substr(begin, end - begin));

        // Eat the delim or group of delims
        end++;
        if (group)
            while (end < str.length() && strchr(delims, str[end]))
                end++;

        begin = end;
    }

    if (delim_pending)
        fields.push_back("");

    return fields;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %ebx
movl %ecx, -0x5c(%rbp)
movq %rdx, %r13
movq %rsi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %rdi, -0x30(%rbp)
callq 0x82a2
movq 0x8(%r14), %r15
testq %r15, %r15
je 0x7cd9
movq %rbx, -0x78(%rbp)
leal -0x1(%rbx), %eax
movq %rax, -0x68(%rbp)
xorl %ebx, %ebx
movq %r14, -0x70(%rbp)
cmpl $0x0, -0x78(%rbp)
je 0x7bc2
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq -0x68(%rbp), %rax
je 0x7cec
cmpq %r15, %rbx
jae 0x7c0c
movq (%r14), %r14
movsbl (%r14,%rbx), %esi
movq %r13, %rdi
callq 0x4130
movb $0x1, %cl
movq %rbx, %r12
testq %rax, %rax
jne 0x7c20
movq %rbx, -0x58(%rbp)
leaq 0x1(%rbx), %r12
movq %r12, %rbx
cmpq %r12, %r15
je 0x7c13
movsbl (%r14,%rbx), %esi
movq %r13, %rdi
callq 0x4130
leaq 0x1(%rbx), %r12
testq %rax, %rax
je 0x7be9
decq %r12
jmp 0x7c16
xorl %ecx, %ecx
movq %rbx, %r12
jmp 0x7c20
movq %r15, %r12
cmpq %r15, %rbx
setb %cl
movq -0x58(%rbp), %rbx
movl %ecx, -0x58(%rbp)
movq %r12, %rcx
subq %rbx, %rcx
movq %rbx, %rdx
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq -0x70(%rbp), %r14
movq %r14, %rsi
callq 0x43b0
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x82e8
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7c5d
callq 0x4350
incq %r12
movq 0x8(%r14), %r15
cmpb $0x0, -0x5c(%rbp)
je 0x7c8e
cmpq %r15, %r12
jae 0x7c8e
movq (%r14), %rbx
movsbl (%rbx,%r12), %esi
movq %r13, %rdi
callq 0x4130
testq %rax, %rax
je 0x7c8e
incq %r12
cmpq %r12, %r15
jne 0x7c72
jmp 0x7c9a
movq %r12, %rbx
cmpq %r15, %r12
jb 0x7ba3
cmpb $0x0, -0x58(%rbp)
je 0x7cd9
leaq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
movq %rax, (%rdi)
leaq 0x1e8e5(%rip), %rdx     # 0x26597
movq %rdx, %rsi
callq 0x5fac
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x82e8
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7cd9
callq 0x4350
movq -0x30(%rbp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x43b0
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x82e8
jmp 0x7cc7
jmp 0x7d19
jmp 0x7d30
jmp 0x7d19
jmp 0x7d30
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7d33
callq 0x4350
jmp 0x7d33
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x5d4e
movq %r14, %rdi
callq 0x4650