// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/mbim-cm.c
// Function: mbim_device_caps_query
static int mbim_device_caps_query(PROFILE_T *profile) {
    MBIM_MESSAGE_HEADER *pRequest = NULL;
    MBIM_COMMAND_DONE_T *pCmdDone = NULL;
    int err;

    mbim_debug("%s()", __func__);
    pRequest = compose_basic_connect_command(MBIM_CID_DEVICE_CAPS, MBIM_CID_CMD_TYPE_QUERY, NULL, 0);
    err = mbim_send_command(pRequest, &pCmdDone, mbim_default_timeout);
    mbim_check_err(err, pRequest, pCmdDone);

    if (le32toh(pCmdDone->InformationBufferLength)) {
         MBIM_DEVICE_CAPS_INFO_T *pInfo = (MBIM_DEVICE_CAPS_INFO_T *)pCmdDone->InformationBuffer;
         char tmp[32];

         if (le32toh(pInfo->DeviceIdOffset) && le32toh(pInfo->DeviceIdSize)) {
            wchar2char((const char *)pInfo + le32toh(pInfo->DeviceIdOffset), le32toh(pInfo->DeviceIdSize), tmp, sizeof(tmp));
            mbim_debug("DeviceId:     %s", tmp);
         }
         if (le32toh(pInfo->FirmwareInfoOffset) && le32toh(pInfo->FirmwareInfoSize)) {
            wchar2char((const char *)pInfo + le32toh(pInfo->FirmwareInfoOffset), le32toh(pInfo->FirmwareInfoSize), tmp, sizeof(tmp));
            strncpy(profile->BaseBandVersion, tmp, sizeof(profile->BaseBandVersion));
            mbim_debug("FirmwareInfo: %s", tmp);
         }
         if (le32toh(pInfo->HardwareInfoOffset) && le32toh(pInfo->HardwareInfoSize)) {
            wchar2char((const char *)pInfo + le32toh(pInfo->HardwareInfoOffset), le32toh(pInfo->HardwareInfoSize), tmp, sizeof(tmp));
            mbim_debug("HardwareInfo: %s", tmp);
         }
    }
    mbim_free(pRequest); mbim_free(pCmdDone);
    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq 0x1b7ea(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x58(%rbp)
callq 0x13930
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0x13c7e(%rip), %rsi     # 0x2f48e
leaq 0x13c93(%rip), %rcx     # 0x2f4aa
movb $0x0, %al
callq 0x52c0
leaq 0x1c643(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1b85a
leaq 0x1c636(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x13930
movq -0x60(%rbp), %rdi
movq %rax, %rdx
leaq 0x13c42(%rip), %rsi     # 0x2f48e
leaq 0x13c57(%rip), %rcx     # 0x2f4aa
movb $0x0, %al
callq 0x52c0
jmp 0x1b85c
movl $0x1, %edi
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %edx
movl %ecx, %esi
callq 0x16eb0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl 0x1bba4(%rip), %edx     # 0x37420
leaq -0x20(%rbp), %rsi
callq 0x17270
movl %eax, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1b899
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x1b8a1
xorl %eax, %eax
movq %rax, -0x68(%rbp)
jmp 0x1b8a1
movq -0x68(%rbp), %rdi
callq 0x17480
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x1b8c4
cmpl $0x0, -0x28(%rbp)
jne 0x1b8c4
cmpq $0x0, -0x20(%rbp)
jne 0x1b9d8
cmpq $0x0, -0x20(%rbp)
je 0x1b8e3
movq -0x20(%rbp), %rdi
cmpl $0x0, 0x1d61a(%rip)     # 0x38ef0
sete %al
andb $0x1, %al
movzbl %al, %esi
callq 0x17560
jmp 0x1b8e5
cmpq $0x0, -0x18(%rbp)
je 0x1b8fd
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x1b8ff
jmp 0x1b901
cmpq $0x0, -0x20(%rbp)
je 0x1b919
movq -0x20(%rbp), %rdi
callq 0x5040
movq $0x0, -0x20(%rbp)
jmp 0x1b91b
jmp 0x1b91d
movq 0x1b6bc(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x70(%rbp)
callq 0x13930
movq -0x70(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r9d
movl -0x28(%rbp), %eax
leaq 0x12ca8(%rip), %rsi     # 0x2e5ed
leaq 0x13b5e(%rip), %rcx     # 0x2f4aa
movl $0x721, %r8d            # imm = 0x721
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
leaq 0x1c505(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1b9a8
leaq 0x1c4f8(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x13930
movq -0x78(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r9d
movl -0x28(%rbp), %eax
leaq 0x12c5c(%rip), %rsi     # 0x2e5ed
leaq 0x13b12(%rip), %rcx     # 0x2f4aa
movl $0x721, %r8d            # imm = 0x721
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
jmp 0x1b9aa
cmpl $0x0, -0x24(%rbp)
je 0x1b9bb
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1bd1e
cmpl $0x0, -0x28(%rbp)
je 0x1b9cc
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1bd1e
movl $0x22b8, -0x4(%rbp)     # imm = 0x22B8
jmp 0x1bd1e
jmp 0x1b9da
movq -0x20(%rbp), %rax
movl 0x2c(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1bce0
movq -0x20(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl 0x28(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1bae5
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1bae5
movq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movl 0x28(%rax), %edi
callq 0x191c0
movl %eax, %ecx
movq -0x88(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %edi
callq 0x191c0
movq -0x80(%rbp), %rdi
movl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdx
movl $0x20, %ecx
callq 0x1c840
movq 0x1b569(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x90(%rbp)
callq 0x13930
movq -0x90(%rbp), %rdi
movq %rax, %rdx
leaq -0x50(%rbp), %rcx
leaq 0x13a26(%rip), %rsi     # 0x2f4c1
movb $0x0, %al
callq 0x52c0
leaq 0x1c3bf(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1bae1
leaq 0x1c3b2(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x98(%rbp)
callq 0x13930
movq -0x98(%rbp), %rdi
movq %rax, %rdx
leaq -0x50(%rbp), %rcx
leaq 0x139e7(%rip), %rsi     # 0x2f4c1
movb $0x0, %al
callq 0x52c0
jmp 0x1bae3
jmp 0x1bae5
movq -0x30(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1bbee
movq -0x30(%rbp), %rax
movl 0x34(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1bbee
movq -0x30(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x30(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x191c0
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rax
movl 0x34(%rax), %edi
callq 0x191c0
movq -0xa0(%rbp), %rdi
movl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdx
movl $0x20, %ecx
callq 0x1c840
movq -0x10(%rbp), %rdi
addq $0x216, %rdi            # imm = 0x216
leaq -0x50(%rbp), %rsi
movl $0x40, %edx
callq 0x5080
movq 0x1b460(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
callq 0x13930
movq -0xb0(%rbp), %rdi
movq %rax, %rdx
leaq -0x50(%rbp), %rcx
leaq 0x13934(%rip), %rsi     # 0x2f4d8
movb $0x0, %al
callq 0x52c0
leaq 0x1c2b6(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1bbea
leaq 0x1c2a9(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
callq 0x13930
movq -0xb8(%rbp), %rdi
movq %rax, %rdx
leaq -0x50(%rbp), %rcx
leaq 0x138f5(%rip), %rsi     # 0x2f4d8
movb $0x0, %al
callq 0x52c0
jmp 0x1bbec
jmp 0x1bbee
movq -0x30(%rbp), %rax
movl 0x38(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1bcde
movq -0x30(%rbp), %rax
movl 0x3c(%rax), %edi
callq 0x191c0
cmpl $0x0, %eax
je 0x1bcde
movq -0x30(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x30(%rbp), %rax
movl 0x38(%rax), %edi
callq 0x191c0
movl %eax, %ecx
movq -0xc8(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x30(%rbp), %rax
movl 0x3c(%rax), %edi
callq 0x191c0
movq -0xc0(%rbp), %rdi
movl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdx
movl $0x20, %ecx
callq 0x1c840
movq 0x1b370(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
callq 0x13930
movq -0xd0(%rbp), %rdi
movq %rax, %rdx
leaq -0x50(%rbp), %rcx
leaq 0x1385b(%rip), %rsi     # 0x2f4ef
movb $0x0, %al
callq 0x52c0
leaq 0x1c1c6(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1bcda
leaq 0x1c1b9(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
callq 0x13930
movq -0xd8(%rbp), %rdi
movq %rax, %rdx
leaq -0x50(%rbp), %rcx
leaq 0x1381c(%rip), %rsi     # 0x2f4ef
movb $0x0, %al
callq 0x52c0
jmp 0x1bcdc
jmp 0x1bcde
jmp 0x1bce0
jmp 0x1bce2
cmpq $0x0, -0x18(%rbp)
je 0x1bcfa
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x1bcfc
jmp 0x1bcfe
cmpq $0x0, -0x20(%rbp)
je 0x1bd16
movq -0x20(%rbp), %rdi
callq 0x5040
movq $0x0, -0x20(%rbp)
jmp 0x1bd18
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)