// File: /workspace/github_c_makefile_star2_O0/qq-smart[P]qq_sh_server/app/qq_wifi_device.c
// Function: qq_wifi_device_mysql_confirm
static qq_int_t
qq_wifi_device_mysql_confirm(qq_connection_t *c, u_char *id)
{
    MYSQL_RES              *res;
    MYSQL_ROW               row;
    qq_uint_t               n, i;
    qq_wifi_device_t       *wd;
    qq_int_t                reason, main_app, app_type;

    reason = QQ_OK;
    main_app = 0;

    res = qq_mysql_wifi_device_select(id);
    if (res == NULL) {
        return QQ_WIFI_DEVICE_NOTHINGNESS;
    }

    n = mysql_num_rows(res);
    if (n == 0) {
        reason = QQ_WIFI_DEVICE_NO_APP;
    }
    else if (n > QQ_WIFI_DEVICE_MAX_APP_NUMBER) {
        reason = QQ_WIFI_DEVICE_APP_OVERRANGING;
    }

    if (reason == QQ_OK) {
        wd = c->data;
        wd->napp = n;

        i = 0;
        while ((row = mysql_fetch_row(res)) != NULL) {
            wd->app[i].app_type = (int) *row[1];
            app_type = wd->app[i].app_type & ~QQ_MAIN_APP_FLAGS;
            main_app += (wd->app[i].app_type & QQ_MAIN_APP_FLAGS) ? 1 : 0;

            if (app_type == QQ_APP_TYPE_ANDROID) {
                wd->app[i].app = (void *) qq_android_app_node((char *) row[0]);
            }
            else if (app_type == QQ_APP_TYPE_IOS) {
                wd->app[i].app = (void *) qq_ios_app_node((char *) row[0]);
            }
        }
    }

    if (main_app != 1) {
        reason = QQ_WIFI_DEVICE_MAIN_APP_ERROR;
    }

    mysql_free_result(res);

    return reason;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0xb720
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xe551
movq $0x3, -0x8(%rbp)
jmp 0xe6bc
movq -0x20(%rbp), %rdi
callq 0x21f0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xe56f
movq $0x4, -0x48(%rbp)
jmp 0xe580
cmpq $0xa, -0x30(%rbp)
jbe 0xe57e
movq $0x5, -0x48(%rbp)
jmp 0xe580
cmpq $0x0, -0x48(%rbp)
jne 0xe69c
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x110(%rax)
movq $0x0, -0x38(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2220
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xe69a
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %ecx
movq -0x40(%rbp), %rax
addq $0x70, %rax
movq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x40(%rbp), %rax
addq $0x70, %rax
movq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rax
addq $0x70, %rax
movq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
andl $0x80000000, %edx       # imm = 0x80000000
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
cltq
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x1, -0x58(%rbp)
jne 0xe667
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0x2630
movq %rax, %rcx
movq -0x40(%rbp), %rax
addq $0x70, %rax
movq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0xe695
cmpq $0x2, -0x58(%rbp)
jne 0xe693
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0x4c80
movq %rax, %rcx
movq -0x40(%rbp), %rax
addq $0x70, %rax
movq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0xe695
jmp 0xe5ad
jmp 0xe69c
cmpq $0x1, -0x50(%rbp)
je 0xe6ab
movq $0x6, -0x48(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2210
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)