// File: /workspace/github_c_makefile_star2_O3/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:
movl $0x1, %eax
testl %edi, %edi
je 0x54ca
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %ebp
leaq 0x86d1(%rip), %r12      # 0xda48
movl %esi, (%rsp)
movq (%r12), %rax
movq 0x18(%rax), %r13
leaq 0x86af(%rip), %rcx      # 0xda38
movq (%rcx), %rcx
cmpq 0x28(%rcx), %r13
je 0x54ba
movq 0x20(%rax), %rbx
movl 0x14(%r13), %r15d
subl %ebx, %r15d
cmpl %ebp, %r15d
cmovgel %ebp, %r15d
testl %r15d, %r15d
je 0x5483
movl %ebp, 0x4(%rsp)
movl $0x4, %edi
callq 0x4fde
movslq %ebx, %r12
leaq (%r12,%r13), %rbp
addq $0x18, %rbp
movslq %r15d, %rbx
testl %r14d, %r14d
je 0x53f0
xorl %r14d, %r14d
movsbl (%rbp,%r14), %edi
callq 0x54cb
testl %eax, %eax
je 0x54ba
incq %r14
cmpq %r14, %rbx
jne 0x53d5
leaq 0x18(%r13), %rax
leaq (%rbx,%rbp), %rdx
movslq 0x14(%r13), %rcx
leaq (%rax,%rcx), %rsi
cmpq %rsi, %rdx
je 0x5417
leaq (%rbx,%rbp), %rdx
incq %rdx
movb -0x1(%rdx), %cl
movb %cl, (%rbp)
incq %rbp
jmp 0x53f8
subl %r15d, %ecx
movl %ecx, 0x14(%r13)
leaq 0x863b(%rip), %rax      # 0xda60
movq (%rax), %rax
testq %rax, %rax
movl (%rsp), %r14d
movl 0x4(%rsp), %ebp
je 0x5477
cmpq %r13, 0x18(%rax)
jne 0x5452
movq 0x20(%rax), %rcx
cmpq %r12, %rcx
jl 0x5452
subq %rbx, %rcx
cmpq %r12, %rcx
cmovleq %r12, %rcx
movq %rcx, 0x20(%rax)
cmpq %r13, 0x28(%rax)
jne 0x546f
movq 0x30(%rax), %rcx
cmpq %r12, %rcx
jl 0x546f
subq %rbx, %rcx
cmpq %r12, %rcx
cmovleq %r12, %rcx
movq %rcx, 0x30(%rax)
movq (%rax), %rax
testq %rax, %rax
jne 0x5435
subl %r15d, %ebp
leaq 0x85c7(%rip), %r12      # 0xda48
jmp 0x54ab
movl $0x8, %edi
callq 0x4fde
callq 0x5542
testl %eax, %eax
je 0x54ba
testl %r14d, %r14d
je 0x54a9
movl $0xa, %edi
callq 0x54cb
testl %eax, %eax
je 0x54ba
decl %ebp
testl %ebp, %ebp
jne 0x537a
movl $0x1, %eax
jmp 0x54bc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq