// File: /workspace/github_cpp_makefile_star2_O2/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, 0x18(%rsp)
movq 0x8(%rdi), %rax
cmpq (%rdi), %rax
je 0x225bb
movq %rsi, %r12
movq 0x8(%rsi), %rax
cmpq (%rsi), %rax
je 0x225c4
movq %rdi, %r13
movl %ecx, 0x10(%rsp)
movslq %ecx, %r14
imulq $0x14, %r14, %rax
movq %rdx, 0x8(%rsp)
leaq (%rdx,%rax), %rbx
addq $0x664, %rbx            # imm = 0x664
movq %rbx, %rdi
callq 0x2100
movq %rax, %rbp
pushq $0xa
popq %rax
xorl %r15d, %r15d
testl %r14d, %r14d
js 0x225e3
movslq %ebp, %rdx
cmpq $0x401, %rdx            # imm = 0x401
setae %sil
testl %ebp, %ebp
sete %cl
orb %sil, %cl
cmpb $0x1, %cl
jne 0x2270a
movl $0x0, %ebp
cmpl $0x0, 0x10(%rsp)
jne 0x22c9b
jmp 0x225e5
leaq 0xae22(%rip), %rdi      # 0x2d3e4
jmp 0x225cb
leaq 0xae2d(%rip), %rdi      # 0x2d3f8
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 0x22603
leaq 0xb1e9(%rip), %rdi      # 0x2d7e7
callq 0x2440
cvtss2sd 0x5e0(%rbx), %xmm0
cvtss2sd 0x5e4(%rbx), %xmm1
leaq 0xadf0(%rip), %rsi      # 0x2d40a
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movl %r15d, %edx
movl %ebp, %ecx
movb $0x2, %al
callq 0x2050
leaq 0xb220(%rip), %rsi      # 0x2d858
movq %rbx, %rdi
callq 0x20a0
movq %rax, %r15
movq %rax, %rdi
callq 0x22d0
movl %eax, %ebx
xorl %ebp, %ebp
pushq $0x3
popq %rsi
movl %eax, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2170
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebx, %edi
movq 0x8(%rsp), %rbx
movl %eax, %edx
xorl %eax, %eax
callq 0x2170
movl $0x2, 0x13d25(%rip)     # 0x363a4
cmpb $0x1, 0x52d(%rbx)
jne 0x22694
leaq 0xb15d(%rip), %rdi      # 0x2d7ec
callq 0x2440
testq %r15, %r15
je 0x226d2
xorl %ebp, %ebp
leaq 0x4a0(%rsp), %rbx
pushq $0x1
popq %r14
movq %rbx, %rdi
movl $0xfde8, %esi           # imm = 0xFDE8
movq %r15, %rdx
callq 0x2470
testq %rax, %rax
jne 0x226cd
cmpl $0x1d, %ebp
ja 0x226cd
movl %r14d, %edi
callq 0x21b0
incl %ebp
jmp 0x226a7
movq 0x8(%rsp), %rbx
cmpb $0x1, 0x52d(%rbx)
jne 0x226eb
leaq 0xade6(%rip), %rdi      # 0x2d4c8
movl %ebp, %esi
xorl %eax, %eax
callq 0x2040
cmpl $0x1e, %ebp
jb 0x22857
testq %r15, %r15
je 0x22c9b
movq %r15, %rdi
callq 0x23e0
jmp 0x22c9b
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)
movslq %ebp, %rcx
xorl %edx, %edx
xorl %eax, %eax
cmpq %rcx, %rdx
jge 0x22766
testl %eax, %eax
jne 0x22766
cmpb $0x2f, 0xa0(%rsp,%rdx)
movl $0x0, %eax
cmovel %edx, %eax
incq %rdx
jmp 0x22748
leal 0x1(%rax), %edx
movslq %edx, %r8
xorl %ebx, %ebx
movq %r8, %rdx
cmpq %rcx, %rdx
jge 0x2278f
testl %ebx, %ebx
jne 0x2278f
cmpb $0x2f, 0xa0(%rsp,%rdx)
movl $0x0, %ebx
cmovel %edx, %ebx
incq %rdx
jmp 0x22771
testl %eax, %eax
jle 0x22c9b
movl %eax, %r14d
notl %r14d
addl %ebx, %r14d
testl %r14d, %r14d
jle 0x22c9b
movl %ebx, %r15d
notl %r15d
addl %ebp, %r15d
testl %r15d, %r15d
jle 0x22c9b
movl %eax, %edx
leaq 0x40(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq %r8, %rbp
callq 0x21f0
leaq (%rsp,%rbp), %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 0x2450
movl %eax, %r15d
movq %r14, %rdi
callq 0x2450
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2450
testl %eax, %eax
jg 0x225e5
movq 0x8(%rsp), %rax
cmpb $0x1, 0x52d(%rax)
jne 0x22c9b
leaq 0xac9f(%rip), %rdi      # 0x2d4f1
jmp 0x225cb
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x4a0(%rsp), %rdi
callq 0x28719
movq %rax, %r14
leaq 0xa852(%rip), %rsi      # 0x2d0d1
leaq 0x20(%rsp), %rdi
callq 0x2530
movq 0x20(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x28e9b
movq %rax, %rbp
leaq 0xa83a(%rip), %rsi      # 0x2d0dd
leaq 0x20(%rsp), %rdi
callq 0x2530
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x28e9b
movq %rax, %rbx
leaq 0xac0e(%rip), %rsi      # 0x2d4d0
leaq 0x20(%rsp), %rdi
callq 0x2530
movq 0x20(%rsp), %rsi
movq %rbp, %rdi
callq 0x28e9b
movq %rax, %rbp
testq %rbx, %rbx
je 0x228f0
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x228f0
movq 0x10(%rbp), %rbp
jmp 0x228f2
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
cmpb $0x1, 0x52d(%rax)
jne 0x2290c
leaq 0xaeea(%rip), %rdi      # 0x2d7f1
callq 0x2440
pushq $0x1
popq %rdi
movq (%r13), %r8
movq 0x8(%r13), %r9
movq (%r12), %r10
movq 0x8(%r12), %rax
subq %r10, %rax
pushq $0x38
popq %rcx
cqto
idivq %rcx
movq %rax, %rcx
leaq -0x1(%rax), %r11
movq 0x8(%rsp), %rax
movss 0x5b0(%rax), %xmm0
movss 0x89ed(%rip), %xmm1     # 0x2b334
mulss %xmm0, %xmm1
mulss 0x89e9(%rip), %xmm1     # 0x2b33c
cvtsi2sdl 0x14(%rsp), %xmm2
cvtss2sd %xmm0, %xmm3
xorl %r12d, %r12d
movss 0x89b3(%rip), %xmm8     # 0x2b31c
movsd 0x8846(%rip), %xmm9     # 0x2b1b8
movss 0x89ba(%rip), %xmm5     # 0x2b334
movsd 0xa665(%rip), %xmm13    # 0x2cfe8
movsd 0x8814(%rip), %xmm14    # 0x2b1a0
xorps %xmm15, %xmm15
testq %rbx, %rbx
je 0x22c55
cmpq %r8, %r9
je 0x229cc
movslq %r12d, %rax
cmpq %rax, %r11
movq %rax, %r12
cmovaq %r11, %r12
imulq $0x38, %rax, %rdx
addq %r10, %rdx
cmpq %rax, %r12
je 0x229cc
movslq 0x28(%rbx), %rsi
cmpq %rsi, (%rdx)
jge 0x229c9
incq %rax
addq $0x38, %rdx
jmp 0x229b2
movq %rax, %r12
movslq %r12d, %rax
cmpq %rax, %r11
jbe 0x22c55
imulq $0x38, %rax, %r14
movq (%r10,%r14), %rsi
movslq 0x28(%rbx), %rax
cmpq %rax, %rsi
jne 0x22c49
movl %esi, %eax
cltd
movl $0x15180, %r13d         # imm = 0x15180
idivl %r13d
movl %edx, %eax
cltd
movl $0x384, %r13d           # imm = 0x384
idivl %r13d
cltq
movq 0x18(%rsp), %r13
movl (%r13,%rax,4), %edx
cvtsi2sd %rdx, %xmm4
divsd 0x8772(%rip), %xmm4     # 0x2b190
movl 0x31c(%r13), %edx
cvtsi2ss %rdx, %xmm6
mulss %xmm0, %xmm6
divss 0x890a(%rip), %xmm6     # 0x2b340
movl 0x318(%r13), %edx
cvtsi2sd %rdx, %xmm10
divsd 0x875d(%rip), %xmm10    # 0x2b1a8
divsd 0x878c(%rip), %xmm10    # 0x2b1e0
cvtsd2ss %xmm10, %xmm12
movaps %xmm8, %xmm10
cmpltps %xmm6, %xmm10
xorps %xmm11, %xmm11
xorps %xmm7, %xmm7
cmpltps %xmm12, %xmm7
andps %xmm10, %xmm7
movd %xmm7, %edx
testb $0x1, %dl
jne 0x22a81
movaps %xmm8, %xmm12
jmp 0x22a86
divss %xmm6, %xmm12
movq 0x18(%rsp), %r13
movl 0x180(%r13,%rax,4), %edx
movl 0x314(%r13), %eax
cvtss2sd %xmm12, %xmm7
ucomisd %xmm7, %xmm9
movss 0xa8db(%rip), %xmm10    # 0x2d388
ja 0x22ab3
movaps %xmm12, %xmm10
cvtsd2ss %xmm4, %xmm4
cvtss2sd %xmm4, %xmm7
ucomisd %xmm9, %xmm7
jbe 0x22ad1
cvtsi2ss %rdx, %xmm11
divss %xmm1, %xmm11
divss %xmm4, %xmm11
movaps %xmm5, %xmm12
minss %xmm10, %xmm12
pushq $0xa
popq %rdx
subl %r12d, %edx
cvtsi2ss %edx, %xmm4
cmpl $0x9, %r12d
jg 0x22b12
ucomiss %xmm8, %xmm6
jbe 0x22b12
incl %r12d
cvtsi2ss %r12d, %xmm6
mulss %xmm4, %xmm12
mulss %xmm6, %xmm11
addss %xmm12, %xmm11
divss 0xa87c(%rip), %xmm11    # 0x2d38c
jmp 0x22b18
ucomiss %xmm15, %xmm11
jbe 0x22b1c
movaps %xmm11, %xmm12
addq %r10, %r14
cmpl $0x0, 0x10(%rsp)
je 0x22b4e
cvtss2sd 0x20(%r14), %xmm6
movsd 0x30(%rbp), %xmm7
mulsd %xmm2, %xmm7
mulsd %xmm13, %xmm7
divsd %xmm3, %xmm7
divsd %xmm14, %xmm7
addsd %xmm6, %xmm7
cvtsd2ss %xmm7, %xmm11
jmp 0x22b6a
movsd 0x30(%rbp), %xmm6
mulsd %xmm2, %xmm6
mulsd %xmm13, %xmm6
divsd %xmm3, %xmm6
divsd %xmm14, %xmm6
cvtsd2ss %xmm6, %xmm11
movss %xmm11, 0x20(%r14)
cvtsi2ss %rax, %xmm6
divss %xmm1, %xmm6
mulss %xmm4, %xmm6
divss %xmm5, %xmm6
movaps %xmm12, %xmm4
mulss %xmm11, %xmm4
movss %xmm4, 0x1c(%r14)
ucomiss %xmm4, %xmm6
jbe 0x22c07
ucomiss %xmm6, %xmm4
jbe 0x22bd9
movq %rsi, %rax
subq (%r10), %rax
cmpq $0xa8bf, %rax           # imm = 0xA8BF
jg 0x22bba
addss %xmm6, %xmm6
addss %xmm4, %xmm6
divss 0x879c(%rip), %xmm6     # 0x2b354
jmp 0x22bd4
movq %rsi, %rax
subq (%r10), %rax
cmpq $0xa8bf, %rax           # imm = 0xA8BF
jg 0x22bd9
addss %xmm4, %xmm6
mulss 0x8750(%rip), %xmm6     # 0x2b324
movaps %xmm6, %xmm4
jmp 0x22c07
ucomiss %xmm8, %xmm11
jbe 0x22c07
ucomiss %xmm4, %xmm6
jbe 0x22c07
subq (%r10), %rsi
cmpq $0xa8bf, %rsi           # imm = 0xA8BF
jg 0x22c07
mulss %xmm11, %xmm12
addss %xmm6, %xmm12
mulss 0x8721(%rip), %xmm12    # 0x2b324
movaps %xmm12, %xmm4
movss %xmm4, 0x1c(%r14)
movss 0x1c(%r10), %xmm4
ucomiss %xmm15, %xmm4
movl %edi, %r12d
jne 0x22c41
jp 0x22c41
movss 0x20(%r10), %xmm4
ucomiss %xmm15, %xmm4
movl %edi, %r12d
jne 0x22c41
jp 0x22c41
movsd 0x54(%r10), %xmm4
movsd %xmm4, 0x1c(%r10)
pushq $0x2
popq %rax
movl %eax, %r12d
movl %r12d, %eax
cmpq %rax, %rcx
jb 0x22cad
movq (%rbx), %rbx
movq (%rbp), %rbp
jmp 0x22990
movq 0x8(%rsp), %rbx
cmpb $0x1, 0x52d(%rbx)
jne 0x22c6f
leaq 0xab8c(%rip), %rdi      # 0x2d7f6
callq 0x2440
testq %r15, %r15
je 0x22c7c
movq %r15, %rdi
callq 0x23e0
cmpb $0x1, 0x52d(%rbx)
jne 0x22c91
leaq 0xab71(%rip), %rdi      # 0x2d7fd
callq 0x2440
leaq 0x20(%rsp), %rdi
callq 0x2578
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 0x22cc7
leaq 0xab34(%rip), %rdi      # 0x2d7f6
callq 0x2440
testq %r15, %r15
je 0x22cd4
movq %r15, %rdi
callq 0x23e0
cmpb $0x0, 0x52d(%rbx)
jne 0x22c85
jmp 0x22c91
jmp 0x22ce1
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2578
movq %rbx, %rdi
callq 0x24d0