// File: /workspace/github_c_makefile_star2_O0/hughbarney[P]pEmacs/display.c
// Function: updateline
void updateline (int row, char vline[], char pline[], short *flags)
{
  char *cp1, *cp2, *cp3, *cp4, *cp5;
  int nbflag;			/* non-blanks to the right flag? */
  int rev;			/* reverse video flag */
  int req;			/* reverse video request flag */

  /* set up pointers to virtual and physical lines */
  cp1 = &vline[0];
  cp2 = &pline[0];

  /* if we need to change the reverse video status of the current line, we
   * need to re-write the entire line */
  rev = *flags & VFREV;
  req = *flags & VFREQ;
  if (rev != req)
    {
      movecursor (row, 0);	 /* Go to start of line */
      (*term.t_rev) (req != FALSE);	  /* set rev video if needed */

      /* scan through the line and dump it to the screen and the virtual
       * screen array */
      cp3 = &vline[term.t_ncol];
      while (cp1 < cp3)
	{
	  (*term.t_putchar) (*cp1);
	  ++ttcol;
	  *cp2++ = *cp1++;
	}
      (*term.t_rev) (FALSE);	 /* turn rev video off */

      /* update the needed flags */
      *flags &= ~VFCHG;
      if (req)
	*flags |= VFREV;
      else
	*flags &= ~VFREV;
      return;
    }

  /* advance past any common chars at the left */
  while (cp1 != &vline[term.t_ncol] && cp1[0] == cp2[0])
    {
      ++cp1;
      ++cp2;
    }

  /* This can still happen, even though we only call this routine on changed
   * lines. A hard update is always done when a line splits, a massive change
   * is done, or a buffer is displayed twice. This optimizes out most of the
   * excess updating. A lot of computes are used, but these tend to be hard
   * operations that do a lot of update, so I don't really care */
  /* if both lines are the same, no update needs to be done */
  if (cp1 == &vline[term.t_ncol])
    return;

  /* find out if there is a match on the right */
  nbflag = FALSE;
  cp3 = &vline[term.t_ncol];
  cp4 = &pline[term.t_ncol];

  while (cp3[-1] == cp4[-1])
    {
      --cp3;
      --cp4;
      if (cp3[0] != ' ')	 /* Note if any nonblank */
	nbflag = TRUE;		 /* in right match */
    }

  cp5 = cp3;

  if (nbflag == FALSE && eolexist == TRUE)
    {				/* Erase to EOL ? */
      while (cp5 != cp1 && cp5[-1] == ' ')
	--cp5;
      if (cp3 - cp5 <= 3)	/* Use only if erase is */
	cp5 = cp3;		/* fewer characters */
    }
  movecursor (row, cp1 - &vline[0]); /* Go to start of line */

  while (cp1 != cp5)
    {				/* Ordinary */
      (*term.t_putchar) (*cp1);
      ++ttcol;
      *cp2++ = *cp1++;
    }

  if (cp5 != cp3)
    {				/* Erase */
      (*term.t_eeol) ();
      while (cp1 != cp3)
	*cp2++ = *cp1++;
    }
  *flags &= ~VFCHG;		/* flag this line is changed */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movswl (%rax), %eax
andl $0x4, %eax
movl %eax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movswl (%rax), %eax
andl $0x8, %eax
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x54(%rbp), %eax
je 0x52ed
movl -0x4(%rbp), %edi
xorl %esi, %esi
callq 0x4200
leaq 0xb64a(%rip), %rax      # 0x10878
movq 0x58(%rax), %rcx
cmpl $0x0, -0x54(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %edi
movb $0x0, %al
callq *%rcx
movq -0x10(%rbp), %rax
leaq 0xb62b(%rip), %rcx      # 0x10878
movslq 0x4(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x52ab
leaq 0xb60f(%rip), %rax      # 0x10878
movq 0x28(%rax), %rcx
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
movb $0x0, %al
callq *%rcx
movl 0xaef6(%rip), %eax      # 0x10174
addl $0x1, %eax
movl %eax, 0xaeed(%rip)      # 0x10174
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x5258
xorl %edi, %edi
leaq 0xb5c4(%rip), %rcx      # 0x10878
movb $0x0, %al
callq *0x58(%rcx)
movq -0x20(%rbp), %rax
movswl (%rax), %ecx
andl $-0x2, %ecx
movw %cx, (%rax)
cmpl $0x0, -0x54(%rbp)
je 0x52db
movq -0x20(%rbp), %rax
movswl (%rax), %ecx
orl $0x4, %ecx
movw %cx, (%rax)
jmp 0x52e8
movq -0x20(%rbp), %rax
movswl (%rax), %ecx
andl $-0x5, %ecx
movw %cx, (%rax)
jmp 0x5505
jmp 0x52ef
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rdx
leaq 0xb57a(%rip), %rax      # 0x10878
movslq 0x4(%rax), %rax
addq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x55(%rbp)
je 0x5325
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x532e
jmp 0x5348
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x52ef
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
leaq 0xb521(%rip), %rdx      # 0x10878
movslq 0x4(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x5368
jmp 0x5505
movl $0x0, -0x4c(%rbp)
movq -0x10(%rbp), %rax
leaq 0xb4fe(%rip), %rcx      # 0x10878
movslq 0x4(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
leaq 0xb4e8(%rip), %rcx      # 0x10878
movslq 0x4(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movsbl -0x1(%rax), %eax
movq -0x40(%rbp), %rcx
movsbl -0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x53dc
movq -0x38(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0x53da
movl $0x1, -0x4c(%rbp)
jmp 0x539b
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x4c(%rbp)
jne 0x544a
leaq 0xaf8f(%rip), %rax      # 0x10380
cmpl $0x1, (%rax)
jne 0x544a
jmp 0x53f8
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x56(%rbp)
je 0x5418
movq -0x48(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x20, %eax
sete %al
movb %al, -0x56(%rbp)
movb -0x56(%rbp), %al
testb $0x1, %al
jne 0x5421
jmp 0x542f
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x53f8
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
cmpq $0x3, %rax
jg 0x5448
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x544a
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
callq 0x4200
movq -0x28(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x54b2
leaq 0xb408(%rip), %rax      # 0x10878
movq 0x28(%rax), %rcx
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
movb $0x0, %al
callq *%rcx
movl 0xacef(%rip), %eax      # 0x10174
addl $0x1, %eax
movl %eax, 0xace6(%rip)      # 0x10174
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x545f
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x54f8
leaq 0xb3b5(%rip), %rcx      # 0x10878
movb $0x0, %al
callq *0x40(%rcx)
movq -0x28(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x54f6
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x54c8
jmp 0x54f8
movq -0x20(%rbp), %rax
movswl (%rax), %ecx
andl $-0x2, %ecx
movw %cx, (%rax)
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)