// File: /workspace/github_c_makefile_star2_O1/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 0x5606
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %ebp
leaq 0x8595(%rip), %r12      # 0xda48
movl %esi, (%rsp)
movq (%r12), %rax
movq 0x18(%rax), %r13
leaq 0x8573(%rip), %rcx      # 0xda38
movq (%rcx), %rcx
cmpq 0x28(%rcx), %r13
je 0x55f6
movq 0x20(%rax), %rbx
movl 0x14(%r13), %r15d
subl %ebx, %r15d
cmpl %ebp, %r15d
cmovgel %ebp, %r15d
testl %r15d, %r15d
je 0x55bf
movl %ebp, 0x4(%rsp)
movl $0x4, %edi
callq 0x512b
movslq %ebx, %r12
leaq (%r12,%r13), %rbp
addq $0x18, %rbp
movslq %r15d, %rbx
testl %r14d, %r14d
je 0x552c
xorl %r14d, %r14d
movsbl (%rbp,%r14), %edi
callq 0x5607
testl %eax, %eax
je 0x55f6
incq %r14
cmpq %r14, %rbx
jne 0x5511
leaq 0x18(%r13), %rax
leaq (%rbx,%rbp), %rdx
movslq 0x14(%r13), %rcx
leaq (%rax,%rcx), %rsi
cmpq %rsi, %rdx
je 0x5553
leaq (%rbx,%rbp), %rdx
incq %rdx
movb -0x1(%rdx), %cl
movb %cl, (%rbp)
incq %rbp
jmp 0x5534
subl %r15d, %ecx
movl %ecx, 0x14(%r13)
leaq 0x84ff(%rip), %rax      # 0xda60
movq (%rax), %rax
testq %rax, %rax
movl (%rsp), %r14d
movl 0x4(%rsp), %ebp
je 0x55b3
cmpq %r13, 0x18(%rax)
jne 0x558e
movq 0x20(%rax), %rcx
cmpq %r12, %rcx
jl 0x558e
subq %rbx, %rcx
cmpq %r12, %rcx
cmovleq %r12, %rcx
movq %rcx, 0x20(%rax)
cmpq %r13, 0x28(%rax)
jne 0x55ab
movq 0x30(%rax), %rcx
cmpq %r12, %rcx
jl 0x55ab
subq %rbx, %rcx
cmpq %r12, %rcx
cmovleq %r12, %rcx
movq %rcx, 0x30(%rax)
movq (%rax), %rax
testq %rax, %rax
jne 0x5571
subl %r15d, %ebp
leaq 0x848b(%rip), %r12      # 0xda48
jmp 0x55e7
movl $0x8, %edi
callq 0x512b
callq 0x567c
testl %eax, %eax
je 0x55f6
testl %r14d, %r14d
je 0x55e5
movl $0xa, %edi
callq 0x5607
testl %eax, %eax
je 0x55f6
decl %ebp
testl %ebp, %ebp
jne 0x54b6
movl $0x1, %eax
jmp 0x55f8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq