// File: /workspace/github_c_makefile_star2_O2/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 0xf8dd
cmpl $0x2, %eax
jne 0x10087
movl 0x1bd(%rbx), %eax
cmpl $0x5, %eax
je 0xfaff
cmpl $0x6, %eax
jne 0x10087
leaq 0xaa(%rbx), %rcx
movl 0x48(%rbx), %r8d
leaq 0xf82b(%rip), %rdx      # 0x1f0b3
leaq 0x10(%rsp), %r14
movl $0x80, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
xorl %esi, %esi
callq 0x5460
testl %eax, %eax
jne 0x10087
movl $0x4, 0x10a(%rbx)
movl 0x48(%rbx), %eax
movl %eax, 0x11e(%rbx)
leaq 0xca(%rbx), %r14
leaq 0x1f(%rsp), %rsi
pushq $0x20
popq %rdx
movq %r14, %rdi
callq 0x5080
jmp 0xfb7c
movl $0x3fc, %edi            # imm = 0x3FC
callq 0x5360
movq %rax, %r14
leaq 0x1fe(%rax), %r12
leaq 0xaa(%rbx), %r15
leaq 0xf808(%rip), %rdx      # 0x1f107
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 0xf948
leaq 0xea(%rbx), %r13
sarq $0x20, %rcx
movq %r14, %rsi
addq %rcx, %rsi
pushq $0x20
popq %rdx
movq %r13, %rdi
callq 0x5080
leaq 0x32e(%rbx), %rsi
movq %rbx, %rdi
callq 0xed43
cmpl $0x0, 0x32e(%rbx)
je 0xf9b5
movl 0x33e(%rbx), %eax
movl %eax, 0x10a(%rbx)
testl %eax, %eax
je 0xff5d
movl 0x11e(%rbx), %ecx
testl %ecx, %ecx
je 0xfbf0
addl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
jmp 0xfbf5
leaq 0xf76b(%rip), %rdx      # 0x1f127
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x5460
testl %eax, %eax
je 0xfa50
callq 0x5070
movq %rax, %r12
cmpl $0x2, (%rax)
jne 0xfc49
leaq 0xf74e(%rip), %rdx      # 0x1f143
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x51c0
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x5460
testl %eax, %eax
je 0xfa50
cmpl $0x2, (%r12)
jne 0xfac0
leaq 0xf73f(%rip), %rdx      # 0x1f167
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x5460
testl %eax, %eax
je 0xfa50
cmpl $0x2, (%r12)
jne 0xfac0
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x5460
testl %eax, %eax
je 0xfcdb
leaq 0x8a(%rbx), %rdi
leaq 0xf539(%rip), %rsi      # 0x1efaa
pushq $0xc
popq %rdx
callq 0x5090
testl %eax, %eax
jne 0xff5d
movl 0x48(%rbx), %ecx
decl %ecx
leaq 0xf71f(%rip), %rdx      # 0x1f1ac
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
xorl %eax, %eax
callq 0x51c0
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x5460
testl %eax, %eax
je 0xfd74
callq 0x5070
cmpl $0x2, (%rax)
je 0xff5d
movq %rax, %r12
movq 0x194f1(%rip), %rax     # 0x28fb8
movq %r15, 0x8(%rsp)
movq (%rax), %r15
callq 0xe343
movq %rax, %r13
movl (%r12), %ebp
movl %ebp, %edi
callq 0x5540
leaq 0xf41b(%rip), %rsi      # 0x1ef04
movq %r15, %rdi
movq 0x8(%rsp), %r15
movq %r13, %rdx
movq %r14, %rcx
movl %ebp, %r8d
jmp 0xfc84
leaq 0x32e(%rbx), %rsi
movq %rbx, %rdi
callq 0xed43
cmpl $0x0, 0x32e(%rbx)
je 0x10087
movl 0x33e(%rbx), %eax
movl %eax, 0x10a(%rbx)
testl %eax, %eax
je 0x10087
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 0x19435(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movl 0x10a(%rbx), %ecx
movl 0x11e(%rbx), %r8d
leaq 0xf529(%rip), %rsi      # 0x1f0c8
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x1a0f2(%rip), %rax     # 0x29ca8
movq (%rax), %r15
testq %r15, %r15
je 0x10087
callq 0xe343
movl 0x10a(%rbx), %ecx
movl 0x11e(%rbx), %r8d
leaq 0xf4ed(%rip), %rsi      # 0x1f0c8
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %r9
xorl %eax, %eax
callq 0x52c0
jmp 0x10087
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
pushq $0x20
popq %rdx
callq 0x5080
movl 0x332(%rbx), %eax
movl 0x342(%rbx), %ecx
movl %eax, 0x10e(%rbx)
movl %ecx, 0x112(%rbx)
jmp 0xff5d
movq 0x19368(%rip), %rax     # 0x28fb8
movq (%rax), %r13
callq 0xe343
movq %rax, %rbp
movq %r15, 0x8(%rsp)
movl (%r12), %r15d
movl %r15d, %edi
callq 0x5540
leaq 0xf291(%rip), %rsi      # 0x1ef04
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 0x1a013(%rip), %rax     # 0x29ca8
movq (%rax), %r13
testq %r13, %r13
je 0xff5d
callq 0xe343
movq %rax, %r15
movl (%r12), %ebp
movl %ebp, %edi
callq 0x5540
leaq 0xf249(%rip), %rsi      # 0x1ef04
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 0xff5d
leaq 0x10(%rsp), %rsi
movl $0x80, %edx
movq %r14, %rdi
callq 0xf365
testl %eax, %eax
jle 0xff5d
leaq 0x10(%rsp), %rdi
callq 0x54c0
movl %eax, 0x10a(%rbx)
cmpl $0x2, %eax
jl 0xfd4a
movl 0x11e(%rbx), %r8d
testl %r8d, %r8d
jne 0xfd25
movl 0x48(%rbx), %r8d
subl $-0x80, %r8d
movl %r8d, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
addl $-0x80, %r8d
leaq 0xf46c(%rip), %rdx      # 0x1f1a3
pushq $0x20
popq %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
movl 0x10a(%rbx), %eax
cmpl $0x1, %eax
jne 0xff5d
movl $0x81, 0x11e(%rbx)
leaq 0xca(%rbx), %rdi
pushq $0x20
popq %rdx
movq %r15, %rsi
callq 0x5080
jmp 0xff5d
leaq 0xf449(%rip), %rdx      # 0x1f1c4
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 0xf365
movq %rax, %r12
cmpl $0x5, %r12d
jl 0xff5d
movq 0x19205(%rip), %rbp     # 0x28fb8
movq %r15, 0x8(%rsp)
movq (%rbp), %r15
callq 0xe343
leaq 0xf41a(%rip), %rsi      # 0x1f1e2
movq %r15, %rdi
movq 0x8(%rsp), %r15
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x19ec4(%rip), %rax     # 0x29ca8
movq (%rax), %r13
testq %r13, %r13
je 0xfe08
callq 0xe343
leaq 0xf3ea(%rip), %rsi      # 0x1f1e2
movq %r13, %rdi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
movq (%rbp), %r15
callq 0xe343
leaq 0xf3fd(%rip), %rsi      # 0x1f215
leaq 0xf43a(%rip), %rcx      # 0x1f259
movq %r15, %rdi
movq %rax, %rdx
movl $0xfc, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x19e6f(%rip), %rax     # 0x29ca8
movq (%rax), %r13
testq %r13, %r13
je 0xfe67
callq 0xe343
leaq 0xf3c8(%rip), %rsi      # 0x1f215
leaq 0xf405(%rip), %rcx      # 0x1f259
movq %r13, %rdi
movq %rax, %rdx
movl $0xfc, %r8d
xorl %eax, %eax
callq 0x52c0
pushq $0x5
popq %rcx
movl %r12d, %eax
xorl %edx, %edx
divl %ecx
movl %eax, 0x10a(%rbx)
cmpl $0xa, %r12d
jb 0xfeda
movl 0x11e(%rbx), %eax
testl %eax, %eax
movq 0x8(%rsp), %r15
je 0xff15
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
leal -0x3b1(%rcx,%rax), %ecx
leaq 0xf2e6(%rip), %rdx      # 0x1f1bb
pushq $0x20
popq %rsi
jmp 0xff56
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 0xf2b9(%rip), %rdx      # 0x1f1bb
pushq $0x20
popq %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x51c0
movq 0x8(%rsp), %r15
jmp 0xff5d
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 0xf268(%rip), %rdx      # 0x1f1bb
pushq $0x20
popq %rsi
xorl %eax, %eax
callq 0x51c0
cmpl $0x0, 0x10a(%rbx)
je 0x10077
cmpl $0x0, 0x10e(%rbx)
jne 0xffd0
movl $0x4000, 0x10e(%rbx)    # imm = 0x4000
leaq 0xf2ed(%rip), %rdx      # 0x1f271
movl $0x1fe, %esi            # imm = 0x1FE
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x51c0
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x5460
testl %eax, %eax
jne 0xffd0
leaq 0x90(%rsp), %rsi
pushq $0x20
popq %rdx
movq %r14, %rdi
callq 0xf365
testq %rax, %rax
je 0xffd0
leaq 0x90(%rsp), %rdi
callq 0x54c0
movl %eax, 0x10e(%rbx)
cmpl $0x0, 0x112(%rbx)
jne 0xffe3
movl $0x5, 0x112(%rbx)
movq 0x18fce(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movl 0x112(%rbx), %r8d
movl 0x10a(%rbx), %ecx
movl 0x10e(%rbx), %r9d
movl 0x11e(%rbx), %r10d
leaq 0xca(%rbx), %r12
leaq 0xf272(%rip), %rsi      # 0x1f28d
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x52c0
popq %rcx
popq %rdx
leaq 0x19c73(%rip), %rax     # 0x29ca8
movq (%rax), %r15
testq %r15, %r15
je 0x10077
callq 0xe343
movl 0x112(%rbx), %r8d
movl 0x10a(%rbx), %ecx
movl 0x10e(%rbx), %r9d
movl 0x11e(%rbx), %r10d
leaq 0xf229(%rip), %rsi      # 0x1f28d
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x52c0
popq %rcx
popq %rdx
movq %rbx, %rdi
callq 0xf7b5
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