// File: /workspace/github_c_makefile_star2_O2/Carton32[P]quectel-CM/QMIThread.c
// Function: requestRegistrationState
static int requestRegistrationState(UCHAR *pPSAttachedState) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    PQMINAS_CURRENT_PLMN_MSG pCurrentPlmn;
    PSERVING_SYSTEM pServingSystem;
    PQMINAS_DATA_CAP pDataCap;
    USHORT MobileCountryCode = 0;
    USHORT MobileNetworkCode = 0;
    const char *pDataCapStr = "UNKNOW";

    if (s_9x07) {
        return requestRegistrationState2(pPSAttachedState);
    }

    pRequest = ComposeQMUXMsg(QMUX_TYPE_NAS, QMINAS_GET_SERVING_SYSTEM_REQ, NULL, NULL);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    qmi_rsp_check_and_return();

    pCurrentPlmn = (PQMINAS_CURRENT_PLMN_MSG)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x12);
    if (pCurrentPlmn) {
        MobileCountryCode = le16_to_cpu(pCurrentPlmn->MobileCountryCode);
        MobileNetworkCode = le16_to_cpu(pCurrentPlmn->MobileNetworkCode);
    }

    *pPSAttachedState = 0;
    pServingSystem = (PSERVING_SYSTEM)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x01);
    if (pServingSystem) {
    //Packet-switched domain attach state of the mobile.
    //0x00    PS_UNKNOWN ?Unknown or not applicable
    //0x01    PS_ATTACHED ?Attached
    //0x02    PS_DETACHED ?Detached
        *pPSAttachedState = pServingSystem->RegistrationState;
        if (pServingSystem->RegistrationState == 0x01) //0x01 ?C REGISTERED ?C Registered with a network
            *pPSAttachedState  = pServingSystem->PSAttachedState;
        else {
            //MobileCountryCode = MobileNetworkCode = 0;
            *pPSAttachedState  = 0x02;
        }
    }

    pDataCap = (PQMINAS_DATA_CAP)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x11);
    if (pDataCap && pDataCap->DataCapListLen) {
        UCHAR *DataCap = &pDataCap->DataCap;
        if (pDataCap->DataCapListLen == 2) {
            if ((DataCap[0] == 0x06) && ((DataCap[1] == 0x08) || (DataCap[1] == 0x0A)))
                DataCap[0] = DataCap[1];
        }
        switch (DataCap[0]) {
             case 0x01: pDataCapStr = "GPRS"; break;
             case 0x02: pDataCapStr = "EDGE"; break;
             case 0x03: pDataCapStr = "HSDPA"; break;
             case 0x04: pDataCapStr = "HSUPA"; break;
             case 0x05: pDataCapStr = "UMTS"; break;
             case 0x06: pDataCapStr = "1XRTT"; break;
             case 0x07: pDataCapStr = "1XEVDO"; break;
             case 0x08: pDataCapStr = "1XEVDO_REVA"; break;
             case 0x09: pDataCapStr = "GPRS"; break;
             case 0x0A: pDataCapStr = "1XEVDO_REVB"; break;
             case 0x0B: pDataCapStr = "LTE"; break;
             case 0x0C: pDataCapStr = "HSDPA"; break;
             case 0x0D: pDataCapStr = "HSDPA"; break;
             default: pDataCapStr = "UNKNOW"; break;
        }
    }

    if (pServingSystem && pServingSystem->RegistrationState == 0x01 && pServingSystem->InUseRadioIF && pServingSystem->RadioIF == 0x09) {
        pDataCapStr = "TD-SCDMA";
    }

    s_is_cdma = 0;
    if (pServingSystem && pServingSystem->RegistrationState == 0x01 && pServingSystem->InUseRadioIF && (pServingSystem->RadioIF == 0x01 || pServingSystem->RadioIF == 0x02)) {
        USHORT cmda_mcc = 0, cdma_mnc = 0;
        s_is_cdma = 1;
        if(!requestGetHomeNetwork(&cmda_mcc, &cdma_mnc,NULL, NULL) && cmda_mcc) {
            quectel_convert_cdma_mcc_2_ascii_mcc(&MobileCountryCode, cmda_mcc);
            quectel_convert_cdma_mnc_2_ascii_mnc(&MobileNetworkCode, cdma_mnc);
        }
        if (1) {
            PQCQMUX_TLV pTLV = (PQCQMUX_TLV)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x23);
            if (pTLV)
                s_hdr_personality = pTLV->Value;
            else
                s_hdr_personality = 0;
            if (s_hdr_personality == 2)
                pDataCapStr = "eHRPD";
        }
    }

    dbg_time("%s MCC: %d, MNC: %d, PS: %s, DataCap: %s", __func__,
        MobileCountryCode, MobileNetworkCode, (*pPSAttachedState == 1) ? "Attached" : "Detached" , pDataCapStr);

    free(pResponse);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
andw $0x0, 0xe(%rsp)
andw $0x0, 0xc(%rsp)
movq %rdi, %rbx
cmpl $0x0, 0x1d7c0(%rip)     # 0x292f8
je 0xbbec
andw $0x0, 0x8(%rsp)
andw $0x0, 0x6(%rsp)
movb $0x0, (%rbx)
pushq $0x3
popq %rdi
pushq $0x4d
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xd53c
leaq 0x12f76(%rip), %rcx     # 0x1ead9
leaq 0x18(%rsp), %r15
movq %rax, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x9e8b
movl %eax, %r14d
testl %eax, %eax
sets %al
movq (%r15), %r13
testq %r13, %r13
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xbc9b
movq 0x1d41d(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0x12bd7(%rip), %rsi     # 0x1e781
leaq 0x12f28(%rip), %rcx     # 0x1ead9
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1e0e0(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xbe04
callq 0xe343
leaq 0x12ba1(%rip), %rsi     # 0x1e781
leaq 0x12ef2(%rip), %rcx     # 0x1ead9
jmp 0xbc86
pushq $0x3
popq %rdi
pushq $0x24
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xd53c
leaq 0x12e30(%rip), %rcx     # 0x1ea32
leaq 0x18(%rsp), %r15
movq %rax, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x9e8b
movl %eax, %r14d
testl %eax, %eax
sets %al
movq (%r15), %r13
testq %r13, %r13
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xbd47
movq 0x1d37e(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0x12b38(%rip), %rsi     # 0x1e781
leaq 0x12de2(%rip), %rcx     # 0x1ea32
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1e041(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xbe04
callq 0xe343
leaq 0x12b02(%rip), %rsi     # 0x1e781
leaq 0x12dac(%rip), %rcx     # 0x1ea32
movq %rbx, %rdi
movq %rax, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xbe04
movzwl 0x10(%r13), %edi
callq 0xe73e
testw %ax, %ax
jne 0xbcbd
movzwl 0x12(%r13), %edi
callq 0xe73e
testw %ax, %ax
je 0xbe16
movzwl 0x12(%r13), %edi
callq 0xe73e
movl %eax, %ebx
movq 0x1d2e8(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movq %rax, %r12
movzwl 0x10(%r13), %edi
callq 0xe73e
movzwl %ax, %r8d
movzwl %bx, %r14d
leaq 0x12a9f(%rip), %rsi     # 0x1e793
leaq 0x12dde(%rip), %rcx     # 0x1ead9
movq %r15, %rdi
movq %r12, %rdx
movl %r14d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1df96(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xbdfa
callq 0xe343
movq %rax, %r15
movzwl 0x10(%r13), %edi
callq 0xe73e
movzwl %ax, %r8d
leaq 0x12a58(%rip), %rsi     # 0x1e793
leaq 0x12d97(%rip), %rcx     # 0x1ead9
jmp 0xbdea
movzwl 0x10(%r13), %edi
callq 0xe73e
testw %ax, %ax
jne 0xbd69
movzwl 0x12(%r13), %edi
callq 0xe73e
testw %ax, %ax
je 0xc182
movzwl 0x12(%r13), %edi
callq 0xe73e
movl %eax, %ebx
movq 0x1d23c(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movq %rax, %r12
movzwl 0x10(%r13), %edi
callq 0xe73e
movzwl %ax, %r8d
movzwl %bx, %r14d
leaq 0x129f3(%rip), %rsi     # 0x1e793
leaq 0x12c8b(%rip), %rcx     # 0x1ea32
movq %r15, %rdi
movq %r12, %rdx
movl %r14d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1deea(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xbdfa
callq 0xe343
movq %rax, %r15
movzwl 0x10(%r13), %edi
callq 0xe73e
movzwl %ax, %r8d
leaq 0x129b0(%rip), %rsi     # 0x1e793
leaq 0x12c48(%rip), %rcx     # 0x1ea32
movq %rbx, %rdi
movq %r15, %rdx
movl %r14d, %r9d
xorl %eax, %eax
callq 0x52c0
movq 0x18(%rsp), %rdi
callq 0x5040
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %r14
addq $0xd, %r14
movzwl 0xb(%r13), %edi
callq 0xe73e
andl $0x0, 0x1de06(%rip)     # 0x29c34
andl $0x0, 0x1de03(%rip)     # 0x29c38
movzwl %ax, %r15d
movb $0x1, 0xb(%rsp)
leaq 0x12be6(%rip), %rax     # 0x1ea2b
movq %rax, 0x30(%rsp)
movl $0x0, 0x10(%rsp)
leaq 0x12833(%rip), %r12     # 0x1e68c
xorl %ebp, %ebp
xorl %r13d, %r13d
movl $0x0, 0x2c(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x28(%rsp)
testq %r15, %r15
jle 0xc129
movzbl (%r14), %eax
leal -0x10(%rax), %ecx
cmpl $0x15, %ecx
ja 0xbebe
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
movzbl %bpl, %eax
jmpq *%rcx
cmpb $0x2, 0x3(%r14)
jne 0xc0fc
xorl %eax, %eax
cmpl $0x0, 0x10(%rsp)
sete %al
movl %eax, 0x1dd81(%rip)     # 0x29c34
movl $0x2f0000, %r13d        # imm = 0x2F0000
jmp 0xbf86
addl $-0x4a, %eax
cmpl $0x5, %eax
ja 0xc0fc
leaq 0x12813(%rip), %rcx     # 0x1e6e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x2, 0x3(%r14)
jne 0xc0fc
andl $0x0, 0x1dd48(%rip)     # 0x29c34
orl $0x80, %r13d
movb $0x2, %bpl
pushq $0x1
popq %rax
movl %eax, 0x10(%rsp)
jmp 0xc0fc
cmpb $0x1, 0x3(%r14)
jne 0xbfad
testb $0x2, 0x4(%r14)
je 0xbfad
movb $0x1, (%rbx)
jmp 0xbfad
cmpb $0x2, 0x3(%r14)
jne 0xc0fc
andl $0x0, 0x1dd02(%rip)     # 0x29c34
movb $0x2, %bpl
pushq $0x1
popq %rax
movl %eax, 0x10(%rsp)
pushq $0x20
popq %r13
jmp 0xc0fc
cmpb $0x1, 0x3(%r14)
jne 0xbf57
testb $0x2, 0x4(%r14)
jne 0xc083
cmpb $0x0, (%rbx)
jne 0xc096
jmp 0xc0ae
cmpb $0x2, 0x3(%r14)
jne 0xc0fc
xorl %eax, %eax
cmpl $0x0, 0x10(%rsp)
sete %al
movl %eax, 0x1dcb4(%rip)     # 0x29c34
movl $0x500000, %r13d        # imm = 0x500000
movb $0x1, %bpl
jmp 0xc0fc
cmpb $0x1, 0x3(%r14)
jne 0xbfad
testb $0x2, 0x4(%r14)
je 0xbfad
movb $0x1, (%rbx)
andl $0x0, 0x1dc8e(%rip)     # 0x29c34
pushq $0x1
popq %rax
movl %eax, 0x10(%rsp)
cmpb $0x1, 0x16(%r14)
jne 0xc0fc
leaq 0x17(%r14), %rdi
callq 0xde8c
movw %ax, 0x8(%rsp)
leaq 0x1a(%r14), %rdi
callq 0xde8c
movw %ax, 0x6(%rsp)
jmp 0xc0fc
cmpb $0x2, 0x3(%r14)
pushq $0x2
popq %rcx
cmovel %ecx, %eax
pushq $0x3
jmp 0xbff5
cmpb $0x2, 0x3(%r14)
pushq $0x2
popq %rcx
cmovel %ecx, %eax
pushq $0x4
popq %rcx
cmovel %ecx, %r13d
movl %eax, %ebp
jmp 0xc0fc
cmpb $0x1, 0x3(%r14)
jne 0xc022
testb $0x2, 0x4(%r14)
je 0xc022
movb $0x1, (%rbx)
xorl %eax, %eax
cmpl $0x0, 0x10(%rsp)
sete %al
movl %eax, 0x1dc12(%rip)     # 0x29c34
cmpb $0x1, 0x26(%r14)
jne 0xc0fc
leaq 0x27(%r14), %rdi
callq 0xde8c
movw %ax, 0x8(%rsp)
leaq 0x2a(%r14), %rdi
jmp 0xbfca
cmpb $0x2, 0x3(%r14)
movq 0x30(%rsp), %rax
leaq 0x12a37(%rip), %rcx     # 0x1ea89
cmoveq %rcx, %rax
movq %rax, 0x30(%rsp)
jmp 0xc0fc
movb 0x3(%r14), %al
movl %eax, 0x24(%rsp)
movb $0x1, %al
movl %eax, 0x2c(%rsp)
jmp 0xc0fc
movb 0x3(%r14), %al
movb %al, 0xb(%rsp)
movb $0x1, %al
movl %eax, 0x28(%rsp)
jmp 0xc0fc
movb $0x1, (%rbx)
xorl %eax, %eax
cmpl $0x0, 0x10(%rsp)
sete %al
movl %eax, 0x1db9e(%rip)     # 0x29c34
cmpb $0x1, 0xd(%r14)
jne 0xc0ae
cmpb $0x3, 0xe(%r14)
jne 0xc0ae
movl $0x2, 0x1db8a(%rip)     # 0x29c38
andw $0x0, 0x16(%rsp)
andw $0x0, 0x14(%rsp)
leaq 0x16(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0xdbdf
testl %eax, %eax
sete %cl
movzwl 0x16(%rsp), %eax
testw %ax, %ax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xc0fc
movzwl %ax, %esi
leaq 0x8(%rsp), %rdi
callq 0xddbd
movzwl 0x14(%rsp), %esi
leaq 0x6(%rsp), %rdi
callq 0xde40
movzwl 0x1(%r14), %edi
callq 0xe73e
movzwl %ax, %eax
subq %rax, %r15
addq $-0x3, %r15
movzwl 0x1(%r14), %edi
callq 0xe73e
movzwl %ax, %eax
addq %rax, %r14
addq $0x3, %r14
jmp 0xbe76
testb $0x20, %r13b
je 0xc15e
cmpb $0x0, 0x2c(%rsp)
setne %al
cmpb $0x0, 0x28(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xc15e
movl %r13d, %eax
orl $0x40, %eax
cmpb $0x0, 0xb(%rsp)
cmovnel %r13d, %eax
cmpb $0x0, 0x24(%rsp)
cmovnel %eax, %r13d
cmpb $0x1, %bpl
jne 0xc1c6
cmpl $0x2, 0x1dacd(%rip)     # 0x29c38
movq 0x30(%rsp), %rbp
jne 0xc208
leaq 0x12915(%rip), %rbp     # 0x1ea92
jmp 0xc345
movq 0x18(%rsp), %rdi
addq $0x9, %rdi
pushq $0x12
popq %rsi
callq 0x9e14
testq %rax, %rax
je 0xc26d
movq %rax, %r14
movzwl 0x3(%rax), %edi
callq 0xe73e
movl %eax, %ebp
movw %ax, 0xe(%rsp)
movzwl 0x5(%r14), %edi
callq 0xe73e
movl %eax, %r14d
movw %ax, 0xc(%rsp)
jmp 0xc272
movl $0x80, %eax
testb %r13b, %r13b
movq 0x30(%rsp), %rbp
js 0xc31b
testb $0x40, %r13b
jne 0xc314
testb $0x20, %r13b
jne 0xc318
movl %r13d, %eax
andl $0x18, %eax
cmpl $0x18, %eax
jne 0xc56a
leaq 0x128f0(%rip), %rbp     # 0x1eaf3
jmp 0xc345
movl $0x200000, %eax         # imm = 0x200000
btl $0x15, %r13d
jb 0xc31b
movl $0x40000, %eax          # imm = 0x40000
btl $0x12, %r13d
jb 0xc31b
movl $0x20000, %eax          # imm = 0x20000
btl $0x11, %r13d
jb 0xc31b
movl $0x10000, %eax          # imm = 0x10000
btl $0x10, %r13d
jb 0xc31b
movl $0x100000, %eax         # imm = 0x100000
btl $0x14, %r13d
jb 0xc31b
movl $0x400000, %eax         # imm = 0x400000
btl $0x16, %r13d
jb 0xc31b
jmp 0xc345
xorl %r14d, %r14d
xorl %ebp, %ebp
movb $0x0, (%rbx)
movq 0x18(%rsp), %rdi
addq $0x9, %rdi
pushq $0x1
popq %rsi
callq 0x9e14
movq %rax, %r15
testq %rax, %rax
je 0xc2a1
movb 0x3(%r15), %cl
movb %cl, (%rbx)
movb $0x2, %al
cmpb $0x1, %cl
jne 0xc29f
movb 0x5(%r15), %al
movb %al, (%rbx)
movq 0x18(%rsp), %rdi
addq $0x9, %rdi
pushq $0x11
popq %rsi
callq 0x9e14
leaq 0x12772(%rip), %r12     # 0x1ea2b
testq %rax, %rax
je 0xc3eb
movb 0x3(%rax), %dl
testb %dl, %dl
je 0xc3eb
xorb $0x2, %dl
movb 0x4(%rax), %cl
movl %ecx, %esi
xorb $0x6, %sil
orb %dl, %sil
jne 0xc2f3
movzbl 0x5(%rax), %ecx
movl %ecx, %edx
orl $0x2, %edx
cmpl $0xa, %edx
jne 0xc3e4
movb %cl, 0x4(%rax)
decb %cl
cmpb $0xc, %cl
ja 0xc3eb
movzbl %cl, %eax
leaq 0x123f4(%rip), %rcx     # 0x1e6fc
movslq (%rcx,%rax,4), %r12
addq %rcx, %r12
jmp 0xc3eb
pushq $0x40
jmp 0xc31a
pushq $0x20
popq %rax
xorl %ecx, %ecx
leaq 0x127db(%rip), %rbp     # 0x1eaff
leaq 0x1c055(%rip), %rdx     # 0x28380
leaq 0x10(%rcx), %rsi
cmpq $0x120, %rsi            # imm = 0x120
je 0xc345
cmpl %eax, (%rcx,%rdx)
movq %rsi, %rcx
jne 0xc32b
movq -0x8(%rsi,%rdx), %rbp
movq 0x1cc6c(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movzwl 0x8(%rsp), %r8d
movzwl 0x6(%rsp), %r9d
cmpb $0x1, (%rbx)
leaq 0x1275d(%rip), %r13     # 0x1eac7
leaq 0x1275f(%rip), %r12     # 0x1ead0
movq %r12, %r10
cmoveq %r13, %r10
leaq 0x12719(%rip), %rsi     # 0x1ea98
leaq 0x12753(%rip), %rcx     # 0x1ead9
xorl %r14d, %r14d
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %rbp
pushq %r10
callq 0x52c0
popq %rcx
popq %rdx
leaq 0x1d906(%rip), %rax     # 0x29ca8
movq (%rax), %r15
testq %r15, %r15
je 0xbdfa
callq 0xe343
movzwl 0x8(%rsp), %r8d
movzwl 0x6(%rsp), %r9d
cmpb $0x1, (%rbx)
cmoveq %r13, %r12
leaq 0x126cb(%rip), %rsi     # 0x1ea98
leaq 0x12705(%rip), %rcx     # 0x1ead9
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %rbp
pushq %r12
jmp 0xc55e
leaq 0x12675(%rip), %r12     # 0x1ea60
testq %r15, %r15
je 0xc4bf
cmpb $0x1, 0x3(%r15)
jne 0xc4bf
cmpb $0x0, 0x7(%r15)
je 0xc416
cmpb $0x9, 0x8(%r15)
leaq 0x12677(%rip), %rax     # 0x1ea89
cmoveq %rax, %r12
andl $0x0, 0x1d817(%rip)     # 0x29c34
cmpb $0x0, 0x7(%r15)
je 0xc4c6
movb 0x8(%r15), %al
decb %al
cmpb $0x1, %al
ja 0xc4c6
leaq 0x8(%rsp), %r14
andw $0x0, (%r14)
leaq 0x6(%rsp), %rsi
andw $0x0, (%rsi)
movl $0x1, 0x1d7e1(%rip)     # 0x29c34
movq %r14, %rdi
callq 0xdbdf
testl %eax, %eax
sete %cl
movzwl (%r14), %eax
testw %ax, %ax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xc48d
movzwl %ax, %esi
leaq 0xe(%rsp), %rdi
callq 0xddbd
movzwl 0x6(%rsp), %esi
leaq 0xc(%rsp), %rdi
callq 0xde40
movq 0x18(%rsp), %rdi
addq $0x9, %rdi
pushq $0x23
popq %rsi
callq 0x9e14
testq %rax, %rax
je 0xc585
movb 0x3(%rax), %al
movzbl %al, %eax
cmpb $0x2, %al
leaq 0x125dc(%rip), %rcx     # 0x1ea92
cmoveq %rcx, %r12
jmp 0xc587
andl $0x0, 0x1d76e(%rip)     # 0x29c34
movq 0x1caeb(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movzwl %bp, %r8d
movzwl %r14w, %r9d
cmpb $0x1, (%rbx)
leaq 0x125e0(%rip), %rbp     # 0x1eac7
leaq 0x125e2(%rip), %r13     # 0x1ead0
movq %r13, %r10
cmoveq %rbp, %r10
leaq 0x1259c(%rip), %rsi     # 0x1ea98
leaq 0x1252f(%rip), %rcx     # 0x1ea32
xorl %r14d, %r14d
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x52c0
popq %rcx
popq %rdx
leaq 0x1d788(%rip), %rax     # 0x29ca8
movq (%rax), %r15
testq %r15, %r15
je 0xbdfa
callq 0xe343
movzwl 0xe(%rsp), %r8d
movzwl 0xc(%rsp), %r9d
cmpb $0x1, (%rbx)
cmoveq %rbp, %r13
leaq 0x1254d(%rip), %rsi     # 0x1ea98
leaq 0x124e0(%rip), %rcx     # 0x1ea32
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r13
callq 0x52c0
popq %rcx
popq %rdx
jmp 0xbdfa
xorl %ecx, %ecx
testb $0x8, %r13b
sete %dl
testl %eax, %eax
je 0xc59d
movb %dl, %cl
leal 0x8(,%rcx,8), %eax
jmp 0xc31b
xorl %eax, %eax
movl %eax, 0x1d6ab(%rip)     # 0x29c38
movzwl 0xe(%rsp), %ebp
movzwl 0xc(%rsp), %r14d
jmp 0xc4c6
pushq $0x4
popq %rax
testb $0x4, %r13b
jne 0xc31b
pushq $0x2
popq %rax
testb $0x2, %r13b
jne 0xc31b
testb $0x1, %r13b
je 0xc345
pushq $0x1
jmp 0xc31a