// File: /workspace/github_c_makefile_star2_O3/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 0x645c9(%rip), %rdx     # 0x77672
leaq 0x38(%rsp), %rdi
movq %rdx, %rsi
callq 0xedf0
movq 0x81a8b(%rip), %r14     # 0x94b48
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 0x664c8(%rip), %rsi     # 0x795ac
movq %rbx, %rdi
callq 0xca10
testl %eax, %eax
je 0x132ad
cmpq $0x0, 0x8(%rbx)
je 0x132ad
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x64563(%rip), %rdx     # 0x77672
leaq 0x10(%rsp), %rdi
movq %rdx, %rsi
callq 0xedf0
movq 0x8(%rbx), %rax
cmpq $0x2, %rax
jb 0x132e4
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 0x131d4
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 0x1318b
callq 0xc640
cmpq $0x0, 0x18(%rsp)
je 0x13253
leaq 0x78(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x18044
movq %rax, %rdi
movq %r13, %rsi
callq 0xcc40
movq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
leaq 0x644ae(%rip), %rcx     # 0x77672
xorl %r8d, %r8d
callq 0xc5c0
movl %r12d, %ebx
jmp 0x13293
decq %rax
cmpq %rax, %rbp
jne 0x13293
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 0x1321f
callq 0xc640
cmpq $0x0, 0x18(%rsp)
jne 0x132c8
movq %r14, %rdi
movq %r15, %r13
movq %r15, %rsi
callq 0x17fc8
cmpq $0x0, (%rax)
je 0x13346
movq %r14, %rdi
movq %r13, %rsi
callq 0x17fc8
movq (%rax), %r14
jmp 0x13293
movq %r14, %rdi
movq %r13, %rsi
callq 0x17fc8
cmpq $0x0, (%rax)
je 0x13361
movq %r14, %rdi
movq %r13, %rsi
callq 0x17fc8
movq (%rax), %r14
cmpq $0x0, 0x38(%r14)
je 0x13290
leaq 0x30(%r14), %rsi
leaq 0x10(%rsp), %rdi
callq 0xcc40
movl %r12d, %ebx
jmp 0x13293
movl %r12d, %ebx
incq %rbp
movq 0x30(%rsp), %rsi
movq 0x8(%rsi), %rax
incl %r12d
cmpq %rbp, %rax
ja 0x13147
jmp 0x132e4
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
leaq 0x8(%rax), %rdi
leaq 0x78(%rsp), %rsi
callq 0x1997e
jmp 0x13311
leaq 0x78(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x18044
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 0x1997e
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x13311
callq 0xc640
leaq 0x78(%rsp), %rdi
callq 0x19c46
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x1332f
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 0x1997e
jmp 0x132fd
movq 0x8(%rsp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x8(%rax), %rdi
leaq 0x78(%rsp), %rsi
callq 0x1997e
jmp 0x132fd
jmp 0x1338f
jmp 0x1338f
jmp 0x1338f
jmp 0x1338f
jmp 0x13386
movq %rax, %rbx
jmp 0x133a6
jmp 0x1338f
jmp 0x1338f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x133a6
callq 0xc640
leaq 0x78(%rsp), %rdi
callq 0x19c46
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x133c4
callq 0xc640
movq %rbx, %rdi
callq 0xc760