// File: /workspace/github_c_makefile_star2_O2/hughbarney[P]pEmacs/file.c
// Function: readin
int readin (char fname[])
{
  LINE *lp1, *lp2;
  WINDOW *wp;
  BUFFER *bp;
  char line[NLINE];
  int nbytes, nline, s, i;
  int lflag;			/* any lines longer than allowed? */

  bp = curbp;			/* Cheap */
  if ((s = bclear (bp)) != TRUE) /* Might be old */
    return (s);
  bp->b_flag &= ~(BFTEMP | BFCHG);
  strncpy (bp->b_fname, fname, NFILEN);
  if ((s = ffropen (fname)) == FIOERR) /* Hard file open */
    goto out;
  if (s == FIOFNF)
    {				/* File not found */
      mlwrite ("[New file]");
      goto out;
    }
  mlwrite ("[Reading file]");
  nline = 0;
  lflag = FALSE;
  while ((s = ffgetline (line, NLINE)) == FIOSUC || s == FIOLNG)
    {
      if (s == FIOLNG)
	lflag = TRUE;
      nbytes = strlen (line);
      if ((lp1 = lalloc (nbytes)) == NULL)
	{
	  s = FIOERR;		/* Keep message on the display */
	  break;
	}
      lp2 = lback (curbp->b_linep);
      lp2->l_fp = lp1;
      lp1->l_fp = curbp->b_linep;
      lp1->l_bp = lp2;
      curbp->b_linep->l_bp = lp1;
      for (i = 0; i < nbytes; ++i)
	lputc (lp1, i, line[i]);
      ++nline;
    }
  ffclose ();			/* Ignore errors */
  if (s == FIOEOF)
    {				/* Don't zap message! */
      if (nline == 1)
	mlwrite ("[Read 1 line]");
      else
	mlwrite ("[Read %d lines]", nline);
    }
  if (lflag)
    mlwrite ("[Read %d line(s), Long lines wrapped]", nline);
 out:
  for (wp = wheadp; wp != NULL; wp = wp->w_wndp)
    {
      if (wp->w_bufp == curbp)
	{
	  wp->w_linep = lforw (curbp->b_linep);
	  wp->w_dotp = lforw (curbp->b_linep);
	  wp->w_doto = 0;
	  wp->w_markp = NULL;
	  wp->w_marko = 0;
	  wp->w_flag |= WFMODE | WFHARD;
	}
    }
  if (s == FIOERR || s == FIOFNF) /* False if error */
    return (FALSE);
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
leaq 0x857b(%rip), %r12      # 0xca28
movq (%r12), %r14
movq %r14, %rdi
callq 0x2b73
cmpl $0x1, %eax
jne 0x4639
andb $-0x4, 0x32(%r14)
addq $0x33, %r14
pushq $0x50
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2070
movq %rbx, %rdi
callq 0x47d4
movl %eax, %ebx
cmpl $0x3, %eax
je 0x45f4
cmpl $0x1, %ebx
jne 0x4507
leaq 0x3cd3(%rip), %rdi      # 0x81cb
xorl %eax, %eax
callq 0x3dec
pushq $0x1
popq %rbx
jmp 0x45f4
leaq 0x3cc8(%rip), %rdi      # 0x81d6
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x3dec
leaq 0x10(%rsp), %r14
pushq $0x3
popq %rbx
xorl %ebp, %ebp
movl $0x0, 0xc(%rsp)
movq %r14, %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x48b5
testl %eax, %eax
je 0x4547
cmpl $0x4, %eax
jne 0x45aa
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
movq %r14, %rdi
callq 0x20d0
movq %rax, %r15
movl %r15d, %edi
xorl %eax, %eax
callq 0x4960
testq %rax, %rax
je 0x45ac
movq (%r12), %rcx
movq 0x28(%rcx), %rcx
movq 0x8(%rcx), %rcx
movq %rax, (%rcx)
movq (%r12), %rdx
movq 0x28(%rdx), %rdx
movq %rdx, (%rax)
movq %rcx, 0x8(%rax)
movq (%r12), %rcx
movq 0x28(%rcx), %rcx
movq %rax, 0x8(%rcx)
testl %r15d, %r15d
cmovlel %r13d, %r15d
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x45a6
movb 0x10(%rsp,%rcx), %dl
movb %dl, 0x18(%rax,%rcx)
incq %rcx
jmp 0x4594
incl %ebp
jmp 0x452a
movl %eax, %ebx
xorl %eax, %eax
callq 0x4825
cmpl $0x2, %ebx
jne 0x45dd
cmpl $0x1, %ebp
jne 0x45cd
leaq 0x3c21(%rip), %rdi      # 0x81e5
xorl %eax, %eax
callq 0x3dec
jmp 0x45dd
leaq 0x3c1f(%rip), %rdi      # 0x81f3
movl %ebp, %esi
xorl %eax, %eax
callq 0x3dec
cmpl $0x0, 0xc(%rsp)
je 0x45f4
leaq 0x3c18(%rip), %rdi      # 0x8203
movl %ebp, %esi
xorl %eax, %eax
callq 0x3dec
movq (%r12), %rax
leaq 0x8451(%rip), %rcx      # 0xca50
xorps %xmm0, %xmm0
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x462e
cmpq %rax, 0x8(%rcx)
jne 0x4602
movq 0x28(%rax), %rdx
movq (%rdx), %rdx
movq %rdx, 0x10(%rcx)
movq %rdx, 0x18(%rcx)
andq $0x0, 0x30(%rcx)
movups %xmm0, 0x20(%rcx)
orb $0x18, 0x3b(%rcx)
jmp 0x4602
andl $-0x3, %ebx
xorl %eax, %eax
cmpl $0x1, %ebx
setne %al
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq