// File: /workspace/github_c_makefile_star2_O0/hughbarney[P]zepl/zepl.c
// Function: copy_cut
void copy_cut(int cut, int verbose)
{
	char_t *p;
	if (scrap != NULL) {
		free(scrap);
		scrap = NULL;
		nscrap = 0;
	}
	/* if no mark or point == marker, nothing doing */
	if (curbp->b_mark == NOMARK || curbp->b_point == curbp->b_mark) return;

	if (curbp->b_point < curbp->b_mark) {
		/* point above marker: move gap under point, region = marker - point */
		(void)movegap(curbp, curbp->b_point);
		p = ptr(curbp, curbp->b_point);
		nscrap = curbp->b_mark - curbp->b_point;
	} else {
		/* if point below marker: move gap under marker, region = point - marker */
		(void)movegap(curbp, curbp->b_mark);
		p = ptr(curbp, curbp->b_mark);
		nscrap = curbp->b_point - curbp->b_mark;
	}
	assert(nscrap > 0);
	if ((scrap = (char_t*) malloc(nscrap + 1)) == NULL) {
		msg("No more memory available.");
	} else {
		(void)memcpy(scrap, p, nscrap * sizeof (char_t));
		*(scrap + nscrap) = '\0';  /* null terminate for insert_string */
		if (cut) {
			curbp->b_egap += nscrap; /* if cut expand gap down */
			curbp->b_point = pos(curbp, curbp->b_egap); /* set point to after region */
			curbp->b_flags |= B_MODIFIED;
			if (verbose) msg("%ld bytes cut.", nscrap);
		} else {
			if (verbose) msg("%ld bytes copied.", nscrap);
		}
		curbp->b_mark = NOMARK;  /* unmark */
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
cmpq $0x0, 0xbbc2(%rip)      # 0xf938
je 0x3d9a
movq 0xbbb9(%rip), %rdi      # 0xf938
callq 0x2050
movq $0x0, 0xbba9(%rip) # 0xf938
movq $0x0, 0xbb96(%rip) # 0xf930
movq 0xbda7(%rip), %rax      # 0xfb48
cmpq $-0x1, (%rax)
je 0x3dbe
movq 0xbd9a(%rip), %rax      # 0xfb48
movq 0x8(%rax), %rax
movq 0xbd8f(%rip), %rcx      # 0xfb48
cmpq (%rcx), %rax
jne 0x3dc3
jmp 0x3f73
movq 0xbd7e(%rip), %rax      # 0xfb48
movq 0x8(%rax), %rax
movq 0xbd73(%rip), %rcx      # 0xfb48
cmpq (%rcx), %rax
jge 0x3e2a
movq 0xbd67(%rip), %rdi      # 0xfb48
movq 0xbd60(%rip), %rax      # 0xfb48
movq 0x8(%rax), %rsi
callq 0x28e0
movq 0xbd50(%rip), %rdi      # 0xfb48
movq 0xbd49(%rip), %rax      # 0xfb48
movq 0x8(%rax), %rsi
callq 0x2610
movq %rax, -0x10(%rbp)
movq 0xbd35(%rip), %rax      # 0xfb48
movq (%rax), %rax
movq 0xbd2b(%rip), %rcx      # 0xfb48
subq 0x8(%rcx), %rax
movq %rax, 0xbb08(%rip)      # 0xf930
jmp 0x3e76
movq 0xbd17(%rip), %rdi      # 0xfb48
movq 0xbd10(%rip), %rax      # 0xfb48
movq (%rax), %rsi
callq 0x28e0
movq 0xbd01(%rip), %rdi      # 0xfb48
movq 0xbcfa(%rip), %rax      # 0xfb48
movq (%rax), %rsi
callq 0x2610
movq %rax, -0x10(%rbp)
movq 0xbce7(%rip), %rax      # 0xfb48
movq 0x8(%rax), %rax
movq 0xbcdc(%rip), %rcx      # 0xfb48
subq (%rcx), %rax
movq %rax, 0xbaba(%rip)      # 0xf930
movq 0xbab3(%rip), %rdi      # 0xf930
addq $0x1, %rdi
callq 0x2220
movq %rax, 0xbaab(%rip)      # 0xf938
cmpq $0x0, %rax
jne 0x3ea6
leaq 0x72ac(%rip), %rdi      # 0xb146
movb $0x0, %al
callq 0x2560
jmp 0x3f73
movq 0xba8b(%rip), %rdi      # 0xf938
movq -0x10(%rbp), %rsi
movq 0xba78(%rip), %rdx      # 0xf930
shlq $0x0, %rdx
callq 0x2210
movq 0xba70(%rip), %rax      # 0xf938
movq 0xba61(%rip), %rcx      # 0xf930
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0x4(%rbp)
je 0x3f48
movq 0xba50(%rip), %rcx      # 0xf930
movq 0xbc61(%rip), %rax      # 0xfb48
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
movq 0xbc52(%rip), %rdi      # 0xfb48
movq 0xbc4b(%rip), %rax      # 0xfb48
movq 0x38(%rax), %rsi
callq 0x2690
movq %rax, %rcx
movq 0xbc38(%rip), %rax      # 0xfb48
movq %rcx, 0x8(%rax)
movq 0xbc2d(%rip), %rax      # 0xfb48
movsbl 0x14d(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x14d(%rax)
cmpl $0x0, -0x8(%rbp)
je 0x3f46
movq 0xb9f8(%rip), %rsi      # 0xf930
leaq 0x7221(%rip), %rdi      # 0xb160
movb $0x0, %al
callq 0x2560
jmp 0x3f65
cmpl $0x0, -0x8(%rbp)
je 0x3f63
movq 0xb9db(%rip), %rsi      # 0xf930
leaq 0x7213(%rip), %rdi      # 0xb16f
movb $0x0, %al
callq 0x2560
jmp 0x3f65
movq 0xbbdc(%rip), %rax      # 0xfb48
movq $-0x1, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)