// File: /workspace/github_cpp_makefile_star2_O1/lega911[P]ijson/src/connect.cpp
// Function: Connect::rpc_add()
void Connect::rpc_add() {
    Slice name(this->name);

    while(json.scan()) {
        if(json.key == "name") {
            json.decode_value(this->name);
            name = this->name;
        } else if(json.key == "info") {
            info = json.value;
        } else if(json.key == "option") {
            if(json.value == "no_id") {
                this->noid = true;
                this->fail_on_disconnect = true;
            } else if(json.value == "fail_on_disconnect") this->fail_on_disconnect = true;
            else {
                // TODO: Wrong option!!!
            }
        }
    }

    if(name.empty()) {
        worker_mode = false;
        this->send.status("400 No name")->done(-32602);
        if(server->log & 4) std::cout << ltime() << "No name for worker " << this << std::endl;
        return;
    };

    if(worker_mode) {
        this->noid = true;
        this->fail_on_disconnect = true;
    };

    loop->add_worker(name, this);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0xb8(%rdi), %rax
movq %rax, -0x38(%rbp)
movl 0xc0(%rdi), %eax
movl %eax, -0x2c(%rbp)
leaq 0x128(%rdi), %r12
movq %r12, %rdi
callq 0xd606
testb %al, %al
je 0xaa74
leaq 0xb8(%rbx), %rax
movq %rax, -0x50(%rbp)
leaq 0x138(%rbx), %rax
movq %rax, -0x48(%rbp)
leaq 0x168(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0xca41(%rip), %r15      # 0x17354
leaq 0xca35(%rip), %r13      # 0x1734f
leaq 0xca5a(%rip), %r14      # 0x1737b
movl 0x130(%rbx), %eax
movq 0x128(%rbx), %rcx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
movb $0x6e, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xa980
cmpb (%rcx,%rsi), %dil
jne 0xa980
movb 0x1(%rsi,%r14), %dil
incq %rsi
cmpq $0x4, %rsi
jne 0xa93d
cmpl $0x4, %eax
jne 0xa980
movq %r12, %rdi
movq -0x50(%rbp), %rsi
callq 0xdc38
movq 0xb8(%rbx), %rax
movq %rax, -0x38(%rbp)
movl 0xc0(%rbx), %eax
movl %eax, -0x2c(%rbp)
jmp 0xaa64
movb $0x69, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xa9bc
cmpb (%rcx,%rsi), %dil
jne 0xa9bc
movb 0x1(%rsi,%r13), %dil
incq %rsi
cmpq $0x4, %rsi
jne 0xa985
cmpl $0x4, %eax
jne 0xa9bc
movq -0x48(%rbp), %rcx
movl 0x8(%rcx), %eax
movq -0x40(%rbp), %rdx
movl %eax, 0x8(%rdx)
movq (%rcx), %rax
movq %rax, (%rdx)
jmp 0xaa64
movb $0x6f, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xaa64
cmpb (%rcx,%rsi), %dil
jne 0xaa64
movb 0x1(%rsi,%r15), %dil
incq %rsi
cmpq $0x6, %rsi
jne 0xa9c1
cmpl $0x6, %eax
jne 0xaa64
movl 0x140(%rbx), %eax
movq 0x138(%rbx), %rcx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
movb $0x6e, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xaa33
cmpb (%rcx,%rsi), %dil
jne 0xaa33
leaq 0xc946(%rip), %rdi      # 0x1735b
movb 0x1(%rsi,%rdi), %dil
incq %rsi
cmpq $0x5, %rsi
jne 0xaa03
cmpl $0x5, %eax
jne 0xaa33
movw $0x101, 0xf0(%rbx)      # imm = 0x101
jmp 0xaa64
movb $0x66, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xaa64
cmpb (%rcx,%rsi), %dil
jne 0xaa64
leaq 0xc917(%rip), %rdi      # 0x17361
movb 0x1(%rsi,%rdi), %dil
incq %rsi
cmpq $0x12, %rsi
jne 0xaa38
cmpl $0x12, %eax
jne 0xaa64
movb $0x1, 0xf0(%rbx)
movq %r12, %rdi
callq 0xd606
testb %al, %al
jne 0xa921
movl -0x2c(%rbp), %edx
testl %edx, %edx
je 0xaaab
cmpb $0x1, 0xf3(%rbx)
jne 0xaa8d
movw $0x101, 0xf0(%rbx)      # imm = 0x101
movq 0x30(%rbx), %rdi
movq -0x38(%rbp), %rsi
movq %rbx, %rcx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11e1c
movb $0x0, 0xf3(%rbx)
leaq 0x18(%rbx), %r14
leaq 0xc8b7(%rip), %rsi      # 0x17374
movq %r14, %rdi
callq 0x9ee0
movq %r14, %rdi
movl $0xffff80a6, %esi       # imm = 0xFFFF80A6
callq 0x9f54
movq 0x48(%rbx), %rax
testb $0x4, 0x20(%rax)
jne 0xaaeb
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x16531
testq %rax, %rax
je 0xab14
movq %rax, %r14
movq %rax, %rdi
callq 0x8130
movq 0x134c9(%rip), %rdi     # 0x1dfd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0xab32
movq 0x134b5(%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 0x13497(%rip), %r14     # 0x1dfd0
leaq 0xc840(%rip), %rsi      # 0x17380
movl $0x13, %edx
movq %r14, %rdi
callq 0x8350
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8250
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
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x81f0