// File: /workspace/github_c_makefile_star2_O2/hughbarney[P]pEmacs/line.c
// Function: ldelete
int ldelete (int n, int kflag)
{
  LINE *dotp;
  WINDOW *wp;
  char *cp1, *cp2;
  int doto, chunk;

  while (n != 0)
    {
      dotp = curwp->w_dotp;
      doto = curwp->w_doto;
      if (dotp == curbp->b_linep) /* Hit end of buffer */
	return (FALSE);
      chunk = dotp->l_used - doto; /* Size of chunk */
      if (chunk > n)
	chunk = n;
      if (chunk == 0)
	{			/* End of line, merge */
	  lchange (WFHARD);
	  if (ldelnewline () == FALSE
	      || (kflag != FALSE && kinsert ('\n') == FALSE))
	    return (FALSE);
	  --n;
	  continue;
	}
      lchange (WFEDIT);
      cp1 = &dotp->l_text[doto]; /* Scrunch text */
      cp2 = cp1 + chunk;
      if (kflag != FALSE)
	{			/* Kill? */
	  while (cp1 != cp2)
	    {
	      if (kinsert (*cp1) == FALSE)
		return (FALSE);
	      ++cp1;
	    }
	  cp1 = &dotp->l_text[doto];
	}
      while (cp2 != &dotp->l_text[dotp->l_used])
	*cp1++ = *cp2++;
      dotp->l_used -= chunk;
      wp = wheadp;		/* Fix windows */
      while (wp != NULL)
	{
	  if (wp->w_dotp == dotp && wp->w_doto >= doto)
	    {
	      wp->w_doto -= chunk;
	      if (wp->w_doto < doto)
		wp->w_doto = doto;
	    }
	  if (wp->w_markp == dotp && wp->w_marko >= doto)
	    {
	      wp->w_marko -= chunk;
	      if (wp->w_marko < doto)
		wp->w_marko = doto;
	    }
	  wp = wp->w_wndp;
	}
      n -= chunk;
    }
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r15d
movl %edi, %ebp
leaq 0x7cc6(%rip), %r14      # 0xca38
leaq 0x7caf(%rip), %r13      # 0xca28
movl %esi, 0x10(%rsp)
testl %ebp, %ebp
je 0x4ec3
movq (%r14), %rax
movq 0x18(%rax), %r12
movq (%r13), %rcx
movl $0x0, 0x8(%rsp)
cmpq 0x28(%rcx), %r12
je 0x4eca
movq 0x20(%rax), %rbx
movl 0x14(%r12), %eax
subl %ebx, %eax
cmpl %ebp, %eax
cmovgel %ebp, %eax
testl %eax, %eax
je 0x4e01
movl %ebp, 0x14(%rsp)
pushq $0x4
popq %rdi
movl %eax, 0xc(%rsp)
callq 0x4a3c
movl 0xc(%rsp), %esi
leaq 0x18(%r12), %rbp
movslq %ebx, %r14
leaq (%r12,%r14), %r13
addq $0x18, %r13
movslq %esi, %rbx
testl %r15d, %r15d
je 0x4e46
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x4e32
movsbl (%r13,%r15), %edi
callq 0x4edd
incq %r15
testl %eax, %eax
jne 0x4de5
jmp 0x4eca
pushq $0x8
popq %rdi
callq 0x4a3c
callq 0x4f52
testl %eax, %eax
je 0x4eca
testl %r15d, %r15d
je 0x4e2b
pushq $0xa
popq %rdi
callq 0x4edd
testl %eax, %eax
je 0x4eca
decl %ebp
jmp 0x4d7d
movl 0x10(%rsp), %r15d
movl 0xc(%rsp), %esi
jmp 0x4e46
movb (%rcx), %al
movb %al, (%r13)
incq %r13
leaq (%rbx,%r13), %rcx
movslq 0x14(%r12), %rax
leaq (%rax,%rbp), %rdx
cmpq %rdx, %rcx
jne 0x4e3d
subl %esi, %eax
movl %eax, 0x14(%r12)
leaq 0x7bea(%rip), %rax      # 0xca50
movl 0x14(%rsp), %ebp
leaq 0x7bb7(%rip), %r13      # 0xca28
movq (%rax), %rax
testq %rax, %rax
je 0x4eb5
cmpq %r12, 0x18(%rax)
jne 0x4e96
movq 0x20(%rax), %rcx
cmpq %r14, %rcx
jl 0x4e96
subq %rbx, %rcx
cmpq %r14, %rcx
cmovleq %r14, %rcx
movq %rcx, 0x20(%rax)
cmpq %r12, 0x28(%rax)
jne 0x4e71
movq 0x30(%rax), %rcx
cmpq %r14, %rcx
jl 0x4e71
subq %rbx, %rcx
cmpq %r14, %rcx
cmovleq %r14, %rcx
movq %rcx, 0x30(%rax)
jmp 0x4e71
subl %esi, %ebp
leaq 0x7b7a(%rip), %r14      # 0xca38
jmp 0x4d7d
pushq $0x1
popq %rax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq