// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./src/router.h
// Function: route::route(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::pair<int, std::map<std::string, std::string>>
    route(const std::string& uri){
        std::string tmp = "";
        int last_pos = 1;
        struct Tree *top = root;
        std::map<std::string, std::string> ret;
        if(uri == "/" || uri.empty()) return make_pair(0, ret);

        std::string has_catcher = "";

        for(auto i = 1; i < uri.size(); ++i){
            if(uri[i] == '/'){
                tmp = uri.substr(last_pos, i - last_pos);
                last_pos = i + 1;

                if(!has_catcher.empty()){
                    ret[has_catcher] = tmp;
                    has_catcher = "";
                    continue;
                }

                if(top->to[tmp]){
                    top = top->to[tmp];

                    if(!top->catcher.empty()){
                        has_catcher = top->catcher;
                    }
                    continue;
                }
                else{
                    return make_pair(-1, ret);
                }
            }
            if(i == uri.size() - 1){
                tmp = uri.substr(last_pos, i - last_pos + 1);
                // std::cout << tmp << ",";
                if(!has_catcher.empty()){
                    ret[has_catcher] = tmp;
                    break;
                }

                if(top->to[tmp]) 
                    top = top->to[tmp];
                else
                    return make_pair(-1, ret);
            }
        }

        return make_pair(top->ending, ret);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x66593(%rip), %rdx     # 0x79667
leaq 0x38(%rsp), %rdi
movq %rdx, %rsi
callq 0xedfa
movq 0x83a60(%rip), %r14     # 0x96b48
leaq 0x80(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x6849d(%rip), %rsi     # 0x7b5ac
movq %rbx, %rdi
callq 0xca10
testl %eax, %eax
je 0x132d8
cmpq $0x0, 0x8(%rbx)
je 0x132d8
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x6652d(%rip), %rdx     # 0x79667
leaq 0x10(%rsp), %rdi
movq %rdx, %rsi
callq 0xedfa
movq 0x8(%rbx), %rax
cmpq $0x2, %rax
jb 0x1330f
movq %rbx, %rsi
movl $0x1, %ebx
movl $0x1, %ebp
movl $0x2, %r12d
leaq 0x38(%rsp), %r13
movq %rsi, 0x30(%rsp)
movq (%rsi), %rcx
cmpb $0x2f, (%rcx,%rbp)
jne 0x131ff
movslq %ebx, %rdx
notl %ebx
addl %r12d, %ebx
movslq %ebx, %rcx
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0xcb00
movq %r13, %rdi
movq %rbx, %rsi
callq 0xc5e0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x131b6
callq 0xc640
cmpq $0x0, 0x18(%rsp)
je 0x1327e
leaq 0x78(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x183b2
movq %rax, %rdi
movq %r13, %rsi
callq 0xcc40
movq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
leaq 0x66478(%rip), %rcx     # 0x79667
xorl %r8d, %r8d
callq 0xc5c0
movl %r12d, %ebx
jmp 0x132be
decq %rax
cmpq %rax, %rbp
jne 0x132be
movq %r13, %r15
movslq %ebx, %rdx
movl %r12d, %eax
subl %edx, %eax
movslq %eax, %rcx
leaq 0x58(%rsp), %r13
movq %r13, %rdi
movq 0x30(%rsp), %rsi
callq 0xcb00
movq %r15, %rdi
movq %r13, %rsi
callq 0xc5e0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x1324a
callq 0xc640
cmpq $0x0, 0x18(%rsp)
jne 0x132f3
movq %r14, %rdi
movq %r15, %r13
movq %r15, %rsi
callq 0x18336
cmpq $0x0, (%rax)
je 0x13371
movq %r14, %rdi
movq %r13, %rsi
callq 0x18336
movq (%rax), %r14
jmp 0x132be
movq %r14, %rdi
movq %r13, %rsi
callq 0x18336
cmpq $0x0, (%rax)
je 0x1338c
movq %r14, %rdi
movq %r13, %rsi
callq 0x18336
movq (%rax), %r14
cmpq $0x0, 0x38(%r14)
je 0x132bb
leaq 0x30(%r14), %rsi
leaq 0x10(%rsp), %rdi
callq 0xcc40
movl %r12d, %ebx
jmp 0x132be
movl %r12d, %ebx
incq %rbp
movq 0x30(%rsp), %rsi
movq 0x8(%rsi), %rax
incl %r12d
cmpq %rbp, %rax
ja 0x13172
jmp 0x1330f
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
leaq 0x8(%rax), %rdi
leaq 0x78(%rsp), %rsi
callq 0x19d16
jmp 0x1333c
leaq 0x78(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x183b2
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0xcc40
movl 0x50(%r14), %eax
movq 0x8(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x8(%rcx), %rdi
leaq 0x78(%rsp), %rsi
callq 0x19d16
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1333c
callq 0xc640
leaq 0x78(%rsp), %rdi
callq 0x19fde
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x1335a
callq 0xc640
movq 0x8(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x8(%rax), %rdi
leaq 0x78(%rsp), %rsi
callq 0x19d16
jmp 0x13328
movq 0x8(%rsp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x8(%rax), %rdi
leaq 0x78(%rsp), %rsi
callq 0x19d16
jmp 0x13328
jmp 0x133ba
jmp 0x133ba
jmp 0x133ba
jmp 0x133ba
jmp 0x133b1
movq %rax, %rbx
jmp 0x133d1
jmp 0x133ba
jmp 0x133ba
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x133d1
callq 0xc640
leaq 0x78(%rsp), %rdi
callq 0x19fde
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x133ef
callq 0xc640
movq %rbx, %rdi
callq 0xc760