// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0x8(%rsp)
movq %rdi, %rbx
movzwl 0x1(%rdi), %ecx
movzbl 0x4(%rdi), %eax
testl %eax, %eax
je 0x13ed2
cmpl $0x3, %eax
jne 0x13ec8
movb $0x0, 0x5(%rbx)
jmp 0x13f78
cmpb $0x0, 0x5(%rbx)
je 0x13f78
incl %ecx
pushq $0x1
popq %rdi
movl %edi, %esi
movq %rbx, %rdx
callq 0x1022b
movq %rax, %r14
testq %rax, %rax
je 0x13f01
leaq 0xbdd4(%rip), %rdi      # 0x1fcc4
callq 0x102de
movups 0x16e38(%rip), %xmm0    # 0x2ad34
movups %xmm0, 0x14(%r14)
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x103ea
movl %eax, %ebx
movq (%r15), %r12
movq %r12, %rdi
callq 0x1055f
movl %eax, %ebp
testq %r12, %r12
je 0x13fd8
testl %ebx, %ebx
jne 0x13fd8
testl %ebp, %ebp
jne 0x13fd8
movl 0x2c(%r12), %ebx
testq %rbx, %rbx
je 0x13ff9
movl 0x153ae(%rip), %edi     # 0x29300
addq $0x30, %r12
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5100
xorl %r15d, %r15d
cmpq %rbx, %rax
setne %r15b
negl %r15d
movq 0x8(%rsp), %r12
jmp 0x13ffd
movq 0x15039(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movzbl 0x4(%rbx), %ecx
leaq 0x810b(%rip), %rsi      # 0x1c09d
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x15d02(%rip), %rax     # 0x29ca8
movq (%rax), %r14
pushq $-0x13
popq %r15
testq %r14, %r14
je 0x140b3
callq 0xe343
movzbl 0x4(%rbx), %ecx
leaq 0x80d7(%rip), %rsi      # 0x1c09d
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0x140b3
testq %r12, %r12
je 0x14012
xorl %esi, %esi
cmpl $0x0, 0x16d4a(%rip)     # 0x2ad30
sete %sil
movq %r12, %rdi
callq 0x10583
movq 0x8(%rsp), %r15
jmp 0x14015
pushq $-0x1
popq %r15
movq %r14, %rdi
callq 0x5040
movq %r12, %rdi
callq 0x5040
jmp 0x140b3
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x5040
testq %r15, %r15
je 0x14030
movq %r15, %rdi
callq 0x5040
andq $0x0, 0x8(%rsp)
movq 0x14f81(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movl %ebp, (%rsp)
leaq 0xb358(%rip), %rsi      # 0x1f3a1
leaq 0xb384(%rip), %rcx      # 0x1f3d4
movq %r14, %rdi
movq %rax, %rdx
movl $0x991, %r8d            # imm = 0x991
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x15c3b(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x140a1
callq 0xe343
movl %ebp, (%rsp)
leaq 0xb31d(%rip), %rsi      # 0x1f3a1
leaq 0xb349(%rip), %rcx      # 0x1f3d4
movq %r14, %rdi
movq %rax, %rdx
movl $0x991, %r8d            # imm = 0x991
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
testl %ebp, %ebp
movl $0x22b8, %r15d          # imm = 0x22B8
cmovnel %ebp, %r15d
testl %ebx, %ebx
cmovnel %ebx, %r15d
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq