// File: /workspace/github_c_makefile_star2_O3/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 0x10065
cmpl $0x2, %eax
jne 0x1083b
movl 0x1bd(%rbx), %eax
cmpl $0x5, %eax
je 0x10295
cmpl $0x6, %eax
jne 0x1083b
leaq 0xaa(%rbx), %rcx
movl 0x48(%rbx), %r8d
leaq 0x1108d(%rip), %rdx     # 0x2109b
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 0x1083b
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 0x10312
movl $0x3fc, %edi            # imm = 0x3FC
callq 0x5360
movq %rax, %r14
leaq 0x1fe(%rax), %r12
leaq 0xaa(%rbx), %r15
leaq 0x11068(%rip), %rdx     # 0x210ef
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 0x100d0
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 0xf4a7
cmpl $0x0, 0x32e(%rbx)
je 0x1013f
movl 0x33e(%rbx), %eax
movl %eax, 0x10a(%rbx)
testl %eax, %eax
je 0x10709
movl 0x11e(%rbx), %ecx
testl %ecx, %ecx
je 0x10386
addl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
jmp 0x1038b
leaq 0x10fc9(%rip), %rdx     # 0x2110f
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 0x101e0
callq 0x5070
movq %rax, %r12
cmpl $0x2, (%rax)
jne 0x103e1
leaq 0x10faa(%rip), %rdx     # 0x2112b
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 0x101e0
cmpl $0x2, (%r12)
jne 0x10256
leaq 0x10f99(%rip), %rdx     # 0x2114f
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 0x101e0
cmpl $0x2, (%r12)
jne 0x10256
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x10473
leaq 0x8a(%rbx), %rdi
leaq 0x10d8f(%rip), %rsi     # 0x20f92
movl $0xc, %edx
callq 0x5090
testl %eax, %eax
jne 0x10709
movl 0x48(%rbx), %ecx
decl %ecx
leaq 0x10f73(%rip), %rdx     # 0x21194
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 0x10510
callq 0x5070
cmpl $0x2, (%rax)
je 0x10709
movq %rax, %r12
movq 0x19d63(%rip), %rax     # 0x29fc0
movq %r15, 0x8(%rsp)
movq (%rax), %r15
callq 0xea3b
movq %rax, %r13
movl (%r12), %ebp
movl %ebp, %edi
callq 0x5530
leaq 0x10c6d(%rip), %rsi     # 0x20eec
movq %r15, %rdi
movq 0x8(%rsp), %r15
movq %r13, %rdx
movq %r14, %rcx
movl %ebp, %r8d
jmp 0x1041c
leaq 0x32e(%rbx), %rsi
movq %rbx, %rdi
callq 0xf4a7
cmpl $0x0, 0x32e(%rbx)
je 0x1083b
movl 0x33e(%rbx), %eax
movl %eax, 0x10a(%rbx)
testl %eax, %eax
je 0x1083b
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 0x19ca7(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xea3b
movl 0x10a(%rbx), %ecx
movl 0x11e(%rbx), %r8d
leaq 0x10d7b(%rip), %rsi     # 0x210b0
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x1a95c(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x1083b
callq 0xea3b
movl 0x10a(%rbx), %ecx
movl 0x11e(%rbx), %r8d
leaq 0x10d3f(%rip), %rsi     # 0x210b0
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %r9
xorl %eax, %eax
callq 0x52c0
jmp 0x1083b
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 0x10709
movq 0x19bd8(%rip), %rax     # 0x29fc0
movq (%rax), %r13
callq 0xea3b
movq %rax, %rbp
movq %r15, 0x8(%rsp)
movl (%r12), %r15d
movl %r15d, %edi
callq 0x5530
leaq 0x10ae1(%rip), %rsi     # 0x20eec
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 0x1a87b(%rip), %rax     # 0x2aca8
movq (%rax), %r13
testq %r13, %r13
je 0x10709
callq 0xea3b
movq %rax, %r15
movl (%r12), %ebp
movl %ebp, %edi
callq 0x5530
leaq 0x10a99(%rip), %rsi     # 0x20eec
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 0x10709
leaq 0x10(%rsp), %rsi
movl $0x80, %edx
movq %r14, %rdi
callq 0xfadd
testl %eax, %eax
jle 0x10709
leaq 0x10(%rsp), %rdi
callq 0x54b0
movl %eax, 0x10a(%rbx)
cmpl $0x2, %eax
jl 0x104e4
movl 0x11e(%rbx), %r8d
testl %r8d, %r8d
jne 0x104bd
movl 0x48(%rbx), %r8d
subl $-0x80, %r8d
movl %r8d, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
addl $-0x80, %r8d
leaq 0x10cbc(%rip), %rdx     # 0x2118b
movl $0x20, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
movl 0x10a(%rbx), %eax
cmpl $0x1, %eax
jne 0x10709
movl $0x81, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
movl $0x20, %edx
movq %r15, %rsi
callq 0x5080
jmp 0x10709
leaq 0x10c95(%rip), %rdx     # 0x211ac
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 0xfadd
movq %rax, %r12
cmpl $0x5, %r12d
jl 0x10709
movq 0x19a71(%rip), %rbp     # 0x29fc0
movq %r15, 0x8(%rsp)
movq (%rbp), %r15
callq 0xea3b
leaq 0x10c66(%rip), %rsi     # 0x211ca
movq %r15, %rdi
movq 0x8(%rsp), %r15
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x1a728(%rip), %rax     # 0x2aca8
movq (%rax), %r13
testq %r13, %r13
je 0x105a4
callq 0xea3b
leaq 0x10c36(%rip), %rsi     # 0x211ca
movq %r13, %rdi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
movq (%rbp), %r15
callq 0xea3b
leaq 0x10c49(%rip), %rsi     # 0x211fd
leaq 0x10c86(%rip), %rcx     # 0x21241
movq %r15, %rdi
movq %rax, %rdx
movl $0xfc, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1a6d3(%rip), %rax     # 0x2aca8
movq (%rax), %r13
testq %r13, %r13
je 0x10603
callq 0xea3b
leaq 0x10c14(%rip), %rsi     # 0x211fd
leaq 0x10c51(%rip), %rcx     # 0x21241
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 0x10682
movl 0x11e(%rbx), %eax
testl %eax, %eax
movq 0x8(%rsp), %r15
je 0x106bf
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 0x10b2b(%rip), %rdx     # 0x211a3
movl $0x20, %esi
jmp 0x10702
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 0x10af9(%rip), %rdx     # 0x211a3
movl $0x20, %esi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x51c0
movq 0x8(%rsp), %r15
jmp 0x10709
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 0x10aa6(%rip), %rdx     # 0x211a3
movl $0x20, %esi
xorl %eax, %eax
callq 0x51c0
cmpl $0x0, 0x10a(%rbx)
je 0x1082b
cmpl $0x0, 0x10e(%rbx)
jne 0x10780
movl $0x4000, 0x10e(%rbx)    # imm = 0x4000
leaq 0x10b29(%rip), %rdx     # 0x21259
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 0x10780
leaq 0x90(%rsp), %rsi
movl $0x20, %edx
movq %r14, %rdi
callq 0xfadd
testq %rax, %rax
je 0x10780
leaq 0x90(%rsp), %rdi
callq 0x54b0
movl %eax, 0x10e(%rbx)
cmpl $0x0, 0x112(%rbx)
jne 0x10793
movl $0x5, 0x112(%rbx)
movq 0x19826(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xea3b
movl 0x112(%rbx), %r8d
movl 0x10a(%rbx), %ecx
movl 0x10e(%rbx), %r9d
movl 0x11e(%rbx), %r10d
leaq 0xca(%rbx), %r12
leaq 0x10aaa(%rip), %rsi     # 0x21275
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x52c0
addq $0x10, %rsp
leaq 0x1a4c1(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x1082b
callq 0xea3b
movl 0x112(%rbx), %r8d
movl 0x10a(%rbx), %ecx
movl 0x10e(%rbx), %r9d
movl 0x11e(%rbx), %r10d
leaq 0x10a5f(%rip), %rsi     # 0x21275
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x52c0
addq $0x10, %rsp
movq %rbx, %rdi
callq 0xff3f
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