// File: /workspace/github_c_makefile_star2_O3/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 $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
leaq 0x905b(%rip), %r12      # 0xda38
movq (%r12), %r14
movq %r14, %rdi
callq 0x2bdf
cmpl $0x1, %eax
jne 0x4b88
andb $-0x4, 0x32(%r14)
addq $0x33, %r14
movl $0x50, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2070
movq %rbx, %rdi
callq 0x4d5c
movl %eax, %ebp
cmpl $0x3, %eax
je 0x4b3a
cmpl $0x1, %ebp
jne 0x4a3b
leaq 0x47a1(%rip), %rdi      # 0x91cb
xorl %eax, %eax
callq 0x4246
movl $0x1, %ebp
jmp 0x4b3a
leaq 0x4794(%rip), %rdi      # 0x91d6
xorl %eax, %eax
callq 0x4246
movq %rsp, %r14
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %r14, %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x4e42
testl %eax, %eax
je 0x4a6f
movl %eax, %ebp
cmpl $0x4, %eax
jne 0x4ae5
movl $0x1, %r13d
movq %r14, %rdi
callq 0x20d0
movq %rax, %r15
movl %r15d, %edi
xorl %eax, %eax
callq 0x4ef4
testq %rax, %rax
je 0x4ad7
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
jle 0x4ad0
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movb (%rsp,%rcx), %dl
movb %dl, 0x18(%rax,%rcx)
incq %rcx
cmpq %rcx, %r15
jne 0x4ac1
incl %ebx
jmp 0x4a51
xorl %eax, %eax
callq 0x4daf
movl $0x3, %ebp
jmp 0x4b25
xorl %eax, %eax
callq 0x4daf
cmpl $0x2, %ebp
jne 0x4b25
cmpl $0x1, %ebx
jne 0x4b10
leaq 0x46e8(%rip), %rdi      # 0x91e5
xorl %eax, %eax
callq 0x4246
movl $0x2, %ebp
movl $0x1, %ebx
jmp 0x4b25
leaq 0x46dc(%rip), %rdi      # 0x91f3
movl %ebx, %esi
xorl %eax, %eax
callq 0x4246
movl $0x2, %ebp
testl %r13d, %r13d
je 0x4b3a
leaq 0x46d2(%rip), %rdi      # 0x9203
movl %ebx, %esi
xorl %eax, %eax
callq 0x4246
leaq 0x8f1f(%rip), %rax      # 0xda60
movq (%rax), %rax
testq %rax, %rax
je 0x4b7d
movq (%r12), %rcx
xorps %xmm0, %xmm0
cmpq %rcx, 0x8(%rax)
jne 0x4b75
movq 0x28(%rcx), %rdx
movq (%rdx), %rdx
movq %rdx, 0x10(%rax)
movq %rdx, 0x18(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
orb $0x18, 0x3b(%rax)
movq (%rax), %rax
testq %rax, %rax
jne 0x4b50
andl $-0x3, %ebp
xorl %eax, %eax
cmpl $0x1, %ebp
setne %al
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq