LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/buffer.h
// Function: ISlice::as_string[abi:cxx11](int) const
std::string as_string(int _default=-1) const {
        std::string s;
        if(valid()) {
            s.append(ptr(), size());
        } else {
            if(_default == 1) s.append("<empty>");
            else if(_default != 0) throw error::NoData();
        }
        return s;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
movq %r12, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq (%rsi), %rax
testq %rax, %rax
je 0xc4a2
movslq 0x8(%rsi), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8070
jmp 0xc4ba
testl %edx, %edx
je 0xc4ba
cmpl $0x1, %edx
jne 0xc4c6
leaq 0xb59f(%rip), %rsi      # 0x17a51
movq %rbx, %rdi
callq 0x84e0
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %r15
leaq 0xb56f(%rip), %rsi      # 0x17a49
movq %rax, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xcd04
leaq 0x117c0(%rip), %rax     # 0x1dcb0
movq %rax, (%r15)
leaq 0x1178e(%rip), %rsi     # 0x1dc88
leaq 0xe0f(%rip), %rdx       # 0xd310
movq %r15, %rdi
callq 0x8480
movq %rax, %r14
movq %r15, %rdi
callq 0x8220
jmp 0xc519
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0xc52d
movq (%r12), %rsi
incq %rsi
callq 0x8320
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/buffer.h
// Function: Buffer::resize(int)
void resize(int capacity) {
        if(_ptr == NULL) {
            _cap = _get_cap(capacity);
            _ptr = (char*)_malloc(_cap);
            if(_ptr == NULL) THROW("No memory");
        } else if(capacity > _cap) {
            _cap = _get_cap(capacity);
            char *p = (char*)_realloc(_ptr, _cap);
            if(!p) THROW("Realloc error");
            _ptr = p;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0xc5ee
cmpl %esi, 0xc(%rbx)
jge 0xc61d
movl $0x10, %eax
cmpl $0x11, %esi
jl 0xc5d9
movl $0x10, %edx
addl %edx, %eax
cmpl $0x1000, %edx           # imm = 0x1000
setl %cl
shll %cl, %edx
cmpl %esi, %eax
jl 0xc5c8
movl %eax, 0xc(%rbx)
movslq %eax, %rsi
callq 0x8460
testq %rax, %rax
je 0xc653
movq %rax, (%rbx)
jmp 0xc61d
movl $0x10, %edi
cmpl $0x11, %esi
jl 0xc60d
movl $0x10, %eax
addl %eax, %edi
cmpl $0x1000, %eax           # imm = 0x1000
setl %cl
shll %cl, %eax
cmpl %esi, %edi
jl 0xc5fd
movl %edi, 0xc(%rbx)
callq 0xee24
movq %rax, (%rbx)
testq %rax, %rax
je 0xc622
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0xb42a(%rip), %rsi      # 0x17a60
leaq 0xb3e9(%rip), %rdx      # 0x17a26
leaq 0xb426(%rip), %r8       # 0x17a6a
movq %rax, %rdi
movl $0xe8, %ecx
callq 0xcd04
jmp 0xc682
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0xb41c(%rip), %rsi      # 0x17a83
leaq 0xb3b8(%rip), %rdx      # 0x17a26
leaq 0xb3f5(%rip), %r8       # 0x17a6a
movq %rax, %rdi
movl $0xec, %ecx
callq 0xcd04
leaq 0x1168f(%rip), %rsi     # 0x1dd18
leaq 0xc80(%rip), %rdx       # 0xd310
movq %rbx, %rdi
callq 0x8480
jmp 0xc69a
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/buffer.h
// Function: ISlice::compare(ISlice const&) const
int compare(const ISlice &s) const {
        int i = 0;
        int d;
        for(; i<size(); i++) {
            if(i >= s.size()) return 1;
            d = ptr()[i] - s.ptr()[i];
            if(d) return d;
        }
        if(i < s.size()) return -1;
        return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq 0x8(%rdi), %rcx
testq %rcx, %rcx
jle 0xcabd
movl 0x8(%rsi), %edx
movq (%rdi), %rdi
movq (%rsi), %r8
xorl %r9d, %r9d
testl %edx, %edx
cmovlel %r9d, %edx
cmpq %r9, %rdx
je 0xcacb
movsbl (%rdi,%r9), %eax
movsbl (%r8,%r9), %r10d
subl %r10d, %eax
jne 0xcad0
incq %r9
cmpq %r9, %rcx
jne 0xca9f
jmp 0xcabf
xorl %ecx, %ecx
xorl %eax, %eax
cmpl 0x8(%rsi), %ecx
setl %al
negl %eax
jmp 0xcad0
movl $0x1, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/exception.cpp
// Function: fatal_error(int)
void fatal_error(int sig) {
        Buffer trace;
        get_traceback(trace);
        std::cerr << "Error: signal " << sig << std::endl;
        std::cerr << trace.ptr() << std::endl;
        exit(1);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %r14d
xorps %xmm0, %xmm0
leaq -0x20(%rbp), %rdi
movaps %xmm0, (%rdi)
callq 0xcd5b
movq 0x10dc9(%rip), %rdi     # 0x1dff0
leaq 0xa8de(%rip), %rsi      # 0x17b0c
movl $0xe, %edx
callq 0x8350
movq 0x10db1(%rip), %rbx     # 0x1dff0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x8490
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x81f0
movq -0x20(%rbp), %r14
testq %r14, %r14
jne 0xd296
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x8470
jmp 0xd2b0
movq %r14, %rdi
callq 0x8130
movq 0x10d4b(%rip), %rdi     # 0x1dff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x8350
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x82f0
movsbl %al, %esi
movq 0x10d22(%rip), %rdi     # 0x1dff0
callq 0x8040
movq %rax, %rdi
callq 0x81f0
movl $0x1, %edi
callq 0x8380
movq %rax, %rbx
leaq -0x20(%rbp), %rdi
callq 0xc536
movq %rbx, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/buffer.h
// Function: Slice::split_left(char)
Slice split_left(char a) {
        for(int i=0;i<size();++i) {
            if(_ptr[i] != a) continue;
            Slice result = Slice(_ptr, i);
            _size -= i + 1;
            _ptr += i + 1;
            return result;
        }
        return pop(_size);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movslq 0x8(%rdi), %rcx
testq %rcx, %rcx
setg %dil
jle 0xd3a5
movq (%rbx), %rax
xorl %edx, %edx
cmpb %sil, (%rax)
je 0xd38f
leaq -0x1(%rcx), %r8
xorl %edi, %edi
cmpq %rdi, %r8
je 0xd3a9
leaq 0x1(%rdi), %rdx
cmpb %sil, 0x1(%rax,%rdi)
movq %rdx, %rdi
jne 0xd375
cmpq %rcx, %rdx
setb %dil
movl %edx, %esi
notl %esi
addl %ecx, %esi
movl %esi, 0x8(%rbx)
movl %edx, %ecx
addq %rax, %rcx
incq %rcx
movq %rcx, (%rbx)
jmp 0xd3b5
xorl %ecx, %ecx
jmp 0xd3b3
incq %rdi
cmpq %rcx, %rdi
setb %dil
movl %ecx, %edx
testb %dil, %dil
jne 0xd3d0
movslq 0x8(%rbx), %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0xc708
addq %r14, (%rbx)
subl %r14d, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/json.cpp
// Function: json::escape(Buffer&, int)
void json::escape(Buffer &s, int start) {
    int col = 0;
    for(int i = start;i<s.size();i++) {
        if(s.ptr()[i] == '"') col++;
    }
    if(!col) return;

    s.resize(0, s.size() + col);
    char *ptr = s.ptr();
    for(int i=s.size() -1;i>=start;i--) {
        char a = ptr[i - col];
        ptr[i] = a;
        if(a == '"') {
            i--;
            ptr[i] = '\\';
            col--;
            if(!col) break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movslq 0x8(%rdi), %r12
xorl %r15d, %r15d
cmpl %esi, %r12d
jle 0xd5a8
movq (%r14), %rax
movslq %ebx, %rcx
xorl %r15d, %r15d
xorl %edx, %edx
cmpb $0x22, (%rax,%rcx)
sete %dl
addl %edx, %r15d
incq %rcx
cmpq %rcx, %r12
jne 0xd594
testl %r15d, %r15d
je 0xd5fd
addl %r15d, %r12d
movq %r14, %rdi
xorl %esi, %esi
callq 0xc5a2
movl %r12d, 0x8(%r14)
movq (%r14), %rax
cmpl %ebx, %r12d
jle 0xd5fd
movslq %r12d, %rcx
leaq -0x1(%rcx), %r12
movl %r12d, %edx
subl %r15d, %edx
movslq %edx, %rdx
movb (%rax,%rdx), %sil
movb %sil, -0x1(%rax,%rcx)
movb $0x1, %dl
cmpb $0x22, %sil
jne 0xd5f9
movb $0x5c, -0x2(%rax,%rcx)
addq $-0x2, %rcx
decl %r15d
setne %dl
movl %ecx, %r12d
testb %dl, %dl
jne 0xd5c1
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/json.cpp
// Function: Json::strip()
void Json::strip() {
    while(index < _data.size()) {
        char a = _data.ptr()[index];
        if(a == ' ' || a == '\n' || a == '\r' || a == '\t') {
            index++;
            continue;
        }
        return;
    }
    throw error::InvalidData();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x30(%rdi), %eax
movslq 0x38(%rdi), %rdx
cmpl %eax, %edx
jge 0xd881
movq %rdx, %rcx
addq 0x28(%rdi), %rcx
negl %eax
leal 0x1(%rdx), %esi
movabsq $0x100002600, %rdx      # imm = 0x100002600
movzbl (%rcx), %r8d
cmpq $0x20, %r8
ja 0xd8ac
btq %r8, %rdx
jae 0xd8ac
movl %esi, 0x38(%rdi)
incq %rcx
leal (%rax,%rsi), %r8d
incl %r8d
incl %esi
cmpl $0x1, %r8d
jne 0xd85c
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
leaq 0x103d3(%rip), %rsi     # 0x1dc70
leaq -0x594(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O1/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), %rdx
cmpl 0x30(%rdi), %edx
jge 0xd96c
movq 0x28(%rdi), %rax
movq %rdx, %rcx
incq %rcx
movl %ecx, 0x38(%rdi)
cmpb $0x22, (%rax,%rdx)
jne 0xd983
movl 0x30(%rdi), %r8d
movslq 0x38(%rdi), %rsi
cmpl %esi, %r8d
jle 0xd928
leal 0x1(%rsi), %r10d
leaq (%rax,%rsi), %r11
subl %esi, %r8d
xorl %r9d, %r9d
cmpb $0x22, (%r11,%r9)
jne 0xd919
cmpb $0x5c, -0x1(%r11,%r9)
jne 0xd953
leal (%r10,%r9), %ebx
movl %ebx, 0x38(%rdi)
incq %r9
cmpl %r9d, %r8d
jne 0xd90a
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
leaq 0x1032c(%rip), %rsi     # 0x1dc70
leaq -0x63b(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
leal (%rsi,%r9), %r8d
addl %r9d, %esi
incl %esi
movl %esi, 0x38(%rdi)
addq %rcx, %rax
notl %edx
addl %r8d, %edx
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
jmp 0xd93d
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
jmp 0xd93d
jmp 0xd99e
jmp 0xd99e
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x38(%rdi), %r12d
cmpl 0x30(%rdi), %r12d
jge 0xda41
movq %rdi, %rbx
movslq %r12d, %rax
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
movl %r12d, %eax
movq 0x28(%rbx), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x38(%rbx)
movslq %eax, %rsi
movzbl (%rcx,%rsi), %esi
movl %esi, %edi
andl $-0x21, %edi
cmpl $0x5d, %edi
je 0xd9ff
cmpl $0x5b, %edi
jne 0xda1b
incl %r13d
jmp 0xda33
decl %r13d
jne 0xda33
addq -0x30(%rbp), %rcx
subl %r12d, %edx
xorl %r13d, %r13d
movl $0x1, %eax
movl %edx, %r14d
movq %rcx, %r15
jmp 0xda35
cmpb $0x22, %sil
jne 0xda33
movl %eax, 0x38(%rbx)
movq %rbx, %rdi
callq 0xd8c4
movl $0x2, %eax
jmp 0xda35
xorl %eax, %eax
testb $0x1, %al
jne 0xda6c
movl 0x38(%rbx), %eax
cmpl 0x30(%rbx), %eax
jl 0xd9da
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
leaq 0x10213(%rip), %rsi     # 0x1dc70
leaq -0x754(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
movq %r15, %rax
movl %r14d, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O1/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
movslq %ecx, %rax
movl 0x30(%rdi), %edx
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 0xdbf5
leal (%rcx,%rdx), %r11d
incl %r11d
movl %r11d, 0x38(%rdi)
movzbl (%rax,%rdx), %r11d
cmpq $0x2c, %r11
ja 0xdaea
btq %r11, %r10
jb 0xdb2e
cmpl $0x7d, %r11d
je 0xdb2e
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 0xdac5
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
jmp 0xdc0a
addl %edx, %ecx
movl %ecx, 0x38(%rdi)
testb $0x1, %sil
jne 0xdbd9
xorl %ecx, %ecx
testl %edx, %edx
movl $0x0, %esi
cmovgl %edx, %esi
movb $0x6e, %r8b
leaq 0xa9df(%rip), %rdi      # 0x18532
cmpq %rcx, %rsi
je 0xdb71
cmpb (%rax,%rcx), %r8b
jne 0xdb71
movb 0x1(%rcx,%rdi), %r8b
incq %rcx
cmpq $0x4, %rcx
jne 0xdb53
cmpl $0x4, %edx
je 0xdbd9
xorl %ecx, %ecx
testl %edx, %edx
movl $0x0, %esi
cmovgl %edx, %esi
movb $0x74, %r8b
leaq 0x9fc5(%rip), %rdi      # 0x17b4c
cmpq %rcx, %rsi
je 0xdba5
cmpb (%rax,%rcx), %r8b
jne 0xdba5
movb 0x1(%rcx,%rdi), %r8b
incq %rcx
cmpq $0x4, %rcx
jne 0xdb87
cmpl $0x4, %edx
je 0xdbd9
xorl %ecx, %ecx
testl %edx, %edx
movl $0x0, %esi
cmovgl %edx, %esi
movb $0x66, %r8b
leaq 0x95d8(%rip), %rdi      # 0x17193
cmpq %rcx, %rsi
je 0xdbde
cmpb (%rax,%rcx), %r8b
jne 0xdbde
movb 0x1(%rcx,%rdi), %r8b
incq %rcx
cmpq $0x5, %rcx
jne 0xdbbb
cmpl $0x5, %edx
jne 0xdbde
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
jmp 0xdc0a
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
leaq 0x1005f(%rip), %rsi     # 0x1dc70
leaq -0x908(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
jmp 0xdc24
jmp 0xdc24
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xdd04
testl %ecx, %ecx
jle 0xdcd2
movq (%rdi), %rdx
addq %rdx, %rcx
xorl %eax, %eax
movzbl (%rdx), %esi
leal -0x30(%rsi), %r8d
movq $-0x30, %rdi
cmpb $0xa, %r8b
jb 0xdcbe
leal -0x41(%rsi), %r8d
movq $-0x37, %rdi
cmpb $0x6, %r8b
jb 0xdcbe
leal -0x61(%rsi), %r8d
movq $-0x57, %rdi
cmpb $0x6, %r8b
jae 0xdcd9
shlq $0x4, %rax
addq %rdi, %rax
addq %rsi, %rax
incq %rdx
cmpq %rcx, %rdx
jb 0xdc88
jmp 0xdcd4
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc238
leaq 0xff7b(%rip), %rsi      # 0x1dc70
leaq -0x9ec(%rip), %rdx      # 0xd310
movq %rbx, %rdi
callq 0x8480
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
movq %rax, %rdi
callq 0xc798
leaq 0xff68(%rip), %rsi      # 0x1dc88
jmp 0xdcf5
jmp 0xdd24
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/mapper.cpp
// Function: Mapper::Mapper(Server*)
Mapper::Mapper(Server *server) {
    this->server = server;
    _cap = 4;
    _size = 1;
    char *buf = (char*)_malloc(_cap * sizeof(Step));
    memset(buf, 0, _cap * sizeof(Step));
    abuf = buf;
    buf_t = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
xorl %r15d, %r15d
movq %r15, 0x28(%rdi)
movq %rsi, (%rdi)
movabsq $0x400000001, %rax      # imm = 0x400000001
movq %rax, 0x40(%rdi)
movl $0x310, %edi            # imm = 0x310
callq 0xee24
movq %rax, %r14
movslq 0x44(%rbx), %rax
imulq $0xc4, %rax, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x81a0
xchgq %r14, 0x30(%rbx)
movq %r15, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xe965
movq %rdi, %rbx
imull $0xc4, %ecx, %edx
leal (%rcx,%rcx), %esi
leal 0x100(%rcx), %eax
cmpl $0x200, %ecx            # imm = 0x200
cmovll %esi, %eax
movl %eax, 0x44(%rdi)
movq 0x38(%rdi), %rdi
movslq %edx, %r14
testq %rdi, %rdi
je 0xe928
cltq
imulq $0xc4, %rax, %rsi
callq 0x8460
testq %rax, %rax
je 0xe96a
movq %rax, 0x38(%rbx)
jmp 0xe946
imull $0xc4, %eax, %edi
callq 0xee24
movq %rax, 0x38(%rbx)
movq 0x30(%rbx), %rsi
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 0x9105(%rip), %rsi      # 0x17a83
leaq 0x9813(%rip), %rdx      # 0x18198
leaq 0x981b(%rip), %r8       # 0x181a7
movq %rax, %rdi
movl $0x1b, %ecx
callq 0xcd04
leaq 0xf378(%rip), %rsi      # 0x1dd18
leaq -0x1697(%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_O1/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), %rdi
movzwl 0x2(%rdi), %ecx
testl %edx, %edx
jle 0xec3c
movq %rdi, %r8
addq $-0xc4, %rdi
movl %edx, %edx
xorl %r9d, %r9d
movsbl (%rsi,%r9), %r10d
movl %r10d, %r11d
andl $0xffe0, %r11d          # imm = 0xFFE0
addl $-0x80, %r11d
cmpl $-0x60, %r11d
jb 0xec1b
addl $0xffe0, %r10d          # imm = 0xFFE0
movzwl %r10w, %r10d
movzwl 0x4(%r8,%r10,2), %r10d
testq %r10, %r10
je 0xec1b
imulq $0xc4, %r10, %r8
addq %rdi, %r8
movb $0x1, %r10b
jmp 0xec20
xorl %r10d, %r10d
movl %ecx, %eax
testb %r10b, %r10b
je 0xec4b
incq %r9
movzwl 0x2(%r8), %r10d
testw %r10w, %r10w
cmovnel %r10d, %ecx
cmpq %r9, %rdx
jne 0xebdd
jmp 0xec3f
movq %rdi, %r8
movzwl (%r8), %eax
testw %ax, %ax
cmovnel %eax, %ecx
movl %ecx, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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), %rcx
testl %edx, %edx
jle 0xecca
movq %rcx, %rdi
addq $-0xc4, %rcx
movl %edx, %edx
xorl %r8d, %r8d
movsbl (%rsi,%r8), %r9d
movzwl %r9w, %r10d
cmpl $0x2a, %r10d
jne 0xec87
movzwl 0x2(%rdi), %eax
movw $0x0, 0x2(%rdi)
xorl %r9d, %r9d
jmp 0xecbb
addl $-0x80, %r10d
cmpl $-0x60, %r10d
jb 0xecb6
addl $0xffe0, %r9d           # imm = 0xFFE0
movzwl %r9w, %r9d
movzwl 0x4(%rdi,%r9,2), %r9d
testq %r9, %r9
je 0xecb6
imulq $0xc4, %r9, %rdi
addq %rcx, %rdi
movb $0x1, %r9b
jmp 0xecbb
xorl %r9d, %r9d
xorl %eax, %eax
testb %r9b, %r9b
je 0xecd5
incq %r8
cmpq %r8, %rdx
jne 0xec69
jmp 0xeccd
movq %rcx, %rdi
movzwl (%rdi), %eax
movw $0x0, (%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xeeb6
movq (%r14), %rsi
xorl %r15d, %r15d
cmpb $0x2f, (%rsi,%r15)
je 0xeebb
incq %r15
cmpq %r15, %rax
jne 0xeea7
xorl %r15d, %r15d
jmp 0xeef2
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 0xc266
movl $0x20, %r15d
subl %eax, %r15d
cmpq $0x0, -0x38(%rbp)
jne 0xef32
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xc468
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %r14
movq %r14, %rsi
callq 0x8390
movq (%r14), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xef32
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x8320
movq -0x40(%rbp), %rdi
callq 0x8310
movl %eax, (%rbx)
movl $0xffffffff, 0x4(%rbx)  # imm = 0xFFFFFFFF
testl %r15d, %r15d
jle 0xef58
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
addl %ecx, %ecx
decl %r15d
jne 0xef4e
movl %ecx, 0x4(%rbx)
movb 0x4(%rbx), %cl
movb 0x7(%rbx), %dl
movb %dl, 0x4(%rbx)
movb %cl, 0x7(%rbx)
rolw $0x8, 0x5(%rbx)
movl 0x4(%rbx), %ecx
andl %eax, %ecx
movl %ecx, (%rbx)
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xef85
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x8320
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0xef94
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xefac
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x8320
movq %rbx, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x40(%rdi), %rax
cmpq 0x38(%rdi), %rax
je 0xf406
movq %rdi, %r14
movq 0x38(%rdi), %rdi
cmpq %rdi, 0x40(%r14)
setne %r15b
je 0xf409
movl %esi, %ebx
callq 0xefb4
testb %al, %al
jne 0xf409
movl $0x8, %r12d
xorl %r13d, %r13d
incq %r13
movq 0x38(%r14), %rdi
movq 0x40(%r14), %rax
subq %rdi, %rax
sarq $0x3, %rax
cmpq %r13, %rax
seta %r15b
jbe 0xf409
addq %r12, %rdi
addq $0x8, %r12
movl %ebx, %esi
callq 0xefb4
testb %al, %al
je 0xf3d7
jmp 0xf409
movb $0x1, %r15b
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf7d5
movl $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl 0xc(%rsi), %edx
movl %edx, -0x1c(%rbp)
testb $0x1, %al
je 0xf7b0
orb $0x1, -0x20(%rbp)
testb $0x2, %al
je 0xf7b8
orb $0x4, -0x20(%rbp)
movl (%rdi), %edi
leaq -0x20(%rbp), %rcx
movl $0x1, %esi
callq 0x83c0
testl %eax, %eax
js 0xf806
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x8b57(%rip), %rsi      # 0x18340
leaq 0x8a02(%rip), %rdx      # 0x181f2
leaq 0x8b66(%rip), %r8       # 0x1835d
movq %rax, %rdi
movl $0xd1, %ecx
callq 0xcd04
jmp 0xf835
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x8b60(%rip), %rsi      # 0x1837a
leaq 0x89d1(%rip), %rdx      # 0x181f2
leaq 0x8b35(%rip), %r8       # 0x1835d
movq %rax, %rdi
movl $0xe0, %ecx
callq 0xcd04
leaq 0xe4dc(%rip), %rsi      # 0x1dd18
leaq -0x2533(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
jmp 0xf84d
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf08a
testl %eax, %eax
je 0xf884
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x16511
movl %eax, %eax
movq %rax, 0x20180(%rbx)
cmpl $0x0, 0x28(%rbx)
jg 0xf89f
movl $0x1, 0x28(%rbx)
cmpl $0x3f, 0x28(%rbx)
jl 0xf8ca
movl $0x3e, 0x28(%rbx)
testb $0x4, 0x20(%rbx)
je 0xf8ca
movq 0xe717(%rip), %rdi      # 0x1dfd0
leaq 0x8a62(%rip), %rsi      # 0x18322
movl $0x12, %edx
callq 0x8350
movl 0x28(%rbx), %edi
shll $0x3, %edi
callq 0xee24
movq %rax, 0x20050(%rbx)
cmpl $0x0, 0x28(%rbx)
jle 0xf935
xorl %r15d, %r15d
movl $0xa8, %edi
callq 0xee48
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 0xf966
movq 0x20050(%rbx), %rax
movq %r14, (%rax,%r15,8)
incq %r15
movslq 0x28(%rbx), %rax
cmpq %rax, %r15
jl 0xf8e5
leaq -0x28(%rbp), %rdi
movq $0x0, (%rdi)
movq %rbx, 0x8(%rdi)
callq 0x15d58
movq %rbx, %rdi
callq 0xf41c
cmpq $0x0, -0x28(%rbp)
jne 0xf960
movq %rax, %rdi
callq 0x84a0
callq 0x80d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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)
cmpl $0x0, 0x28(%rsi)
jle 0xf9f5
movl %edx, %r14d
movq %rsi, %r15
xorl %r12d, %r12d
cmpl %r12d, %r14d
je 0xf9ec
movq %rbx, %rdi
movl %r12d, %esi
callq 0x167ea
incl %r12d
cmpl 0x28(%r15), %r12d
jl 0xf9dc
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x16830
movq %r14, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc171
// File: /workspace/github_cpp_makefile_star2_O1/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, %r15d
movq %rsi, %r12
movq %rdi, %r14
leaq 0x200c8(%rdi), %r13
movq %r13, %rdi
callq 0xebbe
testw %ax, %ax
je 0xfa66
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movzwl %ax, %eax
addl %ecx, %eax
movq 0x20110(%r14), %rcx
movq (%rcx,%rax,8), %rbx
jmp 0xfb87
testb %bl, %bl
je 0xfaaf
leaq 0x20058(%r14), %rdi
movq %rdi, -0x38(%rbp)
callq 0x83f0
testl %eax, %eax
jne 0xfb99
movq %r13, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0xebbe
testw %ax, %ax
je 0xfab6
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movzwl %ax, %eax
addl %ecx, %eax
movq 0x20110(%r14), %rcx
movq (%rcx,%rax,8), %rbx
jmp 0xfb7e
xorl %ebx, %ebx
jmp 0xfb87
movl $0x88, %edi
callq 0xee48
movq %rax, %rbx
movl 0x28(%r14), %esi
movq %rax, %rdi
callq 0x13212
movq %rbx, -0x30(%rbp)
movl $0x0, 0x8(%rbx)
movq %rbx, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0xc0a8
movq 0x20110(%r14), %rcx
movq 0x20118(%r14), %rdx
subq %rcx, %rdx
je 0xfb16
sarq $0x3, %rdx
movw $0x1, %ax
xorl %esi, %esi
cmpq $0x0, (%rcx,%rsi,8)
je 0xfb1a
movzwl %ax, %esi
incl %eax
cmpq %rsi, %rdx
ja 0xfb05
xorl %eax, %eax
jmp 0xfb22
movq -0x30(%rbp), %rdx
movq %rdx, (%rcx,%rsi,8)
testw %ax, %ax
jne 0xfb69
movq 0x20118(%r14), %rsi
cmpq 0x20120(%r14), %rsi
je 0xfb48
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x20118(%r14)
jmp 0xfb58
leaq 0x20110(%r14), %rdi
leaq -0x30(%rbp), %rdx
callq 0xc940
movl 0x20118(%r14), %eax
subl 0x20110(%r14), %eax
shrl $0x3, %eax
movzwl %ax, %ecx
movq %r13, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0xe9c2
movq -0x30(%rbp), %rbx
movq -0x38(%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 0xfbb7
jmp 0xfbb4
movq %rax, %r14
movq -0x38(%rbp), %rdi
callq 0x8240
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10042
movq %rax, %rbx
cmpl $0x2, %edx
jne 0xfe56
movq %rbx, %rdi
callq 0x8120
movq 0x18(%r14), %rcx
testb $0x1, 0x20(%rcx)
je 0xfeb7
leaq 0x8558(%rip), %rsi      # 0x183a4
movq %rax, %rdi
callq 0xcf80
jmp 0xfeb7
cmpl $0x1, %edx
jne 0xfed2
movq %rbx, %rdi
callq 0x8120
movq %rax, %rbx
movq 0x18(%r14), %rax
testb $0x1, 0x20(%rax)
je 0xfeb7
callq 0x16531
movq 0xe154(%rip), %rdi      # 0x1dfd0
movq %rax, %rsi
callq 0x8300
movq %rax, %r14
leaq 0x82de(%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 0xfed2
movq %rax, %rbx
callq 0x8450
movq %rbx, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc171
// File: /workspace/github_cpp_makefile_star2_O1/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
cmpl $0x0, 0x30(%rbx)
jne 0xff4b
addq $0x20058, %rbx          # imm = 0x20058
movq %rbx, %rdi
callq 0x83f0
testl %eax, %eax
jne 0xffc8
movq 0x18(%r14), %rax
cmpl $0x0, 0x30(%rax)
jne 0xff35
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x80b0
movq 0x18(%r14), %rcx
movl %eax, 0x30(%rcx)
movq 0x18(%r14), %rax
cmpl $0x0, 0x30(%rax)
js 0xffcf
movq %rbx, %rdi
callq 0x8240
leaq -0x28(%rbp), %rcx
movl $0x0, 0x8(%rcx)
movq $0x0, (%rcx)
movq 0x18(%r14), %rax
movl 0x30(%rax), %edx
movl %edx, 0x4(%rcx)
movl (%r14), %edi
movl $0x1, %esi
callq 0x83c0
testl %eax, %eax
js 0xff83
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x83e3(%rip), %rsi      # 0x1837a
leaq 0x8254(%rip), %rdx      # 0x181f2
leaq 0x83ed(%rip), %r8       # 0x18392
movq %rax, %rdi
movl $0xef, %ecx
callq 0xcd04
leaq 0xdd5f(%rip), %rsi      # 0x1dd18
leaq -0x2cb0(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
movl %eax, %edi
callq 0x81d0
movl $0x30, %edi
callq 0x8170
movq %rax, %r15
leaq 0x8250(%rip), %rsi      # 0x18233
leaq 0x8208(%rip), %rdx      # 0x181f2
leaq 0x83a1(%rip), %r8       # 0x18392
movq %rax, %rdi
movl $0xea, %ecx
callq 0xcd04
leaq 0xdd13(%rip), %rsi      # 0x1dd18
leaq -0x2cfc(%rip), %rdx     # 0xd310
movq %r15, %rdi
callq 0x8480
movq %rax, %r14
jmp 0x10024
movq %rax, %r14
movq %r15, %rdi
callq 0x8220
movq %rbx, %rdi
callq 0x8240
jmp 0x10039
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x104db
movq $0x0, -0x20(%rbp)
movl $0x0, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
testb $0x1, %al
je 0x1048e
orb $0x1, -0x20(%rbp)
testb $0x2, %al
je 0x10496
orb $0x4, -0x20(%rbp)
movl (%rdi), %edi
leaq -0x20(%rbp), %rcx
movl $0x3, %esi
callq 0x83c0
testl %eax, %eax
jns 0x104ed
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x8033(%rip), %rsi      # 0x184f1
leaq 0x7d2d(%rip), %rdx      # 0x181f2
leaq 0x8002(%rip), %r8       # 0x184ce
movq %rax, %rdi
movl $0x221, %ecx            # imm = 0x221
callq 0xcd04
jmp 0x10525
movl (%rdi), %edi
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x83c0
testl %eax, %eax
js 0x104f6
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x30, %edi
callq 0x8170
movq %rax, %rbx
leaq 0x7fac(%rip), %rsi      # 0x184b6
leaq 0x7ce1(%rip), %rdx      # 0x181f2
leaq 0x7fb6(%rip), %r8       # 0x184ce
movq %rax, %rdi
movl $0x218, %ecx            # imm = 0x218
callq 0xcd04
leaq 0xd7ec(%rip), %rsi      # 0x1dd18
leaq -0x3223(%rip), %rdx     # 0xd310
movq %rbx, %rdi
callq 0x8480
jmp 0x1053d
movq %rax, %r14
movq %rbx, %rdi
callq 0x8220
movq %r14, %rdi
callq 0x84a0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10631
callq 0x16531
testq %rax, %rax
je 0x105a2
movq %rax, %r12
movq %rax, %rdi
callq 0x8130
movq 0xda3b(%rip), %rdi      # 0x1dfd0
movq %r12, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0x105c0
movq 0xda27(%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 0xda09(%rip), %r12      # 0x1dfd0
leaq 0x7f3b(%rip), %rsi      # 0x18509
movl $0x12, %edx
movq %r12, %rdi
callq 0x8350
movq %r12, %rdi
movl %ebx, %esi
callq 0x8490
movq %rax, %r12
leaq 0x70ba(%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 0x10692
movl $0xffffffff, (%r15)     # imm = 0xFFFFFFFF
cmpl $-0x1, 0x4(%r15)
je 0x1065d
movq 0x30(%r15), %rdi
movl 0xc(%r15), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x10460
movl (%r15), %eax
movl %eax, 0x4(%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x11b2e
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 0x7e76(%rip), %rsi      # 0x1851c
leaq 0x7b45(%rip), %rdx      # 0x181f2
leaq 0x7e83(%rip), %r8       # 0x18537
movq %rax, %rdi
movl $0x229, %ecx            # imm = 0x229
callq 0xcd04
leaq 0xd650(%rip), %rsi      # 0x1dd18
leaq -0x33bf(%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_O1/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 0x109c8
movq %rdi, %rbx
movq (%r14), %r12
movl (%r12), %edx
cmpl 0x4(%r12), %edx
je 0x109b1
movq 0x30(%r12), %rdi
movl 0xc(%r12), %esi
callq 0x10460
movl (%r12), %eax
movl %eax, 0x4(%r12)
addq $0x8, %r14
cmpq %r15, %r14
jne 0x1098b
movq 0x60(%rbx), %rax
cmpq %rax, 0x68(%rbx)
je 0x109c8
movq %rax, 0x68(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf9b4
movq 0x18(%rbx), %rax
cmpl $0x0, 0x8(%rax)
js 0x10b49
movq $-0x1, %r13
movq 0xd5be(%rip), %r14      # 0x1dfd0
movq 0x58(%rax,%r13,8), %r15
testq %r15, %r15
je 0x10b35
movl 0x4(%rbx), %eax
cmpl %eax, 0x38(%r15)
jne 0x10b35
cmpb $0x1, 0x40(%r15)
jne 0x10b35
cmpl %eax, 0x3c(%r15)
je 0x10b35
movb $0x0, 0x40(%r15)
cmpl $-0x1, (%r15)
je 0x10b35
movl 0xc(%r15), %esi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x10460
movq 0x18(%rbx), %rax
testb $0x40, 0x20(%rax)
je 0x10aff
movl $0xb, %edx
movq %r14, %rdi
leaq 0x7a23(%rip), %rsi      # 0x184a2
callq 0x8350
movl 0xc(%r15), %esi
movq %r14, %rdi
callq 0x8490
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x7a0c(%rip), %rsi      # 0x184ae
callq 0x8350
movl 0x4(%rbx), %esi
movq %r12, %rdi
callq 0x8490
movq %rax, %r12
movl $0x4, %edx
movq %rax, %rdi
leaq 0x79ed(%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 0xf774
cmpl $0x3, 0xcc(%r15)
jne 0x10b35
movb $0x1, 0x10(%r12)
movq %r12, %rdi
callq 0xfee2
movq 0x18(%rbx), %rax
movslq 0x8(%rax), %rcx
incq %r13
cmpq %rcx, %r13
jl 0x10a12
leaq -0x38(%rbp), %rdi
callq 0x16830
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10b79
jmp 0x10b65
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x16830
movq %rbx, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc171
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10bad
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x80a0
testl %eax, %eax
je 0x10bbc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, -0x30(%rbp)
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %r15
cmpq %r15, %r14
je 0x10ca0
movq (%r14), %r13
cmpl $0x0, 0x8(%r13)
jne 0x10c97
movq 0x18(%rbx), %rax
testb $0x10, 0x20(%rax)
je 0x10c82
callq 0x16531
testq %rax, %rax
je 0x10c19
movq %rax, %r12
movq %rax, %rdi
callq 0x8130
movq 0xd3c7(%rip), %rdi      # 0x1dfd0
movq %r12, %rsi
movq %rdi, %r12
movq %rax, %rdx
callq 0x8350
jmp 0x10c39
movq 0xd3b0(%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 0x7847(%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 0x134e0
movl $0x1e8, %esi            # imm = 0x1E8
movq %r13, %rdi
callq 0x8320
addq $0x8, %r14
jmp 0x10bc8
movq 0x20(%rbx), %rax
cmpq %rax, 0x28(%rbx)
je 0x10cae
movq %rax, 0x28(%rbx)
movq -0x30(%rbp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8240
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10d4d
movq %rdi, %rbx
movq 0x18(%rdi), %rsi
movl 0x4(%rdi), %edx
leaq -0x20(%rbp), %rdi
callq 0xf9b4
movb $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rax
cmpl $0x0, 0x8(%rax)
js 0x10d44
movq $-0x1, %r14
movq 0x58(%rax,%r14,8), %rcx
testq %rcx, %rcx
je 0x10d34
movl 0x38(%rcx), %eax
cmpl 0x4(%rbx), %eax
jne 0x10d34
cmpl $0x3, 0xcc(%rcx)
jne 0x10d34
cmpl $-0x1, (%rcx)
je 0x10d34
movq 0xb8(%rcx), %rsi
movl 0xc0(%rcx), %edx
movq %rbx, %rdi
callq 0x10d74
movq 0x18(%rbx), %rax
movslq 0x8(%rax), %rcx
incq %r14
cmpq %rcx, %r14
jl 0x10cff
leaq -0x20(%rbp), %rdi
callq 0x16830
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x10d6c
movq %rax, %rbx
leaq -0x20(%rbp), %rdi
callq 0x16830
movq %rbx, %rdi
callq 0x84a0
movq %rax, %rdi
callq 0xc171