// File: 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:
subq $0x248, %rsp            # imm = 0x248
movl $0x0, 0x244(%rsp)
movl %edi, 0x240(%rsp)
movq %rsi, 0x238(%rsp)
leaq 0x19d9f(%rip), %rdi     # 0x216a7
leaq 0x19e2d(%rip), %rsi     # 0x2173c
callq 0x2200
movq %rax, 0x230(%rsp)
cmpq $0x0, 0x230(%rsp)
jne 0x7942
leaq 0x19d9d(%rip), %rdi     # 0x216cb
leaq 0x19e07(%rip), %rsi     # 0x2173c
callq 0x2200
movq %rax, 0x230(%rsp)
movb $0x0, 0x1ee57(%rip)     # 0x267a0
movb $0x0, 0x1ee58(%rip)     # 0x267a8
movb $0x0, 0x1ee4a(%rip)     # 0x267a1
movb $0x0, 0x1ee44(%rip)     # 0x267a2
movb $0x0, 0x1ee3e(%rip)     # 0x267a3
movb $0x0, 0x1ee38(%rip)     # 0x267a4
movb $0x0, 0x1ee32(%rip)     # 0x267a5
movb $0x0, 0x1ee2f(%rip)     # 0x267a9
movl $0x384, 0x1ee2c(%rip)   # imm = 0x384
movl $0x5dc, 0x1ee26(%rip)   # imm = 0x5DC
movl $0x1f4, 0x1ee20(%rip)   # imm = 0x1F4
movl $0xbb8, 0x1ee1a(%rip)   # imm = 0xBB8
movl $0x2ee0, 0x1ee14(%rip)  # imm = 0x2EE0
movss 0x19758(%rip), %xmm0    # 0x2110c
movss %xmm0, 0x1ee08(%rip)    # 0x267c4
movss 0x19744(%rip), %xmm0    # 0x21108
movss %xmm0, 0x1edfc(%rip)    # 0x267c8
movss 0x19730(%rip), %xmm0    # 0x21104
movss %xmm0, 0x1edf0(%rip)    # 0x267cc
movss 0x1971c(%rip), %xmm0    # 0x21100
movss %xmm0, 0x1ede4(%rip)    # 0x267d0
movss 0x19708(%rip), %xmm0    # 0x210fc
movss %xmm0, 0x1edd8(%rip)    # 0x267d4
movb $0x32, 0x1eda7(%rip)    # 0x267aa
movb $0x50, 0x1eda1(%rip)    # 0x267ab
movl $0x0, 0x1ed98(%rip)     # 0x267ac
movb $0x0, 0x1ed8b(%rip)     # 0x267a6
movb $0x0, 0x1ed85(%rip)     # 0x267a7
xorps %xmm0, %xmm0
movss %xmm0, 0x1edab(%rip)    # 0x267d8
movss 0x196c3(%rip), %xmm0    # 0x210f8
movss %xmm0, 0x1ed9f(%rip)    # 0x267dc
xorps %xmm0, %xmm0
movss %xmm0, 0x1ed98(%rip)    # 0x267e0
cmpq $0x0, 0x230(%rsp)
je 0x81c3
jmp 0x7a59
leaq 0x30(%rsp), %rdi
movq 0x230(%rsp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x22a0
cmpq $0x0, %rax
je 0x81b6
leaq 0x1b0(%rsp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x2110
leaq 0x130(%rsp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x2110
leaq 0x30(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
leaq 0x130(%rsp), %rcx
leaq 0x19c1d(%rip), %rsi     # 0x216db
movb $0x0, %al
callq 0x21c0
cmpl $0x2, %eax
jne 0x81b1
leaq 0x1b0(%rsp), %rdi
leaq 0x19c18(%rip), %rsi     # 0x216f5
callq 0x2270
cmpl $0x0, %eax
jne 0x7b00
leaq 0x130(%rsp), %rsi
leaq 0x1eb12(%rip), %rdi     # 0x26608
callq 0x21b0
jmp 0x81af
leaq 0x1b0(%rsp), %rdi
leaq 0x19bf0(%rip), %rsi     # 0x216ff
callq 0x2270
cmpl $0x0, %eax
jne 0x7b31
leaq 0x130(%rsp), %rdi
callq 0x2290
movl %eax, 0x1eaf0(%rip)     # 0x2661c
jmp 0x81ad
leaq 0x1b0(%rsp), %rdi
leaq 0x19bcb(%rip), %rsi     # 0x2170b
callq 0x2270
cmpl $0x0, %eax
jne 0x7b63
leaq 0x130(%rsp), %rsi
leaq 0x1eac7(%rip), %rdi     # 0x26620
callq 0x21b0
jmp 0x81ab
leaq 0x1b0(%rsp), %rdi
leaq 0x19ba3(%rip), %rsi     # 0x21715
callq 0x2270
cmpl $0x0, %eax
jne 0x7b95
leaq 0x130(%rsp), %rsi
leaq 0x1eb15(%rip), %rdi     # 0x266a0
callq 0x21b0
jmp 0x81a9
leaq 0x1b0(%rsp), %rdi
leaq 0x19b7f(%rip), %rsi     # 0x21723
callq 0x2270
cmpl $0x0, %eax
jne 0x7bc7
leaq 0x130(%rsp), %rsi
leaq 0x1eb63(%rip), %rdi     # 0x26720
callq 0x21b0
jmp 0x81a7
leaq 0x1b0(%rsp), %rdi
leaq 0x19b5a(%rip), %rsi     # 0x21730
callq 0x2270
cmpl $0x0, %eax
jne 0x7bf8
leaq 0x130(%rsp), %rdi
callq 0x2290
movb %al, 0x1ebb6(%rip)      # 0x267a9
jmp 0x81a5
leaq 0x1b0(%rsp), %rdi
leaq 0x19b37(%rip), %rsi     # 0x2173e
callq 0x2270
cmpl $0x0, %eax
jne 0x7c36
leaq 0x130(%rsp), %rdi
leaq 0x19b26(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x7c36
movb $0x1, 0x1eb6f(%rip)     # 0x267a0
jmp 0x81a3
leaq 0x1b0(%rsp), %rdi
leaq 0x19b06(%rip), %rsi     # 0x2174b
callq 0x2270
cmpl $0x0, %eax
jne 0x7c74
leaq 0x130(%rsp), %rdi
leaq 0x19ae8(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x7c74
movb $0x1, 0x1eb39(%rip)     # 0x267a8
jmp 0x81a1
leaq 0x1b0(%rsp), %rdi
leaq 0x19acf(%rip), %rsi     # 0x21752
callq 0x2270
cmpl $0x0, %eax
jne 0x7cb2
leaq 0x130(%rsp), %rdi
leaq 0x19aaa(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x7cb2
movb $0x1, 0x1eaf4(%rip)     # 0x267a1
jmp 0x819f
leaq 0x1b0(%rsp), %rdi
leaq 0x19a96(%rip), %rsi     # 0x21757
callq 0x2270
cmpl $0x0, %eax
jne 0x7cf0
leaq 0x130(%rsp), %rdi
leaq 0x19a6c(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x7cf0
movb $0x1, 0x1eab7(%rip)     # 0x267a2
jmp 0x819d
leaq 0x1b0(%rsp), %rdi
leaq 0x19a5d(%rip), %rsi     # 0x2175c
callq 0x2270
cmpl $0x0, %eax
jne 0x7d2e
leaq 0x130(%rsp), %rdi
leaq 0x19a2e(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x7d2e
movb $0x1, 0x1ea7a(%rip)     # 0x267a3
jmp 0x819b
leaq 0x1b0(%rsp), %rdi
leaq 0x19a24(%rip), %rsi     # 0x21761
callq 0x2270
cmpl $0x0, %eax
jne 0x7d6c
leaq 0x130(%rsp), %rdi
leaq 0x199f0(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x7d6c
movb $0x1, 0x1ea3d(%rip)     # 0x267a4
jmp 0x8199
leaq 0x1b0(%rsp), %rdi
leaq 0x199eb(%rip), %rsi     # 0x21766
callq 0x2270
cmpl $0x0, %eax
jne 0x7daa
leaq 0x130(%rsp), %rdi
leaq 0x199b2(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x7daa
movb $0x1, 0x1ea00(%rip)     # 0x267a5
jmp 0x8197
leaq 0x1b0(%rsp), %rdi
leaq 0x199b3(%rip), %rsi     # 0x2176c
callq 0x2270
cmpl $0x0, %eax
jne 0x7ddb
leaq 0x130(%rsp), %rdi
callq 0x2290
movl %eax, 0x1e9da(%rip)     # 0x267b0
jmp 0x8195
leaq 0x1b0(%rsp), %rdi
leaq 0x19996(%rip), %rsi     # 0x21780
callq 0x2270
cmpl $0x0, %eax
jne 0x7e0c
leaq 0x130(%rsp), %rdi
callq 0x2290
movl %eax, 0x1e9ad(%rip)     # 0x267b4
jmp 0x8193
leaq 0x1b0(%rsp), %rdi
leaq 0x19978(%rip), %rsi     # 0x21793
callq 0x2270
cmpl $0x0, %eax
jne 0x7e3d
leaq 0x130(%rsp), %rdi
callq 0x2290
movl %eax, 0x1e980(%rip)     # 0x267b8
jmp 0x8191
leaq 0x1b0(%rsp), %rdi
leaq 0x1995b(%rip), %rsi     # 0x217a7
callq 0x2270
cmpl $0x0, %eax
jne 0x7e6e
leaq 0x130(%rsp), %rdi
callq 0x2290
movl %eax, 0x1e953(%rip)     # 0x267bc
jmp 0x818f
leaq 0x1b0(%rsp), %rdi
leaq 0x1993e(%rip), %rsi     # 0x217bb
callq 0x2270
cmpl $0x0, %eax
jne 0x7e9f
leaq 0x130(%rsp), %rdi
callq 0x2290
movl %eax, 0x1e926(%rip)     # 0x267c0
jmp 0x818d
leaq 0x1b0(%rsp), %rdi
leaq 0x19918(%rip), %rsi     # 0x217c6
callq 0x2270
cmpl $0x0, %eax
jne 0x7ed6
leaq 0x130(%rsp), %rdi
callq 0x2220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e8f3(%rip)    # 0x267c4
jmp 0x818b
leaq 0x1b0(%rsp), %rdi
leaq 0x198f1(%rip), %rsi     # 0x217d6
callq 0x2270
cmpl $0x0, %eax
jne 0x7f0d
leaq 0x130(%rsp), %rdi
callq 0x2220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e8c0(%rip)    # 0x267c8
jmp 0x8189
leaq 0x1b0(%rsp), %rdi
leaq 0x198c8(%rip), %rsi     # 0x217e4
callq 0x2270
cmpl $0x0, %eax
jne 0x7f44
leaq 0x130(%rsp), %rdi
callq 0x2220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e88d(%rip)    # 0x267cc
jmp 0x8187
leaq 0x1b0(%rsp), %rdi
leaq 0x1989f(%rip), %rsi     # 0x217f2
callq 0x2270
cmpl $0x0, %eax
jne 0x7f7b
leaq 0x130(%rsp), %rdi
callq 0x2220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e85a(%rip)    # 0x267d0
jmp 0x8185
leaq 0x1b0(%rsp), %rdi
leaq 0x19877(%rip), %rsi     # 0x21801
callq 0x2270
cmpl $0x0, %eax
jne 0x7fb2
leaq 0x130(%rsp), %rdi
callq 0x2220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e827(%rip)    # 0x267d4
jmp 0x8183
leaq 0x1b0(%rsp), %rdi
leaq 0x1984f(%rip), %rsi     # 0x21810
callq 0x2270
cmpl $0x0, %eax
jne 0x7fe3
leaq 0x130(%rsp), %rdi
callq 0x2290
movb %al, 0x1e7cc(%rip)      # 0x267aa
jmp 0x8181
leaq 0x1b0(%rsp), %rdi
leaq 0x19806(%rip), %rsi     # 0x217f8
callq 0x2270
cmpl $0x0, %eax
jne 0x8014
leaq 0x130(%rsp), %rdi
callq 0x2290
movb %al, 0x1e79c(%rip)      # 0x267ab
jmp 0x817f
leaq 0x1b0(%rsp), %rdi
leaq 0x197fa(%rip), %rsi     # 0x2181d
callq 0x2270
cmpl $0x0, %eax
jne 0x8045
leaq 0x130(%rsp), %rdi
callq 0x2290
movl %eax, 0x1e76c(%rip)     # 0x267ac
jmp 0x817d
leaq 0x1b0(%rsp), %rdi
leaq 0x197cf(%rip), %rsi     # 0x21823
callq 0x2270
cmpl $0x0, %eax
jne 0x807c
leaq 0x130(%rsp), %rdi
callq 0x2290
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x1e769(%rip)    # 0x267e0
jmp 0x817b
leaq 0x1b0(%rsp), %rdi
leaq 0x197a1(%rip), %rsi     # 0x2182c
callq 0x2270
cmpl $0x0, %eax
jne 0x80bf
leaq 0x130(%rsp), %rdi
callq 0x2220
movsd 0x18f6e(%rip), %xmm1    # 0x21018
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e71e(%rip)    # 0x267d8
jmp 0x8179
leaq 0x1b0(%rsp), %rdi
leaq 0x19763(%rip), %rsi     # 0x21831
callq 0x2270
cmpl $0x0, %eax
jne 0x80ff
leaq 0x130(%rsp), %rdi
callq 0x2220
movsd 0x18f2b(%rip), %xmm1    # 0x21018
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e6df(%rip)    # 0x267dc
jmp 0x8177
leaq 0x1b0(%rsp), %rdi
leaq 0x19729(%rip), %rsi     # 0x21837
callq 0x2270
cmpl $0x0, %eax
jne 0x813a
leaq 0x130(%rsp), %rdi
leaq 0x1961f(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x813a
movb $0x1, 0x1e66e(%rip)     # 0x267a6
jmp 0x8175
leaq 0x1b0(%rsp), %rdi
leaq 0x196f4(%rip), %rsi     # 0x2183d
callq 0x2270
cmpl $0x0, %eax
jne 0x8173
leaq 0x130(%rsp), %rdi
leaq 0x195e4(%rip), %rsi     # 0x21746
callq 0x2270
cmpl $0x0, %eax
jne 0x8173
movb $0x1, 0x1e634(%rip)     # 0x267a7
jmp 0x8175
jmp 0x8177
jmp 0x8179
jmp 0x817b
jmp 0x817d
jmp 0x817f
jmp 0x8181
jmp 0x8183
jmp 0x8185
jmp 0x8187
jmp 0x8189
jmp 0x818b
jmp 0x818d
jmp 0x818f
jmp 0x8191
jmp 0x8193
jmp 0x8195
jmp 0x8197
jmp 0x8199
jmp 0x819b
jmp 0x819d
jmp 0x819f
jmp 0x81a1
jmp 0x81a3
jmp 0x81a5
jmp 0x81a7
jmp 0x81a9
jmp 0x81ab
jmp 0x81ad
jmp 0x81af
jmp 0x81b1
jmp 0x7a59
movq 0x230(%rsp), %rdi
callq 0x21d0
cmpq $0x0, 0x230(%rsp)
jne 0x81e3
leaq 0x1966e(%rip), %rdi     # 0x21843
leaq 0x194ef(%rip), %rsi     # 0x216cb
movb $0x0, %al
callq 0x2040
cmpq $0x0, 0x230(%rsp)
je 0x8394
jmp 0x81f4
cmpl $0xa, 0x1e851(%rip)     # 0x26a4c
jge 0x8392
movl 0x1e845(%rip), %eax     # 0x26a4c
addl $0x1, %eax
movl %eax, 0x1e83c(%rip)     # 0x26a4c
leaq 0x19652(%rip), %rdi     # 0x21869
leaq 0x19665(%rip), %rsi     # 0x21883
movb $0x0, %al
callq 0x2040
movl 0x1e3f1(%rip), %edx     # 0x2661c
leaq 0x1965e(%rip), %rdi     # 0x21890
leaq 0x1e3cf(%rip), %rsi     # 0x26608
movb $0x0, %al
callq 0x2040
movl 0x1e3d6(%rip), %esi     # 0x2661c
leaq 0x1e3bb(%rip), %rdi     # 0x26608
callq 0x20c20
movl %eax, 0x1df70(%rip)     # 0x261c8
cmpl $0x0, 0x1df69(%rip)     # 0x261c8
jge 0x827e
leaq 0x19644(%rip), %rdi     # 0x218ac
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x2140
jmp 0x81f4
leaq 0x1963a(%rip), %rdi     # 0x218bf
movb $0x0, %al
callq 0x2040
movl $0x0, 0x1e79e(%rip)     # 0x26a34
leaq 0x1e7b3(%rip), %rdi     # 0x26a50
movl $0xff, %esi
movl $0x20, %edx
callq 0x2110
leaq 0x1e7bd(%rip), %rdi     # 0x26a70
movl $0xff, %esi
movl $0x20, %edx
callq 0x2110
leaq 0x1e457(%rip), %rdi     # 0x26720
callq 0x20e0
movq %rax, 0x28(%rsp)
cmpq $0x20, 0x28(%rsp)
jle 0x82e4
movq $0x20, 0x28(%rsp)
movq %rsp, %rdi
movl $0xff, %esi
movl $0x20, %edx
callq 0x2110
movq %rsp, %rdi
movq 0x28(%rsp), %rdx
leaq 0x1e303(%rip), %rsi     # 0x26608
addq $0x118, %rsi            # imm = 0x118
callq 0x2160
leaq 0x1e0e4(%rip), %rdi     # 0x263fc
movl $0x100, %edx            # imm = 0x100
movl %edx, %esi
callq 0xe0f0
leaq 0x1dec5(%rip), %rdi     # 0x261f0
movl $0x100, %edx            # imm = 0x100
movl %edx, %esi
callq 0xe0f0
movq %rsp, %rsi
leaq 0x1e0bb(%rip), %rdi     # 0x263fc
callq 0x16d90
movq %rsp, %rsi
leaq 0x1dea0(%rip), %rdi     # 0x261f0
callq 0xe240
callq 0x83b0
movl 0x1e6ec(%rip), %esi     # 0x26a4c
leaq 0x19570(%rip), %rdi     # 0x218d7
movb $0x0, %al
callq 0x2040
movl 0x1de54(%rip), %edi     # 0x261c8
callq 0x20dd0
movl $0xffffffff, 0x1de45(%rip) # imm = 0xFFFFFFFF
movl $0xa, %edi
callq 0x2140
jmp 0x81f4
jmp 0x8394
leaq 0x19551(%rip), %rdi     # 0x218ec
movb $0x0, %al
callq 0x2040
xorl %eax, %eax
addq $0x248, %rsp            # imm = 0x248
retq
nopl (%rax)