// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/window/backends/xlib/windowxlib.cpp
// Function: smooth::GUI::WindowXLib::OnXIMPreeditDraw(X11::_XIMPreeditDrawCallbackStruct*)
S::Void S::GUI::WindowXLib::OnXIMPreeditDraw(XIMPreeditDrawCallbackStruct *data)
{
	if (activeCursor == NIL) return;

	/* Get preedit string if any.
	 */
	String	 string;

	if (data->text != NIL)
	{
		if (data->text->encoding_is_wchar) string = data->text->string.wide_char;
		else				   string.ImportFrom("UTF-8", data->text->string.multi_byte);
	}

	/* Draw string at cursor position.
	 */
	Rect	 rect = Rect::OverlapRect(Rect(activeCursorPos - Point(1, 1), activeCursor->GetRealSize()), Rect(activeCursor->GetRealPosition(), activeCursor->GetRealSize()));

	activeCursor->SetIMECursor(True);

	drawSurface->StartPaint(rect);
	drawSurface->Box(rect, activeCursor->GetBackgroundColor(), Rect::Filled);

	if (data->text != NIL)
	{
		for (Int i = 0; i < data->text->length; i++)
		{
			Font	 font = activeCursor->GetFont();

			if (data->text->feedback != NIL)
			{
				if (data->text->feedback[i] & XIMUnderline) font.SetStyle(Font::Underline);
			}

			drawSurface->SetText(string.SubString(i, 1), rect + Point(font.GetScaledTextSizeX(string.Head(i)), 0), font);
		}
	}

	drawSurface->EndPaint();

	activeCursor->SetIMEAdvance(activeCursor->GetFont().GetScaledTextSizeX(string.Head(data->caret)));
	activeCursor->SetIMECursor(False);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, (%rsp)
cmpq $0x0, 0xb4d7d(%rip)     # 0x176c08
je 0xc2170
movq %rsi, %r15
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x58e20
movq 0x10(%r15), %rax
testq %rax, %rax
je 0xc1ed3
cmpl $0x0, 0x10(%rax)
movq 0x18(%rax), %rdx
je 0xc1ec2
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x58f00
jmp 0xc1ed3
leaq 0x5040d(%rip), %rsi     # 0x1122d6
leaq 0x20(%rsp), %rdi
callq 0x56950
movl 0xb4d36(%rip), %r14d    # 0x176c10
movl 0xb4d34(%rip), %ebx     # 0x176c14
movq 0xb4d21(%rip), %rdi     # 0x176c08
movq (%rdi), %rax
callq *0x50(%rax)
leal -0x1(%r14), %ecx
leal -0x1(%rbx), %edx
movq %rax, %rsi
shrq $0x20, %rsi
movl %ecx, 0x48(%rsp)
movl %edx, 0x4c(%rsp)
addl %r14d, %eax
decl %eax
movl %eax, 0x50(%rsp)
leal -0x1(%rbx,%rsi), %eax
movl %eax, 0x54(%rsp)
movq 0xb4ced(%rip), %rdi     # 0x176c08
movq (%rdi), %rax
callq *0x48(%rax)
movq %rax, %rbx
movq 0xb4cdd(%rip), %rdi     # 0x176c08
movq (%rdi), %rax
callq *0x50(%rax)
movq %rbx, %rcx
shrq $0x20, %rcx
movq %rax, %rdx
shrq $0x20, %rdx
leaq 0xa0(%rsp), %rsi
movl %ebx, (%rsi)
movl %ecx, 0x4(%rsi)
addl %ebx, %eax
movl %eax, 0x8(%rsi)
addl %ecx, %edx
movl %edx, 0xc(%rsi)
leaq 0x48(%rsp), %rdi
callq 0x58af0
movq %rax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq 0xb4c97(%rip), %rdi     # 0x176c08
movl $0x1, %esi
callq 0x57c40
movq (%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x10(%rsp), %rsi
callq 0x55160
movq (%rsp), %rax
movq 0x10(%rax), %rbx
movq 0xb4c6c(%rip), %rdi     # 0x176c08
movq (%rdi), %rax
callq *0x140(%rax)
movq 0xa9ffc(%rip), %rcx     # 0x16bfa8
movl (%rcx), %ecx
leaq 0x48(%rsp), %r8
movq $0x0, (%r8)
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x57930
movq %r15, 0x8(%rsp)
movq 0x10(%r15), %rax
testq %rax, %rax
je 0xc20fd
cmpw $0x0, (%rax)
je 0xc20fd
xorl %r15d, %r15d
leaq 0x48(%rsp), %r12
leaq 0xa0(%rsp), %r13
movq 0xb4c0b(%rip), %rdi     # 0x176c08
movq (%rdi), %rax
callq *0xe8(%rax)
movq %r12, %rdi
movq %rax, %rsi
callq 0x55b70
movq %r13, %r14
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
leaq 0x20(%rsp), %r13
je 0xc2049
testb $0x2, (%rax,%r15,8)
je 0xc2049
movq 0xa995f(%rip), %rax     # 0x16b998
movswl (%rax), %esi
movq %r12, %rdi
callq 0x55540
leaq 0x20(%rsp), %r13
movq (%rsp), %rax
movq 0x10(%rax), %rbx
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
movl $0x1, %ecx
callq 0x58f50
leaq 0x88(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x58b00
movq %r12, %rdi
movq %rbp, %rsi
callq 0x56730
movq %r14, %r13
movl 0x10(%rsp), %ecx
addl %eax, %ecx
movl 0x14(%rsp), %edx
movl 0x1c(%rsp), %esi
shlq $0x20, %rdx
addl 0x18(%rsp), %eax
orq %rdx, %rcx
shlq $0x20, %rsi
orq %rsi, %rax
movq %rcx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x38(%rsp), %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x57b80
leaq 0x88(%rsp), %rdi
callq 0x59200
movq %r13, %rdi
callq 0x59200
movq %r12, %rdi
callq 0x56720
incq %r15
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movzwl (%rax), %eax
cmpq %rax, %r15
jb 0xc1ff6
movq (%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x58780
movq 0x8(%rsp), %rbp
movq 0xb4af2(%rip), %rbx     # 0x176c08
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xe8(%rax)
movq %rax, %r14
movl (%rbp), %edx
leaq 0x48(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x58b00
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x56730
movq %rbx, %rdi
movl %eax, %esi
callq 0x55ea0
leaq 0x48(%rsp), %rdi
callq 0x59200
movq 0xb4aa9(%rip), %rdi     # 0x176c08
xorl %esi, %esi
callq 0x57c40
leaq 0x20(%rsp), %rdi
callq 0x59200
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc21d4
jmp 0xc21d4
jmp 0xc21d4
jmp 0xc21d4
jmp 0xc21d4
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x59200
jmp 0xc21d7
jmp 0xc21d4
jmp 0xc21a1
jmp 0xc21d4
movq %rax, %rbx
jmp 0xc21c8
movq %rax, %rbx
jmp 0xc21bb
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x59200
leaq 0xa0(%rsp), %rdi
callq 0x59200
leaq 0x48(%rsp), %rdi
callq 0x56720
jmp 0xc21d7
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x59200
movq %rbx, %rdi
callq 0x57090
nop