// File: /workspace/github_cpp_makefile_star2_O3/Eba-M[P]E3DC-Control/awattar.cpp
// Function: openmeteo(std::vector<watt_s, std::allocator<watt_s>>&, std::vector<wetter_s, std::allocator<wetter_s>>&, e3dc_config_t&, int, unsigned int*)
void openmeteo(std::vector<watt_s> &w,std::vector<wetter_s>  &wetter, e3dc_config_t &e3dc,int anlage,u_int32_t iDayStat[25*4*2+1])
{
    FILE * fp;
    char line[1024];
    char path [65000];
    char value[25];
    char var[25];
    char var2[25];

    int x1 = 0;
    int x2 = 0;
    int x3 = 10; // 10kWp
    if (w.size()==0)
    {
        printf("keine Börsenpreise");
        return;
    }
    if (wetter.size()==0) 
    {
        printf("keine Wetterdaten");
        return;
    }
    int len = strlen(e3dc.Forecast[anlage]);
    
    if (anlage >=0)
    {
        if (len>sizeof(line)||len==0)
        {
            //            printf("forecast #%i kann nicht verarbeitet werden ",anlage+1);
            if (anlage >0)
            return;
        }
        else
        {
            memcpy(&line,&e3dc.Forecast[anlage],len);
            memset(var, 0, sizeof(var));
            memset(var2, 0, sizeof(var2));
            memset(value, 0, sizeof(value));
            for(int j = 0;j<len&&x1==0;j++)
            {
                if (line[j]=='/') x1=j;
            }
            x2=0;
            for(int j=x1+1;j<len&&x2==0;j++)
            {
                if (line[j]=='/') x2=j;
            }
            if (x1>0&&x2-x1-1>0&&len-x2-1>0)
            {
                memcpy(&var,&line[0],x1);
                memcpy(&var2,&line[x1+1],x2-x1-1);
                memcpy(&value,&line[x2+1],len-x2-1);
            }
            else
                return;
            x1 = atoi(var);
            x2 = atoi(var2);
            x3 = atoi(value);
        }
    }

   if (x3>0)
      {
          if (e3dc.debug)
              printf("om.1\n");
          sprintf(line,"curl -s -X GET 'https://api.open-meteo.com/v1/forecast?latitude=%f&longitude=%f&minutely_15=global_tilted_irradiance_instant&timeformat=unixtime&forecast_minutely_15=192&tilt=%i&azimuth=%i'",e3dc.hoehe,e3dc.laenge,x1,x2);

          fp = NULL;
          fp = popen(line, "r");
          int fd = fileno(fp);
          int flags = fcntl(fd, F_GETFL, 0);
          flags |= O_NONBLOCK;
          fcntl(fd, F_SETFL, flags);
          fp_status = 2;

        int timeout = 0;
          if (e3dc.debug)
              printf("om.2\n");
          if (fp != NULL)
          while (fgets(path, sizeof(path), fp) == NULL&&timeout < 30)
        {
            sleep(1);
            timeout++;
        }
          if (e3dc.debug)
              printf("om%i.3\n",timeout);

          if (timeout >= 30)
          {
              if (fp!=NULL) pclose(fp);
              return;
          }
        {
            const cJSON *item = NULL;
            const cJSON *item1 = NULL;
            const cJSON *item2 = NULL;

            std::string feld;
            cJSON *wolf_json = cJSON_Parse(path);
            feld = "minutely_15";
            char * c = &feld[0];
            item = cJSON_GetObjectItemCaseSensitive(wolf_json, c );
            feld = "time";
            item1 = cJSON_GetObjectItemCaseSensitive(item, c );
            feld = "global_tilted_irradiance_instant";
            c = &feld[0];
            item2 = cJSON_GetObjectItemCaseSensitive(item, c );
            if (item1!=NULL)
            item1 = item1->child;
            if (item1!=NULL)
            item2 = item2->child;
            int x1 = 0;
            int x2 = 0;
            if (e3dc.debug)
                printf("om.4\n");
            while (item1!=NULL)
            {
                if (w.size()>0)
//                while (w[x1].hh < item1->valueint&&x1<w.size())
//                    x1++;
                while (x2<wetter.size()-1&&wetter[x2].hh < item1->valueint)  // um 15min verschieben
//                while (x2<wetter.size()-1&&wetter[x2].hh < item1->valueint-900)  // um 15min verschieben
                    x2++;
                if (x2 >= wetter.size()-1)
                    break;
                if (wetter[x2].hh == item1->valueint)
//                    if (wetter[x2].hh == item1->valueint-900)
                {
                    // index 200 heutiger Ertrag 15min
                    // index 199 heutige Prognose kumuliert
                    // Index 198 heutiger Ertrag kumuliert

                    int y1 = wetter[x2].hh%(24*3600)/900;
                    float f2 = iDayStat[y1]/100.0;  // Soll
                    float f3 = iDayStat[y1+96]/(e3dc.speichergroesse*10*3600);  //Ist
                    // aktuelle PV-Leistung ermitteln aus Prog
                    float f4 = (iDayStat[199]) * e3dc.speichergroesse/10000.0;
                    float f5 = iDayStat[198]/3600.0/1000.0;
                    float f6 = 1;
//                    if (f4>1&&f5>0&&(wetter[x2].hh-wetter[0].hh)<12*3600) // erst nach der ersten kWh
                        if (f4>1&&f5>0) // erst nach der ersten kWh
                        f6 = f5/f4;
                    if (f6<0.1) f6 = 0.1;  // schneebedeckte Module?
                    if (f6>10) f6 = 10;
                    float f7 = 0;
//                    if (iDayStat[y1]>0&&f2>f3)
                    if (f2>0.1)
                        f7 = f3/f2;
// absoluter Ertrag des letzen 15min
                    float f8 = iDayStat[197] /(e3dc.speichergroesse*10*3600);
                    f8 = f8 * (10 - x2)/10;
                    
                    // relativer ertrag aus statistik höher als aktueller ertrag
                    if (f4 > 1&&x2<10)
                        f6 = (f7*(x2+1)+(10-x2)*f6)/(11);
                    else
                        if (f7>0)
                            f6=f7;
//                    if (x2<10)
//                    f6 = (f6*(x2)+f8*(10-x2))/10;

                    if (anlage==0){
                        wetter[x2].progsolar = item2->valuedouble*x3/4/e3dc.speichergroesse/10;
                        
                            wetter[x2].solar = wetter[x2].progsolar*f6;

                        // (15min Intervall daher /4
                    }
                    else {
                            wetter[x2].progsolar = wetter[x2].progsolar+item2->valuedouble*x3/4/e3dc.speichergroesse/10;
                            wetter[x2].solar = wetter[x2].progsolar*f6;

                    }
                    int hh = wetter[x2].hh-wetter[0].hh;
                    if (wetter[x2].solar<f8&&wetter[x2].progsolar*f6>f8
                        &&
                        (wetter[x2].hh-wetter[0].hh)<12*3600)    // 12h
                            (wetter[x2].solar=(2*f8+wetter[x2].progsolar*f6)/3);
                    else
                        if (wetter[x2].solar<f8&&wetter[x2].progsolar*f6>f8
                            &&
                            (wetter[x2].hh-wetter[0].hh)<12*3600)    // 12h
                                (wetter[x2].solar=(1*f8+wetter[x2].progsolar*f6)/2);
                        else
                            if (wetter[x2].solar<f8&&wetter[x2].progsolar*f6<f8
                                && (wetter[x2].progsolar > 1) &&
                                (wetter[x2].hh-wetter[0].hh)<12*3600)    // 12h
                                    (wetter[x2].solar=(wetter[x2].progsolar*f6+f8)/2);
                            else
                        wetter[x2].solar = wetter[x2].progsolar*f6;
                    if (x2=1&&wetter[0].solar==0&&wetter[0].progsolar==0)
                    {
                        wetter[0].solar = wetter[1].solar;
                        wetter[0].progsolar = wetter[1].progsolar;
                    }
                    x1++;
                    x2++;
                    if (x2 > wetter.size())
                    {                        
                        if (e3dc.debug)
                            printf("om.bfc\n");
                        if (fp!=NULL) pclose(fp);
                        if (e3dc.debug)
                        printf("om.afc\n");
                        return;
                    }
                }
                item1 = item1->next;
                item2 = item2->next;

            }
            if (e3dc.debug)
                printf("om.bfc\n");
            if (fp!=NULL) pclose(fp);
            if (e3dc.debug)
            printf("om.afc\n");
            return;
        }
    }
    if (e3dc.debug)
        printf("om.5");
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10288, %rsp          # imm = 0x10288
movq %r8, 0x38(%rsp)
movq 0x8(%rdi), %rax
cmpq (%rdi), %rax
je 0x2608b
movq %rsi, %r12
movq 0x8(%rsi), %rax
cmpq (%rsi), %rax
je 0x26094
movq %rdi, %r13
movl %ecx, 0x10(%rsp)
movslq %ecx, %r14
leaq (%r14,%r14,4), %rax
movq %rdx, 0x8(%rsp)
leaq (%rdx,%rax,4), %rbx
addq $0x664, %rbx            # imm = 0x664
movq %rbx, %rdi
callq 0x2100
movq %rax, %rbp
movl $0xa, %eax
xorl %r15d, %r15d
testl %r14d, %r14d
js 0x260b3
movslq %ebp, %rdx
cmpq $0x401, %rdx            # imm = 0x401
setae %sil
testl %ebp, %ebp
sete %cl
orb %sil, %cl
cmpb $0x1, %cl
jne 0x261fe
movl $0x0, %ebp
cmpl $0x0, 0x10(%rsp)
jne 0x26833
jmp 0x260b5
leaq 0xc52a(%rip), %rdi      # 0x325bc
jmp 0x2609b
leaq 0xc535(%rip), %rdi      # 0x325d0
xorl %eax, %eax
addq $0x10288, %rsp          # imm = 0x10288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040
xorl %ebp, %ebp
movl %eax, 0x14(%rsp)
movq 0x8(%rsp), %rbx
cmpb $0x1, 0x52d(%rbx)
jne 0x260d3
leaq 0xc8f1(%rip), %rdi      # 0x329bf
callq 0x2400
xorps %xmm0, %xmm0
cvtss2sd 0x5e0(%rbx), %xmm0
cvtss2sd 0x5e4(%rbx), %xmm1
leaq 0xc4f5(%rip), %rsi      # 0x325e2
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movl %r15d, %edx
movl %ebp, %ecx
movb $0x2, %al
callq 0x2050
leaq 0xc925(%rip), %rsi      # 0x32a30
movq %rbx, %rdi
callq 0x20a0
movq %rax, %r15
movq %rax, %rdi
callq 0x22c0
movl %eax, %ebx
xorl %ebp, %ebp
movl %eax, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2160
orl $0x800, %eax            # imm = 0x800
movl %ebx, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2160
movl $0x2, 0x13233(%rip)     # 0x39384
movq 0x8(%rsp), %rax
cmpb $0x1, 0x52d(%rax)
jne 0x2616b
leaq 0xc85e(%rip), %rdi      # 0x329c4
callq 0x2400
testq %r15, %r15
je 0x261c1
leaq 0x4a0(%rsp), %rdi
movl $0xfde8, %esi           # imm = 0xFDE8
movq %r15, %rdx
callq 0x2440
testq %rax, %rax
jne 0x261c1
xorl %r14d, %r14d
leaq 0x4a0(%rsp), %rbx
movl $0x1, %edi
callq 0x21b0
leal 0x1(%r14), %ebp
movq %rbx, %rdi
movl $0xfde8, %esi           # imm = 0xFDE8
movq %r15, %rdx
callq 0x2440
testq %rax, %rax
jne 0x261c1
cmpl $0x1d, %r14d
movl %ebp, %r14d
jb 0x26195
movq 0x8(%rsp), %rax
cmpb $0x1, 0x52d(%rax)
jne 0x261df
leaq 0xc4ca(%rip), %rdi      # 0x326a0
movl %ebp, %esi
xorl %eax, %eax
callq 0x2040
cmpl $0x1e, %ebp
jb 0x2635a
testq %r15, %r15
je 0x26833
movq %r15, %rdi
callq 0x23a0
jmp 0x26833
leaq 0xa0(%rsp), %rdi
movq %rbx, %rsi
callq 0x21f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movups %xmm0, 0x49(%rsp)
movaps %xmm0, 0x60(%rsp)
movups %xmm0, 0x69(%rsp)
movaps %xmm0, 0x80(%rsp)
movups %xmm0, 0x89(%rsp)
xorl %ebx, %ebx
movl $0x0, %eax
testl %ebp, %ebp
jle 0x26264
movl %ebp, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
cmpb $0x2f, 0xa0(%rsp,%rdx)
movl %edx, %eax
je 0x26258
xorl %eax, %eax
incq %rdx
cmpq %rcx, %rdx
jae 0x26264
testl %eax, %eax
je 0x2624a
leal 0x1(%rax), %r8d
cmpl %ebp, %r8d
jge 0x26290
movslq %eax, %rcx
incq %rcx
movslq %ebp, %rdx
cmpb $0x2f, 0xa0(%rsp,%rcx)
movl %ecx, %ebx
je 0x26284
xorl %ebx, %ebx
incq %rcx
cmpq %rdx, %rcx
jge 0x26290
testl %ebx, %ebx
je 0x26276
testl %eax, %eax
jle 0x26833
movl %eax, %r14d
notl %r14d
addl %ebx, %r14d
testl %r14d, %r14d
jle 0x26833
movl %ebx, %r15d
notl %r15d
addl %ebp, %r15d
testl %r15d, %r15d
jle 0x26833
movl %eax, %edx
leaq 0x40(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movl %r8d, %ebp
callq 0x21f0
movl %ebp, %eax
leaq (%rsp,%rax), %rsi
addq $0xa0, %rsi
movl %r14d, %edx
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0x21f0
movslq %ebx, %rax
leaq 0xa0(%rsp), %rcx
leaq (%rax,%rcx), %rsi
incq %rsi
movl %r15d, %edx
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x21f0
leaq 0x40(%rsp), %rdi
callq 0x2420
movl %eax, %r15d
movq %r14, %rdi
callq 0x2420
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2420
testl %eax, %eax
jg 0x260b5
movq 0x8(%rsp), %rax
cmpb $0x1, 0x52d(%rax)
jne 0x26833
leaq 0xc374(%rip), %rdi      # 0x326c9
jmp 0x2609b
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x4a0(%rsp), %rdi
callq 0x2c943
movq %rax, %rbp
leaq 0x18(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xbf1b(%rip), %rcx      # 0x322a9
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2410
movq 0x18(%rsp), %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2d1d7
movq %rax, %rbp
leaq 0x18(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xbef7(%rip), %rcx      # 0x322b5
movl $0x4, %r8d
xorl %esi, %esi
callq 0x2410
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2d1d7
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xc2bf(%rip), %rcx      # 0x326a8
movl $0x20, %r8d
xorl %esi, %esi
callq 0x2410
movq 0x18(%rsp), %rsi
movq %rbp, %rdi
callq 0x2d1d7
movq %rax, %rbp
testq %rbx, %rbx
je 0x2641a
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x2641a
movq 0x10(%rbp), %rbp
jmp 0x2641c
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
cmpb $0x1, 0x52d(%rax)
jne 0x26436
leaq 0xc598(%rip), %rdi      # 0x329c9
callq 0x2400
testq %rbx, %rbx
je 0x267db
movq (%r13), %rax
movq 0x8(%r13), %rcx
movq (%r12), %rdx
movq 0x8(%r12), %rdi
subq %rdx, %rdi
sarq $0x3, %rdi
movabsq $0x6db6db6db6db6db7, %rsi # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdi, %rsi
leaq -0x1(%rsi), %rdi
movq 0x8(%rsp), %r8
movss 0x5b0(%r8), %xmm0
movss 0x9f85(%rip), %xmm1     # 0x30404
mulss %xmm0, %xmm1
mulss 0x9f81(%rip), %xmm1     # 0x3040c
cvtsi2sdl 0x14(%rsp), %xmm2
cvtss2sd %xmm0, %xmm3
xorl %r10d, %r10d
movss 0x9f4b(%rip), %xmm8     # 0x303ec
movsd 0x9dde(%rip), %xmm9     # 0x30288
movss 0x9f52(%rip), %xmm5     # 0x30404
movsd 0xbd05(%rip), %xmm13    # 0x321c0
movsd 0x9dac(%rip), %xmm14    # 0x30270
xorps %xmm15, %xmm15
cmpq %rax, %rcx
je 0x264f4
movslq %r10d, %r8
cmpq %r8, %rdi
jbe 0x264f4
movslq 0x28(%rbx), %r9
imulq $0x38, %r8, %r10
addq %rdx, %r10
cmpq %r9, (%r10)
jge 0x264f1
incq %r8
addq $0x38, %r10
cmpq %r8, %rdi
ja 0x264e0
movl %r8d, %r10d
movslq %r10d, %r8
cmpq %r8, %rdi
jbe 0x267db
imulq $0x38, %r8, %r8
movq (%rdx,%r8), %r9
movslq 0x28(%rbx), %r11
cmpq %r11, %r9
jne 0x267cb
movslq %r9d, %r11
imulq $-0x3dd1baf9, %r11, %r14 # imm = 0xC22E4507
shrq $0x20, %r14
addl %r11d, %r14d
movl %r14d, %r12d
shrl $0x1f, %r12d
sarl $0x10, %r14d
addl %r12d, %r14d
imull $0x15180, %r14d, %r14d  # imm = 0x15180
subl %r14d, %r11d
movslq %r11d, %r11
imulq $-0x6e5d4c3b, %r11, %r14 # imm = 0x91A2B3C5
shrq $0x20, %r14
addl %r14d, %r11d
movl %r11d, %r14d
shrl $0x1f, %r14d
sarl $0x9, %r11d
addl %r14d, %r11d
movslq %r11d, %r11
movq 0x38(%rsp), %r12
movl (%r12,%r11,4), %r14d
xorps %xmm4, %xmm4
cvtsi2sd %r14, %xmm4
divsd 0x9ce7(%rip), %xmm4     # 0x30260
movl 0x31c(%r12), %r14d
xorps %xmm6, %xmm6
cvtsi2ss %r14, %xmm6
mulss %xmm0, %xmm6
divss 0x9e7b(%rip), %xmm6     # 0x30410
movl 0x318(%r12), %r14d
cvtsi2sd %r14, %xmm10
divsd 0x9ccd(%rip), %xmm10    # 0x30278
divsd 0x9cfc(%rip), %xmm10    # 0x302b0
xorps %xmm12, %xmm12
cvtsd2ss %xmm10, %xmm12
movaps %xmm8, %xmm10
cmpltps %xmm6, %xmm10
xorps %xmm11, %xmm11
xorps %xmm7, %xmm7
cmpltps %xmm12, %xmm7
andps %xmm10, %xmm7
movd %xmm7, %r14d
testb $0x1, %r14b
jne 0x265e7
movaps %xmm8, %xmm12
jmp 0x265ec
divss %xmm6, %xmm12
xorps %xmm7, %xmm7
cvtss2sd %xmm12, %xmm7
ucomisd %xmm7, %xmm9
movss 0xbf5e(%rip), %xmm10    # 0x32560
ja 0x26608
movaps %xmm12, %xmm10
cvtsd2ss %xmm4, %xmm4
xorps %xmm7, %xmm7
cvtss2sd %xmm4, %xmm7
ucomisd %xmm9, %xmm7
jbe 0x26635
movl 0x180(%r12,%r11,4), %r11d
xorps %xmm11, %xmm11
cvtsi2ss %r11, %xmm11
divss %xmm1, %xmm11
divss %xmm4, %xmm11
movaps %xmm5, %xmm12
minss %xmm10, %xmm12
movl $0xa, %r11d
subl %r10d, %r11d
xorps %xmm4, %xmm4
cvtsi2ss %r11d, %xmm4
cmpl $0x9, %r10d
jg 0x26680
ucomiss %xmm8, %xmm6
jbe 0x26680
incl %r10d
xorps %xmm6, %xmm6
cvtsi2ss %r10d, %xmm6
mulss %xmm4, %xmm12
mulss %xmm6, %xmm11
addss %xmm12, %xmm11
divss 0xbee6(%rip), %xmm11    # 0x32564
jmp 0x26686
ucomiss %xmm15, %xmm11
jbe 0x2668a
movaps %xmm11, %xmm12
addq %rdx, %r8
movl 0x314(%r12), %r10d
cmpl $0x0, 0x10(%rsp)
je 0x266cb
xorps %xmm6, %xmm6
cvtss2sd 0x20(%r8), %xmm6
movsd 0x30(%rbp), %xmm7
mulsd %xmm2, %xmm7
mulsd %xmm13, %xmm7
divsd %xmm3, %xmm7
divsd %xmm14, %xmm7
addsd %xmm6, %xmm7
xorps %xmm11, %xmm11
cvtsd2ss %xmm7, %xmm11
jmp 0x266eb
movsd 0x30(%rbp), %xmm6
mulsd %xmm2, %xmm6
mulsd %xmm13, %xmm6
divsd %xmm3, %xmm6
divsd %xmm14, %xmm6
xorps %xmm11, %xmm11
cvtsd2ss %xmm6, %xmm11
movss %xmm11, 0x20(%r8)
xorps %xmm6, %xmm6
cvtsi2ss %r10, %xmm6
divss %xmm1, %xmm6
mulss %xmm4, %xmm6
divss %xmm5, %xmm6
movaps %xmm12, %xmm4
mulss %xmm11, %xmm4
movss %xmm4, 0x1c(%r8)
ucomiss %xmm4, %xmm6
jbe 0x2678d
ucomiss %xmm6, %xmm4
jbe 0x2675f
movq %r9, %r10
subq (%rdx), %r10
cmpq $0xa8bf, %r10           # imm = 0xA8BF
jg 0x2673f
addss %xmm6, %xmm6
addss %xmm4, %xmm6
divss 0x9ce7(%rip), %xmm6     # 0x30424
jmp 0x2675a
movq %r9, %r10
subq (%rdx), %r10
cmpq $0xa8bf, %r10           # imm = 0xA8BF
jg 0x2675f
addss %xmm4, %xmm6
mulss 0x9c9a(%rip), %xmm6     # 0x303f4
movaps %xmm6, %xmm4
jmp 0x2678d
ucomiss %xmm8, %xmm11
jbe 0x2678d
ucomiss %xmm4, %xmm6
jbe 0x2678d
subq (%rdx), %r9
cmpq $0xa8bf, %r9            # imm = 0xA8BF
jg 0x2678d
mulss %xmm11, %xmm12
addss %xmm6, %xmm12
mulss 0x9c6b(%rip), %xmm12    # 0x303f4
movaps %xmm12, %xmm4
movss %xmm4, 0x1c(%r8)
movss 0x1c(%rdx), %xmm4
movl $0x1, %r10d
ucomiss %xmm15, %xmm4
jne 0x267c3
jp 0x267c3
movss 0x20(%rdx), %xmm4
ucomiss %xmm15, %xmm4
jne 0x267c3
jp 0x267c3
movsd 0x54(%rdx), %xmm4
movsd %xmm4, 0x1c(%rdx)
movl $0x2, %r10d
movl %r10d, %r8d
cmpq %r8, %rsi
jb 0x26845
movq (%rbx), %rbx
movq (%rbp), %rbp
testq %rbx, %rbx
jne 0x264c8
movq 0x8(%rsp), %rbx
cmpb $0x1, 0x52d(%rbx)
jne 0x267f5
leaq 0xc1de(%rip), %rdi      # 0x329ce
callq 0x2400
testq %r15, %r15
je 0x26802
movq %r15, %rdi
callq 0x23a0
cmpb $0x1, 0x52d(%rbx)
jne 0x26817
leaq 0xc1c3(%rip), %rdi      # 0x329d5
callq 0x2400
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x26833
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x22b0
addq $0x10288, %rsp          # imm = 0x10288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rbx
cmpb $0x1, 0x52d(%rbx)
jne 0x2685f
leaq 0xc174(%rip), %rdi      # 0x329ce
callq 0x2400
testq %r15, %r15
je 0x2686c
movq %r15, %rdi
callq 0x23a0
cmpb $0x0, 0x52d(%rbx)
jne 0x2680b
jmp 0x26817
jmp 0x26879
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x26898
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x24a0