// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/mbim-cm.c
// Function: mbim_ms_version_query
static int mbim_ms_version_query(void) {
    MBIM_MESSAGE_HEADER *pRequest = NULL;
    MBIM_COMMAND_DONE_T *pCmdDone = NULL;
    int err;

    struct _bc_ext_version {
            UINT8 ver_minor;
            UINT8 ver_major;
            UINT8 ext_ver_minor;
            UINT8 ext_ver_major;
    } __attribute__ ((packed)) bc_ext_version;

    bc_ext_version.ver_major = 1;
    bc_ext_version.ver_minor = 0;
    bc_ext_version.ext_ver_major = 2;
    bc_ext_version.ext_ver_minor = 0;

    pRequest = compose_basic_connect_ext_command(MBIM_CID_MS_VERSION, MBIM_CID_CMD_TYPE_QUERY, &bc_ext_version, sizeof(bc_ext_version));
    err = mbim_send_command(pRequest, &pCmdDone, mbim_default_timeout);
    mbim_check_err(err, pRequest, pCmdDone);

    if (le32toh(pCmdDone->InformationBufferLength)) {
        struct _bc_ext_version *pInfo = (struct _bc_ext_version *)pCmdDone->InformationBuffer;
        //mbim_debug("%s ext_rel_ver major=%d, minor=%d", __func__, pInfo->ext_ver_major, pInfo->ext_ver_minor);
        mbim_ms_version = pInfo->ext_ver_major;
    }

    mbim_free(pRequest); mbim_free(pCmdDone);
    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movb $0x1, -0x1f(%rbp)
movb $0x0, -0x20(%rbp)
movb $0x2, -0x1d(%rbp)
movb $0x0, -0x1e(%rbp)
movl $0xf, %edi
xorl %esi, %esi
leaq -0x20(%rbp), %rdx
movl $0x4, %ecx
callq 0x1caf0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl 0x1ab05(%rip), %edx     # 0x37420
leaq -0x18(%rbp), %rsi
callq 0x17270
movl %eax, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1c938
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x1c940
xorl %eax, %eax
movq %rax, -0x38(%rbp)
jmp 0x1c940
movq -0x38(%rbp), %rdi
callq 0x17480
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1c963
cmpl $0x0, -0x24(%rbp)
jne 0x1c963
cmpq $0x0, -0x18(%rbp)
jne 0x1ca71
cmpq $0x0, -0x18(%rbp)
je 0x1c982
movq -0x18(%rbp), %rdi
cmpl $0x0, 0x1c57b(%rip)     # 0x38ef0
sete %al
andb $0x1, %al
movzbl %al, %esi
callq 0x17560
jmp 0x1c984
cmpq $0x0, -0x10(%rbp)
je 0x1c99c
movq -0x10(%rbp), %rdi
callq 0x5040
movq $0x0, -0x10(%rbp)
jmp 0x1c99e
jmp 0x1c9a0
cmpq $0x0, -0x18(%rbp)
je 0x1c9b8
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x1c9ba
jmp 0x1c9bc
movq 0x1a61d(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x13930
movq -0x40(%rbp), %rdi
movq %rax, %rdx
movl -0x1c(%rbp), %r9d
movl -0x24(%rbp), %eax
leaq 0x11c09(%rip), %rsi     # 0x2e5ed
leaq 0x12bbc(%rip), %rcx     # 0x2f5a7
movl $0x6e1, %r8d            # imm = 0x6E1
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
leaq 0x1b466(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1ca47
leaq 0x1b459(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x13930
movq -0x48(%rbp), %rdi
movq %rax, %rdx
movl -0x1c(%rbp), %r9d
movl -0x24(%rbp), %eax
leaq 0x11bbd(%rip), %rsi     # 0x2e5ed
leaq 0x12b70(%rip), %rcx     # 0x2f5a7
movl $0x6e1, %r8d            # imm = 0x6E1
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
jmp 0x1ca49
cmpl $0x0, -0x1c(%rbp)
je 0x1ca5a
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cadc
cmpl $0x0, -0x24(%rbp)
je 0x1ca68
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cadc
movl $0x22b8, -0x4(%rbp)     # imm = 0x22B8
jmp 0x1cadc
jmp 0x1ca73
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1ca9e
movq -0x18(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
movl %eax, 0x1a996(%rip)     # 0x37434
jmp 0x1caa0
cmpq $0x0, -0x10(%rbp)
je 0x1cab8
movq -0x10(%rbp), %rdi
callq 0x5040
movq $0x0, -0x10(%rbp)
jmp 0x1caba
jmp 0x1cabc
cmpq $0x0, -0x18(%rbp)
je 0x1cad4
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x1cad6
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)