// File: /workspace/github_c_makefile_star2_O3/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, 0x1c561(%rip)     # 0x2a2f8
je 0xdda5
movl $0xb, %edi
movl $0x2f, %esi
jmp 0xddaf
movl $0x2, %edi
movl $0x2b, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xd9a2
leaq 0x12bcc(%rip), %rcx     # 0x2098b
leaq 0x8(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa273
movl %eax, %ebp
testl %eax, %eax
sets %al
movq (%r14), %r12
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xde53
movq 0x1c1ce(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xea3b
leaq 0x12980(%rip), %rsi     # 0x20781
leaq 0x12b83(%rip), %rcx     # 0x2098b
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1ce89(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xdf14
callq 0xea3b
leaq 0x1294a(%rip), %rsi     # 0x20781
leaq 0x12b4d(%rip), %rcx     # 0x2098b
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xdf14
movzwl 0x10(%r12), %edi
callq 0xee73
testw %ax, %ax
jne 0xde77
movzwl 0x12(%r12), %edi
callq 0xee73
testw %ax, %ax
je 0xdf21
movzwl 0x12(%r12), %edi
callq 0xee73
movl %eax, %ebx
movq 0x1c135(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xee73
movzwl %ax, %r8d
movzwl %bx, %ebx
leaq 0x128e4(%rip), %rsi     # 0x20793
leaq 0x12ad5(%rip), %rcx     # 0x2098b
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1cddb(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xdf0a
callq 0xea3b
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xee73
movzwl %ax, %r8d
leaq 0x128a0(%rip), %rsi     # 0x20793
leaq 0x12a91(%rip), %rcx     # 0x2098b
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 0xa1f8
testq %rax, %rax
je 0xdf0a
movzbl 0x3(%rax), %eax
cmpl $0x1, %eax
je 0xdf5a
cmpl $0x5, %eax
je 0xdf53
cmpl $0x4, %eax
jne 0xdf0a
movl $0x4, %eax
jmp 0xdf5f
movl $0x6, %eax
jmp 0xdf5f
movl $0x3, %eax
movl %eax, (%rbx)
jmp 0xdf0a