// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: startwin_puts
int startwin_puts(const char *str)
{
    GtkTextBuffer *textbuffer;
    GtkTextIter enditer;
    GtkTextMark *mark;
    const char *aptr, *bptr;

    if (!gtkenabled || !str) return 0;
    if (!startwin) return 1;

    textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(controls.messagestext));

    gtk_text_buffer_get_end_iter(textbuffer, &enditer);
    for (aptr = bptr = str; *aptr != 0; ) {
        switch (*bptr) {
            case '\b':
                if (bptr > aptr) {
                    // Insert any normal characters seen so far.
                    gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
                }
                gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
                aptr = ++bptr;
                break;
            case 0:
                if (bptr > aptr) {
                    gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
                }
                aptr = bptr;
                break;
            default:
                bptr++;
                break;
        }
    }

    mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
    gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(controls.messagestext), mark, 0.0, FALSE, 0.0, 1.0);
    gtk_text_buffer_delete_mark(textbuffer, mark);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x695132(%rip), %rax    # 0x6c2018
cmpl $0x0, (%rax)
je 0x2cef2
cmpq $0x0, -0x10(%rbp)
jne 0x2cefe
movl $0x0, -0x4(%rbp)
jmp 0x2d08f
cmpq $0x0, 0x18dc6a(%rip)    # 0x1bab70
jne 0x2cf14
movl $0x1, -0x4(%rbp)
jmp 0x2d08f
movq 0x18dc8d(%rip), %rax    # 0x1baba8
movq %rax, -0x88(%rbp)
callq 0x6660
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
callq 0x6250
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x6a10
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2d023
movq -0x80(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x8c(%rbp)
testl %eax, %eax
je 0x2cfe0
jmp 0x2cf7e
movl -0x8c(%rbp), %eax
subl $0x8, %eax
jne 0x2d012
jmp 0x2cf8f
movq -0x80(%rbp), %rax
cmpq -0x78(%rbp), %rax
jbe 0x2cfba
movq -0x18(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
subl $0x1, %ecx
leaq -0x68(%rbp), %rsi
callq 0x6840
movq -0x18(%rbp), %rdi
leaq -0x68(%rbp), %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x6540
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
jmp 0x2d01e
movq -0x80(%rbp), %rax
cmpq -0x78(%rbp), %rax
jbe 0x2d008
movq -0x18(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
leaq -0x68(%rbp), %rsi
callq 0x6840
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x2d01e
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x2cf5b
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x68(%rbp), %rdx
movl $0x1, %ecx
callq 0x6980
movq %rax, -0x70(%rbp)
movq 0x18db64(%rip), %rax    # 0x1baba8
movq %rax, -0x98(%rbp)
callq 0x6660
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
movq -0x70(%rbp), %rsi
xorps %xmm1, %xmm1
xorl %edx, %edx
movsd 0x8495d(%rip), %xmm2    # 0xb19d0
movaps %xmm1, %xmm0
callq 0x6030
movq -0x18(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x6050
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)