LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/main.c
// Function: usbnet_link_change
static void usbnet_link_change(int link, PROFILE_T *profile) {
    if (s_link == link)
        return;

    s_link = link;

    if (!(link & (1<<IpFamilyV4)))
        memset(&profile->ipv4, 0, sizeof(IPV4_T));

    if (!(link & (1<<IpFamilyV6)))
        memset(&profile->ipv6, 0, sizeof(IPV6_T));

    if (link) {
        udhcpc_start(profile);
    } else {
        udhcpc_stop(profile);
    }
}

// Assembly:
cmpl %edi, 0x20c44(%rip)     # 0x2a2f4
jne 0x96b3
retq
movl %edi, 0x20c3b(%rip)     # 0x2a2f4
testb $0x10, %dil
jne 0x96d4
xorps %xmm0, %xmm0
movups %xmm0, 0x20e3d(%rip)    # 0x2a506
movq $0x0, 0x20e42(%rip) # 0x2a516
testb $0x40, %dil
jne 0x970b
xorps %xmm0, %xmm0
movups %xmm0, 0x20e7a(%rip)    # 0x2a55e
movups %xmm0, 0x20e63(%rip)    # 0x2a54e
movups %xmm0, 0x20e4c(%rip)    # 0x2a53e
movups %xmm0, 0x20e35(%rip)    # 0x2a52e
movups %xmm0, 0x20e1e(%rip)    # 0x2a51e
movq $0x0, 0x20e61(%rip) # 0x2a56c
testl %edi, %edi
je 0x971b
leaq 0x20cca(%rip), %rdi     # 0x2a3e0
jmp 0x1c5ab
leaq 0x20cbe(%rip), %rdi     # 0x2a3e0
jmp 0x1d552
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/main.c
// Function: ls_dir
static int ls_dir(const char *dir, int (*match)(const char *dir, const char *file, void *argv[]), void *argv[])
{
    DIR *pDir;
    struct dirent* ent = NULL;
    int match_times = 0;

    pDir = opendir(dir);
    if (pDir == NULL)  {
        dbg_time("Cannot open directory: %s, errno: %d (%s)", dir, errno, strerror(errno));
        return 0;
    }

    while ((ent = readdir(pDir)) != NULL)  {
        match_times += match(dir, ent->d_name, argv);
    }
    closedir(pDir);

    return match_times;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
callq 0x5140
testq %rax, %rax
je 0x9780
movq %rax, %r14
movq %rax, %rdi
callq 0x5320
xorl %ebp, %ebp
testq %rax, %rax
je 0x9773
addq $0x13, %rax
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq *%r12
addl %eax, %ebp
movq %r14, %rdi
callq 0x5320
jmp 0x9752
movq %r14, %rdi
callq 0x5240
jmp 0x9805
movq 0x20839(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
movq %rax, %r12
callq 0x5070
movq %rax, %r14
movl (%rax), %r13d
movl %r13d, %edi
callq 0x5530
leaq 0x155ee(%rip), %rsi     # 0x1ed9a
xorl %ebp, %ebp
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %rcx
movl %r13d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x214dd(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x9805
callq 0xeb2f
movq %rax, %r12
movl (%r14), %r14d
movl %r14d, %edi
callq 0x5530
leaq 0x155ad(%rip), %rsi     # 0x1ed9a
xorl %ebp, %ebp
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %rcx
movl %r14d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/main.c
// Function: is_same_linkfile
static int is_same_linkfile(const char *dir, const char *file,  void *argv[])
{
    const char *qmichannel = (const char *)argv[1];
    char linkname[MAX_PATH];
    char filename[MAX_PATH];
    int linksize;

    snprintf(linkname, MAX_PATH, "%s/%s", dir, file);
    linksize = readlink(linkname, filename, MAX_PATH);
    if (linksize <= 0)
        return 0;

    filename[linksize] = 0;
    if (strcmp(filename, qmichannel))
        return 0;

    dbg_time("%s -> %s", linkname, filename);
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r8
movq %rdi, %rcx
movq 0x8(%rdx), %r14
leaq 0x153bc(%rip), %rdx     # 0x1ee14
xorl %ebx, %ebx
leaq 0x100(%rsp), %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
xorl %eax, %eax
callq 0x51c0
movq %rsp, %rsi
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x50d0
testl %eax, %eax
jle 0x9b03
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, (%rsp,%rax)
movq %rsp, %rdi
movq %r14, %rsi
callq 0x52a0
testl %eax, %eax
jne 0x9b03
movq 0x2051c(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xeb2f
leaq 0x15367(%rip), %rsi     # 0x1ee1a
leaq 0x100(%rsp), %rcx
movq %rsp, %r8
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x211d6(%rip), %rax     # 0x2aca8
movq (%rax), %r14
movl $0x1, %ebx
testq %r14, %r14
je 0x9b03
callq 0xeb2f
leaq 0x1532f(%rip), %rsi     # 0x1ee1a
leaq 0x100(%rsp), %rcx
movq %rsp, %r8
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movl %ebx, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/MPQMUX.c
// Function: dump_tlv
void dump_tlv(PQCQMUX_MSG_HDR pQMUXMsgHdr) {
    int TLVFind = 0;
    int i;
    //dbg("QCQMUX_TLV-----------------------------------\n");
    //dbg("{Type,\tLength,\tValue}\n");

    while (1) {
        PQMI_TLV_HDR TLVHdr = GetTLV(pQMUXMsgHdr, 0x1000 + (++TLVFind));
        if (TLVHdr == NULL)
            break;

        //if ((TLVHdr->TLVType == 0x02) && ((USHORT *)(TLVHdr+1))[0])
        {        
            dbg("{%02x,\t%04x,\t", TLVHdr->TLVType, le16_to_cpu(TLVHdr->TLVLength));
            for (i = 0; i < le16_to_cpu(TLVHdr->TLVLength); i++) {
                dbg("%02x ", ((UCHAR *)(TLVHdr+1))[i]);
            }
            dbg("}\n");
        }
    }  // while
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
leaq 0x20c94(%rip), %r14     # 0x2a7c0
leaq 0x15373(%rip), %r13     # 0x1eea6
xorl %ebx, %ebx
movq %rdi, 0x10(%rsp)
leal 0x1001(%rbx), %esi
movq %r12, %rdi
callq 0xa29c
testq %rax, %rax
je 0x9c29
movq %rax, %rbp
movq %r14, %rdi
callq 0x5160
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9ba3
leaq (%r14,%rax), %r15
movl $0x400, %r12d           # imm = 0x400
subq %rax, %r12
movzbl (%rbp), %eax
movl %eax, 0xc(%rsp)
movzwl 0x1(%rbp), %edi
callq 0xef61
movzwl %ax, %r8d
movq %r15, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %r12
leaq 0x15300(%rip), %rdx     # 0x1ee98
movl 0xc(%rsp), %ecx
xorl %eax, %eax
callq 0x51c0
movzwl 0x1(%rbp), %edi
callq 0xef61
testw %ax, %ax
je 0x9bf4
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x5160
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9be0
leaq (%r14,%rax), %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
movzbl 0x3(%rbp,%r15), %ecx
movq %r13, %rdx
xorl %eax, %eax
callq 0x51c0
incq %r15
movzwl 0x1(%rbp), %edi
callq 0xef61
movzwl %ax, %eax
cmpq %rax, %r15
jb 0x9bb4
movq %r14, %rdi
callq 0x5160
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9c1e
leaq (%r14,%rax), %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
leaq 0x15295(%rip), %rdx     # 0x1eeac
xorl %eax, %eax
callq 0x51c0
incl %ebx
testq %rbp, %rbp
jne 0x9b3a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/MPQMUX.c
// Function: dump_ctl
void dump_ctl(PQCQMICTL_MSG_HDR CTLHdr) {
    const char *tag;
    
    //dbg("QCQMICTL_MSG--------------------------------------------\n");
    //dbg("CtlFlags:           %02x\t\t%s\n", CTLHdr->CtlFlags, QMI_NAME(qmi_ctl_CtlFlags, CTLHdr->CtlFlags));
   dbg("TransactionId:      %02x\n", CTLHdr->TransactionId);
        switch (CTLHdr->CtlFlags) {
            case QMICTL_FLAG_REQUEST: tag = "_REQ"; break;
            case QMICTL_FLAG_RESPONSE: tag = "_RESP"; break;
            case QMICTL_FLAG_INDICATION: tag = "_IND"; break;
            default: tag = 0; break;
       }
        dbg("QMICTLType:         %04x\t%s\n", le16_to_cpu(CTLHdr->QMICTLType),
        QMUX_NAME(qmux_ctl_QMICTLType, le16_to_cpu(CTLHdr->QMICTLType), tag));     
        dbg("Length:             %04x\n", le16_to_cpu(CTLHdr->Length));

     dump_tlv((PQCQMUX_MSG_HDR)(&CTLHdr->QMICTLType));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x20b76(%rip), %r14     # 0x2a7c0
movq %r14, %rdi
callq 0x5160
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9c7a
addq %rax, %r14
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
movzbl 0x1(%rbx), %ecx
leaq 0x1523f(%rip), %rdx     # 0x1eeaf
movq %r14, %rdi
xorl %eax, %eax
callq 0x51c0
movzbl (%rbx), %eax
cmpq $0x2, %rax
ja 0x9c93
leaq 0x15202(%rip), %rcx     # 0x1ee8c
movslq (%rcx,%rax,4), %r14
addq %rcx, %r14
jmp 0x9c96
xorl %r14d, %r14d
leaq 0x20b23(%rip), %r15     # 0x2a7c0
movq %r15, %rdi
callq 0x5160
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9cfe
addq %rax, %r15
movl $0x400, %r12d           # imm = 0x400
subq %rax, %r12
movzwl 0x2(%rbx), %edi
callq 0xef61
movzwl %ax, %ebp
movzwl 0x2(%rbx), %edi
callq 0xef61
movzwl %ax, %edx
leaq 0x1e928(%rip), %rdi     # 0x28600
movl $0xf, %esi
movq %r14, %rcx
callq 0x9d55
leaq 0x151dd(%rip), %rdx     # 0x1eec9
movq %r15, %rdi
movq %r12, %rsi
movl %ebp, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0x51c0
leaq 0x20abb(%rip), %r14     # 0x2a7c0
movq %r14, %rdi
callq 0x5160
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9d41
addq %rax, %r14
movl $0x400, %r15d           # imm = 0x400
subq %rax, %r15
movzwl 0x4(%rbx), %edi
callq 0xef61
movzwl %ax, %ecx
leaq 0x151b2(%rip), %rdx     # 0x1eee6
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x51c0
addq $0x2, %rbx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x9b14
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/MPQMUX.c
// Function: qmi_name_get
static const char * qmi_name_get(const QMI_NAME_T *table, size_t size, int type, const char *tag) {
    static char unknow[40];
    size_t i;

    if (qmux_CtlFlags == table) {
        if (!strcmp(tag, "_REQ"))
            tag = "_CMD";
        else  if (!strcmp(tag, "_RESP"))
            tag = "_RSP";
    }
    
    for (i = 0; i < size; i++) {
        if (table[i].type == (UINT)type) {
            if (!tag || (strstr(table[i].name, tag)))
                return table[i].name;
        }
    }
    sprintf(unknow, "unknow_%x", type);
    return unknow;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r15
leaq 0x1f561(%rip), %rax     # 0x292d0
cmpq %rax, %rdi
jne 0x9dac
leaq 0x15787(%rip), %rsi     # 0x1f502
movq %r14, %rdi
callq 0x52a0
testl %eax, %eax
je 0x9da5
leaq 0x15792(%rip), %rsi     # 0x1f520
movq %r14, %rdi
callq 0x52a0
testl %eax, %eax
leaq 0x151e7(%rip), %rax     # 0x1ef86
cmoveq %rax, %r14
jmp 0x9dac
leaq 0x151c3(%rip), %r14     # 0x1ef6f
testq %r12, %r12
je 0x9dd9
addq $0x8, %r15
cmpl %ebx, -0x8(%r15)
jne 0x9dd0
testq %r14, %r14
je 0x9df5
movq (%r15), %rdi
movq %r14, %rsi
callq 0x5550
testq %rax, %rax
jne 0x9df5
addq $0x10, %r15
decq %r12
jne 0x9db5
leaq 0x20e10(%rip), %r14     # 0x2abf0
leaq 0x1516c(%rip), %rsi     # 0x1ef53
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x54e0
jmp 0x9df8
movq (%r15), %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/MPQMUX.c
// Function: dump_qmi
void dump_qmi(void *dataBuffer, int dataLen) 
{
    PQCQMI_HDR QMIHdr = (PQCQMI_HDR)dataBuffer;
    PQCQMUX_HDR QMUXHdr = (PQCQMUX_HDR) (QMIHdr + 1);
    PQCQMICTL_MSG_HDR CTLHdr =  (PQCQMICTL_MSG_HDR) (QMIHdr + 1);

    int i;

    if (!debug_qmi)
        return;

    pthread_mutex_lock(&dumpQMIMutex);
    line[0] = 0;
    for (i = 0; i < dataLen; i++) {
        dbg("%02x ", ((unsigned char *)dataBuffer)[i]);
    }
    dbg_time("%s", line);
    line[0] = 0;
    
    //dbg("QCQMI_HDR-----------------------------------------");
    //dbg("IFType:             %02x\t\t%s", QMIHdr->IFType, QMI_NAME(qmi_IFType, QMIHdr->IFType));
    //dbg("Length:             %04x", le16_to_cpu(QMIHdr->Length));
    //dbg("CtlFlags:           %02x\t\t%s", QMIHdr->CtlFlags, QMI_NAME(qmi_CtlFlags, QMIHdr->CtlFlags));
    //dbg("QMIType:            %02x\t\t%s", QMIHdr->QMIType, QMI_NAME(qmi_QMIType, QMIHdr->QMIType));
    //dbg("ClientId:           %02x", QMIHdr->ClientId);

    if (QMIHdr->QMIType == QMUX_TYPE_CTL) {
        dump_ctl(CTLHdr);
    } else {
        dump_qmux(QMIHdr->QMIType, QMUXHdr);
    }
    dbg_time("%s", line);
    pthread_mutex_unlock(&dumpQMIMutex);
}

// Assembly:
leaq 0x20292(%rip), %rax     # 0x2a3d0
cmpl $0x0, (%rax)
je 0xa22c
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x20a62(%rip), %rdi     # 0x2abc0
callq 0x5560
movb $0x0, 0x20656(%rip)     # 0x2a7c0
testl %ebp, %ebp
jle 0xa1b5
movl %ebp, %r12d
leaq 0x20648(%rip), %r14     # 0x2a7c0
leaq 0x14d27(%rip), %r15     # 0x1eea6
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x5160
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xa1ad
leaq (%r14,%rax), %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
movzbl (%rbx,%r13), %ecx
movq %r15, %rdx
xorl %eax, %eax
callq 0x51c0
incq %r13
cmpq %r13, %r12
jne 0xa182
movq 0x1fe04(%rip), %r15     # 0x29fc0
movq (%r15), %r14
callq 0xeb2f
leaq 0x14d7f(%rip), %rsi     # 0x1ef4a
leaq 0x205ee(%rip), %rcx     # 0x2a7c0
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x20ac2(%rip), %r12     # 0x2aca8
movq (%r12), %r14
testq %r14, %r14
je 0xa20f
callq 0xeb2f
leaq 0x14d4f(%rip), %rsi     # 0x1ef4a
leaq 0x205be(%rip), %rcx     # 0x2a7c0
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movb $0x0, 0x205aa(%rip)     # 0x2a7c0
movzbl 0x4(%rbx), %edi
addq $0x6, %rbx
testl %edi, %edi
je 0xa22d
movq %rbx, %rsi
callq 0x9e07
jmp 0xa235
retq
movq %rbx, %rdi
callq 0x9c38
movq (%r15), %rbx
callq 0xeb2f
leaq 0x14d06(%rip), %rsi     # 0x1ef4a
leaq 0x20575(%rip), %rcx     # 0x2a7c0
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movq (%r12), %rbx
testq %rbx, %rbx
je 0xa281
callq 0xeb2f
leaq 0x14cdd(%rip), %rsi     # 0x1ef4a
leaq 0x2054c(%rip), %rcx     # 0x2a7c0
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x20938(%rip), %rdi     # 0x2abc0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5340
nop
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: GetTLV
PQMI_TLV_HDR GetTLV (PQCQMUX_MSG_HDR pQMUXMsgHdr, int TLVType) {
    int TLVFind = 0;
    USHORT Length = le16_to_cpu(pQMUXMsgHdr->Length);
    PQMI_TLV_HDR pTLVHdr = (PQMI_TLV_HDR)(pQMUXMsgHdr + 1);

    while (Length >= sizeof(QMI_TLV_HDR)) {
        TLVFind++;
        if (TLVType > 0x1000) {
            if ((TLVFind + 0x1000) == TLVType)
                return pTLVHdr;
        } else  if (pTLVHdr->TLVType == TLVType) {
            return pTLVHdr;
        }

        Length -= (le16_to_cpu((pTLVHdr->TLVLength)) + sizeof(QMI_TLV_HDR));
        pTLVHdr = (PQMI_TLV_HDR)(((UCHAR *)pTLVHdr) + le16_to_cpu(pTLVHdr->TLVLength) + sizeof(QMI_TLV_HDR));
    }

   return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movzwl 0x2(%rdi), %edi
callq 0xef61
cmpw $0x3, %ax
jb 0xa307
movl %eax, %r14d
addq $0x4, %rbx
movl $0x1001, %r15d          # imm = 0x1001
cmpl $0x1001, %ebp           # imm = 0x1001
jl 0xa2d3
cmpl %r15d, %ebp
jne 0xa2da
jmp 0xa309
movzbl (%rbx), %eax
cmpl %ebp, %eax
je 0xa309
movzwl 0x1(%rbx), %edi
callq 0xef61
subl %eax, %r14d
addl $-0x3, %r14d
movzwl 0x1(%rbx), %edi
callq 0xef61
movzwl %ax, %eax
addq %rax, %rbx
addq $0x3, %rbx
incl %r15d
cmpw $0x2, %r14w
ja 0xa2c4
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: QmiThreadSendQMITimeout
int QmiThreadSendQMITimeout(PQCQMIMSG pRequest, PQCQMIMSG *ppResponse, unsigned msecs, const char *funcname) {
    int ret;
    
    if (!pRequest)
        return -EINVAL;

    pthread_mutex_lock(&cm_command_mutex);

    if (ppResponse)
        *ppResponse = NULL;

    dump_qmi(pRequest, le16_to_cpu(pRequest->QMIHdr.Length) + 1);

    s_pRequest = pRequest;
    s_pResponse = NULL;

    ret = qmidev_send(pRequest);

    if (ret == 0) {
        ret = pthread_cond_timeout_np(&cm_command_cond, &cm_command_mutex, msecs);
        if (!ret) {
            if (s_pResponse && ppResponse) {
                *ppResponse = s_pResponse;
            } else {
                if (s_pResponse) {
                    free(s_pResponse);
                    s_pResponse = NULL;
                }
            }
        } else {
            dbg_time("%s message timeout", funcname);
        }
    }

    pthread_mutex_unlock(&cm_command_mutex);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0xa38f
movq %rcx, %rbx
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %r12
leaq 0x20919(%rip), %rdi     # 0x2ac50
callq 0x5560
testq %r14, %r14
je 0xa348
movq $0x0, (%r14)
movzwl 0x1(%r12), %edi
callq 0xef61
movzwl %ax, %esi
incl %esi
movq %r12, %rdi
callq 0xa137
movq %r12, 0x208b1(%rip)     # 0x2ac18
movq $0x0, 0x208ae(%rip) # 0x2ac20
movq %r12, %rdi
callq *0x208ad(%rip)          # 0x2ac28
movl %eax, %ebp
testl %eax, %eax
je 0xa39f
leaq 0x208c8(%rip), %rdi     # 0x2ac50
callq 0x5340
jmp 0xa394
movl $0xffffffea, %ebp       # imm = 0xFFFFFFEA
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x208d2(%rip), %rdi     # 0x2ac78
leaq 0x208a3(%rip), %rsi     # 0x2ac50
movl %r15d, %edx
callq 0xedc5
testl %eax, %eax
je 0xa411
movl %eax, %ebp
movq 0x1fbfe(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
leaq 0x16363(%rip), %rsi     # 0x20734
movq %r14, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x208c0(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xa381
callq 0xeb2f
leaq 0x16338(%rip), %rsi     # 0x20734
movq %r14, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x52c0
jmp 0xa381
testq %r14, %r14
sete %al
movq 0x20802(%rip), %rdi     # 0x2ac20
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0xa432
movq %rdi, (%r14)
xorl %ebp, %ebp
jmp 0xa381
xorl %ebp, %ebp
testq %rdi, %rdi
je 0xa381
callq 0x5040
movq $0x0, 0x207d3(%rip) # 0x2ac20
jmp 0xa381
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: requestEnterSimPin
static int requestEnterSimPin(const char *pPinCode) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;

    if (s_9x07)
        pRequest = ComposeQMUXMsg(QMUX_TYPE_UIM, QMIUIM_VERIFY_PIN_REQ, UimVerifyPinReqSend, (void *)pPinCode);
    else
        pRequest = ComposeQMUXMsg(QMUX_TYPE_DMS, QMIDMS_UIM_VERIFY_PIN_REQ, DmsUIMVerifyPinReqSend, (void *)pPinCode);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    qmi_rsp_check_and_return();

    free(pResponse);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rcx
cmpl $0x0, 0x1edf7(%rip)     # 0x2a2f8
je 0xb516
leaq 0x2b50(%rip), %rdx      # 0xe05a
movl $0xb, %edi
movl $0x26, %esi
jmp 0xb527
leaq 0x2bbd(%rip), %rdx      # 0xe0da
movl $0x2, %edi
movl $0x28, %esi
callq 0xda86
leaq 0x15470(%rip), %rcx     # 0x209a3
movq %rsp, %r14
movq %rax, %rdi
movq %r14, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa317
movl %eax, %ebx
testl %eax, %eax
sets %al
movq (%r14), %r12
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xb5c5
movq 0x1ea5c(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
leaq 0x15212(%rip), %rsi     # 0x20785
leaq 0x15429(%rip), %rcx     # 0x209a3
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1f717(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xb685
callq 0xeb2f
leaq 0x151dc(%rip), %rsi     # 0x20785
leaq 0x153f3(%rip), %rcx     # 0x209a3
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xb685
movzwl 0x10(%r12), %edi
callq 0xef61
testw %ax, %ax
jne 0xb5e9
movzwl 0x12(%r12), %edi
callq 0xef61
testw %ax, %ax
je 0xb693
movzwl 0x12(%r12), %edi
callq 0xef61
movl %eax, %ebx
movq 0x1e9c3(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xef61
movzwl %ax, %r8d
movzwl %bx, %ebx
leaq 0x15176(%rip), %rsi     # 0x20797
leaq 0x1537b(%rip), %rcx     # 0x209a3
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1f669(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xb67c
callq 0xeb2f
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xef61
movzwl %ax, %r8d
leaq 0x15132(%rip), %rsi     # 0x20797
leaq 0x15337(%rip), %rcx     # 0x209a3
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
movq (%rsp), %rdi
callq 0x5040
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%rsp), %rdi
callq 0x5040
xorl %ebx, %ebx
jmp 0xb685
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: ComposeQMUXMsg
static PQCQMIMSG ComposeQMUXMsg(UCHAR QMIType, USHORT Type, CUSTOMQMUX customQmuxMsgFunction, void *arg) {
    UCHAR QMIBuf[WDM_DEFAULT_BUFSIZE];
    PQCQMIMSG pRequest = (PQCQMIMSG)QMIBuf;
    int Length;

    memset(QMIBuf, 0x00, sizeof(QMIBuf));
    pRequest->QMIHdr.IFType = USB_CTL_MSG_TYPE_QMI;
    pRequest->QMIHdr.CtlFlags = 0x00;
    pRequest->QMIHdr.QMIType = QMIType;

    pRequest->MUXMsg.QMUXHdr.CtlFlags = QMUX_CTL_FLAG_SINGLE_MSG | QMUX_CTL_FLAG_TYPE_CMD;
    pRequest->MUXMsg.QMUXHdr.TransactionId = cpu_to_le16(GetQMUXTransactionId());
    pRequest->MUXMsg.QMUXMsgHdr.Type = cpu_to_le16(Type);
    if (customQmuxMsgFunction)
        pRequest->MUXMsg.QMUXMsgHdr.Length = cpu_to_le16(customQmuxMsgFunction(&pRequest->MUXMsg, arg) - sizeof(QCQMUX_MSG_HDR));
    else
        pRequest->MUXMsg.QMUXMsgHdr.Length = cpu_to_le16(0x0000);

    pRequest->QMIHdr.Length = cpu_to_le16(le16_to_cpu(pRequest->MUXMsg.QMUXMsgHdr.Length) + sizeof(QCQMUX_MSG_HDR) + sizeof(QCQMUX_HDR)
        + sizeof(QCQMI_HDR) - 1);
    Length = le16_to_cpu(pRequest->QMIHdr.Length) + 1;

    pRequest = (PQCQMIMSG)malloc(Length);
    if (pRequest == NULL) {
        dbg_time("%s fail to malloc", __func__);
    } else {
        memcpy(pRequest, QMIBuf, Length);
    }

    return pRequest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rcx, %r15
movq %rdx, %r14
movl %esi, %ebp
movl %edi, %r13d
movq %rsp, %r12
xorl %ebx, %ebx
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
xorl %esi, %esi
callq 0x5200
movb $0x1, (%r12)
movb %bl, 0x3(%r12)
movb %r13b, 0x4(%r12)
movb %bl, 0x6(%r12)
movl 0x1d160(%rip), %eax     # 0x2ac30
leal 0x1(%rax), %ecx
movl $0xffff, %edx           # imm = 0xFFFF
cmpl %edx, %eax
movl $0x1, %edi
cmovll %ecx, %edi
movl %edi, 0x1d148(%rip)     # 0x2ac30
andl %edx, %edi
callq 0xef6c
movw %ax, 0x7(%r12)
movl %ebp, %edi
callq 0xef6c
movw %ax, 0x9(%r12)
testq %r14, %r14
je 0xdb17
leaq 0x6(%rsp), %rdi
movq %r15, %rsi
callq *%r14
movl %eax, %ebx
addl $-0x4, %ebx
movzwl %bx, %edi
callq 0xef6c
movw %ax, 0xb(%rsp)
movzwl %ax, %edi
callq 0xef61
addl $0xc, %eax
movzwl %ax, %edi
callq 0xef6c
movw %ax, 0x1(%rsp)
movzwl %ax, %edi
callq 0xef61
movzwl %ax, %r14d
incq %r14
movq %r14, %rdi
callq 0x5360
movq %rax, %rbx
testq %rax, %rax
je 0xdb6b
movq %rsp, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x52f0
jmp 0xdbc4
movq 0x1c44e(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
leaq 0x104cd(%rip), %rsi     # 0x1e04e
leaq 0x12c48(%rip), %rcx     # 0x207d0
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x1d10c(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xdbc4
callq 0xeb2f
leaq 0x1049e(%rip), %rsi     # 0x1e04e
leaq 0x12c19(%rip), %rcx     # 0x207d0
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: WdsSetQMUXBindMuxDataPort
static USHORT WdsSetQMUXBindMuxDataPort(PQMUX_MSG pMUXMsg, void *arg) {
    QMAP_SETTING *qmap_settings = (QMAP_SETTING *)arg;

    pMUXMsg->BindMuxDataPortReq.TLVType = 0x10;
    pMUXMsg->BindMuxDataPortReq.TLVLength = cpu_to_le16(0x08);
    pMUXMsg->BindMuxDataPortReq.ep_type = cpu_to_le32(qmap_settings->ep_type);
    pMUXMsg->BindMuxDataPortReq.iface_id = cpu_to_le32(qmap_settings->iface_id);
    pMUXMsg->BindMuxDataPortReq.TLV2Type = 0x11;
    pMUXMsg->BindMuxDataPortReq.TLV2Length = cpu_to_le16(0x01);
    pMUXMsg->BindMuxDataPortReq.MuxId = qmap_settings->MuxId;
    pMUXMsg->BindMuxDataPortReq.TLV3Type = 0x13;
    pMUXMsg->BindMuxDataPortReq.TLV3Length = cpu_to_le16(0x04);
    pMUXMsg->BindMuxDataPortReq.client_type = cpu_to_le32(1); //WDS_CLIENT_TYPE_TETHERED
    
    return sizeof(QMIWDS_BIND_MUX_DATA_PORT_REQ_MSG);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movb $0x10, 0x7(%rdi)
movl $0x8, %edi
callq 0xef6c
movw %ax, 0x8(%rbx)
movl 0x8(%r14), %edi
callq 0xef6f
movl %eax, 0xa(%rbx)
movl 0xc(%r14), %edi
callq 0xef6f
movl %eax, 0xe(%rbx)
movb $0x11, 0x12(%rbx)
movl $0x1, %edi
callq 0xef6c
movw %ax, 0x13(%rbx)
movb 0x10(%r14), %al
movb %al, 0x15(%rbx)
movb $0x13, 0x16(%rbx)
movl $0x4, %edi
callq 0xef6c
movw %ax, 0x17(%rbx)
movl $0x1, %edi
callq 0xef6f
movl %eax, 0x19(%rbx)
movw $0x1a, %ax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: WdsSetClientIPFamilyPref
static USHORT WdsSetClientIPFamilyPref(PQMUX_MSG pMUXMsg, void *arg) {
    pMUXMsg->SetClientIpFamilyPrefReq.TLVType = 0x01;
    pMUXMsg->SetClientIpFamilyPrefReq.TLVLength = cpu_to_le16(0x01);
    pMUXMsg->SetClientIpFamilyPrefReq.IpPreference = *((UCHAR *)arg);
    return sizeof(QMIWDS_SET_CLIENT_IP_FAMILY_PREF_REQ_MSG);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movb $0x1, 0x7(%rdi)
movl $0x1, %edi
callq 0xef6c
movw %ax, 0x8(%r14)
movb (%rbx), %al
movb %al, 0xa(%r14)
movw $0x8, %ax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: WdaSetLoopBackReq
static USHORT WdaSetLoopBackReq(PQMUX_MSG pMUXMsg, void *arg) {
    (void)arg;
	pMUXMsg->SetLoopBackReq.loopback_state.TLVType  = 0x01;
	pMUXMsg->SetLoopBackReq.loopback_state.TLVLength = cpu_to_le16(1);

	pMUXMsg->SetLoopBackReq.replication_factor.TLVType	= 0x10;
	pMUXMsg->SetLoopBackReq.replication_factor.TLVLength = cpu_to_le16(4);

	return sizeof(QMI_WDA_SET_LOOPBACK_CONFIG_REQ_MSG);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb $0x1, 0x7(%rdi)
movl $0x1, %edi
callq 0xef6c
movw %ax, 0x8(%rbx)
movb $0x10, 0xb(%rbx)
movl $0x4, %edi
callq 0xef6c
movw %ax, 0xc(%rbx)
movw $0xf, %ax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: UimVerifyPinReqSend
static USHORT UimVerifyPinReqSend(PQMUX_MSG pMUXMsg, void *arg)
{
    pMUXMsg->UIMUIMVerifyPinReq.TLVType = 0x01;
    pMUXMsg->UIMUIMVerifyPinReq.TLVLength = cpu_to_le16(0x02);
    pMUXMsg->UIMUIMVerifyPinReq.Session_Type = 0x00;
    pMUXMsg->UIMUIMVerifyPinReq.Aid_Len = 0x00;
    pMUXMsg->UIMUIMVerifyPinReq.TLV2Type = 0x02;
    pMUXMsg->UIMUIMVerifyPinReq.TLV2Length = cpu_to_le16(2 + strlen((const char *)arg));
    pMUXMsg->UIMUIMVerifyPinReq.PINID = 0x01;  //Pin1, not Puk
    pMUXMsg->UIMUIMVerifyPinReq.PINLen= strlen((const char *)arg);
    qstrcpy((char *)&pMUXMsg->UIMUIMVerifyPinReq.PINValue, ((const char *)arg));
    return sizeof(QMIUIM_VERIFY_PIN_REQ_MSG) + (strlen((const char *)arg) - 1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movb $0x1, %bpl
movb %bpl, 0x7(%rdi)
movl $0x2, %edi
callq 0xef6c
movw %ax, 0x8(%r14)
movw $0x0, 0xa(%r14)
movb $0x2, 0xc(%r14)
movq %rbx, %rdi
callq 0x5160
addl $0x2, %eax
movzwl %ax, %edi
callq 0xef6c
movw %ax, 0xd(%r14)
movb %bpl, 0xf(%r14)
movq %rbx, %rdi
callq 0x5160
movb %al, 0x10(%r14)
movb (%rbx), %al
movb %al, 0x11(%r14)
testb %al, %al
je 0xe0ca
xorl %eax, %eax
movb 0x1(%rbx,%rax), %cl
movb %cl, 0x12(%r14,%rax)
incq %rax
testb %cl, %cl
jne 0xe0ba
movq %rbx, %rdi
callq 0x5160
addl $0xe, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: DmsUIMVerifyPinReqSend
static USHORT DmsUIMVerifyPinReqSend(PQMUX_MSG pMUXMsg, void *arg) {
    pMUXMsg->UIMVerifyPinReq.TLVType = 0x01;
    pMUXMsg->UIMVerifyPinReq.PINID = 0x01; //Pin1, not Puk
    pMUXMsg->UIMVerifyPinReq.PINLen = strlen((const char *)arg);
    qstrcpy((char *)&pMUXMsg->UIMVerifyPinReq.PINValue, ((const char *)arg));
    pMUXMsg->UIMVerifyPinReq.TLVLength = cpu_to_le16(2 + strlen((const char *)arg));
    return sizeof(QMIDMS_UIM_VERIFY_PIN_REQ_MSG) + (strlen((const char *)arg) - 1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movb $0x1, %al
movb %al, 0x7(%rdi)
movb %al, 0xa(%rdi)
movq %rsi, %rdi
callq 0x5160
movb %al, 0xb(%r14)
movb (%rbx), %al
movb %al, 0xc(%r14)
testb %al, %al
je 0xe114
xorl %eax, %eax
movb 0x1(%rbx,%rax), %cl
movb %cl, 0xd(%r14,%rax)
incq %rax
testb %cl, %cl
jne 0xe104
movq %rbx, %rdi
callq 0x5160
addl $0x2, %eax
movzwl %ax, %edi
callq 0xef6c
movw %ax, 0x8(%r14)
movq %rbx, %rdi
callq 0x5160
addl $0x9, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: WdsGetProfileSettingsReqSend
static USHORT WdsGetProfileSettingsReqSend(PQMUX_MSG pMUXMsg, void *arg) {
    PROFILE_T *profile = (PROFILE_T *)arg;
    pMUXMsg->GetProfileSettingsReq.Length = cpu_to_le16(sizeof(QMIWDS_GET_PROFILE_SETTINGS_REQ_MSG) - 4);
    pMUXMsg->GetProfileSettingsReq.TLVType = 0x01;
    pMUXMsg->GetProfileSettingsReq.TLVLength = cpu_to_le16(0x02);
    pMUXMsg->GetProfileSettingsReq.ProfileType = 0x00; // 0 ~ 3GPP, 1 ~ 3GPP2
    pMUXMsg->GetProfileSettingsReq.ProfileIndex = profile->pdp;
    return sizeof(QMIWDS_GET_PROFILE_SETTINGS_REQ_MSG);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x5, %edi
callq 0xef6c
movw %ax, 0x5(%r14)
movb $0x1, 0x7(%r14)
movl $0x2, %edi
callq 0xef6c
movw %ax, 0x8(%r14)
movb $0x0, 0xa(%r14)
movb 0x48(%rbx), %al
movb %al, 0xb(%r14)
movw $0x9, %ax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: WdsCreateProfileSettingsReqSend
static USHORT WdsCreateProfileSettingsReqSend(PQMUX_MSG pMUXMsg, void *arg) {
    PROFILE_T *profile = (PROFILE_T *)arg;
    pMUXMsg->CreatetProfileSettingsReq.Length = cpu_to_le16(sizeof(QMIWDS_CREATE_PROFILE_SETTINGS_REQ_MSG) - 4);
    pMUXMsg->CreatetProfileSettingsReq.TLVType = 0x01;
    pMUXMsg->CreatetProfileSettingsReq.TLVLength = cpu_to_le16(0x01);
    pMUXMsg->CreatetProfileSettingsReq.ProfileType = 0x00; // 0 ~ 3GPP, 1 ~ 3GPP2
    pMUXMsg->CreatetProfileSettingsReq.TLV2Type = 0x25;
    pMUXMsg->CreatetProfileSettingsReq.TLV2Length = cpu_to_le16(0x01);
    pMUXMsg->CreatetProfileSettingsReq.pdp_context = profile->pdp; // 0 ~ 3GPP, 1 ~ 3GPP2
    return sizeof(QMIWDS_CREATE_PROFILE_SETTINGS_REQ_MSG);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x8, %edi
callq 0xef6c
movw %ax, 0x5(%r14)
movb $0x1, 0x7(%r14)
movl $0x1, %edi
callq 0xef6c
movw %ax, 0x8(%r14)
movw $0x2500, 0xa(%r14)      # imm = 0x2500
movl $0x1, %edi
callq 0xef6c
movw %ax, 0xc(%r14)
movb 0x48(%rbx), %al
movb %al, 0xe(%r14)
movw $0xc, %ax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: quectel_convert_cdma_mcc_2_ascii_mcc
static void quectel_convert_cdma_mcc_2_ascii_mcc( USHORT *p_mcc, USHORT mcc )
{
  unsigned int d1, d2, d3, buf = mcc + 111;

  if ( mcc == 0x3FF ) // wildcard
  {
    *p_mcc = 3;
  }
  else
  {
    d3 = buf % 10;
    buf = ( d3 == 0 ) ? (buf-10)/10 : buf/10;

    d2 = buf % 10;
    buf = ( d2 == 0 ) ? (buf-10)/10 : buf/10;

    d1 = ( buf == 10 ) ? 0 : buf;

//dbg_time("d1:%d, d2:%d,d3:%d",d1,d2,d3);
    if ( d1<10 && d2<10 && d3<10 )
    {
    *p_mcc = d1*100+d2*10+d3;
#if 0
      *(p_mcc+0) = '0' + d1;
      *(p_mcc+1) = '0' + d2;
      *(p_mcc+2) = '0' + d3;
#endif
    }
    else
    {
      //dbg_time( "invalid digits %d %d %d", d1, d2, d3 );
      *p_mcc = 0;
    }
  }
}

// Assembly:
movw $0x3, %r8w
cmpl $0x3ff, %esi            # imm = 0x3FF
je 0xe625
movzwl %si, %edx
leal 0x6f(%rdx), %ecx
imulq $0x1999999a, %rcx, %rax # imm = 0x1999999A
shrq $0x20, %rax
addl %eax, %eax
leal (%rax,%rax,4), %esi
addl $0x65, %edx
movl %ecx, %eax
subl %esi, %eax
cmovnel %ecx, %edx
imulq $0x1999999a, %rdx, %rsi # imm = 0x1999999A
shrq $0x20, %rsi
imulq $0x1999999a, %rsi, %rcx # imm = 0x1999999A
shrq $0x20, %rcx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %r8d
movl %esi, %ecx
subl %r8d, %ecx
je 0xe5f9
movl %edx, %edx
imulq $0x28f5c29, %rdx, %rdx  # imm = 0x28F5C29
shrq $0x20, %rdx
jmp 0xe609
addl $-0xa, %esi
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rsi, %rdx
shrq $0x23, %rdx
xorl %r8d, %r8d
cmpl $0xa, %edx
cmovel %r8d, %edx
cmpl $0x9, %edx
ja 0xe625
imull $0x64, %edx, %edx
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,2), %r8d
addl %edx, %r8d
movw %r8w, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: char2ushort
static USHORT char2ushort(UCHAR str[3]) {
    int i;
    char temp[4];
    USHORT ret= 0;

    memcpy(temp, str, 3);
    temp[3] = '\0';

    for (i = 0; i < 4; i++) {
        if ((UCHAR)temp[i] == 0xFF) {
            temp[i] = '\0';
        }
    }
    ret = (USHORT)atoi(temp);

    return ret;
}

// Assembly:
pushq %rax
movb 0x2(%rdi), %al
movb %al, 0x6(%rsp)
movzwl (%rdi), %eax
movw %ax, 0x4(%rsp)
movb $0x0, 0x7(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
movzbl 0x4(%rsp,%rcx), %edx
cmpb $-0x1, %dl
cmovel %eax, %edx
movb %dl, 0x4(%rsp,%rcx)
incq %rcx
cmpq $0x4, %rcx
jne 0xe643
leaq 0x4(%rsp), %rdi
callq 0x54b0
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: WdsStopNwInterfaceReq
static USHORT WdsStopNwInterfaceReq(PQMUX_MSG pMUXMsg, void *arg) {
    pMUXMsg->StopNwInterfaceReq.TLVType = 0x01;
    pMUXMsg->StopNwInterfaceReq.TLVLength = cpu_to_le16(0x04);
    if (*((int *)arg) == IpFamilyV4)
        pMUXMsg->StopNwInterfaceReq.Handle =  cpu_to_le32(WdsConnectionIPv4Handle);
    else
        pMUXMsg->StopNwInterfaceReq.Handle =  cpu_to_le32(WdsConnectionIPv6Handle);
    return sizeof(QMIWDS_STOP_NETWORK_INTERFACE_REQ_MSG);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movb $0x1, 0x7(%rdi)
movl $0x4, %edi
callq 0xef6c
movw %ax, 0x8(%r14)
cmpl $0x4, (%rbx)
leaq 0x1c320(%rip), %rax     # 0x2ac3c
leaq 0x1c31d(%rip), %rcx     # 0x2ac40
cmoveq %rax, %rcx
movl (%rcx), %edi
callq 0xef6f
movl %eax, 0xa(%r14)
movw $0xb, %ax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/util.c
// Function: cm_open_dev
int cm_open_dev(const char *dev) {
    int fd;

    fd = open(dev, O_RDWR | O_NONBLOCK | O_NOCTTY);
    if (fd != -1) {
        fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) | O_NONBLOCK);
        fcntl(fd, F_SETFD, FD_CLOEXEC);

        if (!strncmp(dev, "/dev/tty", strlen("/dev/tty")))
        {
            //disable echo on serial ports 
            struct termios  ios;

            memset(&ios, 0, sizeof(ios));
            tcgetattr( fd, &ios );
            cfmakeraw(&ios);
            cfsetispeed(&ios, B115200);
            cfsetospeed(&ios, B115200);
            tcsetattr( fd, TCSANOW, &ios );
            tcflush(fd, TCIOFLUSH);
        }
    } else {
        dbg_time("Failed to open %s, errno: %d (%s)", dev, errno, strerror(errno));
    }

    return fd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %r14
movl $0x902, %esi            # imm = 0x902
xorl %eax, %eax
callq 0x5440
movl %eax, %ebx
cmpl $-0x1, %eax
je 0xeaa3
movl %ebx, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x50e0
orl $0x800, %eax            # imm = 0x800
movl %ebx, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x50e0
movl %ebx, %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x50e0
leaq 0x12296(%rip), %rsi     # 0x20cc5
movl $0x8, %edx
movq %r14, %rdi
callq 0x5090
testl %eax, %eax
jne 0xeb20
xorps %xmm0, %xmm0
movq %rsp, %r14
movups %xmm0, 0x2c(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
movl %ebx, %edi
movq %r14, %rsi
callq 0x5420
movq %r14, %rdi
callq 0x53a0
movq %r14, %rdi
movl $0x1002, %esi           # imm = 0x1002
callq 0x5480
movq %r14, %rdi
movl $0x1002, %esi           # imm = 0x1002
callq 0x5150
movl %ebx, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x5430
movl %ebx, %edi
movl $0x2, %esi
callq 0x5180
jmp 0xeb20
movq 0x1b516(%rip), %rax     # 0x29fc0
movq (%rax), %r12
callq 0xeb2f
callq 0x5070
movq %rax, %r15
movl (%rax), %ebp
movl %ebp, %edi
callq 0x5530
leaq 0x12204(%rip), %rsi     # 0x20cce
leaq 0x1c1df(%rip), %rdx     # 0x2acb0
movq %r12, %rdi
movq %r14, %rcx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movq 0x1c1bd(%rip), %r12     # 0x2aca8
testq %r12, %r12
je 0xeb20
callq 0xeb2f
movl (%r15), %ebp
movl %ebp, %edi
callq 0x5530
leaq 0x121c8(%rip), %rsi     # 0x20cce
leaq 0x1c1a3(%rip), %rdx     # 0x2acb0
movq %r12, %rdi
movq %r14, %rcx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/util.c
// Function: pthread_cond_timeout_np
int pthread_cond_timeout_np(pthread_cond_t *cond, pthread_mutex_t * mutex, unsigned msecs) {
    if (msecs != 0) {
        unsigned i;
        unsigned t = msecs/4;
        int ret = 0;

        if (t == 0)
            t = 1;

        for (i = 0; i < msecs; i += t) {
            struct timespec ts;
            setTimespecRelative(&ts, t);
//very old uclibc do not support pthread_condattr_setclock(CLOCK_MONOTONIC)
            ret = pthread_cond_timedwait(cond, mutex, &ts); //to advoid system time change
            if (ret != ETIMEDOUT) {
                if(ret) dbg_time("ret=%d, msecs=%u, t=%u", ret, msecs, t);
                break;
            }
        }

        return ret;
    } else {
        return pthread_cond_wait(cond, mutex);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r12
testl %edx, %edx
je 0xef0a
movl %edx, %r15d
movq %rsi, 0x20(%rsp)
movl %edx, %eax
shrl $0x2, %eax
cmpl $0x4, %edx
movl $0x1, %esi
cmovael %eax, %esi
movabsq $0x4189374bc6a7f0, %rcx # imm = 0x4189374BC6A7F0
movq %rsi, %rax
mulq %rcx
movq %rdx, %r13
imulq $0x3e8, %rdx, %rax      # imm = 0x3E8
movq %rsi, 0x8(%rsp)
subq %rax, %rsi
imulq $0x3e8, %rsi, %rbx      # imm = 0x3E8
xorl %r14d, %r14d
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x51f0
movq 0x28(%rsp), %rax
addq %r13, %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rcx
addq %rbx, %rcx
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
movq %rcx, 0x18(%rsp)
cmpq $0x3b9aca00, %rcx       # imm = 0x3B9ACA00
jb 0xee6c
incq %rax
movq %rax, 0x10(%rsp)
addq $-0x3b9aca00, %rcx      # imm = 0xC4653600
movq %rcx, 0x18(%rsp)
movq %r12, %rdi
movq 0x20(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x5410
movl %eax, %ebp
cmpl $0x6e, %eax
jne 0xee91
addl 0x8(%rsp), %r14d
cmpl %r15d, %r14d
jb 0xee22
jmp 0xeef9
testl %ebp, %ebp
je 0xeef9
movq 0x1b124(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xeb2f
leaq 0x11e8b(%rip), %rsi     # 0x20d36
leaq 0x1bdfe(%rip), %rdx     # 0x2acb0
movq %rbx, %rdi
movl %ebp, %ecx
movl %r15d, %r8d
movq 0x8(%rsp), %r9
xorl %eax, %eax
callq 0x52c0
movq 0x1bddb(%rip), %rbx     # 0x2aca8
testq %rbx, %rbx
je 0xeef9
callq 0xeb2f
leaq 0x11e58(%rip), %rsi     # 0x20d36
leaq 0x1bdcb(%rip), %rdx     # 0x2acb0
movq %rbx, %rdi
movl %ebp, %ecx
movl %r15d, %r8d
movq 0x8(%rsp), %r9
xorl %eax, %eax
callq 0x52c0
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5120
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/util.c
// Function: ql_set_driver_qmap_setting
void ql_set_driver_qmap_setting(PROFILE_T *profile, QMAP_SETTING *qmap_settings) {
    int ifc_ctl_sock;
    struct ifreq ifr;
    int rc;
    int request = 0x89F2;

    ifc_ctl_sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (ifc_ctl_sock <= 0) {
        dbg_time("socket() failed: %s\n", strerror(errno));
        return;
    }
    
    memset(&ifr, 0, sizeof(struct ifreq));
    strncpy(ifr.ifr_name, profile->usbnet_adapter, IFNAMSIZ);
    ifr.ifr_name[IFNAMSIZ - 1] = 0;    
    ifr.ifr_ifru.ifru_data = (void *)qmap_settings;
        
    rc = ioctl(ifc_ctl_sock, request, &ifr);
    if (rc < 0) {
        dbg_time("ioctl(0x%x, qmap_settings) failed: %s, rc=%d", request, strerror(errno), rc);
    }

    close(ifc_ctl_sock);	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %r15
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x55a0
testl %eax, %eax
jle 0xf8a3
movl %eax, %ebx
xorps %xmm0, %xmm0
movq %rsp, %r12
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq $0x0, 0x20(%r12)
addq $0xaa, %r15
movl $0x10, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x5080
movb $0x0, 0xf(%r12)
movq %r14, 0x10(%r12)
movl $0x89f2, %esi           # imm = 0x89F2
movl %ebx, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0x5210
testl %eax, %eax
jns 0xf88f
movl %eax, %ebp
movq 0x1a7a7(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
callq 0x5070
movq %rax, %r14
movl (%rax), %edi
callq 0x5530
leaq 0x11645(%rip), %rsi     # 0x20e7c
leaq 0x1b472(%rip), %rdx     # 0x2acb0
movq %r15, %rdi
movl $0x89f2, %ecx           # imm = 0x89F2
movq %rax, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0x52c0
movq 0x1b44e(%rip), %r15     # 0x2aca8
testq %r15, %r15
je 0xf88f
callq 0xeb2f
movl (%r14), %edi
callq 0x5530
leaq 0x11609(%rip), %rsi     # 0x20e7c
leaq 0x1b436(%rip), %rdx     # 0x2acb0
movq %r15, %rdi
movl $0x89f2, %ecx           # imm = 0x89F2
movq %rax, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0x52c0
movl %ebx, %edi
callq 0x5230
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x1a716(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
callq 0x5070
movq %rax, %rbx
movl (%rax), %edi
callq 0x5530
leaq 0x11563(%rip), %rsi     # 0x20e2b
leaq 0x1b3e1(%rip), %rdx     # 0x2acb0
movq %r14, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x52c0
movq 0x1b3c5(%rip), %r14     # 0x2aca8
testq %r14, %r14
je 0xf896
callq 0xeb2f
movl (%rbx), %edi
callq 0x5530
leaq 0x11530(%rip), %rsi     # 0x20e2b
leaq 0x1b3ae(%rip), %rdx     # 0x2acb0
movq %r14, %rdi
movq %rax, %rcx
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x52c0
nop
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/qmap_bridge_mode.c
// Function: ql_fread
static size_t ql_fread(const char *filename, void *buf, size_t size) {
    FILE *fp = fopen(filename , "r");
    size_t n = 0;

    memset(buf, 0x00, size);

    if (fp) {
        n = fread(buf, 1, size, fp);
        if (n <= 0 || n == size) {
            dbg_time("warnning: fail to fread(%s), fread=%zu, buf_size=%zu: (%s)", filename, n, size, strerror(errno));
        }
        fclose(fp);
    }

    return n > 0 ? n : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r15
leaq 0x12537(%rip), %rsi     # 0x2215e
callq 0x5470
movq %rax, %r14
xorl %r12d, %r12d
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x5200
testq %r14, %r14
je 0xfd08
movl $0x1, %esi
movq %r13, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x50b0
movq %rax, %r12
testq %rax, %rax
setne %al
cmpq %rbx, %r12
setne %cl
testb %cl, %al
jne 0xfd00
movq 0x1a347(%rip), %rax     # 0x29fc0
movq (%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xeb2f
movq %rax, %rbp
callq 0x5070
movq %rax, %r13
movl (%rax), %edi
callq 0x5530
movq %rax, (%rsp)
leaq 0x11378(%rip), %rsi     # 0x2101b
movq 0x10(%rsp), %rdi
movq %rbp, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x1afe6(%rip), %rax     # 0x2aca8
movq (%rax), %rbp
testq %rbp, %rbp
je 0xfd00
callq 0xeb2f
movq %rax, 0x10(%rsp)
movl (%r13), %edi
callq 0x5530
movq %rax, (%rsp)
leaq 0x11333(%rip), %rsi     # 0x2101b
movq %rbp, %rdi
movq 0x10(%rsp), %rdx
movq %r15, %rcx
movq %r12, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x52c0
movq %r14, %rdi
callq 0x5130
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/qmap_bridge_mode.c
// Function: ql_fwrite
static size_t ql_fwrite(const char *filename, const void *buf, size_t size) {
    FILE *fp = fopen(filename , "w");
    size_t n = 0;

    if (fp) {
        n = fwrite(buf, 1, size, fp);
        if (n != size) {
            dbg_time("warnning: fail to fwrite(%s), fwrite=%zu, buf_size=%zu: (%s)", filename, n, size, strerror(errno));
        }
        fclose(fp);
    }

    return n > 0 ? n : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
leaq 0x118e1(%rip), %rsi     # 0x21619
callq 0x5470
testq %rax, %rax
je 0xfe0c
movq %rax, %r14
movl $0x1, %esi
movq %r12, %rdi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x5500
cmpq %rbx, %rax
je 0xfdf6
movq %rax, %r12
movq 0x1a251(%rip), %rax     # 0x29fc0
movq (%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xeb2f
movq %rax, %rbp
callq 0x5070
movq %rax, %r13
movl (%rax), %edi
callq 0x5530
movq %rax, (%rsp)
leaq 0x112c3(%rip), %rsi     # 0x2105c
movq 0x10(%rsp), %rdi
movq %rbp, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x1aef0(%rip), %rax     # 0x2aca8
movq (%rax), %rbp
testq %rbp, %rbp
je 0xfdf6
callq 0xeb2f
movq %rax, 0x10(%rsp)
movl (%r13), %edi
callq 0x5530
movq %rax, (%rsp)
leaq 0x1127e(%rip), %rsi     # 0x2105c
movq %rbp, %rdi
movq 0x10(%rsp), %rdx
movq %r15, %rcx
movq %r12, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x52c0
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5130
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/qmap_bridge_mode.c
// Function: ql_driver_type_detect
int ql_driver_type_detect(PROFILE_T *profile) {
    if (qmidev_is_gobinet(profile->qmichannel)) {
        profile->qmi_ops = &gobi_qmidev_ops;
    }
    else {
        profile->qmi_ops = &qmiwwan_qmidev_ops;
    }
    qmidev_send = profile->qmi_ops->send;

    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x8a, %rdi
leaq 0xeb33(%rip), %rsi      # 0x1eb5c
movl $0xa, %edx
callq 0x5090
leaq 0x18586(%rip), %rcx     # 0x285c0
leaq 0x1859f(%rip), %rdx     # 0x285e0
leaq 0x10(%rdx), %rsi
testl %eax, %eax
cmovneq %rcx, %rdx
leaq 0x10(%rcx), %rax
movq %rdx, 0x31e(%rbx)
cmoveq %rsi, %rax
movq (%rax), %rax
leaq 0x1abc4(%rip), %rcx     # 0x2ac28
movq %rax, (%rcx)
xorl %eax, %eax
popq %rbx
retq