// File: bummelbaerchen[P]e3dc/RscpExampleMain.cpp
// Function: WBProcess(SRscpFrameBuffer*)
int WBProcess(SRscpFrameBuffer * frameBuffer) {
/*   Steuerung der Wallbox
*/
    const int cMinimumladestand = 15;
    const int iMaxcurrent=31;
    static float_t iDyLadeende;
    static uint8_t WBChar_alt = 0;
    static int32_t iWBMinimumPower = 1300; // MinimumPower bei 6A
    static int iLadeleistung[27][4]; //27*4 Zellen
    static bool bWBOn = false; // Wallbox eingeschaltet

//    if (!bWBLademodus) // WB Steuerung nur bei Sonnenmodus
//    return 0;

    if (iWBStatus == 0)  {

        iDyLadeende = e3dc_config.ladeschwelle;
        iFc = 0;
        iBattLoad = 100;
        
        if (fBatt_SOC > iDyLadeende) iDyLadeende = fBatt_SOC;

        
        
        memcpy(WBchar6,"\x00\x06\x00\x00\x00\x00",6);
        WBchar6[1]=WBchar[2];

        if (WBchar[2]==32)
            bWBmaxLadestrom = true; else
            bWBmaxLadestrom = false;

        
            if (WBchar[2] > 4)
            iWBStatus = 5;
            else return 0;
        
//            createRequestWBData(frameBuffer);
    }
    
    if (iWBStatus == 1) {
        if (bWBmaxLadestrom)  {//Wenn der Ladestrom auf 32, dann erfolgt keine
            if ((fBatt_SOC>cMinimumladestand)&&(fAvPower_Grid<400)) { //Wenn der Ladestrom auf 32, dann erfolgt keine Begrenzung des Ladestroms im Sonnenmodus
            if ((WBchar6[1]<32)&&(fBatt_SOC>(cMinimumladestand+2))) {
                WBchar6[1]=32;
                createRequestWBData(frameBuffer);
                WBChar_alt = WBchar6[1];
                iWBStatus = 7; }
        }
        }     else if ((!bWBLademodus)&& (WBchar6[1] > 6)&&(fPower_WB == 0))  // Immer von 6A aus starten
{ // Wallbox lädt nicht
    if ((not bWBmaxLadestrom)&&(not bWBOn))
    { WBchar6[1] = 6;
//      WBchar6[4] = 1; // Laden starten
        bWBOn = true;
        createRequestWBData(frameBuffer);
        WBchar6[4] = 0; // toggle aus
        iWBStatus = 7;
    }
    else WBchar6[1] = 32;
}

        
        if (fBatt_SOC > iDyLadeende) iDyLadeende = fBatt_SOC;
        if ((fPower_WB == 0)&&(iWBStatus==1)&&bWBLademodus) {
            iDyLadeende = cMinimumladestand;
        }
                if ( (fPower_WB == 0) &&bWBLademodus &&
               ( ((fPower_Grid - iPower_Bat)< -5500)
             ||(
                ( ((fPower_Grid - iPower_Bat)< (iWBMinimumPower*-1))&&(fBatt_SOC>cMinimumladestand) )
             ||
                ( ((fPower_Grid - iPower_Bat)< -1800)&&(fBatt_SOC>cMinimumladestand)&&
                 ((fAvBatterie>iFc)||(fBatt_SOC>94)) ) // größer Mindesladeschwellex
             ||
                ((fAvPower_Grid< -500)&&(fBatt_SOC>=iDyLadeende))
                )
             )
//            && (WBchar6[1] != 6)  // Immer von 6A aus starten
            ) { // Wallbox lädt nicht
            if ((not bWBmaxLadestrom)&&(iWBStatus==1))
                { WBchar6[1] = 6;
                    int x1,x2;
                    for (x1=1;x1<=33;x1++) {};

                WBchar6[4] = 1; // Laden starten
                if (not bWBOn)
                createRequestWBData(frameBuffer);
                bWBOn = true;
                WBchar6[4] = 0; // Toggle aus
                WBChar_alt = WBchar6[1];
                iWBStatus = 20;
                }
                    else WBchar6[1] = 32;
        }
        if ((fPower_WB > 1000) && not (bWBmaxLadestrom)) { // Wallbox lädt
            if (WBchar6[1]==6) iWBMinimumPower = fPower_WB;
            if (((fPower_Grid< -200)&&(fAvPower_Grid < -100)) && (iPower_Bat >= 0) && (WBchar6[1]<iMaxcurrent)){
                WBchar6[1]++;
                if ((fPower_Grid-iPower_Bat < -10*700) && (iPower_Bat >= 0)&& (WBchar6[1]<iMaxcurrent)) WBchar6[1]++;
                if ((fPower_Grid-iPower_Bat < -9*700) && (iPower_Bat >= 0)&& (WBchar6[1]<iMaxcurrent)) WBchar6[1]++;
                if ((fPower_Grid-iPower_Bat < -8*700) && (iPower_Bat >= 0)&& (WBchar6[1]<iMaxcurrent)) WBchar6[1]++;
                if ((fPower_Grid-iPower_Bat < -7*700) && (iPower_Bat >= 0)&& (WBchar6[1]<iMaxcurrent)) WBchar6[1]++;
                if ((fPower_Grid-iPower_Bat < -6*700) && (iPower_Bat >= 0)&& (WBchar6[1]<iMaxcurrent)) WBchar6[1]++;
                if ((fPower_Grid-iPower_Bat < -5*700) && (iPower_Bat >= 0)&& (WBchar6[1]<iMaxcurrent)) WBchar6[1]++;
                    createRequestWBData(frameBuffer);
//                if ((WBchar6[1]>16)&&(WBChar_alt<= 16)) iWBStatus = 30; else
                    iWBStatus = 12;
                WBChar_alt = WBchar6[1];

                // Länger warten bei Wechsel von <= 16A auf > 16A hohen Stömen

             }
            if (
                 ((iPower_Bat-fPower_Grid < -2600)&&(WBchar6[1] > 6)) ||
                 ((iPower_Bat-fPower_Grid < -2000)&&(fAvBatterie<-1000)&&(WBchar6[1] > 6)) ||
                 ((iPower_Bat < 2000) && (iPower_Bat+400 < iBattLoad) &&(fBatt_SOC < cMinimumladestand)&&(WBchar6[1] > 6)) ||
//                ((fBatt_SOC < e3dc_config.ladeende)&&
                ((((fBatt_SOC < e3dc_config.ladeende)&&(iPower_Bat<(2000)))||
                ((fBatt_SOC >= e3dc_config.ladeende)&&(fBatt_SOC < 93)&&
                 (iPower_Bat<(1500))))&&
                  ((iPower_Bat+800)<iBattLoad)&&
                  ((iPower_Bat+400)<iFc)&&
//                   ((iPower_Bat)<iMinLade)&&
                  ((fAvBatterie+200)<iFc)&&
//                  ((fAvBatterie)<iMinLade)&&
                  (WBchar6[1]>6))
                 ) { // Mind. 2000W Batterieladen
                WBchar6[1]--;
                for (int X1 = 3; X1 < 20; X1++)
                    if (((iPower_Bat-fPower_Grid) < (iBattLoad-700*X1))&& (WBchar6[1]>6)) WBchar6[1]--; else break;
                
                if (WBchar6[1]==31) WBchar6[1]--;;
                createRequestWBData(frameBuffer);
                WBChar_alt = WBchar6[1];
//                if (WBchar6[1]>16) iWBStatus = 15; else // Länger warten bei hohen Stömen
                iWBStatus = 12;  // Länger warten bei hohen Stömen

            } else
// Bedingung zum Wallbox abschalten ermitteln
//
                
                
            if (
                   ((iPower_Bat-fPower_Grid < -2700)&&(fBatt_SOC < 94))
                || ((fPower_Grid > 3000)&&(iPower_Bat<1000))   //Speicher > 94%
                || ((iPower_Bat-fPower_Grid < -2000)&&(fBatt_SOC < iDyLadeende-1)&&(iBattLoad>0))
                || ((iPower_Bat-fPower_Grid < -1500)&&(fBatt_SOC < iDyLadeende-1.5)&&(iBattLoad>0))
                || ((iPower_Bat-fPower_Grid < -1000)&&(fBatt_SOC < iDyLadeende-2)&&(iBattLoad>0))
                || ((iPower_Bat-fPower_Grid < -500)&&(fBatt_SOC < iDyLadeende-2.5)&&(iBattLoad>0))
                || (fAvPower_Grid>400)          // Hohem Netzbezug
                                                // Bei Speicher < 94%
                || ((iPower_Bat-fPower_Grid < -1500)&&(fAvBatterie<-1000)&&(fBatt_SOC < 94)&&(iBattLoad>0))
                || ((iPower_Bat-fPower_Grid < -1000)&&((fAvBatterie<(iFc-400))||(fAvBatterie<0))&&(fBatt_SOC < 94)&&(iBattLoad>0))
                )  { // höchstens. 1500W Batterieentladen wenn voll
                {if ((WBchar6[1] > 5)&&bWBLademodus)
                    WBchar6[1]--;

                    for (int X1 = 3; X1 < 20; X1++)
                        if (((iPower_Bat-fPower_Grid) < (iBattLoad-700*X1))&& (WBchar6[1]>6)) WBchar6[1]--;
                        else break;


                    if (WBchar6[1]!=WBchar[2]){
                        if (WBchar6[1]==5) {(WBchar6[1]=6);
                            WBchar6[4] = 1;
                            bWBOn = false;
                        } // Laden beenden
                        createRequestWBData(frameBuffer);}
                    WBChar_alt = WBchar6[1];
                    if (WBchar6[4] == 0)
                        iWBStatus = 7; else // Warten bis Neustart
                        iWBStatus = 20;  // Warten bis Neustart
                }}
    }
        }
        printf("Power %0i DyLadeende %0.01f ",iWBMinimumPower, iDyLadeende);
    printf(" iWBStatus %i",iWBStatus);
    if (iWBStatus > 1) iWBStatus--;
return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl $0xf, 0x14(%rsp)
movl $0x1f, 0x10(%rsp)
cmpl $0x0, 0x23174(%rip)     # 0x267e4
jne 0x3727
movzbl 0x2312d(%rip), %eax     # 0x267aa
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x231db(%rip)    # 0x26864
movl $0x0, 0x23195(%rip)     # 0x26828
movl $0x64, 0x23193(%rip)    # 0x26830
movss 0x23167(%rip), %xmm0    # 0x2680c
ucomiss 0x231b8(%rip), %xmm0    # 0x26864
jbe 0x36be
movss 0x23156(%rip), %xmm0    # 0x2680c
movss %xmm0, 0x231a6(%rip)    # 0x26864
movl 0x1da4e(%rip), %eax     # 0x21112
movl %eax, 0x2311e(%rip)     # 0x267e8
movw 0x1da45(%rip), %ax      # 0x21116
movw %ax, 0x23114(%rip)      # 0x267ec
movb 0x23345(%rip), %al      # 0x26a23
movb %al, 0x23105(%rip)      # 0x267e9
movzbl 0x23338(%rip), %eax     # 0x26a23
cmpl $0x20, %eax
jne 0x36f9
movb $0x1, 0x23332(%rip)     # 0x26a29
jmp 0x3700
movb $0x0, 0x23329(%rip)     # 0x26a29
movzbl 0x2331c(%rip), %eax     # 0x26a23
cmpl $0x4, %eax
jle 0x3718
movl $0x5, 0x230ce(%rip)     # 0x267e4
jmp 0x3725
movl $0x0, 0x24(%rsp)
jmp 0x4223
jmp 0x3727
cmpl $0x1, 0x230b6(%rip)     # 0x267e4
jne 0x41cf
testb $0x1, 0x232ee(%rip)     # 0x26a29
je 0x37af
movss 0x230c7(%rip), %xmm0    # 0x2680c
movss 0x1d937(%rip), %xmm1    # 0x21084
ucomiss %xmm1, %xmm0
jbe 0x37ad
movss 0x1d92e(%rip), %xmm0    # 0x21088
ucomiss 0x232cb(%rip), %xmm0    # 0x26a2c
jbe 0x37ad
movzbl 0x2307f(%rip), %eax     # 0x267e9
cmpl $0x20, %eax
jge 0x37ab
movss 0x23095(%rip), %xmm0    # 0x2680c
movss 0x1d90d(%rip), %xmm1    # 0x2108c
ucomiss %xmm1, %xmm0
jbe 0x37ab
movb $0x20, 0x2305e(%rip)    # 0x267e9
movq 0x18(%rsp), %rdi
callq 0x2890
movb 0x2304e(%rip), %al      # 0x267e9
movb %al, 0x230c7(%rip)      # 0x26868
movl $0x7, 0x23039(%rip)     # 0x267e4
jmp 0x37ad
jmp 0x381e
testb $0x1, 0x2327a(%rip)     # 0x26a30
jne 0x381c
movzbl 0x2302a(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jle 0x381c
movss 0x23090(%rip), %xmm0    # 0x2685c
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x381c
jp 0x381c
testb $0x1, 0x2324c(%rip)     # 0x26a29
jne 0x3813
testb $0x1, 0x2323a(%rip)     # 0x26a20
jne 0x3813
movb $0x6, 0x22ffa(%rip)     # 0x267e9
movb $0x1, 0x2322a(%rip)     # 0x26a20
movq 0x18(%rsp), %rdi
callq 0x2890
movb $0x0, 0x22fe5(%rip)     # 0x267ec
movl $0x7, 0x22fd3(%rip)     # 0x267e4
jmp 0x381a
movb $0x20, 0x22fcf(%rip)    # 0x267e9
jmp 0x381c
jmp 0x381e
movss 0x22fe6(%rip), %xmm0    # 0x2680c
ucomiss 0x23037(%rip), %xmm0    # 0x26864
jbe 0x383f
movss 0x22fd5(%rip), %xmm0    # 0x2680c
movss %xmm0, 0x23025(%rip)    # 0x26864
movss 0x23015(%rip), %xmm0    # 0x2685c
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3873
jp 0x3873
cmpl $0x1, 0x22f8c(%rip)     # 0x267e4
jne 0x3873
testb $0x1, 0x231cf(%rip)     # 0x26a30
je 0x3873
movss 0x1d819(%rip), %xmm0    # 0x21084
movss %xmm0, 0x22ff1(%rip)    # 0x26864
movss 0x22fe1(%rip), %xmm0    # 0x2685c
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3a06
jp 0x3a06
testb $0x1, 0x2319c(%rip)     # 0x26a30
je 0x3a06
movss 0x22f9e(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22f92(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d7da(%rip), %xmm0    # 0x21090
ucomiss %xmm1, %xmm0
ja 0x3986
movss 0x22f79(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22f6d(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
imull $-0x1, 0x228ea(%rip), %eax # 0x261c4
cvtsi2ss %eax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x38fc
movss 0x22f21(%rip), %xmm0    # 0x2680c
movss 0x1d791(%rip), %xmm1    # 0x21084
ucomiss %xmm1, %xmm0
ja 0x3986
movss 0x22f3c(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22f30(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d77c(%rip), %xmm0    # 0x21094
ucomiss %xmm1, %xmm0
jbe 0x395c
movss 0x22ee7(%rip), %xmm0    # 0x2680c
movss 0x1d757(%rip), %xmm1    # 0x21084
ucomiss %xmm1, %xmm0
jbe 0x395c
movss 0x22efe(%rip), %xmm0    # 0x26838
cvtsi2ssl 0x22ee6(%rip), %xmm1 # 0x26828
ucomiss %xmm1, %xmm0
ja 0x3986
movss 0x22ebd(%rip), %xmm0    # 0x2680c
movss 0x1d741(%rip), %xmm1    # 0x21098
ucomiss %xmm1, %xmm0
ja 0x3986
movss 0x1d738(%rip), %xmm0    # 0x2109c
ucomiss 0x230c1(%rip), %xmm0    # 0x26a2c
jbe 0x3a06
movss 0x22e93(%rip), %xmm0    # 0x2680c
ucomiss 0x22ee4(%rip), %xmm0    # 0x26864
jb 0x3a06
testb $0x1, 0x2309c(%rip)     # 0x26a29
jne 0x39fd
cmpl $0x1, 0x22e4e(%rip)     # 0x267e4
jne 0x39fd
movb $0x6, 0x22e4a(%rip)     # 0x267e9
movl $0x1, 0xc(%rsp)
cmpl $0x21, 0xc(%rsp)
jg 0x39bd
jmp 0x39b0
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x39a7
movb $0x1, 0x22e28(%rip)     # 0x267ec
testb $0x1, 0x23055(%rip)     # 0x26a20
jne 0x39d7
movq 0x18(%rsp), %rdi
callq 0x2890
movb $0x1, 0x23042(%rip)     # 0x26a20
movb $0x0, 0x22e07(%rip)     # 0x267ec
movb 0x22dfe(%rip), %al      # 0x267e9
movb %al, 0x22e77(%rip)      # 0x26868
movl $0x14, 0x22de9(%rip)    # 0x267e4
jmp 0x3a04
movb $0x20, 0x22de5(%rip)    # 0x267e9
jmp 0x3a06
movss 0x22e4e(%rip), %xmm0    # 0x2685c
movss 0x1d68a(%rip), %xmm1    # 0x210a0
ucomiss %xmm1, %xmm0
jbe 0x41cd
testb $0x1, 0x23003(%rip)     # 0x26a29
jne 0x41cd
movzbl 0x22db6(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jne 0x3a46
cvttss2si 0x22e1c(%rip), %eax # 0x2685c
movl %eax, 0x2277e(%rip)     # 0x261c4
movss 0x1d656(%rip), %xmm0    # 0x210a4
ucomiss 0x22deb(%rip), %xmm0    # 0x26840
jbe 0x3c53
movss 0x1d645(%rip), %xmm0    # 0x210a8
ucomiss 0x22fc2(%rip), %xmm0    # 0x26a2c
jbe 0x3c53
cmpl $0x0, 0x22dc5(%rip)     # 0x2683c
jl 0x3c53
movzbl 0x22d65(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jge 0x3c53
movb 0x22d56(%rip), %al      # 0x267e9
addb $0x1, %al
movb %al, 0x22d4e(%rip)      # 0x267e9
movss 0x22d9d(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22d91(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d5f5(%rip), %xmm0    # 0x210ac
ucomiss %xmm1, %xmm0
jbe 0x3adf
cmpl $0x0, 0x22d79(%rip)     # 0x2683c
jl 0x3adf
movzbl 0x22d1d(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jge 0x3adf
movb 0x22d12(%rip), %al      # 0x267e9
addb $0x1, %al
movb %al, 0x22d0a(%rip)      # 0x267e9
movss 0x22d59(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22d4d(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d5b5(%rip), %xmm0    # 0x210b0
ucomiss %xmm1, %xmm0
jbe 0x3b23
cmpl $0x0, 0x22d35(%rip)     # 0x2683c
jl 0x3b23
movzbl 0x22cd9(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jge 0x3b23
movb 0x22cce(%rip), %al      # 0x267e9
addb $0x1, %al
movb %al, 0x22cc6(%rip)      # 0x267e9
movss 0x22d15(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22d09(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d575(%rip), %xmm0    # 0x210b4
ucomiss %xmm1, %xmm0
jbe 0x3b67
cmpl $0x0, 0x22cf1(%rip)     # 0x2683c
jl 0x3b67
movzbl 0x22c95(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jge 0x3b67
movb 0x22c8a(%rip), %al      # 0x267e9
addb $0x1, %al
movb %al, 0x22c82(%rip)      # 0x267e9
movss 0x22cd1(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22cc5(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d535(%rip), %xmm0    # 0x210b8
ucomiss %xmm1, %xmm0
jbe 0x3bab
cmpl $0x0, 0x22cad(%rip)     # 0x2683c
jl 0x3bab
movzbl 0x22c51(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jge 0x3bab
movb 0x22c46(%rip), %al      # 0x267e9
addb $0x1, %al
movb %al, 0x22c3e(%rip)      # 0x267e9
movss 0x22c8d(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22c81(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d4f5(%rip), %xmm0    # 0x210bc
ucomiss %xmm1, %xmm0
jbe 0x3bef
cmpl $0x0, 0x22c69(%rip)     # 0x2683c
jl 0x3bef
movzbl 0x22c0d(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jge 0x3bef
movb 0x22c02(%rip), %al      # 0x267e9
addb $0x1, %al
movb %al, 0x22bfa(%rip)      # 0x267e9
movss 0x22c49(%rip), %xmm1    # 0x26840
cvtsi2ssl 0x22c3d(%rip), %xmm0 # 0x2683c
subss %xmm0, %xmm1
movss 0x1d4b5(%rip), %xmm0    # 0x210c0
ucomiss %xmm1, %xmm0
jbe 0x3c33
cmpl $0x0, 0x22c25(%rip)     # 0x2683c
jl 0x3c33
movzbl 0x22bc9(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jge 0x3c33
movb 0x22bbe(%rip), %al      # 0x267e9
addb $0x1, %al
movb %al, 0x22bb6(%rip)      # 0x267e9
movq 0x18(%rsp), %rdi
callq 0x2890
movl $0xc, 0x22b9d(%rip)     # 0x267e4
movb 0x22b9c(%rip), %al      # 0x267e9
movb %al, 0x22c15(%rip)      # 0x26868
cvtsi2ssl 0x22be1(%rip), %xmm1 # 0x2683c
subss 0x22bdd(%rip), %xmm1    # 0x26840
movss 0x1d459(%rip), %xmm0    # 0x210c4
ucomiss %xmm1, %xmm0
jbe 0x3c80
movzbl 0x22b72(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jg 0x3dc2
cvtsi2ssl 0x22bb4(%rip), %xmm1 # 0x2683c
subss 0x22bb0(%rip), %xmm1    # 0x26840
movss 0x1d430(%rip), %xmm0    # 0x210c8
ucomiss %xmm1, %xmm0
jbe 0x3cbe
movss 0x1d3d7(%rip), %xmm0    # 0x2107c
ucomiss 0x22b8c(%rip), %xmm0    # 0x26838
jbe 0x3cbe
movzbl 0x22b34(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jg 0x3dc2
cmpl $0x7d0, 0x22b74(%rip)   # imm = 0x7D0
jge 0x3cfe
movl 0x22b6c(%rip), %eax     # 0x2683c
addl $0x190, %eax            # imm = 0x190
cmpl 0x22b55(%rip), %eax     # 0x26830
jge 0x3cfe
movss 0x1d39f(%rip), %xmm0    # 0x21084
ucomiss 0x22b20(%rip), %xmm0    # 0x2680c
jbe 0x3cfe
movzbl 0x22af4(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jg 0x3dc2
movss 0x22b06(%rip), %xmm1    # 0x2680c
movzbl 0x22a9e(%rip), %eax     # 0x267ab
cvtsi2ss %eax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x3d22
cmpl $0x7d0, 0x22b1c(%rip)   # imm = 0x7D0
jl 0x3d63
movss 0x22ae2(%rip), %xmm0    # 0x2680c
movzbl 0x22a7a(%rip), %eax     # 0x267ab
cvtsi2ss %eax, %xmm1
ucomiss %xmm1, %xmm0
jb 0x3e74
movss 0x1d32a(%rip), %xmm0    # 0x21070
ucomiss 0x22abf(%rip), %xmm0    # 0x2680c
jbe 0x3e74
cmpl $0x5dc, 0x22adf(%rip)   # imm = 0x5DC
jge 0x3e74
movl 0x22ad3(%rip), %eax     # 0x2683c
addl $0x320, %eax            # imm = 0x320
cmpl 0x22abc(%rip), %eax     # 0x26830
jge 0x3e74
movl 0x22abc(%rip), %eax     # 0x2683c
addl $0x190, %eax            # imm = 0x190
cmpl 0x22a9d(%rip), %eax     # 0x26828
jge 0x3e74
movss 0x1d333(%rip), %xmm1    # 0x210cc
addss 0x22a97(%rip), %xmm1    # 0x26838
cvtsi2ssl 0x22a7f(%rip), %xmm0 # 0x26828
ucomiss %xmm1, %xmm0
jbe 0x3e74
movzbl 0x22a30(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jle 0x3e74
movb 0x22a21(%rip), %al      # 0x267e9
addb $-0x1, %al
movb %al, 0x22a19(%rip)      # 0x267e9
movl $0x3, 0x4(%rsp)
cmpl $0x14, 0x4(%rsp)
jge 0x3e35
cvtsi2ssl 0x22a55(%rip), %xmm1 # 0x2683c
subss 0x22a51(%rip), %xmm1    # 0x26840
movl 0x22a3b(%rip), %eax     # 0x26830
imull $0x2bc, 0x4(%rsp), %ecx # imm = 0x2BC
subl %ecx, %eax
cvtsi2ss %eax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x3e24
movzbl 0x229da(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jle 0x3e24
movb 0x229cf(%rip), %al      # 0x267e9
addb $-0x1, %al
movb %al, 0x229c7(%rip)      # 0x267e9
jmp 0x3e26
jmp 0x3e35
jmp 0x3e28
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x3dd8
movzbl 0x229ad(%rip), %eax     # 0x267e9
cmpl $0x1f, %eax
jne 0x3e4f
movb 0x229a2(%rip), %al      # 0x267e9
addb $-0x1, %al
movb %al, 0x2299a(%rip)      # 0x267e9
movq 0x18(%rsp), %rdi
callq 0x2890
movb 0x2298a(%rip), %al      # 0x267e9
movb %al, 0x22a03(%rip)      # 0x26868
movl $0xc, 0x22975(%rip)     # 0x267e4
jmp 0x41cb
cvtsi2ssl 0x229c0(%rip), %xmm1 # 0x2683c
subss 0x229bc(%rip), %xmm1    # 0x26840
movss 0x1d244(%rip), %xmm0    # 0x210d0
ucomiss %xmm1, %xmm0
jbe 0x3ea6
movss 0x1d1ff(%rip), %xmm0    # 0x21098
ucomiss 0x2296c(%rip), %xmm0    # 0x2680c
ja 0x40d9
movss 0x22992(%rip), %xmm0    # 0x26840
movss 0x1d21e(%rip), %xmm1    # 0x210d4
ucomiss %xmm1, %xmm0
jbe 0x3ecb
cmpl $0x3e8, 0x22977(%rip)   # imm = 0x3E8
jl 0x40d9
cvtsi2ssl 0x22969(%rip), %xmm1 # 0x2683c
subss 0x22965(%rip), %xmm1    # 0x26840
movss 0x1d1e5(%rip), %xmm0    # 0x210c8
ucomiss %xmm1, %xmm0
jbe 0x3f16
movss 0x2291c(%rip), %xmm1    # 0x2680c
movss 0x2296c(%rip), %xmm0    # 0x26864
movss 0x1d1d8(%rip), %xmm2    # 0x210d8
subss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x3f16
cmpl $0x0, 0x22920(%rip)     # 0x26830
jg 0x40d9
cvtsi2ssl 0x2291e(%rip), %xmm1 # 0x2683c
subss 0x2291a(%rip), %xmm1    # 0x26840
movss 0x1d1ae(%rip), %xmm0    # 0x210dc
ucomiss %xmm1, %xmm0
jbe 0x3f6a
movss 0x228d1(%rip), %xmm0    # 0x2680c
cvtss2sd %xmm0, %xmm1
movss 0x2291d(%rip), %xmm0    # 0x26864
cvtss2sd %xmm0, %xmm0
movsd 0x1d105(%rip), %xmm2    # 0x21058
subsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x3f6a
cmpl $0x0, 0x228cc(%rip)     # 0x26830
jg 0x40d9
cvtsi2ssl 0x228ca(%rip), %xmm1 # 0x2683c
subss 0x228c6(%rip), %xmm1    # 0x26840
movss 0x1d0fa(%rip), %xmm0    # 0x2107c
ucomiss %xmm1, %xmm0
jbe 0x3fb5
movss 0x2287d(%rip), %xmm1    # 0x2680c
movss 0x228cd(%rip), %xmm0    # 0x26864
movss 0x1d0c9(%rip), %xmm2    # 0x21068
subss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x3fb5
cmpl $0x0, 0x22881(%rip)     # 0x26830
jg 0x40d9
cvtsi2ssl 0x2287f(%rip), %xmm1 # 0x2683c
subss 0x2287b(%rip), %xmm1    # 0x26840
movss 0x1d0cf(%rip), %xmm0    # 0x2109c
ucomiss %xmm1, %xmm0
jbe 0x4009
movss 0x22832(%rip), %xmm0    # 0x2680c
cvtss2sd %xmm0, %xmm1
movss 0x2287e(%rip), %xmm0    # 0x26864
cvtss2sd %xmm0, %xmm0
movsd 0x1d06e(%rip), %xmm2    # 0x21060
subsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4009
cmpl $0x0, 0x2282d(%rip)     # 0x26830
jg 0x40d9
movss 0x22a1b(%rip), %xmm0    # 0x26a2c
movss 0x1d06f(%rip), %xmm1    # 0x21088
ucomiss %xmm1, %xmm0
ja 0x40d9
cvtsi2ssl 0x22812(%rip), %xmm1 # 0x2683c
subss 0x2280e(%rip), %xmm1    # 0x26840
movss 0x1d0a2(%rip), %xmm0    # 0x210dc
ucomiss %xmm1, %xmm0
jbe 0x406a
movss 0x1d035(%rip), %xmm0    # 0x2107c
ucomiss 0x227ea(%rip), %xmm0    # 0x26838
jbe 0x406a
movss 0x1d040(%rip), %xmm0    # 0x21098
ucomiss 0x227ad(%rip), %xmm0    # 0x2680c
jbe 0x406a
cmpl $0x0, 0x227c8(%rip)     # 0x26830
jg 0x40d9
cvtsi2ssl 0x227ca(%rip), %xmm1 # 0x2683c
subss 0x227c6(%rip), %xmm1    # 0x26840
movss 0x1cffa(%rip), %xmm0    # 0x2107c
ucomiss %xmm1, %xmm0
jbe 0x41c9
movss 0x227a5(%rip), %xmm1    # 0x26838
movl 0x2278f(%rip), %eax     # 0x26828
subl $0x190, %eax            # imm = 0x190
cvtsi2ss %eax, %xmm0
ucomiss %xmm1, %xmm0
ja 0x40b7
xorps %xmm0, %xmm0
ucomiss 0x22787(%rip), %xmm0    # 0x26838
jbe 0x41c9
movss 0x1cfd9(%rip), %xmm0    # 0x21098
ucomiss 0x22746(%rip), %xmm0    # 0x2680c
jbe 0x41c9
cmpl $0x0, 0x2275d(%rip)     # 0x26830
jle 0x41c9
movzbl 0x22709(%rip), %eax     # 0x267e9
cmpl $0x5, %eax
jle 0x40fc
testb $0x1, 0x22944(%rip)     # 0x26a30
je 0x40fc
movb 0x226f5(%rip), %al      # 0x267e9
addb $-0x1, %al
movb %al, 0x226ed(%rip)      # 0x267e9
movl $0x3, (%rsp)
cmpl $0x14, (%rsp)
jge 0x415c
cvtsi2ssl 0x2272b(%rip), %xmm1 # 0x2683c
subss 0x22727(%rip), %xmm1    # 0x26840
movl 0x22711(%rip), %eax     # 0x26830
imull $0x2bc, (%rsp), %ecx    # imm = 0x2BC
subl %ecx, %eax
cvtsi2ss %eax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x414d
movzbl 0x226b1(%rip), %eax     # 0x267e9
cmpl $0x6, %eax
jle 0x414d
movb 0x226a6(%rip), %al      # 0x267e9
addb $-0x1, %al
movb %al, 0x2269e(%rip)      # 0x267e9
jmp 0x414f
jmp 0x415c
jmp 0x4151
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x4103
movzbl 0x22686(%rip), %eax     # 0x267e9
movzbl 0x228b9(%rip), %ecx     # 0x26a23
cmpl %ecx, %eax
je 0x4199
movzbl 0x22674(%rip), %eax     # 0x267e9
cmpl $0x5, %eax
jne 0x418f
movb $0x6, 0x22668(%rip)     # 0x267e9
movb $0x1, 0x22664(%rip)     # 0x267ec
movb $0x0, 0x22891(%rip)     # 0x26a20
movq 0x18(%rsp), %rdi
callq 0x2890
movb 0x2264a(%rip), %al      # 0x267e9
movb %al, 0x226c3(%rip)      # 0x26868
movzbl 0x22640(%rip), %eax     # 0x267ec
cmpl $0x0, %eax
jne 0x41bd
movl $0x7, 0x22629(%rip)     # 0x267e4
jmp 0x41c7
movl $0x14, 0x2261d(%rip)    # 0x267e4
jmp 0x41c9
jmp 0x41cb
jmp 0x41cd
jmp 0x41cf
movl 0x21fef(%rip), %esi     # 0x261c4
movss 0x22687(%rip), %xmm0    # 0x26864
cvtss2sd %xmm0, %xmm0
leaq 0x1d0de(%rip), %rdi     # 0x212c6
movb $0x1, %al
callq 0x2040
movl 0x225ef(%rip), %esi     # 0x267e4
leaq 0x1d0e7(%rip), %rdi     # 0x212e3
movb $0x0, %al
callq 0x2040
cmpl $0x1, 0x225da(%rip)     # 0x267e4
jle 0x421b
movl 0x225d2(%rip), %eax     # 0x267e4
addl $-0x1, %eax
movl %eax, 0x225c9(%rip)     # 0x267e4
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)