// File: /workspace/github_c_makefile_star2_O2/Carton32[P]quectel-CM/mbim-cm.c
// Function: mbim_init
static int mbim_init(PROFILE_T *profile) {
    int retval;
    int t = 0;

    if (profile->proxy[0] && !strcmp(profile->proxy, LIBMBIM_PROXY)) {
        retval = mbim_proxy_configure(profile->qmichannel);
        if (retval) goto exit;
    }

    while (t++ < 10) {
        retval = mbim_open_device(4096);
        if (retval != ETIMEDOUT)
            break;
    }
    if (retval) goto exit;
    retval = mbim_device_caps_query(profile);
    if (retval) goto exit;
    mbim_update_state();
    retval = mbim_device_services_query();
    if (retval) goto exit;
    mbim_update_state();
    retval = mbim_set_radio_state(MBIMRadioOn);
    if (retval) goto exit;
    mbim_update_state();

    if (qmi_over_mbim_support) {
        if (!socketpair( AF_LOCAL, SOCK_STREAM, 0, qmi_over_mbim_sk)) {
            qmidev_send = qmi_over_mbim_qmidev_send;
#ifdef CONFIG_CELLINFO //by now, only this function need QMI OVER MBIM
            qmi_over_mbim_nas = qmi_over_mbim_get_client_id(QMUX_TYPE_NAS);
#endif
        }
    }

    return 0;

exit:
    return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, 0x18(%rsp)
cmpb $0x0, 0x28(%rdi)
je 0x10eca
movq 0x18(%rsp), %rax
leaq 0x28(%rax), %rdi
leaq 0xb668(%rip), %rsi      # 0x1c525
callq 0x52a0
testl %eax, %eax
je 0x11449
pushq $0xb
popq %r15
leaq 0xf36d(%rip), %r14      # 0x20242
leaq 0xf371(%rip), %r13      # 0x2024d
xorl %eax, %eax
movl %eax, %ebp
decl %r15d
je 0x1109f
andq $0x0, 0x20(%rsp)
movq 0x180c2(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x18d90(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x10f38
callq 0xe343
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x52c0
pushq $0x10
popq %rdi
callq 0x5360
movq %rax, %r13
testq %rax, %rax
je 0x10f71
movabsq $0x1000000001, %rax     # imm = 0x1000000001
movq %rax, (%r13)
movl 0x183ac(%rip), %eax     # 0x29308
leal 0x1(%rax), %ecx
movl %ecx, 0x183a3(%rip)     # 0x29308
movl %eax, 0x8(%r13)
movl $0x1000, 0xc(%r13)      # imm = 0x1000
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
movl $0xbb8, %edx            # imm = 0xBB8
callq 0x103ea
movl %eax, %ebx
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x1055f
movl %eax, %r12d
testq %r14, %r14
je 0x10fca
testl %ebx, %ebx
jne 0x10fca
testl %r12d, %r12d
jne 0x10fca
movl 0xc(%r14), %ebp
movq %r13, %rdi
callq 0x5040
movq %r14, %rdi
callq 0x5040
leaq 0xf284(%rip), %r14      # 0x20242
leaq 0xf288(%rip), %r13      # 0x2024d
jmp 0x11093
testq %r14, %r14
leaq 0xe3cd(%rip), %rbp      # 0x1f3a1
je 0x10ff2
xorl %esi, %esi
cmpl $0x0, 0x19d51(%rip)     # 0x2ad30
sete %sil
movq %r14, %rdi
callq 0x10583
movq 0x20(%rsp), %r14
jmp 0x10ff5
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x5040
testq %r14, %r14
je 0x11010
movq %r14, %rdi
callq 0x5040
andq $0x0, 0x20(%rsp)
movq 0x17fa1(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movl %r12d, (%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
leaq 0xf21a(%rip), %r13      # 0x2024d
movq %r13, %rcx
movl $0x69f, %r8d            # imm = 0x69F
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x18c5b(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x1107a
callq 0xe343
movl %r12d, (%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
movq %r13, %rcx
movl $0x69f, %r8d            # imm = 0x69F
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
movl $0x22b8, %ebp           # imm = 0x22B8
testl %r12d, %r12d
je 0x11087
movl %r12d, %ebp
testl %ebx, %ebx
cmovnel %ebx, %ebp
leaq 0xf1af(%rip), %r14      # 0x20242
pushq $0x6e
popq %rax
cmpl $0x6e, %ebp
je 0x10ede
testl %ebp, %ebp
jne 0x119c5
andq $0x0, 0x10(%rsp)
movq 0x17f04(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0xf17f(%rip), %rsi      # 0x20242
leaq 0xf194(%rip), %rcx      # 0x2025e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x18bca(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x11106
callq 0xe343
leaq 0xf150(%rip), %rsi      # 0x20242
leaq 0xf165(%rip), %rcx      # 0x2025e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
pushq $0x1
popq %rbp
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1022b
movq %rax, %r14
leaq 0x10(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x103ea
movl %eax, %r12d
movq (%rbx), %r15
movq %r15, %rdi
callq 0x1055f
movl %eax, %ebx
testq %r15, %r15
je 0x11469
testl %r12d, %r12d
jne 0x11469
testl %ebx, %ebx
jne 0x11469
cmpl $0x0, 0x2c(%r15)
je 0x112e9
leaq 0x30(%r15), %r12
movl 0x58(%r15), %edi
testq %rdi, %rdi
je 0x111dc
movl 0x5c(%r15), %esi
testq %rsi, %rsi
je 0x111dc
addq %r12, %rdi
leaq 0x20(%rsp), %rbx
movq %rbx, %rdx
callq 0x14f9d
movq 0x17e28(%rip), %rax     # 0x28fb8
movq (%rax), %r13
callq 0xe343
leaq 0xf0d6(%rip), %rsi      # 0x20275
movq %r13, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x18af2(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x111dc
callq 0xe343
leaq 0xf0ab(%rip), %rsi      # 0x20275
leaq 0x20(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movl 0x60(%r15), %edi
testq %rdi, %rdi
je 0x1126c
movl 0x64(%r15), %esi
testq %rsi, %rsi
je 0x1126c
addq %r12, %rdi
leaq 0x20(%rsp), %rbx
movq %rbx, %rdx
callq 0x14f9d
movq 0x18(%rsp), %rdi
addq $0x216, %rdi            # imm = 0x216
pushq $0x40
popq %rdx
movq %rbx, %rsi
callq 0x5080
movq 0x17d98(%rip), %rax     # 0x28fb8
movq (%rax), %r13
callq 0xe343
leaq 0xf05d(%rip), %rsi      # 0x2028c
movq %r13, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x18a62(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x1126c
callq 0xe343
leaq 0xf032(%rip), %rsi      # 0x2028c
leaq 0x20(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movl 0x68(%r15), %eax
testq %rax, %rax
je 0x112e4
movl 0x6c(%r15), %esi
testq %rsi, %rsi
je 0x112e4
addq %rax, %r12
leaq 0x20(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x14f9d
movq 0x17d20(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
leaq 0xeffc(%rip), %rsi      # 0x202a3
movq %r15, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x189ea(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x112e4
callq 0xe343
leaq 0xefd1(%rip), %rsi      # 0x202a3
leaq 0x20(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movq 0x10(%rsp), %r15
movq %r14, %rdi
callq 0x5040
movq %r15, %rdi
callq 0x5040
callq 0x14cde
andq $0x0, 0x10(%rsp)
movq 0x17cad(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0xef28(%rip), %rsi      # 0x20242
leaq 0xf01f(%rip), %rcx      # 0x20340
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x18973(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x1135d
callq 0xe343
leaq 0xeef9(%rip), %rsi      # 0x20242
leaq 0xeff0(%rip), %rcx      # 0x20340
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
pushq $0x10
popq %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1022b
movq %rax, %r13
leaq 0x10(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x103ea
movl %eax, %r15d
movq (%rbx), %r14
movq %r14, %rdi
callq 0x1055f
movl %eax, %r12d
testq %r14, %r14
je 0x1148a
testl %r15d, %r15d
jne 0x1148a
testl %r12d, %r12d
jne 0x1148a
cmpl $0x0, 0x2c(%r14)
je 0x11569
movq %r13, 0x48(%rsp)
movq %r14, 0x18(%rsp)
leaq 0x30(%r14), %r13
xorl %r15d, %r15d
leaq 0x199ee(%rip), %r14     # 0x2adc0
xorl %r12d, %r12d
movl (%r13), %eax
cmpq %rax, %r15
jae 0x11557
movq 0x18(%rsp), %rax
movl 0x38(%rax,%r15,8), %ebx
addq %r13, %rbx
movq %rbx, %rdi
callq 0x14a68
leaq 0xe0e8(%rip), %rdi      # 0x1f4e6
movq %r14, %rsi
callq 0x5050
testl %eax, %eax
je 0x11431
movq %rbx, %rdi
callq 0x14a68
leaq 0xe8ab(%rip), %rdi      # 0x1fcc4
movq %r14, %rsi
callq 0x5050
testl %eax, %eax
jne 0x1142c
movb $0x1, 0x19ac4(%rip)     # 0x2aef0
incq %r15
jmp 0x113d5
movl 0x18(%rbx), %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x1142c
cmpl $0xf, 0x1c(%rbx,%rcx,4)
cmovel %ebp, %r12d
incq %rcx
jmp 0x11436
movq 0x18(%rsp), %rax
leaq 0x8a(%rax), %rdi
callq 0x1009c
movl %eax, %ebp
testl %eax, %eax
jne 0x119c5
jmp 0x10eca
testq %r15, %r15
je 0x114b2
xorl %esi, %esi
cmpl $0x0, 0x198b9(%rip)     # 0x2ad30
sete %sil
movq %r15, %rdi
callq 0x10583
movq 0x10(%rsp), %r15
jmp 0x114b5
testq %r14, %r14
je 0x1161e
xorl %esi, %esi
cmpl $0x0, 0x19894(%rip)     # 0x2ad30
sete %sil
movq %r14, %rdi
callq 0x10583
movq 0x10(%rsp), %rbx
jmp 0x11620
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x5040
testq %r15, %r15
je 0x114d0
movq %r15, %rdi
callq 0x5040
andq $0x0, 0x10(%rsp)
movq 0x17ae1(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movl %ebx, (%rsp)
leaq 0xdeb8(%rip), %rsi      # 0x1f3a1
leaq 0xed6e(%rip), %rcx      # 0x2025e
movq %r14, %rdi
movq %rax, %rdx
movl $0x721, %r8d            # imm = 0x721
movl %r12d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1879b(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x11541
callq 0xe343
movl %ebx, (%rsp)
leaq 0xde7d(%rip), %rsi      # 0x1f3a1
leaq 0xed33(%rip), %rcx      # 0x2025e
movq %r14, %rdi
movq %rax, %rdx
movl $0x721, %r8d            # imm = 0x721
movl %r12d, %r9d
xorl %eax, %eax
callq 0x52c0
testl %ebx, %ebx
movl $0x22b8, %ebp           # imm = 0x22B8
cmovnel %ebx, %ebp
testl %r12d, %r12d
cmovnel %r12d, %ebp
jmp 0x119c5
testl %r12d, %r12d
sete %bl
movq 0x10(%rsp), %r14
movq 0x48(%rsp), %r13
jmp 0x1156b
movb $0x1, %bl
movq %r13, %rdi
callq 0x5040
testq %r14, %r14
je 0x11586
movq %r14, %rdi
callq 0x5040
andq $0x0, 0x10(%rsp)
testb %bl, %bl
jne 0x11776
andq $0x0, 0x20(%rsp)
leaq 0x54(%rsp), %rdx
movl $0x2000100, (%rdx)      # imm = 0x2000100
pushq $0xf
popq %rdi
pushq $0x4
popq %rcx
xorl %esi, %esi
callq 0x1022b
movq %rax, %r14
testq %rax, %rax
je 0x115cc
leaq 0xdf2b(%rip), %rdi      # 0x1f4e6
callq 0x102de
movups 0x1976d(%rip), %xmm0    # 0x2ad34
movups %xmm0, 0x14(%r14)
leaq 0x20(%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 0x116c6
testl %ebx, %ebx
jne 0x116c6
testl %ebp, %ebp
jne 0x116c6
movq %r14, %rdi
callq 0x5040
movq %r15, %rdi
callq 0x5040
jmp 0x11776
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x5040
testq %rbx, %rbx
je 0x1163b
movq %rbx, %rdi
callq 0x5040
andq $0x0, 0x10(%rsp)
movq 0x17976(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
movl %r12d, (%rsp)
leaq 0xdd4c(%rip), %rsi      # 0x1f3a1
leaq 0xece4(%rip), %rcx      # 0x20340
movq %rbx, %rdi
movq %rax, %rdx
movl $0x6f6, %r8d            # imm = 0x6F6
movl %r15d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1862f(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x116ae
callq 0xe343
movl %r12d, (%rsp)
leaq 0xdd10(%rip), %rsi      # 0x1f3a1
leaq 0xeca8(%rip), %rcx      # 0x20340
movq %rbx, %rdi
movq %rax, %rdx
movl $0x6f6, %r8d            # imm = 0x6F6
movl %r15d, %r9d
xorl %eax, %eax
callq 0x52c0
testl %r12d, %r12d
movl $0x22b8, %ebp           # imm = 0x22B8
cmovnel %r12d, %ebp
testl %r15d, %r15d
cmovnel %r15d, %ebp
jmp 0x119c5
testq %r15, %r15
je 0x116e7
xorl %esi, %esi
cmpl $0x0, 0x1965c(%rip)     # 0x2ad30
sete %sil
movq %r15, %rdi
callq 0x10583
movq 0x20(%rsp), %r15
jmp 0x116ea
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x5040
testq %r15, %r15
je 0x11705
movq %r15, %rdi
callq 0x5040
andq $0x0, 0x20(%rsp)
movq 0x178ac(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movl %ebp, (%rsp)
leaq 0xdc83(%rip), %rsi      # 0x1f3a1
leaq 0xec36(%rip), %rcx      # 0x2035b
movq %r14, %rdi
movq %rax, %rdx
movl $0x6e1, %r8d            # imm = 0x6E1
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x18566(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x11776
callq 0xe343
movl %ebp, (%rsp)
leaq 0xdc48(%rip), %rsi      # 0x1f3a1
leaq 0xebfb(%rip), %rcx      # 0x2035b
movq %r14, %rdi
movq %rax, %rdx
movl $0x6e1, %r8d            # imm = 0x6E1
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
callq 0x14cde
andq $0x0, 0x20(%rsp)
movl $0x1, 0x10(%rsp)
movq 0x17828(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0xebd2(%rip), %rsi      # 0x20371
leaq 0xebda(%rip), %rcx      # 0x20380
pushq $0x1
popq %r8
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x184ea(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x117ea
callq 0xe343
leaq 0xeb9f(%rip), %rsi      # 0x20371
leaq 0xeba7(%rip), %rcx      # 0x20380
pushq $0x1
popq %r8
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
pushq $0x3
popq %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
pushq $0x4
popq %rcx
callq 0x1022b
movq %rax, %r14
leaq 0x20(%rsp), %r15
movq %rax, %rdi
movq %r15, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0x103ea
movl %eax, %ebx
movq (%r15), %r12
movq %r12, %rdi
callq 0x1055f
movl %eax, %r15d
testq %r12, %r12
je 0x11902
testl %ebx, %ebx
jne 0x11902
testl %r15d, %r15d
jne 0x11902
cmpl $0x0, 0x2c(%r12)
je 0x118ab
movq 0x1776a(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
movl 0x30(%r12), %ecx
movl 0x34(%r12), %r8d
leaq 0xeb2e(%rip), %rsi      # 0x20395
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x1842d(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x118a6
callq 0xe343
movl 0x30(%r12), %ecx
movl 0x34(%r12), %r8d
leaq 0xeafc(%rip), %rsi      # 0x20395
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movq 0x20(%rsp), %r12
movq %r14, %rdi
callq 0x5040
movq %r12, %rdi
callq 0x5040
callq 0x14cde
xorl %ebp, %ebp
cmpb $0x0, 0x19627(%rip)     # 0x2aef0
je 0x119c5
leaq 0x17a2a(%rip), %rcx     # 0x29300
pushq $0x1
popq %rdi
xorl %ebp, %ebp
movl %edi, %esi
xorl %edx, %edx
callq 0x5300
testl %eax, %eax
jne 0x119c5
leaq 0x25a6(%rip), %rax      # 0x13e99
leaq 0x1832e(%rip), %rcx     # 0x29c28
movq %rax, (%rcx)
jmp 0x119c5
testq %r12, %r12
je 0x11923
xorl %esi, %esi
cmpl $0x0, 0x19420(%rip)     # 0x2ad30
sete %sil
movq %r12, %rdi
callq 0x10583
movq 0x20(%rsp), %r12
jmp 0x11926
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x5040
testq %r12, %r12
je 0x11941
movq %r12, %rdi
callq 0x5040
andq $0x0, 0x20(%rsp)
movq 0x17670(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movl %r15d, (%rsp)
leaq 0xda46(%rip), %rsi      # 0x1f3a1
leaq 0xea1e(%rip), %rcx      # 0x20380
movq %r14, %rdi
movq %rax, %rdx
movl $0x756, %r8d            # imm = 0x756
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x18329(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x119b4
callq 0xe343
movl %r15d, (%rsp)
leaq 0xda0a(%rip), %rsi      # 0x1f3a1
leaq 0xe9e2(%rip), %rcx      # 0x20380
movq %r14, %rdi
movq %rax, %rdx
movl $0x756, %r8d            # imm = 0x756
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
testl %r15d, %r15d
movl $0x22b8, %ebp           # imm = 0x22B8
cmovnel %r15d, %ebp
testl %ebx, %ebx
cmovnel %ebx, %ebp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq