// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/device.c
// Function: qmidevice_detect
BOOL qmidevice_detect(char *qmichannel, char *usbnet_adapter, unsigned bufsize, PROFILE_T *profile) {
    struct dirent* ent = NULL;
    DIR *pDir;
    const char *rootdir = "/sys/bus/usb/devices";
    struct {
        char path[255*2];
    } *pl;
    pl = (typeof(pl)) malloc(sizeof(*pl));
    memset(pl, 0x00, sizeof(*pl));

    pDir = opendir(rootdir);
    if (!pDir) {
        dbg_time("opendir %s failed: %s", rootdir, strerror(errno));
        goto error;
    }

    while ((ent = readdir(pDir)) != NULL)  {
        char netcard[32+1] = {'\0'};
        char devname[32+5] = {'\0'}; //+strlen("/dev/")
        int netIntf;
        int driver_type;

        if (ent->d_name[0] == 'u')
            continue;

        snprintf(pl->path, sizeof(pl->path), "%s/%s", rootdir, ent->d_name);
        query_usb_device_info(pl->path, &profile->usb_dev);
        if (profile->usb_dev.idVendor == CM_INVALID_VAL)
            continue;

        if (profile->usb_dev.idVendor == 0x2c7c || profile->usb_dev.idVendor == 0x05c6) {
            dbg_time("Find %s/%s idVendor=0x%x idProduct=0x%x, bus=0x%03x, dev=0x%03x",
                rootdir, ent->d_name, profile->usb_dev.idVendor, profile->usb_dev.idProduct,
                profile->usb_dev.busnum, profile->usb_dev.devnum);
        }

        /* get network interface */
        /* NOTICE: there is a case that, bNumberInterface=6, but the net interface is 8 */
        /* toolchain-mips_24kc_gcc-5.4.0_musl donot support GLOB_BRACE */
        /* RG500U's MBIM is at inteface 0 */
        for (netIntf = 0;  netIntf < (profile->usb_dev.bNumInterfaces + 8); netIntf++) {
            snprintf(pl->path, sizeof(pl->path), "%s/%s:1.%d/net", rootdir, ent->d_name, netIntf);
            dir_get_child(pl->path, netcard, sizeof(netcard), NULL);
            if (netcard[0])
                break;
        }

        if (netcard[0] == '\0') { //for centos 2.6.x
            const char *n= "usb0";
            const char *c = "qcqmi0";

            snprintf(pl->path, sizeof(pl->path), "%s/%s:1.4/net:%s", rootdir, ent->d_name, n);
            if (!access(pl->path, F_OK)) {
                snprintf(pl->path, sizeof(pl->path), "%s/%s:1.4/GobiQMI:%s", rootdir, ent->d_name, c);
                if (!access(pl->path, F_OK)) {
                    snprintf(qmichannel, bufsize, "/dev/%s", c);
                    snprintf(usbnet_adapter, bufsize, "%s", n);
                    snprintf(pl->path, sizeof(pl->path), "%s/%s:1.4", rootdir, ent->d_name);
                    query_usb_interface_info(pl->path, &profile->usb_intf);
                    break;
                }
            }
        }

        if (netcard[0] == '\0')
            continue;

        /* not '-i iface' */
        if (usbnet_adapter[0] && strcmp(usbnet_adapter, netcard))
            continue;

        snprintf(pl->path, sizeof(pl->path), "%s/%s:1.%d", rootdir, ent->d_name, netIntf);
        query_usb_interface_info(pl->path, &profile->usb_intf);
        driver_type = get_driver_type(profile);

        if (driver_type == SOFTWARE_QMI || driver_type == SOFTWARE_MBIM) {
            detect_path_cdc_wdm_or_qcqmi(pl->path, devname, sizeof(devname));
        }
        else if (driver_type == SOFTWARE_ECM_RNDIS_NCM)
        {
            int atIntf = -1;

            if (profile->usb_dev.idVendor == 0x2c7c) { //Quectel
                switch (profile->usb_dev.idProduct) { //EC200U
                case 0x0901: //EC200U
                case 0x8101: //RG801H
                    atIntf = 2;
                break;
                case 0x0900: //RG500U
                    atIntf = 4;
                break;
                case 0x6026: //EC200T
                case 0x6002: //EC200S
                    atIntf = 3;
                break;
                default:
                   dbg_time("unknow at interface for USB idProduct:%04x\n", profile->usb_dev.idProduct);
                break;
                }
            }

            if (atIntf != -1) {
                snprintf(pl->path, sizeof(pl->path), "%s/%s:1.%d", rootdir, ent->d_name, atIntf);
                dir_get_child(pl->path, devname, sizeof(devname), "tty");
                if (devname[0] && !strcmp(devname, "tty")) {
                    snprintf(pl->path, sizeof(pl->path), "%s/%s:1.%d/tty", rootdir, ent->d_name, atIntf);
                    dir_get_child(pl->path, devname, sizeof(devname), "tty");
                }
            }
        }
        
        if (netcard[0] && devname[0]) {
            if (devname[0] == '/')
                snprintf(qmichannel, bufsize, "%s", devname);
            else
                snprintf(qmichannel, bufsize, "/dev/%s", devname);
            snprintf(usbnet_adapter, bufsize, "%s", netcard);
            dbg_time("Auto find qmichannel = %s", qmichannel);
            dbg_time("Auto find usbnet_adapter = %s", usbnet_adapter);
            break;
        }
    }
    closedir(pDir);

    if (qmichannel[0] == '\0' || usbnet_adapter[0] == '\0') {
        dbg_time("network interface '%s' or qmidev '%s' is not exist", usbnet_adapter, qmichannel);
        goto error;
    }
    free(pl);
    return TRUE;
error:
    free(pl);
    return FALSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rcx, %r12
movl %edx, %r14d
movq %rsi, (%rsp)
movq %rdi, %r15
movl $0x1fe, %edi            # imm = 0x1FE
callq 0x5360
movq %rax, %rbx
xorl %ebp, %ebp
movl $0x1fe, %edx            # imm = 0x1FE
movq %rax, %rdi
xorl %esi, %esi
callq 0x5200
leaq 0xc0fd(%rip), %rdi      # 0x22840
callq 0x5140
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x1728a
movq %r15, 0x8(%rsp)
leaq 0x1c5(%r12), %rax
movq %rax, 0x18(%rsp)
movl %r14d, %eax
movq %rax, 0x10(%rsp)
leaq 0x1d9(%r12), %rax
movq %rax, 0x50(%rsp)
leaq 0xc133(%rip), %rbp      # 0x228b7
movq 0x58(%rsp), %rdi
callq 0x5320
testq %rax, %rax
je 0x17207
movq %rax, %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movb $0x0, 0x80(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x3d(%rsp)
cmpb $0x75, 0x13(%rax)
jne 0x167d9
movl $0x5, %r15d
cmpl $0x6, %r15d
jne 0x16784
jmp 0x17207
addq $0x13, %r13
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
leaq 0x8628(%rip), %rdx      # 0x1ee14
leaq 0xc04d(%rip), %rcx      # 0x22840
movq %r13, %r8
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
callq 0x5160
movq %rax, %r14
movq 0x18(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movl $0x0, 0x10(%r15)
movb $0x0, (%rbx,%rax)
movq %rbx, %rdi
callq 0x5160
movabsq $0x6f646e655664692f, %rcx # imm = 0x6F646E655664692F
movq %rcx, (%rbx,%rax)
movw $0x72, 0x8(%rbx,%rax)
movq %rbx, %rdi
movl $0x10, %esi
callq 0x18425
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x16921
xorl %ebp, %ebp
movb %bpl, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movabsq $0x75646f725064692f, %rcx # imm = 0x75646F725064692F
movq %rcx, (%rbx,%rax)
movl $0x746375, 0x7(%rbx,%rax) # imm = 0x746375
movq %rbx, %rdi
movl $0x10, %esi
callq 0x18425
movl %eax, 0x1c9(%r12)
movb %bpl, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movabsq $0x6d756e7375622f, %r15 # imm = 0x6D756E7375622F
movq %r15, (%rbx,%rax)
movq %rbx, %rdi
movl $0xa, %esi
callq 0x18425
movl %eax, 0x1cd(%r12)
movb %bpl, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
leaq 0x2f00200(%r15), %rcx
movq %rcx, (%rbx,%rax)
movq %rbx, %rdi
movl $0xa, %esi
callq 0x18425
movl %eax, 0x1d1(%r12)
movb %bpl, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movups 0xc52b(%rip), %xmm0     # 0x22e28
movups %xmm0, (%rbx,%rax)
movq %rbx, %rdi
movl $0xa, %esi
callq 0x18425
movl %eax, 0x1d5(%r12)
movb %bpl, (%rbx,%r14)
leaq 0xbf96(%rip), %rbp      # 0x228b7
movq 0x18(%rsp), %rax
movl (%rax), %eax
cmpl $-0x1, %eax
je 0x167c8
cmpl $0x2c7c, %eax           # imm = 0x2C7C
je 0x16943
cmpl $0x5c6, %eax            # imm = 0x5C6
jne 0x169fe
movq 0x13676(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movl 0x1c5(%r12), %r9d
movl 0x1c9(%r12), %r10d
movl 0x1cd(%r12), %r11d
movl 0x1d1(%r12), %r15d
subq $0x8, %rsp
movq %r14, %rdi
leaq 0xbef1(%rip), %rsi      # 0x22871
movq %rax, %rdx
leaq 0xbeb6(%rip), %rcx      # 0x22840
movq %r13, %r8
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
callq 0x52c0
addq $0x20, %rsp
leaq 0x14303(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x169fe
callq 0xeb2f
movl 0x1c5(%r12), %r9d
movl 0x1c9(%r12), %r10d
movl 0x1cd(%r12), %r11d
movl 0x1d1(%r12), %r15d
subq $0x8, %rsp
movq %r14, %rdi
leaq 0xbe91(%rip), %rsi      # 0x22871
movq %rax, %rdx
leaq 0xbe56(%rip), %rcx      # 0x22840
movq %r13, %r8
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
callq 0x52c0
addq $0x20, %rsp
xorl %r14d, %r14d
cmpl $-0x7, 0x1d5(%r12)
leaq 0xbe2f(%rip), %rcx      # 0x22840
jl 0x16a6c
xorl %r15d, %r15d
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
movq %rbp, %rdx
movq %r13, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
leaq 0x60(%rsp), %rsi
movl $0x21, %edx
xorl %ecx, %ecx
callq 0x17324
cmpb $0x0, 0x60(%rsp)
jne 0x16a69
leal 0x1(%r15), %r14d
movl 0x1d5(%r12), %eax
addl $0x7, %eax
cmpl %eax, %r15d
movl %r14d, %r15d
leaq 0xbddb(%rip), %rcx      # 0x22840
jl 0x16a16
jmp 0x16a6c
movl %r15d, %r14d
cmpb $0x0, 0x60(%rsp)
jne 0x16b70
xorl %r15d, %r15d
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
leaq 0xbe49(%rip), %rdx      # 0x228d2
leaq 0xbdb0(%rip), %rbp      # 0x22840
movq %rbp, %rcx
movq %r13, %r8
leaq 0xbe29(%rip), %r9       # 0x228c6
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5450
movb $0x1, %cl
testl %eax, %eax
jne 0x16b61
xorl %r15d, %r15d
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
leaq 0xbe19(%rip), %rdx      # 0x228e3
movq %rbp, %rcx
movq %r13, %r8
leaq 0xbdf4(%rip), %r9       # 0x228cb
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5450
movb $0x1, %cl
testl %eax, %eax
jne 0x16b61
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
leaq 0xbdf6(%rip), %rdx      # 0x228f8
leaq 0xbdc2(%rip), %rcx      # 0x228cb
xorl %eax, %eax
callq 0x51c0
movq (%rsp), %rdi
movq %r15, %rsi
leaq 0xc2ef(%rip), %rdx      # 0x22e0d
leaq 0xbda1(%rip), %rcx      # 0x228c6
xorl %eax, %eax
callq 0x51c0
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
leaq 0xbdc5(%rip), %rdx      # 0x22900
leaq 0xbcfe(%rip), %rcx      # 0x22840
movq %r13, %r8
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
callq 0x173c5
xorl %ecx, %ecx
movl $0x6, %r15d
testb %cl, %cl
leaq 0xbd4d(%rip), %rbp      # 0x228b7
je 0x167ce
cmpb $0x0, 0x60(%rsp)
je 0x167c8
movq (%rsp), %rax
cmpb $0x0, (%rax)
je 0x16ba0
movq (%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x52a0
movl $0x5, %r15d
testl %eax, %eax
jne 0x167ce
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
leaq 0xbd5b(%rip), %rdx      # 0x2290a
leaq 0xbc8a(%rip), %rcx      # 0x22840
movq %r13, %r8
movl %r14d, %r9d
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
callq 0x173c5
movq %r12, %rdi
callq 0x175a6
leal -0x1(%rax), %ecx
cmpl $0x1, %ecx
ja 0x16eb9
movq %rbx, %rdi
callq 0x5160
movq %rax, %r14
movb $0x0, 0x20(%rsp)
movq %rbx, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
jne 0x17026
xorl %r15d, %r15d
movb %r15b, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movabsq $0x494d5169626f472f, %rcx # imm = 0x494D5169626F472F
movq %rcx, (%rbx,%rax)
movb %r15b, 0x8(%rbx,%rax)
movq %rbx, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x16c9f
xorl %r15d, %r15d
movb %r15b, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movabsq $0x6373696d6273752f, %rcx # imm = 0x6373696D6273752F
movq %rcx, (%rbx,%rax)
movb %r15b, 0x8(%rbx,%rax)
movq %rbx, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x16c9f
xorl %r15d, %r15d
movb %r15b, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movb %r15b, 0x4(%rbx,%rax)
movl $0x6273752f, (%rbx,%rax) # imm = 0x6273752F
movq %rbx, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
jne 0x17026
leaq 0x1372a(%rip), %rax     # 0x2a3d0
cmpl $0x0, (%rax)
je 0x16cfc
movq 0x1330e(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movq %r14, %rdi
leaq 0x8286(%rip), %rsi      # 0x1ef4a
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x13fd0(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x16cfc
callq 0xeb2f
movq %r14, %rdi
leaq 0x825b(%rip), %rsi      # 0x1ef4a
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x52c0
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
movl $0x20, %edx
xorl %ecx, %ecx
callq 0x17324
cmpb $0x0, 0x90(%rsp)
je 0x17026
movl $0x25, %esi
leaq 0x20(%rsp), %r14
movq %r14, %rdi
leaq 0xbbc3(%rip), %rdx      # 0x228f8
leaq 0x90(%rsp), %rcx
xorl %eax, %eax
callq 0x51c0
movq %r14, %rdi
movl $0x4, %esi
callq 0x5450
testl %eax, %eax
je 0x17026
callq 0x5070
cmpl $0x2, (%rax)
jne 0x17026
movq %rax, %r14
movq 0x1324f(%rip), %rax     # 0x29fc0
movq (%rax), %rax
movq %rax, 0x88(%rsp)
callq 0xeb2f
movq %rax, %r13
movl (%r14), %r15d
movl %r15d, %edi
callq 0x5530
movq 0x88(%rsp), %rdi
leaq 0xc118(%rip), %rsi      # 0x22eb6
movq %r13, %rdx
leaq 0x20(%rsp), %rcx
movl %r15d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x13eee(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x16df4
callq 0xeb2f
movq %rax, %r13
movl (%r14), %r14d
movl %r14d, %edi
callq 0x5530
movq %r15, %rdi
leaq 0xc0d7(%rip), %rsi      # 0x22eb6
movq %r13, %rdx
leaq 0x20(%rsp), %rcx
movl %r14d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movq %rbx, %rdi
callq 0x5160
movw $0x2f, (%rbx,%rax)
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x54c0
movq %rbx, %rdi
callq 0x5160
movabsq $0x746e657665752f, %rcx # imm = 0x746E657665752F
movq %rcx, (%rbx,%rax)
movq %rbx, %rdi
leaq 0xc0ac(%rip), %rsi      # 0x22ede
callq 0x18537
movl %eax, %r14d
movq %rbx, %rdi
leaq 0xc0a0(%rip), %rsi      # 0x22ee4
callq 0x18537
movl %eax, %r13d
cmpl $-0x1, %r14d
sete %al
cmpl $-0x1, %r13d
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x17165
movq 0x13154(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movq %r14, %rdi
leaq 0xc06c(%rip), %rsi      # 0x22eea
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x13e19(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x17026
callq 0xeb2f
movq %r14, %rdi
leaq 0xc040(%rip), %rsi      # 0x22eea
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0x17026
cmpl $0x3, %eax
jne 0x17026
movq 0x18(%rsp), %rax
cmpl $0x2c7c, (%rax)         # imm = 0x2C7C
jne 0x16f7b
movl 0x1c9(%r12), %ecx
movl $0x2, %r14d
xorl %eax, %eax
cmpl $0x6001, %ecx           # imm = 0x6001
jle 0x16f11
cmpl $0x6002, %ecx           # imm = 0x6002
je 0x16f85
cmpl $0x6026, %ecx           # imm = 0x6026
je 0x16f85
cmpl $0x8101, %ecx           # imm = 0x8101
je 0x16f95
jmp 0x16f21
cmpl $0x900, %ecx            # imm = 0x900
je 0x16f8d
cmpl $0x901, %ecx            # imm = 0x901
je 0x16f95
movq 0x13098(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movl 0x1c9(%r12), %ecx
movq %r14, %rdi
leaq 0xb9d3(%rip), %r15      # 0x22915
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x13d52(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x16f7b
callq 0xeb2f
movl 0x1c9(%r12), %ecx
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movb $0x1, %al
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x16f95
movl $0x3, %r14d
jmp 0x16f93
movl $0x4, %r14d
xorl %eax, %eax
testb %al, %al
jne 0x17026
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
leaq 0xb95e(%rip), %rdx      # 0x2290a
leaq 0xb88d(%rip), %rcx      # 0x22840
movq %r13, %r8
movl %r14d, %r9d
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movl $0x25, %edx
leaq 0xb97e(%rip), %rcx      # 0x22952
callq 0x17324
cmpb $0x0, 0x20(%rsp)
je 0x17026
cmpl $0x797474, 0x20(%rsp)   # imm = 0x797474
jne 0x17026
movl $0x1fe, %esi            # imm = 0x1FE
movq %rbx, %rdi
leaq 0xb94e(%rip), %rdx      # 0x22947
leaq 0xb840(%rip), %rcx      # 0x22840
movq %r13, %r8
movl %r14d, %r9d
xorl %eax, %eax
callq 0x51c0
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movl $0x25, %edx
leaq 0xb931(%rip), %rcx      # 0x22952
callq 0x17324
cmpb $0x0, 0x60(%rsp)
setne %cl
movb 0x20(%rsp), %al
testb %al, %al
setne %dl
andb %cl, %dl
xorl %r15d, %r15d
cmpb $0x1, %dl
jne 0x167ce
cmpb $0x2f, %al
jne 0x17071
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
leaq 0xbdad(%rip), %r13      # 0x22e0d
movq %r13, %rdx
leaq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x51c0
jmp 0x1709b
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
leaq 0xb870(%rip), %rdx      # 0x228f8
leaq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x51c0
leaq 0xbd72(%rip), %r13      # 0x22e0d
movq (%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
leaq 0x60(%rsp), %rcx
xorl %eax, %eax
callq 0x51c0
movq 0x12f08(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movq %r14, %rdi
leaq 0xb88c(%rip), %r13      # 0x22956
movq %r13, %rsi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x13bc7(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x17101
callq 0xeb2f
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
movq 0x12eb8(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
movq %r14, %rdi
leaq 0xb85c(%rip), %rsi      # 0x22976
movq %rax, %rdx
movq (%rsp), %r13
movq %r13, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x13b76(%rip), %rax     # 0x2aca8
movq (%rax), %r14
movl $0x6, %r15d
testq %r14, %r14
je 0x167ce
callq 0xeb2f
movq %r14, %rdi
leaq 0xb823(%rip), %rsi      # 0x22976
movq %rax, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x52c0
jmp 0x167ce
movl %r14d, %eax
shll $0x8, %eax
andl $0xfff00, %eax          # imm = 0xFFF00
movzbl %r13b, %ecx
orl %eax, %ecx
movl %r13d, %eax
shll $0xc, %eax
andl $0xfff00000, %eax       # imm = 0xFFF00000
orl %ecx, %eax
movslq %eax, %rdx
leaq 0x20(%rsp), %rdi
movl $0x21b6, %esi           # imm = 0x21B6
callq 0x52d0
testl %eax, %eax
je 0x17026
movq 0x12e1c(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
movq %r15, %rdi
leaq 0xbd55(%rip), %rsi      # 0x22f0b
movq %rax, %rdx
leaq 0x20(%rsp), %rcx
movl %r14d, %r8d
movl %r13d, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x13ad6(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x17026
callq 0xeb2f
movq %r15, %rdi
leaq 0xbd1e(%rip), %rsi      # 0x22f0b
movq %rax, %rdx
leaq 0x20(%rsp), %rcx
movl %r14d, %r8d
movl %r13d, %r9d
xorl %eax, %eax
callq 0x52c0
jmp 0x17026
movq 0x58(%rsp), %rdi
callq 0x5240
movq 0x8(%rsp), %r15
cmpb $0x0, (%r15)
movq (%rsp), %r12
je 0x17230
movl $0x1, %ebp
cmpb $0x0, (%r12)
jne 0x17308
movq 0x12d89(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
leaq 0xb754(%rip), %rsi      # 0x2299a
xorl %ebp, %ebp
movq %r14, %rdi
movq %rax, %rdx
movq %r12, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x52c0
leaq 0x13a46(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0x17308
callq 0xeb2f
leaq 0xb720(%rip), %rsi      # 0x2299a
xorl %ebp, %ebp
movq %r14, %rdi
movq %rax, %rdx
movq %r12, %rcx
movq %r15, %r8
jmp 0x17301
movq 0x12d2f(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
movq %rax, %r12
callq 0x5070
movq %rax, %r14
movl (%rax), %edi
callq 0x5530
leaq 0xb5a3(%rip), %rsi      # 0x22855
leaq 0xb587(%rip), %rcx      # 0x22840
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x52c0
leaq 0x139d8(%rip), %rax     # 0x2aca8
movq (%rax), %r15
testq %r15, %r15
je 0x17308
callq 0xeb2f
movq %rax, %r12
movl (%r14), %edi
callq 0x5530
leaq 0xb566(%rip), %rsi      # 0x22855
leaq 0xb54a(%rip), %rcx      # 0x22840
xorl %ebp, %ebp
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x52c0
movq %rbx, %rdi
callq 0x5040
movl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq