// File: /workspace/github_cpp_makefile_star2_O1/StanHash[P]nesdump/nesdump.cc
// Function: parse_item(std::basic_string_view<char, std::char_traits<char>>)
Item parse_item(std::string_view item_str)
{
    std::size_t const colon_pos = item_str.find_first_of(':');

    std::string_view const item_name = (colon_pos == std::string_view::npos)
        ? item_str
        : item_str.substr(0, colon_pos);

    std::string_view const item_part = (colon_pos == std::string_view::npos)
        ? ""
        : item_str.substr(colon_pos+1);

    if (item_name.compare("info") == 0)
    {
        Item result = ItemInfo {};
        return result;
    }

    if (item_name.compare("prg") == 0)
    {
        int bank = -1;

        if (!item_part.empty())
            bank = std::stoi(std::string { item_part }, nullptr, 0);

        Item result = ItemPrg { bank };
        return result;
    }

    if (item_name.compare("chr") == 0)
    {
        int bank = -1;

        if (!item_part.empty())
            bank = std::stoi(std::string { item_part }, nullptr, 0);

        Item result = ItemChr { bank };
        return result;
    }

    Item result = ItemError {};
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r12
movq %rdi, %rbx
testq %rdi, %rdi
je 0x2409
movq %r12, %rdi
movl $0x3a, %esi
movq %rbx, %rdx
callq 0x21b0
movq %rax, %rdx
subq %r12, %rdx
xorl %ecx, %ecx
cmpq $0x1, %rax
sbbq %rcx, %rcx
orq %rdx, %rcx
jmp 0x2410
movq $-0x1, %rcx
cmpq %rcx, %rbx
movq %rcx, %r13
cmovbq %rbx, %r13
cmpq $-0x1, %rcx
cmoveq %rbx, %r13
je 0x2439
leaq 0x1(%rcx), %r15
cmpq %rbx, %rcx
jae 0x262f
subq %r15, %rbx
addq %r12, %r15
jmp 0x2442
xorl %ebx, %ebx
leaq 0x1c65(%rip), %r15      # 0x40a7
testq %r13, %r13
je 0x246a
cmpq $0x4, %r13
movl $0x4, %edx
cmovbq %r13, %rdx
leaq 0x1ba9(%rip), %rsi      # 0x4004
movq %r12, %rdi
callq 0x21a0
testl %eax, %eax
sete %al
jmp 0x246c
movb $0x1, %al
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpq $0x4, %r13
sete %cl
testb %cl, %al
je 0x248e
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
incq %r13
xorl %r14d, %r14d
jmp 0x261a
testq %r13, %r13
je 0x24b6
cmpq $0x3, %r13
movl $0x3, %edx
cmovbq %r13, %rdx
leaq 0x1b62(%rip), %rsi      # 0x4009
movq %r12, %rdi
callq 0x21a0
testl %eax, %eax
sete %al
jmp 0x24b8
movb $0x1, %al
cmpq $0x3, %r13
setne %cl
xorb $0x1, %al
orb %cl, %al
jne 0x2549
movabsq $0x200000000, %r13      # imm = 0x200000000
testq %rbx, %rbx
je 0x261a
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
addq %r15, %rbx
movq %rsp, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2dc4
movq (%rsp), %rbx
callq 0x2040
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x20(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x21f0
cmpq %rbx, (%r12)
je 0x264a
movq %rax, %r14
movslq %r14d, %rax
cmpq %r14, %rax
jne 0x253d
movl (%r15), %eax
cmpl $0x22, %eax
jne 0x25f0
leaq 0x1b44(%rip), %rdi      # 0x4088
callq 0x2200
testq %r13, %r13
je 0x2571
cmpq $0x3, %r13
movl $0x3, %edx
cmovbq %r13, %rdx
leaq 0x1aab(%rip), %rsi      # 0x400d
movq %r12, %rdi
callq 0x21a0
testl %eax, %eax
sete %al
jmp 0x2573
movb $0x1, %al
cmpq $0x3, %r13
setne %cl
xorb $0x1, %al
orb %cl, %al
jne 0x2614
movabsq $0x300000000, %r13      # imm = 0x300000000
testq %rbx, %rbx
je 0x261a
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
addq %r15, %rbx
movq %rsp, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2dc4
movq (%rsp), %rbx
callq 0x2040
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x20(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x21f0
cmpq %rbx, (%r12)
je 0x2656
movq %rax, %r14
movslq %r14d, %rax
cmpq %r14, %rax
jne 0x2662
movl (%r15), %eax
cmpl $0x22, %eax
je 0x2662
testl %eax, %eax
jne 0x25f7
movl %ebp, (%r15)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x261a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x261a
xorl %r14d, %r14d
xorl %r13d, %r13d
movl %r14d, %eax
orq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a21(%rip), %rdi      # 0x4057
leaq 0x1a00(%rip), %rsi      # 0x403d
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2210
leaq 0x1a37(%rip), %rdi      # 0x4088
callq 0x20f0
leaq 0x1a2b(%rip), %rdi      # 0x4088
callq 0x20f0
leaq 0x1a1f(%rip), %rdi      # 0x4088
callq 0x2200
jmp 0x2672
jmp 0x2677
movq %rax, %rbx
jmp 0x269e
movq %rax, %rbx
cmpl $0x0, (%r15)
jne 0x2683
movl %ebp, (%r15)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x269e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x2270