// File: /workspace/github_c_makefile_star2_O0/bobrippling[P]tim/yank.c
// Function: charwise_put
static void charwise_put(
		const yank *ynk, list_t *head,
		int *px, bool prepend)
{
	/* first line */
	const list_t *ins_iter = ynk->list;

	*px += !prepend;

	for(unsigned i = 0; i < ins_iter->len_line; i++)
		list_inschar(head,
				px,
				&(int){ 0 },
				ins_iter->line[i], /*autogap*/0);

	int final_x = *px - 1;

	/* if we have multiple lines... */
	if((ins_iter = ins_iter->next)){
		struct str
		{
			char *str;
			size_t len;
		};

		/* need to pull out the rest of the line */
		struct str append = { .str = NULL };

		unsigned off = *px;
		if(off < head->len_line){
			unsigned len = head->len_line - *px;

			append.str = ustrdup_len(head->line + *px, len);
			append.len = len;

			head->len_line = *px;
		}

		/* append ins_iter - 2 lines */
		{
			list_t *copy = list_copy_deep(ins_iter, NULL);

			list_t *copy_tail = list_tail(copy);
			list_t *after = head->next;
			head->next = copy;
			copy->prev = head;

			copy_tail->next = after;
			if(after)
				after->prev = copy_tail;
		}

		if(append.str){
			list_t *tail = head;
			for(; ins_iter; ins_iter = ins_iter->next)
				tail = tail->next;

			/* tail is now the last inserted line */
			unsigned len = tail->len_line + append.len;
			tail->len_malloc = len + 1;
			tail->line = urealloc(tail->line, tail->len_malloc);

			memcpy(tail->line + tail->len_line,
					append.str,
					append.len);

			tail->len_line += append.len;
		}
	}

	*px = final_x;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movb -0x19(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x18(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x11ba3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x0, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
leaq -0x30(%rbp), %rdx
xorl %r8d, %r8d
movsbl (%rax,%rcx), %ecx
callq 0xd000
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x11b62
movq -0x18(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x11d37
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x4240
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x11c35
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rax
addq %rax, %rdi
movl -0x50(%rbp), %eax
movl %eax, %esi
callq 0x5fe0
movq %rax, -0x48(%rbp)
movl -0x50(%rbp), %eax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movslq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc710
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0xd2d0
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x68(%rbp)
je 0x11c96
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x20(%rax)
cmpq $0x0, -0x48(%rbp)
je 0x11d35
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x11cca
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x11ca9
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x40(%rbp), %rax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x70(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x70(%rbp), %rax
movq (%rax), %rdi
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5f60
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
movq (%rax), %rdi
movq -0x70(%rbp), %rax
addq 0x8(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x4350
movq -0x40(%rbp), %rcx
movq -0x70(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
jmp 0x11d37
movl -0x34(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)