// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: OptionWindow::draw(int*)
void draw(int * glow){
        std::string total;
        total += "Title: ";
        total += window_title;
        XGCValues values;
        int screen = DefaultScreen(display);
        values.foreground = WhitePixel(display, screen);
        GC local = XCreateGC(display, window, GCForeground, &values);
        int width, height;
        get_window_dimensions(display, window, &width, &height);
        // XFillRectangle(display, option_window, local, 0, 0, width, height);
        XClearWindow(display, window);
        XFreeGC(display, local);

        int y = 10;
        int font_size = 10;
        int glyph_width = 1;

        GContext context = XGContextFromGC(graphics);
        XFontStruct * font = XQueryFont(display, context);
        if (font != NULL){
            glyph_width = font->max_bounds.width;
            font_size = font->max_bounds.ascent - font->max_bounds.descent;
            // std::cout << "Got font info" << std::endl;
            XFreeFontInfo(0, font, 1);
        }

        XDrawString(display, window, graphics, 1, y, total.c_str(), total.size());
        y += font_size * 3 / 2;
        char glow_info[32];
        snprintf(glow_info, sizeof(glow_info), "Glow: %d", *glow);
        XDrawString(display, window, graphics, 1, y, glow_info, strlen(glow_info));

        int line_x = (glyph_width + 1) * strlen("glow: 123");
        int line_y = y - font_size / 2;
        int glow_height = 12;

        if (glow_line_y == 0){
            glow_line_y = line_y;
            glow_line_x = line_x;
            glow_line_width = glow_max_speed * glow_line_step;
            glow_line_height = glow_height;
        }

        int glow_x = *glow * glow_line_step;

        // XDrawLine(display, window, graphics, line_x, line_y, glow_line_width, line_y);
        XDrawLine(display, window, graphics, line_x, line_y, line_x + glow_line_width, line_y);

        XFillRectangle(display, window, graphics, line_x + glow_x, line_y - glow_height / 2, 5, glow_height);

        draw_palette(display, window, palette_start_y);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %r12
movq %rdi, %rbx
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xc76(%rip), %rsi       # 0x6370
leaq -0x48(%rbp), %rdi
callq 0x35c0
movq 0x30(%rbx), %rsi
movq 0x38(%rbx), %rdx
leaq -0x48(%rbp), %rdi
callq 0x30f0
movq 0x20(%rbx), %rdi
movslq 0xe0(%rdi), %rax
movq 0xe8(%rdi), %rcx
shlq $0x7, %rax
movq 0x58(%rcx,%rax), %rax
leaq -0x170(%rbp), %rcx
movq %rax, 0x10(%rcx)
movq 0x8(%rbx), %rsi
movl $0x4, %edx
callq 0x3160
movq %rax, %r15
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdi
leaq -0xf0(%rbp), %rdx
callq 0x3560
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdi
callq 0x32a0
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x31a0
movq 0x18(%rbx), %rdi
callq 0x3050
movq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x3420
testq %rax, %rax
je 0x57b5
movswl 0x48(%rax), %r13d
movswl 0x4a(%rax), %r15d
movswl 0x4c(%rax), %r14d
xorl %edi, %edi
movq %rax, %rsi
movl $0x1, %edx
callq 0x3440
subl %r14d, %r15d
jmp 0x57c1
movl $0xa, %r15d
movl $0x1, %r13d
movq 0x20(%rbx), %rdi
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq -0x48(%rbp), %r9
movl -0x40(%rbp), %eax
movl %eax, (%rsp)
movl $0x1, %ecx
movl $0xa, %r8d
callq 0x32e0
movq %r13, -0x58(%rbp)
leal (%r15,%r15,2), %eax
movq %r15, -0x50(%rbp)
movl %eax, %r15d
shrl $0x1f, %r15d
addl %eax, %r15d
sarl %r15d
addl $0xa, %r15d
movq %r12, -0x60(%rbp)
movl (%r12), %ecx
leaq 0xb65(%rip), %rdx       # 0x6378
leaq -0xf0(%rbp), %rdi
movl $0x20, %esi
xorl %eax, %eax
callq 0x34e0
movq 0x20(%rbx), %r13
movq 0x8(%rbx), %r14
movq 0x18(%rbx), %r12
leaq -0xf0(%rbp), %rdi
callq 0x3140
movl %eax, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
movl $0x1, %ecx
movl %r15d, %r8d
leaq -0xf0(%rbp), %r9
callq 0x32e0
movq -0x58(%rbp), %rax
leal (%rax,%rax,8), %r12d
addl $0x9, %r12d
movq -0x50(%rbp), %rcx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
subl %eax, %r15d
cmpl $0x0, 0x54(%rbx)
jne 0x5896
movl %r15d, 0x54(%rbx)
movl %r12d, 0x5c(%rbx)
movl $0xc8, 0x60(%rbx)
movl $0xc, 0x58(%rbx)
movq -0x60(%rbp), %rax
movl (%rax), %r14d
movq 0x20(%rbx), %rdi
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdx
movl 0x60(%rbx), %r9d
addl %r12d, %r9d
movl %r15d, (%rsp)
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x34c0
movq 0x20(%rbx), %rdi
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdx
leal (%r12,%r14,2), %ecx
addl $-0x6, %r15d
movl $0xc, (%rsp)
movl %r15d, %r8d
movl $0x5, %r9d
callq 0x3170
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdi
movl $0x28, %edx
callq 0x3d87
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5913
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5931
jmp 0x5931
jmp 0x5931
jmp 0x5931
jmp 0x5931
jmp 0x5931
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x594d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
callq 0x3550
nop