// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x10(%rbp)
leaq 0xa7c2(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x3530
movl %eax, -0x23c(%rbp)
cmpl $0x1, %eax
je 0x62af
movl -0x23c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x658f
movq -0x30(%rbp), %rax
movsbl 0x32(%rax), %ecx
andl $-0x4, %ecx
movb %cl, 0x32(%rax)
movq -0x30(%rbp), %rdi
addq $0x33, %rdi
movq -0x10(%rbp), %rsi
movl $0x50, %edx
callq 0x2070
movq -0x10(%rbp), %rdi
callq 0x6870
movl %eax, -0x23c(%rbp)
cmpl $0x3, %eax
jne 0x62ec
jmp 0x64ca
cmpl $0x1, -0x23c(%rbp)
jne 0x6308
leaq 0x601c(%rip), %rdi      # 0xc318
movb $0x0, %al
callq 0x56d0
jmp 0x64ca
leaq 0x6014(%rip), %rdi      # 0xc323
movb $0x0, %al
callq 0x56d0
movl $0x0, -0x238(%rbp)
movl $0x0, -0x244(%rbp)
leaq -0x230(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x69e0
movl %eax, %ecx
movl %ecx, -0x23c(%rbp)
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x245(%rbp)
je 0x6360
cmpl $0x4, -0x23c(%rbp)
sete %al
movb %al, -0x245(%rbp)
movb -0x245(%rbp), %al
testb $0x1, %al
jne 0x636f
jmp 0x646c
cmpl $0x4, -0x23c(%rbp)
jne 0x6382
movl $0x1, -0x244(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x20e0
movl %eax, -0x234(%rbp)
movl -0x234(%rbp), %edi
movb $0x0, %al
callq 0x6b00
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x63ba
movl $0x3, -0x23c(%rbp)
jmp 0x646c
leaq 0xa687(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq 0xa666(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq 0x28(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
leaq 0xa641(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x240(%rbp)
movl -0x240(%rbp), %eax
cmpl -0x234(%rbp), %eax
jge 0x6458
movslq -0x240(%rbp), %rax
movb -0x230(%rbp,%rax), %dl
movq -0x18(%rbp), %rax
movslq -0x240(%rbp), %rcx
movb %dl, 0x18(%rax,%rcx)
movl -0x240(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x240(%rbp)
jmp 0x641c
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x632a
movb $0x0, %al
callq 0x6910
cmpl $0x2, -0x23c(%rbp)
jne 0x64ab
cmpl $0x1, -0x238(%rbp)
jne 0x6495
leaq 0x5ea6(%rip), %rdi      # 0xc332
movb $0x0, %al
callq 0x56d0
jmp 0x64a9
movl -0x238(%rbp), %esi
leaq 0x5e9e(%rip), %rdi      # 0xc340
movb $0x0, %al
callq 0x56d0
jmp 0x64ab
cmpl $0x0, -0x244(%rbp)
je 0x64c8
movl -0x238(%rbp), %esi
leaq 0x5e8f(%rip), %rdi      # 0xc350
movb $0x0, %al
callq 0x56d0
jmp 0x64ca
leaq 0xa59f(%rip), %rax      # 0x10a70
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x656d
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0xa556(%rip), %rcx      # 0x10a48
cmpq (%rcx), %rax
jne 0x655b
leaq 0xa54a(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
leaq 0xa531(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x28(%rbp), %rax
movsbl 0x3b(%rax), %ecx
orl $0x18, %ecx
movb %cl, 0x3b(%rax)
jmp 0x655d
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x64d8
cmpl $0x3, -0x23c(%rbp)
je 0x657f
cmpl $0x1, -0x23c(%rbp)
jne 0x6588
movl $0x0, -0x4(%rbp)
jmp 0x658f
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
nopl (%rax,%rax)