// File: /workspace/github_c_makefile_star2_O3/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 0x2195(%rip), %rdi      # 0xb48d
xorl %eax, %eax
callq 0x6c74
movq (%rbx), %r14
movb 0x118(%r14), %al
testb $0x2, %al
jne 0x9350
orb $0x2, %al
movb %al, 0x118(%r14)
movq 0x18(%r14), %rax
leaq (%rax,%rax), %rcx
cmpq %rcx, 0x10(%r14)
jae 0x93ff
leaq 0x2135(%rip), %rsi      # 0xb464
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 0x9390
movq (%r15), %rdi
testq %rdi, %rdi
je 0x9383
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
callq *0x30(%rbx)
incq %r12
addq $0x10, %r15
cmpq $0xa, %r12
jne 0x9367
movq 0x8(%rbx), %rbx
leaq 0x6325(%rip), %rax      # 0xf6c0
movl $0xea60, %r14d          # imm = 0xEA60
addq (%rax), %r14
testb $0x8, 0x9(%rbx)
je 0x93d8
movq %r14, %rax
subq 0x20(%rbx), %rax
movq %rax, %rcx
negq %rcx
cmovsq %rax, %rcx
cmpq $0x12c, %rcx            # imm = 0x12C
jb 0x93f0
leaq 0x20(%rbx), %rsi
leaq 0x5f41(%rip), %rdi      # 0xf310
callq 0x81c4
andb $-0x9, 0x9(%rbx)
leaq 0x20(%rbx), %rsi
movq %r14, 0x20(%rbx)
leaq 0x5f29(%rip), %rdi      # 0xf310
callq 0x7f4c
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 0x9360
movq -0x8(%r15), %rdi
testq %rdi, %rdi
je 0x945b
movl (%r15), %eax
andl %r13d, %eax
cmpl $0x2, %eax
je 0x9453
cmpl $0x1, %eax
jne 0x945b
movq %r14, %rsi
callq 0x2581
jmp 0x945b
movq %r14, %rsi
callq 0x3ce2
incq %r12
addq $0x10, %r15
cmpq $0xa, %r12
jne 0x9423
jmp 0x9360