Normalization__NormalizeCharacter
INT64 __fastcall Normalization__NormalizeCharacter(INT64 a1, INT64 a2, UINT8 a3, INT64 a4){
UINT8 v5;
unsigned int v6;
int v8;
CHAR v9;
unsigned __int8 v10;
unsigned int v11;
unsigned int v12;
CHAR v13;
unsigned __int16 *v14;
int v15;
unsigned __int8 v16;
unsigned __int8 v17;
unsigned __int8 v18;
char v19;
unsigned __int8 v20;
int CanCombinableCharactersCombine;
__int64 v22;
__int64 v23;
__int64 v24;
char v25;
bool v26;
unsigned int StartBasePair;
unsigned int v28;
unsigned int StartBase;
unsigned int v30;
__int16 *v31;
INT64 v32;
INT64 v33;
__int64 v34;
__int64 v35;
__int64 v36;
unsigned int v38;
char v39;
CHAR v40;
CHAR v41;
CHAR v42;
unsigned int v43;
char v44;
CHAR v45;
__int64 v46;
__int64 v47;
unsigned __int64 v48;
CHAR v49;
unsigned __int16 *v50;
INT64 v51;
signed int v52;
unsigned __int16 v53;
INT64 v54;
unsigned __int16 v55;
unsigned int LastChar;
unsigned int v57;
NTSTATUS v58;
unsigned int v59;
unsigned __int16 *v60;
INT64 v61;
unsigned int v62;
__int64 v63;
unsigned __int16 *v64;
__int64 v65;
v5 = a3;
v6 = a2;
if( !a3 )
goto LABEL_26;
while( 1 )
{
while( 1 )
{
switch( v5 )
{
case 0u:
goto LABEL_125;
case 0xFBu:
if( !*(_BYTE *)(a1 + 113) )
return 3221227287i64;
LABEL_125:
v49 = NormBuffer__Append(a4, v6);
goto LABEL_96;
case 0xFCu:
return 3221227287i64;
case 0xFDu:
return Normalization__AppendDecomposedChar(a1, v6, a4);
}
if( v5 != 254 )
break;
v14 = *(unsigned __int16 **)(a4 + 16);
if( v14 == *(unsigned __int16 **)(a4 + 8) )
return 3221227287i64;
v15 = *v14;
*(_QWORD *)(a4 + 16) = v14 + 1;
if( (unsigned __int16)(v15 + 9216) > 0x3FFu )
return 3221227287i64;
v6 = v15 + ((v6 - 55287) << 10);
v5 = *(_BYTE *)(((__int64)(int)v6 >> 7) + *(_QWORD *)(a1 + 32));
LABEL_30:
if( !v5 )
goto LABEL_26;
}
if( v5 != 255 )
break;
if( (int)v6 < 44032 )
{
if( v6 - 4352 <= 0x12 )
{
v60 = *(unsigned __int16 **)(a4 + 16);
if( v60 != *(unsigned __int16 **)(a4 + 8) )
{
v61 = *v60;
*(_QWORD *)(a4 + 16) = v60 + 1;
v62 = ComposeHangulLV(v6, v61);
if( !v62 )
{
*(_QWORD *)(a4 + 16) = v63;
goto LABEL_26;
}
v6 = v62;
if( v50 != v64 )
{
*(_QWORD *)(a4 + 16) = v50 + 1;
v51 = v62;
goto LABEL_119;
}
}
LABEL_26:
v13 = NormBuffer__Append(a4, v6);
LABEL_92:
if( !v13 )
return 3221225507i64;
return 0i64;
}
if( v6 - 4449 <= 0x14 )
{
if( (unsigned int)NormBuffer__GetLastChar(a4) - 4352 > 0x12 )
goto LABEL_26;
NormBuffer__RewindOutputCharacter(a4);
v58 = ComposeHangulLV(v59, v6);
goto LABEL_114;
}
if( v6 - 4520 <= 0x1A )
{
LastChar = NormBuffer__GetLastChar(a4);
if( IsHangulLV(LastChar) )
{
NormBuffer__RewindOutputCharacter(a4);
v58 = ComposeHangulLVT(v57, v6);
goto LABEL_114;
}
goto LABEL_26;
}
if( ((*(_DWORD *)a1 - 13) & 0xFFFFFEFF) != 0 || v6 - 4447 > 1 )
goto LABEL_26;
}
else
{
if( (int)v6 < 55204 )
{
if( *(_BYTE *)(a1 + 112) != 1 )
{
if( !IsHangulLV(v6) )
goto LABEL_26;
v50 = *(unsigned __int16 **)(a4 + 16);
if( v50 == *(unsigned __int16 **)(a4 + 8) )
goto LABEL_26;
v51 = v6;
*(_QWORD *)(a4 + 16) = v50 + 1;
LABEL_119:
v58 = ComposeHangulLVT(v51, *v50);
if( !v58 )
{
*(_QWORD *)(a4 + 16) = v65;
goto LABEL_26;
}
LABEL_114:
v6 = v58;
goto LABEL_26;
}
v52 = v6 - 44032;
if( !NormBuffer__AppendEx(a4, (unsigned __int16)((int)(v6 - 44032) / 588 + 4352), 0, 0) )
return 3221225507i64;
v53 = (int)(v6 - 44032) % 588 / 28 + 4449;
if( !NormBuffer__AppendEx(a4, v53, 0, 0) )
return 3221225507i64;
v55 = (unsigned __int16)(v52 % 28) != 0 ? v52 % 28 + 4519 : 0;
if( v55 )
{
if( !NormBuffer__AppendEx(v54, v55, 0, 0) )
return 3221225507i64;
v53 = v55;
}
*(_QWORD *)(a4 + 80) = *(_QWORD *)(a4 + 40);
*(_DWORD *)(a4 + 88) = v53;
goto LABEL_98;
}
if( v6 - 55216 <= 0x16 || v6 - 55243 <= 0x30 )
goto LABEL_26;
}
v5 = -5;
}
v8 = *(unsigned __int8 *)((v6 & 0x7F) + ((unsigned __int64)v5 << 7) + *(_QWORD *)(a1 + 40) - 128);
if( !(_BYTE)v8 )
goto LABEL_95;
v9 = v8 & 0xC0;
v10 = v8 & 0x3F;
if( (v8 & 0x3F) != 0 && v10 != 63 )
{
if( (v8 & 0x80) == 0 )
{
if( !NormBuffer__AppendEx(a4, v6, v8 & 0x3F, v8 & 0xC0) )
return 3221225507i64;
*(_QWORD *)(a4 + 80) = *(_QWORD *)(a4 + 40);
*(_DWORD *)(a4 + 88) = v6;
*(_BYTE *)(a4 + 92) = v10;
*(_BYTE *)(a4 + 93) = v9;
return 0i64;
}
NormBuffer__GetLastChar(a4);
v17 = *(_BYTE *)(a4 + 72);
if( !v17 || v17 == 63 || (v18 = *(_BYTE *)(a4 + 73), (v18 & v16) == 0) )
{
v18 = *(_BYTE *)(a4 + 73);
*(_QWORD *)(a4 + 80) = *(_QWORD *)(a4 + 64) + 2i64;
*(_DWORD *)(a4 + 88) = *(_DWORD *)(a4 + 56);
*(_BYTE *)(a4 + 92) = v17;
*(_BYTE *)(a4 + 93) = v18;
*(_QWORD *)(a4 + 96) = 0i64;
}
if( v9 == (CHAR)0x80 || ((unsigned __int8)((*(_BYTE *)(a4 + 92) | *(_BYTE *)(a4 + 93)) + 64) & v16) == 0 )
{
NormBuffer__IsBlocked(a4);
goto LABEL_61;
}
if( !v17 || v17 == 63 )
{
if( (unsigned int)Normalization__CanCombinableCharactersCombine(a1, *(unsigned int *)(a4 + 88), v6) )
{
NormBuffer__RewindOutputCharacter(a4);
v6 = v46;
v47 = *(_QWORD *)(a1 + 40);
v48 = (v46 & 0x7F) + ((unsigned __int64)*(unsigned __int8 *)((v46 >> 7) + *(_QWORD *)(a1 + 32)) << 7);
v9 = *(_BYTE *)(v48 + v47 - 128) & 0xC0;
v10 = *(_BYTE *)(v48 + v47 - 128) & 0x3F;
}
LABEL_90:
v32 = a4;
v33 = v6;
LABEL_91:
v13 = NormBuffer__AppendEx(v32, v33, v10, v9);
goto LABEL_92;
}
if( v18 )
{
if( v18 != 64 )
{
NormBuffer__IsBlocked(a4);
if( v19 )
goto LABEL_61;
v20 = *(_BYTE *)(a4 + 92);
if( !v20 || v20 == 63 || *(_BYTE *)(a4 + 93) == 64 )
{
CanCombinableCharactersCombine = Normalization__CanCombinableCharactersCombine(
a1,
*(unsigned int *)(a4 + 88),
v6);
v22 = CanCombinableCharactersCombine;
if( CanCombinableCharactersCombine )
{
v23 = *(_QWORD *)(a1 + 32);
v24 = *(_QWORD *)(a4 + 80);
*(_DWORD *)(a4 + 88) = v22;
v25 = *(_BYTE *)((v22 & 0x7F)
+ ((unsigned __int64)*(unsigned __int8 *)((v22 >> 7) + v23) << 7)
+ *(_QWORD *)(a1 + 40)
- 128);
*(_WORD *)(v24 - 2) = v22;
*(_BYTE *)(a4 + 93) = v25 & 0xC0;
v26 = (v25 & 0xC0) == 64;
*(_BYTE *)(a4 + 92) = v25 & 0x3F;
LABEL_80:
if( v26 )
NormBuffer__RecheckStartCombinations(a4);
return 0i64;
}
if( !v20 || v20 == 63 )
goto LABEL_61;
}
if( v20 <= v10 )
goto LABEL_61;
if( v20 == *(_BYTE *)(a1 + 116) )
{
if( v10 >= *(_BYTE *)(a1 + 114) )
{
if( v10 == *(_BYTE *)(a1 + 115) )
goto LABEL_58;
LABEL_61:
v31 = *(__int16 **)(a4 + 104);
v32 = a4;
v33 = v6;
if( v31 != *(__int16 **)(a4 + 40) )
{
v13 = NormBuffer__Insert((_QWORD *)a4, v6, v31);
goto LABEL_92;
}
goto LABEL_91;
}
}
else if( v20 == *(_BYTE *)(a1 + 118) && v10 == *(_BYTE *)(a1 + 117) )
{
LABEL_58:
StartBasePair = NormBuffer__LastStartBasePair(a4);
v28 = Normalization__CanCombinableCharactersCombine(a1, StartBasePair, v6);
if( v28 )
{
LABEL_75:
v39 = *(_BYTE *)((v28 & 0x7F)
+ ((unsigned __int64)*(unsigned __int8 *)(((__int64)(int)v28 >> 7) + *(_QWORD *)(a1 + 32)) << 7)
+ *(_QWORD *)(a1 + 40)
- 128);
v40 = v39 & 0x3F;
v41 = v39 & 0xC0;
v42 = NormBuffer__ReplaceLastStartBasePair(a4, v28, v40, v41);
LABEL_78:
if( !v42 )
return 3221225507i64;
v26 = v41 == 64;
goto LABEL_80;
}
goto LABEL_61;
}
StartBase = NormBuffer__LastStartBase(a4);
v30 = Normalization__CanCombinableCharactersCombine(a1, StartBase, v6);
if( !v30 )
goto LABEL_61;
LABEL_77:
v44 = *(_BYTE *)((v30 & 0x7F)
+ ((unsigned __int64)*(unsigned __int8 *)(((__int64)(int)v30 >> 7) + *(_QWORD *)(a1 + 32)) << 7)
+ *(_QWORD *)(a1 + 40)
- 128);
v45 = v44 & 0x3F;
v41 = v44 & 0xC0;
v42 = NormBuffer__ReplaceLastStartBase(a4, v30, v45, v41);
goto LABEL_78;
}
if( (unsigned int)Normalization__CanCombinableCharactersCombine(a1, *(unsigned int *)(a4 + 88), v6) )
{
NormBuffer__RewindOutputCharacter(a4);
v35 = *(unsigned __int8 *)((v34 & 0x7F)
+ ((unsigned __int64)*(unsigned __int8 *)((v34 >> 7) + *(_QWORD *)(a1 + 32)) << 7)
+ *(_QWORD *)(a1 + 40)
- 128);
if( !NormBuffer__AppendEx(a4, (unsigned int)v34, v35 & 0x3F, v35 & 0xC0) )
return 3221225507i64;
v36 = *(_QWORD *)(a4 + 64);
*(_QWORD *)(a4 + 96) = 0i64;
*(_QWORD *)(a4 + 80) = v36 + 2;
*(_DWORD *)(a4 + 88) = *(_DWORD *)(a4 + 56);
*(_BYTE *)(a4 + 92) = *(_BYTE *)(a4 + 72);
*(_BYTE *)(a4 + 93) = *(_BYTE *)(a4 + 73);
return 0i64;
}
}
if( v17 <= v10 )
goto LABEL_90;
if( v17 == *(_BYTE *)(a1 + 116) )
{
if( v10 >= *(_BYTE *)(a1 + 114) )
{
if( v10 != *(_BYTE *)(a1 + 115) )
goto LABEL_90;
LABEL_74:
v38 = NormBuffer__LastStartBasePair(a4);
v28 = Normalization__CanCombinableCharactersCombine(a1, v38, v6);
if( !v28 )
goto LABEL_90;
goto LABEL_75;
}
}
else if( v17 == *(_BYTE *)(a1 + 118) && v10 == *(_BYTE *)(a1 + 117) )
{
goto LABEL_74;
}
v43 = NormBuffer__LastStartBase(a4);
v30 = Normalization__CanCombinableCharactersCombine(a1, v43, v6);
if( !v30 )
goto LABEL_90;
goto LABEL_77;
}
switch( v8 )
{
case 127:
if( !*(_BYTE *)(a1 + 113) )
return 3221227287i64;
LABEL_95:
v49 = NormBuffer__AppendEx(a4, v6, 0, 0);
LABEL_96:
if( !v49 )
return 3221225507i64;
*(_QWORD *)(a4 + 80) = *(_QWORD *)(a4 + 40);
*(_DWORD *)(a4 + 88) = v6;
LABEL_98:
*(_WORD *)(a4 + 92) = 0;
return 0i64;
case 191:
return Normalization__AppendDecomposedChar(a1, v6, a4);
case 192:
v11 = NormBuffer__GetLastChar(a4);
if( !(unsigned int)Normalization__CanCombinableCharactersCombine(a1, v11, v6) )
goto LABEL_90;
NormBuffer__RewindOutputCharacter(a4);
v6 = v12;
goto LABEL_30;
}
if( v8 != 255 || !v6 && *(_QWORD *)(a4 + 16) == *(_QWORD *)(a4 + 8) )
goto LABEL_90;
return 3221227287i64;
}Referenced by:
Normalization__AppendDecomposedChar
Normalization__Normalize