// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5160
shlq %rax
addq $0xc, %rax
movl %eax, %ecx
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
movl %esi, %edi
callq 0x16eb0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x16d02
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x1794c(%rip), %rdi     # 0x2e5c8
callq 0x17000
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, 0x14(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x1c(%rax)
movq -0x18(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0xc, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5160
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5160
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %rax, %rcx
shlq %rcx
callq 0x171e0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movl $0xf, 0x8(%rax)
movq -0x18(%rbp), %rdi
movl 0x20714(%rip), %edx     # 0x37420
leaq -0x20(%rbp), %rsi
callq 0x17270
movl %eax, -0x2c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x16d29
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x16d31
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x16d31
movq -0x58(%rbp), %rdi
callq 0x17480
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x16d54
cmpl $0x0, -0x30(%rbp)
jne 0x16d54
cmpq $0x0, -0x20(%rbp)
jne 0x16e5f
cmpq $0x0, -0x20(%rbp)
je 0x16d73
movq -0x20(%rbp), %rdi
cmpl $0x0, 0x2218a(%rip)     # 0x38ef0
sete %al
andb $0x1, %al
movzbl %al, %esi
callq 0x17560
jmp 0x16d75
cmpq $0x0, -0x18(%rbp)
je 0x16d8d
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x16d8f
jmp 0x16d91
cmpq $0x0, -0x20(%rbp)
je 0x16da9
movq -0x20(%rbp), %rdi
callq 0x5040
movq $0x0, -0x20(%rbp)
jmp 0x16dab
jmp 0x16dad
movq 0x2022c(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x13930
movq -0x60(%rbp), %rdi
movq %rax, %rdx
movl -0x2c(%rbp), %r9d
movl -0x30(%rbp), %eax
leaq 0x17818(%rip), %rsi     # 0x2e5ed
leaq 0x1782f(%rip), %rcx     # 0x2e60b
movl $0x875, %r8d            # imm = 0x875
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
leaq 0x21075(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x16e38
leaq 0x21068(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x13930
movq -0x68(%rbp), %rdi
movq %rax, %rdx
movl -0x2c(%rbp), %r9d
movl -0x30(%rbp), %eax
leaq 0x177cc(%rip), %rsi     # 0x2e5ed
leaq 0x177e3(%rip), %rcx     # 0x2e60b
movl $0x875, %r8d            # imm = 0x875
movl %eax, (%rsp)
movb $0x0, %al
callq 0x52c0
jmp 0x16e3a
cmpl $0x0, -0x2c(%rbp)
je 0x16e48
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x16e9f
cmpl $0x0, -0x30(%rbp)
je 0x16e56
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x16e9f
movl $0x22b8, -0x4(%rbp)     # imm = 0x22B8
jmp 0x16e9f
jmp 0x16e61
jmp 0x16e63
cmpq $0x0, -0x18(%rbp)
je 0x16e7b
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x16e7d
jmp 0x16e7f
cmpq $0x0, -0x20(%rbp)
je 0x16e97
movq -0x20(%rbp), %rdi
callq 0x5040
movq $0x0, -0x20(%rbp)
jmp 0x16e99
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)