// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/mbim-cm.c
// Function: qmi_over_mbim_qmidev_send
int qmi_over_mbim_qmidev_send(PQCQMIMSG pQMI) {
    MBIM_MESSAGE_HEADER *pRequest = NULL;
    MBIM_COMMAND_DONE_T *pCmdDone = NULL;
    int err;
    size_t len = le16toh(pQMI->QMIHdr.Length) + 1;

    if (pQMI->QMIHdr.QMIType != QMUX_TYPE_CTL) {
        if (pQMI->QMIHdr.QMIType == QMUX_TYPE_NAS)
            pQMI->QMIHdr.ClientId = qmi_over_mbim_nas;

        if (pQMI->QMIHdr.ClientId == 0) {
            dbg_time("QMIType %d has no clientID", pQMI->QMIHdr.QMIType);
            return -ENODEV;
        }
    }

    pRequest = compose_qmi_over_mbim_command(1, MBIM_CID_CMD_TYPE_SET, pQMI, len);
    err = mbim_send_command(pRequest, &pCmdDone, mbim_default_timeout);
    mbim_check_err(err, pRequest, pCmdDone);

    err = -1;
    len = le32toh(pCmdDone->InformationBufferLength);
    if (len) {
        if (write(qmi_over_mbim_sk[0], pCmdDone->InformationBuffer, len) == len) {
            err = 0;
        };
    }

    mbim_free(pRequest); mbim_free(pCmdDone);
    return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq $0x0, 0x8(%rsp)
movzwl 0x1(%rdi), %ecx
movzbl 0x4(%rdi), %eax
testl %eax, %eax
je 0x14be9
cmpl $0x3, %eax
jne 0x14bdf
movb $0x0, 0x5(%rbx)
cmpb $0x0, 0x5(%rbx)
je 0x14d74
incl %ecx
movl $0x1, %edi
movl $0x1, %esi
movq %rbx, %rdx
callq 0x10b66
xorl %r15d, %r15d
testq %rax, %rax
je 0x14c21
movq %rax, %rbx
leaq 0xd071(%rip), %rdi      # 0x21c80
callq 0x10c1b
movups 0x17119(%rip), %xmm0    # 0x2bd34
movups %xmm0, 0x14(%rbx)
jmp 0x14c23
xorl %ebx, %ebx
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x10d09
movl %eax, %ebp
movq (%r14), %rdi
testq %rdi, %rdi
je 0x14c5f
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl (%rdi), %eax
cmpl $0x3, %eax
ja 0x14c5f
movl %eax, %eax
leaq 0xdbb1(%rip), %rcx      # 0x22808
movq (%rcx,%rax,8), %rax
movl (%rdi,%rax), %r15d
movl %ebp, %eax
orl %r15d, %eax
sete %al
testq %rdi, %rdi
setne %r12b
andb %al, %r12b
je 0x14c78
jmp 0x14d3c
testq %rdi, %rdi
je 0x14c8f
xorl %esi, %esi
cmpl $0x0, 0x170aa(%rip)     # 0x2bd30
sete %sil
callq 0x10e8f
testq %rbx, %rbx
je 0x14c9c
movq %rbx, %rdi
callq 0x5040
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14cb4
callq 0x5040
movq $0x0, 0x8(%rsp)
movq 0x15305(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xeb2f
movl %r15d, (%rsp)
leaq 0xc68f(%rip), %rsi      # 0x2135d
leaq 0xc6bb(%rip), %rcx      # 0x21390
movq %rbx, %rdi
movq %rax, %rdx
movl $0x991, %r8d            # imm = 0x991
movl %ebp, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x15fb6(%rip), %rax     # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x14d27
callq 0xeb2f
movl %r15d, (%rsp)
leaq 0xc653(%rip), %rsi      # 0x2135d
leaq 0xc67f(%rip), %rcx      # 0x21390
movq %rbx, %rdi
movq %rax, %rdx
movl $0x991, %r8d            # imm = 0x991
movl %ebp, %r9d
xorl %eax, %eax
callq 0x52c0
testl %r15d, %r15d
movl $0x22b8, %r14d          # imm = 0x22B8
cmovnel %r15d, %r14d
testl %ebp, %ebp
cmovnel %ebp, %r14d
xorl %ebx, %ebx
testb %r12b, %r12b
je 0x14dfa
movq 0x8(%rsp), %rsi
movl 0x2c(%rsi), %r15d
testq %r15, %r15
je 0x14dcf
movl 0x155a7(%rip), %edi     # 0x2a300
addq $0x30, %rsi
movq %r15, %rdx
callq 0x5100
xorl %r14d, %r14d
cmpq %r15, %rax
setne %r14b
negl %r14d
jmp 0x14dd5
movq 0x15245(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movzbl 0x4(%rbx), %ecx
leaq 0x930f(%rip), %rsi      # 0x1e09d
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x15f06(%rip), %rax     # 0x2aca8
movq (%rax), %r15
movl $0xffffffed, %r14d      # imm = 0xFFFFFFED
testq %r15, %r15
je 0x14dfa
callq 0xeb2f
movzbl 0x4(%rbx), %ecx
leaq 0x92dd(%rip), %rsi      # 0x1e09d
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0x14dfa
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x14de2
movq %rbx, %rdi
callq 0x5040
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14dfa
callq 0x5040
movq $0x0, 0x8(%rsp)
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq