// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x1(%rax), %edi
callq 0x19120
movzwl %ax, %eax
addl $0x1, %eax
cltq
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x18f0c
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x3, %eax
jne 0x18e80
movb 0x2007b(%rip), %cl      # 0x38ef4
movq -0x10(%rbp), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
cmpl $0x0, %eax
jne 0x18f0a
jmp 0x18e8f
movq 0x1e14a(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x13930
movq -0x40(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %ecx
leaq 0x12221(%rip), %rsi     # 0x2b0d9
movb $0x0, %al
callq 0x52c0
leaq 0x1efa2(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x18efc
leaq 0x1ef95(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x13930
movq -0x48(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %ecx
leaq 0x121e4(%rip), %rsi     # 0x2b0d9
movb $0x0, %al
callq 0x52c0
jmp 0x18efe
movl $0xffffffed, -0x4(%rbp) # imm = 0xFFFFFFED
jmp 0x19112
jmp 0x18f0c
movq -0x10(%rbp), %rdx
movq -0x30(%rbp), %rax
movl %eax, %ecx
movl $0x1, %esi
movl %esi, %edi
callq 0x19140
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl 0x1e4f0(%rip), %edx     # 0x37420
leaq -0x20(%rbp), %rsi
callq 0x17270
movl %eax, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x18f4d
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x18f55
xorl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0x18f55
movq -0x50(%rbp), %rdi
callq 0x17480
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x18f78
cmpl $0x0, -0x34(%rbp)
jne 0x18f78
cmpq $0x0, -0x20(%rbp)
jne 0x1908c
cmpq $0x0, -0x20(%rbp)
je 0x18f97
movq -0x20(%rbp), %rdi
cmpl $0x0, 0x1ff66(%rip)     # 0x38ef0
sete %al
andb $0x1, %al
movzbl %al, %esi
callq 0x17560
jmp 0x18f99
cmpq $0x0, -0x18(%rbp)
je 0x18fb1
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x18fb3
jmp 0x18fb5
cmpq $0x0, -0x20(%rbp)
je 0x18fcd
movq -0x20(%rbp), %rdi
callq 0x5040
movq $0x0, -0x20(%rbp)
jmp 0x18fcf
jmp 0x18fd1
movq 0x1e008(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x58(%rbp)
callq 0x13930
movq -0x58(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r9d
movl -0x34(%rbp), %eax
leaq 0x155f4(%rip), %rsi     # 0x2e5ed
leaq 0x15620(%rip), %rcx     # 0x2e620
movl $0x991, %r8d            # imm = 0x991
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
leaq 0x1ee51(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1905c
leaq 0x1ee44(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x13930
movq -0x60(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r9d
movl -0x34(%rbp), %eax
leaq 0x155a8(%rip), %rsi     # 0x2e5ed
leaq 0x155d4(%rip), %rcx     # 0x2e620
movl $0x991, %r8d            # imm = 0x991
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
jmp 0x1905e
cmpl $0x0, -0x24(%rbp)
je 0x1906f
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x19112
cmpl $0x0, -0x34(%rbp)
je 0x19080
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x19112
movl $0x22b8, -0x4(%rbp)     # imm = 0x22B8
jmp 0x19112
jmp 0x1908e
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movl 0x2c(%rax), %edi
callq 0x191c0
movl %eax, %eax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x190d4
movl 0x1e370(%rip), %edi     # 0x37424
movq -0x20(%rbp), %rsi
addq $0x30, %rsi
movq -0x30(%rbp), %rdx
callq 0x5100
cmpq -0x30(%rbp), %rax
jne 0x190d2
movl $0x0, -0x24(%rbp)
jmp 0x190d4
jmp 0x190d6
cmpq $0x0, -0x18(%rbp)
je 0x190ee
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x190f0
jmp 0x190f2
cmpq $0x0, -0x20(%rbp)
je 0x1910a
movq -0x20(%rbp), %rdi
callq 0x5040
movq $0x0, -0x20(%rbp)
jmp 0x1910c
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)