// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbx
movl 0x14435(%rip), %eax     # 0x177a4
cmpl $0x1, %eax
je 0x33f8
testl %eax, %eax
jne 0x3809
movzbl 0x143e3(%rip), %eax     # 0x1776a
cvtsi2ss %eax, %xmm1
movss %xmm1, 0x14485(%rip)    # 0x17818
movl $0x0, 0x1444b(%rip)     # 0x177e8
movl $0x64, 0x14449(%rip)    # 0x177f0
movss 0x1441d(%rip), %xmm0    # 0x177cc
ucomiss %xmm1, %xmm0
jbe 0x33bc
movss %xmm0, 0x1445c(%rip)    # 0x17818
movl $0x600, 0x143e2(%rip)   # imm = 0x600
movb 0x14456(%rip), %cl      # 0x17822
cmpb $0x20, %cl
sete 0x14452(%rip)           # 0x17828
movw $0x0, 0x143cd(%rip)     # 0x177ac
movb %cl, 0x143c4(%rip)      # 0x177a9
movl $0x5, %eax
cmpb $0x4, %cl
ja 0x3803
jmp 0x384f
movq %rdi, %rbx
cmpb $0x1, 0x14426(%rip)     # 0x17828
jne 0x345b
movss 0x143c0(%rip), %xmm0    # 0x177cc
xorl %eax, %eax
ucomiss 0xfc0b(%rip), %xmm0     # 0x13020
movb $0x1, %cl
jbe 0x34c2
movss 0xfbff(%rip), %xmm1     # 0x13024
ucomiss 0x14400(%rip), %xmm1    # 0x1782c
jbe 0x34c2
xorl %eax, %eax
ucomiss 0xfbed(%rip), %xmm0     # 0x13028
jbe 0x34c2
cmpb $0x1f, 0x14361(%rip)    # 0x177a9
ja 0x34c2
movb $0x20, 0x14358(%rip)    # 0x177a9
movq %rbx, %rdi
callq 0x28d4
jmp 0x34b4
movb $0x1, %cl
xorl %eax, %eax
cmpb $0x0, 0x143ca(%rip)     # 0x17830
jne 0x34c2
cmpb $0x7, 0x1433a(%rip)     # 0x177a9
jb 0x34c2
movss 0x14397(%rip), %xmm0    # 0x17810
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x34c2
jp 0x34c2
cmpb $0x0, 0x14392(%rip)     # 0x1781c
je 0x3497
movb $0x20, 0x14316(%rip)    # 0x177a9
xorl %eax, %eax
jmp 0x34c2
movb $0x6, 0x1430b(%rip)     # 0x177a9
movb $0x1, 0x14377(%rip)     # 0x1781c
movq %rbx, %rdi
callq 0x28d4
movb $0x0, 0x142f8(%rip)     # 0x177ac
movl $0x7, 0x142e6(%rip)     # 0x177a4
movb $0x1, %al
xorl %ecx, %ecx
movss 0x14302(%rip), %xmm1    # 0x177cc
movss 0x14346(%rip), %xmm2    # 0x17818
ucomiss %xmm2, %xmm1
jbe 0x34e2
movss %xmm1, 0x14339(%rip)    # 0x17818
movaps %xmm1, %xmm2
movss 0x14326(%rip), %xmm0    # 0x17810
xorps %xmm3, %xmm3
ucomiss %xmm0, %xmm3
setp %dl
setne %sil
orb %dl, %sil
xorb $0x1, %cl
orb %sil, %cl
jne 0x351d
cmpb $0x1, 0x14327(%rip)     # 0x17830
jne 0x351d
movl $0x41700000, 0x14303(%rip) # imm = 0x41700000
movss 0xfb03(%rip), %xmm2     # 0x13020
ucomiss %xmm3, %xmm0
jne 0x3616
jp 0x3616
cmpb $0x1, 0x142fd(%rip)     # 0x17830
jne 0x3616
movss 0x142bf(%rip), %xmm3    # 0x17800
cvtsi2ssl 0x142b3(%rip), %xmm4 # 0x177fc
subss %xmm4, %xmm3
movss 0xfad7(%rip), %xmm4     # 0x1302c
ucomiss %xmm3, %xmm4
ja 0x35c4
ucomiss 0xfabf(%rip), %xmm1     # 0x13020
jbe 0x3577
xorl %ecx, %ecx
subl 0x13c21(%rip), %ecx     # 0x1718c
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
ucomiss %xmm3, %xmm4
ja 0x35c4
ucomiss 0xfaa2(%rip), %xmm1     # 0x13020
jbe 0x35ae
movss 0xfaa8(%rip), %xmm4     # 0x13030
ucomiss %xmm3, %xmm4
jbe 0x35ae
ucomiss 0xfaa0(%rip), %xmm1     # 0x13034
ja 0x35c4
xorps %xmm3, %xmm3
cvtsi2ssl 0x14247(%rip), %xmm3 # 0x177e8
movss 0x1424f(%rip), %xmm4    # 0x177f8
ucomiss %xmm3, %xmm4
ja 0x35c4
movss 0xfa82(%rip), %xmm3     # 0x13038
ucomiss 0x1426f(%rip), %xmm3    # 0x1782c
jbe 0x3616
ucomiss %xmm2, %xmm1
jb 0x3616
orb 0x1425e(%rip), %al      # 0x17828
testb $0x1, %al
je 0x35d7
movb $0x20, 0x141d4(%rip)    # 0x177a9
jmp 0x3616
movb $0x6, 0x141cb(%rip)     # 0x177a9
movb $0x1, 0x141c7(%rip)     # 0x177ac
cmpb $0x0, 0x14230(%rip)     # 0x1781c
jne 0x35fe
movq %rbx, %rdi
callq 0x28d4
movss 0x14212(%rip), %xmm0    # 0x17810
movb $0x1, 0x14217(%rip)     # 0x1781c
movb $0x0, 0x141a0(%rip)     # 0x177ac
movl $0x14, 0x1418e(%rip)    # 0x177a4
ucomiss 0xf9fb(%rip), %xmm0     # 0x13018
jbe 0x3809
cmpb $0x0, 0x141fe(%rip)     # 0x17828
jne 0x3809
movb 0x14173(%rip), %al      # 0x177a9
cmpb $0x6, %al
jne 0x3644
cvttss2si %xmm0, %ecx
movl %ecx, 0x13b48(%rip)     # 0x1718c
movss 0x141b4(%rip), %xmm2    # 0x17800
movl 0x141aa(%rip), %ecx     # 0x177fc
cmpb $0x1e, %al
ja 0x3750
movss 0xf9da(%rip), %xmm0     # 0x1303c
ucomiss %xmm2, %xmm0
jbe 0x3750
movss 0xf9cd(%rip), %xmm0     # 0x13040
ucomiss 0x141b2(%rip), %xmm0    # 0x1782c
jbe 0x3750
testl %ecx, %ecx
js 0x3750
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
subss %xmm0, %xmm2
movss 0xf9a9(%rip), %xmm0     # 0x13044
ucomiss %xmm2, %xmm0
seta %cl
cmpb $0x1e, %al
setb %dl
andb %cl, %dl
addb %al, %dl
incb %dl
movss 0xf994(%rip), %xmm0     # 0x13048
ucomiss %xmm2, %xmm0
seta %al
cmpb $0x1f, %dl
setb %cl
andb %al, %cl
addb %dl, %cl
movss 0xf980(%rip), %xmm0     # 0x1304c
ucomiss %xmm2, %xmm0
seta %al
cmpb $0x1f, %cl
setb %dl
andb %al, %dl
addb %cl, %dl
movss 0xf96c(%rip), %xmm0     # 0x13050
ucomiss %xmm2, %xmm0
seta %al
cmpb $0x1f, %dl
setb %cl
andb %al, %cl
addb %dl, %cl
movss 0xf958(%rip), %xmm0     # 0x13054
ucomiss %xmm2, %xmm0
seta %al
cmpb $0x1f, %cl
setb %dl
andb %al, %dl
addb %cl, %dl
movss 0xf944(%rip), %xmm0     # 0x13058
ucomiss %xmm2, %xmm0
seta %al
cmpb $0x1f, %dl
setb %cl
andb %al, %cl
addb %dl, %cl
movb %cl, 0x1407f(%rip)      # 0x177a9
movq %rbx, %rdi
callq 0x28d4
movl $0xc, 0x14068(%rip)     # 0x177a4
movl 0x140ba(%rip), %ecx     # 0x177fc
movss 0x140b6(%rip), %xmm2    # 0x17800
movb 0x14059(%rip), %al      # 0x177a9
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
subss %xmm2, %xmm0
movss 0xf8f9(%rip), %xmm1     # 0x1305c
ucomiss %xmm0, %xmm1
seta %dl
cmpb $0x7, %al
setae %sil
testb %sil, %dl
jne 0x37af
cmpb $0x7, %al
setae %dl
movss 0x14077(%rip), %xmm1    # 0x177f8
movss 0xf8d7(%rip), %xmm3     # 0x13060
movaps %xmm0, %xmm4
cmpltps %xmm3, %xmm4
movss 0xf8cc(%rip), %xmm5     # 0x13064
movaps %xmm1, %xmm3
cmpltps %xmm5, %xmm3
andps %xmm3, %xmm4
movd %xmm4, %esi
testb %dl, %sil
je 0x3853
decb %al
movb %al, 0x13ff2(%rip)      # 0x177a9
movl $0xfffff7cc, %ecx       # imm = 0xFFFFF7CC
movl 0x1402e(%rip), %edx     # 0x177f0
leal (%rdx,%rcx), %esi
xorps %xmm1, %xmm1
cvtsi2ss %esi, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x37eb
cmpb $0x7, %al
jb 0x37eb
decb %al
movb %al, 0x13fcc(%rip)      # 0x177a9
addl $0xfffffd44, %ecx       # imm = 0xFFFFFD44
cmpl $0xffffc950, %ecx       # imm = 0xFFFFC950
jne 0x37c2
cmpb $0x1f, %al
jne 0x37f6
movb $0x1e, 0x13fb3(%rip)    # 0x177a9
movq %rbx, %rdi
callq 0x28d4
movl $0xc, %eax
movl %eax, 0x13f9b(%rip)     # 0x177a4
movl 0x1397d(%rip), %esi     # 0x1718c
xorps %xmm0, %xmm0
cvtss2sd 0x13ffe(%rip), %xmm0    # 0x17818
leaq 0xfbed(%rip), %rdi      # 0x1340e
movb $0x1, %al
callq 0x2040
movl 0x13f76(%rip), %esi     # 0x177a4
leaq 0xfbf6(%rip), %rdi      # 0x1342b
xorl %eax, %eax
callq 0x2040
movl 0x13f62(%rip), %eax     # 0x177a4
cmpl $0x2, %eax
jl 0x384f
decl %eax
movl %eax, 0x13f55(%rip)     # 0x177a4
xorl %eax, %eax
popq %rbx
retq
cmpl $0x7d0, %ecx            # imm = 0x7D0
jge 0x38bc
cmpb $0x7, %al
setae %dil
leal 0x190(%rcx), %edx
movl 0x13f83(%rip), %esi     # 0x177f0
cmpl %esi, %edx
setl %r8b
movss 0x13f51(%rip), %xmm4    # 0x177cc
movss 0xf79d(%rip), %xmm5     # 0x13020
ucomiss %xmm4, %xmm5
seta %r9b
andb %r8b, %r9b
testb %dil, %r9b
jne 0x37af
movzbl 0x13ece(%rip), %edi     # 0x1776b
xorps %xmm5, %xmm5
cvtsi2ss %edi, %xmm5
ucomiss %xmm4, %xmm5
jbe 0x3a7b
leal 0x320(%rcx), %edi
cmpl %esi, %edi
jge 0x38c4
jmp 0x3ab7
movss 0x13f08(%rip), %xmm4    # 0x177cc
movss 0xf7a0(%rip), %xmm5     # 0x1306c
ucomiss %xmm0, %xmm5
jbe 0x38de
movss 0xf75b(%rip), %xmm5     # 0x13034
ucomiss %xmm4, %xmm5
ja 0x38f7
cmpl $0x3e7, %ecx            # imm = 0x3E7
jg 0x3982
ucomiss 0xf77f(%rip), %xmm2     # 0x13070
jbe 0x3982
cmpb $0x6, %al
jb 0x390c
cmpb $0x1, 0x13f2e(%rip)     # 0x17830
jne 0x390c
decb %al
movb %al, 0x13e9d(%rip)      # 0x177a9
movl $0xfffff7cc, %ecx       # imm = 0xFFFFF7CC
movl 0x13ed9(%rip), %edx     # 0x177f0
leal (%rdx,%rcx), %esi
xorps %xmm1, %xmm1
cvtsi2ss %esi, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x3940
cmpb $0x7, %al
jb 0x3940
decb %al
movb %al, 0x13e77(%rip)      # 0x177a9
addl $0xfffffd44, %ecx       # imm = 0xFFFFFD44
cmpl $0xffffc950, %ecx       # imm = 0xFFFFC950
jne 0x3917
cmpb 0x13edc(%rip), %al      # 0x17822
je 0x3969
cmpb $0x5, %al
jne 0x3961
movb $0x6, 0x13e56(%rip)     # 0x177a9
movb $0x1, 0x13e52(%rip)     # 0x177ac
movb $0x0, 0x13ebb(%rip)     # 0x1781c
movq %rbx, %rdi
callq 0x28d4
cmpb $0x0, 0x13e3c(%rip)     # 0x177ac
movl $0x7, %ecx
movl $0x14, %eax
cmovel %ecx, %eax
jmp 0x3803
movss 0xf6d6(%rip), %xmm2     # 0x13060
ucomiss %xmm0, %xmm2
jbe 0x39b1
movss 0x13e81(%rip), %xmm2    # 0x17818
addss 0xf6d5(%rip), %xmm2     # 0x13074
ucomiss %xmm4, %xmm2
jbe 0x39b1
cmpl $0x0, 0x13e45(%rip)     # 0x177f0
jg 0x38f7
movss 0xf6bf(%rip), %xmm2     # 0x13078
ucomiss %xmm0, %xmm2
jbe 0x39eb
xorps %xmm2, %xmm2
cvtss2sd %xmm4, %xmm2
xorps %xmm5, %xmm5
cvtss2sd 0x13e48(%rip), %xmm5    # 0x17818
addsd 0xf708(%rip), %xmm5     # 0x130e0
ucomisd %xmm2, %xmm5
jbe 0x39eb
cmpl $0x0, 0x13e0b(%rip)     # 0x177f0
jg 0x38f7
movss 0xf671(%rip), %xmm2     # 0x13064
ucomiss %xmm0, %xmm2
jbe 0x3a1a
movss 0x13e18(%rip), %xmm5    # 0x17818
addss 0xf674(%rip), %xmm5     # 0x1307c
ucomiss %xmm4, %xmm5
jbe 0x3a1a
cmpl $0x0, 0x13ddc(%rip)     # 0x177f0
jg 0x38f7
movss 0xf616(%rip), %xmm5     # 0x13038
ucomiss %xmm0, %xmm5
jbe 0x3af5
xorps %xmm5, %xmm5
cvtss2sd %xmm4, %xmm5
xorps %xmm6, %xmm6
cvtss2sd 0x13ddb(%rip), %xmm6    # 0x17818
addsd 0xf6a3(%rip), %xmm6     # 0x130e8
ucomisd %xmm5, %xmm6
seta %dl
movl 0x13d9e(%rip), %ecx     # 0x177f0
testl %ecx, %ecx
setg %sil
testb %sil, %dl
jne 0x38f7
movss 0x13dc3(%rip), %xmm5    # 0x1782c
ucomiss 0xf5b4(%rip), %xmm5     # 0x13024
jbe 0x3b10
jmp 0x38f7
cmpleps %xmm4, %xmm5
movss 0xf589(%rip), %xmm6     # 0x13010
movaps %xmm4, %xmm7
cmpltps %xmm6, %xmm7
andps %xmm5, %xmm7
movd %xmm7, %edi
cmpl $0x5dc, %ecx            # imm = 0x5DC
setl %r8b
andb %dil, %r8b
leal 0x320(%rcx), %edi
cmpl %esi, %edi
setl %sil
testb %sil, %r8b
je 0x38c4
movl 0x13d2b(%rip), %esi     # 0x177e8
cmpl %esi, %edx
jge 0x38c4
cmpb $0x7, %al
setae %dl
movaps %xmm1, %xmm5
xorps %xmm6, %xmm6
cvtsi2ss %esi, %xmm6
addss 0xf58c(%rip), %xmm5     # 0x13068
ucomiss %xmm5, %xmm6
seta %sil
andb %dl, %sil
cmpb $0x1, %sil
je 0x37af
jmp 0x38c4
movss 0x13d2f(%rip), %xmm5    # 0x1782c
ucomiss 0xf520(%rip), %xmm5     # 0x13024
ja 0x38f7
movl 0x13ce0(%rip), %ecx     # 0x177f0
movss 0xf51c(%rip), %xmm5     # 0x13034
ucomiss %xmm4, %xmm5
seta %dl
movss 0xf552(%rip), %xmm6     # 0x13078
movaps %xmm0, %xmm7
cmpltps %xmm6, %xmm7
andps %xmm3, %xmm7
movd %xmm7, %esi
andb %dl, %sil
testl %ecx, %ecx
setg %dl
testb %dl, %sil
jne 0x38f7
ucomiss %xmm0, %xmm2
jbe 0x3809
testl %ecx, %ecx
setg %cl
ucomiss %xmm4, %xmm5
seta %dl
movl $0xfffffe70, %esi       # imm = 0xFFFFFE70
addl 0x13c84(%rip), %esi     # 0x177e8
xorps %xmm2, %xmm2
cvtsi2ss %esi, %xmm2
xorps %xmm3, %xmm3
movaps %xmm1, %xmm4
cmpltps %xmm3, %xmm4
cmpltps %xmm2, %xmm1
orps %xmm4, %xmm1
movd %xmm1, %esi
andb %cl, %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x3809
jmp 0x38f7