// File: 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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x33f0
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x31e0
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x136ee
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x3360
movb (%rax), %al
movb %al, -0x49(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x134e8
movsbl -0x49(%rbp), %eax
cmpl $0x30, %eax
jl 0x1346a
movsbl -0x49(%rbp), %eax
cmpl $0x39, %eax
jle 0x134dc
movl $0x10, %edi
callq 0x3140
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
leaq 0x9c48(%rip), %rsi      # 0x1d0d0
callq 0x30c0
jmp 0x1348f
movq -0xa8(%rbp), %rdi
movq 0x10b53(%rip), %rsi     # 0x23ff0
movq 0x10afc(%rip), %rdx     # 0x23fa0
callq 0x34c0
jmp 0x137a5
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x3200
jmp 0x13793
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x13793
movl $0x1, -0x1c(%rbp)
jmp 0x136db
cmpl $0x1, -0x1c(%rbp)
jne 0x1364d
leaq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x1c(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
movsbl -0x49(%rbp), %eax
cmpl $0x30, %eax
jl 0x13534
movsbl -0x49(%rbp), %eax
cmpl $0x39, %eax
jg 0x13534
jmp 0x13648
movsbl -0x49(%rbp), %eax
cmpl $0x6b, %eax
je 0x13546
movsbl -0x49(%rbp), %eax
cmpl $0x4b, %eax
jne 0x1355e
leaq -0x88(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x137b0
jmp 0x13559
jmp 0x13646
movsbl -0x49(%rbp), %eax
cmpl $0x6d, %eax
je 0x13570
movsbl -0x49(%rbp), %eax
cmpl $0x4d, %eax
jne 0x13588
leaq -0x88(%rbp), %rdi
movl $0x100000, %esi         # imm = 0x100000
callq 0x137b0
jmp 0x13583
jmp 0x13644
movsbl -0x49(%rbp), %eax
cmpl $0x67, %eax
je 0x1359a
movsbl -0x49(%rbp), %eax
cmpl $0x47, %eax
jne 0x135b2
leaq -0x88(%rbp), %rdi
movl $0x40000000, %esi       # imm = 0x40000000
callq 0x137b0
jmp 0x135ad
jmp 0x13642
movsbl -0x49(%rbp), %eax
cmpl $0x62, %eax
je 0x135c4
movsbl -0x49(%rbp), %eax
cmpl $0x42, %eax
jne 0x135df
movsbl -0x49(%rbp), %eax
cmpl $0x62, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x14(%rbp)
movl $0x3, -0x1c(%rbp)
jmp 0x13640
movl $0x10, %edi
callq 0x3140
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xb0(%rbp)
leaq 0x9ae0(%rip), %rsi      # 0x1d0dd
callq 0x30c0
jmp 0x13604
movq -0xb0(%rbp), %rdi
movq 0x109de(%rip), %rsi     # 0x23ff0
movq 0x10987(%rip), %rdx     # 0x23fa0
callq 0x34c0
jmp 0x137a5
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x3200
jmp 0x13793
jmp 0x13642
jmp 0x13644
jmp 0x13646
jmp 0x13648
jmp 0x136d9
cmpl $0x2, -0x1c(%rbp)
jne 0x1366e
movsbl -0x49(%rbp), %eax
cmpl $0x62, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x14(%rbp)
movl $0x3, -0x1c(%rbp)
jmp 0x136d7
cmpl $0x3, -0x1c(%rbp)
jne 0x136d5
movl $0x10, %edi
callq 0x3140
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xb8(%rbp)
leaq 0x9a60(%rip), %rsi      # 0x1d0f2
callq 0x30c0
jmp 0x13699
movq -0xb8(%rbp), %rdi
movq 0x10949(%rip), %rsi     # 0x23ff0
movq 0x108f2(%rip), %rdx     # 0x23fa0
callq 0x34c0
jmp 0x137a5
movq -0xb8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x3200
jmp 0x13793
jmp 0x136d7
jmp 0x136d9
jmp 0x136db
jmp 0x136dd
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x13415
leaq -0x40(%rbp), %rdi
callq 0x34a0
testb $0x1, %al
jne 0x136fd
jmp 0x1370e
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x3030
jmp 0x1370c
jmp 0x1370e
xorl %eax, %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
movl $0xa, %edx
callq 0x17030
movq %rax, -0xc0(%rbp)
jmp 0x13729
movq -0xc0(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x13760
movq -0x90(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq %rcx, %rax
shrq $0x3, %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x94(%rbp)
jmp 0x1377d
movq -0x90(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq %rcx, %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x94(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x31b0
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x31b0
movq -0x58(%rbp), %rdi
callq 0x34f0
nopw %cs:(%rax,%rax)