// File: lega911[P]ijson/src/mapper.cpp
// Function: Mapper::add(ISlice, unsigned short)
void Mapper::add(ISlice name, u16 value) {
    mutex.lock();
    int i = 0;
    int next;
    int nstep = 1;
    Step *step = get_step_t(nstep);
    for(;;i++) {
        if(i >= name.size()) {
            step->end = value;
            break;
        }
        u16 a = name.ptr()[i];

        if(a == '*') {
            step->std = value;
            break;
        }

        if(a < 32 || a >= 128) THROW("Wrong char");
        a -= 32;

        next = step->k[a];
        if(!next) {
            next = _next();
            step = get_step_t(nstep);
            step->k[a] = next;
        }
        nstep = next;
        step = get_step_t(nstep);
    }

    char *old = NULL;
    if(buf_t) {
        old = abuf.exchange(buf_t);
        buf_t = NULL;
    }
    mutex.unlock();

    if(old) {
        server->_free_lock.lock();
        server->_free_list.push_back(old);
        server->_free_lock.unlock();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movw %cx, %ax
movq %rsi, -0x10(%rbp)
movl %edx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movw %ax, -0x1a(%rbp)
movq -0x18(%rbp), %rdi
movq %rdi, -0x58(%rbp)
addq $0x8, %rdi
callq 0x1fa50
movq -0x58(%rbp), %rdi
movl $0x0, -0x20(%rbp)
movl $0x1, -0x28(%rbp)
movl -0x28(%rbp), %esi
callq 0x26800
movq %rax, -0x30(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x5c(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x1e6d0
movl %eax, %ecx
movl -0x5c(%rbp), %eax
cmpl %ecx, %eax
jl 0x26291
movw -0x1a(%rbp), %cx
movq -0x30(%rbp), %rax
movw %cx, (%rax)
jmp 0x263b1
leaq -0x10(%rbp), %rdi
callq 0x1e6f0
movslq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movw %ax, -0x32(%rbp)
movzwl -0x32(%rbp), %eax
cmpl $0x2a, %eax
jne 0x262c0
movw -0x1a(%rbp), %cx
movq -0x30(%rbp), %rax
movw %cx, 0x2(%rax)
jmp 0x263b1
movzwl -0x32(%rbp), %eax
cmpl $0x20, %eax
jl 0x262d4
movzwl -0x32(%rbp), %eax
cmpl $0x80, %eax
jl 0x2633a
movl $0x30, %edi
callq 0x19180
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
leaq 0x12f0c(%rip), %rsi     # 0x391fb
leaq 0x12ee2(%rip), %rdx     # 0x391d8
leaq 0x12f09(%rip), %r8      # 0x39206
movl $0x37, %ecx
callq 0x22ba0
jmp 0x26309
movq -0x68(%rbp), %rdi
leaq 0x209ec(%rip), %rsi     # 0x46d00
leaq -0x320b(%rip), %rdx     # 0x23110
callq 0x19480
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x19210
jmp 0x26447
movzwl -0x32(%rbp), %eax
subl $0x20, %eax
movw %ax, -0x32(%rbp)
movq -0x30(%rbp), %rax
movzwl -0x32(%rbp), %ecx
movzwl 0x4(%rax,%rcx,2), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x2638d
movq -0x58(%rbp), %rdi
callq 0x26080
movq -0x58(%rbp), %rdi
movzwl %ax, %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %esi
callq 0x26800
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movw %ax, %dx
movq -0x30(%rbp), %rax
movzwl -0x32(%rbp), %ecx
movw %dx, 0x4(%rax,%rcx,2)
movq -0x58(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %esi
callq 0x26800
movq %rax, -0x30(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x26269
movq -0x58(%rbp), %rax
movq $0x0, -0x50(%rbp)
cmpq $0x0, 0x38(%rax)
je 0x263f0
movq -0x58(%rbp), %rax
movq %rax, %rdi
addq $0x30, %rdi
movq 0x38(%rax), %rsi
movl $0x5, %edx
callq 0x26880
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, -0x50(%rbp)
movq $0x0, 0x38(%rax)
movq -0x58(%rbp), %rdi
addq $0x8, %rdi
callq 0x1fa80
cmpq $0x0, -0x50(%rbp)
je 0x26441
movq -0x58(%rbp), %rax
movq (%rax), %rdi
addq $0x20088, %rdi          # imm = 0x20088
callq 0x1fa50
movq -0x58(%rbp), %rax
movq (%rax), %rdi
addq $0x200b0, %rdi          # imm = 0x200B0
leaq -0x50(%rbp), %rsi
callq 0x26940
movq -0x58(%rbp), %rax
movq (%rax), %rdi
addq $0x20088, %rdi          # imm = 0x20088
callq 0x1fa80
addq $0x70, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x194a0