// File: /workspace/github_cpp_makefile_star2_O1/bummelbaerchen[P]e3dc/RscpExampleMain.cpp
// Function: main
int main(int argc, char *argv[])
{
    // get conf parameters
    FILE *fp;
    fp = fopen(CONF_PATH CONF_FILE, "r");
    if(!fp) {
        fp = fopen(CONF_FILE, "r");
    }
    char var[128], value[128], line[256];
    e3dc_config.wallbox = false;
    e3dc_config.openWB = false;
    e3dc_config.ext1 = false;
    e3dc_config.ext2 = false;
    e3dc_config.ext3 = false;
    e3dc_config.ext7 = false;
    e3dc_config.debug = false;
    e3dc_config.wurzelzaehler = 0;
    e3dc_config.untererLadekorridor = UNTERERLADEKORRIDOR;
    e3dc_config.obererLadekorridor = OBERERLADEKORRIDOR;
    e3dc_config.minimumLadeleistung = MINIMUMLADELEISTUNG;
    e3dc_config.maximumLadeleistung = MAXIMUMLADELEISTUNG;
    e3dc_config.wrleistung = WRLEISTUNG;
    e3dc_config.speichergroesse = SPEICHERGROESSE;
    e3dc_config.winterminimum = WINTERMINIMUM;
    e3dc_config.sommermaximum = SOMMERMAXIMUM;
    e3dc_config.sommerladeende = SOMMERLADEENDE; 
    e3dc_config.einspeiselimit = EINSPEISELIMIT;
    e3dc_config.ladeschwelle = LADESCHWELLE;
    e3dc_config.ladeende = LADEENDE;
    e3dc_config.ht = 0;
    e3dc_config.htsat = false;
    e3dc_config.htsun = false;
    e3dc_config.hton = 0;
    e3dc_config.htoff = 24*3600; // in Sekunden
    e3dc_config.htsockel = 0;

    if(fp) {
        while (fgets(line, sizeof(line), fp)) {
            memset(var, 0, sizeof(var));
            memset(value, 0, sizeof(value));
            if(sscanf(line, "%[^ \t=]%*[\t ]=%*[\t ]%[^\n]", var, value) == 2) {
                if(strcmp(var, "server_ip") == 0)
                    strcpy(e3dc_config.server_ip, value);
                else if(strcmp(var, "server_port") == 0)
                    e3dc_config.server_port = atoi(value);
                else if(strcmp(var, "e3dc_user") == 0)
                    strcpy(e3dc_config.e3dc_user, value);
                else if(strcmp(var, "e3dc_password") == 0)
                    strcpy(e3dc_config.e3dc_password, value);
                else if(strcmp(var, "aes_password") == 0)
                    strcpy(e3dc_config.aes_password, value);
                else if(strcmp(var, "wurzelzaehler") == 0)
                    e3dc_config.wurzelzaehler = atoi(value);
                else if((strcmp(var, "wallbox") == 0)&&
                       (strcmp(value, "true") == 0))
                    e3dc_config.wallbox = true;
                else if((strcmp(var, "openWB") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.openWB = true;
                else if((strcmp(var, "ext1") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.ext1 = true;
                else if((strcmp(var, "ext2") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.ext2 = true;
                else if((strcmp(var, "ext3") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.ext3 = true;
                else if((strcmp(var, "ext7") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.ext7 = true;
                else if((strcmp(var, "debug") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.debug = true;
                else if(strcmp(var, "untererLadekorridor") == 0)
                    e3dc_config.untererLadekorridor = atoi(value);
                else if(strcmp(var, "obererLadekorridor") == 0)
                    e3dc_config.obererLadekorridor = atoi(value);
                else if(strcmp(var, "minimumLadeleistung") == 0)
                    e3dc_config.minimumLadeleistung = atoi(value);
                else if(strcmp(var, "maximumLadeleistung") == 0)
                    e3dc_config.maximumLadeleistung = atoi(value);
                else if(strcmp(var, "wrleistung") == 0)
                    e3dc_config.wrleistung = atoi(value);
                else if(strcmp(var, "speichergroesse") == 0)
                    e3dc_config.speichergroesse = atof(value);
                else if(strcmp(var, "winterminimum") == 0)
                    e3dc_config.winterminimum = atof(value);
                else if(strcmp(var, "sommermaximum") == 0)
                    e3dc_config.sommermaximum = atof(value);
                else if(strcmp(var, "sommerladeende") == 0)
                    e3dc_config.sommerladeende = atof(value);
                else if(strcmp(var, "einspeiselimit") == 0)
                    e3dc_config.einspeiselimit = atof(value);
                else if(strcmp(var, "ladeschwelle") == 0)
                    e3dc_config.ladeschwelle = atoi(value);
                else if(strcmp(var, "ladeende") == 0)
                    e3dc_config.ladeende = atoi(value);
                else if(strcmp(var, "htmin") == 0)
                    e3dc_config.ht = atoi(value);
                else if(strcmp(var, "htsockel") == 0)
                    e3dc_config.htsockel = atoi(value);
                else if(strcmp(var, "hton") == 0)
                    e3dc_config.hton = atof(value)*3600; // in Sekunden
                else if(strcmp(var, "htoff") == 0)
                    e3dc_config.htoff = atof(value)*3600; // in Sekunden
                else if((strcmp(var, "htsat") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.htsat = true;
                else if((strcmp(var, "htsun") == 0)&&
                        (strcmp(value, "true") == 0))
                    e3dc_config.htsun = true;


            }
        }
//        printf("e3dc_user %s\n",e3dc_config.e3dc_user);
//        printf("e3dc_password %s\n",e3dc_config.e3dc_password);
//        printf("aes_password %s\n",e3dc_config.aes_password);
        fclose(fp);
    }
    static int iEC = 0;
    if (!fp) printf("Configurationsdatei %s nicht gefunden",CONF_FILE);
    // endless application which re-connections to server on connection lost
    if (fp)
        while(iEC < 10)
    {
        iEC++; // Schleifenzähler erhöhen

        // connect to server
        printf("Program Start Version:%s\n",VERSION);

        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;
        sleep(10);
    }
    printf("Programm wirklich beendet");
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
leaq 0xd306(%rip), %rdi      # 0x1376a
leaq 0xd6b9(%rip), %rsi      # 0x13b24
callq 0x21c0
movq %rax, %rbx
testq %rax, %rax
jne 0x648e
leaq 0xd30f(%rip), %rdi      # 0x1378e
leaq 0xd69e(%rip), %rsi      # 0x13b24
callq 0x21c0
movq %rax, %rbx
movaps 0xcc9b(%rip), %xmm0     # 0x13130
movups %xmm0, 0x112c4(%rip)    # 0x17760
movaps 0xcc9d(%rip), %xmm0     # 0x13140
movups %xmm0, 0x112c6(%rip)    # 0x17770
movl $0x2ee0, 0x112cc(%rip)  # imm = 0x2EE0
movaps 0xcc95(%rip), %xmm0     # 0x13150
movups %xmm0, 0x112c2(%rip)    # 0x17784
movaps 0xcc97(%rip), %xmm0     # 0x13160
movups %xmm0, 0x112c4(%rip)    # 0x17794
testq %rbx, %rbx
je 0x6d06
leaq 0x1c0(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x2250
testq %rax, %rax
je 0x6cf9
leaq 0xd2a0(%rip), %r14      # 0x1379e
leaq 0x1c0(%rsp), %r15
leaq 0x50(%rsp), %r12
leaq 0x140(%rsp), %r13
movabsq $0x695f726576726573, %rbp # imm = 0x695F726576726573
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x140(%rsp)
movaps %xmm0, 0x150(%rsp)
movaps %xmm0, 0x160(%rsp)
movaps %xmm0, 0x170(%rsp)
movaps %xmm0, 0x180(%rsp)
movaps %xmm0, 0x190(%rsp)
movaps %xmm0, 0x1a0(%rsp)
movaps %xmm0, 0x1b0(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2180
cmpl $0x2, %eax
jne 0x6b10
movq 0x50(%rsp), %rax
xorq %rbp, %rax
movzwl 0x58(%rsp), %ecx
xorq $0x70, %rcx
orq %rax, %rcx
je 0x6ad6
movq 0x50(%rsp), %rax
movabsq $0x705f726576726573, %rcx # imm = 0x705F726576726573
xorq %rcx, %rax
movl 0x58(%rsp), %ecx
xorq $0x74726f, %rcx         # imm = 0x74726F
orq %rax, %rcx
je 0x6adf
movq 0x50(%rsp), %rax
movabsq $0x6573755f63643365, %rcx # imm = 0x6573755F63643365
xorq %rcx, %rax
movzwl 0x58(%rsp), %ecx
xorq $0x72, %rcx
orq %rax, %rcx
je 0x6aef
movq 0x50(%rsp), %rax
movabsq $0x7361705f63643365, %rcx # imm = 0x7361705F63643365
xorq %rcx, %rax
movq 0x56(%rsp), %rcx
movabsq $0x64726f77737361, %rdx # imm = 0x64726F77737361
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6af8
movq 0x50(%rsp), %rax
movabsq $0x737361705f736561, %rcx # imm = 0x737361705F736561
xorq %rcx, %rax
movq 0x55(%rsp), %rcx
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6b01
movq 0x50(%rsp), %rax
movabsq $0x617a6c657a727577, %rcx # imm = 0x617A6C657A727577
xorq %rcx, %rax
movq 0x56(%rsp), %rcx
movabsq $0x72656c6865617a, %rdx # imm = 0x72656C6865617A
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6b2e
movabsq $0x786f626c6c6177, %rax # imm = 0x786F626C6C6177
cmpq %rax, 0x50(%rsp)
jne 0x66c3
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6b3e
movl 0x50(%rsp), %eax
movl $0x6e65706f, %ecx       # imm = 0x6E65706F
xorl %ecx, %eax
movl 0x53(%rsp), %ecx
movl $0x42576e, %edx         # imm = 0x42576E
xorl %edx, %ecx
orl %eax, %ecx
jne 0x66fb
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6b57
movl 0x50(%rsp), %eax
movl $0x31747865, %ecx       # imm = 0x31747865
xorl %ecx, %eax
movzbl 0x54(%rsp), %ecx
orl %eax, %ecx
jne 0x672d
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6b60
movl 0x50(%rsp), %eax
movl $0x32747865, %ecx       # imm = 0x32747865
xorl %ecx, %eax
movzbl 0x54(%rsp), %ecx
orl %eax, %ecx
jne 0x675f
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6b69
movl 0x50(%rsp), %eax
movl $0x33747865, %ecx       # imm = 0x33747865
xorl %ecx, %eax
movzbl 0x54(%rsp), %ecx
orl %eax, %ecx
jne 0x6791
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6b82
movl 0x50(%rsp), %eax
movl $0x37747865, %ecx       # imm = 0x37747865
xorl %ecx, %eax
movzbl 0x54(%rsp), %ecx
orl %eax, %ecx
jne 0x67c3
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6b8b
movl 0x50(%rsp), %eax
movl $0x75626564, %ecx       # imm = 0x75626564
xorl %ecx, %eax
movzwl 0x54(%rsp), %ecx
xorl $0x67, %ecx
orl %eax, %ecx
jne 0x67f8
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6b97
movd 0x60(%rsp), %xmm0
pcmpeqb 0xc96a(%rip), %xmm0     # 0x13170
movdqa 0x50(%rsp), %xmm1
pcmpeqb 0xc96c(%rip), %xmm1     # 0x13180
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x6b47
movdqu 0x53(%rsp), %xmm0
pcmpeqb 0xc95b(%rip), %xmm0     # 0x13190
movdqa 0x50(%rsp), %xmm1
pcmpeqb 0xc95d(%rip), %xmm1     # 0x131a0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x6b72
movd 0x60(%rsp), %xmm0
movd 0xc94c(%rip), %xmm2     # 0x131b0
pcmpeqb %xmm2, %xmm0
movdqa 0x50(%rsp), %xmm1
pcmpeqb 0xc94a(%rip), %xmm1     # 0x131c0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x6ba3
movd 0x60(%rsp), %xmm0
pcmpeqb %xmm2, %xmm0
movdqa 0x50(%rsp), %xmm1
pcmpeqb 0xc92f(%rip), %xmm1     # 0x131d0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x6bb6
movq 0x50(%rsp), %rax
movabsq $0x75747369656c7277, %rcx # imm = 0x75747369656C7277
xorq %rcx, %rax
movq 0x53(%rsp), %rcx
movabsq $0x676e7574736965, %rdx # imm = 0x676E7574736965
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6bc9
movdqa 0x50(%rsp), %xmm0
pcmpeqb 0xc8f1(%rip), %xmm0     # 0x131e0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x6bdc
movq 0x50(%rsp), %rax
movabsq $0x696d7265746e6977, %rcx # imm = 0x696D7265746E6977
xorq %rcx, %rax
movq 0x56(%rsp), %rcx
movabsq $0x6d756d696e696d, %rdx # imm = 0x6D756D696E696D
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6bf5
movq 0x50(%rsp), %rax
movabsq $0x616d72656d6d6f73, %rcx # imm = 0x616D72656D6D6F73
xorq %rcx, %rax
leaq 0x9f800(%rdx), %rcx
xorq 0x56(%rsp), %rcx
orq %rax, %rcx
je 0x6c0e
movq 0x50(%rsp), %rax
movabsq $0x616c72656d6d6f73, %rcx # imm = 0x616C72656D6D6F73
xorq %rcx, %rax
movq 0x57(%rsp), %rcx
movabsq $0x65646e65656461, %rdx # imm = 0x65646E65656461
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6c27
movq 0x50(%rsp), %rax
movabsq $0x73696570736e6965, %rcx # imm = 0x73696570736E6965
xorq %rcx, %rax
movq 0x57(%rsp), %rcx
movabsq $0x74696d696c6573, %rdx # imm = 0x74696D696C6573
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6c40
movq 0x50(%rsp), %rax
movabsq $0x776863736564616c, %rcx # imm = 0x776863736564616C
xorq %rcx, %rax
movq 0x55(%rsp), %rcx
movabsq $0x656c6c65776863, %rdx # imm = 0x656C6C65776863
xorq %rdx, %rcx
orq %rax, %rcx
je 0x6c59
movq 0x50(%rsp), %rax
movabsq $0x65646e656564616c, %rcx # imm = 0x65646E656564616C
xorq %rcx, %rax
movzbl 0x58(%rsp), %ecx
orq %rax, %rcx
je 0x6c6c
movl 0x50(%rsp), %eax
movl $0x696d7468, %ecx       # imm = 0x696D7468
xorl %ecx, %eax
movzwl 0x54(%rsp), %ecx
xorl $0x6e, %ecx
orl %eax, %ecx
je 0x6c7f
movq 0x50(%rsp), %rax
movabsq $0x6c656b636f737468, %rcx # imm = 0x6C656B636F737468
xorq %rcx, %rax
movzbl 0x58(%rsp), %ecx
orq %rax, %rcx
je 0x6c92
movl 0x50(%rsp), %eax
movl $0x6e6f7468, %ecx       # imm = 0x6E6F7468
xorl %ecx, %eax
movzbl 0x54(%rsp), %ecx
orl %eax, %ecx
je 0x6cab
movl 0x50(%rsp), %eax
movl $0x666f7468, %ecx       # imm = 0x666F7468
xorl %ecx, %eax
movzwl 0x54(%rsp), %ecx
xorl $0x66, %ecx
orl %eax, %ecx
je 0x6ccc
movl 0x50(%rsp), %eax
movl $0x61737468, %ecx       # imm = 0x61737468
xorl %ecx, %eax
movzwl 0x54(%rsp), %ecx
xorl $0x74, %ecx
orl %eax, %ecx
jne 0x6a9c
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
je 0x6ced
movl 0x50(%rsp), %eax
movl $0x75737468, %ecx       # imm = 0x75737468
xorl %ecx, %eax
movzwl 0x54(%rsp), %ecx
xorl $0x6e, %ecx
orl %eax, %ecx
jne 0x6b10
movl 0x140(%rsp), %eax
movl $0x65757274, %ecx       # imm = 0x65757274
xorl %ecx, %eax
movzbl 0x144(%rsp), %ecx
orl %eax, %ecx
jne 0x6b10
movb $0x1, 0x10c93(%rip)     # 0x17767
jmp 0x6b10
leaq 0x10aeb(%rip), %rdi     # 0x175c8
jmp 0x6b08
movq %r13, %rdi
callq 0x2240
movl %eax, 0x10aef(%rip)     # 0x175dc
jmp 0x6b10
leaq 0x10aea(%rip), %rdi     # 0x175e0
jmp 0x6b08
leaq 0x10b61(%rip), %rdi     # 0x17660
jmp 0x6b08
leaq 0x10bd8(%rip), %rdi     # 0x176e0
movq %r13, %rsi
callq 0x2170
movq %r15, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x2250
testq %rax, %rax
jne 0x651d
jmp 0x6cf9
movq %r13, %rdi
callq 0x2240
movb %al, 0x10c2d(%rip)      # 0x17769
jmp 0x6b10
movb $0x1, 0x10c1b(%rip)     # 0x17760
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movl %eax, 0x10c1b(%rip)     # 0x17770
jmp 0x6b10
movb $0x1, 0x10c0a(%rip)     # 0x17768
jmp 0x6b10
movb $0x1, 0x10bfa(%rip)     # 0x17761
jmp 0x6b10
movb $0x1, 0x10bf2(%rip)     # 0x17762
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movl %eax, 0x10bf4(%rip)     # 0x17774
jmp 0x6b10
movb $0x1, 0x10bda(%rip)     # 0x17763
jmp 0x6b10
movb $0x1, 0x10bd2(%rip)     # 0x17764
jmp 0x6b10
movb $0x1, 0x10bc7(%rip)     # 0x17765
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movl %eax, 0x10bc7(%rip)     # 0x17778
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movl %eax, 0x10bb8(%rip)     # 0x1777c
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movl %eax, 0x10ba9(%rip)     # 0x17780
jmp 0x6b10
movq %r13, %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10b94(%rip)    # 0x17784
jmp 0x6b10
movq %r13, %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10b7f(%rip)    # 0x17788
jmp 0x6b10
movq %r13, %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10b6a(%rip)    # 0x1778c
jmp 0x6b10
movq %r13, %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10b55(%rip)    # 0x17790
jmp 0x6b10
movq %r13, %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10b40(%rip)    # 0x17794
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movb %al, 0x10b03(%rip)      # 0x1776a
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movb %al, 0x10af1(%rip)      # 0x1776b
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
movl %eax, 0x10adf(%rip)     # 0x1776c
jmp 0x6b10
movq %r13, %rdi
callq 0x2240
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x10afa(%rip)    # 0x177a0
jmp 0x6b10
movq %r13, %rdi
callq 0x21e0
mulsd 0xc3e5(%rip), %xmm0     # 0x130a0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10ad1(%rip)    # 0x17798
jmp 0x6b10
movq %r13, %rdi
callq 0x21e0
mulsd 0xc3c4(%rip), %xmm0     # 0x130a0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10ab4(%rip)    # 0x1779c
jmp 0x6b10
movb $0x1, 0x10a72(%rip)     # 0x17766
jmp 0x6b10
movq %rbx, %rdi
callq 0x2190
testq %rbx, %rbx
jne 0x6d1b
leaq 0xcbf1(%rip), %rdi      # 0x138fe
leaq 0xca7a(%rip), %rsi      # 0x1378e
xorl %eax, %eax
callq 0x2040
testq %rbx, %rbx
je 0x73b3
cmpl $0x9, 0x10b21(%rip)     # 0x1784c
jg 0x73b3
leaq 0x138(%rsp), %rbp
movabsq $-0x1111111111111111, %r14 # imm = 0xEEEEEEEEEEEEEEEF
incl 0x10b03(%rip)           # 0x1784c
leaq 0xcbd4(%rip), %rdi      # 0x13924
leaq 0xcbe7(%rip), %rsi      # 0x1393e
xorl %eax, %eax
callq 0x2040
movl 0x10878(%rip), %edx     # 0x175dc
leaq 0xcbe0(%rip), %rdi      # 0x1394b
leaq 0x10856(%rip), %rbx     # 0x175c8
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2040
movl 0x1085a(%rip), %esi     # 0x175dc
movq %rbx, %rdi
callq 0x12360
movl %eax, 0xc(%rsp)
testl %eax, %eax
js 0x7390
leaq 0xcd46(%rip), %rdi      # 0x13ae3
callq 0x2220
movb $0x0, 0x10a8b(%rip)     # 0x17834
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x10a9b(%rip)    # 0x17850
movdqa %xmm0, 0x10aa3(%rip)    # 0x17860
movdqa %xmm0, 0x10aab(%rip)    # 0x17870
movdqa %xmm0, 0x10ab3(%rip)    # 0x17880
leaq 0x1090c(%rip), %rbx     # 0x176e0
movq %rbx, %rdi
callq 0x20b0
cmpq $0x20, %rax
movl $0x20, %ecx
cmovgeq %rcx, %rax
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x110(%rsp)
movdqa %xmm0, 0x100(%rsp)
leaq 0x100(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2120
leaq 0x105a0(%rip), %rbx     # 0x173bc
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
callq 0x8a9e
leaq 0x1037b(%rip), %r12     # 0x171b0
movq %r12, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
callq 0x8a9e
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd0f4
movq %r12, %rdi
movq %r15, %rsi
callq 0x8b1e
leaq 0xd0(%rsp), %rdi
callq 0x76c4
xorl %r15d, %r15d
pxor %xmm0, %xmm0
movdqa %xmm0, 0x10(%rsp)
cmpb $0x1, 0x109b6(%rip)     # 0x17834
jne 0x6eab
cmpl $0x0, 0x18(%rsp)
jne 0x6e9a
cmpb $0x1, 0x108d2(%rip)     # 0x17760
jne 0x6e9a
leaq 0x10(%rsp), %rdi
callq 0x336b
cmpl $0x0, 0x18(%rsp)
jne 0x6eab
leaq 0x10(%rsp), %rdi
callq 0x2acd
cmpl $0x0, 0x18(%rsp)
jne 0x6ec6
leaq 0x10(%rsp), %rdi
callq 0x3b4e
movl $0x1, %edi
callq 0x2100
movl 0x18(%rsp), %esi
testl %esi, %esi
je 0x7329
pxor %xmm0, %xmm0
movdqa %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
addl $0x1f, %esi
andl $-0x20, %esi
leaq 0x30(%rsp), %rdi
callq 0x756c
movl 0x18(%rsp), %edi
addq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
subq %rdi, %rdx
xorl %esi, %esi
callq 0x20e0
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x18(%rsp), %edx
callq 0x2120
leaq 0x10289(%rip), %rdi     # 0x171b0
leaq 0x10942(%rip), %rsi     # 0x17870
movl $0x20, %edx
callq 0x8b06
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
subq %rdx, %rcx
shrq $0x5, %rcx
leaq 0x10260(%rip), %rdi     # 0x171b0
movq %rdx, %rsi
movl $0x1, %r8d
callq 0xd01c
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rax
movdqu -0x20(%rax), %xmm0
movdqu -0x10(%rax), %xmm1
movl %eax, %edx
subl %esi, %edx
movdqa %xmm0, 0x108f2(%rip)    # 0x17870
movdqa %xmm1, 0x108fa(%rip)    # 0x17880
movl 0xc(%rsp), %edi
callq 0x124bb
movl %eax, %r12d
testl %eax, %eax
js 0x72cd
cmpb $0x1, 0x107c4(%rip)     # 0x17765
jne 0x6fb1
leaq 0xca0c(%rip), %rdi      # 0x139b6
xorl %eax, %eax
callq 0x2040
movb 0x108f9(%rip), %al      # 0x178b0
testb %al, %al
je 0x7347
movl $0x0, 0x2c(%rsp)
testb $0x1, %r15b
jne 0x72fb
movslq 0x108b8(%rip), %rax     # 0x17890
testq %rax, %rax
jg 0x6fe8
cmpl $0x0, 0x2c(%rsp)
jne 0x72fb
movq 0x108b1(%rip), %rsi     # 0x178a0
subq 0x108a2(%rip), %rsi     # 0x17898
movq %rsi, %rcx
subq %rax, %rcx
cmpq $0xfff, %rcx            # imm = 0xFFF
ja 0x7025
cmpq $0x10016, %rsi          # imm = 0x10016
jae 0x72ea
addq $0x1000, %rsi           # imm = 0x1000
leaq 0x10878(%rip), %rdi     # 0x17898
callq 0x756c
movq 0x1086c(%rip), %rax     # 0x17898
movslq 0x1085d(%rip), %rsi     # 0x17890
movl 0x10867(%rip), %edx     # 0x178a0
subl %eax, %edx
subl %esi, %edx
addq %rax, %rsi
movl 0xc(%rsp), %edi
callq 0x12513
testl %eax, %eax
js 0x7283
je 0x729d
addl %eax, 0x10833(%rip)     # 0x17890
movb $0x1, %bl
testb $0x1, %r15b
jne 0x72c3
movslq 0x10820(%rip), %r12     # 0x17890
movq %r12, %r13
andq $-0x20, %r13
testl %r13d, %r13d
je 0x71ab
pxor %xmm0, %xmm0
movdqa %xmm0, 0xe0(%rsp)
movq $0x0, 0xf0(%rsp)
leaq 0xe0(%rsp), %rdi
movq %r13, %rsi
callq 0x756c
leaq 0x1030c(%rip), %rdi     # 0x173bc
leaq 0x10799(%rip), %rsi     # 0x17850
movl $0x20, %edx
callq 0x8b06
movq 0x107d0(%rip), %rsi     # 0x17898
movq 0xe0(%rsp), %rdx
sarl $0x5, %r12d
leaq 0x102e1(%rip), %rdi     # 0x173bc
movl %r12d, %ecx
movl $0x1, %r8d
callq 0x11c0c
movq 0xe0(%rsp), %r12
movq %rbp, %rdi
callq 0x76c4
leaq 0x118(%rsp), %rax
pxor %xmm0, %xmm0
movdqu %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl %r13d, 0xdc(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
leaq 0xdc(%rsp), %rdx
leaq 0x100(%rsp), %rcx
callq 0x7e12
movl %eax, %r13d
testl %eax, %eax
js 0x71b3
movq 0x104(%rsp), %rcx
movq 0x118(%rsp), %rax
movq %rcx, 0x1065e(%rip)     # 0x177b0
cmpq %rax, 0x120(%rsp)
je 0x7199
movl $0x1, %r12d
xorl %ecx, %ecx
leaq (%rcx,%rcx,4), %rcx
leaq (%rcx,%rcx,2), %rsi
addq %rax, %rsi
movq %rbp, %rdi
callq 0x493b
movl %r12d, %ecx
movq 0x118(%rsp), %rax
movq 0x120(%rsp), %rdx
subq %rax, %rdx
imulq %r14, %rdx
incl %r12d
cmpq %rcx, %rdx
ja 0x7164
movq %rbp, %rdi
leaq 0x118(%rsp), %rsi
callq 0x801a
jmp 0x71c0
xorl %r12d, %r12d
jmp 0x7278
cmpl $-0x5, %r13d
movl $0x0, %eax
cmovel %eax, %r13d
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x71dd
movq 0x128(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq %rbp, %rdi
callq 0x76d0
testl %r13d, %r13d
js 0x723f
je 0x7258
addl $0x1f, %r13d
andl $0x7fffffe0, %r13d      # imm = 0x7FFFFFE0
movq 0x1069a(%rip), %rdi     # 0x17898
leaq (%rdi,%r13), %rsi
movdqu -0x20(%rdi,%r13), %xmm0
movdqu -0x10(%rdi,%r13), %xmm1
movdqa %xmm0, 0x10638(%rip)    # 0x17850
movdqa %xmm1, 0x10640(%rip)    # 0x17860
movq 0x10679(%rip), %rdx     # 0x178a0
subq %rsi, %rdx
callq 0x2120
subl %r13d, 0x1065a(%rip)    # 0x17890
incl 0x2c(%rsp)
movb $0x1, %r12b
jmp 0x725b
xorl %r12d, %r12d
leaq 0xc7fc(%rip), %rdi      # 0x13a45
movl %r13d, %esi
xorl %eax, %eax
callq 0x2040
movb $0x1, %r15b
jmp 0x725b
xorl %r12d, %r12d
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x7278
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
testb %r12b, %r12b
jne 0x705d
jmp 0x72c3
callq 0x2030
movl (%rax), %esi
cmpl $0xb, %esi
jne 0x72b0
leaq 0xc890(%rip), %rdi      # 0x13b26
callq 0x2220
jmp 0x72ac
leaq 0xc868(%rip), %rdi      # 0x13b0c
callq 0x2220
movb $0x1, %r15b
xorl %ebx, %ebx
jmp 0x72c3
xorl %ebx, %ebx
leaq 0xc76c(%rip), %rdi      # 0x13a25
xorl %eax, %eax
callq 0x2040
movb $0x1, %r15b
testb %bl, %bl
jne 0x6fc7
jmp 0x72fb
callq 0x2030
movl (%rax), %edx
leaq 0xc6bb(%rip), %rdi      # 0x13996
movl %r12d, %esi
xorl %eax, %eax
callq 0x2040
movb $0x1, %r15b
jmp 0x7312
leaq 0xc712(%rip), %rdi      # 0x13a03
xorl %eax, %eax
callq 0x2040
movb $0x1, %r15b
cmpb $0x1, 0x10463(%rip)     # 0x17765
jne 0x7312
leaq 0xc6bd(%rip), %rdi      # 0x139c8
xorl %eax, %eax
callq 0x2040
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x7329
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0xd0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8622
testb $0x1, %r15b
je 0x6e6d
jmp 0x7351
callq 0x2300
jmp 0x6fbf
leaq 0xc680(%rip), %rdi      # 0x139d8
xorl %eax, %eax
callq 0x2040
leaq 0xd0(%rsp), %rdi
callq 0x76d0
movl 0x104da(%rip), %esi     # 0x1784c
leaq 0xc5ee(%rip), %rdi      # 0x13967
xorl %eax, %eax
callq 0x2040
movl 0xc(%rsp), %edi
callq 0x124a4
movl $0xa, %edi
jmp 0x73a1
leaq 0xc763(%rip), %rdi      # 0x13afa
callq 0x2220
movl $0x1, %edi
callq 0x2100
cmpl $0x9, 0x1049f(%rip)     # 0x1784c
jle 0x6d43
leaq 0xc5c2(%rip), %rdi      # 0x1397c
xorl %eax, %eax
callq 0x2040
xorl %eax, %eax
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x73de
jmp 0x73de
movq %rax, %rbx
jmp 0x744f
movq %rax, %rbx
jmp 0x7438
jmp 0x73ee
jmp 0x73e9
jmp 0x73ee
movq %rax, %rbx
jmp 0x741b
movq %rax, %rbx
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x740e
movq 0x128(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0x138(%rsp), %rdi
callq 0x76d0
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x7438
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x744f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21b0
leaq 0xd0(%rsp), %rdi
callq 0x76d0
movq %rbx, %rdi
callq 0x2290