// File: /workspace/github_c_makefile_star2_O3/hughbarney[P]pEmacs/line.c
// Function: linsert
int linsert (int n, int c)
{
  WINDOW *wp;
  LINE *lp1, *lp2, *lp3;
  char *cp1, *cp2;
  int i, doto;

  lchange (WFEDIT);
  lp1 = curwp->w_dotp;	       /* Current line */
  if (lp1 == curbp->b_linep)
    {			       /* At the end: special */
      if (curwp->w_doto != 0)
	{
	  mlwrite ("bug: linsert");
	  return (FALSE);
	}
      if ((lp2 = lalloc (n)) == NULL)	/* Allocate new line */
	return (FALSE);
      lp3 = lp1->l_bp;	       /* Previous line */
      lp3->l_fp = lp2;	       /* Link in */
      lp2->l_fp = lp1;
      lp1->l_bp = lp2;
      lp2->l_bp = lp3;
      for (i = 0; i < n; ++i)
	lp2->l_text[i] = c;
      curwp->w_dotp = lp2;
      curwp->w_doto = n;
      return (TRUE);
    }
  doto = curwp->w_doto;	       /* Save for later */
  if (lp1->l_used + n > lp1->l_size)
    {			       /* Hard: reallocate */
      if ((lp2 = lalloc (lp1->l_used + n)) == NULL)
	return (FALSE);
      cp1 = &lp1->l_text[0];
      cp2 = &lp2->l_text[0];
      while (cp1 != &lp1->l_text[doto])
	*cp2++ = *cp1++;
      cp2 += n;
      while (cp1 != &lp1->l_text[lp1->l_used])
	*cp2++ = *cp1++;
      lp1->l_bp->l_fp = lp2;
      lp2->l_fp = lp1->l_fp;
      lp1->l_fp->l_bp = lp2;
      lp2->l_bp = lp1->l_bp;
      free ((char *) lp1);
    }
  else
    {				/* Easy: in place */
      lp2 = lp1;		/* Pretend new line */
      lp2->l_used += n;
      cp2 = &lp1->l_text[lp1->l_used];
      cp1 = cp2 - n;
      while (cp1 != &lp1->l_text[doto])
	*--cp2 = *--cp1;
    }
  for (i = 0; i < n; ++i)	/* Add the characters */
    lp2->l_text[doto + i] = c;
  wp = wheadp;		       /* Update windows */
  while (wp != NULL)
    {
      if (wp->w_linep == lp1)
	wp->w_linep = lp2;
      if (wp->w_dotp == lp1)
	{
	  wp->w_dotp = lp2;
	  if (wp == curwp || wp->w_doto > doto)
	    wp->w_doto += n;
	}
      if (wp->w_markp == lp1)
	{
	  wp->w_markp = lp2;
	  if (wp->w_marko > doto)
	    wp->w_marko += n;
	}
      wp = wp->w_wndp;
    }
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %ebp
movl $0x4, %edi
callq 0x4fde
leaq 0x8a07(%rip), %r12      # 0xda48
movq (%r12), %rax
movq 0x18(%rax), %rbx
movq 0x20(%rax), %r13
leaq 0x89e4(%rip), %rax      # 0xda38
movq (%rax), %rax
cmpq 0x28(%rax), %rbx
je 0x50b8
movslq 0x14(%rbx), %rax
movslq %ebp, %r12
leaq (%rax,%r12), %rdi
cmpl 0x10(%rbx), %edi
jle 0x50d2
callq 0x4ef4
testq %rax, %rax
je 0x5167
movq %rax, %r15
leaq 0x18(%rbx), %rax
leaq 0x18(%r15), %rcx
movq %r13, %rdx
shlq $0x20, %rdx
je 0x516e
movslq %r13d, %rdi
leaq (%rbx,%rdi), %rdx
addq $0x18, %rdx
xorl %esi, %esi
movb (%rax,%rsi), %r8b
movb %r8b, (%rcx,%rsi)
incq %rsi
cmpq %rsi, %rdi
jne 0x50a0
addq %rsi, %rcx
jmp 0x5171
testq %r13, %r13
je 0x5118
leaq 0x4240(%rip), %rdi      # 0x9304
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4246
jmp 0x523e
movl %edi, 0x14(%rbx)
leaq (%rbx,%rdi), %rdx
addq $0x18, %rdx
subq %r12, %rdx
movslq %r13d, %rcx
leaq (%rbx,%rcx), %rsi
addq $0x18, %rsi
movq %rbx, %r15
cmpq %rsi, %rdx
je 0x51b9
leaq (%r12,%rbx), %rdx
addq $0x17, %rdx
movb 0x17(%rbx,%rax), %sil
movb %sil, (%rdx,%rax)
decq %rax
cmpq %rax, %rcx
jne 0x50ff
movq %rbx, %r15
jmp 0x51b9
movl %ebp, %edi
callq 0x4ef4
testq %rax, %rax
je 0x5167
movq %rax, %r15
movq 0x8(%rbx), %rax
movq %r15, (%rax)
movq %rbx, (%r15)
movq %r15, 0x8(%rbx)
movq %rax, 0x8(%r15)
testl %ebp, %ebp
jle 0x514e
movq %r15, %rdi
addq $0x18, %rdi
movl %ebp, %edx
movl %r14d, %esi
callq 0x2130
movq (%r12), %rax
movq %r15, 0x18(%rax)
movslq %ebp, %rcx
movq %rcx, 0x20(%rax)
movl $0x1, %ebp
jmp 0x523e
xorl %ebp, %ebp
jmp 0x523e
movq %rax, %rdx
movslq 0x14(%rbx), %rsi
addq %rax, %rsi
cmpq %rsi, %rdx
je 0x5198
addq %r12, %rcx
movb (%rdx), %sil
incq %rdx
movb %sil, (%rcx)
incq %rcx
movslq 0x14(%rbx), %rsi
addq %rax, %rsi
cmpq %rsi, %rdx
jne 0x5180
movq 0x8(%rbx), %rax
movq %r15, (%rax)
movq (%rbx), %rax
movq %rax, (%r15)
movq %r15, 0x8(%rax)
movq 0x8(%rbx), %rax
movq %rax, 0x8(%r15)
movq %rbx, %rdi
callq 0x2040
testl %ebp, %ebp
jle 0x51d2
movslq %r13d, %rax
leaq (%rax,%r15), %rdi
addq $0x18, %rdi
movl %ebp, %edx
movl %r14d, %esi
callq 0x2130
leaq 0x8887(%rip), %rax      # 0xda60
movq (%rax), %rax
movl $0x1, %ebp
testq %rax, %rax
je 0x523e
leaq 0x885b(%rip), %rcx      # 0xda48
movq (%rcx), %rcx
movslq %r13d, %rdx
cmpq %rbx, 0x10(%rax)
jne 0x51fd
movq %r15, 0x10(%rax)
cmpq %rbx, 0x18(%rax)
jne 0x521c
movq %r15, 0x18(%rax)
movq 0x20(%rax), %rsi
cmpq %rcx, %rax
je 0x5215
cmpq %rdx, %rsi
jle 0x521c
addq %r12, %rsi
movq %rsi, 0x20(%rax)
cmpq %rbx, 0x28(%rax)
jne 0x5236
movq %r15, 0x28(%rax)
movq 0x30(%rax), %rsi
cmpq %rdx, %rsi
jle 0x5236
addq %r12, %rsi
movq %rsi, 0x30(%rax)
movq (%rax), %rax
testq %rax, %rax
jne 0x51f3
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq