// File: /workspace/github_c_makefile_star2_O0/bobrippling[P]tim/yank.c
// Function: yank_put_in_list
void yank_put_in_list(
		const yank *ynk,
		list_t **const phead,
		const bool prepend,
		int *py, int *px)
{
	switch(ynk->as){
		case REGION_CHAR:
			charwise_put(ynk, list_seek(*phead, *py, true), px, prepend);
			break;

		case REGION_LINE:
		{
			list_t *copy = list_copy_deep(ynk->list, NULL);
			list_t *copy_tail = list_tail(copy);

			if(prepend){
				if(*py == 0){
					list_t *head = *phead;

					copy->prev = NULL;
					*phead = copy;

					copy_tail->next = head;
					if(head)
						head->prev = copy_tail;
				}else{
					list_t *before = list_seek(*phead, *py - 1, true);
					list_t *after = before->next;

					copy->prev = before;
					before->next = copy;

					copy_tail->next = after;
					if(after)
						after->prev = copy_tail;
				}
			}else{
				list_t *const head = *list_seekp(phead, *py, true);
				list_t *const after = head->next;

				/* top link */
				head->next = copy;
				copy->prev = head;

				/* bottom link */
				copy_tail->next = after;
				if(after)
					after->prev = copy_tail;

				++*py;
			}
			break;
		}
		case REGION_COL:
		{
			list_t *head = *list_seekp(phead, *py, true);
			assert(head);
			int y = 0;
			for(const list_t *l = ynk->list;
			    l; l = l->next, y++)
			{
				for(unsigned i = 0; i < l->len_line; i++)
					list_inschar(head,
							&(int){ *px + !prepend + i },
							&(int){ y },
							l->line[i], /* force spaces to fill in for now */' ');
			}

			if(!prepend)
				++*px;
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x88(%rbp)
testl %eax, %eax
je 0x11886
jmp 0x11865
movl -0x88(%rbp), %eax
subl $0x1, %eax
je 0x11a12
jmp 0x11876
movl -0x88(%rbp), %eax
subl $0x2, %eax
je 0x118c8
jmp 0x11b0b
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
movl $0x1, %edx
callq 0xcd50
movq -0x90(%rbp), %rdi
movq %rax, %rsi
movq -0x28(%rbp), %rdx
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x11b20
jmp 0x11b0b
movq -0x8(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc710
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xd2d0
movq %rax, -0x38(%rbp)
testb $0x1, -0x11(%rbp)
je 0x119a4
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x1193f
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x40(%rbp)
je 0x1193d
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x119a2
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
subl $0x1, %esi
movl $0x1, %edx
callq 0xcd50
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x50(%rbp)
je 0x119a0
movq -0x38(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x119a2
jmp 0x11a0d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
movl $0x1, %edx
callq 0xcc90
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x58(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x60(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x60(%rbp)
je 0x11a02
movq -0x38(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x11b0b
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
movl $0x1, %edx
callq 0xcc90
movq (%rax), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x11a36
jmp 0x11a55
leaq 0x3fd4(%rip), %rdi      # 0x15a11
leaq 0x3f9b(%rip), %rsi      # 0x159df
movl $0xb4, %edx
leaq 0x3fc6(%rip), %rcx      # 0x15a16
callq 0x4210
movl $0x0, -0x6c(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x11af8
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x11adc
movq -0x68(%rbp), %rdi
movq -0x28(%rbp), %rax
movl (%rax), %eax
movb -0x11(%rbp), %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
addl -0x7c(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x78(%rbp), %rax
movq (%rax), %rax
movl -0x7c(%rbp), %ecx
leaq -0x80(%rbp), %rsi
leaq -0x84(%rbp), %rdx
movl $0x20, %r8d
movsbl (%rax,%rcx), %ecx
callq 0xd000
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x11a79
jmp 0x11ade
movq -0x78(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x11a67
testb $0x1, -0x11(%rbp)
jne 0x11b09
movq -0x28(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x11b0b
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)