// File: 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
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x3490
movq -0x138(%rbp), %rdi
leaq 0xf39(%rip), %rsi       # 0x73c5
callq 0x32f0
jmp 0x6493
movq -0x140(%rbp), %rsi
addq $0x30, %rsi
leaq -0x30(%rbp), %rdi
callq 0x3440
jmp 0x64a9
movq -0x140(%rbp), %rax
movq 0x20(%rax), %rcx
movl 0xe0(%rcx), %ecx
movl %ecx, -0xc4(%rbp)
movq 0x20(%rax), %rcx
movq 0xe8(%rcx), %rcx
movslq -0xc4(%rbp), %rdx
shlq $0x7, %rdx
movq 0x58(%rcx,%rdx), %rcx
movq %rcx, -0xb0(%rbp)
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdi
movl $0x4, %edx
leaq -0xc0(%rbp), %rcx
callq 0x3170
movq %rax, -0x148(%rbp)
jmp 0x6504
movq -0x140(%rbp), %rax
movq -0x148(%rbp), %rcx
movq %rcx, -0xd0(%rbp)
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdi
leaq -0xd4(%rbp), %rdx
leaq -0xd8(%rbp), %rcx
callq 0x3b80
jmp 0x6536
movq -0x140(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdi
callq 0x32e0
jmp 0x654c
movq -0x140(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0xd0(%rbp), %rsi
callq 0x31c0
jmp 0x6565
movq -0x140(%rbp), %rax
movl $0xa, -0xdc(%rbp)
movl $0xa, -0xe0(%rbp)
movl $0x1, -0xe4(%rbp)
movq 0x18(%rax), %rdi
callq 0x3050
movq %rax, -0x150(%rbp)
jmp 0x659c
movq -0x140(%rbp), %rax
movq -0x150(%rbp), %rcx
movq %rcx, -0xf0(%rbp)
movq 0x20(%rax), %rdi
movq -0xf0(%rbp), %rsi
callq 0x34d0
movq %rax, -0x158(%rbp)
jmp 0x65ca
movq -0x158(%rbp), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0xf8(%rbp)
je 0x663d
movq -0xf8(%rbp), %rax
movswl 0x48(%rax), %eax
movl %eax, -0xe4(%rbp)
movq -0xf8(%rbp), %rcx
movswl 0x4a(%rcx), %eax
movswl 0x4c(%rcx), %ecx
subl %ecx, %eax
movl %eax, -0xe0(%rbp)
movq -0xf8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
movl $0x1, %edx
callq 0x34f0
jmp 0x6621
jmp 0x663d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x31d0
jmp 0x68c1
movq -0x140(%rbp), %rax
movq 0x20(%rax), %rcx
movq %rcx, -0x180(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x178(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x170(%rbp)
movl -0xdc(%rbp), %eax
movl %eax, -0x164(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x3140
movq -0x188(%rbp), %rdi
movq %rax, -0x160(%rbp)
callq 0x3210
movq -0x180(%rbp), %rdi
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
movl -0x164(%rbp), %r8d
movq -0x160(%rbp), %r9
movl %eax, %ecx
movq %rsp, %rax
movl %ecx, (%rax)
movl $0x1, %ecx
callq 0x3330
jmp 0x66ca
movl -0xe0(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %ecx
movl %ecx, %eax
shrl $0x1f, %eax
addl %eax, %ecx
sarl %ecx
movl -0xdc(%rbp), %eax
addl %ecx, %eax
movl %eax, -0xdc(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
leaq 0xcd4(%rip), %rdx       # 0x73cd
xorl %eax, %eax
leaq -0x120(%rbp), %rdi
movq %rdi, -0x190(%rbp)
movl $0x20, %esi
callq 0x35b0
movq -0x190(%rbp), %rdi
movq -0x140(%rbp), %rax
movq 0x20(%rax), %rcx
movq %rcx, -0x1b0(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x1a8(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x1a0(%rbp)
movl -0xdc(%rbp), %eax
movl %eax, -0x194(%rbp)
callq 0x3150
movq -0x1b0(%rbp), %rdi
movq -0x1a8(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
movl -0x194(%rbp), %r8d
movq -0x190(%rbp), %r9
movl %eax, %ecx
movq %rsp, %rax
movl %ecx, (%rax)
movl $0x1, %ecx
callq 0x3330
jmp 0x6789
movl -0xe4(%rbp), %eax
addl $0x1, %eax
cltq
imulq $0x9, %rax, %rax
movl %eax, -0x124(%rbp)
movl -0xdc(%rbp), %ecx
movl -0xe0(%rbp), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq -0x140(%rbp), %rax
subl %edx, %ecx
movl %ecx, -0x128(%rbp)
movl $0xc, -0x12c(%rbp)
cmpl $0x0, 0x54(%rax)
jne 0x67fc
movq -0x140(%rbp), %rax
movl -0x128(%rbp), %ecx
movl %ecx, 0x54(%rax)
movl -0x124(%rbp), %ecx
movl %ecx, 0x5c(%rax)
movl $0xc8, 0x60(%rax)
movl -0x12c(%rbp), %ecx
movl %ecx, 0x58(%rax)
movq -0x140(%rbp), %rax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
addl %ecx, %ecx
movl %ecx, -0x130(%rbp)
movq 0x20(%rax), %rdi
movq 0x8(%rax), %rsi
movq 0x18(%rax), %rdx
movl -0x124(%rbp), %ecx
movl -0x128(%rbp), %r8d
movl 0x60(%rax), %eax
movl %ecx, %r9d
addl %eax, %r9d
movq %rsp, %rax
movl %r8d, (%rax)
callq 0x3590
jmp 0x6840
movq -0x140(%rbp), %rax
movq 0x20(%rax), %rdi
movq 0x8(%rax), %rsi
movq 0x18(%rax), %rdx
movl -0x124(%rbp), %ecx
movl -0x130(%rbp), %eax
addl %eax, %ecx
movl -0x128(%rbp), %r8d
movl -0x12c(%rbp), %r9d
movl %r9d, %r10d
shrl $0x1f, %r10d
movl %r9d, %eax
addl %r10d, %eax
sarl %eax
subl %eax, %r8d
movq %rsp, %rax
movl %r9d, (%rax)
movl $0x5, %r9d
callq 0x3180
jmp 0x6894
movq -0x140(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rax), %rdi
movl $0x28, %edx
callq 0x4320
jmp 0x68af
leaq -0x30(%rbp), %rdi
callq 0x31d0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3620
nopw (%rax,%rax)