// File: Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImFontAtlasBuildRenderLinesTexData(ImFontAtlas*)
static void ImFontAtlasBuildRenderLinesTexData(ImFontAtlas* atlas)
{
    if (atlas->Flags & ImFontAtlasFlags_NoBakedLines)
        return;

    // This generates a triangular shape in the texture, with the various line widths stacked on top of each other to allow interpolation between them
    ImFontAtlasCustomRect* r = atlas->GetCustomRectByIndex(atlas->PackIdLines);
    IM_ASSERT(r->IsPacked());
    for (unsigned int n = 0; n < IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1; n++) // +1 because of the zero-width row
    {
        // Each line consists of at least two empty pixels at the ends, with a line of solid pixels in the middle
        unsigned int y = n;
        unsigned int line_width = n;
        unsigned int pad_left = (r->Width - line_width) / 2;
        unsigned int pad_right = r->Width - (pad_left + line_width);

        // Write each slice
        IM_ASSERT(pad_left + line_width + pad_right == r->Width && y < r->Height); // Make sure we're inside the texture bounds before we start writing pixels
        unsigned char* write_ptr = &atlas->TexPixelsAlpha8[r->X + ((r->Y + y) * atlas->TexWidth)];
        memset(write_ptr, 0x00, pad_left);
        memset(write_ptr + pad_left, 0xFF, line_width);
        memset(write_ptr + pad_left + line_width, 0x00, pad_right);

        // Calculate UVs for this line
        ImVec2 uv0 = ImVec2((float)(r->X + pad_left - 1), (float)(r->Y + y)) * atlas->TexUvScale;
        ImVec2 uv1 = ImVec2((float)(r->X + pad_left + line_width + 1), (float)(r->Y + y + 1)) * atlas->TexUvScale;
        float half_v = (uv0.y + uv1.y) * 0.5f; // Calculate a constant V in the middle of the row to avoid sampling artifacts
        atlas->TexUvLines[n] = ImVec4(uv0.x, half_v, uv1.x, half_v);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x11b373
jmp 0x11b5c3
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x474(%rax), %esi
callq 0x127c00
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x127be0
testb $0x1, %al
jne 0x11b399
jmp 0x11b39b
jmp 0x11b3ba
leaq 0x7047a(%rip), %rdi     # 0x18b81c
leaq 0x6edcd(%rip), %rsi     # 0x18a176
movl $0x9ae, %edx            # imm = 0x9AE
leaq 0x7052e(%rip), %rcx     # 0x18b8e3
callq 0xd180
movl $0x0, -0x14(%rbp)
cmpl $0x40, -0x14(%rbp)
jae 0x11b5c3
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movzwl (%rax), %eax
subl -0x1c(%rbp), %eax
shrl %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movzwl (%rax), %eax
movl -0x20(%rbp), %ecx
addl -0x1c(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %ecx
addl -0x1c(%rbp), %ecx
addl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movzwl (%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x65(%rbp)
jne 0x11b424
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x2(%rcx), %ecx
cmpl %ecx, %eax
setb %al
movb %al, -0x65(%rbp)
movb -0x65(%rbp), %al
testb $0x1, %al
jne 0x11b42d
jmp 0x11b42f
jmp 0x11b44e
leaq 0x704e4(%rip), %rdi     # 0x18b91a
leaq 0x6ed39(%rip), %rsi     # 0x18a176
movl $0x9b8, %edx            # imm = 0x9B8
leaq 0x7049a(%rip), %rcx     # 0x18b8e3
callq 0xd180
movq -0x8(%rbp), %rsi
movq 0x18(%rsi), %rax
movq -0x10(%rbp), %rdx
movzwl 0x4(%rdx), %ecx
movzwl 0x6(%rdx), %edx
movl -0x18(%rbp), %edi
addl %edi, %edx
movl 0x28(%rsi), %esi
imull %esi, %edx
addl %edx, %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movl -0x20(%rbp), %eax
movl %eax, %edx
xorl %esi, %esi
movl %esi, -0x7c(%rbp)
callq 0xd2f0
movq -0x30(%rbp), %rdi
movl -0x20(%rbp), %eax
addq %rax, %rdi
movl -0x1c(%rbp), %eax
movl %eax, %edx
movl $0xff, %esi
callq 0xd2f0
movl -0x7c(%rbp), %esi
movq -0x30(%rbp), %rdi
movl -0x20(%rbp), %eax
addq %rax, %rdi
movl -0x1c(%rbp), %eax
addq %rax, %rdi
movl -0x24(%rbp), %eax
movl %eax, %edx
callq 0xd2f0
movq -0x10(%rbp), %rax
movzwl 0x4(%rax), %esi
movl -0x20(%rbp), %ecx
movl %ecx, %edx
movl %esi, %ecx
leal -0x1(%rcx,%rdx), %ecx
cvtsi2ss %rcx, %xmm0
movzwl 0x6(%rax), %eax
movl -0x18(%rbp), %ecx
addl %ecx, %eax
cvtsi2ss %rax, %xmm1
leaq -0x40(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0xbf4c0
movq -0x78(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x30, %rsi
callq 0x1175f0
movlpd %xmm0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x4(%rax), %esi
movl -0x20(%rbp), %ecx
addl %ecx, %esi
movl -0x1c(%rbp), %edx
movl %edx, %ecx
movl %esi, %edx
leal 0x1(%rcx,%rdx), %ecx
cvtsi2ss %rcx, %xmm0
movzwl 0x6(%rax), %edx
movl -0x18(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %eax
cvtsi2ss %rax, %xmm1
leaq -0x50(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0xbf4c0
movq -0x70(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x30, %rsi
callq 0x1175f0
movlpd %xmm0, -0x48(%rbp)
movss -0x34(%rbp), %xmm0
addss -0x44(%rbp), %xmm0
movss 0x56a6a(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x38(%rbp), %xmm0
movss -0x54(%rbp), %xmm1
movss -0x48(%rbp), %xmm2
movss -0x54(%rbp), %xmm3
leaq -0x64(%rbp), %rdi
callq 0xbf4f0
movq -0x8(%rbp), %rax
addq $0x70, %rax
movl -0x14(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x64(%rbp), %rcx
movq %rcx, (%rax)
movq -0x5c(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x11b3c1
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)