// File: /workspace/github_c_makefile_star2_O1/qq-smart[P]qq_sh_server/app/qq_wifi_device.c
// Function: qq_wifi_device_status_package_process
static void
qq_wifi_device_status_package_process(qq_connection_t *c, cJSON *root)
{
    qq_wifi_device_t  *wd;
    qq_int_t           i, app_type;
    u_char            *p;

    qq_log_debug("qq_wifi_device_status_package_process(%s)", root);

    wd = c->data;
    if (wd->first_status == 0) {
        wd->first_status = 1;

        if (wd->buf_size < (wd->buf_ndata * 2)) {
            qq_wifi_device_close(c, QQ_WIFI_DEVICE_INSUFFICIENT_MEMORY);
            return;
        }

        wd->status = wd->buf;
        wd->status_size = wd->buf_ndata;
        wd->buf = wd->status + wd->status_size;
        wd->buf_size = wd->buf_ndata;

        for (i = 0;i < QQ_WIFI_DEVICE_MAX_APP_NUMBER;i++) {
            if (i == wd->napp) {
                break;
            }

            if (wd->app[i].app != NULL) {
                app_type = wd->app[i].app_type & ~QQ_MAIN_APP_FLAGS;

                if (app_type == QQ_APP_TYPE_ANDROID) {
                    qq_android_app_and_device_associate(wd->app[i].app, wd);
                }
                else if (app_type == QQ_APP_TYPE_IOS) {
                    qq_ios_app_and_device_associate(wd->app[i].app, wd);
                }
            }
        }
    }
    else {
        p = wd->status;
        wd->status = wd->buf;
        wd->buf = p;
    }

    for (i = 0;i < QQ_WIFI_DEVICE_MAX_APP_NUMBER;i++) {
        if (i == wd->napp) {
            break;
        }

        if (wd->app[i].app != NULL) {
            c->send(wd->app[i].app, wd->status, wd->status_size);
        }
    }

    qq_event_add_timer(c->read, QQ_WIFI_DEVICE_PING_TIMEOUT);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x2017(%rip), %rdi      # 0xb49d
xorl %eax, %eax
callq 0x6daa
movq (%rbx), %r14
movb 0x118(%r14), %al
testb $0x2, %al
jne 0x94de
orb $0x2, %al
movb %al, 0x118(%r14)
movq 0x18(%r14), %rax
leaq (%rax,%rax), %rcx
cmpq %rcx, 0x10(%r14)
jae 0x958d
leaq 0x1fb7(%rip), %rsi      # 0xb474
movl $0x29, %edx
movq %rbx, %rdi
callq *0x30(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x26a2
movq 0x8(%r14), %rax
movq 0x20(%r14), %rcx
movq %rax, 0x20(%r14)
movq %rcx, 0x8(%r14)
leaq 0x70(%r14), %r15
xorl %r12d, %r12d
cmpq 0x110(%r14), %r12
je 0x951e
movq (%r15), %rdi
testq %rdi, %rdi
je 0x9511
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
callq *0x30(%rbx)
incq %r12
addq $0x10, %r15
cmpq $0xa, %r12
jne 0x94f5
movq 0x8(%rbx), %rbx
leaq 0x6197(%rip), %rax      # 0xf6c0
movl $0xea60, %r14d          # imm = 0xEA60
addq (%rax), %r14
testb $0x8, 0x9(%rbx)
je 0x9566
movq %r14, %rax
subq 0x20(%rbx), %rax
movq %rax, %rcx
negq %rcx
cmovsq %rax, %rcx
cmpq $0x12c, %rcx            # imm = 0x12C
jb 0x957e
leaq 0x20(%rbx), %rsi
leaq 0x5db3(%rip), %rdi      # 0xf310
callq 0x8313
andb $-0x9, 0x9(%rbx)
leaq 0x20(%rbx), %rsi
movq %r14, 0x20(%rbx)
leaq 0x5d9b(%rip), %rdi      # 0xf310
callq 0x8098
orb $0x8, 0x9(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rcx
movq %rcx, 0x20(%r14)
movq %rax, 0x28(%r14)
addq %rax, %rcx
movq %rcx, 0x8(%r14)
movq %rax, 0x10(%r14)
leaq 0x78(%r14), %r15
xorl %r12d, %r12d
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
cmpq 0x110(%r14), %r12
je 0x94ee
movq -0x8(%r15), %rdi
testq %rdi, %rdi
je 0x95e9
movl (%r15), %eax
andl %r13d, %eax
cmpl $0x2, %eax
je 0x95e1
cmpl $0x1, %eax
jne 0x95e9
movq %r14, %rsi
callq 0x2581
jmp 0x95e9
movq %r14, %rsi
callq 0x3cd2
incq %r12
addq $0x10, %r15
cmpq $0xa, %r12
jne 0x95b1
jmp 0x94ee