// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: requestGetPINStatus
static int requestGetPINStatus(SIM_Status *pSIMStatus) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    PQMIDMS_UIM_PIN_STATUS pPin1Status = NULL;
    //PQMIDMS_UIM_PIN_STATUS pPin2Status = NULL;

    if (s_9x07)
        pRequest = ComposeQMUXMsg(QMUX_TYPE_UIM, QMIUIM_GET_CARD_STATUS_REQ, NULL, NULL);
    else
        pRequest = ComposeQMUXMsg(QMUX_TYPE_DMS, QMIDMS_UIM_GET_PIN_STATUS_REQ, NULL, NULL);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    qmi_rsp_check_and_return();

    pPin1Status = (PQMIDMS_UIM_PIN_STATUS)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x11);
    //pPin2Status = (PQMIDMS_UIM_PIN_STATUS)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x12);

    if (pPin1Status != NULL) {
        if (pPin1Status->PINStatus == QMI_PIN_STATUS_NOT_VERIF) {
            *pSIMStatus = SIM_PIN;
        } else if (pPin1Status->PINStatus == QMI_PIN_STATUS_BLOCKED) {
            *pSIMStatus = SIM_PUK;
        } else if (pPin1Status->PINStatus == QMI_PIN_STATUS_PERM_BLOCKED) {
            *pSIMStatus = SIM_BAD;
        }
    }

    free(pResponse);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x1c46a(%rip)     # 0x2a2f8
je 0xde9c
movl $0xb, %edi
movl $0x2f, %esi
jmp 0xdea6
movl $0x2, %edi
movl $0x2b, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xda86
leaq 0x12ad9(%rip), %rcx     # 0x2098f
leaq 0x8(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa317
movl %eax, %ebp
testl %eax, %eax
sets %al
movq (%r14), %r12
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xdf4a
movq 0x1c0d7(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xeb2f
leaq 0x1288d(%rip), %rsi     # 0x20785
leaq 0x12a90(%rip), %rcx     # 0x2098f
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1cd92(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xe00b
callq 0xeb2f
leaq 0x12857(%rip), %rsi     # 0x20785
leaq 0x12a5a(%rip), %rcx     # 0x2098f
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xe00b
movzwl 0x10(%r12), %edi
callq 0xef61
testw %ax, %ax
jne 0xdf6e
movzwl 0x12(%r12), %edi
callq 0xef61
testw %ax, %ax
je 0xe018
movzwl 0x12(%r12), %edi
callq 0xef61
movl %eax, %ebx
movq 0x1c03e(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xef61
movzwl %ax, %r8d
movzwl %bx, %ebx
leaq 0x127f1(%rip), %rsi     # 0x20797
leaq 0x129e2(%rip), %rcx     # 0x2098f
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1cce4(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xe001
callq 0xeb2f
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xef61
movzwl %ax, %r8d
leaq 0x127ad(%rip), %rsi     # 0x20797
leaq 0x1299e(%rip), %rcx     # 0x2098f
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
movq 0x8(%rsp), %rdi
callq 0x5040
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rdi
addq $0x9, %rdi
movl $0x11, %esi
callq 0xa29c
testq %rax, %rax
je 0xe001
movzbl 0x3(%rax), %eax
cmpl $0x1, %eax
je 0xe051
cmpl $0x5, %eax
je 0xe04a
cmpl $0x4, %eax
jne 0xe001
movl $0x4, %eax
jmp 0xe056
movl $0x6, %eax
jmp 0xe056
movl $0x3, %eax
movl %eax, (%rbx)
jmp 0xe001