// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/qmap_bridge_mode.c
// Function: ql_qmi_qmap_mode_detect
static int ql_qmi_qmap_mode_detect(PROFILE_T *profile) {
    char buf[128];
    int n;
    struct {
        char filename[255 * 2];
        char linkname[255 * 2];
    } *pl;

    pl = (typeof(pl)) malloc(sizeof(*pl));

    snprintf(pl->linkname, sizeof(pl->linkname), "/sys/class/net/%s/device/driver", profile->usbnet_adapter);
    n = readlink(pl->linkname, pl->filename, sizeof(pl->filename));
    pl->filename[n] = '\0';
    while (pl->filename[n] != '/')
        n--;
    strncpy(profile->driver_name, &pl->filename[n+1], sizeof(profile->driver_name));

    ql_get_driver_rmnet_info(profile, &profile->rmnet_info);
    if (profile->rmnet_info.size) {
        profile->qmap_mode = profile->rmnet_info.qmap_mode;
        if (profile->qmap_mode) {
            int offset_id = (profile->muxid == 0)? profile->pdp - 1 : profile->muxid - 0x81;

            if (profile->qmap_mode == 1)
                offset_id = 0;
            profile->muxid = profile->rmnet_info.mux_id[offset_id];
            strncpy(profile->qmapnet_adapter, profile->rmnet_info.ifname[offset_id], sizeof(profile->qmapnet_adapter));
            profile->qmap_size = profile->rmnet_info.rx_urb_size;
            profile->qmap_version = profile->rmnet_info.qmap_version;
        }

        goto _out;
    }

    snprintf(pl->filename, sizeof(pl->filename), "/sys/class/net/%s/qmap_mode", profile->usbnet_adapter);
    if (access(pl->filename, R_OK)) {
        if (errno != ENOENT) {
            dbg_time("fail to access %s, errno: %d (%s)", pl->filename, errno, strerror(errno));
            goto _out;
        }
        
        snprintf(pl->filename, sizeof(pl->filename), "/sys/module/%s/parameters/qmap_mode", profile->driver_name);
        if (access(pl->filename, R_OK)) {
            if (errno != ENOENT) {
                dbg_time("fail to access %s, errno: %d (%s)", pl->filename, errno, strerror(errno));
                goto _out;
            }
            
            snprintf(pl->filename, sizeof(pl->filename), "/sys/class/net/%s/device/driver/module/parameters/qmap_mode", profile->usbnet_adapter);
            if (access(pl->filename, R_OK)) {
                if (errno != ENOENT) {
                    dbg_time("fail to access %s, errno: %d (%s)", pl->filename, errno, strerror(errno));
                    goto _out;
                }
            }
        }
    }

    if (!access(pl->filename, R_OK)) {
        n = ql_fread(pl->filename, buf, sizeof(buf));
        if (n > 0) {
            profile->qmap_mode = atoi(buf);
            
            if (profile->qmap_mode > 1) {
                if(!profile->muxid)
                	profile->muxid = profile->pdp + 0x80; //muxis is 0x8X for PDN-X
                snprintf(profile->qmapnet_adapter, sizeof(profile->qmapnet_adapter),
                    "%.16s.%d", profile->usbnet_adapter, profile->muxid - 0x80);
           } if (profile->qmap_mode == 1) {
                profile->muxid = 0x81;
                strncpy(profile->qmapnet_adapter, profile->usbnet_adapter, sizeof(profile->qmapnet_adapter));
           }
        }
    }
    else if (qmidev_is_qmiwwan(profile->qmichannel)) {
        snprintf(pl->filename, sizeof(pl->filename), "/sys/class/net/qmimux%d", profile->pdp - 1);
        if (access(pl->filename, R_OK)) {
            if (errno != ENOENT) {
                dbg_time("fail to access %s, errno: %d (%s)", pl->filename, errno, strerror(errno));
            }
            goto _out;
        }

        //upstream Kernel Style QMAP qmi_wwan.c
        snprintf(pl->filename, sizeof(pl->filename), "/sys/class/net/%s/qmi/add_mux", profile->usbnet_adapter);
        n = ql_fread(pl->filename, buf, sizeof(buf));
        if (n >= 5) {
            dbg_time("If use QMAP by /sys/class/net/%s/qmi/add_mux", profile->usbnet_adapter);
            dbg_time("File:%s Line:%d Please make sure add next patch to qmi_wwan.c", __func__, __LINE__);
            /*
            diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
            index 74bebbd..db8a777 100644
            --- a/drivers/net/usb/qmi_wwan.c
            +++ b/drivers/net/usb/qmi_wwan.c
            @@ -379,6 +379,24 @@ static ssize_t add_mux_store(struct device *d,  struct device_attribute *attr, c
                if (!ret) {
                        info->flags |= QMI_WWAN_FLAG_MUX;
                        ret = len;
            +#if 1 //Add by Quectel
            +               if (le16_to_cpu(dev->udev->descriptor.idVendor) == 0x2c7c) {
            +                       int idProduct = le16_to_cpu(dev->udev->descriptor.idProduct);
            +
            +                       if (idProduct == 0x0121 || idProduct == 0x0125 || idProduct == 0x0435) //MDM9x07
            +                               dev->rx_urb_size = 4*1024;
            +                       else if (idProduct == 0x0306) //MDM9x40
            +                               dev->rx_urb_size = 16*1024;
            +                       else if (idProduct == 0x0512) //SDX20
            +                               dev->rx_urb_size = 32*1024;
            +                       else if (idProduct == 0x0620) //SDX24
            +                               dev->rx_urb_size = 32*1024;
            +                       else if (idProduct == 0x0800) //SDX55
            +                               dev->rx_urb_size = 32*1024;
            +                       else
            +                               dev->rx_urb_size = 32*1024;
            +               }
            +#endif
                }
            err:
                rtnl_unlock();
            */
            profile->qmap_mode = n/5; //0x11\n0x22\n0x33\n
            if (profile->qmap_mode > 1) {
                //PDN-X map to qmimux-X
                if(!profile->muxid) {
                	profile->muxid = (buf[5*(profile->pdp - 1) + 2] - '0')*16 + (buf[5*(profile->pdp - 1) + 3] - '0');
                    snprintf(profile->qmapnet_adapter, sizeof(profile->qmapnet_adapter), "qmimux%d", profile->pdp - 1);
                } else {
					profile->muxid = (buf[5*(profile->muxid - 0x81) + 2] - '0')*16 + (buf[5*(profile->muxid - 0x81) + 3] - '0');
                    snprintf(profile->qmapnet_adapter, sizeof(profile->qmapnet_adapter), "qmimux%d", profile->muxid - 0x81);
                }
            } else if (profile->qmap_mode == 1) {
                profile->muxid = (buf[5*0 + 2] - '0')*16 + (buf[5*0 + 3] - '0');
                snprintf(profile->qmapnet_adapter, sizeof(profile->qmapnet_adapter),
                    "qmimux%d", 0);
            }
        }
    } 

_out:
    if (profile->qmap_mode) {
        if (profile->qmap_size == 0) {
            profile->qmap_size = 16*1024;
            snprintf(pl->filename, sizeof(pl->filename), "/sys/class/net/%s/qmap_size", profile->usbnet_adapter);
            if (!access(pl->filename, R_OK)) {
                size_t n;
                char buf[32];
                n = ql_fread(pl->filename, buf, sizeof(buf));
                if (n > 0) {
                    profile->qmap_size = atoi(buf);
                }
            }
        }

        if (profile->qmap_version == 0) {
            profile->qmap_version = WDA_DL_DATA_AGG_QMAP_ENABLED;
        }

        dbg_time("qmap_mode = %d, qmap_version = %d, qmap_size = %d, muxid = 0x%02x, qmap_netcard = %s",
            profile->qmap_mode, profile->qmap_version, profile->qmap_size, profile->muxid, profile->qmapnet_adapter);
    }
    ql_set_driver_bridge_mode(profile);
    free(pl);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x8(%rbp)
movl $0x3fc, %edi            # imm = 0x3FC
callq 0x5370
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
addq $0x1fe, %rdi            # imm = 0x1FE
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
movl $0x1fe, %esi            # imm = 0x1FE
leaq 0x18382(%rip), %rdx     # 0x2e2e7
movb $0x0, %al
callq 0x51c0
movq -0xa0(%rbp), %rdi
addq $0x1fe, %rdi            # imm = 0x1FE
movq -0xa0(%rbp), %rsi
movl $0x1fe, %edx            # imm = 0x1FE
callq 0x50d0
movl %eax, -0x94(%rbp)
movq -0xa0(%rbp), %rax
movslq -0x94(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0xa0(%rbp), %rax
movslq -0x94(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
je 0x15fcb
movl -0x94(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x15fa3
movq -0x8(%rbp), %rdi
addq $0xea, %rdi
movq -0xa0(%rbp), %rsi
movl -0x94(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rsi
movl $0x20, %edx
callq 0x5080
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x32e, %rsi            # imm = 0x32E
callq 0x14a40
movq -0x8(%rbp), %rax
cmpl $0x0, 0x32e(%rax)
je 0x16112
movq -0x8(%rbp), %rax
movl 0x33e(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10a(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10a(%rax)
je 0x1610d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x11e(%rax)
jne 0x1605e
movq -0x8(%rbp), %rax
movl 0x48(%rax), %eax
subl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x16073
movq -0x8(%rbp), %rax
movl 0x11e(%rax), %eax
subl $0x81, %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x10a(%rax)
jne 0x16096
movl $0x0, -0xa4(%rbp)
movq -0x8(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movzbl 0x3ca(%rax,%rcx), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x11e(%rax)
movq -0x8(%rbp), %rdi
addq $0xca, %rdi
movq -0x8(%rbp), %rsi
addq $0x32e, %rsi            # imm = 0x32E
addq $0x1c, %rsi
movslq -0xa4(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
movl $0x20, %edx
callq 0x5080
movq -0x8(%rbp), %rax
movl 0x332(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10e(%rax)
movq -0x8(%rbp), %rax
movl 0x342(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x112(%rax)
jmp 0x16a42
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
movl $0x1fe, %esi            # imm = 0x1FE
leaq 0x181d7(%rip), %rdx     # 0x2e307
movb $0x0, %al
callq 0x51c0
movq -0xa0(%rbp), %rdi
movl $0x4, %esi
callq 0x5460
cmpl $0x0, %eax
je 0x164e7
callq 0x5070
cmpl $0x2, (%rax)
je 0x16257
jmp 0x16161
movq 0x20e78(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
callq 0x13930
movq %rax, -0xe8(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0xe0(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0xd8(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rdx
movq -0xe0(%rbp), %rcx
movl -0xd8(%rbp), %r8d
movq %rax, %r9
leaq 0x17f19(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
leaq 0x21c8f(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x16250
leaq 0x21c82(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x110(%rbp)
callq 0x13930
movq %rax, -0x108(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x100(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0xf4(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %rdx
movq -0x100(%rbp), %rcx
movl -0xf4(%rbp), %r8d
movq %rax, %r9
leaq 0x17e9b(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
jmp 0x16252
jmp 0x16a42
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rcx
addq $0xea, %rcx
movl $0x1fe, %esi            # imm = 0x1FE
leaq 0x180ae(%rip), %rdx     # 0x2e323
movb $0x0, %al
callq 0x51c0
movq -0xa0(%rbp), %rdi
movl $0x4, %esi
callq 0x5460
cmpl $0x0, %eax
je 0x164e5
callq 0x5070
cmpl $0x2, (%rax)
je 0x1639c
jmp 0x162a6
movq 0x20d33(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x130(%rbp)
callq 0x13930
movq %rax, -0x128(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x120(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x114(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rdx
movq -0x120(%rbp), %rcx
movl -0x114(%rbp), %r8d
movq %rax, %r9
leaq 0x17dd4(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
leaq 0x21b4a(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x16395
leaq 0x21b3d(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x150(%rbp)
callq 0x13930
movq %rax, -0x148(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x140(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x134(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rdx
movq -0x140(%rbp), %rcx
movl -0x134(%rbp), %r8d
movq %rax, %r9
leaq 0x17d56(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
jmp 0x16397
jmp 0x16a42
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
movl $0x1fe, %esi            # imm = 0x1FE
leaq 0x17f8d(%rip), %rdx     # 0x2e347
movb $0x0, %al
callq 0x51c0
movq -0xa0(%rbp), %rdi
movl $0x4, %esi
callq 0x5460
cmpl $0x0, %eax
je 0x164e3
callq 0x5070
cmpl $0x2, (%rax)
je 0x164e1
jmp 0x163eb
movq 0x20bee(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x170(%rbp)
callq 0x13930
movq %rax, -0x168(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x160(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x154(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x170(%rbp), %rdi
movq -0x168(%rbp), %rdx
movq -0x160(%rbp), %rcx
movl -0x154(%rbp), %r8d
movq %rax, %r9
leaq 0x17c8f(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
leaq 0x21a05(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x164da
leaq 0x219f8(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x190(%rbp)
callq 0x13930
movq %rax, -0x188(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x180(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x174(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rdx
movq -0x180(%rbp), %rcx
movl -0x174(%rbp), %r8d
movq %rax, %r9
leaq 0x17c11(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
jmp 0x164dc
jmp 0x16a42
jmp 0x164e3
jmp 0x164e5
jmp 0x164e7
movq -0xa0(%rbp), %rdi
movl $0x4, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x165f2
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x80, %edx
callq 0x15460
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
jle 0x165ed
leaq -0x90(%rbp), %rdi
callq 0x54c0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10a(%rax)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x10a(%rax)
jle 0x165b0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x11e(%rax)
jne 0x16575
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
addl $0x80, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x11e(%rax)
movq -0x8(%rbp), %rdi
addq $0xca, %rdi
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
movq -0x8(%rbp), %rax
movl 0x11e(%rax), %r8d
subl $0x80, %r8d
movl $0x20, %esi
leaq 0x17dda(%rip), %rdx     # 0x2e383
movb $0x0, %al
callq 0x51c0
movq -0x8(%rbp), %rax
cmpl $0x1, 0x10a(%rax)
jne 0x165eb
movq -0x8(%rbp), %rax
movl $0x81, 0x11e(%rax)
movq -0x8(%rbp), %rdi
addq $0xca, %rdi
movq -0x8(%rbp), %rsi
addq $0xaa, %rsi
movl $0x20, %edx
callq 0x5080
jmp 0x165ed
jmp 0x16a40
movq -0x8(%rbp), %rdi
addq $0x8a, %rdi
leaq 0x17b86(%rip), %rsi     # 0x2e18a
movl $0xc, %edx
callq 0x5090
cmpl $0x0, %eax
jne 0x16a3e
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
subl $0x1, %ecx
movl $0x1fe, %esi            # imm = 0x1FE
leaq 0x17d58(%rip), %rdx     # 0x2e38c
movb $0x0, %al
callq 0x51c0
movq -0xa0(%rbp), %rdi
movl $0x4, %esi
callq 0x5460
cmpl $0x0, %eax
je 0x1675d
callq 0x5070
cmpl $0x2, (%rax)
je 0x16758
jmp 0x16665
movq 0x20974(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x1b0(%rbp)
callq 0x13930
movq %rax, -0x1a8(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x1a0(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x194(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x1b0(%rbp), %rdi
movq -0x1a8(%rbp), %rdx
movq -0x1a0(%rbp), %rcx
movl -0x194(%rbp), %r8d
movq %rax, %r9
leaq 0x17a15(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
leaq 0x2178b(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x16754
leaq 0x2177e(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x1d0(%rbp)
callq 0x13930
movq %rax, -0x1c8(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x1b4(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x1d0(%rbp), %rdi
movq -0x1c8(%rbp), %rdx
movq -0x1c0(%rbp), %rcx
movl -0x1b4(%rbp), %r8d
movq %rax, %r9
leaq 0x17997(%rip), %rsi     # 0x2e0e4
movb $0x0, %al
callq 0x52c0
jmp 0x16756
jmp 0x16758
jmp 0x16a42
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
movl $0x1fe, %esi            # imm = 0x1FE
leaq 0x17c29(%rip), %rdx     # 0x2e3a4
movb $0x0, %al
callq 0x51c0
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x80, %edx
callq 0x15460
movl %eax, -0x94(%rbp)
cmpl $0x5, -0x94(%rbp)
jl 0x16a3c
jmp 0x167af
movq 0x2082a(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
callq 0x13930
movq -0x1d8(%rbp), %rdi
movq %rax, %rdx
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
leaq 0x17be1(%rip), %rsi     # 0x2e3c2
movb $0x0, %al
callq 0x52c0
leaq 0x21679(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1682e
leaq 0x2166c(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x1e0(%rbp)
callq 0x13930
movq -0x1e0(%rbp), %rdi
movq %rax, %rdx
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
leaq 0x17b9b(%rip), %rsi     # 0x2e3c2
movb $0x0, %al
callq 0x52c0
jmp 0x16830
jmp 0x16832
movq 0x207a7(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x1e8(%rbp)
callq 0x13930
movq -0x1e8(%rbp), %rdi
movq %rax, %rdx
leaq 0x17b9c(%rip), %rsi     # 0x2e3f5
leaq 0x17bd9(%rip), %rcx     # 0x2e439
movl $0xfc, %r8d
movb $0x0, %al
callq 0x52c0
leaq 0x215f4(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x168b5
leaq 0x215e7(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x1f0(%rbp)
callq 0x13930
movq -0x1f0(%rbp), %rdi
movq %rax, %rdx
leaq 0x17b54(%rip), %rsi     # 0x2e3f5
leaq 0x17b91(%rip), %rcx     # 0x2e439
movl $0xfc, %r8d
movb $0x0, %al
callq 0x52c0
jmp 0x168b7
movl -0x94(%rbp), %eax
movl $0x5, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10a(%rax)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x10a(%rax)
jle 0x169e8
movq -0x8(%rbp), %rax
cmpl $0x0, 0x11e(%rax)
jne 0x16965
movq -0x8(%rbp), %rax
movl 0x48(%rax), %eax
subl $0x1, %eax
imull $0x5, %eax, %eax
addl $0x2, %eax
cltq
movsbl -0x90(%rbp,%rax), %ecx
subl $0x30, %ecx
shll $0x4, %ecx
movq -0x8(%rbp), %rax
movl 0x48(%rax), %eax
subl $0x1, %eax
imull $0x5, %eax, %eax
addl $0x3, %eax
cltq
movsbl -0x90(%rbp,%rax), %eax
subl $0x30, %eax
addl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x11e(%rax)
movq -0x8(%rbp), %rdi
addq $0xca, %rdi
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
subl $0x1, %ecx
movl $0x20, %esi
leaq 0x17a42(%rip), %rdx     # 0x2e39b
movb $0x0, %al
callq 0x51c0
jmp 0x169e6
movq -0x8(%rbp), %rax
movl 0x11e(%rax), %eax
subl $0x81, %eax
imull $0x5, %eax, %eax
addl $0x2, %eax
cltq
movsbl -0x90(%rbp,%rax), %ecx
subl $0x30, %ecx
shll $0x4, %ecx
movq -0x8(%rbp), %rax
movl 0x11e(%rax), %eax
subl $0x81, %eax
imull $0x5, %eax, %eax
addl $0x3, %eax
cltq
movsbl -0x90(%rbp,%rax), %eax
subl $0x30, %eax
addl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x11e(%rax)
movq -0x8(%rbp), %rdi
addq $0xca, %rdi
movq -0x8(%rbp), %rax
movl 0x11e(%rax), %ecx
subl $0x81, %ecx
movl $0x20, %esi
leaq 0x179bc(%rip), %rdx     # 0x2e39b
movb $0x0, %al
callq 0x51c0
jmp 0x16a3a
movq -0x8(%rbp), %rax
cmpl $0x1, 0x10a(%rax)
jne 0x16a38
movsbl -0x8e(%rbp), %ecx
subl $0x30, %ecx
shll $0x4, %ecx
movsbl -0x8d(%rbp), %eax
subl $0x30, %eax
addl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x11e(%rax)
movq -0x8(%rbp), %rdi
addq $0xca, %rdi
movl $0x20, %esi
leaq 0x1796c(%rip), %rdx     # 0x2e39b
xorl %ecx, %ecx
movb $0x0, %al
callq 0x51c0
jmp 0x16a3a
jmp 0x16a3c
jmp 0x16a3e
jmp 0x16a40
jmp 0x16a42
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10a(%rax)
je 0x16bf8
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10e(%rax)
jne 0x16af2
movq -0x8(%rbp), %rax
movl $0x4000, 0x10e(%rax)    # imm = 0x4000
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rcx
addq $0xaa, %rcx
movl $0x1fe, %esi            # imm = 0x1FE
leaq 0x179c1(%rip), %rdx     # 0x2e451
movb $0x0, %al
callq 0x51c0
movq -0xa0(%rbp), %rdi
movl $0x4, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x16af0
movq -0xa0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movl $0x20, %edx
callq 0x15460
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
jbe 0x16aee
leaq -0xd0(%rbp), %rdi
callq 0x54c0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10e(%rax)
jmp 0x16af0
jmp 0x16af2
movq -0x8(%rbp), %rax
cmpl $0x0, 0x112(%rax)
jne 0x16b0d
movq -0x8(%rbp), %rax
movl $0x5, 0x112(%rax)
jmp 0x16b0f
movq 0x204ca(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x1f8(%rbp)
callq 0x13930
movq -0x1f8(%rbp), %rdi
movq %rax, %rdx
movq -0x8(%rbp), %rax
movl 0x10a(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x112(%rax), %r8d
movq -0x8(%rbp), %rax
movl 0x10e(%rax), %r9d
movq -0x8(%rbp), %rax
movl 0x11e(%rax), %r10d
movq -0x8(%rbp), %rax
addq $0xca, %rax
leaq 0x17902(%rip), %rsi     # 0x2e46d
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x52c0
leaq 0x212e6(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x16bf4
leaq 0x212d9(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x200(%rbp)
callq 0x13930
movq -0x200(%rbp), %rdi
movq %rax, %rdx
movq -0x8(%rbp), %rax
movl 0x10a(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x112(%rax), %r8d
movq -0x8(%rbp), %rax
movl 0x10e(%rax), %r9d
movq -0x8(%rbp), %rax
movl 0x11e(%rax), %r10d
movq -0x8(%rbp), %rax
addq $0xca, %rax
leaq 0x17889(%rip), %rsi     # 0x2e46d
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x52c0
jmp 0x16bf6
jmp 0x16bf8
movq -0x8(%rbp), %rdi
callq 0x15b10
movq -0xa0(%rbp), %rdi
callq 0x5040
xorl %eax, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
nopl (%rax,%rax)