// File: /workspace/github_c_makefile_star2_O1/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
movq $0x0, 0x10(%rsp)
callq 0x5160
leal 0xc(,%rax,2), %ecx
xorl %r15d, %r15d
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x10b66
movq %rax, %r14
testq %rax, %rax
je 0x10a1b
leaq 0x10977(%rip), %rdi     # 0x21338
callq 0x10c1b
movups 0x1b367(%rip), %xmm0    # 0x2bd34
movups %xmm0, 0x14(%r14)
movl $0xc, 0x30(%r14)
movq %rbx, %rdi
callq 0x5160
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
andq %rax, %rcx
je 0x10a0f
xorl %edx, %edx
movb (%rbx,%rdx), %sil
movb %sil, 0x3c(%r14,%rdx,2)
movb $0x0, 0x3d(%r14,%rdx,2)
incq %rdx
cmpq %rdx, %rcx
jne 0x109f3
addl %eax, %eax
movl %eax, %r15d
movl %r15d, 0x34(%r14)
movl $0xf, 0x38(%r14)
leaq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x10d09
movl %eax, %ebx
movq (%r15), %rdi
xorl %ebp, %ebp
testq %rdi, %rdi
je 0x10a58
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl (%rdi), %eax
cmpl $0x3, %eax
ja 0x10a58
movl %eax, %eax
leaq 0x11db7(%rip), %rcx     # 0x22808
movq (%rcx,%rax,8), %rax
movl (%rdi,%rax), %ebp
movl %ebx, %eax
orl %ebp, %eax
sete %al
testq %rdi, %rdi
setne %r15b
andb %al, %r15b
je 0x10a70
jmp 0x10b2f
testq %rdi, %rdi
je 0x10a87
xorl %esi, %esi
cmpl $0x0, 0x1b2b2(%rip)     # 0x2bd30
sete %sil
callq 0x10e8f
testq %r14, %r14
je 0x10a94
movq %r14, %rdi
callq 0x5040
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x10aac
callq 0x5040
movq $0x0, 0x10(%rsp)
movq 0x1950d(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movl %ebp, (%rsp)
leaq 0x10898(%rip), %rsi     # 0x2135d
leaq 0x108af(%rip), %rcx     # 0x2137b
movq %r14, %rdi
movq %rax, %rdx
movl $0x875, %r8d            # imm = 0x875
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1a1bf(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x10b1d
callq 0xeb2f
movl %ebp, (%rsp)
leaq 0x1085d(%rip), %rsi     # 0x2135d
leaq 0x10874(%rip), %rcx     # 0x2137b
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
xorl %r14d, %r14d
testb %r15b, %r15b
je 0x10b5b
testq %r14, %r14
je 0x10b41
movq %r14, %rdi
callq 0x5040
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x10b59
callq 0x5040
movq $0x0, 0x10(%rsp)
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq