// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/qmap_bridge_mode.c
// Function: ql_qmap_mode_detect
int ql_qmap_mode_detect(PROFILE_T *profile) {
    if (profile->software_interface == SOFTWARE_MBIM) {
        if (profile->hardware_interface == HARDWARE_USB)
            return ql_mbim_usb_vlan_mode_detect(profile);
        else if (profile->hardware_interface == HARDWARE_PCIE)
            return ql_mbim_mhi_qmap_mode_detect(profile);
    } else if (profile->software_interface == SOFTWARE_QMI) {
        return ql_qmi_qmap_mode_detect(profile);
    }
#ifdef CONFIG_QRTR
    else if(profile->software_interface == SOFTWARE_QRTR) {
        char tmp[128];

        profile->qmap_mode = 4;
        profile->qmap_version = WDA_DL_DATA_AGG_QMAP_V5_ENABLED;
        profile->qmap_size = 31*1024;
        profile->muxid = 0x80 | profile->pdp;
        snprintf(profile->qmapnet_adapter, sizeof(profile->qmapnet_adapter), "rmnet_data%d", profile->muxid&0xF);

        snprintf(tmp, sizeof(tmp), "/sys/class/net/%s", profile->qmapnet_adapter);
        if (access(tmp, F_OK)) {
            rtrmnet_ctl_create_vnd(profile->usbnet_adapter, profile->qmapnet_adapter,
                profile->muxid, profile->qmap_version, 11, 4096);
        }
    }
#endif
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
movl 0x1c1(%rdi), %eax
cmpl $0x1, %eax
je 0x10191
cmpl $0x2, %eax
jne 0x10966
movl 0x1bd(%rbx), %eax
cmpl $0x5, %eax
je 0x103c1
cmpl $0x6, %eax
jne 0x10966
leaq 0xaa(%rbx), %rcx
movl 0x48(%rbx), %r8d
leaq 0x10f65(%rip), %rdx     # 0x2109f
leaq 0x10(%rsp), %r14
movl $0x80, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
xorl %esi, %esi
callq 0x5450
testl %eax, %eax
jne 0x10966
movl $0x4, 0x10a(%rbx)
movl 0x48(%rbx), %eax
movl %eax, 0x11e(%rbx)
leaq 0xca(%rbx), %r14
leaq 0x1f(%rsp), %rsi
movl $0x20, %edx
movq %r14, %rdi
callq 0x5080
jmp 0x1043e
movl $0x3fc, %edi            # imm = 0x3FC
callq 0x5360
movq %rax, %r14
leaq 0x1fe(%rax), %r12
leaq 0xaa(%rbx), %r15
leaq 0x10f40(%rip), %rdx     # 0x210f3
movl $0x1fe, %esi            # imm = 0x1FE
movq %r12, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
movl $0x1fe, %edx            # imm = 0x1FE
movq %r12, %rdi
movq %r14, %rsi
callq 0x50d0
movslq %eax, %rcx
leaq (%r14,%rcx), %rdx
movb $0x0, (%r14,%rcx)
shlq $0x20, %rax
movabsq $0x200000000, %rcx      # imm = 0x200000000
addq %rax, %rcx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %rcx
cmpb $0x2f, (%rdx)
leaq -0x1(%rdx), %rdx
jne 0x101fc
leaq 0xea(%rbx), %r13
sarq $0x20, %rcx
movq %r14, %rsi
addq %rcx, %rsi
movl $0x20, %edx
movq %r13, %rdi
callq 0x5080
leaq 0x32e(%rbx), %rsi
movq %rbx, %rdi
callq 0xf5b9
cmpl $0x0, 0x32e(%rbx)
je 0x1026b
movl 0x33e(%rbx), %eax
movl %eax, 0x10a(%rbx)
testl %eax, %eax
je 0x10834
movl 0x11e(%rbx), %ecx
testl %ecx, %ecx
je 0x104b2
addl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
jmp 0x104b7
leaq 0x10ea1(%rip), %rdx     # 0x21113
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x1030c
callq 0x5070
movq %rax, %r12
cmpl $0x2, (%rax)
jne 0x1050d
leaq 0x10e82(%rip), %rdx     # 0x2112f
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x1030c
cmpl $0x2, (%r12)
jne 0x10382
leaq 0x10e71(%rip), %rdx     # 0x21153
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x1030c
cmpl $0x2, (%r12)
jne 0x10382
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x1059f
leaq 0x8a(%rbx), %rdi
leaq 0x10c67(%rip), %rsi     # 0x20f96
movl $0xc, %edx
callq 0x5090
testl %eax, %eax
jne 0x10834
movl 0x48(%rbx), %ecx
decl %ecx
leaq 0x10e4b(%rip), %rdx     # 0x21198
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x1063b
callq 0x5070
cmpl $0x2, (%rax)
je 0x10834
movq %rax, %r12
movq 0x19c37(%rip), %rax     # 0x29fc0
movq %r15, 0x8(%rsp)
movq (%rax), %r15
callq 0xeb2f
movq %rax, %r13
movl (%r12), %ebp
movl %ebp, %edi
callq 0x5530
leaq 0x10b45(%rip), %rsi     # 0x20ef0
movq %r15, %rdi
movq 0x8(%rsp), %r15
movq %r13, %rdx
movq %r14, %rcx
movl %ebp, %r8d
jmp 0x10548
leaq 0x32e(%rbx), %rsi
movq %rbx, %rdi
callq 0xf5b9
cmpl $0x0, 0x32e(%rbx)
je 0x10966
movl 0x33e(%rbx), %eax
movl %eax, 0x10a(%rbx)
testl %eax, %eax
je 0x10966
movl 0x48(%rbx), %ecx
leal -0x1(%rcx), %edx
xorl %esi, %esi
cmpl $0x1, %eax
cmovel %esi, %edx
movl %ecx, 0x11e(%rbx)
leaq 0xca(%rbx), %r14
movslq %edx, %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rsi
addq $0x34a, %rsi            # imm = 0x34A
movq %r14, %rdi
callq 0x50a0
movl 0x332(%rbx), %eax
movl 0x342(%rbx), %ecx
movl %eax, 0x10e(%rbx)
movl %ecx, 0x112(%rbx)
movq 0x19b7b(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
movl 0x10a(%rbx), %ecx
movl 0x11e(%rbx), %r8d
leaq 0x10c53(%rip), %rsi     # 0x210b4
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x1a830(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x10966
callq 0xeb2f
movl 0x10a(%rbx), %ecx
movl 0x11e(%rbx), %r8d
leaq 0x10c17(%rip), %rsi     # 0x210b4
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %r9
xorl %eax, %eax
callq 0x52c0
jmp 0x10966
movl 0x48(%rbx), %ecx
decl %ecx
xorl %edx, %edx
cmpl $0x1, %eax
cmovnel %ecx, %edx
movslq %edx, %rax
movzbl 0x3ca(%rbx,%rax), %ecx
movl %ecx, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
shlq $0x4, %rax
leaq (%rbx,%rax), %rsi
addq $0x34a, %rsi            # imm = 0x34A
movl $0x20, %edx
callq 0x5080
movl 0x332(%rbx), %eax
movl 0x342(%rbx), %ecx
movl %eax, 0x10e(%rbx)
movl %ecx, 0x112(%rbx)
jmp 0x10834
movq 0x19aac(%rip), %rax     # 0x29fc0
movq (%rax), %r13
callq 0xeb2f
movq %rax, %rbp
movq %r15, 0x8(%rsp)
movl (%r12), %r15d
movl %r15d, %edi
callq 0x5530
leaq 0x109b9(%rip), %rsi     # 0x20ef0
movq %r13, %rdi
movq %rbp, %rdx
movq %r14, %rcx
movl %r15d, %r8d
movq 0x8(%rsp), %r15
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x1a74f(%rip), %rax     # 0x2aca8
movq (%rax), %r13
testq %r13, %r13
je 0x10834
callq 0xeb2f
movq %rax, %r15
movl (%r12), %ebp
movl %ebp, %edi
callq 0x5530
leaq 0x10971(%rip), %rsi     # 0x20ef0
movq %r13, %rdi
movq %r15, %rdx
movq 0x8(%rsp), %r15
movq %r14, %rcx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
jmp 0x10834
leaq 0x10(%rsp), %rsi
movl $0x80, %edx
movq %r14, %rdi
callq 0xfc09
testl %eax, %eax
jle 0x10834
leaq 0x10(%rsp), %rdi
callq 0x54b0
movl %eax, 0x10a(%rbx)
cmpl $0x2, %eax
jl 0x1060b
cmpl $0x0, 0x11e(%rbx)
jne 0x105e3
movl 0x48(%rbx), %eax
subl $-0x80, %eax
movl %eax, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
movl 0x11e(%rbx), %r8d
addl $-0x80, %r8d
leaq 0x10b93(%rip), %rdx     # 0x2118f
movl $0x20, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
cmpl $0x1, 0x10a(%rbx)
jne 0x10834
movl $0x81, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
movl $0x20, %edx
movq %r15, %rsi
callq 0x5080
jmp 0x10834
leaq 0x10b6e(%rip), %rdx     # 0x211b0
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
leaq 0x10(%rsp), %rsi
movl $0x80, %edx
movq %r14, %rdi
callq 0xfc09
movq %rax, %r12
cmpl $0x5, %r12d
jl 0x10834
movq 0x19946(%rip), %rbp     # 0x29fc0
movq %r15, 0x8(%rsp)
movq (%rbp), %r15
callq 0xeb2f
leaq 0x10b3f(%rip), %rsi     # 0x211ce
movq %r15, %rdi
movq 0x8(%rsp), %r15
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x1a5fd(%rip), %rax     # 0x2aca8
movq (%rax), %r13
testq %r13, %r13
je 0x106cf
callq 0xeb2f
leaq 0x10b0f(%rip), %rsi     # 0x211ce
movq %r13, %rdi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
movq (%rbp), %r15
callq 0xeb2f
leaq 0x10b22(%rip), %rsi     # 0x21201
leaq 0x10b5f(%rip), %rcx     # 0x21245
movq %r15, %rdi
movq %rax, %rdx
movl $0xfc, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1a5a8(%rip), %rax     # 0x2aca8
movq (%rax), %r13
testq %r13, %r13
je 0x1072e
callq 0xeb2f
leaq 0x10aed(%rip), %rsi     # 0x21201
leaq 0x10b2a(%rip), %rcx     # 0x21245
movq %r13, %rdi
movq %rax, %rdx
movl $0xfc, %r8d
xorl %eax, %eax
callq 0x52c0
movl %r12d, %eax
movl $0xcccccccd, %ecx       # imm = 0xCCCCCCCD
imulq %rax, %rcx
shrq $0x22, %rcx
movl %ecx, 0x10a(%rbx)
cmpl $0xa, %r12d
jb 0x107ad
movl 0x11e(%rbx), %eax
testl %eax, %eax
movq 0x8(%rsp), %r15
je 0x107ea
leal (%rax,%rax,4), %ecx
addl $0xfffffd7d, %ecx       # imm = 0xFFFFFD7D
movslq %ecx, %rcx
movsbl 0x10(%rsp,%rcx), %ecx
shll $0x4, %ecx
leal (%rax,%rax,4), %eax
addl $0xfffffd7e, %eax       # imm = 0xFFFFFD7E
cltq
movsbl 0x10(%rsp,%rax), %eax
leal -0x330(%rcx,%rax), %edx
movl %edx, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
addl %eax, %ecx
addl $0xfffffc4f, %ecx       # imm = 0xFFFFFC4F
leaq 0x10a04(%rip), %rdx     # 0x211a7
movl $0x20, %esi
jmp 0x1082d
movsbl 0x12(%rsp), %eax
shll $0x4, %eax
movsbl 0x13(%rsp), %ecx
addl %ecx, %eax
addl $0xfffffcd0, %eax       # imm = 0xFFFFFCD0
movl %eax, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
leaq 0x109d2(%rip), %rdx     # 0x211a7
movl $0x20, %esi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x51c0
movq 0x8(%rsp), %r15
jmp 0x10834
movl 0x48(%rbx), %ecx
leal (%rcx,%rcx,4), %eax
addl $-0x3, %eax
cltq
movsbl 0x10(%rsp,%rax), %eax
shll $0x4, %eax
leal (%rcx,%rcx,4), %edx
addl $-0x2, %edx
movslq %edx, %rdx
movsbl 0x10(%rsp,%rdx), %edx
addl %edx, %eax
addl $0xfffffcd0, %eax       # imm = 0xFFFFFCD0
movl %eax, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
decl %ecx
leaq 0x1097f(%rip), %rdx     # 0x211a7
movl $0x20, %esi
xorl %eax, %eax
callq 0x51c0
cmpl $0x0, 0x10a(%rbx)
je 0x10956
cmpl $0x0, 0x10e(%rbx)
jne 0x108ab
movl $0x4000, 0x10e(%rbx)    # imm = 0x4000
leaq 0x10a02(%rip), %rdx     # 0x2125d
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
jne 0x108ab
leaq 0x90(%rsp), %rsi
movl $0x20, %edx
movq %r14, %rdi
callq 0xfc09
testq %rax, %rax
je 0x108ab
leaq 0x90(%rsp), %rdi
callq 0x54b0
movl %eax, 0x10e(%rbx)
cmpl $0x0, 0x112(%rbx)
jne 0x108be
movl $0x5, 0x112(%rbx)
movq 0x196fb(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
movl 0x112(%rbx), %r8d
movl 0x10a(%rbx), %ecx
movl 0x10e(%rbx), %r9d
movl 0x11e(%rbx), %r10d
leaq 0xca(%rbx), %r12
leaq 0x10983(%rip), %rsi     # 0x21279
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x52c0
addq $0x10, %rsp
leaq 0x1a396(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x10956
callq 0xeb2f
movl 0x112(%rbx), %r8d
movl 0x10a(%rbx), %ecx
movl 0x10e(%rbx), %r9d
movl 0x11e(%rbx), %r10d
leaq 0x10938(%rip), %rsi     # 0x21279
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x52c0
addq $0x10, %rsp
movq %rbx, %rdi
callq 0x1006b
movq %r14, %rdi
callq 0x5040
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop