// File: /workspace/github_c_makefile_star2_O2/Carton32[P]quectel-CM/main.c
// Function: qmi_main
static int qmi_main(PROFILE_T *profile)
{
    int triger_event = 0;
    int signo;
#ifdef CONFIG_SIM
    SIM_Status SIMStatus;
#endif
    UCHAR PSAttachedState = 0;
    UCHAR  IPv4ConnectionStatus = QWDS_PKT_DATA_UNKNOW;
    UCHAR  IPv6ConnectionStatus = QWDS_PKT_DATA_UNKNOW; 
    unsigned SetupCallFail = 0;
    unsigned long SetupCallAllowTime = clock_msec();
    int qmierr = 0;
    const struct request_ops *request_ops = profile ->request_ops;
    pthread_t gQmiThreadID = 0;

//sudo apt-get install udhcpc
//sudo apt-get remove ModemManager
    if (profile->reattach_flag) {
        if (!reattach_driver(profile)) 
            sleep(2);
    }

    /* try to recreate FDs*/
    if (socketpair( AF_LOCAL, SOCK_STREAM, 0, signal_control_fd) < 0 ) {
        dbg_time("%s Faild to create main_control_fd: %d (%s)", __func__, errno, strerror(errno));
        return -1;
    }

    if ( socketpair( AF_LOCAL, SOCK_STREAM, 0, qmidevice_control_fd ) < 0 ) {
        dbg_time("%s Failed to create thread control socket pair: %d (%s)", __func__, errno, strerror(errno));
        return 0;
    }

    if ((profile->qmap_mode == 0 || profile->qmap_mode == 1) && (!profile->proxy[0])) {
        kill_brothers(profile->qmichannel);
     }

    if (pthread_create( &gQmiThreadID, 0, profile->qmi_ops->read, (void *)profile) != 0) {
        dbg_time("%s Failed to create QMIThread: %d (%s)", __func__, errno, strerror(errno));
        return 0;
    }

    if ((read(qmidevice_control_fd[0], &triger_event, sizeof(triger_event)) != sizeof(triger_event))
        || (triger_event != RIL_INDICATE_DEVICE_CONNECTED)) {
        dbg_time("%s Failed to init QMIThread: %d (%s)", __func__, errno, strerror(errno));
        return 0;
    }

    if (profile->qmi_ops->init && profile->qmi_ops->init(profile)) {
        dbg_time("%s Failed to qmi init: %d (%s)", __func__, errno, strerror(errno));
        return 0;
    }

    if (request_ops->requestBaseBandVersion)
        request_ops->requestBaseBandVersion(profile);

    if (request_ops->requestSetEthMode)
        request_ops->requestSetEthMode(profile);

    if (request_ops->requestSetLoopBackState && profile->loopback_state) {
    	request_ops->requestSetLoopBackState(profile->loopback_state, profile->replication_factor);
    	profile->loopback_state = 0;
    }

    if (request_ops->requestGetSIMStatus) {
        qmierr = request_ops->requestGetSIMStatus(&SIMStatus);

        while (qmierr == QMI_ERR_OP_DEVICE_UNSUPPORTED) {
            sleep(1);
            qmierr = request_ops->requestGetSIMStatus(&SIMStatus);
        }

        if ((SIMStatus == SIM_PIN) && profile->pincode && request_ops->requestEnterSimPin) {
            request_ops->requestEnterSimPin(profile->pincode);
        }
    }

    if (SIMStatus == SIM_READY) {
        if (request_ops->requestGetICCID)
            request_ops->requestGetICCID();

        if (request_ops->requestGetIMSI)
            request_ops->requestGetIMSI();
    }

    if (request_ops->requestGetProfile)
        request_ops->requestGetProfile(profile);

    if (request_ops->requestSetProfile && (profile->apn || profile->user || profile->password)) {
        request_ops->requestSetProfile(profile);
    }

    request_ops->requestRegistrationState(&PSAttachedState);

    send_signo_to_main(SIG_EVENT_CHECK);

    while (1)
    {
        struct pollfd pollfds[] = {{signal_control_fd[1], POLLIN, 0}, {qmidevice_control_fd[0], POLLIN, 0}};
        int ne, ret, nevents = sizeof(pollfds)/sizeof(pollfds[0]);

        do {
            ret = poll(pollfds, nevents,  15*1000);
        } while ((ret < 0) && (errno == EINTR));

        if (ret == 0)
        {
            send_signo_to_main(SIG_EVENT_CHECK);
            continue;
        }

        if (ret <= 0) {
            dbg_time("%s poll=%d, errno: %d (%s)", __func__, ret, errno, strerror(errno));
            goto __main_quit;
        }

        for (ne = 0; ne < nevents; ne++) {
            int fd = pollfds[ne].fd;
            short revents = pollfds[ne].revents;

            if (revents & (POLLERR | POLLHUP | POLLNVAL)) {
                dbg_time("%s poll err/hup", __func__);
                dbg_time("epoll fd = %d, events = 0x%04x", fd, revents);
                main_send_event_to_qmidevice(RIL_REQUEST_QUIT);
                if (revents & POLLHUP)
                    goto __main_quit;
            }

            if ((revents & POLLIN) == 0)
                continue;

            if (fd == signal_control_fd[1])
            {
                if (read(fd, &signo, sizeof(signo)) == sizeof(signo))
                {
                    alarm(0);
                    switch (signo)
                    {
                        case SIG_EVENT_START:
                            if (PSAttachedState != 1 && profile->loopback_state == 0)
                                break;
                            
                            if (SetupCallAllowTime > clock_msec()) {
                                alarm((SetupCallAllowTime - clock_msec()+999)/1000);
                                break;
                            }

                            if (profile->enable_ipv4 && IPv4ConnectionStatus !=  QWDS_PKT_DATA_CONNECTED) {
                                qmierr = request_ops->requestSetupDataCall(profile, IpFamilyV4);

                                if ((qmierr > 0) && profile->user && profile->user[0] && profile->password && profile->password[0]) {
                                    int old_auto =  profile->auth;

                                    //may be fail because wrong auth mode, try pap->chap, or chap->pap
                                    profile->auth = (profile->auth == 1) ? 2 : 1;
                                	qmierr = request_ops->requestSetupDataCall(profile, IpFamilyV4);

                                    if (qmierr)
                                        profile->auth = old_auto; //still fail, restore old auth moe
                                }

                                if (!qmierr) {
                                    qmierr = request_ops->requestGetIPAddress(profile, IpFamilyV4);
                                    if (!qmierr)
                                        IPv4ConnectionStatus = QWDS_PKT_DATA_CONNECTED;
                                }
                                        
                            }

                            if (profile->enable_ipv6 && IPv6ConnectionStatus !=  QWDS_PKT_DATA_CONNECTED) {
                                if (profile->enable_ipv4 && profile->request_ops != &qmi_request_ops) {
                                    IPv6ConnectionStatus = IPv4ConnectionStatus;
                                }
                                else {
                                    qmierr = request_ops->requestSetupDataCall(profile, IpFamilyV6);

                                    if (!qmierr) {
                                        qmierr = request_ops->requestGetIPAddress(profile, IpFamilyV6);
                                        if (!qmierr)
                                            IPv6ConnectionStatus = QWDS_PKT_DATA_CONNECTED;
                                    }
                                }
                            }
                                
                            if ((profile->enable_ipv4 && IPv4ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED)
                                    || (profile->enable_ipv6 && IPv6ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED)) {
                                const unsigned allow_time[] = {5, 10, 20, 40, 60};

                                if (SetupCallFail < (sizeof(allow_time)/sizeof(unsigned)))
                                    SetupCallAllowTime = allow_time[SetupCallFail];
                                else
                                    SetupCallAllowTime = 60;
                                SetupCallFail++;
                                dbg_time("try to requestSetupDataCall %ld second later", SetupCallAllowTime);
                                alarm(SetupCallAllowTime);
                                SetupCallAllowTime = SetupCallAllowTime*1000 + clock_msec();
                            }
                            else if (IPv4ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED || IPv6ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED) {
                                SetupCallFail = 0;
                                SetupCallAllowTime = clock_msec();
                            }
                        break;

                        case SIG_EVENT_CHECK:
                            if (request_ops->requestGetSignalInfo)
                                request_ops->requestGetSignalInfo();
                            
                            if (request_ops->requestGetCellInfoList)
                                request_ops->requestGetCellInfoList();

                            if (profile->enable_ipv4 && IPv4ConnectionStatus != QWDS_PKT_DATA_DISCONNECTED
                                && !request_ops->requestQueryDataCall(&IPv4ConnectionStatus, IpFamilyV4))
                            {
                                if (QWDS_PKT_DATA_CONNECTED == IPv4ConnectionStatus && profile->ipv4.Address == 0) {
                                    //killall -9 quectel-CM for MBIM and ATC call
                                    qmierr = request_ops->requestGetIPAddress(profile, IpFamilyV4);
                                    if (qmierr)
                                        IPv4ConnectionStatus = QWDS_PKT_DATA_DISCONNECTED;
                                }

                                //local ip is different with remote ip
                                if (QWDS_PKT_DATA_CONNECTED == IPv4ConnectionStatus && check_ipv4_address(profile) == 0) {
                                    request_ops->requestDeactivateDefaultPDP(profile, IpFamilyV4);
                                    IPv4ConnectionStatus = QWDS_PKT_DATA_DISCONNECTED;
                                }
                            }
                            else {
                                IPv4ConnectionStatus = QWDS_PKT_DATA_DISCONNECTED;
                            }

                            if (profile->enable_ipv6 && IPv6ConnectionStatus != QWDS_PKT_DATA_DISCONNECTED) {
                                if (profile->enable_ipv4 && profile->request_ops != &qmi_request_ops) {
                                    IPv6ConnectionStatus = IPv4ConnectionStatus;
                                }
                                else {
                                    request_ops->requestQueryDataCall(&IPv6ConnectionStatus, IpFamilyV6);
                                }
                            }
                            else {
                                IPv6ConnectionStatus = QWDS_PKT_DATA_DISCONNECTED;
                            }

                            if (IPv4ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED && IPv6ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED) {
                                usbnet_link_change(0, profile);
                            }
                            else if (IPv4ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED || IPv6ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED) {
                                int link = 0;
                                if (IPv4ConnectionStatus == QWDS_PKT_DATA_CONNECTED)
                                    link |= (1<<IpFamilyV4);
                                if (IPv6ConnectionStatus == QWDS_PKT_DATA_CONNECTED)
                                    link |= (1<<IpFamilyV6);
                                usbnet_link_change(link, profile);
                            }
                            
                            if ((profile->enable_ipv4 && IPv4ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED)
                                || (profile->enable_ipv6 && IPv6ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED)) {
                                send_signo_to_main(SIG_EVENT_START);
                            }
                        break;

                        case SIG_EVENT_STOP:
                            if (profile->enable_ipv4 && IPv4ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED) {
                                request_ops->requestDeactivateDefaultPDP(profile, IpFamilyV4);
                            }
                            if (profile->enable_ipv6 && IPv6ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED) {
                                if (profile->enable_ipv4 && profile->request_ops != &qmi_request_ops) {
                                    
                                }
                                else {
                                    request_ops->requestDeactivateDefaultPDP(profile, IpFamilyV6);
                                }
                            }
                            usbnet_link_change(0, profile);
                            if (profile->qmi_ops->deinit)
                                profile->qmi_ops->deinit();
                            main_send_event_to_qmidevice(RIL_REQUEST_QUIT);
                            goto __main_quit;
                        break;

                        default:
                        break;
                    }
                }
            }

            if (fd == qmidevice_control_fd[0]) {
                if (read(fd, &triger_event, sizeof(triger_event)) == sizeof(triger_event)) {
                    switch (triger_event) {
                        case RIL_INDICATE_DEVICE_DISCONNECTED:
                            usbnet_link_change(0, profile);                            
                            goto __main_quit;
                        break;

                        case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED:
                            request_ops->requestRegistrationState(&PSAttachedState);
                            if (PSAttachedState == 1) {
                                if ((profile->enable_ipv4 && IPv4ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED)
                                    || (profile->enable_ipv6 && IPv6ConnectionStatus ==  QWDS_PKT_DATA_DISCONNECTED)) {
                                    send_signo_to_main(SIG_EVENT_START);
                                }
                             } else {
                                SetupCallAllowTime = clock_msec();
                             }
                        break;

                        case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
                            if (IPv4ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED || IPv6ConnectionStatus ==  QWDS_PKT_DATA_CONNECTED) {
                                SetupCallAllowTime = clock_msec() + 1000; //from connect -> disconnect, do not re-dail immediately, wait network stable
                            }
                            send_signo_to_main(SIG_EVENT_CHECK);
                        break;

                        case MODEM_REPORT_RESET_EVENT:
                        {
                            dbg_time("main recv MODEM RESET SIGNAL");
                            main_send_event_to_qmidevice(RIL_REQUEST_QUIT);
                            g_donot_exit_when_modem_hangup = 1;
                            goto __main_quit;
                        }
                        break;

                    	case RIL_UNSOL_LOOPBACK_CONFIG_IND:
                        {
                        	QMI_WDA_SET_LOOPBACK_CONFIG_IND_MSG SetLoopBackInd;
                        	if (read(fd, &SetLoopBackInd, sizeof(SetLoopBackInd)) == sizeof(SetLoopBackInd)) {
                            	profile->loopback_state = SetLoopBackInd.loopback_state.TLVVaule;
                            	profile->replication_factor = le32_to_cpu(SetLoopBackInd.replication_factor.TLVVaule);
                            	dbg_time("SetLoopBackInd: loopback_state=%d, replication_factor=%u",
                                	profile->loopback_state, profile->replication_factor);
                            	if (profile->loopback_state)
                                	send_signo_to_main(SIG_EVENT_START);
                            }
                        }
                    	break;
                        default:
                        break;
                    }
                }
            }
        }
    }

__main_quit:
    usbnet_link_change(0, profile);
    if (gQmiThreadID && pthread_join(gQmiThreadID, NULL)) {
        dbg_time("%s Error joining to listener thread (%s)", __func__, strerror(errno));
    }

    close(signal_control_fd[0]);
    close(signal_control_fd[1]);
    close(qmidevice_control_fd[0]);
    close(qmidevice_control_fd[1]);
    dbg_time("%s exit", __func__);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
andl $0x0, 0x1c(%rsp)
xorl %ebx, %ebx
movb %bl, 0xf(%rsp)
movb %bl, 0xd(%rsp)
movb %bl, 0xe(%rsp)
callq 0xe70d
andq $0x0, 0x68(%rsp)
movq %rax, %r14
movq 0x214dd(%rip), %r12     # 0x29706
cmpb %bl, 0x2136d(%rip)      # 0x2959c
je 0x8249
leaq 0x211a8(%rip), %rdi     # 0x293e0
callq 0x1685b
testl %eax, %eax
jne 0x8249
pushq $0x2
popq %rdi
callq 0x5550
leaq 0x21564(%rip), %rcx     # 0x297b4
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x5300
testl %eax, %eax
js 0x838c
leaq 0x2116d(%rip), %rcx     # 0x293d8
pushq $0x1
popq %rbx
xorl %r15d, %r15d
movl %ebx, %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0x5300
testl %eax, %eax
js 0x840b
cmpl $0x1, 0x2125f(%rip)     # 0x294ea
ja 0x82ef
cmpb $0x0, 0x21174(%rip)     # 0x29408
jne 0x82ef
leaq 0x70(%rsp), %rsi
movq %rsi, 0x50(%rsp)
leaq 0x211c3(%rip), %rax     # 0x2946a
movq %rax, 0x58(%rsp)
leaq 0x14ad0(%rip), %rdi     # 0x1cd83
movl $0x100, %edx            # imm = 0x100
callq 0x50d0
testl %eax, %eax
jle 0x82ef
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, 0x70(%rsp,%rax)
leaq 0x14ac0(%rip), %rdi     # 0x1cd92
leaq 0x10f3(%rip), %rsi      # 0x93cc
leaq 0x50(%rsp), %rdx
callq 0x92e5
testl %eax, %eax
je 0x82ef
pushq $0x1
popq %rdi
callq 0x5550
leaq 0x210ea(%rip), %rcx     # 0x293e0
movq 0x21401(%rip), %rax     # 0x296fe
movq 0x18(%rax), %rdx
xorl %r15d, %r15d
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
callq 0x53e0
testl %eax, %eax
je 0x847f
movq 0x20c99(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movq %rax, %r12
callq 0x5070
movq %rax, %rbx
movl (%rax), %ebp
movl %ebp, %edi
callq 0x5540
leaq 0x148ea(%rip), %rsi     # 0x1cc2c
leaq 0x1489c(%rip), %rcx     # 0x1cbe5
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x21945(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x85cd
callq 0xe343
movq %rax, %r12
movl (%rbx), %ebx
movl %ebx, %edi
callq 0x5540
leaq 0x148a5(%rip), %rsi     # 0x1cc2c
jmp 0x85b0
movq 0x20c25(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movq %rax, %r15
callq 0x5070
movq %rax, %rbx
movl (%rax), %ebp
movl %ebp, %edi
callq 0x5540
leaq 0x147fd(%rip), %rsi     # 0x1cbb3
leaq 0x14828(%rip), %rcx     # 0x1cbe5
movq %r14, %rdi
movq %r15, %rdx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x218d1(%rip), %rax     # 0x29ca8
movq (%rax), %r14
pushq $-0x1
popq %r15
testq %r14, %r14
je 0x85cd
callq 0xe343
movq %rax, %r12
movl (%rbx), %ebx
movl %ebx, %edi
callq 0x5540
leaq 0x147b4(%rip), %rsi     # 0x1cbb3
leaq 0x147df(%rip), %rcx     # 0x1cbe5
jmp 0x85ba
movq 0x20ba6(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movq %rax, %r12
callq 0x5070
movq %rax, %rbx
movl (%rax), %ebp
movl %ebp, %edi
callq 0x5540
leaq 0x147b9(%rip), %rsi     # 0x1cbee
leaq 0x147a9(%rip), %rcx     # 0x1cbe5
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x21852(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x85cd
callq 0xe343
movq %rax, %r12
movl (%rbx), %ebx
movl %ebx, %edi
callq 0x5540
leaq 0x14774(%rip), %rsi     # 0x1cbee
jmp 0x85b0
movl 0x20f53(%rip), %edi     # 0x293d8
leaq 0x1c(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x5250
cmpq $0x4, %rax
jne 0x8542
cmpl $0x1002, 0x1c(%rsp)     # imm = 0x1002
jne 0x8542
movq 0x2124d(%rip), %rax     # 0x296fe
movq (%rax), %rax
testq %rax, %rax
je 0x85e2
leaq 0x20f1c(%rip), %rdi     # 0x293e0
callq *%rax
testl %eax, %eax
je 0x85e2
movq 0x20ae3(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movq %rax, %r12
callq 0x5070
movq %rax, %rbx
movl (%rax), %ebp
movl %ebp, %edi
callq 0x5540
leaq 0x1478c(%rip), %rsi     # 0x1cc84
leaq 0x146e6(%rip), %rcx     # 0x1cbe5
xorl %r15d, %r15d
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x2178c(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x85cd
callq 0xe343
movq %rax, %r12
movl (%rbx), %ebx
movl %ebx, %edi
callq 0x5540
leaq 0x14744(%rip), %rsi     # 0x1cc84
jmp 0x85b0
movq 0x20a6f(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movq %rax, %r12
callq 0x5070
movq %rax, %rbx
movl (%rax), %ebp
movl %ebp, %edi
callq 0x5540
leaq 0x146ed(%rip), %rsi     # 0x1cc59
leaq 0x14672(%rip), %rcx     # 0x1cbe5
xorl %r15d, %r15d
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
leaq 0x21718(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x85cd
callq 0xe343
movq %rax, %r12
movl (%rbx), %ebx
movl %ebx, %edi
callq 0x5540
leaq 0x146a9(%rip), %rsi     # 0x1cc59
leaq 0x1462e(%rip), %rcx     # 0x1cbe5
xorl %r15d, %r15d
movq %r14, %rdi
movq %r12, %rdx
movl %ebx, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movl %r15d, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rax
testq %rax, %rax
je 0x85f4
leaq 0x20dee(%rip), %rdi     # 0x293e0
callq *%rax
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x8607
leaq 0x20ddb(%rip), %rdi     # 0x293e0
callq *%rax
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x862d
movb 0x20fde(%rip), %cl      # 0x295f5
testb %cl, %cl
je 0x862d
movl 0x20e45(%rip), %esi     # 0x29466
movzbl %cl, %edi
callq *%rax
movb $0x0, 0x20fc8(%rip)     # 0x295f5
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x8678
leaq 0x2c(%rsp), %r15
pushq $0x1
popq %rbp
movq %r15, %rdi
callq *%rax
cmpl $0x19, %eax
jne 0x8657
movl %ebp, %edi
callq 0x5550
movq 0x18(%r12), %rax
jmp 0x863f
movl 0x2c(%rsp), %eax
cmpl $0x3, %eax
jne 0x867c
movq 0x20d99(%rip), %rdi     # 0x29400
testq %rdi, %rdi
je 0x8699
movq 0x20(%r12), %rax
testq %rax, %rax
je 0x8678
callq *%rax
movl 0x2c(%rsp), %eax
cmpl $0x2, %eax
jne 0x8699
movq 0x70(%r12), %rax
testq %rax, %rax
je 0x868d
callq *%rax
movq 0x78(%r12), %rax
testq %rax, %rax
je 0x8699
callq *%rax
movq 0x30(%r12), %rax
testq %rax, %rax
je 0x86ac
leaq 0x20d36(%rip), %rdi     # 0x293e0
callq *%rax
movq %r14, 0x20(%rsp)
movq 0x28(%r12), %rax
testq %rax, %rax
je 0x86e2
cmpq $0x0, 0x20d1d(%rip)     # 0x293e0
jne 0x86d9
cmpq $0x0, 0x20d1b(%rip)     # 0x293e8
jne 0x86d9
cmpq $0x0, 0x20d19(%rip)     # 0x293f0
je 0x86e2
leaq 0x20d00(%rip), %rdi     # 0x293e0
callq *%rax
leaq 0xf(%rsp), %rdi
movq %r12, 0x10(%rsp)
callq *0x38(%r12)
movl %ebx, %edi
callq 0x81c0
leaq 0x70(%rsp), %r12
pushq $0x2
popq %r14
movl $0x0, 0x18(%rsp)
movl 0x210a9(%rip), %eax     # 0x297b8
movl %eax, 0x70(%rsp)
movl %ebx, 0x74(%rsp)
movl 0x20cbb(%rip), %eax     # 0x293d8
movl %eax, 0x78(%rsp)
movl %ebx, 0x7c(%rsp)
movq %r12, %rdi
movq %r14, %rsi
movl $0x3a98, %edx           # imm = 0x3A98
callq 0x53d0
testl %eax, %eax
jns 0x874a
movl %eax, %ebp
callq 0x5070
cmpl $0x4, (%rax)
je 0x8725
jmp 0x8fb5
je 0x8fa1
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x8fad
movl 0x70(%rsp,%rbx,8), %r15d
movswl 0x76(%rsp,%rbx,8), %ebp
testb $0x38, %bpl
je 0x8842
movl %r15d, %r14d
movq %rbx, %r13
movq 0x2083b(%rip), %rax     # 0x28fb8
movq (%rax), %r12
callq 0xe343
movq %r12, %rdi
leaq 0x1451a(%rip), %rbx     # 0x1cca9
movq %rbx, %rsi
movq %rax, %rdx
leaq 0x14449(%rip), %r15     # 0x1cbe5
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x214fb(%rip), %rax     # 0x29ca8
movq (%rax), %r12
testq %r12, %r12
je 0x87cd
callq 0xe343
movq %r12, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x52c0
movq 0x207e4(%rip), %rax     # 0x28fb8
movq (%rax), %r12
callq 0xe343
movq %r12, %rdi
leaq 0x13bb0(%rip), %rbx     # 0x1c396
movq %rbx, %rsi
movq %rax, %rdx
movl %r14d, %r15d
movl %r14d, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x214a5(%rip), %rax     # 0x29ca8
movq (%rax), %r12
testq %r12, %r12
je 0x8826
callq 0xe343
movq %r12, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movl %r15d, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x52c0
movl $0x1000, %edi           # imm = 0x1000
callq 0x81d8
testb $0x10, %bpl
leaq 0x70(%rsp), %r12
movq %r13, %rbx
jne 0x904f
testb $0x1, %bpl
jne 0x8851
pushq $0x2
popq %r14
jmp 0x8b6f
cmpl 0x20f60(%rip), %r15d    # 0x297b8
pushq $0x2
popq %r14
leaq 0x144b2(%rip), %rbp     # 0x1cd15
jne 0x8a0a
movl %r15d, %edi
leaq 0x4c(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x5250
cmpq $0x4, %rax
jne 0x8a0a
xorl %edi, %edi
callq 0x5220
movl 0x4c(%rsp), %eax
testl %eax, %eax
je 0x892d
cmpl $0x1, %eax
je 0x88a9
cmpl $0x2, %eax
jne 0x8a0a
jmp 0x917e
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rax
testq %rax, %rax
je 0x88b9
callq *%rax
movq 0x10(%rsp), %rax
movq 0x68(%rax), %rax
testq %rax, %rax
je 0x88c9
callq *%rax
cmpb $0x0, 0x20b60(%rip)     # 0x29430
je 0x88f1
cmpb $0x1, 0xd(%rsp)
je 0x88f1
leaq 0xd(%rsp), %rdi
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rax
callq *0x48(%rax)
testl %eax, %eax
je 0x8c1a
movb $0x1, 0xd(%rsp)
cmpb $0x0, 0x20b34(%rip)     # 0x29431
je 0x8983
cmpb $0x1, 0xe(%rsp)
je 0x8983
cmpb $0x0, 0x20b1f(%rip)     # 0x29430
je 0x898c
leaq 0x1f986(%rip), %rax     # 0x282a0
cmpq %rax, 0x20de5(%rip)     # 0x29706
je 0x898c
movb 0xd(%rsp), %al
movb %al, 0xe(%rsp)
jmp 0x89a0
cmpb $0x1, 0xf(%rsp)
je 0x8941
cmpb $0x0, 0x20cba(%rip)     # 0x295f5
je 0x8a0a
callq 0xe70d
movq 0x20(%rsp), %r14
cmpq %rax, %r14
jbe 0x8b77
callq 0xe70d
movq %r14, %rcx
subq %rax, %rcx
addq $0x3e7, %rcx            # imm = 0x3E7
movq %rcx, %rax
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
divq %rcx
movl %eax, %edi
callq 0x5220
pushq $0x2
popq %r14
jmp 0x8a0a
movb $0x1, 0xe(%rsp)
movb $0x1, %al
jmp 0x89a0
leaq 0xe(%rsp), %rdi
pushq $0x6
popq %rsi
movq 0x10(%rsp), %rax
callq *0x48(%rax)
movb 0xe(%rsp), %al
movb 0xd(%rsp), %cl
movl %ecx, %edx
xorb $0x1, %dl
movl %eax, %esi
xorb $0x1, %sil
xorl %edi, %edi
orb %dl, %sil
je 0x89de
cmpb $0x2, %cl
sete %dl
cmpb $0x2, %al
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x89e3
xorl %edx, %edx
cmpb $0x2, %cl
sete %dl
shll $0x4, %edx
leal 0x40(%rdx), %edi
cmpb $0x2, %al
cmovnel %edx, %edi
callq 0x926e
cmpb $0x0, 0x20a46(%rip)     # 0x29430
je 0x89f3
cmpb $0x1, 0xd(%rsp)
je 0x8a03
cmpb $0x0, 0x20a37(%rip)     # 0x29431
je 0x8a0a
cmpb $0x1, 0xe(%rsp)
jne 0x8a0a
xorl %edi, %edi
callq 0x81c0
cmpl 0x209c7(%rip), %r15d    # 0x293d8
jne 0x8b6f
movl %r15d, %edi
leaq 0x1c(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x5250
cmpq $0x4, %rax
jne 0x8b6f
movl 0x1c(%rsp), %eax
movl $0xffffeffd, %ecx       # imm = 0xFFFFEFFD
addl %ecx, %eax
cmpl $0x4, %eax
ja 0x8b6f
leaq 0x13a28(%rip), %rcx     # 0x1c474
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xf(%rsp), %rdi
movq 0x10(%rsp), %rax
callq *0x38(%rax)
cmpb $0x1, 0xf(%rsp)
jne 0x8b65
cmpb $0x0, 0x209bc(%rip)     # 0x29430
je 0x8a81
cmpb $0x1, 0xd(%rsp)
je 0x8b39
cmpb $0x0, 0x209a9(%rip)     # 0x29431
je 0x8b6f
cmpb $0x1, 0xe(%rsp)
je 0x8b39
jmp 0x8b6f
movl %r15d, %edi
leaq 0x50(%rsp), %rsi
pushq $0xf
popq %rdx
callq 0x5250
cmpq $0xf, %rax
jne 0x8b6f
movb 0x57(%rsp), %al
movb %al, 0x20b33(%rip)      # 0x295f5
movl 0x5b(%rsp), %edi
callq 0xe741
movl %eax, 0x20995(%rip)     # 0x29466
movq 0x204e0(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movzbl 0x20b0e(%rip), %ecx     # 0x295f5
movl 0x20978(%rip), %r8d     # 0x29466
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x211a3(%rip), %rax     # 0x29ca8
movq (%rax), %r15
testq %r15, %r15
je 0x8b30
callq 0xe343
movzbl 0x20adc(%rip), %ecx     # 0x295f5
movl 0x20946(%rip), %r8d     # 0x29466
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
cmpb $0x0, 0x20abe(%rip)     # 0x295f5
je 0x8b6f
xorl %edi, %edi
jmp 0x8b5e
cmpb $0x2, 0xd(%rsp)
je 0x8b4b
cmpb $0x2, 0xe(%rsp)
jne 0x8b5b
callq 0xe70d
addq $0x3e8, %rax            # imm = 0x3E8
movq %rax, 0x20(%rsp)
pushq $0x1
popq %rdi
callq 0x81c0
jmp 0x8b6f
callq 0xe70d
movq %rax, 0x20(%rsp)
incq %rbx
jmp 0x8752
cmpb $0x0, 0x208b2(%rip)     # 0x29430
pushq $0x2
popq %r14
je 0x8e2b
cmpb $0x2, 0xd(%rsp)
je 0x8e2b
leaq 0x20846(%rip), %rdi     # 0x293e0
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rax
callq *0x40(%rax)
testl %eax, %eax
jle 0x8e0e
movq 0x20834(%rip), %rax     # 0x293e8
testq %rax, %rax
je 0x8e2b
cmpb $0x0, (%rax)
je 0x8e2b
movq 0x20823(%rip), %rax     # 0x293f0
testq %rax, %rax
je 0x8e2b
cmpb $0x0, (%rax)
je 0x8e2b
movl 0x20813(%rip), %ebp     # 0x293f8
xorl %eax, %eax
cmpl $0x1, %ebp
sete %al
incl %eax
movl %eax, 0x20803(%rip)     # 0x293f8
leaq 0x207e4(%rip), %rdi     # 0x293e0
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rax
callq *0x40(%rax)
testl %eax, %eax
je 0x8e10
movl %ebp, 0x207e3(%rip)     # 0x293f8
jmp 0x8e2b
movb 0xd(%rsp), %al
cmpb $0x2, %al
jne 0x8c49
cmpl $0x0, 0x208dd(%rip)     # 0x29506
jne 0x8c49
leaq 0x207ae(%rip), %rdi     # 0x293e0
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rax
callq *0x58(%rax)
testl %eax, %eax
jne 0x88f1
movb 0xd(%rsp), %al
cmpb $0x2, %al
jne 0x88f6
movq 0x20aae(%rip), %rax     # 0x29706
cmpq 0x20381(%rip), %rax     # 0x28fe0
sete %cl
cmpq 0x20357(%rip), %rax     # 0x28fc0
sete %dl
orb %cl, %dl
jne 0x88f6
movl 0x2088b(%rip), %r13d    # 0x29506
leaq 0x2075e(%rip), %rdi     # 0x293e0
pushq $0x4
popq %rsi
callq *0x58(%rax)
testl %eax, %eax
jne 0x8df7
movl %r13d, %r12d
shrl $0x8, %r12d
movl %r13d, %ebp
shrl $0x10, %ebp
movl %r13d, %eax
andl $0xff000000, %eax       # imm = 0xFF000000
movl $0xff, %edx
andl %edx, %ebp
movl %ebp, %ecx
shll $0x10, %ecx
orl %eax, %ecx
andl %edx, %r12d
movl %r12d, 0x28(%rsp)
shll $0x8, %r12d
orl %ecx, %r12d
movl %r13d, %eax
andl %edx, %eax
movq %rax, 0x60(%rsp)
orl %eax, %r12d
cmpl %r12d, 0x20830(%rip)    # 0x29506
jne 0x8ce5
cmpl $0x0, 0x206f1(%rip)     # 0x293d0
je 0x8dde
shrl $0x18, %r13d
movq 0x202c8(%rip), %rax     # 0x28fb8
movq (%rax), %rax
movq %rax, 0x30(%rsp)
callq 0xe343
movzbl 0x20805(%rip), %ecx     # 0x29509
movq %rcx, 0x40(%rsp)
movzbl 0x207f8(%rip), %ecx     # 0x29508
movq %rcx, 0x38(%rsp)
movzbl 0x207ea(%rip), %r10d    # 0x29507
movzbl 0x207e1(%rip), %r11d    # 0x29506
subq $0x8, %rsp
movq 0x38(%rsp), %rdi
leaq 0x140f2(%rip), %rsi     # 0x1ce27
movq %rax, %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl 0x30(%rsp), %r9d
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x50(%rsp)
pushq 0x60(%rsp)
pushq 0x88(%rsp)
callq 0x52c0
addq $0x30, %rsp
leaq 0x20f40(%rip), %rax     # 0x29ca8
movq (%rax), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x8dde
callq 0xe343
movzbl 0x20788(%rip), %ecx     # 0x29509
movq %rcx, 0x38(%rsp)
movzbl 0x2077b(%rip), %ecx     # 0x29508
movq %rcx, 0x30(%rsp)
movzbl 0x2076d(%rip), %r10d    # 0x29507
movzbl 0x20764(%rip), %r11d    # 0x29506
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
leaq 0x14075(%rip), %rsi     # 0x1ce27
movq %rax, %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl 0x30(%rsp), %r9d
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x48(%rsp)
pushq 0x58(%rsp)
pushq 0x88(%rsp)
callq 0x52c0
addq $0x30, %rsp
cmpl %r12d, 0x20721(%rip)    # 0x29506
leaq 0x70(%rsp), %r12
leaq 0x13f24(%rip), %rbp     # 0x1cd15
je 0x88f6
leaq 0x205e2(%rip), %rdi     # 0x293e0
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rax
callq *0x50(%rax)
jmp 0x88f1
jne 0x8e2b
leaq 0x205c9(%rip), %rdi     # 0x293e0
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rax
callq *0x58(%rax)
testl %eax, %eax
jne 0x8e2b
movb $0x2, 0xd(%rsp)
cmpb $0x0, 0x205ff(%rip)     # 0x29431
leaq 0x13edc(%rip), %rbp     # 0x1cd15
je 0x8e96
cmpb $0x2, 0xe(%rsp)
je 0x8e96
cmpb $0x0, 0x205e7(%rip)     # 0x29430
je 0x8e65
leaq 0x1f44e(%rip), %rax     # 0x282a0
cmpq %rax, 0x208ad(%rip)     # 0x29706
je 0x8e65
movb 0xd(%rsp), %al
movb %al, 0xe(%rsp)
jmp 0x8e96
leaq 0x20574(%rip), %rdi     # 0x293e0
pushq $0x6
popq %rsi
movq 0x10(%rsp), %rax
callq *0x40(%rax)
testl %eax, %eax
jne 0x8e96
leaq 0x2055e(%rip), %rdi     # 0x293e0
pushq $0x6
popq %rsi
movq 0x10(%rsp), %rax
callq *0x58(%rax)
testl %eax, %eax
jne 0x8e96
movb $0x2, 0xe(%rsp)
cmpb $0x0, 0x20593(%rip)     # 0x29430
setne %cl
movb 0xd(%rsp), %al
cmpb $0x1, %al
sete %dl
testb %dl, %cl
jne 0x8ecf
cmpb $0x0, 0x2057d(%rip)     # 0x29431
setne %dl
movb 0xe(%rsp), %cl
cmpb $0x1, %cl
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x8f74
movl %r15d, %r13d
pushq $0x3c
popq %r14
cmpl $0x4, 0x18(%rsp)
ja 0x8eec
movl 0x18(%rsp), %eax
leaq 0x135a8(%rip), %rcx     # 0x1c490
movl (%rcx,%rax,4), %r14d
movq 0x200c5(%rip), %rax     # 0x28fb8
movq (%rax), %r12
callq 0xe343
movq %r12, %rdi
leaq 0x13dba(%rip), %r15     # 0x1ccbf
movq %r15, %rsi
movq %rax, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x52c0
leaq 0x20d8c(%rip), %rax     # 0x29ca8
movq (%rax), %r12
testq %r12, %r12
je 0x8f3c
callq 0xe343
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x52c0
incl 0x18(%rsp)
movl %r14d, %edi
callq 0x5220
imulq $0x3e8, %r14, %r12      # imm = 0x3E8
callq 0xe70d
addq %r12, %rax
movq %rax, 0x20(%rsp)
leaq 0x70(%rsp), %r12
pushq $0x2
popq %r14
leaq 0x13da9(%rip), %rbp     # 0x1cd15
movl %r13d, %r15d
jmp 0x8a0a
cmpb $0x2, %al
sete %al
cmpb $0x2, %cl
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x8a0a
movl $0x0, 0x18(%rsp)
callq 0xe70d
movq %rax, 0x20(%rsp)
jmp 0x8a0a
movl %ebx, %edi
callq 0x81c0
jmp 0x8709
pushq $0x1
popq %rbx
jmp 0x8709
movq %rax, %r15
movq 0x1fff9(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
movq %rax, %r14
movl (%r15), %r12d
movl %r12d, %edi
callq 0x5540
movq %rax, %r10
subq $0x8, %rsp
leaq 0x13194(%rip), %rsi     # 0x1c177
leaq 0x13bfb(%rip), %rcx     # 0x1cbe5
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %r8d
movl %r12d, %r9d
xorl %eax, %eax
pushq %r10
callq 0x52c0
popq %rcx
popq %rdx
leaq 0x20ca0(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x904f
callq 0xe343
movq %rax, %r14
movl (%r15), %r15d
movl %r15d, %edi
callq 0x5540
movq %rax, %r10
subq $0x8, %rsp
leaq 0x13146(%rip), %rsi     # 0x1c177
leaq 0x13bad(%rip), %rcx     # 0x1cbe5
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %r8d
movl %r15d, %r9d
xorl %eax, %eax
pushq %r10
callq 0x52c0
popq %rcx
popq %rdx
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x926e
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x90ed
xorl %esi, %esi
callq 0x5520
testl %eax, %eax
je 0x90ed
movq 0x1ff3f(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
movq %rax, %r12
callq 0x5070
movq %rax, %rbx
movl (%rax), %edi
callq 0x5540
leaq 0x13cba(%rip), %rsi     # 0x1cd54
leaq 0x13b44(%rip), %rcx     # 0x1cbe5
movq %r14, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x52c0
leaq 0x20bf0(%rip), %rax     # 0x29ca8
movq (%rax), %r14
testq %r14, %r14
je 0x90ed
callq 0xe343
movq %rax, %r12
movl (%rbx), %edi
callq 0x5540
leaq 0x13c7e(%rip), %rsi     # 0x1cd54
leaq 0x13b08(%rip), %rcx     # 0x1cbe5
movq %r14, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x52c0
movl 0x206c1(%rip), %edi     # 0x297b4
callq 0x5230
movl 0x206ba(%rip), %edi     # 0x297b8
callq 0x5230
movl 0x202cf(%rip), %edi     # 0x293d8
callq 0x5230
movl 0x202c8(%rip), %edi     # 0x293dc
callq 0x5230
movq 0x1fe98(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0x130f9(%rip), %rsi     # 0x1c228
leaq 0x13aaf(%rip), %rcx     # 0x1cbe5
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x20b5e(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x85cd
callq 0xe343
leaq 0x130c6(%rip), %rsi     # 0x1c228
leaq 0x13a7c(%rip), %rcx     # 0x1cbe5
xorl %r15d, %r15d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
jmp 0x85cd
cmpb $0x0, 0x202ab(%rip)     # 0x29430
movq 0x10(%rsp), %rbx
je 0x91a0
cmpb $0x2, 0xd(%rsp)
jne 0x91a0
leaq 0x20246(%rip), %rdi     # 0x293e0
pushq $0x4
popq %rsi
callq *0x50(%rbx)
cmpb $0x0, 0x2028a(%rip)     # 0x29431
je 0x91d6
cmpb $0x2, 0xe(%rsp)
jne 0x91d6
cmpb $0x0, 0x20279(%rip)     # 0x29430
je 0x91c9
movq 0x20546(%rip), %rax     # 0x29706
cmpq 0x1fe09(%rip), %rax     # 0x28fd0
jne 0x91d6
leaq 0x20210(%rip), %rdi     # 0x293e0
pushq $0x6
popq %rsi
callq *0x50(%rbx)
xorl %edi, %edi
callq 0x926e
movq 0x2051a(%rip), %rax     # 0x296fe
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x91ef
callq *%rax
movl $0x1000, %edi           # imm = 0x1000
callq 0x81d8
jmp 0x904f
movq 0x1fdb3(%rip), %rax     # 0x28fb8
movq (%rax), %rbx
callq 0xe343
leaq 0x13ade(%rip), %rsi     # 0x1ccf2
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x20a80(%rip), %rax     # 0x29ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x9249
callq 0xe343
leaq 0x13ab6(%rip), %rsi     # 0x1ccf2
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movl $0x1000, %edi           # imm = 0x1000
callq 0x81d8
movl $0x1, 0x20177(%rip)     # 0x293d4
jmp 0x904f
xorl %edi, %edi
callq 0x926e
jmp 0x904f