// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq $0x0, 0x8(%rsp)
movzwl 0x1(%rdi), %ecx
movzbl 0x4(%rdi), %eax
testl %eax, %eax
je 0x14a09
cmpl $0x3, %eax
jne 0x149fe
movb $0x0, 0x5(%r14)
jmp 0x14ac2
cmpb $0x0, 0x5(%r14)
je 0x14ac2
incl %ecx
movl $0x1, %edi
movl $0x1, %esi
movq %r14, %rdx
callq 0x10a7b
movq %rax, %r14
testq %rax, %rax
je 0x14a3d
leaq 0xd27c(%rip), %rdi      # 0x21ca8
callq 0x10b31
movups 0x172fc(%rip), %xmm0    # 0x2bd34
movups %xmm0, 0x14(%r14)
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x10c38
movl %eax, %ebx
movq (%r15), %rax
testq %rax, %rax
je 0x14b25
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addl (%rax), %ecx
xorl %r15d, %r15d
cmpl $0x3, %ecx
ja 0x14a80
movl %ecx, %ecx
leaq 0xddb8(%rip), %rdx      # 0x22830
movq (%rdx,%rcx,8), %rcx
movl (%rax,%rcx), %r15d
testl %ebx, %ebx
sete %bpl
movl %ebx, %ecx
orl %r15d, %ecx
jne 0x14b36
movl 0x2c(%rax), %r15d
testq %r15, %r15
je 0x14bf9
movl 0x1585c(%rip), %edi     # 0x2a300
addq $0x30, %rax
movq %rax, %rsi
movq %r15, %rdx
callq 0x5100
xorl %ebx, %ebx
cmpq %r15, %rax
setne %bl
negl %ebx
jmp 0x14bfe
movq 0x154f7(%rip), %rax     # 0x29fc0
movq (%rax), %rbx
callq 0xea3b
movzbl 0x4(%r14), %ecx
leaq 0x95c0(%rip), %rsi      # 0x1e09d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x161b7(%rip), %rax     # 0x2aca8
movq (%rax), %r15
movl $0xffffffed, %ebx       # imm = 0xFFFFFFED
testq %r15, %r15
je 0x14c1a
callq 0xea3b
movzbl 0x4(%r14), %ecx
leaq 0x958a(%rip), %rsi      # 0x1e09d
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0x14c1a
testl %ebx, %ebx
sete %bpl
movl $0x22b8, %r12d          # imm = 0x22B8
xorl %r15d, %r15d
jmp 0x14b58
xorl %esi, %esi
cmpl $0x0, 0x171f1(%rip)     # 0x2bd30
sete %sil
movq %rax, %rdi
callq 0x10dbe
testl %r15d, %r15d
movl $0x22b8, %r12d          # imm = 0x22B8
cmovnel %r15d, %r12d
testq %r14, %r14
je 0x14b65
movq %r14, %rdi
callq 0x5040
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14b7d
callq 0x5040
movq $0x0, 0x8(%rsp)
movq 0x1543c(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
movl %r15d, (%rsp)
leaq 0xc7ee(%rip), %rsi      # 0x21385
leaq 0xc81a(%rip), %rcx      # 0x213b8
movq %r14, %rdi
movq %rax, %rdx
movl $0x991, %r8d            # imm = 0x991
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x160ed(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x14bf0
callq 0xea3b
movl %r15d, (%rsp)
leaq 0xc7b2(%rip), %rsi      # 0x21385
leaq 0xc7de(%rip), %rcx      # 0x213b8
movq %r14, %rdi
movq %rax, %rdx
movl $0x991, %r8d            # imm = 0x991
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
testb %bpl, %bpl
cmovnel %r12d, %ebx
jmp 0x14c1a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x14c0b
movq %r14, %rdi
callq 0x5040
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14c1a
callq 0x5040
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq