// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq $0x0, 0x8(%rsp)
callq 0x5160
leal 0xc(,%rax,2), %ecx
xorl %r15d, %r15d
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x10a7b
testq %rax, %rax
je 0x10959
movq %rax, %r14
leaq 0x10ac5(%rip), %rdi     # 0x21360
callq 0x10b31
movups 0x1b48d(%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 0x108e9
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 0x108cd
addl %eax, %eax
movl %eax, %r15d
movl %r15d, 0x34(%r14)
movl $0xf, 0x38(%r14)
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x10c38
movl %eax, %ebx
movq (%r15), %r15
testq %r15, %r15
je 0x1098d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl (%r15), %eax
xorl %r12d, %r12d
cmpl $0x3, %eax
ja 0x10935
movl %eax, %eax
leaq 0x11f03(%rip), %rcx     # 0x22830
movq (%rcx,%rax,8), %rax
movl (%r15,%rax), %r12d
testl %ebx, %ebx
sete %bpl
movl %ebx, %eax
orl %r12d, %eax
jne 0x1099e
movq %r14, %rdi
callq 0x5040
movq %r15, %rdi
callq 0x5040
xorl %ebx, %ebx
jmp 0x10a6c
movq $0x0, 0x8(%rsp)
cmpl $0x0, 0x199a3(%rip)     # 0x2a30c
jle 0x109e2
cmpq $0x0, 0x1b3d5(%rip)     # 0x2bd48
movl $0xffffffea, %eax       # imm = 0xFFFFFFEA
movl $0xfffffff4, %ebx       # imm = 0xFFFFFFF4
cmovel %eax, %ebx
xorl %ebp, %ebp
movl $0x22b8, %r15d          # imm = 0x22B8
xorl %r12d, %r12d
jmp 0x109c8
testl %ebx, %ebx
sete %bpl
xorl %r12d, %r12d
movl $0x22b8, %r15d          # imm = 0x22B8
jmp 0x109c0
xorl %esi, %esi
cmpl $0x0, 0x1b389(%rip)     # 0x2bd30
sete %sil
movq %r15, %rdi
callq 0x10dbe
testl %r12d, %r12d
movl $0x22b8, %r15d          # imm = 0x22B8
cmovnel %r12d, %r15d
movq %r14, %rdi
callq 0x5040
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x109f2
callq 0x5040
movq $0x0, 0x8(%rsp)
jmp 0x109f2
movl $0x22b8, %r15d          # imm = 0x22B8
xorl %r12d, %r12d
movl $0xffffffed, %ebx       # imm = 0xFFFFFFED
xorl %ebp, %ebp
movq 0x195c7(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xea3b
movl %r12d, (%rsp)
leaq 0x10979(%rip), %rsi     # 0x21385
leaq 0x10990(%rip), %rcx     # 0x213a3
movq %r14, %rdi
movq %rax, %rdx
movl $0x875, %r8d            # imm = 0x875
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1a278(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x10a65
callq 0xea3b
movl %r12d, (%rsp)
leaq 0x1093d(%rip), %rsi     # 0x21385
leaq 0x10954(%rip), %rcx     # 0x213a3
movq %r14, %rdi
movq %rax, %rdx
movl $0x875, %r8d            # imm = 0x875
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
testb %bpl, %bpl
cmovnel %r15d, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq