// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x38(%rbp)
cmpl $0x0, 0x259f5(%rip)     # 0x37300
je 0x11929
movl $0xb, %edi
movl $0x2f, %esi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x11170
movq %rax, -0x18(%rbp)
jmp 0x11943
movl $0x2, %edi
movl $0x2b, %esi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x11170
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movl $0x7530, %edx           # imm = 0x7530
leaq 0x1c214(%rip), %rcx     # 0x2db6b
callq 0xc670
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x11970
cmpq $0x0, -0x20(%rbp)
jne 0x119f2
jmp 0x11972
movq 0x25667(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x13930
movq -0x48(%rbp), %rdi
movq %rax, %rdx
movl -0x2c(%rbp), %r8d
leaq 0x1bfca(%rip), %rsi     # 0x2d961
leaq 0x1c1cd(%rip), %rcx     # 0x2db6b
movb $0x0, %al
callq 0x52c0
leaq 0x264bc(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x119e5
leaq 0x264af(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x50(%rbp)
callq 0x13930
movq -0x50(%rbp), %rdi
movq %rax, %rdx
movl -0x2c(%rbp), %r8d
leaq 0x1bf8a(%rip), %rsi     # 0x2d961
leaq 0x1c18d(%rip), %rcx     # 0x2db6b
movb $0x0, %al
callq 0x52c0
jmp 0x119e7
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x11b77
movq -0x20(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x11a2c
movq -0x28(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x11af5
movq -0x28(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movw %ax, -0x3a(%rbp)
movq 0x2559c(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x13930
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x3a(%rbp), %r9d
leaq 0x1befa(%rip), %rsi     # 0x2d973
leaq 0x1c0eb(%rip), %rcx     # 0x2db6b
movb $0x0, %al
callq 0x52c0
leaq 0x263da(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x11ade
leaq 0x263cd(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x70(%rbp)
callq 0x13930
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x3a(%rbp), %r9d
leaq 0x1bea3(%rip), %rsi     # 0x2d973
leaq 0x1c094(%rip), %rcx     # 0x2db6b
movb $0x0, %al
callq 0x52c0
jmp 0x11ae0
movq -0x20(%rbp), %rdi
callq 0x5040
movzwl -0x3a(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x11b77
jmp 0x11af7
movq -0x20(%rbp), %rdi
addq $0x6, %rdi
addq $0x3, %rdi
movl $0x11, %esi
callq 0xc580
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x11b67
movq -0x38(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x1, %eax
jne 0x11b31
movq -0x10(%rbp), %rax
movl $0x3, (%rax)
jmp 0x11b65
movq -0x38(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x4, %eax
jne 0x11b4a
movq -0x10(%rbp), %rax
movl $0x4, (%rax)
jmp 0x11b63
movq -0x38(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x5, %eax
jne 0x11b61
movq -0x10(%rbp), %rax
movl $0x6, (%rax)
jmp 0x11b63
jmp 0x11b65
jmp 0x11b67
movq -0x20(%rbp), %rdi
callq 0x5040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq