// File: /workspace/github_c_makefile_star2_O1/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, 0xb4bef(%rip)     # 0x177c08
je 0xc3305
movq %rsi, %rbx
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x58e20
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0xc3061
cmpl $0x0, 0x10(%rax)
movq 0x18(%rax), %rdx
je 0xc3050
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x58f00
jmp 0xc3061
leaq 0x500cf(%rip), %rsi     # 0x113126
leaq 0x20(%rsp), %rdi
callq 0x56950
movl 0xb4ba8(%rip), %r15d    # 0x177c10
movl 0xb4ba5(%rip), %r14d    # 0x177c14
movq 0xb4b92(%rip), %rdi     # 0x177c08
movq (%rdi), %rax
callq *0x50(%rax)
leal -0x1(%r15), %ecx
leal -0x1(%r14), %edx
movq %rax, %rsi
shrq $0x20, %rsi
movl %ecx, 0x48(%rsp)
movl %edx, 0x4c(%rsp)
addl %r15d, %eax
decl %eax
movl %eax, 0x50(%rsp)
leal -0x1(%r14,%rsi), %eax
movl %eax, 0x54(%rsp)
movq 0xb4b5c(%rip), %rdi     # 0x177c08
movq (%rdi), %rax
callq *0x48(%rax)
movq %rax, %r14
movq 0xb4b4c(%rip), %rdi     # 0x177c08
movq (%rdi), %rax
callq *0x50(%rax)
movq %r14, %rcx
shrq $0x20, %rcx
movq %rax, %rdx
shrq $0x20, %rdx
leaq 0xa0(%rsp), %rsi
movl %r14d, (%rsi)
movl %ecx, 0x4(%rsi)
addl %r14d, %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 0xb4b04(%rip), %rdi     # 0x177c08
movl $0x1, %esi
callq 0x57c40
movq (%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x10(%rsp), %rsi
callq 0x55160
movq (%rsp), %rax
movq 0x10(%rax), %r14
movq 0xb4ad9(%rip), %rdi     # 0x177c08
movq (%rdi), %rax
callq *0x140(%rax)
movq 0xa9e69(%rip), %rcx     # 0x16cfa8
movl (%rcx), %ecx
leaq 0x48(%rsp), %r8
movq $0x0, (%r8)
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
movq %rax, %rdx
callq 0x57930
movq %rbx, 0x8(%rsp)
cmpq $0x0, 0x10(%rbx)
je 0xc3291
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
cmpw $0x0, (%rax)
je 0xc3291
xorl %r15d, %r15d
leaq 0x48(%rsp), %r12
leaq 0xa0(%rsp), %r14
movq 0xb4a71(%rip), %rdi     # 0x177c08
movq (%rdi), %rax
callq *0xe8(%rax)
movq %r12, %rdi
movq %rax, %rsi
callq 0x55b70
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
leaq 0x20(%rsp), %rbx
je 0xc31e0
testb $0x2, (%rax,%r15,8)
je 0xc31e0
movq 0xa97c8(%rip), %rax     # 0x16c998
movswl (%rax), %esi
movq %r12, %rdi
callq 0x55540
leaq 0x20(%rsp), %rbx
movq (%rsp), %rax
movq 0x10(%rax), %rbp
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl $0x1, %ecx
callq 0x58f50
leaq 0x88(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x58b00
movq %r12, %rdi
movq %r13, %rsi
callq 0x56730
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 %rbp, %rdi
movq %r14, %rsi
leaq 0x38(%rsp), %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x57b80
leaq 0x88(%rsp), %rdi
callq 0x59200
movq %r14, %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 0xc3190
movq (%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x58780
movq 0x8(%rsp), %r13
movq 0xb495e(%rip), %r14     # 0x177c08
movq (%r14), %rax
movq %r14, %rdi
callq *0xe8(%rax)
movq %rax, %r15
movl (%r13), %edx
leaq 0x48(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x58b00
leaq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0x56730
movq %r14, %rdi
movl %eax, %esi
callq 0x55ea0
leaq 0x48(%rsp), %rdi
callq 0x59200
movq 0xb4914(%rip), %rdi     # 0x177c08
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 0xc3369
jmp 0xc3369
jmp 0xc3369
jmp 0xc3369
jmp 0xc3369
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x59200
jmp 0xc336c
jmp 0xc3369
jmp 0xc3336
jmp 0xc3369
movq %rax, %rbx
jmp 0xc335d
movq %rax, %rbx
jmp 0xc3350
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x59200
leaq 0xa0(%rsp), %rdi
callq 0x59200
leaq 0x48(%rsp), %rdi
callq 0x56720
jmp 0xc336c
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x59200
movq %rbx, %rdi
callq 0x57090