// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/GobiNetCM.c
// Function: GobiNetSendQMI
static int GobiNetSendQMI(PQCQMIMSG pRequest) {
    int ret, fd;

    fd = qmiclientId[pRequest->QMIHdr.QMIType];
    pRequest->QMIHdr.ClientId = (fd&0xFF) ? fd&0xFF : pRequest->QMIHdr.QMIType;

    if (fd <= 0) {
        dbg_time("%s QMIType: %d has no clientID", __func__, pRequest->QMIHdr.QMIType);
        return -ENODEV;
    }

    // Always ready to write
    if (1 == 1) {
        ssize_t nwrites = le16_to_cpu(pRequest->QMIHdr.Length) + 1 - sizeof(QCQMI_HDR);
        ret = write(fd, &pRequest->MUXMsg, nwrites);
        if (ret == nwrites) {
            ret = 0;
        } else {
            dbg_time("%s write=%d, errno: %d (%s)", __func__, ret, errno, strerror(errno));
        }
    } else {
        dbg_time("%s poll=%d, errno: %d (%s)", __func__, ret, errno, strerror(errno));
    }

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
movl %eax, %ecx
leaq 0x303f3(%rip), %rax     # 0x37520
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
andl $0xff, %eax
cmpl $0x0, %eax
je 0x714d
movl -0x18(%rbp), %eax
andl $0xff, %eax
movl %eax, -0x24(%rbp)
jmp 0x7158
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x5(%rax)
cmpl $0x0, -0x18(%rbp)
jg 0x71fb
jmp 0x7170
movq 0x2fe69(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x13930
movq -0x30(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %r8d
leaq 0x24232(%rip), %rsi     # 0x2b3cc
leaq 0x24250(%rip), %rcx     # 0x2b3f1
movb $0x0, %al
callq 0x52c0
leaq 0x30cb9(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x71ed
leaq 0x30cac(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x13930
movq -0x38(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %r8d
leaq 0x241ed(%rip), %rsi     # 0x2b3cc
leaq 0x2420b(%rip), %rcx     # 0x2b3f1
movb $0x0, %al
callq 0x52c0
jmp 0x71ef
movl $0xffffffed, -0x4(%rbp) # imm = 0xFFFFFFED
jmp 0x7316
movq -0x10(%rbp), %rax
movzwl 0x1(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
addl $0x1, %eax
cltq
subq $0x6, %rax
movq %rax, -0x20(%rbp)
movl -0x18(%rbp), %edi
movq -0x10(%rbp), %rsi
addq $0x6, %rsi
movq -0x20(%rbp), %rdx
callq 0x5100
movl %eax, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x7245
movl $0x0, -0x14(%rbp)
jmp 0x7310
jmp 0x7247
movq 0x2fd92(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x50(%rbp)
callq 0x13930
movq %rax, -0x48(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x40(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rdx
movl -0x40(%rbp), %r8d
movl -0x3c(%rbp), %r9d
leaq 0x23e69(%rip), %rsi     # 0x2b0fa
leaq 0x24159(%rip), %rcx     # 0x2b3f1
movq %rax, (%rsp)
movb $0x0, %al
callq 0x52c0
leaq 0x30bbe(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x730c
leaq 0x30bb1(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x13930
movq %rax, -0x60(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x58(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x54(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rdx
movl -0x58(%rbp), %r8d
movl -0x54(%rbp), %r9d
leaq 0x23e00(%rip), %rsi     # 0x2b0fa
leaq 0x240f0(%rip), %rcx     # 0x2b3f1
movq %rax, (%rsp)
movb $0x0, %al
callq 0x52c0
jmp 0x730e
jmp 0x7310
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop