// File: /workspace/github_cpp_makefile_star2_O2/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 $0xf8, %rsp
movq %rsi, %r12
movq %rdi, %rbx
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x129f(%rip), %rsi      # 0x6374
leaq -0x68(%rbp), %rdi
callq 0x3580
leaq 0x30(%rbx), %rsi
leaq -0x68(%rbp), %rdi
callq 0x35b0
movq 0x20(%rbx), %rdi
movslq 0xe0(%rdi), %rax
movq 0xe8(%rdi), %rcx
shlq $0x7, %rax
movq 0x58(%rcx,%rax), %rax
leaq -0x110(%rbp), %rcx
movq %rax, 0x10(%rcx)
movq 0x8(%rbx), %rsi
pushq $0x4
popq %rdx
callq 0x3160
movq %rax, %r15
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdi
leaq -0x48(%rbp), %rdx
leaq -0x44(%rbp), %rcx
callq 0x3920
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdi
callq 0x3290
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x31a0
movq 0x18(%rbx), %rdi
callq 0x3040
movq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x33f0
testq %rax, %rax
je 0x5189
movswl 0x48(%rax), %r13d
movswl 0x4a(%rax), %r15d
movswl 0x4c(%rax), %r14d
pushq $0x1
popq %rdx
xorl %edi, %edi
movq %rax, %rsi
callq 0x3410
subl %r14d, %r15d
jmp 0x5191
pushq $0xa
popq %r15
pushq $0x1
popq %r13
movq 0x20(%rbx), %rdi
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq -0x68(%rbp), %r9
movl -0x60(%rbp), %eax
movl %eax, (%rsp)
pushq $0x1
popq %rcx
pushq $0xa
popq %r8
callq 0x32d0
movq %r13, -0x40(%rbp)
leal (%r15,%r15,2), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movq %r15, -0x38(%rbp)
movl %eax, %r15d
addl $0xa, %r15d
movq %r12, -0x30(%rbp)
movl (%r12), %ecx
leaq 0x11a1(%rip), %rdx      # 0x637c
leaq -0x90(%rbp), %rdi
pushq $0x20
popq %rsi
xorl %eax, %eax
callq 0x34b0
movq 0x20(%rbx), %r14
movq 0x8(%rbx), %r12
movq 0x18(%rbx), %r13
leaq -0x90(%rbp), %rdi
callq 0x3120
movl %eax, (%rsp)
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl %r15d, %r8d
leaq -0x90(%rbp), %r9
callq 0x32d0
movq -0x40(%rbp), %rax
leal (%rax,%rax,8), %r13d
addl $0x9, %r13d
pushq $-0x2
popq %rcx
movq -0x38(%rbp), %rax
cltd
idivl %ecx
addl %eax, %r15d
cmpl $0x0, 0x54(%rbx)
je 0x5247
movl 0x60(%rbx), %r9d
jmp 0x5263
movl %r15d, 0x54(%rbx)
movl %r13d, 0x5c(%rbx)
movl $0xc8, 0x60(%rbx)
movl $0xc, 0x58(%rbx)
movl $0xc8, %r9d
movq -0x30(%rbp), %rax
movl (%rax), %r14d
movq 0x20(%rbx), %rdi
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdx
addl %r13d, %r9d
movl %r15d, (%rsp)
movl %r13d, %ecx
movl %r15d, %r8d
callq 0x3490
movq 0x20(%rbx), %rdi
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdx
leal (%r13,%r14,2), %ecx
addl $-0x6, %r15d
movl $0xc, (%rsp)
pushq $0x5
popq %r9
movl %r15d, %r8d
callq 0x3170
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdi
pushq $0x28
popq %rdx
callq 0x3cc8
leaq -0x68(%rbp), %rdi
callq 0x3130
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x52e7
jmp 0x52e7
jmp 0x52e7
jmp 0x52e7
jmp 0x52e7
jmp 0x52e7
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3510
nop