// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/server.cpp
// Function: Loop::_add_worker(Slice, Connect*)
int Loop::_add_worker(Slice name, Connect *worker) {
    if(!name.empty() && name.ptr()[0] == '/') name.remove(1);
    QueueLine *ql = server->get_queue(name, true);
    Queue *q;

    if(worker->info) {
        try {
            ql->info.set(worker->info);
            json::unescape(ql->info);
        } catch (Exception &e) {
            ql->info.clear();
        };
    }

    if(!worker->connection_id) generate_id(worker->connection_id);

    if(!worker->worker_mode && worker->worker_item && worker->worker_sub_name.compare(name)) {
        worker->worker_item->pop();

        GC gc;
        for(auto const &it : worker->direct_message) {
            gc.add(it, GC::DirectMessage);
        }
        worker->direct_message.clear();
    }

    if(!worker->direct_message.empty()) {
        worker->write_mode(true);
        return 1;
    }

    Message *msg = NULL;
    GC gc;
    int result;

    ql->last_worker = get_time_sec();
    std::string sid;

    ql->mutex.lock();
    int rloop = _nloop;
    for(int index=-1;index<server->threads;index++) {
        if(index == _nloop) continue;
        if(index >= 0) rloop = index;
        q = &ql->queue[rloop];

        auto it=q->clients.begin();
        while (it != q->clients.end()) {
            msg = *it;

            if(msg->required_worker) {
                if(msg->required_worker != worker->connection_id) {
                    msg = NULL;
                    it++;
                    continue;
                }
            }
            it = q->clients.erase(it);
            gc.add(msg, GC::Message);

            if(!msg->conn) break;
            Connect *client = msg->conn;
            if(client->is_closed()) {
                if(server->log & 8) std::cout << ltime() << "closed client " << msg->conn << std::endl;
                msg = NULL;
                continue;
            }

            bool skip = true;
            if(client->status == Status::client_wait_result) {
                client->mutex.lock();
                if(client->status == Status::client_wait_result) {
                    client->status = Status::busy;
                    skip = false;
                }
                client->mutex.unlock();
            }

            if(skip) {
                if(server->log & 8) std::cout << ltime() << "client is busy!!! " << client << std::endl;
                msg = NULL;
                continue;
            }

            if(worker->noid) break;
            Slice id = client->id;
            if(id.empty()) {
                try {
                    while(client->json.scan()) {
                        if(client->json.key == "id") {
                            id = client->json.value;
                            client->id.set(id);
                            break;
                        }
                    }
                } catch (const error::InvalidData &e) {
                    client->send.status("400 No Id")->done(-1);
                    if(server->log & 4) std::cout << ltime() << "400 no id " << name.as_string() << std::endl;
                    msg = NULL;
                    continue;
                }
                if(id.empty()) {
                    generate_id(client->id);
                    id = client->id;
                };
            }
            sid = id.as_string();

            server->wait_lock.lock();
            bool busy = server->wait_response.find(sid) != server->wait_response.end();
            server->wait_lock.unlock();
            if(busy) {
                // colision id
                if(server->log & 2) std::cout << ltime() << "collision id\n";
                client->send.status("400 Collision Id")->done(-1);
                client->status = Status::net;
                msg = NULL;
                continue;
            }
            break;
        }
        if(msg) break;
    }

    if(msg) {
        if(!msg->conn) {
            if(worker->worker_mode) worker->status = Status::worker_mode_async;
            else worker->status = Status::net;
            worker->send.status("200 OK")->header("Name", msg->name)->header("Async", Slice("true"))->done(*msg->buf);
        } else {
            auto client = msg->conn;
            if(worker->fail_on_disconnect) {
                worker->client = client;
                worker->client->link();
            }
            if(worker->noid) {
                worker->status = Status::worker_wait_result;
                worker->send.status("200 OK")->header("Name", client->name)->done(client->body);
            } else {
                worker->send.status("200 OK")->header("Id", client->id)->header("Name", client->name)->done(client->body);
                server->wait_lock.lock();
                server->wait_response[sid] = client;
                server->wait_lock.unlock();
                client->link();
                worker->status = Status::net;
            }
            result = 1;
        }
        if(server->log & 32) worker->start_time = get_time();
    } else {
        Queue *q0 = &ql->queue[_nloop];
        if(q0->workers.size()) {
            auto it=q0->workers.begin();
            while (it != q0->workers.end()) {
                Connect *conn = *it;
                if(conn->is_closed() || conn == worker) {
                    it = q0->workers.erase(it);
                    conn->unlink();
                } else {
                    it++;
                }
            }
        }

        q0->workers.push_back(worker);
        worker->link();
        worker->status = Status::worker_wait_job;
        result = 0;
    }

    if(!worker->worker_item) {
        if(worker->worker_mode || worker->noid || worker->status == Status::worker_wait_job) worker->worker_item = ql->workers.push(worker);
        if(!worker->worker_mode && worker->noid) worker->worker_sub_name.set(name);
    }

    ql->mutex.unlock();

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, %rbx
movq %rsi, -0x88(%rbp)
movl %edx, -0x80(%rbp)
movq %rcx, -0x38(%rbp)
testl %edx, %edx
je 0x11dd5
cmpb $0x2f, (%rsi)
jne 0x11dd7
testl %edx, %edx
movl $0x1, %eax
cmovlel %edx, %eax
cltq
addq %rax, %rsi
movq %rsi, -0x88(%rbp)
subl %eax, %edx
movl %edx, -0x80(%rbp)
jmp 0x11dd7
xorl %edx, %edx
movq %rdi, -0x30(%rbp)
movq 0x18(%rdi), %rdi
movl $0x1, %ecx
callq 0xf926
movq %rax, %r15
movl 0x170(%rbx), %edx
testl %edx, %edx
movq %rax, -0x40(%rbp)
je 0x11e1f
leaq 0x48(%r15), %r14
movq 0x168(%rbx), %rsi
movl $0x0, 0x50(%r15)
movq %r14, %rdi
callq 0xc102
movq %r14, %rdi
xorl %esi, %esi
callq 0xd3a4
cmpl $0x0, 0x108(%rbx)
jne 0x11e34
leaq 0x100(%rbx), %rdi
callq 0x16775
cmpb $0x0, 0xf3(%rbx)
jne 0x11f1a
movq 0x178(%rbx), %rdi
testq %rdi, %rdi
je 0x11f1a
movslq 0x188(%rbx), %rax
movl -0x80(%rbp), %ecx
testq %rax, %rax
jle 0x11e96
movq 0x180(%rbx), %rdx
movq -0x88(%rbp), %rsi
xorl %r8d, %r8d
testl %ecx, %ecx
movl $0x0, %r9d
cmovgl %ecx, %r9d
cmpq %r8, %r9
je 0x11e9c
movb (%rdx,%r8), %r10b
cmpb (%rsi,%r8), %r10b
jne 0x11e9c
incq %r8
cmpq %r8, %rax
jne 0x11e7d
jmp 0x11e98
xorl %eax, %eax
cmpl %ecx, %eax
jge 0x11f1a
callq 0x16a90
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movq 0x1a0(%rbx), %r12
movq 0x1c0(%rbx), %r15
cmpq %r15, %r12
je 0x11f01
movq 0x1b0(%rbx), %r14
movq 0x1b8(%rbx), %r13
movq (%r12), %rsi
leaq -0x60(%rbp), %rdi
movl $0x2, %edx
callq 0x167b2
addq $0x8, %r12
cmpq %r14, %r12
jne 0x11efc
movq 0x8(%r13), %r12
addq $0x8, %r13
leaq 0x200(%r12), %r14
cmpq %r15, %r12
jne 0x11ed1
leaq 0x190(%rbx), %rdi
callq 0x13432
leaq -0x60(%rbp), %rdi
callq 0xc194
movq -0x40(%rbp), %r15
movq 0x1c0(%rbx), %rax
cmpq 0x1a0(%rbx), %rax
je 0x11f42
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x8a20
jmp 0x1297f
xorps %xmm0, %xmm0
movaps %xmm0, -0x100(%rbp)
movq $0x0, -0xf0(%rbp)
callq 0x163d5
movl %eax, %eax
movq %rax, 0x10(%r15)
leaq -0xc8(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x18(%r15), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x83f0
testl %eax, %eax
jne 0x129a2
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rax
cmpl $0x0, 0x28(%rax)
movl 0x4(%rcx), %edx
js 0x125d1
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rcx
cmpl 0x4(%rcx), %esi
je 0x125bf
testl %esi, %esi
movl %esi, -0xb4(%rbp)
cmovnsl %esi, %edx
movq 0x40(%r15), %rax
movl %edx, -0xb8(%rbp)
movslq %edx, %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
movq 0x60(%rax,%rcx), %r14
cmpq 0x80(%rax,%rcx), %r14
je 0x125ab
addq %rcx, %rax
addq $0x50, %rax
movq 0x20(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq %rax, -0x78(%rbp)
movq 0x28(%rax), %rax
movq %rax, -0x70(%rbp)
movq (%r14), %r13
cmpl $0x0, 0x10(%r13)
je 0x1205f
leaq 0x8(%r13), %rdi
movq -0x38(%rbp), %rsi
movl $0x100, %eax            # imm = 0x100
addq %rax, %rsi
callq 0xca7c
testl %eax, %eax
je 0x1205f
addq $0x8, %r14
cmpq -0x90(%rbp), %r14
jne 0x124c8
movq -0x70(%rbp), %rax
movq 0x8(%rax), %r14
addq $0x8, %rax
movq %rax, -0x70(%rbp)
leaq 0x200(%r14), %rax
movq %rax, -0x90(%rbp)
jmp 0x124c8
movq %r14, -0x60(%rbp)
movq -0x70(%rbp), %rcx
movq (%rcx), %rax
movq %rax, -0x58(%rbp)
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x50(%rbp)
movq %rcx, -0x48(%rbp)
leaq -0xb0(%rbp), %rdi
movq -0x78(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x13c32
movq -0xb0(%rbp), %r14
movq -0xa0(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x100(%rbp), %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x167b2
movq 0x18(%r13), %r12
testq %r12, %r12
je 0x126e9
cmpl $-0x1, (%r12)
je 0x122fd
cmpl $0x4, 0xcc(%r12)
jne 0x12347
leaq 0x50(%r12), %rbx
movq %rbx, %rdi
callq 0x83f0
testl %eax, %eax
jne 0x12994
cmpl $0x4, 0xcc(%r12)
jne 0x1233f
movl $0x5, 0xcc(%r12)
movq %rbx, %rdi
callq 0x8240
movq -0x38(%rbp), %rax
cmpb $0x0, 0xf1(%rax)
jne 0x126e9
movq 0xe0(%r12), %rax
movl 0xe8(%r12), %ecx
movq %rax, -0xb0(%rbp)
movl %ecx, -0xa8(%rbp)
testl %ecx, %ecx
movq -0x30(%rbp), %r15
jne 0x12222
leaq 0xe0(%r12), %rax
movq %rax, -0x68(%rbp)
leaq 0x128(%r12), %rbx
movq %rbx, %rdi
callq 0xd5de
testb %al, %al
je 0x121f3
movl 0x130(%r12), %eax
movq 0x128(%r12), %rcx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
movb $0x69, %dil
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x12171
cmpb (%rcx,%rsi), %dil
jne 0x12171
leaq 0x519e(%rip), %rdi      # 0x1734c
movb 0x1(%rsi,%rdi), %dil
incq %rsi
cmpq $0x2, %rsi
jne 0x1219c
cmpl $0x2, %eax
jne 0x12171
movq 0x138(%r12), %rsi
movq %rsi, -0xb0(%rbp)
movl 0x140(%r12), %edx
movl %edx, -0xa8(%rbp)
movl $0x0, 0xe8(%r12)
movq -0x68(%rbp), %rdi
callq 0xc102
cmpl $0x0, -0xa8(%rbp)
jne 0x12222
movq -0x68(%rbp), %rdi
callq 0x16775
movq 0xe0(%r12), %rax
movl 0xe8(%r12), %ecx
movq %rax, -0xb0(%rbp)
movl %ecx, -0xa8(%rbp)
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
leaq -0xb0(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xc49c
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
callq 0x8390
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x12262
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x8320
movq 0x18(%r15), %rdi
movl $0x20158, %eax          # imm = 0x20158
addq %rax, %rdi
callq 0x83f0
testl %eax, %eax
jne 0x1299b
movq 0x18(%r15), %rdi
movl $0x20128, %eax          # imm = 0x20128
addq %rax, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x1446a
movq %rax, %rbx
movq 0x18(%r15), %rdi
leaq 0x20130(%rdi), %rax
movq %rax, -0x68(%rbp)
addq $0x20158, %rdi          # imm = 0x20158
callq 0x8240
cmpq -0x68(%rbp), %rbx
je 0x1259e
movq 0x18(%r15), %rax
testb $0x2, 0x20(%rax)
movq -0x40(%rbp), %r15
je 0x1249e
callq 0x163f5
movq %rax, %rbx
testq %rax, %rax
je 0x12468
movq %rbx, %rdi
callq 0x8130
movq 0xbce3(%rip), %rdi      # 0x1dfd0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0x12486
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x8, 0x20(%rax)
je 0x124c8
callq 0x163f5
movq %rax, %rbx
testq %rax, %rax
je 0x123f6
movq %rbx, %rdi
callq 0x8130
movq 0xbca1(%rip), %rdi      # 0x1dfd0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0x12414
movq %rbx, %rdi
callq 0x8240
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x8, 0x20(%rax)
je 0x124c8
callq 0x163f5
movq %rax, %rbx
testq %rax, %rax
je 0x12382
movq %rbx, %rdi
callq 0x8130
movq 0xbc5b(%rip), %rdi      # 0x1dfd0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x8350
jmp 0x123a0
movq 0xbc47(%rip), %rcx      # 0x1dfd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0x12, %edx
movq 0xbc24(%rip), %rdi      # 0x1dfd0
leaq 0x61aa(%rip), %rsi      # 0x1855d
callq 0x8350
movq 0xbc11(%rip), %rdi      # 0x1dfd0
movq %r12, %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
callq 0x81f0
jmp 0x124c8
movq 0xbbd3(%rip), %rcx      # 0x1dfd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0xe, %edx
movq 0xbbb0(%rip), %rdi      # 0x1dfd0
leaq 0x6127(%rip), %rsi      # 0x1854e
callq 0x8350
movq 0x18(%r13), %rsi
movq 0xbb99(%rip), %rdi      # 0x1dfd0
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
callq 0x81f0
jmp 0x124c8
movq 0xbb61(%rip), %rcx      # 0x1dfd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x8470
movl $0xd, %edx
movq 0xbb3e(%rip), %rdi      # 0x1dfd0
leaq 0x60ec(%rip), %rsi      # 0x18585
callq 0x8350
leaq 0x18(%r12), %rdi
leaq 0x60e9(%rip), %rsi      # 0x18593
callq 0x9ec6
movq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x9f3a
movl $0x0, 0xcc(%r12)
movq -0x78(%rbp), %rax
cmpq 0x30(%rax), %r14
jne 0x12008
jmp 0x125ab
jmp 0x124dd
movq %rax, %r13
cmpl $0x2, %edx
jne 0x12a3e
movq %r13, %rdi
callq 0x8120
addq $0x18, %r12
movq %r12, %rdi
leaq 0x6071(%rip), %rsi      # 0x18570
callq 0x9ec6
movq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x9f3a
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x4, 0x20(%rax)
je 0x12590
callq 0x163f5
movq 0xbaa5(%rip), %rdi      # 0x1dfd0
movq %rax, %rsi
callq 0x8300
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0x6035(%rip), %rsi      # 0x1857a
callq 0x8350
leaq -0x60(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xc49c
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x8350
movq %rax, %rdi
callq 0x8160
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x12590
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x8320
callq 0x8450
movq -0x40(%rbp), %r15
jmp 0x124c8
testq %r13, %r13
movq -0x40(%rbp), %r15
jne 0x126e9
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl -0xb8(%rbp), %edx
movl -0xb4(%rbp), %esi
incl %esi
cmpl 0x28(%rax), %esi
jl 0x11faa
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edx
movq 0x40(%r15), %rcx
movslq %edx, %rax
leaq (%rax,%rax,4), %rdx
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rbx
movq 0x48(%rcx,%rdx), %rax
movq 0x28(%rcx,%rdx), %r13
movq %rax, %rsi
subq %r13, %rsi
shrq $0x3, %rsi
cmpq $0x1, %rax
adcq $-0x1, %rsi
shlq $0x6, %rsi
movq 0x30(%rcx,%rdx), %rax
movq %rax, %rdi
subq 0x38(%rcx,%rdx), %rdi
sarq $0x3, %rdi
addq %rsi, %rdi
movq 0x10(%rcx,%rdx), %r15
movq 0x20(%rcx,%rdx), %r14
movq %r14, %rcx
subq %r15, %rcx
sarq $0x3, %rcx
addq %rdi, %rcx
je 0x126c3
cmpq %rax, %r15
je 0x126c3
movq -0x38(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movq (%r15), %r12
cmpl $-0x1, (%r12)
je 0x12670
cmpq -0x78(%rbp), %r12
je 0x12670
addq $0x8, %r15
cmpq %r14, %r15
jne 0x126be
movq 0x8(%r13), %r15
addq $0x8, %r13
leaq 0x200(%r15), %r14
jmp 0x126be
movq %r15, -0x60(%rbp)
movq (%r13), %rax
movq %rax, -0x58(%rbp)
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x50(%rbp)
movq %r13, -0x48(%rbp)
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
leaq -0x60(%rbp), %rdx
callq 0x148c6
movq -0xb0(%rbp), %r15
movq -0xa0(%rbp), %r14
movq -0x98(%rbp), %r13
movq %r12, %rdi
callq 0x898c
movq 0x30(%rbx), %rax
cmpq %rax, %r15
jne 0x12646
movq 0x40(%rbx), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x127d7
movq -0x38(%rbp), %rsi
movq %rsi, (%rax)
addq $0x8, 0x30(%rbx)
movq -0x40(%rbp), %r15
jmp 0x127eb
movq 0x18(%r13), %rbx
movq -0x38(%rbp), %r14
testq %rbx, %rbx
je 0x12763
cmpb $0x1, 0xf0(%r14)
jne 0x1270a
movq %rbx, 0x120(%r14)
incl 0x8(%rbx)
cmpb $0x1, 0xf1(%r14)
jne 0x12800
movl $0x2, 0xcc(%r14)
addq $0x18, %r14
leaq 0x4b0b(%rip), %rsi      # 0x17239
movq %r14, %rdi
callq 0x9ec6
leaq 0xb8(%rbx), %rdx
leaq 0x5e60(%rip), %rsi      # 0x185a4
movq %rax, %rdi
callq 0xbc4a
addq $0xd0, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa766
jmp 0x1289f
xorl %eax, %eax
cmpb $0x0, 0xf3(%r14)
movl $0x6, %ecx
cmovel %eax, %ecx
movl %ecx, 0xcc(%r14)
addq $0x18, %r14
leaq 0x4ab2(%rip), %rsi      # 0x17239
movq %r14, %rdi
callq 0x9ec6
leaq 0x28(%r13), %rdx
leaq 0x5e0a(%rip), %rsi      # 0x185a4
movq %rax, %rdi
callq 0xbc4a
leaq 0x53a3(%rip), %rcx      # 0x17b4c
leaq -0x60(%rbp), %rdx
movq %rcx, (%rdx)
movl $0x4, 0x8(%rdx)
leaq 0x5deb(%rip), %rsi      # 0x185a9
movq %rax, %rdi
callq 0xbc4a
movq 0x20(%r13), %rsi
movq %rax, %rdi
callq 0xa766
jmp 0x1289f
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x150fe
movq -0x40(%rbp), %r15
movq -0x38(%rbp), %rsi
incl 0x8(%rsi)
movl $0x1, 0xcc(%rsi)
xorl %r14d, %r14d
jmp 0x128cf
leaq 0x18(%r14), %rdi
leaq 0x4a2e(%rip), %rsi      # 0x17239
callq 0x9ec6
leaq 0xe0(%rbx), %rdx
leaq 0x5d83(%rip), %rsi      # 0x185a1
movq %rax, %rdi
callq 0xbc4a
leaq 0xb8(%rbx), %rdx
leaq 0x5d70(%rip), %rsi      # 0x185a4
movq %rax, %rdi
callq 0xbc4a
leaq 0xd0(%rbx), %rsi
movq %rax, %rdi
callq 0xa766
movl $0x20158, %edi          # imm = 0x20158
movq -0x30(%rbp), %r12
addq 0x18(%r12), %rdi
callq 0x83f0
testl %eax, %eax
jne 0x129a9
movl $0x20128, %edi          # imm = 0x20128
addq 0x18(%r12), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x134a8
movq %rbx, (%rax)
movl $0x20158, %edi          # imm = 0x20158
movq -0x30(%rbp), %rax
addq 0x18(%rax), %rdi
callq 0x8240
incl 0x8(%rbx)
movl $0x0, 0xcc(%r14)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x20, 0x20(%rax)
jne 0x128b9
movl $0x1, %r14d
movq -0x38(%rbp), %rsi
jmp 0x128cf
callq 0x163ac
movq -0x38(%rbp), %rsi
movq %rax, 0x1e0(%rsi)
movl $0x1, %r14d
cmpq $0x0, 0x178(%rsi)
jne 0x12945
movb 0xf3(%rsi), %al
testb %al, %al
jne 0x128f5
cmpb $0x0, 0xf1(%rsi)
jne 0x128f5
cmpl $0x1, 0xcc(%rsi)
jne 0x12912
addq $0x58, %r15
movq %r15, %rdi
callq 0x16b00
movq -0x38(%rbp), %rsi
movq %rax, 0x178(%rsi)
movb 0xf3(%rsi), %al
testb $0x1, %al
jne 0x12945
cmpb $0x1, 0xf1(%rsi)
jne 0x12945
movq -0x88(%rbp), %rax
movl -0x80(%rbp), %edx
movl $0x0, 0x188(%rsi)
addq $0x180, %rsi            # imm = 0x180
movq %rsi, %rdi
movq %rax, %rsi
callq 0xc102
movq -0xe0(%rbp), %rdi
callq 0x8240
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x12973
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x8320
leaq -0x100(%rbp), %rdi
callq 0xc194
movl %r14d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x81d0
movl %eax, %edi
callq 0x81d0
movl %eax, %edi
callq 0x81d0
movl %eax, %edi
callq 0x81d0
jmp 0x12a3b
movq %rax, %r13
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x129d8
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x8320
jmp 0x129d8
jmp 0x129d5
movq %rax, %r13
callq 0x8450
jmp 0x12a3e
movq %rax, %rdi
callq 0xc1cb
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
movq %rax, %r13
jmp 0x12a60
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
movq %rax, %r13
cmpl $0x1, %edx
jne 0x12a6c
movq %r13, %rdi
callq 0x8120
movq -0x40(%rbp), %r15
movl $0x0, 0x50(%r15)
callq 0x8450
jmp 0x11e1f
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
movq %rax, %r13
leaq -0x60(%rbp), %rdi
jmp 0x12a67
jmp 0x12a3b
jmp 0x12a3b
jmp 0x12a3b
movq %rax, %r13
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x12a60
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x8320
leaq -0x100(%rbp), %rdi
callq 0xc194
movq %r13, %rdi
callq 0x84a0