// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %rbx
movslq %edi, %r13
pushq $0x1
popq %r14
leaq 0x1b817(%rip), %r15     # 0x2cb77
leaq 0x1b817(%rip), %r12     # 0x2cb7e
cmpq %r13, %r14
jge 0x113cb
movq (%rbx,%r14,8), %rdx
movq %r15, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x2040
movq (%rbx,%r14,8), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x23d0
testl %eax, %eax
je 0x113b5
movq %rbp, %rdi
leaq 0x1b7ec(%rip), %rsi     # 0x2cb86
callq 0x23d0
testl %eax, %eax
je 0x113b5
cmpb $0x2d, (%rbp)
jne 0x113c6
cmpb $0x63, 0x1(%rbp)
jne 0x113c6
cmpb $0x0, 0x2(%rbp)
jne 0x113c6
movq 0x8(%rbx,%r14,8), %rsi
leaq 0x25873(%rip), %rdi     # 0x36c34
callq 0x2260
incq %r14
jmp 0x11367
leaq 0x26806(%rip), %rdi     # 0x37bd8
callq 0x2250
movq 0x267fa(%rip), %rax     # 0x37bd8
movq %rax, 0x27bdb(%rip)     # 0x38fc0
leaq 0x1b7a0(%rip), %rdi     # 0x2cb8c
callq 0x2210
callq 0x2f9e
movb $0x0, 0x25a5d(%rip)     # 0x36e5a
cmpb $0x0, 0x25a4c(%rip)     # 0x36e50
je 0x11587
leaq 0x1ab12(%rip), %rdi     # 0x2bf23
leaq 0x1a457(%rip), %rsi     # 0x2b86f
callq 0x22f0
testq %rax, %rax
je 0x11444
movq %rax, %rbx
leaq 0x2b524(%rip), %rdi     # 0x3c950
pushq $0x4
popq %rsi
movl $0x2aa, %edx            # imm = 0x2AA
movq %rax, %rcx
callq 0x2420
movq %rbx, %rdi
callq 0x2290
leaq 0x1aae5(%rip), %rdi     # 0x2bf30
leaq 0x1a41d(%rip), %rsi     # 0x2b86f
callq 0x22f0
testq %rax, %rax
je 0x1147e
movq %rax, %rbx
leaq 0x2aa3a(%rip), %rdi     # 0x3bea0
pushq $0x4
popq %rsi
movl $0x2aa, %edx            # imm = 0x2AA
movq %rax, %rcx
callq 0x2420
movq %rbx, %rdi
callq 0x2290
leaq 0x1b70b(%rip), %rdi     # 0x2cb90
leaq 0x1a3e3(%rip), %rsi     # 0x2b86f
callq 0x22f0
testq %rax, %rax
je 0x114b6
movq %rax, %rbx
leaq 0x2bf60(%rip), %rdi     # 0x3d400
pushq $0x4
popq %rsi
pushq $0x62
popq %rdx
movq %rax, %rcx
callq 0x2420
movq %rbx, %rdi
callq 0x2290
leaq 0x2671b(%rip), %rdi     # 0x37bd8
callq 0x2250
leaq 0x1aa3d(%rip), %rsi     # 0x2bf06
leaq 0x1aa3d(%rip), %rdx     # 0x2bf0d
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x1a386(%rip), %rsi     # 0x2b86f
movq %rbx, %rdi
callq 0x22f0
testq %rax, %rax
je 0x11518
movq %rax, %rbx
leaq 0x2c090(%rip), %rdi     # 0x3d590
pushq $0x4
popq %rsi
movl $0xc9, %edx
movq %rax, %rcx
callq 0x2420
movq %rbx, %rdi
callq 0x2290
movq 0x266a9(%rip), %rax     # 0x37bc8
movl 0x10(%rax), %ecx
movl 0x14(%rax), %eax
pushq $0x64
popq %rsi
cltd
idivl %esi
incl %ecx
leaq 0x2c38c(%rip), %rbx     # 0x3d8c0
leaq 0x1a9d9(%rip), %rsi     # 0x2bf14
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x1a323(%rip), %rsi     # 0x2b86f
movq %rbx, %rdi
callq 0x22f0
testq %rax, %rax
je 0x1157b
movq %rax, %rbx
leaq 0x27a7d(%rip), %rdi     # 0x38fe0
pushq $0x4
popq %rsi
movl $0xba0, %edx            # imm = 0xBA0
movq %rax, %rcx
callq 0x2420
movq %rbx, %rdi
callq 0x2290
leaq 0x25306(%rip), %rdi     # 0x36888
callq 0x211ef
leaq 0x98(%rsp), %rbp
leaq 0x78(%rsp), %r14
pushq $0xf
popq %r12
movl 0x2c522(%rip), %eax     # 0x3dac0
cmpl $0xa, %eax
setl %cl
movb 0x258b0(%rip), %dl      # 0x36e5a
testb %dl, %dl
sete %sil
andb %cl, %sil
cmpb $0x64, %dl
setae %cl
orb %sil, %cl
cmpb $0x1, %cl
jne 0x122af
movb $0x0, 0x2588e(%rip)     # 0x36e5a
incl %eax
movl %eax, 0x2c4ec(%rip)     # 0x3dac0
movl 0x2660a(%rip), %eax     # 0x37be4
cltd
pushq $0x3c
popq %rcx
idivl %ecx
movl %eax, %r15d
movl %edx, 0x8(%rsp)
movl 0x265f3(%rip), %eax     # 0x37be0
cltd
idivl %ecx
movl %eax, %r13d
movl %edx, 0xc(%rsp)
movq 0x265ca(%rip), %rdi     # 0x37bc8
callq 0x20f0
movq %rax, %rdi
leaq 0x1bc5c(%rip), %rsi     # 0x2d269
callq 0x2460
leaq 0x259c7(%rip), %rdi     # 0x36fe0
leaq 0x1b57d(%rip), %rsi     # 0x2cb9d
movq %rax, %rdx
leaq 0x1b57f(%rip), %rbx     # 0x2cba9
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
callq 0x2a5c
leaq 0x1b575(%rip), %rdi     # 0x2cbb5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2040
leaq 0x1b57e(%rip), %rdi     # 0x2cbcf
movl %r13d, %esi
movl 0xc(%rsp), %edx
movl %r15d, %ecx
movl 0x8(%rsp), %r8d
xorl %eax, %eax
callq 0x2040
cmpb $0x0, 0x257e8(%rip)     # 0x36e56
jne 0x1167d
cmpb $0x1, 0x257d8(%rip)     # 0x36e4f
jne 0x1178d
movl 0x2655c(%rip), %r8d     # 0x37be0
movl 0x26559(%rip), %r9d     # 0x37be4
movl 0x2786f(%rip), %eax     # 0x38f00
movss 0x2c2c7(%rip), %xmm2    # 0x3d960
movl 0x2bd64(%rip), %r10d    # 0x3d404
subq $0x8, %rsp
leaq 0x24d3d(%rip), %r15     # 0x363e8
movq %r15, %rdi
leaq 0x24d4b(%rip), %r13     # 0x36400
movq %r13, %rsi
leaq 0x2c28d(%rip), %rdx     # 0x3d94c
leaq 0x2c2b2(%rip), %rcx     # 0x3d978
movss 0x19d36(%rip), %xmm0    # 0x2b404
movss 0x19c52(%rip), %xmm1    # 0x2b328
pushq %r10
pushq %rax
leaq 0x25238(%rip), %rbx     # 0x36918
pushq %rbx
callq 0x1dd97
addq $0x20, %rsp
movd 0x24c5e(%rip), %xmm0    # 0x36350
movss 0x2c266(%rip), %xmm1    # 0x3d960
movl 0x264df(%rip), %r8d     # 0x37be0
leaq 0x25180(%rip), %rdi     # 0x36888
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
leaq 0x2be78(%rip), %r9      # 0x3d590
callq 0x22f4f
cmpb $0x0, 0x25737(%rip)     # 0x36e5b
je 0x1178d
movl 0x264b3(%rip), %r8d     # 0x37be0
movl 0x264b0(%rip), %r9d     # 0x37be4
movl 0x277c6(%rip), %eax     # 0x38f00
movss 0x2c21e(%rip), %xmm2    # 0x3d960
movl 0x2bcbb(%rip), %r10d    # 0x3d404
subq $0x8, %rsp
leaq 0x24c94(%rip), %rdi     # 0x363e8
leaq 0x24ca5(%rip), %rsi     # 0x36400
leaq 0x2c1ea(%rip), %rdx     # 0x3d94c
leaq 0x2c20f(%rip), %rcx     # 0x3d978
movd 0x19c93(%rip), %xmm0    # 0x2b404
movss 0x19c2b(%rip), %xmm1    # 0x2b3a4
pushq %r10
pushq %rax
leaq 0x25195(%rip), %rax     # 0x36918
pushq %rax
callq 0x1dd97
addq $0x20, %rsp
movb 0x256c8(%rip), %bl      # 0x36e5b
callq 0x72b6
testb %bl, %bl
jne 0x1178d
movl 0x25286(%rip), %edx     # 0x36a28
leaq 0x1b441(%rip), %rdi     # 0x2cbea
leaq 0x25168(%rip), %rbx     # 0x36918
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2040
movl 0x25268(%rip), %esi     # 0x36a28
movq %rbx, %rdi
callq 0x1d43e
movl %eax, 0xc(%rsp)
testl %eax, %eax
js 0x12296
leaq 0x1b66c(%rip), %rdi     # 0x2ce47
callq 0x2440
movb $0x0, 0x2c2ad(%rip)     # 0x3da94
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x2c2dd(%rip)    # 0x3dad0
movdqa %xmm0, 0x2c2e5(%rip)    # 0x3dae0
movdqa %xmm0, 0x2c2ed(%rip)    # 0x3daf0
movdqa %xmm0, 0x2c2f5(%rip)    # 0x3db00
leaq 0x25322(%rip), %rbx     # 0x36b34
movq %rbx, %rdi
callq 0x2100
cmpq $0x20, %rax
pushq $0x20
popq %rcx
cmovgeq %rcx, %rax
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x90(%rsp)
movdqa %xmm0, 0x80(%rsp)
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21f0
leaq 0x24dfc(%rip), %rbx     # 0x36654
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
callq 0x13eb2
leaq 0x24bd7(%rip), %r13     # 0x36448
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
callq 0x13eb2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x18546
movq %r13, %rdi
movq %r15, %rsi
callq 0x13f28
leaq 0x50(%rsp), %rdi
callq 0x12e18
movl $0x0, 0x8(%rsp)
movl $0x0, 0x2c(%rsp)
leaq 0x10(%rsp), %rbx
testb $0x1, 0x8(%rsp)
jne 0x120d2
cmpb $0x0, 0x25590(%rip)     # 0x36e5a
jne 0x120d2
pxor %xmm0, %xmm0
movdqa %xmm0, 0x10(%rsp)
cmpb $0x1, 0x2c1b3(%rip)     # 0x3da94
jne 0x11ae9
movl 0x262f2(%rip), %r15d    # 0x37be0
cmpb $0x1, 0x25550(%rip)     # 0x36e45
jne 0x11903
leaq 0x1b572(%rip), %rdi     # 0x2ce70
callq 0x2440
cmpb $0x0, 0x2554c(%rip)     # 0x36e56
jne 0x11915
cmpb $0x1, 0x2553c(%rip)     # 0x36e4f
jne 0x11950
movd 0x24a33(%rip), %xmm0    # 0x36350
movss 0x2c03b(%rip), %xmm1    # 0x3d960
leaq 0x24f5c(%rip), %rdi     # 0x36888
leaq 0x24ab5(%rip), %rsi     # 0x363e8
leaq 0x24ac6(%rip), %rdx     # 0x36400
leaq 0x24fd7(%rip), %rcx     # 0x36918
movl %r15d, %r8d
leaq 0x2bc45(%rip), %r9      # 0x3d590
callq 0x22f4f
cmpb $0x1, 0x254ee(%rip)     # 0x36e45
jne 0x11965
leaq 0x1b513(%rip), %rdi     # 0x2ce73
callq 0x2440
cmpb $0x1, 0x254e0(%rip)     # 0x36e4c
movss 0x199b4(%rip), %xmm1    # 0x2b328
jne 0x1199f
movq 0x24a9b(%rip), %rax     # 0x36418
movss 0x199a3(%rip), %xmm1    # 0x2b328
cmpq %rax, 0x24a94(%rip)     # 0x36420
je 0x1199f
movslq 0x26273(%rip), %rcx     # 0x37c08
imulq $0x70, %rcx, %rcx
movss 0x68(%rax,%rcx), %xmm1
movss 0x249a9(%rip), %xmm0    # 0x36350
ucomiss 0x1998a(%rip), %xmm0    # 0x2b338
jb 0x11a07
movl 0x26229(%rip), %r8d     # 0x37be0
movl 0x26226(%rip), %r9d     # 0x37be4
movl 0x2753c(%rip), %eax     # 0x38f00
movss 0x2bf94(%rip), %xmm2    # 0x3d960
movl 0x2ba31(%rip), %r10d    # 0x3d404
subq $0x8, %rsp
leaq 0x24a0a(%rip), %rdi     # 0x363e8
leaq 0x24a1b(%rip), %rsi     # 0x36400
leaq 0x2bf60(%rip), %rdx     # 0x3d94c
leaq 0x2bf85(%rip), %rcx     # 0x3d978
pushq %r10
pushq %rax
leaq 0x24f1b(%rip), %rax     # 0x36918
pushq %rax
callq 0x1dd97
addq $0x20, %rsp
cmpb $0x1, 0x25437(%rip)     # 0x36e45
jne 0x11a1c
leaq 0x1b45f(%rip), %rdi     # 0x2ce76
callq 0x2440
leaq 0x24f1d(%rip), %rdi     # 0x36940
leaq 0x19ada(%rip), %rsi     # 0x2b504
pushq $0x8
popq %rdx
callq 0x2110
testl %eax, %eax
jle 0x11a3b
callq 0x52d9
movb 0x25404(%rip), %al      # 0x36e45
cmpb $0x1, %al
jne 0x11a57
leaq 0x1b42d(%rip), %rdi     # 0x2ce79
callq 0x2440
movb 0x253ee(%rip), %al      # 0x36e45
cmpl $0x0, 0x18(%rsp)
sete %cl
cmpl $0x0, 0x25436(%rip)     # 0x36e9c
setns %dl
andb %cl, %dl
andb 0x2c(%rsp), %dl
cmpb $0x1, %dl
jne 0x11a92
testb $0x1, %al
je 0x11a84
leaq 0x1b3fe(%rip), %rdi     # 0x2ce7d
callq 0x2440
movq %rbx, %rdi
callq 0xd4c5
movb 0x253b3(%rip), %al      # 0x36e45
testb $0x1, %al
je 0x11aa8
leaq 0x1b3e4(%rip), %rdi     # 0x2ce81
callq 0x2440
movb 0x2539d(%rip), %al      # 0x36e45
movl 0x18(%rsp), %ecx
testl %ecx, %ecx
sete %dl
movl %edx, 0x2c(%rsp)
testb $0x1, %al
je 0x11ac9
leaq 0x1b3c4(%rip), %rdi     # 0x2ce84
callq 0x2440
movl 0x18(%rsp), %ecx
testl %ecx, %ecx
jne 0x11ad2
callq 0x72b6
cmpb $0x1, 0x2536c(%rip)     # 0x36e45
jne 0x11ae9
leaq 0x1b192(%rip), %rdi     # 0x2cc74
xorl %eax, %eax
callq 0x2040
movl 0x18(%rsp), %esi
testl %esi, %esi
jne 0x11b05
movq %rbx, %rdi
callq 0xe6f0
movl 0x18(%rsp), %esi
testl %esi, %esi
je 0x1205c
andq $0x0, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
addl $0x1f, %esi
andl $-0x20, %esi
leaq 0x30(%rsp), %rdi
callq 0x12422
movl 0x18(%rsp), %edi
addq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
subq %rdi, %rdx
xorl %esi, %esi
callq 0x2150
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x18(%rsp), %edx
callq 0x21f0
movq %r13, %rdi
leaq 0x2bf98(%rip), %rsi     # 0x3daf0
pushq $0x20
popq %rdx
callq 0x13f12
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
subq %rdx, %rcx
shrq $0x5, %rcx
movq %r13, %rdi
movq %rdx, %rsi
pushq $0x1
popq %r8
callq 0x18486
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rax
movups -0x20(%rax), %xmm0
movups -0x10(%rax), %xmm1
movl %eax, %edx
subl %esi, %edx
movaps %xmm0, 0x2bf53(%rip)    # 0x3daf0
movaps %xmm1, 0x2bf5c(%rip)    # 0x3db00
movl 0xc(%rsp), %edi
callq 0x1d70b
movl %eax, %r15d
testl %eax, %eax
js 0x11d19
pushq $0x1
popq %rdi
callq 0x21b0
leaq 0x1b0d0(%rip), %rdi     # 0x2cc97
pushq $0x1b
popq %rbx
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
cmpb $0x1, 0x2526b(%rip)     # 0x36e45
jne 0x11bec
leaq 0x1b0b9(%rip), %rdi     # 0x2cc9c
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
movq 0x25fdd(%rip), %rdi     # 0x37bd0
movq %rdi, %rax
cqto
movl $0x15180, %r15d         # imm = 0x15180
idivq %r15
movq %rdx, %rax
cltd
movl $0xe10, %ecx            # imm = 0xE10
idivl %ecx
movl %eax, %esi
movq %rdi, %rax
cqto
movl $0xe10, %ecx            # imm = 0xE10
idivq %rcx
movq %rdx, %rax
cwtd
movslq %esi, %r8
movw $0x3c, %cx
idivw %cx
movswq %ax, %rcx
movq %rdi, %rax
cqto
pushq $0x3c
popq %rsi
idivq %rsi
movq %rdx, %rax
leaq 0x1b05f(%rip), %rdi     # 0x2cca2
leaq 0x1af5f(%rip), %rsi     # 0x2cba9
movq %r8, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x2040
cvtss2sd 0x2bd21(%rip), %xmm0    # 0x3d980
movss 0x25261(%rip), %xmm4    # 0x36ec8
movss 0x2bce9(%rip), %xmm1    # 0x3d958
mulss %xmm4, %xmm1
movss 0x19695(%rip), %xmm5    # 0x2b310
divss %xmm5, %xmm1
cvtss2sd %xmm1, %xmm1
movss 0x2bcfd(%rip), %xmm2    # 0x3d988
mulss %xmm4, %xmm2
divss %xmm5, %xmm2
cvtss2sd %xmm2, %xmm2
movss 0x2bcbd(%rip), %xmm3    # 0x3d95c
mulss %xmm4, %xmm3
divss %xmm5, %xmm3
cvtss2sd %xmm3, %xmm3
mulss 0x2bcc9(%rip), %xmm4    # 0x3d97c
divss %xmm5, %xmm4
cvtss2sd %xmm4, %xmm4
leaq 0x1aff2(%rip), %rdi     # 0x2ccb4
movb $0x5, %al
callq 0x2040
movq 0x25f08(%rip), %rax     # 0x37bd8
cqto
idivq %r15
cmpq $-0x383, %rdx           # imm = 0xFC7D
jl 0x11d7c
cmpb $0x1, 0x25167(%rip)     # 0x36e50
jne 0x11d7c
movl 0x2bbaf(%rip), %eax     # 0x3d8a4
cvtsi2sd %rax, %xmm0
divsd 0x194d6(%rip), %xmm0    # 0x2b1d8
movq 0x246f7(%rip), %rax     # 0x36400
cmpq %rax, 0x246f8(%rip)     # 0x36408
je 0x11d3c
movss 0x1c(%rax), %xmm1
jmp 0x11d3f
callq 0x2030
movl (%rax), %edx
leaq 0x1af50(%rip), %rdi     # 0x2cc77
movl %r15d, %esi
xorl %eax, %eax
callq 0x2040
movb $0x1, %al
movl %eax, 0x8(%rsp)
jmp 0x12052
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm0
movl 0x2bb67(%rip), %eax     # 0x3d8b0
cvtss2sd %xmm0, %xmm0
mulss 0x25173(%rip), %xmm1    # 0x36ec8
divss 0x195b3(%rip), %xmm1    # 0x2b310
cvtss2sd %xmm1, %xmm1
cvtsi2sd %rax, %xmm2
divsd 0x1946a(%rip), %xmm2    # 0x2b1d8
leaq 0x1af66(%rip), %rdi     # 0x2ccdb
movb $0x3, %al
callq 0x2040
leaq 0x1a6f2(%rip), %rdi     # 0x2c475
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
movb 0x2bd9e(%rip), %al      # 0x3db30
testb %al, %al
je 0x12081
xorl %ebx, %ebx
testb $0x1, 0x8(%rsp)
jne 0x12046
movslq 0x2bd62(%rip), %rsi     # 0x3db10
testq %rsi, %rsi
setg %al
testl %ebx, %ebx
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x12046
movq 0x2bd55(%rip), %rdx     # 0x3db20
movq 0x2bd46(%rip), %rax     # 0x3db18
subq %rax, %rdx
movq %rdx, %rcx
subq %rsi, %rcx
cmpq $0xfff, %rcx            # imm = 0xFFF
ja 0x11e23
cmpq $0x10016, %rdx          # imm = 0x10016
jae 0x1202f
addq $0x1000, %rdx           # imm = 0x1000
leaq 0x2bd19(%rip), %rdi     # 0x3db18
movq %rdx, %rsi
callq 0x12422
movq 0x2bd0a(%rip), %rax     # 0x3db18
movl 0x2bcfc(%rip), %ecx     # 0x3db10
movq 0x2bd05(%rip), %rdx     # 0x3db20
movslq %ecx, %rsi
subq %rax, %rdx
jmp 0x11e25
movl %esi, %ecx
addq %rax, %rsi
subl %ecx, %edx
movl 0xc(%rsp), %edi
callq 0x1d758
testl %eax, %eax
js 0x11ffb
je 0x12021
addl %eax, 0x2bcc9(%rip)     # 0x3db10
testb $0x1, 0x8(%rsp)
jne 0x11d9c
movslq 0x2bcb7(%rip), %r15     # 0x3db10
movq %r15, %r13
andq $-0x20, %r13
testl %r13d, %r13d
je 0x11d9c
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
leaq 0x60(%rsp), %rdi
movq %r13, %rsi
callq 0x12422
leaq 0x247c9(%rip), %rdi     # 0x36654
leaq 0x2bc3e(%rip), %rsi     # 0x3dad0
pushq $0x20
popq %rdx
callq 0x13f12
movq 0x2bc77(%rip), %rsi     # 0x3db18
movq 0x60(%rsp), %rdx
sarl $0x5, %r15d
leaq 0x247a3(%rip), %rdi     # 0x36654
movl %r15d, %ecx
pushq $0x1
popq %r8
callq 0x1ce48
movq 0x60(%rsp), %r15
movq %r14, %rdi
callq 0x12e18
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
andq $0x0, 0x10(%rbp)
movl %r13d, 0x5c(%rsp)
movq %r14, %rdi
movq %r15, %rsi
leaq 0x5c(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x133d2
movl %eax, %r13d
testl %eax, %eax
js 0x11f50
movq 0x84(%rsp), %rax
movq %rax, 0x26fef(%rip)     # 0x38ef8
xorl %r15d, %r15d
movl %r15d, %r15d
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rax
subq %rsi, %rax
cqto
idivq %r12
cmpq %r15, %rax
jbe 0x11f40
imulq $0xf, %r15, %rax
addq %rax, %rsi
movq %r14, %rdi
callq 0xf64a
incl %r15d
jmp 0x11f0c
movq %r14, %rdi
movq %rbp, %r15
movq %rbp, %rsi
callq 0x13584
jmp 0x11f60
cmpl $-0x5, %r13d
movl $0x0, %eax
cmovel %eax, %r13d
movq %rbp, %r15
movq %r15, %rdi
callq 0x12642
movq %r14, %rdi
callq 0x12e24
testl %r13d, %r13d
js 0x11fc4
je 0x11fe0
addl $0x1f, %r13d
andl $0x7fffffe0, %r13d      # imm = 0x7FFFFFE0
movq 0x2bb8f(%rip), %rdi     # 0x3db18
leaq (%rdi,%r13), %rsi
movups -0x20(%rdi,%r13), %xmm0
movups -0x10(%rdi,%r13), %xmm1
movaps %xmm0, 0x2bb30(%rip)    # 0x3dad0
movaps %xmm1, 0x2bb39(%rip)    # 0x3dae0
movq 0x2bb72(%rip), %rdx     # 0x3db20
subq %rsi, %rdx
callq 0x21f0
subl %r13d, 0x2bb53(%rip)    # 0x3db10
incl %ebx
movb $0x1, %r15b
jmp 0x11fe3
xorl %r15d, %r15d
leaq 0x1ad79(%rip), %rdi     # 0x2cd47
movl %r13d, %esi
xorl %eax, %eax
callq 0x2040
movb $0x1, %al
movl %eax, 0x8(%rsp)
jmp 0x11fe3
xorl %r15d, %r15d
leaq 0x60(%rsp), %rdi
callq 0x129ec
testb %r15b, %r15b
jne 0x11e47
jmp 0x11d9c
callq 0x2030
movl (%rax), %esi
cmpl $0xb, %esi
leaq 0x2443c(%rip), %r13     # 0x36448
leaq 0x10(%rsp), %rbx
jne 0x1206e
leaq 0x1ae87(%rip), %rdi     # 0x2cea1
callq 0x2440
jmp 0x12052
leaq 0x1ae5f(%rip), %rdi     # 0x2ce87
callq 0x2440
jmp 0x12040
leaq 0x1accf(%rip), %rdi     # 0x2cd05
movq %rdx, %rsi
xorl %eax, %eax
callq 0x2040
movb $0x1, %al
movl %eax, 0x8(%rsp)
leaq 0x243fb(%rip), %r13     # 0x36448
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %rdi
callq 0x129ec
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x13ac6
jmp 0x118b8
leaq 0x1acb2(%rip), %rdi     # 0x2cd27
xorl %eax, %eax
callq 0x2040
jmp 0x11d31
leaq 0x2baa8(%rip), %rdi     # 0x3db30
callq 0x24f0
testl %eax, %eax
je 0x11d9a
xorps %xmm0, %xmm0
movups %xmm0, 0x2ba79(%rip)    # 0x3db18
andq $0x0, 0x2ba81(%rip)     # 0x3db28
leaq 0x36e(%rip), %rdi       # 0x1241c
leaq 0x2ba63(%rip), %rsi     # 0x3db18
leaq 0x2420c(%rip), %rdx     # 0x362c8
callq 0x2230
leaq 0x2ba68(%rip), %rdi     # 0x3db30
callq 0x2180
jmp 0x11d9a
leaq 0x1ac1b(%rip), %rdi     # 0x2ccf4
xorl %eax, %eax
callq 0x2040
leaq 0x50(%rsp), %rdi
callq 0x12e24
movl 0x2b9d0(%rip), %esi     # 0x3dac0
leaq 0x1ab0f(%rip), %rdi     # 0x2cc06
xorl %eax, %eax
callq 0x2040
movl 0xc(%rsp), %edi
callq 0x1d6f4
movb 0x24d4d(%rip), %al      # 0x36e5a
testb %al, %al
jne 0x1211f
pushq $0x1
popq %rdi
callq 0x21b0
movb 0x24d3b(%rip), %al      # 0x36e5a
movzbl %al, %esi
leaq 0x1aaf2(%rip), %rdi     # 0x2cc1b
xorl %eax, %eax
callq 0x2040
cmpb $0x1, 0x24d19(%rip)     # 0x36e50
jne 0x11598
leaq 0x19ddf(%rip), %rdi     # 0x2bf23
leaq 0x195a8(%rip), %rsi     # 0x2b6f3
callq 0x22f0
testq %rax, %rax
je 0x12177
movq %rax, %r15
movl $0x2aa, %edx            # imm = 0x2AA
leaq 0x2a7ec(%rip), %rdi     # 0x3c950
pushq $0x4
popq %rsi
movq %rax, %rcx
callq 0x2540
movq %r15, %rdi
callq 0x2290
leaq 0x19db2(%rip), %rdi     # 0x2bf30
leaq 0x1956e(%rip), %rsi     # 0x2b6f3
callq 0x22f0
testq %rax, %rax
je 0x121b1
movq %rax, %r15
movl $0x2aa, %edx            # imm = 0x2AA
leaq 0x29d02(%rip), %rdi     # 0x3bea0
pushq $0x4
popq %rsi
movq %rax, %rcx
callq 0x2540
movq %r15, %rdi
callq 0x2290
leaq 0x1a9d8(%rip), %rdi     # 0x2cb90
leaq 0x19534(%rip), %rsi     # 0x2b6f3
callq 0x22f0
testq %rax, %rax
je 0x121e9
movq %rax, %r15
leaq 0x2b22d(%rip), %rdi     # 0x3d400
pushq $0x4
popq %rsi
pushq $0x62
popq %rdx
movq %rax, %rcx
callq 0x2540
movq %r15, %rdi
callq 0x2290
leaq 0x259e8(%rip), %rdi     # 0x37bd8
callq 0x2250
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
leaq 0x19cff(%rip), %rsi     # 0x2bf06
leaq 0x19cff(%rip), %rdx     # 0x2bf0d
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
leaq 0x194d4(%rip), %rsi     # 0x2b6f3
callq 0x22f0
testq %rax, %rax
je 0x1224b
movq %rax, %r15
movl $0xc9, %edx
leaq 0x2b358(%rip), %rdi     # 0x3d590
pushq $0x4
popq %rsi
movq %rax, %rcx
callq 0x2540
movq %r15, %rdi
callq 0x2290
leaq 0x2b66e(%rip), %rdi     # 0x3d8c0
leaq 0x1949a(%rip), %rsi     # 0x2b6f3
callq 0x22f0
testq %rax, %rax
je 0x12285
movq %rax, %r15
movl $0xba0, %edx            # imm = 0xBA0
leaq 0x26d6e(%rip), %rdi     # 0x38fe0
pushq $0x4
popq %rsi
movq %rax, %rcx
callq 0x2540
movq %r15, %rdi
callq 0x2290
leaq 0x245fc(%rip), %rdi     # 0x36888
callq 0x21131
jmp 0x11598
leaq 0x1abc1(%rip), %rdi     # 0x2ce5e
callq 0x2440
pushq $0x1
popq %rdi
callq 0x21b0
jmp 0x11598
leaq 0x1ab77(%rip), %rdi     # 0x2ce2d
callq 0x2440
xorl %eax, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x122d3
jmp 0x122d3
movq %rax, %r14
jmp 0x12315
jmp 0x122dc
jmp 0x122dc
movq %rax, %r14
jmp 0x1230b
jmp 0x122ec
jmp 0x122e7
jmp 0x122ec
movq %rax, %r14
jmp 0x12301
movq %rax, %r14
movq %rbp, %rdi
callq 0x12642
leaq 0x78(%rsp), %rdi
callq 0x12e24
leaq 0x60(%rsp), %rdi
callq 0x129ec
leaq 0x30(%rsp), %rdi
callq 0x129ec
leaq 0x50(%rsp), %rdi
callq 0x12e24
movq %r14, %rdi
callq 0x24d0
nop