// File: /workspace/github_cpp_makefile_star2_O1/occivink[P]pyct/pyct.cpp
// Function: size_to_number(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
u64 size_to_number(const std::string& s) {
    int bits = false;
    int mult = 1;
    enum {
        Num,
        NumOrUnitOrBit,
        Bit,
        Nothing,
    } expects = Num;
    std::string numPart;
    for (size_t i = 0; i < s.size(); ++i) {
        char c = s[i];
        if (expects == Num) {
            if (c < '0' or c > '9')
                throw std::runtime_error{"Not a number"};
            expects = NumOrUnitOrBit;
        } else if (expects == NumOrUnitOrBit) {
            auto readUnit = [&](int val){
                mult = val;
                expects = Bit;
                numPart = s.substr(0, i);
            };
            if (c >= '0' and c <= '9')
                {}
            else if (c == 'k' or c == 'K')
                readUnit(1024);
            else if (c == 'm' or c == 'M')
                readUnit(1024 * 1024);
            else if (c == 'g' or c == 'G')
                readUnit(1024 * 1024 * 1024);
            else if (c == 'b' or c == 'B') {
                bits = c == 'b';
                expects = Nothing;
            } else {
                throw std::runtime_error{"Not a number or unit"};
            }
        } else if (expects == Bit) {
            bits = c == 'b';
            expects = Nothing;
        } else if (expects == Nothing) {
            throw std::runtime_error{"Unexpected character"};
        }
    }
    if (numPart.empty())
        numPart = s;
    u64 num = stoull(numPart);
    if (bits)
        return num * mult / 8;
    else
        return num * mult;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpq $0x0, 0x8(%rdi)
je 0x9d1e
leaq 0x38(%rsp), %r12
xorl %r14d, %r14d
movq (%rbx), %rax
movzbl (%rax,%r14), %edx
movl %r14d, %eax
leaq 0x41f6(%rip), %rbp      # 0xdf00
movslq (%rbp,%rax,4), %rsi
addq %rbp, %rsi
movl $0x1, %eax
xorl %r13d, %r13d
xorl %ecx, %ecx
jmpq *%rsi
movb $0x1, 0x7(%rsp)
movl $0x1, %r13d
jmp 0x9d36
testl %r13d, %r13d
sete 0x7(%rsp)
movl %eax, %r13d
cmpq $0x0, 0x10(%rsp)
jne 0x9d4b
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2110
movq 0x8(%rsp), %r15
callq 0x2040
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x28(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x22a0
cmpq %r15, (%r12)
je 0x9dd8
movq %rax, %rbx
movl (%r14), %eax
testl %eax, %eax
je 0x9d96
cmpl $0x22, %eax
jne 0x9d99
leaq 0x4b1d(%rip), %rdi      # 0xe8ae
callq 0x22e0
movl %ebp, (%r14)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9db5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
imulq %r13, %rbx
movq %rbx, %rax
shrq $0x3, %rax
cmpb $0x0, 0x7(%rsp)
cmovneq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4acf(%rip), %rdi      # 0xe8ae
callq 0x2130
jmp 0x9fdc
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x9fdf
movl %ebp, (%r14)
jmp 0x9fdf
addb $-0x3a, %dl
movl $0x1, %ecx
cmpb $-0xb, %dl
ja 0x9f73
movl $0x10, %edi
callq 0x20f0
movq %rax, %r14
leaq 0x41fd(%rip), %rsi      # 0xe020
movq %rax, %rdi
callq 0x20b0
jmp 0x9fc1
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x9fdf
leal -0x30(%rdx), %esi
cmpb $0xa, %sil
jb 0x9f73
movl %edx, %ecx
andl $-0x21, %ecx
cmpl $0x47, %ecx
je 0x9ee9
cmpl $0x4d, %ecx
je 0x9ea9
cmpl $0x4b, %ecx
jne 0x9f2e
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x2210
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0x2270
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x9ea2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movl $0x400, %eax            # imm = 0x400
jmp 0x9f27
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x2210
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0x2270
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x9ee2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movl $0x100000, %eax         # imm = 0x100000
jmp 0x9f27
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x2210
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0x2270
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x9f22
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movl $0x40000000, %eax       # imm = 0x40000000
movl $0x2, %ecx
jmp 0x9f73
movl %edx, %ecx
orl $0x20, %ecx
cmpl $0x62, %ecx
je 0x9f94
movl $0x10, %edi
callq 0x20f0
movq %rax, %r14
leaq 0x40e1(%rip), %rsi      # 0xe02d
movq %rax, %rdi
callq 0x20b0
movq 0x8095(%rip), %rsi      # 0x11ff0
movq 0x804e(%rip), %rdx      # 0x11fb0
movq %r14, %rdi
callq 0x2360
jmp 0x9fdc
jmp 0x9e30
jmp 0x9fdc
incq %r14
cmpq 0x8(%rbx), %r14
jae 0x9d2b
movq (%rbx), %rdx
movzbl (%rdx,%r14), %edx
movl %ecx, %esi
movslq (%rbp,%rsi,4), %rsi
addq %rbp, %rsi
jmpq *%rsi
xorl %r13d, %r13d
cmpl $0x62, %edx
sete %r13b
movl $0x3, %ecx
jmp 0x9f73
movl $0x10, %edi
callq 0x20f0
movq %rax, %r14
leaq 0x4089(%rip), %rsi      # 0xe042
movq %rax, %rdi
callq 0x20b0
movq 0x8028(%rip), %rsi      # 0x11ff0
movq 0x7fe1(%rip), %rdx      # 0x11fb0
movq %r14, %rdi
callq 0x2360
jmp 0x9e30
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9ffb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2380