// File: Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: main
int main(int argc, char *argv[])
{
/*
    static int ret = -1;
    while (true)
    {
        ret = iModbusTCP();
        sleep(1);
    }
 */
//    signgam(EPIPE, SIG_IGN);
 for (int i=1; i < argc; i++)
 {
     // Ausgabe aller Parameter
     printf(" %i %s",i,argv[i]);
     // Auf speziellen Parameter prüfen
     if((strcmp(argv[i], "-config") == 0)||(strcmp(argv[i], "-conf") == 0)||(strcmp(argv[i], "-c") == 0))
     strcpy(e3dc_config.conffile, argv[i+1]);
 }
    

static int iEC = 0;
 time(&t);
    t_alt = t;
    float f1=0,f2=0;
//    shellyem_get(f1,f2);

    // endless application which re-connections to server on connection lost
    int res = system("pwd");
    GetConfig();
    e3dc_config.stop = 0; // Stop ausschalten
    
    if (e3dc_config.statistik)
    {
        FILE * pFile;
        pFile = NULL;
        pFile = fopen ("Weekhour.dat","rb");
        if (pFile!=NULL)
        {
            size_t x1 = sizeof(iWeekhour);
            x1 = fread (&iWeekhour , sizeof(uint32_t), sizeof(iWeekhour)/sizeof(uint32_t), pFile);
            fclose (pFile);
        }
        pFile = NULL;
        pFile = fopen ("WeekhourWP.dat","rb");
        if (pFile!=NULL)
        {
            size_t x1 = sizeof(iWeekhourWP);
            x1 = fread (&iWeekhourWP , sizeof(uint32_t), sizeof(iWeekhourWP)/sizeof(uint32_t), pFile);
            fclose (pFile);
        }
        pFile = NULL;
        pFile = fopen ("HeatStat.dat","rb");
        if (pFile!=NULL)
        {
            size_t x1 = sizeof(iHeatStat);
            x1 = fread (&iHeatStat , sizeof(uint32_t), sizeof(iHeatStat)/sizeof(uint32_t), pFile);
            fclose (pFile);
        }

        pFile = NULL;
        char fname[100];
        time(&t);
        int day = (t%(24*3600*28))/(24*3600);
        sprintf(fname,"%s.dat","PVStat");
        pFile = fopen(fname,"rb");       // altes logfile löschen

        if (pFile!=NULL)
        {
            size_t x1 = sizeof(iDayStat);
            x1 = fread (&iDayStat , sizeof(uint32_t), sizeof(iDayStat)/sizeof(uint32_t), pFile);
            fclose (pFile);
        }
        pFile = NULL;
        sprintf(fnameGrid,"Grid.%i.%i.dat",ptm->tm_year%100,ptm->tm_mon+1);
        pFile = fopen(fnameGrid,"rb");       // altes logfile löschen

        if (pFile!=NULL)
        {
            size_t x1 = sizeof(iGridStat);
            x1 = fread (&iGridStat, sizeof(int32_t), sizeof(iGridStat)/sizeof(int32_t), pFile);
            fclose (pFile);
        }
        GetWallbox(ch);
    }
    
        while(iEC < 10&&e3dc_config.stop==0||e3dc_config.stop>99)
        {

            e3dc_config.stop=0;
            iEC++; // Schleifenzähler erhöhen
            int hh1 = sunsetAt / 60;
            int mm1 = sunsetAt % 60;
            int hh = sunriseAt / 60;
            int mm = sunriseAt % 60;
            sprintf(Log,"Start %s %s", strtok(asctime(ptm),"\n"),VERSION);
            WriteLog();
            // connect to server
            printf("Program Start Version:%s\n",VERSION);
            printf("Sonnenaufgang %i:%i %i:%i\n", hh, mm, hh1, mm1);
//            CheckConfig();
//            printf("GetConfig done");
            if ((e3dc_config.aWATTar||e3dc_config.openmeteo))
            {
                mewp(w,wetter,fatemp,fcop,sunriseAt,sunsetAt,e3dc_config,55.5,ireq_Heistab,-99,fNotstromreserve,iHeatStat[1]);
                aWATTar(ch,w,wetter,e3dc_config,fBatt_SOC, fNotstromreserve, sunriseAt, iDayStat); // im Master nicht aufrufen
                if (e3dc_config.test)
                    mewp(w,wetter,fatemp,fcop,sunriseAt,sunsetAt,e3dc_config,55.5,ireq_Heistab,5,fNotstromreserve,iHeatStat[1]);
            }
            while (e3dc_config.test)
                LoadDataProcess();

            LoadDataProcess();

        printf("Connecting to server %s:%i\n", e3dc_config.server_ip, e3dc_config.server_port);
        iSocket = SocketConnect(e3dc_config.server_ip, e3dc_config.server_port);
        if(iSocket < 0) 
        {
            printf("Connection failed\n");
            sleep(1);
            continue;
        }
        printf("Connected successfully\n");

        // reset authentication flag
        iAuthenticated = 0;

        // create AES key and set AES parameters
        {
            // initialize AES encryptor and decryptor IV
            memset(ucDecryptionIV, 0xff, AES_BLOCK_SIZE);
            memset(ucEncryptionIV, 0xff, AES_BLOCK_SIZE);

            // limit password length to AES_KEY_SIZE
            int64_t iPasswordLength = strlen(e3dc_config.aes_password);
            if(iPasswordLength > AES_KEY_SIZE)
                iPasswordLength = AES_KEY_SIZE;

            // copy up to 32 bytes of AES key password
            uint8_t ucAesKey[AES_KEY_SIZE];
            memset(ucAesKey, 0xff, AES_KEY_SIZE);
            memcpy(ucAesKey, e3dc_config.aes_password, iPasswordLength);

            // set encryptor and decryptor parameters
            aesDecrypter.SetParameters(AES_KEY_SIZE * 8, AES_BLOCK_SIZE * 8);
            aesEncrypter.SetParameters(AES_KEY_SIZE * 8, AES_BLOCK_SIZE * 8);
            aesDecrypter.StartDecryption(ucAesKey);
            aesEncrypter.StartEncryption(ucAesKey);
        }

        // enter the main transmit / receive loop
        mainLoop();
        printf("mainloop beendet %i\n",iEC);
        // close socket connection
        SocketClose(iSocket);
        iSocket = -1;
        if (!e3dc_config.stop)
            sleep(1);
            printf("Program stop Reason e3dc_config.stop=%i",e3dc_config.stop);
            if (e3dc_config.statistik)
            {
                FILE * pFile;
                pFile = NULL;
                pFile = fopen ("Weekhour.dat","wb");
                if (pFile!=NULL)
                {
                    fwrite (iWeekhour , sizeof(uint32_t), sizeof(iWeekhour)/sizeof(uint32_t), pFile);
                    fclose (pFile);
                }
                pFile = fopen ("WeekhourWP.dat","wb");
                if (pFile!=NULL)
                {
                    fwrite (iWeekhourWP , sizeof(uint32_t), sizeof(iWeekhourWP)/sizeof(uint32_t), pFile);
                    fclose (pFile);
                }
                pFile = fopen ("HeatStat.dat","wb");
                if (pFile!=NULL)
                {
                    size_t x1;
                    x1 = fwrite (iHeatStat , sizeof(uint32_t), sizeof(iHeatStat)/sizeof(uint32_t), pFile);
                    fclose (pFile);
                }
                char fname[100];
                time(&t);
                int day = (t%(24*3600*28))/(24*3600);
                sprintf(fname,"%s.dat","PVStat");
                pFile = fopen(fname,"wb");       // altes logfile löschen

                if (pFile!=NULL)
                {
                    x1 = fwrite (iDayStat , sizeof(uint32_t), sizeof(iDayStat)/sizeof(uint32_t), pFile);
                    fclose (pFile);
                }
                pFile = fopen(fnameGrid,"wb");       // datei zurückschreiben
                if (pFile!=NULL)
                {
                    x1 = fwrite (iGridStat , sizeof(int32_t), sizeof(iGridStat)/sizeof(int32_t), pFile);
                    fclose (pFile);
                }
                PutWallbox(ch);
            }

    }

    printf("Programm wirklich beendet\n");
    
    return 0;
}

// Assembly:
subq $0x198, %rsp            # imm = 0x198
movl $0x0, 0x194(%rsp)
movl %edi, 0x190(%rsp)
movq %rsi, 0x188(%rsp)
movl $0x1, 0x184(%rsp)
movl 0x184(%rsp), %eax
cmpl 0x190(%rsp), %eax
jge 0x1ade5
movl 0x184(%rsp), %esi
movq 0x188(%rsp), %rax
movslq 0x184(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x46d6a(%rip), %rdi     # 0x61a9c
movb $0x0, %al
callq 0x2040
movq 0x188(%rsp), %rax
movslq 0x184(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x46d4f(%rip), %rsi     # 0x61aa3
callq 0x23c0
cmpl $0x0, %eax
je 0x1ada8
movq 0x188(%rsp), %rax
movslq 0x184(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x46d32(%rip), %rsi     # 0x61aab
callq 0x23c0
cmpl $0x0, %eax
je 0x1ada8
movq 0x188(%rsp), %rax
movslq 0x184(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x46d13(%rip), %rsi     # 0x61ab1
callq 0x23c0
cmpl $0x0, %eax
jne 0x1adcd
movq 0x188(%rsp), %rax
movl 0x184(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x53e88(%rip), %rdi     # 0x6ec50
callq 0x2290
jmp 0x1adcf
movl 0x184(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x184(%rsp)
jmp 0x1acfc
leaq 0x54e0c(%rip), %rdi     # 0x6fbf8
callq 0x2280
movq 0x54e00(%rip), %rax     # 0x6fbf8
movq %rax, 0x561c9(%rip)     # 0x70fc8
xorps %xmm0, %xmm0
movss %xmm0, 0x180(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x17c(%rsp)
leaq 0x46c96(%rip), %rdi     # 0x61ab4
callq 0x2240
movl %eax, 0x178(%rsp)
callq 0x32a0
movb $0x0, 0x54040(%rip)     # 0x6ee76
testb $0x1, 0x5402f(%rip)     # 0x6ee6c
je 0x1b107
movq $0x0, 0x170(%rsp)
leaq 0x45f6e(%rip), %rdi     # 0x60dc4
leaq 0x45877(%rip), %rsi     # 0x606d4
callq 0x2300
movq %rax, 0x170(%rsp)
cmpq $0x0, 0x170(%rsp)
je 0x1aeb4
movq $0xaa8, 0x168(%rsp) # imm = 0xAA8
movq 0x170(%rsp), %rcx
leaq 0x59ad0(%rip), %rdi     # 0x74960
movl $0x4, %esi
movl $0x2aa, %edx            # imm = 0x2AA
callq 0x2410
movq %rax, 0x168(%rsp)
movq 0x170(%rsp), %rdi
callq 0x22c0
movq $0x0, 0x170(%rsp)
leaq 0x45f0a(%rip), %rdi     # 0x60dd1
leaq 0x45806(%rip), %rsi     # 0x606d4
callq 0x2300
movq %rax, 0x170(%rsp)
cmpq $0x0, 0x170(%rsp)
je 0x1af25
movq $0xaa8, 0x160(%rsp) # imm = 0xAA8
movq 0x170(%rsp), %rcx
leaq 0x58faf(%rip), %rdi     # 0x73eb0
movl $0x4, %esi
movl $0x2aa, %edx            # imm = 0x2AA
callq 0x2410
movq %rax, 0x160(%rsp)
movq 0x170(%rsp), %rdi
callq 0x22c0
movq $0x0, 0x170(%rsp)
leaq 0x46b80(%rip), %rdi     # 0x61ab8
leaq 0x45795(%rip), %rsi     # 0x606d4
callq 0x2300
movq %rax, 0x170(%rsp)
cmpq $0x0, 0x170(%rsp)
je 0x1af96
movq $0x188, 0x158(%rsp) # imm = 0x188
movq 0x170(%rsp), %rcx
leaq 0x5a49e(%rip), %rdi     # 0x75410
movl $0x4, %esi
movl $0x62, %edx
callq 0x2410
movq %rax, 0x158(%rsp)
movq 0x170(%rsp), %rdi
callq 0x22c0
movq $0x0, 0x170(%rsp)
leaq 0x54c4f(%rip), %rdi     # 0x6fbf8
callq 0x2280
movq 0x54c43(%rip), %rax     # 0x6fbf8
movl $0x24ea00, %ecx         # imm = 0x24EA00
cqto
idivq %rcx
movq %rdx, %rax
movl $0x15180, %ecx          # imm = 0x15180
cqto
idivq %rcx
movl %eax, 0xec(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0x45dc5(%rip), %rsi     # 0x60da7
leaq 0x45dc5(%rip), %rdx     # 0x60dae
movb $0x0, %al
callq 0x2060
leaq 0xf0(%rsp), %rdi
leaq 0x456d5(%rip), %rsi     # 0x606d4
callq 0x2300
movq %rax, 0x170(%rsp)
cmpq $0x0, 0x170(%rsp)
je 0x1b056
movq $0x324, 0xe0(%rsp) # imm = 0x324
movq 0x170(%rsp), %rcx
leaq 0x5a56e(%rip), %rdi     # 0x755a0
movl $0x4, %esi
movl $0xc9, %edx
callq 0x2410
movq %rax, 0xe0(%rsp)
movq 0x170(%rsp), %rdi
callq 0x22c0
movq $0x0, 0x170(%rsp)
movq 0x54b7f(%rip), %rax     # 0x6fbe8
movl 0x14(%rax), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movq 0x54b6d(%rip), %rax     # 0x6fbe8
movl 0x10(%rax), %ecx
addl $0x1, %ecx
leaq 0x5a848(%rip), %rdi     # 0x758d0
leaq 0x45d26(%rip), %rsi     # 0x60db5
movb $0x0, %al
callq 0x2060
leaq 0x5a833(%rip), %rdi     # 0x758d0
leaq 0x45630(%rip), %rsi     # 0x606d4
callq 0x2300
movq %rax, 0x170(%rsp)
cmpq $0x0, 0x170(%rsp)
je 0x1b0fb
movq $0x2e80, 0xd8(%rsp) # imm = 0x2E80
movq 0x170(%rsp), %rcx
leaq 0x55f19(%rip), %rdi     # 0x70ff0
movl $0x4, %esi
movl $0xba0, %edx            # imm = 0xBA0
callq 0x2410
movq %rax, 0xd8(%rsp)
movq 0x170(%rsp), %rdi
callq 0x22c0
leaq 0x537a6(%rip), %rdi     # 0x6e8a8
callq 0x439b0
jmp 0x1b109
cmpl $0xa, 0x5a9f0(%rip)     # 0x75b00
jge 0x1b124
movzbl 0x53d5d(%rip), %ecx     # 0x6ee76
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x1b(%rsp)
je 0x1b135
movzbl 0x53d4b(%rip), %eax     # 0x6ee76
cmpl $0x63, %eax
setg %al
movb %al, 0x1b(%rsp)
movb 0x1b(%rsp), %al
testb $0x1, %al
jne 0x1b142
jmp 0x1b731
movb $0x0, 0x53d2d(%rip)     # 0x6ee76
movl 0x5a9b1(%rip), %eax     # 0x75b00
addl $0x1, %eax
movl %eax, 0x5a9a8(%rip)     # 0x75b00
movl 0x54aaa(%rip), %eax     # 0x6fc08
movl $0x3c, %ecx
cltd
idivl %ecx
movl %eax, 0xd4(%rsp)
movl 0x54a95(%rip), %eax     # 0x6fc08
movl $0x3c, %ecx
cltd
idivl %ecx
movl %edx, 0xd0(%rsp)
movl 0x54a7c(%rip), %eax     # 0x6fc04
movl $0x3c, %ecx
cltd
idivl %ecx
movl %eax, 0xcc(%rsp)
movl 0x54a67(%rip), %eax     # 0x6fc04
movl $0x3c, %ecx
cltd
idivl %ecx
movl %edx, 0xc8(%rsp)
movq 0x54a35(%rip), %rdi     # 0x6fbe8
callq 0x2110
movq %rax, %rdi
leaq 0x46f45(%rip), %rsi     # 0x62107
callq 0x2440
movq %rax, %rdx
leaq 0x53e2f(%rip), %rdi     # 0x6f000
leaq 0x468ed(%rip), %rsi     # 0x61ac5
leaq 0x468f2(%rip), %rcx     # 0x61ad1
movb $0x0, %al
callq 0x2060
callq 0x2bc0
leaq 0x468eb(%rip), %rdi     # 0x61add
leaq 0x468d8(%rip), %rsi     # 0x61ad1
movb $0x0, %al
callq 0x2040
movl 0xcc(%rsp), %esi
movl 0xc8(%rsp), %edx
movl 0xd4(%rsp), %ecx
movl 0xd0(%rsp), %r8d
leaq 0x468d3(%rip), %rdi     # 0x61af7
movb $0x0, %al
callq 0x2040
cmpb $0x0, 0x53c40(%rip)     # 0x6ee72
jne 0x1b241
testb $0x1, 0x53c30(%rip)     # 0x6ee6b
je 0x1b35b
movl 0x549bc(%rip), %r8d     # 0x6fc04
movl 0x549b9(%rip), %r9d     # 0x6fc08
movl 0x55cca(%rip), %r10d    # 0x70f20
movss 0x5a71a(%rip), %xmm2    # 0x75978
movl 0x5a1b0(%rip), %eax     # 0x75414
leaq 0x5319d(%rip), %rdi     # 0x6e408
leaq 0x531ae(%rip), %rsi     # 0x6e420
leaq 0x5a6e7(%rip), %rdx     # 0x75960
leaq 0x5a710(%rip), %rcx     # 0x75990
leaq 0x536ad(%rip), %r11     # 0x6e934
movss 0x44e65(%rip), %xmm0    # 0x600f4
movss 0x44d75(%rip), %xmm1    # 0x6000c
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x36e20
movss 0x5309f(%rip), %xmm0    # 0x6e350
movss 0x5a6bf(%rip), %xmm1    # 0x75978
movl 0x54944(%rip), %r8d     # 0x6fc04
leaq 0x535e1(%rip), %rdi     # 0x6e8a8
leaq 0x5313a(%rip), %rsi     # 0x6e408
leaq 0x5314b(%rip), %rdx     # 0x6e420
leaq 0x53658(%rip), %rcx     # 0x6e934
leaq 0x5a2bd(%rip), %r9      # 0x755a0
callq 0x48160
cmpb $0x0, 0x53b88(%rip)     # 0x6ee77
je 0x1b359
movl 0x5490c(%rip), %r8d     # 0x6fc04
movl 0x54909(%rip), %r9d     # 0x6fc08
movl 0x55c1a(%rip), %r10d    # 0x70f20
movss 0x5a66a(%rip), %xmm2    # 0x75978
movl 0x5a100(%rip), %eax     # 0x75414
leaq 0x530ed(%rip), %rdi     # 0x6e408
leaq 0x530fe(%rip), %rsi     # 0x6e420
leaq 0x5a637(%rip), %rdx     # 0x75960
leaq 0x5a660(%rip), %rcx     # 0x75990
leaq 0x535fd(%rip), %r11     # 0x6e934
movss 0x44db5(%rip), %xmm0    # 0x600f4
movss 0x44d25(%rip), %xmm1    # 0x6006c
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x36e20
jmp 0x1b35b
jmp 0x1b35d
cmpb $0x0, 0x53b13(%rip)     # 0x6ee77
je 0x1b36d
callq 0x8e40
jmp 0x1b35d
callq 0x8e40
movl 0x536cc(%rip), %edx     # 0x6ea44
leaq 0x46793(%rip), %rdi     # 0x61b12
leaq 0x535ae(%rip), %rsi     # 0x6e934
movb $0x0, %al
callq 0x2040
movl 0x536b1(%rip), %esi     # 0x6ea44
leaq 0x5359a(%rip), %rdi     # 0x6e934
callq 0x360d0
movl %eax, 0x52ff7(%rip)     # 0x6e39c
cmpl $0x0, 0x52ff0(%rip)     # 0x6e39c
jge 0x1b3cb
leaq 0x46779(%rip), %rdi     # 0x61b2e
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x21e0
jmp 0x1b109
leaq 0x4676f(%rip), %rdi     # 0x61b41
movb $0x0, %al
callq 0x2040
movl $0x0, 0x5a6ed(%rip)     # 0x75ad0
leaq 0x5a726(%rip), %rdi     # 0x75b10
movl $0xff, %esi
movl $0x20, %edx
callq 0x2170
leaq 0x5a730(%rip), %rdi     # 0x75b30
movl $0xff, %esi
movl $0x20, %edx
callq 0x2170
leaq 0x5373a(%rip), %rdi     # 0x6eb50
callq 0x2130
movq %rax, 0xc0(%rsp)
cmpq $0x20, 0xc0(%rsp)
jle 0x1b43a
movq $0x20, 0xc0(%rsp)
leaq 0xa0(%rsp), %rdi
movl $0xff, %esi
movl $0x20, %edx
callq 0x2170
leaq 0xa0(%rsp), %rdi
movq 0xc0(%rsp), %rdx
leaq 0x534cc(%rip), %rsi     # 0x6e934
addq $0x21c, %rsi            # imm = 0x21C
callq 0x2220
leaq 0x531f9(%rip), %rdi     # 0x6e674
movl $0x100, %edx            # imm = 0x100
movl %edx, %esi
callq 0x233b0
leaq 0x52fda(%rip), %rdi     # 0x6e468
movl $0x100, %edx            # imm = 0x100
movl %edx, %esi
callq 0x233b0
leaq 0xa0(%rsp), %rsi
leaq 0x531cb(%rip), %rdi     # 0x6e674
callq 0x2c050
leaq 0xa0(%rsp), %rsi
leaq 0x52fab(%rip), %rdi     # 0x6e468
callq 0x23500
callq 0x1b750
movl 0x5a633(%rip), %esi     # 0x75b00
leaq 0x46685(%rip), %rdi     # 0x61b59
movb $0x0, %al
callq 0x2040
movl 0x52ebb(%rip), %edi     # 0x6e39c
callq 0x364b0
movl $0xffffffff, 0x52eac(%rip) # imm = 0xFFFFFFFF
cmpb $0x0, 0x5397f(%rip)     # 0x6ee76
jne 0x1b503
movl $0x1, %edi
callq 0x21e0
movzbl 0x5396c(%rip), %esi     # 0x6ee76
leaq 0x4665d(%rip), %rdi     # 0x61b6e
movb $0x0, %al
callq 0x2040
testb $0x1, 0x5394d(%rip)     # 0x6ee6c
je 0x1b72c
movq $0x0, 0x98(%rsp)
leaq 0x4588c(%rip), %rdi     # 0x60dc4
leaq 0x44fef(%rip), %rsi     # 0x6052e
callq 0x2300
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x1b582
movq 0x98(%rsp), %rcx
leaq 0x593fa(%rip), %rdi     # 0x74960
movl $0x4, %esi
movl $0x2aa, %edx            # imm = 0x2AA
callq 0x2530
movq 0x98(%rsp), %rdi
callq 0x22c0
leaq 0x45848(%rip), %rdi     # 0x60dd1
leaq 0x44f9e(%rip), %rsi     # 0x6052e
callq 0x2300
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x1b5d3
movq 0x98(%rsp), %rcx
leaq 0x588f9(%rip), %rdi     # 0x73eb0
movl $0x4, %esi
movl $0x2aa, %edx            # imm = 0x2AA
callq 0x2530
movq 0x98(%rsp), %rdi
callq 0x22c0
leaq 0x464de(%rip), %rdi     # 0x61ab8
leaq 0x44f4d(%rip), %rsi     # 0x6052e
callq 0x2300
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x1b62c
movq 0x98(%rsp), %rcx
leaq 0x59e08(%rip), %rdi     # 0x75410
movl $0x4, %esi
movl $0x62, %edx
callq 0x2530
movq %rax, 0x90(%rsp)
movq 0x98(%rsp), %rdi
callq 0x22c0
leaq 0x545c5(%rip), %rdi     # 0x6fbf8
callq 0x2280
movq 0x545b9(%rip), %rax     # 0x6fbf8
movl $0x24ea00, %ecx         # imm = 0x24EA00
cqto
idivq %rcx
movq %rdx, %rax
movl $0x15180, %ecx          # imm = 0x15180
cqto
idivq %rcx
movl %eax, 0x1c(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x45741(%rip), %rsi     # 0x60da7
leaq 0x45741(%rip), %rdx     # 0x60dae
movb $0x0, %al
callq 0x2060
leaq 0x20(%rsp), %rdi
leaq 0x44eae(%rip), %rsi     # 0x6052e
callq 0x2300
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x1b6c9
movq 0x98(%rsp), %rcx
leaq 0x59ef9(%rip), %rdi     # 0x755a0
movl $0x4, %esi
movl $0xc9, %edx
callq 0x2530
movl %eax, 0x54714(%rip)     # 0x6fdd0
movq 0x98(%rsp), %rdi
callq 0x22c0
leaq 0x5a200(%rip), %rdi     # 0x758d0
leaq 0x44e57(%rip), %rsi     # 0x6052e
callq 0x2300
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x98(%rsp)
je 0x1b720
movq 0x98(%rsp), %rcx
leaq 0x558f2(%rip), %rdi     # 0x70ff0
movl $0x4, %esi
movl $0xba0, %edx            # imm = 0xBA0
callq 0x2530
movl %eax, 0x546bd(%rip)     # 0x6fdd0
movq 0x98(%rsp), %rdi
callq 0x22c0
leaq 0x53181(%rip), %rdi     # 0x6e8a8
callq 0x43830
jmp 0x1b109
leaq 0x4645e(%rip), %rdi     # 0x61b96
movb $0x0, %al
callq 0x2040
xorl %eax, %eax
addq $0x198, %rsp            # imm = 0x198
retq
nopl (%rax)