LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/json.cpp
// Function: Json::read_string()
Slice Json::read_string() {
    if(next() != '"') throw error::InvalidData();
    int start = index;
    const char *ptr = _data.ptr();
    for(;index < _data.size();index++) {
        if(ptr[index] == '"' && ptr[index-1] != '\\') {
            index++;
            return Slice(&ptr[start], index - start - 1);
        }
    }
    throw error::InvalidData();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movslq 0x38(%rdi), %rcx
movl 0x30(%rdi), %edx
cmpl %edx, %ecx
jge 0xd933
movq 0x28(%rdi), %rax
leaq 0x1(%rcx), %r8
movl %r8d, 0x38(%rdi)
cmpb $0x22, (%rax,%rcx)
jne 0xd94a
cmpl %edx, %r8d
jge 0xd8fb
leal 0x2(%rcx), %esi
addq %r8, %rax
movl %ecx, %r8d
notl %r8d
addl %edx, %r8d
xorl %edx, %edx
cmpb $0x22, (%rax,%rdx)
jne 0xd8eb
cmpb $0x5c, -0x1(%rax,%rdx)
jne 0xd926
leal (%rsi,%rdx), %r9d
movl %r9d, 0x38(%rdi)
incq %rdx
cmpl %edx, %r8d
jne 0xd8de
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
leaq 0x10359(%rip), %rsi     # 0x1dc70
leaq -0x60e(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
addl %edx, %ecx
addl $0x2, %ecx
movl %ecx, 0x38(%rdi)
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
jmp 0xd910
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
jmp 0xd910
jmp 0xd965
jmp 0xd965
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/json.cpp
// Function: Json::read_object()
Slice Json::read_object() {
    int lvl = 0;
    int start = index;
    while(true) {
        char a = next();
        if(a == '{' || a == '[') {
            lvl++;
        } else if(a == '}' || a == ']') {
            lvl--;
            if(lvl==0) return Slice(&_data.ptr()[start], index - start);
        } else if(a == '"') {
            index--;
            read_string();
            continue;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x30(%rdi), %ecx
movl 0x38(%rdi), %r14d
cmpl %ecx, %r14d
jge 0xd9e8
movq %rdi, %rbx
movslq %r14d, %r15
xorl %r12d, %r12d
movl %r14d, %esi
movq 0x28(%rbx), %rax
leal 0x1(%rsi), %edx
movl %edx, 0x38(%rbx)
movslq %esi, %rdi
movzbl (%rax,%rdi), %edi
movl %edi, %r8d
andl $-0x21, %r8d
cmpl $0x5d, %r8d
je 0xd9c4
cmpl $0x5b, %r8d
jne 0xd9cb
incl %r12d
jmp 0xd9e2
decl %r12d
jne 0xd9e2
jmp 0xda13
cmpb $0x22, %dil
jne 0xd9e2
movl %esi, 0x38(%rbx)
movq %rbx, %rdi
callq 0xd89c
movl 0x30(%rbx), %ecx
movl 0x38(%rbx), %edx
movl %edx, %esi
cmpl %ecx, %edx
jl 0xd99b
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
leaq 0x1026c(%rip), %rsi     # 0x1dc70
leaq -0x6fb(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
addq %r15, %rax
subl %r14d, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/json.cpp
// Function: Json::read_value()
Slice Json::read_value() {
    // 0-9, null, true, false
    int start = index;
    char a;
    bool is_number = true;
    while(true) {
        a = next();
        if(a == ' ' || a == ',' || a == '}' || a == '\n' || a == '\r') break;
        if(a < '0' || a > '9') is_number = false;
        if(!is_number && (index - start > 5)) throw error::InvalidData();
    }
    index--;
    Slice result(&_data.ptr()[start], index - start);
    if(!is_number) {
        if(!(result == "null" || result == "true" || result == "false")) throw error::InvalidData();
    }
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x38(%rdi), %ecx
movl 0x30(%rdi), %edx
movslq %ecx, %rax
cmpl %edx, %eax
cmovgl %eax, %edx
movslq %edx, %r8
subq %rax, %r8
addq 0x28(%rdi), %rax
movb $0x1, %sil
xorl %r9d, %r9d
movabsq $0x100100002400, %r10   # imm = 0x100100002400
xorl %edx, %edx
cmpq %rdx, %r8
je 0xdb97
leal (%rcx,%rdx), %r11d
incl %r11d
movl %r11d, 0x38(%rdi)
movzbl (%rax,%rdx), %r11d
cmpq $0x2c, %r11
ja 0xda8c
btq %r11, %r10
jb 0xdad0
cmpl $0x7d, %r11d
je 0xdad0
addb $-0x3a, %r11b
cmpb $-0xa, %r11b
movzbl %sil, %esi
cmovbl %r9d, %esi
incq %rdx
cmpq $0x6, %rdx
setb %r11b
orb %sil, %r11b
testb $0x1, %r11b
jne 0xda67
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
jmp 0xdbac
addl %edx, %ecx
movl %ecx, 0x38(%rdi)
testb $0x1, %sil
jne 0xdb7b
xorl %ecx, %ecx
testl %edx, %edx
movl $0x0, %esi
cmovgl %edx, %esi
movb $0x6e, %r8b
leaq 0xaa3d(%rip), %rdi      # 0x18532
cmpq %rcx, %rsi
je 0xdb13
cmpb (%rax,%rcx), %r8b
jne 0xdb13
movb 0x1(%rcx,%rdi), %r8b
incq %rcx
cmpq $0x4, %rcx
jne 0xdaf5
cmpl $0x4, %edx
je 0xdb7b
xorl %ecx, %ecx
testl %edx, %edx
movl $0x0, %esi
cmovgl %edx, %esi
movb $0x74, %r8b
leaq 0xa023(%rip), %rdi      # 0x17b4c
cmpq %rcx, %rsi
je 0xdb47
cmpb (%rax,%rcx), %r8b
jne 0xdb47
movb 0x1(%rcx,%rdi), %r8b
incq %rcx
cmpq $0x4, %rcx
jne 0xdb29
cmpl $0x4, %edx
je 0xdb7b
xorl %ecx, %ecx
testl %edx, %edx
movl $0x0, %esi
cmovgl %edx, %esi
movb $0x66, %r8b
leaq 0x9636(%rip), %rdi      # 0x17193
cmpq %rcx, %rsi
je 0xdb80
cmpb (%rax,%rcx), %r8b
jne 0xdb80
movb 0x1(%rcx,%rdi), %r8b
incq %rcx
cmpq $0x5, %rcx
jne 0xdb5d
cmpl $0x5, %edx
jne 0xdb80
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
jmp 0xdbac
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
leaq 0x100bd(%rip), %rsi     # 0x1dc70
leaq -0x8aa(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
jmp 0xdbc6
jmp 0xdbc6
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/buffer.h
// Function: ISlice::hextoi() const
i64 hextoi() const {
        if(!size()) throw error::NoData();
        i64 value = 0;
        char *p = ptr();
        char *end = p + size();
        for(;p < end; p++) {
           char a = *p;
           if(a >= '0' && a <= '9') value = (value << 4) + a - '0';
           else if(a >= 'A' && a <= 'F') value = (value << 4) + a - 'A' + 10;
           else if(a >= 'a' && a <= 'f') value = (value << 4) + a - 'a' + 10;
           else throw error::InvalidData();
        }
        return value;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movslq 0x8(%rdi), %rcx
testq %rcx, %rcx
je 0xdca6
testl %ecx, %ecx
jle 0xdc74
movq (%rdi), %rdx
addq %rdx, %rcx
xorl %eax, %eax
movzbl (%rdx), %esi
leal -0x30(%rsi), %r8d
movq $-0x30, %rdi
cmpb $0xa, %r8b
jb 0xdc60
leal -0x41(%rsi), %r8d
movq $-0x37, %rdi
cmpb $0x6, %r8b
jb 0xdc60
leal -0x61(%rsi), %r8d
movq $-0x57, %rdi
cmpb $0x6, %r8b
jae 0xdc7b
shlq $0x4, %rax
addq %rdi, %rax
addq %rsi, %rax
incq %rdx
cmpq %rcx, %rdx
jb 0xdc2a
jmp 0xdc76
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc254
leaq 0xffd9(%rip), %rsi      # 0x1dc70
leaq -0x98e(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc78c
leaq 0xffc6(%rip), %rsi      # 0x1dc88
jmp 0xdc97
jmp 0xdcc6
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/mapper.cpp
// Function: Mapper::_next()
u16 Mapper::_next() {
    _size += 1;
    if(_size <= _cap) return _size;

    int old_size = sizeof(Step) * _cap;
    if(_cap >= 512) _cap += 256;
    else _cap *= 2;

    if(buf_t) {
        char *p = (char*)_realloc(buf_t, _cap * sizeof(Step));
        if(!p) THROW("Realloc error");
        buf_t = p;
    } else {
        buf_t = (char*)_malloc(_cap * sizeof(Step));
        memcpy(buf_t, abuf.load(), old_size);
    };
    memset(&buf_t[old_size], 0, sizeof(Step) * _cap - old_size);
    return _size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x40(%rdi), %edx
movl 0x44(%rdi), %ecx
leal 0x1(%rdx), %eax
movl %eax, 0x40(%rdi)
cmpl %ecx, %edx
jl 0xe894
movq %rdi, %rbx
imull $0xc4, %ecx, %r14d
leal (%rcx,%rcx), %edx
leal 0x100(%rcx), %eax
cmpl $0x200, %ecx            # imm = 0x200
cmovll %edx, %eax
movl %eax, 0x44(%rdi)
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0xe854
cltq
imulq $0xc4, %rax, %rsi
callq 0x8460
testq %rax, %rax
je 0xe899
movq %rax, %rdi
movq %rax, 0x38(%rbx)
movslq %r14d, %r14
jmp 0xe879
imull $0xc4, %eax, %edi
callq 0xed28
movq %rax, 0x38(%rbx)
movq 0x30(%rbx), %rsi
movslq %r14d, %r14
movq %rax, %rdi
movq %r14, %rdx
callq 0x8270
movq 0x38(%rbx), %rdi
addq %r14, %rdi
movslq 0x44(%rbx), %rax
imulq $0xc4, %rax, %rdx
subq %r14, %rdx
xorl %esi, %esi
callq 0x81a0
movl 0x40(%rbx), %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x91d6(%rip), %rsi      # 0x17a83
leaq 0x98e4(%rip), %rdx      # 0x18198
leaq 0x98ec(%rip), %r8       # 0x181a7
movq %rax, %rdi
movl $0x1b, %ecx
callq 0xcd04
leaq 0xf449(%rip), %rsi      # 0x1dd18
leaq -0x15c6(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/mapper.cpp
// Function: Mapper::find(ISlice)
u16 Mapper::find(ISlice name) {
    u16 std = 0;
    int next;
    char *ptr = abuf.load();
    Step *step = _get_step(ptr, 1);
    for(int i=0;;i++) {
        if(step->std) std = step->std;
        if(i >= name.size()) {
            if(step->end) return step->end;
            return std;
        }
        u16 a = name.ptr()[i];

        if(a < 32 || a >= 128) return std;
        a -= 32;

        next = step->k[a];
        if(!next) return std;
        step = _get_step(ptr, next);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x30(%rdi), %rcx
movzwl 0x2(%rcx), %eax
testl %edx, %edx
jle 0xeb5a
movl %edx, %edx
xorl %edi, %edi
movq %rcx, %r8
movsbl (%rsi,%rdi), %r9d
movl %r9d, %r10d
andl $0xffe0, %r10d          # imm = 0xFFE0
addl $-0x80, %r10d
cmpl $-0x60, %r10d
jb 0xeb67
addl $0xffe0, %r9d           # imm = 0xFFE0
movzwl %r9w, %r9d
movzwl 0x4(%r8,%r9,2), %r8d
testq %r8, %r8
je 0xeb67
decl %r8d
imulq $0xc4, %r8, %r9
leaq (%rcx,%r9), %r8
incq %rdi
movzwl 0x2(%rcx,%r9), %r9d
testw %r9w, %r9w
cmovnel %r9d, %eax
cmpq %rdi, %rdx
jne 0xeb05
jmp 0xeb5d
movq %rcx, %r8
movzwl (%r8), %ecx
testw %cx, %cx
cmovnel %ecx, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/mapper.cpp
// Function: Mapper::del(ISlice)
u16 Mapper::del(ISlice name) {
    int next;
    char *ptr = abuf.load();
    Step *step = _get_step(ptr, 1);
    for(int i=0;;i++) {
        if(i >= name.size()) {
            auto result = step->end;
            step->end = 0;
            return result;
        }
        u16 a = name.ptr()[i];

        if(a == '*') {
            auto result = step->std;
            step->std = 0;
            return result;
        }

        if(a < 32 || a >= 128) return 0;
        a -= 32;

        next = step->k[a];
        if(!next) return 0;
        step = _get_step(ptr, next);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x30(%rdi), %rax
testl %edx, %edx
jle 0xebc2
movl %edx, %ecx
xorl %edx, %edx
movq %rax, %rdi
movsbl (%rsi,%rdx), %r8d
movzwl %r8w, %r9d
cmpl $0x2a, %r9d
je 0xebcb
addl $-0x80, %r9d
cmpl $-0x60, %r9d
jb 0xebc7
addl $0xffe0, %r8d           # imm = 0xFFE0
movzwl %r8w, %r8d
movzwl 0x4(%rdi,%r8,2), %edi
testq %rdi, %rdi
je 0xebc7
decl %edi
imulq $0xc4, %rdi, %rdi
addq %rax, %rdi
incq %rdx
cmpq %rdx, %rcx
jne 0xeb7d
jmp 0xebcf
movq %rax, %rdi
jmp 0xebcf
xorl %eax, %eax
jmp 0xebd7
addq $0x2, %rdi
movzwl (%rdi), %eax
movw $0x0, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/netfilter.cpp
// Function: NetFilter::NetFilter(Slice&)
NetFilter::NetFilter(Slice &mask) {
    std::string ip;
    int bits = 32;
    for(int i=0;i<mask.size();i++) {
        if(mask.ptr()[i] == '/') {
            ip.append(mask.ptr(), i);
            mask.remove(i + 1);
            bits = mask.atoi();
            break;
        }
    };
    if(ip.empty()) ip = mask.as_string();
    _ip = inet_addr(ip.c_str());

    _mask = 0xffffffff;
    bits = 32 - bits;
    for(int i=0;i<bits;i++) _mask = _mask << 1;
    // swap bytes
    char *b4 = (char*)&_mask;
    char t = b4[0]; b4[0] = b4[3]; b4[3] = t;
    t = b4[1]; b4[1] = b4[2]; b4[2] = t;

    _ip = _ip & _mask;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
movslq 0x8(%rsi), %rax
testq %rax, %rax
jle 0xedba
movq (%r14), %rsi
xorl %r15d, %r15d
cmpb $0x2f, (%rsi,%r15)
je 0xedf8
incq %r15
cmpq %r15, %rax
jne 0xedab
xorl %r15d, %r15d
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xc49c
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %r14
movq %r14, %rsi
callq 0x8390
movq (%r14), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xee36
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x8320
jmp 0xee36
leaq -0x40(%rbp), %rdi
movq %r15, %rdx
callq 0x8070
incl %r15d
movl 0x8(%r14), %eax
cmpl %r15d, %eax
cmovll %eax, %r15d
movslq %r15d, %rcx
addq %rcx, (%r14)
subl %ecx, %eax
movl %eax, 0x8(%r14)
movq %r14, %rdi
callq 0xc282
movl $0x20, %r15d
subl %eax, %r15d
cmpq $0x0, -0x38(%rbp)
je 0xedbd
movq -0x40(%rbp), %rdi
callq 0x8310
movl %eax, (%rbx)
movl $0xffffffff, 0x4(%rbx)  # imm = 0xFFFFFFFF
testl %r15d, %r15d
jle 0xee6d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
addl %ecx, %ecx
decl %r15d
jne 0xee52
movl %ecx, 0x4(%rbx)
movl %ecx, %esi
shrl $0x18, %esi
movl %ecx, %edx
shrl $0x8, %edx
movl %ecx, %edi
shrl $0x10, %edi
jmp 0xee77
movb $-0x1, %dil
movb $-0x1, %dl
movb $-0x1, %sil
movb $-0x1, %cl
movb %sil, 0x4(%rbx)
movb %cl, 0x7(%rbx)
movb %dil, 0x5(%rbx)
movb %dl, 0x6(%rbx)
movl 0x4(%rbx), %ecx
andl %eax, %ecx
movl %ecx, (%rbx)
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xeea1
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x8320
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0xeeb0
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xeec8
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x8320
movq %rbx, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Server::_valid_ip(unsigned int)
bool Server::_valid_ip(u32 ip) {
    if(!net_filter.size()) return true;

    for(int i=0;i<net_filter.size();i++) {
        if(net_filter[i].match(ip)) {
            return true;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rdi
cmpq %rdi, 0x40(%r14)
je 0xf301
movl %esi, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
addq %r15, %rdi
movl %ebx, %esi
callq 0xeed0
testb %al, %al
jne 0xf303
incq %r12
movq 0x38(%r14), %rdi
movq 0x40(%r14), %rcx
subq %rdi, %rcx
sarq $0x3, %rcx
addq $0x8, %r15
cmpq %r12, %rcx
ja 0xf2d6
jmp 0xf303
movb $0x1, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::accept(Connect*)
void Loop::accept(Connect *conn) {
    conn->nloop = conn->need_loop = _nloop;
    conn->loop = this;

    int st = conn->get_socket_status();
    if(st == -1) THROW("accept: connection is closed");

    eitem event = {0};
#ifdef _KQUEUE
    EV_SET(&event, conn->fd, EVFILT_READ, (st & 1) ? EV_ADD | EV_ENABLE : EV_DISABLE, 0, 0, NULL);
    if(kevent(epollfd, &event, 1, NULL, 0, NULL) == -1) THROW("kqueue change read error");

    if(st & 2) {
        EV_SET(&event, conn->fd, EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, NULL);
        if(kevent(epollfd, &event, 1, NULL, 0, NULL) == -1) THROW("kqueue change write error");
    }
#else
    event.data.fd = conn->fd;
    if(st & 1) event.events |= EPOLLIN;
    if(st & 2) event.events |= EPOLLOUT;
    if(epoll_ctl(epollfd, EPOLL_CTL_ADD, conn->fd, &event) < 0) THROW("epoll_ctl EPOLL_CTL_ADD");
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl 0x4(%rdi), %eax
movl %eax, 0x3c(%rsi)
movl %eax, 0x38(%rsi)
movq %rdi, 0x30(%rsi)
movl (%rsi), %eax
cmpl $-0x1, %eax
je 0xf6ce
movl $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl 0xc(%rsi), %edx
movl %edx, -0x1c(%rbp)
testb $0x3, %al
je 0xf6b1
movl %eax, %ecx
andl $0x1, %ecx
orl $0x4, %ecx
testb $0x2, %al
movl $0x1, %eax
cmovnel %ecx, %eax
movl %eax, -0x20(%rbp)
movl (%rdi), %edi
leaq -0x20(%rbp), %rcx
movl $0x1, %esi
callq 0x83c0
testl %eax, %eax
js 0xf6ff
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x8c5e(%rip), %rsi      # 0x18340
leaq 0x8b09(%rip), %rdx      # 0x181f2
leaq 0x8c6d(%rip), %r8       # 0x1835d
movq %rax, %rdi
movl $0xd1, %ecx
callq 0xcd04
jmp 0xf72e
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x8c67(%rip), %rsi      # 0x1837a
leaq 0x8ad8(%rip), %rdx      # 0x181f2
leaq 0x8c3c(%rip), %r8       # 0x1835d
movq %rax, %rdi
movl $0xe0, %ecx
callq 0xcd04
leaq 0xe5e3(%rip), %rsi      # 0x1dd18
leaq -0x242c(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
jmp 0xf746
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Server::start()
void Server::start() {
    if(_listen() != 0) return;
    stat_starttime = get_time_sec();

    if(threads < 1) threads = 1;
    if(threads > 62) {
        threads = 62;
        if(log & 4) std::cout << "max threads is 62\n";
    }
    loops = (Loop**)_malloc(sizeof(Loop*) * threads);

    for(int i=0; i<threads; i++) {
        Loop *loop = new Loop(this, i);
        loop->start();
        loops[i] = loop;
    }

    Service service(this);
    service.start();

    _accept();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0xefa6
testl %eax, %eax
je 0xf77e
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x163d5
movl %eax, %eax
movq %rax, 0x20180(%rbx)
movl 0x28(%rbx), %edi
testl %edi, %edi
jg 0xf7a1
movl $0x1, 0x28(%rbx)
movl $0x1, %edi
jmp 0xf7d3
cmpl $0x3f, %edi
jb 0xf7d3
movl $0x3e, 0x28(%rbx)
movl $0x3e, %edi
testb $0x4, 0x20(%rbx)
je 0xf7d3
movq 0xe811(%rip), %rdi      # 0x1dfd0
leaq 0x8b5c(%rip), %rsi      # 0x18322
movl $0x12, %edx
callq 0x8350
movl 0x28(%rbx), %edi
shll $0x3, %edi
callq 0xed28
movq %rax, 0x20050(%rbx)
cmpl $0x0, 0x28(%rbx)
jle 0xf83b
xorl %r15d, %r15d
movl $0xa8, %edi
callq 0xed4c
movq %rax, %r14
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x20(%rax), %rdi
movl $0x88, %edx
xorl %esi, %esi
callq 0x81a0
movq %rbx, 0x18(%r14)
movl %r15d, 0x4(%r14)
movq %r14, %rdi
callq 0xf86c
movq 0x20050(%rbx), %rax
movq %r14, (%rax,%r15,8)
incq %r15
movslq 0x28(%rbx), %rax
cmpq %rax, %r15
jl 0xf7eb
leaq -0x28(%rbp), %rdi
movq $0x0, (%rdi)
movq %rbx, 0x8(%rdi)
callq 0x15c3c
movq %rbx, %rdi
callq 0xf30c
cmpq $0x0, -0x28(%rbp)
jne 0xf866
movq %rax, %rdi
callq 0x84a0
callq 0x80d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Server::autolock(int)
Lock Server::autolock(int except) {
    Lock lock(this);
    for(int i=0;i<threads;i++) {
        if(i != except) lock.lock(i);
    }
    return lock;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq %rsi, (%rdi)
movq $0x0, 0x8(%rdi)
movl 0x28(%rsi), %eax
testl %eax, %eax
jle 0xf8ff
movl %edx, %r14d
movq %rsi, %r15
xorl %r12d, %r12d
cmpl %r12d, %r14d
je 0xf8f7
movq %rbx, %rdi
movl %r12d, %esi
callq 0x166be
movl 0x28(%r15), %eax
incl %r12d
cmpl %eax, %r12d
jl 0xf8e3
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x16704
movq %r14, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc1cb
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Server::get_queue(ISlice, bool)
QueueLine *Server::get_queue(ISlice key, bool create) {
    u16 n = _mapper.find(key);
    if(n) return _queue_list[n-1];
    if(!create) return NULL;

    LOCK _l(global_lock);
    n = _mapper.find(key);
    if(n) return _queue_list[n-1];

    QueueLine *ql = new QueueLine(threads);
    ql->name.set(key);

    n = 0;
    for(u16 i=0;i<_queue_list.size();i++) {
        if(_queue_list[i] == NULL) {
            _queue_list[i] = ql;
            n = i + 1;
            break;
        }
    }
    if(!n) {
        _queue_list.push_back(ql);
        n = _queue_list.size();
    }
    _mapper.add(key, n);
    return ql;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r13
leaq 0x200c8(%rdi), %r12
movq %r12, %rdi
callq 0xeaee
testw %ax, %ax
je 0xf970
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movzwl %ax, %eax
addl %ecx, %eax
movq 0x20110(%r13), %rcx
movq (%rcx,%rax,8), %rbx
jmp 0xfa95
testb %bl, %bl
je 0xf9b9
leaq 0x20058(%r13), %rdi
movq %rdi, -0x30(%rbp)
callq 0x83f0
testl %eax, %eax
jne 0xfaa7
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xeaee
testw %ax, %ax
je 0xf9c0
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movzwl %ax, %eax
addl %ecx, %eax
movq 0x20110(%r13), %rcx
movq (%rcx,%rax,8), %rbx
jmp 0xfa8c
xorl %ebx, %ebx
jmp 0xfa95
movl $0x88, %edi
callq 0xed4c
movq %rax, %rbx
movl 0x28(%r13), %esi
movq %rax, %rdi
callq 0x130de
movq %rbx, -0x38(%rbp)
movl $0x0, 0x8(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xc102
movq 0x20110(%r13), %rcx
movq 0x20118(%r13), %rsi
movq %rsi, %rdx
subq %rcx, %rdx
je 0xfa35
sarq $0x3, %rdx
movw $0x1, %ax
xorl %edi, %edi
cmpq $0x0, (%rcx,%rdi,8)
je 0xfa25
movzwl %ax, %edi
incl %eax
cmpq %rdi, %rdx
ja 0xfa12
jmp 0xfa35
movq %rbx, (%rcx,%rdi,8)
testw %ax, %ax
jne 0xfa77
movq 0x20118(%r13), %rsi
leaq 0x20110(%r13), %rdi
cmpq 0x20120(%r13), %rsi
je 0xfa5c
movq %rbx, (%rsi)
movq 0x20118(%r13), %rax
addq $0x8, %rax
movq %rax, 0x20118(%r13)
jmp 0xfa72
leaq -0x38(%rbp), %rdx
movq %rdi, %rbx
callq 0xc93c
movq 0x20118(%r13), %rax
movq %rbx, %rdi
subl (%rdi), %eax
shrl $0x3, %eax
movzwl %ax, %ecx
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xe8f2
movq -0x38(%rbp), %rbx
movq -0x30(%rbp), %rdi
callq 0x8240
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x81d0
movq %rax, %r14
movl $0x88, %esi
movq %rbx, %rdi
callq 0x8320
jmp 0xfac5
jmp 0xfac2
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x8240
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_loop_safe()
void Loop::_loop_safe() {
    try {
        _loop();
    } catch (const Exception &e) {
        if(server->log & 1) e.print("Exception in loop");
    } catch (const std::exception &e) {
        if(server->log & 1) std::cout << ltime() << "Fatal exception: " << e.what() << std::endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0xff4c
movq %rax, %rbx
cmpl $0x2, %edx
jne 0xfd64
movq %rbx, %rdi
callq 0x8120
movq 0x18(%r14), %rcx
testb $0x1, 0x20(%rcx)
je 0xfdc5
leaq 0x864a(%rip), %rsi      # 0x183a4
movq %rax, %rdi
callq 0xcf80
jmp 0xfdc5
cmpl $0x1, %edx
jne 0xfde0
movq %rbx, %rdi
callq 0x8120
movq %rax, %rbx
movq 0x18(%r14), %rax
testb $0x1, 0x20(%rax)
je 0xfdc5
callq 0x163f5
movq 0xe246(%rip), %rdi      # 0x1dfd0
movq %rax, %rsi
callq 0x8300
movq %rax, %r14
leaq 0x83d0(%rip), %rsi      # 0x1816c
movl $0x11, %edx
movq %rax, %rdi
callq 0x8350
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x8300
movq %rax, %rdi
callq 0x8160
popq %rbx
popq %r14
popq %rbp
jmp 0x8450
movq %rax, %rbx
callq 0x8450
jmp 0xfde0
movq %rax, %rbx
callq 0x8450
movq %rbx, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc1cb
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::wake()
void Loop::wake() {
#ifndef _KQUEUE  // TODO: fix for kqueue
    if(!server->fake_fd) {
        LOCK _l(server->global_lock);
        if(!server->fake_fd) server->fake_fd = socket(AF_INET, SOCK_STREAM, 0);
        if(server->fake_fd < 0) THROW("Error opening socket");
    }

    eitem event = {0};
    event.data.fd = server->fake_fd;
    if(epoll_ctl(epollfd, EPOLL_CTL_ADD, server->fake_fd, &event) < 0) THROW("epoll_ctl EPOLL_CTL_ADD");
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rbx
movl 0x30(%rbx), %edx
testl %edx, %edx
jne 0xfe5c
addq $0x20058, %rbx          # imm = 0x20058
movq %rbx, %rdi
callq 0x83f0
testl %eax, %eax
jne 0xfed2
movq 0x18(%r14), %rax
movl 0x30(%rax), %eax
testl %eax, %eax
jne 0xfe45
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x80b0
movq 0x18(%r14), %rcx
movl %eax, 0x30(%rcx)
testl %eax, %eax
js 0xfed9
movq %rbx, %rdi
callq 0x8240
movq 0x18(%r14), %rax
movl 0x30(%rax), %edx
leaq -0x28(%rbp), %rcx
movq $0x0, (%rcx)
movl $0x0, 0x8(%rcx)
movl %edx, 0x4(%rcx)
movl (%r14), %edi
movl $0x1, %esi
callq 0x83c0
testl %eax, %eax
js 0xfe8d
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x84d9(%rip), %rsi      # 0x1837a
leaq 0x834a(%rip), %rdx      # 0x181f2
leaq 0x84e3(%rip), %r8       # 0x18392
movq %rax, %rdi
movl $0xef, %ecx
callq 0xcd04
leaq 0xde55(%rip), %rsi      # 0x1dd18
leaq -0x2bba(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
movl %eax, %edi
callq 0x81d0
movl $0x30, %edi
callq 0x8170
movq %rax, %r15
leaq 0x8346(%rip), %rsi      # 0x18233
leaq 0x82fe(%rip), %rdx      # 0x181f2
leaq 0x8497(%rip), %r8       # 0x18392
movq %rax, %rdi
movl $0xea, %ecx
callq 0xcd04
leaq 0xde09(%rip), %rsi      # 0x1dd18
leaq -0x2c06(%rip), %rdx     # 0xd310
movq %r15, %rdi
callq 0x8480
movq %rax, %r14
jmp 0xff2e
movq %rax, %r14
movq %r15, %rdi
callq 0x8220
movq %rbx, %rdi
callq 0x8240
jmp 0xff43
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::set_poll_mode(int, int)
void Loop::set_poll_mode(int fd, int status) {
    if(status == -1) {
        if(epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, NULL) < 0) THROW("epoll_ctl EPOLL_CTL_DEL");
        return;
    }

    eitem event = {0};
    event.data.fd = fd;
    if(status & 1) event.events |= EPOLLIN;
    if(status & 2) event.events |= EPOLLOUT;

    if(epoll_ctl(epollfd, EPOLL_CTL_MOD, fd, &event) < 0) THROW("epoll_ctl EPOLL_CTL_MOD");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %eax
movl %esi, %edx
cmpl $-0x1, %eax
je 0x103fc
movq $0x0, -0x20(%rbp)
movl $0x0, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
testb $0x3, %al
je 0x103b7
movl %eax, %ecx
andl $0x1, %ecx
orl $0x4, %ecx
testb $0x2, %al
movl $0x1, %eax
cmovnel %ecx, %eax
movl %eax, -0x20(%rbp)
movl (%rdi), %edi
leaq -0x20(%rbp), %rcx
movl $0x3, %esi
callq 0x83c0
testl %eax, %eax
jns 0x1040e
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x8112(%rip), %rsi      # 0x184f1
leaq 0x7e0c(%rip), %rdx      # 0x181f2
leaq 0x80e1(%rip), %r8       # 0x184ce
movq %rax, %rdi
movl $0x221, %ecx            # imm = 0x221
callq 0xcd04
jmp 0x10446
movl (%rdi), %edi
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x83c0
testl %eax, %eax
js 0x10417
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x808b(%rip), %rsi      # 0x184b6
leaq 0x7dc0(%rip), %rdx      # 0x181f2
leaq 0x8095(%rip), %r8       # 0x184ce
movq %rax, %rdi
movl $0x218, %ecx            # imm = 0x218
callq 0xcd04
leaq 0xd8cb(%rip), %rsi      # 0x1dd18
leaq -0x3144(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
jmp 0x1045e
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_close(int)
void Loop::_close(int fd) {
    Connect* conn = server->connections[fd];
    if(server->log & 16) std::cout << ltime() << "disconnect socket " << fd << " " << (void*)conn << std::endl;
    if(conn == NULL) THROW("_close: connection is null");
    conn->close();
    conn->_switch_mode();
    this->on_disconnect(conn);
    conn->unlink();
    server->connections[fd] = NULL;
    close(fd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x18(%rdi), %rax
movslq %esi, %r13
movq 0x50(%rax,%r13,8), %r15
testb $0x10, 0x20(%rax)
je 0x10553
callq 0x163f5
testq %rax, %rax
je 0x104c4
movq %rax, %r12
movq %rax, %rdi
callq 0x8130
movq 0xdb19(%rip), %rdi      # 0x1dfd0
movq %r12, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0x104e2
movq 0xdb05(%rip), %rax      # 0x1dfd0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
leaq (%rax,%rcx), %rdi
movl 0x20(%rax,%rcx), %esi
orl $0x1, %esi
callq 0x8470
movq 0xdae7(%rip), %r12      # 0x1dfd0
leaq 0x8019(%rip), %rsi      # 0x18509
movl $0x12, %edx
movq %r12, %rdi
callq 0x8350
movq %r12, %rdi
movl %ebx, %esi
callq 0x8490
movq %rax, %r12
leaq 0x7198(%rip), %rsi      # 0x176a9
movl $0x1, %edx
movq %rax, %rdi
callq 0x8350
movq %r12, %rdi
movq %r15, %rsi
callq 0x8250
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x81f0
testq %r15, %r15
je 0x105b4
movl $0xffffffff, (%r15)     # imm = 0xFFFFFFFF
cmpl $-0x1, 0x4(%r15)
je 0x1057f
movq 0x30(%r15), %rdi
movl 0xc(%r15), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x10378
movl (%r15), %eax
movl %eax, 0x4(%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x119f8
movq %r15, %rdi
callq 0x898c
movq 0x18(%r14), %rax
movq $0x0, 0x50(%rax,%r13,8)
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8500
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x7f54(%rip), %rsi      # 0x1851c
leaq 0x7c23(%rip), %rdx      # 0x181f2
leaq 0x7f61(%rip), %r8       # 0x18537
movq %rax, %rdi
movl $0x229, %ecx            # imm = 0x229
callq 0xcd04
leaq 0xd72e(%rip), %rsi      # 0x1dd18
leaq -0x32e1(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_perform_to_send()
void Loop::_perform_to_send() {
    if(!_queue_to_send.size()) return;
    for(auto const& conn : _queue_to_send) {
        conn->_switch_mode();
    }
    _queue_to_send.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x60(%rdi), %r14
movq 0x68(%rdi), %r15
cmpq %r14, %r15
je 0x108ee
movq %rdi, %rbx
movq (%r14), %r12
movl (%r12), %edx
cmpl 0x4(%r12), %edx
je 0x108d7
movq 0x30(%r12), %rdi
movl 0xc(%r12), %esi
callq 0x10378
movl (%r12), %eax
movl %eax, 0x4(%r12)
addq $0x8, %r14
cmpq %r15, %r14
jne 0x108b1
movq 0x60(%rbx), %rax
cmpq %rax, 0x68(%rbx)
je 0x108ee
movq %rax, 0x68(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_migrate_send()
void Loop::_migrate_send() {
    Lock lock = server->autolock(_nloop);

    for (int i = 0; i <= server->max_fd; i++) {
        Connect* conn = server->connections[i];
        if(!conn) continue;
        if(conn->nloop != _nloop) continue;
        if(!conn->go_loop || conn->need_loop == _nloop) continue;
        conn->go_loop = false;
        if(conn->is_closed()) continue;
        set_poll_mode(conn->fd, -1);
        if(server->log & 64) std::cout << "migrate fd " << conn->fd << ", " << _nloop << " -> " << conn->need_loop << std::endl;
        auto loop = server->loops[conn->need_loop];
        loop->accept(conn);

        if(conn->status == Status::migration) {
            loop->accept_request = true;
            loop->wake();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rsi
movl 0x4(%rdi), %edx
leaq -0x38(%rbp), %rdi
callq 0xf8ba
movq 0x18(%rbx), %rax
cmpl $0x0, 0x8(%rax)
js 0x10a6f
movq $-0x1, %r13
movq 0xd698(%rip), %r14      # 0x1dfd0
movq 0x58(%rax,%r13,8), %r15
testq %r15, %r15
je 0x10a5b
movl 0x38(%r15), %eax
cmpl 0x4(%rbx), %eax
jne 0x10a5b
cmpb $0x1, 0x40(%r15)
jne 0x10a5b
cmpl %eax, 0x3c(%r15)
je 0x10a5b
movb $0x0, 0x40(%r15)
cmpl $-0x1, (%r15)
je 0x10a5b
movl 0xc(%r15), %esi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x10378
movq 0x18(%rbx), %rax
testb $0x40, 0x20(%rax)
je 0x10a29
movl $0xb, %edx
movq %r14, %rdi
leaq 0x7afd(%rip), %rsi      # 0x184a2
callq 0x8350
movl 0xc(%r15), %esi
movq %r14, %rdi
callq 0x8490
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x7ae6(%rip), %rsi      # 0x184ae
callq 0x8350
movl 0x4(%rbx), %esi
movq %r12, %rdi
callq 0x8490
movq %rax, %r12
movl $0x4, %edx
movq %rax, %rdi
leaq 0x7ac7(%rip), %rsi      # 0x184b1
callq 0x8350
movl 0x3c(%r15), %esi
movq %r12, %rdi
callq 0x8490
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x81f0
movq 0x18(%rbx), %rax
movq 0x20050(%rax), %rax
movslq 0x3c(%r15), %rcx
movq (%rax,%rcx,8), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xf664
cmpl $0x3, 0xcc(%r15)
jne 0x10a5b
movb $0x1, 0x10(%r12)
movq %r12, %rdi
callq 0xfdf0
movq 0x18(%rbx), %rax
movslq 0x8(%rax), %rcx
incq %r13
cmpq %rcx, %r13
jl 0x10938
leaq -0x38(%rbp), %rdi
callq 0x16704
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10a9f
jmp 0x10a8b
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x16704
movq %rbx, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc1cb
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_delete_connections()
void Loop::_delete_connections() {
    if(!dead_connections.size()) return;
    if(!del_lock.try_lock()) return;

    for(Connect *conn : dead_connections) {
        if(conn->get_link() == 0) {
            if(server->log & 16) std::cout << ltime() << "delete connection " << (void*)conn << std::endl;
            delete conn;
        }
    }
    dead_connections.clear();
    del_lock.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x28(%rdi), %rax
cmpq 0x20(%rdi), %rax
je 0x10ad3
movq %rdi, %rbx
leaq 0x38(%rdi), %r12
movq %r12, %rdi
callq 0x80a0
testl %eax, %eax
je 0x10ae2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %r15
cmpq %r15, %r14
je 0x10bdc
movq %r12, -0x30(%rbp)
movq (%r14), %r13
cmpl $0x0, 0x8(%r13)
jne 0x10bbd
movq 0x18(%rbx), %rax
testb $0x10, 0x20(%rax)
je 0x10ba8
callq 0x163f5
testq %rax, %rax
je 0x10b3f
movq %rax, %r12
movq %rax, %rdi
callq 0x8130
movq 0xd4a1(%rip), %rdi      # 0x1dfd0
movq %r12, %rsi
movq %rdi, %r12
movq %rax, %rdx
callq 0x8350
jmp 0x10b5f
movq 0xd48a(%rip), %r12      # 0x1dfd0
movq (%r12), %rax
movq -0x18(%rax), %rax
leaq (%r12,%rax), %rdi
movl 0x20(%r12,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0x12, %edx
movq %r12, %rdi
leaq 0x7921(%rip), %rsi      # 0x1848f
callq 0x8350
movq %r12, %rdi
movq %r13, %rsi
callq 0x8250
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq %r12, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x81f0
movq %r13, %rdi
callq 0x1339c
movl $0x1e8, %esi            # imm = 0x1E8
movq %r13, %rdi
callq 0x8320
addq $0x8, %r14
cmpq %r15, %r14
jne 0x10af7
movq 0x20(%rbx), %rax
cmpq %rax, 0x28(%rbx)
movq -0x30(%rbp), %r12
je 0x10bdc
movq %rax, 0x28(%rbx)
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8240
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_migrate_recv()
void Loop::_migrate_recv() {
    if(!accept_request) return;
    Lock lock = server->autolock(_nloop);
    accept_request = false;
    for (int i = 0; i <= server->max_fd; i++) {
        Connect* conn = server->connections[i];
        if(!conn || conn->nloop != _nloop) continue;
        if(conn->status != Status::migration) continue;
        if(conn->is_closed()) continue;

        client_request(conn->name, conn);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpb $0x1, 0x10(%rdi)
jne 0x10c79
movq %rdi, %rbx
movq 0x18(%rdi), %rsi
movl 0x4(%rdi), %edx
leaq -0x20(%rbp), %rdi
callq 0xf8ba
movb $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rax
cmpl $0x0, 0x8(%rax)
js 0x10c70
movq $-0x1, %r14
movq 0x58(%rax,%r14,8), %rcx
testq %rcx, %rcx
je 0x10c64
movl 0x38(%rcx), %edx
cmpl 0x4(%rbx), %edx
jne 0x10c64
cmpl $0x3, 0xcc(%rcx)
jne 0x10c64
cmpl $-0x1, (%rcx)
je 0x10c64
movq 0xb8(%rcx), %rsi
movl 0xc0(%rcx), %edx
movq %rbx, %rdi
callq 0x10ca0
movq 0x18(%rbx), %rax
movslq 0x8(%rax), %rcx
incq %r14
cmpq %rcx, %r14
jl 0x10c2b
leaq -0x20(%rbp), %rdi
callq 0x16704
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x10c98
movq %rax, %rbx
leaq -0x20(%rbp), %rdi
callq 0x16704
movq %rbx, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc1cb
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::add_worker(ISlice, Connect*)
void Loop::add_worker(ISlice name, Connect *worker) {
    char *ptr = name.ptr();
    int start = 0;
    int i = 0;
    Slice n;
    for(;i<name.size();i++) {
        if(ptr[i] == ',' || ptr[i] == ' ') {
            n.set(&ptr[start], i - start);
            start = i + 1;
            if(_add_worker(n, worker) == 1) {
                // worker is taken
                return;
            }
        }
    }
    if(start < name.size()) {
        n.set(&ptr[start], i - start);
        _add_worker(n, worker);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %eax
movq %rsi, %r14
movq %rdi, %r15
testl %edx, %edx
jle 0x11d4f
movl %eax, -0x2c(%rbp)
movl %eax, %r13d
xorl %r12d, %r12d
xorl %ecx, %ecx
movzbl (%r14,%r12), %eax
cmpl $0x20, %eax
je 0x11d1d
cmpl $0x2c, %eax
jne 0x11d40
movslq %ecx, %rax
leaq (%r14,%rax), %rsi
movl %r12d, %edx
subl %eax, %edx
incq %r12
movq %r15, %rdi
movq %rbx, %rcx
callq 0x11d8a
movl %r12d, %ecx
testl %eax, %eax
je 0x11d43
jmp 0x11d7b
incq %r12
cmpq %r13, %r12
jne 0x11d0e
movl -0x2c(%rbp), %eax
movl %eax, %edx
jmp 0x11d53
xorl %edx, %edx
xorl %ecx, %ecx
cmpl %eax, %ecx
jge 0x11d7b
movslq %ecx, %rax
addq %rax, %r14
subl %ecx, %edx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11d8a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::worker_result(ISlice, Connect*)
int Loop::worker_result(ISlice id, Connect *worker) {
    auto it = server->wait_response.find(id.as_string());
    if(it == server->wait_response.end()) return -1;
    Connect *client = it->second;
    server->wait_lock.lock();
    server->wait_response.erase(it);
    server->wait_lock.unlock();

    client->unlink();
    if(client->is_closed()) return -2;
    if(worker) client->send.status("200 OK")->header("Id", id)->done(worker->body);
    else client->send.status("503 Service Unavailable")->header("Id", id)->done(-1);
    client->status = Status::net;

    if(worker && worker->nloop != worker->need_loop) migrate(worker, client);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rcx, %rbx
movq %rdi, %r14
leaq -0x30(%rbp), %rax
movq %rsi, (%rax)
movl %edx, 0x8(%rax)
movl $0x20128, %r15d         # imm = 0x20128
addq 0x18(%rdi), %r15
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xc49c
movq %r15, %rdi
movq %r12, %rsi
callq 0x1446a
movq %rax, %r12
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12b3e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x8320
movq 0x18(%r14), %rdi
leaq 0x20130(%rdi), %rax
cmpq %rax, %r12
je 0x12bf5
movq 0x40(%r12), %r15
addq $0x20158, %rdi          # imm = 0x20158
callq 0x83f0
testl %eax, %eax
jne 0x12c4f
movl $0x20128, %edi          # imm = 0x20128
addq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0x15bf8
movl $0x20158, %edi          # imm = 0x20158
addq 0x18(%r14), %rdi
callq 0x8240
movq %r15, %rdi
callq 0x898c
cmpl $-0x1, (%r15)
je 0x12bfd
leaq 0x18(%r15), %rdi
testq %rbx, %rbx
je 0x12c05
leaq 0x4691(%rip), %rsi      # 0x17239
callq 0x9ec6
leaq 0x59ed(%rip), %rsi      # 0x185a1
leaq -0x30(%rbp), %rdx
movq %rax, %rdi
callq 0xbc4a
leaq 0xd0(%rbx), %rsi
movq %rax, %rdi
callq 0xa766
movl $0x0, 0xcc(%r15)
movl 0x38(%rbx), %eax
xorl %r12d, %r12d
cmpl 0x3c(%rbx), %eax
je 0x12c3f
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x12c7a
jmp 0x12c3f
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x12c3f
movl $0xfffffffe, %r12d      # imm = 0xFFFFFFFE
jmp 0x12c3f
leaq 0x59f3(%rip), %rsi      # 0x185ff
callq 0x9ec6
leaq 0x5989(%rip), %rsi      # 0x185a1
leaq -0x30(%rbp), %rdx
movq %rax, %rdi
callq 0xbc4a
movq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x9f3a
movl $0x0, 0xcc(%r15)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x81d0
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12c72
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x8320
movq %rbx, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::migrate(Connect*, Connect*)
void Loop::migrate(Connect *w, Connect *c) {
    if(_nloop == w->need_loop && server->log & 1) std::cout << "migrate warning: connection is on target loop\n";

    w->go_loop = true;
    c->go_loop = true;
    c->need_loop = w->need_loop;
    if(server->log & 64) std::cout << "migrate: loop " << _nloop << " -> " << w->need_loop << ", fd " << w->fd << ", " << c->fd << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x4(%rdi), %ecx
movl 0x3c(%rsi), %eax
cmpl %eax, %ecx
jne 0x12cc0
movq 0x18(%r15), %rax
testb $0x1, 0x20(%rax)
movl %ecx, %eax
je 0x12cc0
movq 0xb325(%rip), %rdi      # 0x1dfd0
leaq 0x59fb(%rip), %rsi      # 0x186ad
movl $0x2e, %edx
callq 0x8350
movl 0x3c(%r14), %eax
movb $0x1, %cl
movb %cl, 0x40(%r14)
movb %cl, 0x40(%rbx)
movl %eax, 0x3c(%rbx)
movq 0x18(%r15), %rax
testb $0x40, 0x20(%rax)
jne 0x12cdf
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0xb2ea(%rip), %r12      # 0x1dfd0
leaq 0x59ef(%rip), %rsi      # 0x186dc
movl $0xe, %edx
movq %r12, %rdi
callq 0x8350
movl 0x4(%r15), %esi
movq %r12, %rdi
callq 0x8490
movq %rax, %r15
leaq 0x57a1(%rip), %rsi      # 0x184b1
movl $0x4, %edx
movq %rax, %rdi
callq 0x8350
movl 0x3c(%r14), %esi
movq %r15, %rdi
callq 0x8490
movq %rax, %r15
leaq 0x59b8(%rip), %rsi      # 0x186eb
movl $0x5, %edx
movq %rax, %rdi
callq 0x8350
movl 0xc(%r14), %esi
movq %r15, %rdi
callq 0x8490
movq %rax, %r14
leaq 0x5758(%rip), %rsi      # 0x184ae
movl $0x2, %edx
movq %rax, %rdi
callq 0x8350
movl 0xc(%rbx), %esi
movq %r14, %rdi
callq 0x8490
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x81f0
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::worker_result_noid(Connect*)
int Loop::worker_result_noid(Connect *worker) {
    stat_result++;
    auto client = worker->client;
    if(!client) THROW("No connected client for noid");

    if(!worker->worker_mode) {
        worker->noid = false;
        worker->fail_on_disconnect = false;
    }
    worker->client = NULL;
    client->unlink();

    if(client->is_closed()) return -2;
    client->status = Status::net;
    client->send.status("200 OK")->done(worker->body);

    if(worker->nloop != worker->need_loop) migrate(worker, client);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
incq 0x88(%rdi)
movq 0x120(%rsi), %r14
testq %r14, %r14
je 0x12e4d
movq %rdi, %rbx
movq %rsi, %r15
cmpb $0x0, 0xf3(%rsi)
jne 0x12ddb
movw $0x0, 0xf0(%r15)
movq $0x0, 0x120(%r15)
movq %r14, %rdi
callq 0x898c
cmpl $-0x1, (%r14)
je 0x12e3b
movl $0x0, 0xcc(%r14)
leaq 0x18(%r14), %rdi
leaq 0x442f(%rip), %rsi      # 0x17239
callq 0x9ec6
leaq 0xd0(%r15), %rsi
movq %rax, %rdi
callq 0xa766
movl 0x38(%r15), %eax
xorl %r12d, %r12d
cmpl 0x3c(%r15), %eax
je 0x12e41
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x12c7a
jmp 0x12e41
movl $0xfffffffe, %r12d      # imm = 0xFFFFFFFE
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x57b6(%rip), %rsi      # 0x18617
leaq 0x538a(%rip), %rdx      # 0x181f2
leaq 0x57c5(%rip), %r8       # 0x18634
movq %rax, %rdi
movl $0x3ac, %ecx            # imm = 0x3AC
callq 0xcd04
leaq 0xae95(%rip), %rsi      # 0x1dd18
leaq -0x5b7a(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/service.cpp
// Function: Service::_free_memory()
void Service::_free_memory() {
    if(!server->_free_list.size()) return;

    server->_free_lock.lock();
    std::vector<char*> v(server->_free_list);
    server->_free_list.clear();
    server->_free_lock.unlock();
    usleep(10'000);
    for(auto const &ptr : v) _free(ptr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movq 0x200b8(%rdi), %rax
cmpq 0x200b0(%rdi), %rax
je 0x15fd1
addq $0x20088, %rdi          # imm = 0x20088
callq 0x83f0
testl %eax, %eax
jne 0x15fda
movl $0x200b0, %esi          # imm = 0x200B0
addq 0x8(%rbx), %rsi
leaq -0x28(%rbp), %rdi
callq 0x162e6
movq 0x8(%rbx), %rdi
movq 0x200b0(%rdi), %rax
cmpq %rax, 0x200b8(%rdi)
je 0x15f85
movq %rax, 0x200b8(%rdi)
addq $0x20088, %rdi          # imm = 0x20088
callq 0x8240
movl $0x2710, %edi           # imm = 0x2710
callq 0x83d0
movq -0x28(%rbp), %rbx
movq -0x20(%rbp), %r14
cmpq %r14, %rbx
je 0x15fbd
movq (%rbx), %rdi
callq 0xed3b
addq $0x8, %rbx
cmpq %r14, %rbx
jne 0x15fa8
movq -0x28(%rbp), %rbx
testq %rbx, %rbx
je 0x15fd1
movq -0x18(%rbp), %rsi
subq %rbx, %rsi
movq %rbx, %rdi
callq 0x8320
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x81d0
jmp 0x15fe3
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x15ffb
movq -0x18(%rbp), %rsi
subq %rdi, %rsi
callq 0x8320
movq %rbx, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/utils.cpp
// Function: Lock::lock(int)
void Lock::lock(int n) {
    u64 v = 1 << n;
    if(mask & v) return;
    mask |= v;
    server->loops[n]->del_lock.lock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
movl $0x1, %eax
shll %cl, %eax
cltq
movq 0x8(%rdi), %rdx
testq %rax, %rdx
jne 0x166fb
orq %rax, %rdx
movq %rdx, 0x8(%rdi)
movq (%rdi), %rax
movq 0x20050(%rax), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
addq $0x38, %rdi
callq 0x83f0
testl %eax, %eax
jne 0x166fd
popq %rbp
retq
movl %eax, %edi
callq 0x81d0
// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/utils.cpp
// Function: Lock::unlock()
void Lock::unlock() {
    u64 v = 1;
    for(int i=0;i<server->threads;i++) {
        if(v & mask) server->loops[i]->del_lock.unlock();
        v <<= 1;
    }
    mask = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
cmpl $0x0, 0x28(%rax)
jle 0x1674f
movl $0x1, %r14d
xorl %r15d, %r15d
testq %r14, 0x8(%rbx)
je 0x16740
movq 0x20050(%rax), %rax
movq (%rax,%r15,8), %rdi
addq $0x38, %rdi
callq 0x8240
movq (%rbx), %rax
addq %r14, %r14
incq %r15
movslq 0x28(%rax), %rcx
cmpq %rcx, %r15
jl 0x16723
movq $0x0, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq