// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3a8, %rsp            # imm = 0x3A8
movq %rdi, %rbx
leaq 0x7f71b(%rip), %rsi     # 0x91782
callq 0x61d0
testq %rax, %rax
je 0x128a6
movq %rax, %r14
leaq 0xa0(%rsp), %r15
xorl %ebp, %ebp
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x6060
movq %r15, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdx
callq 0x6240
cmpb $0x23, (%r15)
jne 0x12372
movl %ebp, 0x34(%rsp)
movl %ebp, 0x24(%rsp)
movl %ebp, 0x38(%rsp)
movq %r14, %rdi
callq 0x6600
testl %eax, %eax
jne 0x1236a
leaq 0x80(%rsp), %r15
leaq 0x1a0(%rsp), %r12
leaq 0x2a0(%rsp), %r13
leaq 0xa0(%rsp), %rbp
movzbl 0xa0(%rsp), %eax
cmpl $0x66, %eax
je 0x12133
cmpl $0x70, %eax
jne 0x1234a
movq %rbp, %rdi
leaq 0x532ab(%rip), %rsi     # 0x653b2
leaq 0x34(%rsp), %rdx
leaq 0x24(%rsp), %rcx
leaq 0x38(%rsp), %r8
xorl %eax, %eax
callq 0x6140
movl 0x34(%rsp), %edi
movl 0x24(%rsp), %esi
movl 0x38(%rsp), %edx
callq 0x766c
jmp 0x1234a
movl $0x0, 0x30(%rsp)
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
xorl %esi, %esi
callq 0x6060
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x6060
movq %rbp, %rdi
leaq 0x5325c(%rip), %rsi     # 0x653bf
leaq 0x30(%rsp), %rdx
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x6140
cmpb $0x30, 0x1a0(%rsp)
jne 0x121cf
movq %rbx, %rdi
callq 0x2b3f6
leaq 0x53241(%rip), %rdi     # 0x653cf
movq %rax, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x4dfb7
movl 0x30(%rsp), %edx
leaq 0x70(%rsp), %rdi
movq %rax, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x4a3ac
movdqa 0x70(%rsp), %xmm2
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
jmp 0x122b0
movq %r12, %rdi
callq 0x52611
testq %rax, %rax
je 0x1234a
movl $0x0, 0x28(%rsp)
movq %rax, %rdi
movl $0xa, %esi
leaq 0x28(%rsp), %rdx
callq 0x4f126
movq %rax, %r15
movslq 0x28(%rsp), %r12
leaq (,%r12,4), %rdi
callq 0x61c0
movq %rax, %r13
testq %r12, %r12
jle 0x12235
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
callq 0x4ecd4
movl %eax, (%r13,%r12,4)
incq %r12
movslq 0x28(%rsp), %rax
cmpq %rax, %r12
jl 0x1221a
movq %rbx, %rdi
callq 0x2b3f6
leaq 0x5318b(%rip), %rdi     # 0x653cf
movq %rax, %rsi
leaq 0x2a0(%rsp), %r12
movq %r12, %rdx
xorl %eax, %eax
callq 0x4dfb7
movl 0x30(%rsp), %edx
movl 0x28(%rsp), %r8d
leaq 0x70(%rsp), %rdi
movq %rax, %rsi
movq %r13, %rcx
callq 0x4a3ac
movaps 0x70(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
leaq 0x80(%rsp), %r15
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movq %r13, %rdi
movq %r12, %r13
callq 0x62e0
movdqa 0x40(%rsp), %xmm2
leaq 0x1a0(%rsp), %r12
pshufd $0xff, %xmm2, %xmm0     # xmm0 = xmm2[3,3,3,3]
movd %xmm0, %eax
testl %eax, %eax
je 0x1234a
pshufd $0x55, %xmm2, %xmm0     # xmm0 = xmm2[1,1,1,1]
movd %xmm0, %eax
testl %eax, %eax
jle 0x1234a
cmpb $0x1, 0x91f80(%rip)     # 0xa4255
jne 0x122fb
movdqa %xmm2, 0x91f81(%rip)    # 0xa4260
movdqa 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movdqa %xmm0, 0x91f7e(%rip)    # 0xa4270
movaps %xmm1, 0x91f87(%rip)    # 0xa4280
jmp 0x12342
movdqa %xmm2, 0x40(%rsp)
callq 0x6a3c
movdqa 0x40(%rsp), %xmm2
movdqa %xmm2, 0x91f4c(%rip)    # 0xa4260
movdqa 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movdqa %xmm0, 0x91f49(%rip)    # 0xa4270
movaps %xmm1, 0x91f52(%rip)    # 0xa4280
cmpb $0x0, 0x91f20(%rip)     # 0xa4255
jne 0x12342
callq 0x6a3c
movdqa 0x40(%rsp), %xmm2
movd %xmm2, 0x91f86(%rip)    # 0xa42d0
movq %rbp, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdx
callq 0x6240
movq %r14, %rdi
callq 0x6600
testl %eax, %eax
je 0x120e7
movq %r14, %rdi
jmp 0x128a1
movq %r14, %rdi
callq 0x6620
leaq 0x53054(%rip), %rsi     # 0x653d5
movq %rbx, %rdi
callq 0x61d0
testq %rax, %rax
je 0x128a6
movq %rax, %rbx
xorl %eax, %eax
leaq 0x70(%rsp), %r14
movl %eax, (%r14)
movb $0x0, 0x4(%r14)
leaq 0x3e(%rsp), %r12
movw %ax, (%r12)
leaq 0x3c(%rsp), %r13
movw %ax, (%r13)
leaq 0x34(%rsp), %r15
movl %eax, (%r15)
movl $0x1, %esi
movl $0x4, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x64a0
movl $0x1, %esi
movl $0x2, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x64a0
movl $0x1, %esi
movl $0x2, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x64a0
movl $0x1, %esi
movl $0x4, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x64a0
cmpl $0x20534772, (%r14)     # imm = 0x20534772
jne 0x1289e
xorl %r15d, %r15d
movw %r15w, 0x2e(%rsp)
movw %r15w, 0x22(%rsp)
movl $0x0, 0x24(%rsp)
movl 0x34(%rsp), %r12d
testl %r12d, %r12d
jle 0x124e7
movl $0x1, %esi
movl $0x2, %edx
leaq 0x2e(%rsp), %rdi
movq %rbx, %rcx
callq 0x64a0
movl $0x1, %esi
movl $0x2, %edx
leaq 0x22(%rsp), %rdi
movq %rbx, %rcx
callq 0x64a0
movl $0x1, %esi
movl $0x4, %edx
leaq 0x24(%rsp), %rdi
movq %rbx, %rcx
callq 0x64a0
movswl 0x2e(%rsp), %edi
testl %edi, %edi
je 0x124a4
movswl 0x22(%rsp), %esi
movl 0x24(%rsp), %edx
callq 0x766c
jmp 0x124db
movswl 0x22(%rsp), %ebp
movl 0x24(%rsp), %r13d
xorl %edi, %edi
movl %ebp, %esi
movl %r13d, %edx
callq 0x766c
cmpl $0xf, %ebp
jg 0x124db
movl $0x1, %r14d
movl %r14d, %edi
movl %ebp, %esi
movl %r13d, %edx
callq 0x766c
incl %r14d
cmpl $0x10, %r14d
jne 0x124c5
incl %r15d
cmpl %r12d, %r15d
jne 0x12446
leaq 0x38(%rsp), %r14
movl $0x0, (%r14)
movl $0x1, %esi
movl $0x4, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x64a0
cmpl $0x0, (%r14)
jle 0x1289e
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rdi
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %ebp, %ebp
leaq 0x30(%rsp), %r15
movl %ebp, (%r15)
leaq 0x2a0(%rsp), %r14
movaps %xmm0, (%r14)
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x64a0
leaq 0xa4(%rsp), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x64a0
movl $0x1, %esi
movl $0x4, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x64a0
movl $0x1, %esi
movl $0x10, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x64a0
leaq 0x28(%rsp), %r14
movl %ebp, (%r14)
movl $0x1, %esi
movl $0x4, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x64a0
movslq (%r14), %r14
testq %r14, %r14
jle 0x12679
leaq 0x1a8(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rdi)
movq $0x0, 0x8(%rdi)
movl $0x1, 0x8(%rdi)
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x64a0
leaq 0x1ac(%rsp), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x64a0
leaq 0x1b4(%rsp), %r15
movl $0x1, %esi
movl $0x4, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x64a0
movq %r14, %rdi
callq 0x61c0
movq %rax, -0x14(%r15)
movl $0x1, %esi
movq %rax, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x64a0
leaq 0xac(%rsp), %rdi
movq -0x4(%r15), %rax
movq %rax, 0x10(%rsp)
movaps -0x14(%r15), %xmm0
movups %xmm0, (%rsp)
callq 0x3f17c
movq -0x4(%r15), %rax
movq %rax, 0x10(%rsp)
movaps -0x14(%r15), %xmm0
movups %xmm0, (%rsp)
callq 0x39568
movslq 0xa4(%rsp), %r14
movl $0x10, %esi
movq %r14, %rdi
callq 0x65e0
movq %rax, 0xc0(%rsp)
testq %r14, %r14
jle 0x12742
movq %rax, %r15
movq %r14, %r12
movl $0x1, %esi
movl $0x10, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x64a0
addq $0x10, %r15
decq %r12
jne 0x126a5
movl $0x28, %esi
movq %r14, %rdi
callq 0x65e0
movq %rax, 0xc8(%rsp)
testl %r14d, %r14d
jle 0x12757
movq %rax, %r15
movl $0x1, %esi
movl $0x4, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x64a0
leaq 0x4(%r15), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x64a0
leaq 0x8(%r15), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x64a0
leaq 0xc(%r15), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x64a0
addq $0x28, %r15
decq %r14
jne 0x126e0
jmp 0x12757
movl $0x28, %esi
movq %r14, %rdi
callq 0x65e0
movq %rax, 0xc8(%rsp)
movl 0xa0(%rsp), %ebp
movq 0xa4(%rsp), %r15
movl 0xac(%rsp), %r14d
movaps 0xb0(%rsp), %xmm0
movaps %xmm0, 0x1a0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x1b8(%rsp)
testl %r14d, %r14d
je 0x1282e
cmpb $0x1, 0x91aa7(%rip)     # 0xa4255
jne 0x127e3
leaq 0xb0(%rsp), %rax
movl %ebp, 0x91aa2(%rip)     # 0xa4260
movq %r15, 0x91a9f(%rip)     # 0xa4264
movl %r14d, 0x91aa0(%rip)    # 0xa426c
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm0, 0x91a96(%rip)    # 0xa4270
movaps %xmm1, 0x91a9f(%rip)    # 0xa4280
jmp 0x12828
callq 0x6a3c
movl %ebp, 0x91a72(%rip)     # 0xa4260
movq %r15, 0x91a6f(%rip)     # 0xa4264
movl %r14d, 0x91a70(%rip)    # 0xa426c
movaps 0x1a0(%rsp), %xmm0
movaps 0x1b0(%rsp), %xmm1
movaps %xmm0, 0x91a5d(%rip)    # 0xa4270
movaps %xmm1, 0x91a66(%rip)    # 0xa4280
cmpb $0x0, 0x91a34(%rip)     # 0xa4255
jne 0x12828
callq 0x6a3c
movl %ebp, 0x91aa2(%rip)     # 0xa42d0
movss 0x2a8(%rsp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x12841
jnp 0x1289e
movss 0x2ac(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jne 0x12851
jnp 0x1289e
leaq 0xac(%rsp), %rax
movl 0x10(%rax), %ecx
movl %ecx, 0x1b0(%rsp)
movups (%rax), %xmm0
movaps %xmm0, 0x1a0(%rsp)
movsd 0x2a0(%rsp), %xmm0
movsd 0x2a8(%rsp), %xmm1
movl 0x1b0(%rsp), %eax
movl %eax, 0x10(%rsp)
movdqa 0x1a0(%rsp), %xmm2
movdqu %xmm2, (%rsp)
callq 0x223a1
movq %rbx, %rdi
callq 0x6620
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq