// File: /workspace/github_cpp_makefile_star2_O3/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 0xd5de
testb %al, %al
je 0xaad6
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 0xc9df(%rip), %r15      # 0x17354
leaq 0xc9d3(%rip), %r13      # 0x1734f
leaq 0xc9f8(%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 0xa9e2
cmpb (%rcx,%rsi), %dil
jne 0xa9e2
movb 0x1(%rsi,%r14), %dil
incq %rsi
cmpq $0x4, %rsi
jne 0xa99f
cmpl $0x4, %eax
jne 0xa9e2
movq %r12, %rdi
movq -0x50(%rbp), %rsi
callq 0xdbda
movq 0xb8(%rbx), %rax
movq %rax, -0x38(%rbp)
movl 0xc0(%rbx), %eax
movl %eax, -0x2c(%rbp)
jmp 0xaac6
movb $0x69, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xaa1e
cmpb (%rcx,%rsi), %dil
jne 0xaa1e
movb 0x1(%rsi,%r13), %dil
incq %rsi
cmpq $0x4, %rsi
jne 0xa9e7
cmpl $0x4, %eax
jne 0xaa1e
movq -0x48(%rbp), %rcx
movl 0x8(%rcx), %eax
movq -0x40(%rbp), %rdx
movl %eax, 0x8(%rdx)
movq (%rcx), %rax
movq %rax, (%rdx)
jmp 0xaac6
movb $0x6f, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xaac6
cmpb (%rcx,%rsi), %dil
jne 0xaac6
movb 0x1(%rsi,%r15), %dil
incq %rsi
cmpq $0x6, %rsi
jne 0xaa23
cmpl $0x6, %eax
jne 0xaac6
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 0xaa95
cmpb (%rcx,%rsi), %dil
jne 0xaa95
leaq 0xc8e4(%rip), %rdi      # 0x1735b
movb 0x1(%rsi,%rdi), %dil
incq %rsi
cmpq $0x5, %rsi
jne 0xaa65
cmpl $0x5, %eax
jne 0xaa95
movw $0x101, 0xf0(%rbx)      # imm = 0x101
jmp 0xaac6
movb $0x66, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0xaac6
cmpb (%rcx,%rsi), %dil
jne 0xaac6
leaq 0xc8b5(%rip), %rdi      # 0x17361
movb 0x1(%rsi,%rdi), %dil
incq %rsi
cmpq $0x12, %rsi
jne 0xaa9a
cmpl $0x12, %eax
jne 0xaac6
movb $0x1, 0xf0(%rbx)
movq %r12, %rdi
callq 0xd5de
testb %al, %al
jne 0xa983
movl -0x2c(%rbp), %edx
testl %edx, %edx
je 0xab0d
cmpb $0x1, 0xf3(%rbx)
jne 0xaaef
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 0x11ce6
movb $0x0, 0xf3(%rbx)
leaq 0x18(%rbx), %r14
leaq 0xc855(%rip), %rsi      # 0x17374
movq %r14, %rdi
callq 0x9ec6
movq %r14, %rdi
movl $0xffff80a6, %esi       # imm = 0xFFFF80A6
callq 0x9f3a
movq 0x48(%rbx), %rax
testb $0x4, 0x20(%rax)
jne 0xab4d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x163f5
testq %rax, %rax
je 0xab76
movq %rax, %r14
movq %rax, %rdi
callq 0x8130
movq 0x13467(%rip), %rdi     # 0x1dfd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0xab94
movq 0x13453(%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 0x13435(%rip), %r14     # 0x1dfd0
leaq 0xc7de(%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