// File: /workspace/github_c_makefile_star2_O0/arkanis[P]process-map/./deps/raygui.h
// Function: GuiLoadStyle
void GuiLoadStyle(const char *fileName)
{
    bool tryBinary = false;

    // Try reading the files as text file first
    FILE *rgsFile = fopen(fileName, "rt");

    if (rgsFile != NULL)
    {
        char buffer[256] = { 0 };
        fgets(buffer, 256, rgsFile);

        if (buffer[0] == '#')
        {
            int controlId = 0;
            int propertyId = 0;
            unsigned int propertyValue = 0;

            while (!feof(rgsFile))
            {
                switch (buffer[0])
                {
                    case 'p':
                    {
                        // Style property: p <control_id> <property_id> <property_value> <property_name>

                        sscanf(buffer, "p %d %d 0x%x", &controlId, &propertyId, &propertyValue);

                        GuiSetStyle(controlId, propertyId, (int)propertyValue);

                    } break;
                    case 'f':
                    {
                        // Style font: f <gen_font_size> <charmap_file> <font_file>

                        int fontSize = 0;
                        char charmapFileName[256] = { 0 };
                        char fontFileName[256] = { 0 };
                        sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName);

                        Font font = { 0 };

                        if (charmapFileName[0] != '0')
                        {
                            // Load characters from charmap file,
                            // expected '\n' separated list of integer values
                            char *charValues = LoadFileText(charmapFileName);
                            if (charValues != NULL)
                            {
                                int charsCount = 0;
                                const char **chars = TextSplit(charValues, '\n', &charsCount);

                                int *values = (int *)RAYGUI_MALLOC(charsCount*sizeof(int));
                                for (int i = 0; i < charsCount; i++) values[i] = TextToInteger(chars[i]);

                                font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, values, charsCount);

                                RAYGUI_FREE(values);
                            }
                        }
                        else font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0);

                        if ((font.texture.id > 0) && (font.charsCount > 0)) GuiSetFont(font);

                    } break;
                    default: break;
                }

                fgets(buffer, 256, rgsFile);
            }
        }
        else tryBinary = true;

        fclose(rgsFile);
    }

    if (tryBinary)
    {
        rgsFile = fopen(fileName, "rb");

        if (rgsFile == NULL) return;

        char signature[5] = "";
        short version = 0;
        short reserved = 0;
        int propertiesCount = 0;

        fread(signature, 1, 4, rgsFile);
        fread(&version, 1, sizeof(short), rgsFile);
        fread(&reserved, 1, sizeof(short), rgsFile);
        fread(&propertiesCount, 1, sizeof(int), rgsFile);

        if ((signature[0] == 'r') &&
            (signature[1] == 'G') &&
            (signature[2] == 'S') &&
            (signature[3] == ' '))
        {
            short controlId = 0;
            short propertyId = 0;
            int propertyValue = 0;

            for (int i = 0; i < propertiesCount; i++)
            {
                fread(&controlId, 1, sizeof(short), rgsFile);
                fread(&propertyId, 1, sizeof(short), rgsFile);
                fread(&propertyValue, 1, sizeof(int), rgsFile);

                if (controlId == 0) // DEFAULT control
                {
                    // If a DEFAULT property is loaded, it is propagated to all controls
                    // NOTE: All DEFAULT properties should be defined first in the file
                    GuiSetStyle(0, (int)propertyId, propertyValue);

                    if (propertyId < NUM_PROPS_DEFAULT) for (int i = 1; i < NUM_CONTROLS; i++) GuiSetStyle(i, (int)propertyId, propertyValue);
                }
                else GuiSetStyle((int)controlId, (int)propertyId, propertyValue);
            }

            // Font loading is highly dependant on raylib API to load font data and image
            // TODO: Find some mechanism to support it in standalone mode
#if !defined(RAYGUI_STANDALONE)
            // Load custom font if available
            int fontDataSize = 0;
            fread(&fontDataSize, 1, sizeof(int), rgsFile);

            if (fontDataSize > 0)
            {
                Font font = { 0 };
                int fontType = 0;   // 0-Normal, 1-SDF
                Rectangle whiteRec = { 0 };

                fread(&font.baseSize, 1, sizeof(int), rgsFile);
                fread(&font.charsCount, 1, sizeof(int), rgsFile);
                fread(&fontType, 1, sizeof(int), rgsFile);

                // Load font white rectangle
                fread(&whiteRec, 1, sizeof(Rectangle), rgsFile);

                // Load font image parameters
                int fontImageSize = 0;
                fread(&fontImageSize, 1, sizeof(int), rgsFile);

                if (fontImageSize > 0)
                {
                    Image imFont = { 0 };
                    imFont.mipmaps = 1;
                    fread(&imFont.width, 1, sizeof(int), rgsFile);
                    fread(&imFont.height, 1, sizeof(int), rgsFile);
                    fread(&imFont.format, 1, sizeof(int), rgsFile);

                    imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageSize);
                    fread(imFont.data, 1, fontImageSize, rgsFile);

                    font.texture = LoadTextureFromImage(imFont);

                    UnloadImage(imFont);
                }

                // Load font recs data
                font.recs = (Rectangle *)RAYGUI_CALLOC(font.charsCount, sizeof(Rectangle));
                for (int i = 0; i < font.charsCount; i++) fread(&font.recs[i], 1, sizeof(Rectangle), rgsFile);

                // Load font chars info data
                font.chars = (CharInfo *)RAYGUI_CALLOC(font.charsCount, sizeof(CharInfo));
                for (int i = 0; i < font.charsCount; i++)
                {
                    fread(&font.chars[i].value, 1, sizeof(int), rgsFile);
                    fread(&font.chars[i].offsetX, 1, sizeof(int), rgsFile);
                    fread(&font.chars[i].offsetY, 1, sizeof(int), rgsFile);
                    fread(&font.chars[i].advanceX, 1, sizeof(int), rgsFile);
                }

                GuiSetFont(font);

                // Set font texture source rectangle to be used as white texture to draw shapes
                // NOTE: This way, all gui can be draw using a single draw call
                if ((whiteRec.width != 0) && (whiteRec.height != 0)) SetShapesTexture(font.texture, whiteRec);
            }
#endif
        }

        fclose(rgsFile);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4e0, %rsp            # imm = 0x4E0
movq %rdi, -0x8(%rbp)
movb $0x0, -0x9(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xa4f70(%rip), %rsi     # 0xb703e
callq 0x61e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x12414
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x6060
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x6250
movsbl -0x120(%rbp), %eax
cmpl $0x23, %eax
jne 0x12407
movl $0x0, -0x124(%rbp)
movl $0x0, -0x128(%rbp)
movl $0x0, -0x12c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x65d0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x12152
jmp 0x12405
movsbl -0x120(%rbp), %eax
movl %eax, -0x4a4(%rbp)
subl $0x66, %eax
je 0x121bd
jmp 0x12166
movl -0x4a4(%rbp), %eax
subl $0x70, %eax
jne 0x123e9
jmp 0x12177
leaq -0x120(%rbp), %rdi
leaq 0x79fc5(%rip), %rsi     # 0x8c14a
leaq -0x124(%rbp), %rdx
leaq -0x128(%rbp), %rcx
leaq -0x12c(%rbp), %r8
movb $0x0, %al
callq 0x6140
movl -0x124(%rbp), %edi
movl -0x128(%rbp), %esi
movl -0x12c(%rbp), %edx
callq 0x6ee0
jmp 0x123eb
movl $0x0, -0x130(%rbp)
leaq -0x230(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x6060
leaq -0x330(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x6060
leaq -0x120(%rbp), %rdi
leaq -0x230(%rbp), %rcx
leaq -0x330(%rbp), %r8
leaq 0x79f4e(%rip), %rsi     # 0x8c157
leaq -0x130(%rbp), %rdx
movb $0x0, %al
callq 0x6140
leaq -0x360(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x6060
movsbl -0x230(%rbp), %eax
cmpl $0x30, %eax
je 0x12358
leaq -0x230(%rbp), %rdi
callq 0x71800
movq %rax, -0x368(%rbp)
cmpq $0x0, -0x368(%rbp)
je 0x12356
movl $0x0, -0x36c(%rbp)
movq -0x368(%rbp), %rdi
movl $0xa, %esi
leaq -0x36c(%rbp), %rdx
callq 0x66bb0
movq %rax, -0x378(%rbp)
movslq -0x36c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x61d0
movq %rax, -0x380(%rbp)
movl $0x0, -0x384(%rbp)
movl -0x384(%rbp), %eax
cmpl -0x36c(%rbp), %eax
jge 0x122ee
movq -0x378(%rbp), %rax
movslq -0x384(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x66650
movl %eax, %edx
movq -0x380(%rbp), %rax
movslq -0x384(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x384(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x384(%rbp)
jmp 0x122a5
movq -0x8(%rbp), %rdi
callq 0x33be0
movq %rax, %rsi
leaq -0x330(%rbp), %rdx
leaq 0x79e5f(%rip), %rdi     # 0x8c167
movb $0x0, %al
callq 0x65400
movq %rax, %rsi
movl -0x130(%rbp), %edx
movq -0x380(%rbp), %rcx
movl -0x36c(%rbp), %r8d
leaq -0x3b8(%rbp), %rdi
callq 0x62b10
leaq -0x360(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
movl $0x30, %edx
callq 0x6790
movq -0x380(%rbp), %rdi
callq 0x62e0
jmp 0x123ad
movq -0x8(%rbp), %rdi
callq 0x33be0
movq %rax, %rsi
leaq -0x330(%rbp), %rdx
leaq 0x79df5(%rip), %rdi     # 0x8c167
movb $0x0, %al
callq 0x65400
movq %rax, %rsi
movl -0x130(%rbp), %edx
leaq -0x3e8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x62b10
leaq -0x360(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
movl $0x30, %edx
callq 0x6790
cmpl $0x0, -0x354(%rbp)
jbe 0x123e7
cmpl $0x0, -0x35c(%rbp)
jle 0x123e7
movups -0x360(%rbp), %xmm0
movups -0x350(%rbp), %xmm1
movups -0x340(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x69c0
jmp 0x123eb
jmp 0x123eb
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x6250
jmp 0x12138
jmp 0x1240b
movb $0x1, -0x9(%rbp)
movq -0x18(%rbp), %rdi
callq 0x65f0
testb $0x1, -0x9(%rbp)
je 0x12a52
movq -0x8(%rbp), %rdi
leaq 0x79d44(%rip), %rsi     # 0x8c16d
callq 0x61e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1243e
jmp 0x12a52
leaq -0x3ed(%rbp), %rdi
xorl %esi, %esi
movl $0x5, %edx
callq 0x6060
movw $0x0, -0x3f0(%rbp)
movw $0x0, -0x3f2(%rbp)
movl $0x0, -0x3f8(%rbp)
leaq -0x3ed(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movq -0x18(%rbp), %rcx
leaq -0x3f0(%rbp), %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0x6470
movq -0x18(%rbp), %rcx
leaq -0x3f2(%rbp), %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0x6470
movq -0x18(%rbp), %rcx
leaq -0x3f8(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movsbl -0x3ed(%rbp), %eax
cmpl $0x72, %eax
jne 0x12a49
movsbl -0x3ec(%rbp), %eax
cmpl $0x47, %eax
jne 0x12a49
movsbl -0x3eb(%rbp), %eax
cmpl $0x53, %eax
jne 0x12a49
movsbl -0x3ea(%rbp), %eax
cmpl $0x20, %eax
jne 0x12a49
movw $0x0, -0x3fa(%rbp)
movw $0x0, -0x3fc(%rbp)
movl $0x0, -0x400(%rbp)
movl $0x0, -0x404(%rbp)
movl -0x404(%rbp), %eax
cmpl -0x3f8(%rbp), %eax
jge 0x12636
movq -0x18(%rbp), %rcx
leaq -0x3fa(%rbp), %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0x6470
movq -0x18(%rbp), %rcx
leaq -0x3fc(%rbp), %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0x6470
movq -0x18(%rbp), %rcx
leaq -0x400(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movswl -0x3fa(%rbp), %eax
cmpl $0x0, %eax
jne 0x12607
movswl -0x3fc(%rbp), %esi
movl -0x400(%rbp), %edx
xorl %edi, %edi
callq 0x6ee0
movswl -0x3fc(%rbp), %eax
cmpl $0x10, %eax
jge 0x12605
movl $0x1, -0x408(%rbp)
cmpl $0x10, -0x408(%rbp)
jge 0x12603
movl -0x408(%rbp), %edi
movswl -0x3fc(%rbp), %esi
movl -0x400(%rbp), %edx
callq 0x6ee0
movl -0x408(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x408(%rbp)
jmp 0x125d1
jmp 0x12605
jmp 0x12620
movswl -0x3fa(%rbp), %edi
movswl -0x3fc(%rbp), %esi
movl -0x400(%rbp), %edx
callq 0x6ee0
jmp 0x12622
movl -0x404(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x404(%rbp)
jmp 0x1253b
movl $0x0, -0x40c(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x40c(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
cmpl $0x0, -0x40c(%rbp)
jle 0x12a47
leaq -0x440(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x6060
movl $0x0, -0x444(%rbp)
leaq -0x454(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x6060
leaq -0x440(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
leaq -0x440(%rbp), %rdi
addq $0x4, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movq -0x18(%rbp), %rcx
leaq -0x444(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movq -0x18(%rbp), %rcx
leaq -0x454(%rbp), %rdi
movl $0x1, %esi
movl $0x10, %edx
callq 0x6470
movl $0x0, -0x458(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x458(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
cmpl $0x0, -0x458(%rbp)
jle 0x12853
leaq -0x470(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x6060
movl $0x1, -0x460(%rbp)
leaq -0x470(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
leaq -0x470(%rbp), %rdi
addq $0xc, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
leaq -0x470(%rbp), %rdi
addq $0x14, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movslq -0x458(%rbp), %rdi
callq 0x61d0
movq %rax, -0x470(%rbp)
movq -0x470(%rbp), %rdi
movslq -0x458(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0x6470
leaq -0x484(%rbp), %rdi
leaq -0x470(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x4f700
movq -0x484(%rbp), %rax
movq %rax, -0x434(%rbp)
movq -0x47c(%rbp), %rax
movq %rax, -0x42c(%rbp)
movl -0x474(%rbp), %eax
movl %eax, -0x424(%rbp)
leaq -0x470(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x46670
movslq -0x43c(%rbp), %rdi
movl $0x10, %esi
callq 0x65b0
movq %rax, -0x420(%rbp)
movl $0x0, -0x488(%rbp)
movl -0x488(%rbp), %eax
cmpl -0x43c(%rbp), %eax
jge 0x128bc
movq -0x420(%rbp), %rdi
movslq -0x488(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x10, %edx
callq 0x6470
movl -0x488(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x488(%rbp)
jmp 0x12875
movslq -0x43c(%rbp), %rdi
movl $0x28, %esi
callq 0x65b0
movq %rax, -0x418(%rbp)
movl $0x0, -0x48c(%rbp)
movl -0x48c(%rbp), %eax
cmpl -0x43c(%rbp), %eax
jge 0x129b0
movq -0x418(%rbp), %rdi
movslq -0x48c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movq -0x418(%rbp), %rdi
movslq -0x48c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movq -0x418(%rbp), %rdi
movslq -0x48c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movq -0x418(%rbp), %rdi
movslq -0x48c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
addq $0xc, %rdi
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x4, %edx
callq 0x6470
movl -0x48c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48c(%rbp)
jmp 0x128de
movups -0x440(%rbp), %xmm0
movups -0x430(%rbp), %xmm1
movups -0x420(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x69c0
movss -0x44c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x129ec
jp 0x129ec
jmp 0x12a45
movss -0x448(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x12a00
jp 0x12a00
jmp 0x12a45
movl -0x424(%rbp), %eax
movl %eax, -0x490(%rbp)
movups -0x434(%rbp), %xmm0
movaps %xmm0, -0x4a0(%rbp)
movsd -0x454(%rbp), %xmm0
movsd -0x44c(%rbp), %xmm1
movl -0x490(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
movups -0x4a0(%rbp), %xmm2
movups %xmm2, (%rax)
callq 0x28820
jmp 0x12a47
jmp 0x12a49
movq -0x18(%rbp), %rdi
callq 0x65f0
addq $0x4e0, %rsp            # imm = 0x4E0
popq %rbp
retq
nopl (%rax,%rax)