// File: /workspace/github_c_makefile_star2_O2/Carton32[P]quectel-CM/mbim-cm.c
// Function: mbim_proxy_configure
int mbim_proxy_configure(const char *dev) {
    MBIM_MESSAGE_HEADER *pRequest = NULL;
    MBIM_COMMAND_DONE_T *pCmdDone = NULL;
    MBIM_LIBQMI_PROXY_CONFIG_T *cfg;
    int err;

    pRequest = compose_basic_connect_command(
                                                    MBIM_CID_PROXY_CONTROL_CONFIGURATION,
                                                    MBIM_CID_CMD_TYPE_SET,
                                                    NULL,
                                                    sizeof(*cfg) + strlen(dev)*2);
    if (pRequest) {
        memcpy(((MBIM_COMMAND_MSG_T *)pRequest)->DeviceServiceId.uuid, str2uuid(UUID_LIBMBIM_PROXY), 16);
        cfg = (MBIM_LIBQMI_PROXY_CONFIG_T *)((MBIM_COMMAND_MSG_T *)pRequest)->InformationBuffer;

        cfg->DevicePathOffset = sizeof(*cfg);
        cfg->DevicePathSize = char2wchar(dev, strlen(dev), cfg->DataBuffer, strlen(dev)*2);
        cfg->Timeout = 15;
    }

    err = mbim_send_command(pRequest, &pCmdDone, mbim_default_timeout);
    mbim_check_err(err, pRequest, pCmdDone);

    mbim_free(pRequest); mbim_free(pCmdDone);
    return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
andq $0x0, 0x10(%rsp)
callq 0x5160
leal 0xc(,%rax,2), %ecx
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x1022b
movq %rax, %r14
testq %rax, %rax
je 0x10119
leaq 0xf2a6(%rip), %rdi      # 0x1f37c
callq 0x102de
movups 0x1ac52(%rip), %xmm0    # 0x2ad34
movups %xmm0, 0x14(%r14)
movl $0xc, 0x30(%r14)
movq %rbx, %rdi
callq 0x5160
movq %r14, %rdx
addq $0x3c, %rdx
leaq (%rax,%rax), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x103c0
movl %eax, 0x34(%r14)
movl $0xf, 0x38(%r14)
leaq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x103ea
movl %eax, %ebx
movq (%r15), %r15
movq %r15, %rdi
callq 0x1055f
movl %eax, %ebp
testq %r15, %r15
je 0x10161
testl %ebx, %ebx
jne 0x10161
testl %ebp, %ebp
jne 0x10161
movq %r14, %rdi
callq 0x5040
movq %r15, %rdi
callq 0x5040
xorl %eax, %eax
jmp 0x10220
testq %r15, %r15
je 0x10182
xorl %esi, %esi
cmpl $0x0, 0x1abc1(%rip)     # 0x2ad30
sete %sil
movq %r15, %rdi
callq 0x10583
movq 0x10(%rsp), %r15
jmp 0x10185
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x5040
testq %r15, %r15
je 0x101a0
movq %r15, %rdi
callq 0x5040
andq $0x0, 0x10(%rsp)
movq 0x18e11(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movl %ebp, (%rsp)
leaq 0xf1e8(%rip), %rsi      # 0x1f3a1
leaq 0xf1ff(%rip), %rcx      # 0x1f3bf
movq %r14, %rdi
movq %rax, %rdx
movl $0x875, %r8d            # imm = 0x875
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x19acb(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x10211
callq 0xe343
movl %ebp, (%rsp)
leaq 0xf1ad(%rip), %rsi      # 0x1f3a1
leaq 0xf1c4(%rip), %rcx      # 0x1f3bf
movq %r14, %rdi
movq %rax, %rdx
movl $0x875, %r8d            # imm = 0x875
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
testl %ebp, %ebp
movl $0x22b8, %eax           # imm = 0x22B8
cmovnel %ebp, %eax
testl %ebx, %ebx
cmovnel %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq