// File: /workspace/github_c_makefile_star2_O3/hughbarney[P]pEmacs/file.c
// Function: getfile
int getfile (char fname[])
{
  BUFFER *bp;
  LINE *lp;
  char bname[NBUFN];		/* buffer name to put file */
  int i, s;

  for (bp = bheadp; bp != (BUFFER*)0; bp = bp->b_bufp)
    {
      if ((bp->b_flag & BFTEMP) == 0 && strcmp (bp->b_fname, fname) == 0)
	{
	  if (--curbp->b_nwnd == 0)
	    {
	      curbp->b_dotp = curwp->w_dotp;
	      curbp->b_doto = curwp->w_doto;
	      curbp->b_markp = curwp->w_markp;
	      curbp->b_marko = curwp->w_marko;
	    }
	  swbuffer (bp);
	  lp = curwp->w_dotp;
	  i = curwp->w_ntrows / 2;
	  while (i-- && lback (lp) != curbp->b_linep)
	    lp = lback (lp);
	  curwp->w_linep = lp;
	  curwp->w_flag |= WFMODE | WFHARD;
	  mlwrite ("[Old buffer]");
	  return (TRUE);
	}
    }
  makename (bname, fname);	/* New buffer name */
  while ((bp = bfind (bname, FALSE, 0)) != (BUFFER*)0)
    {
      s = mlreply ("Buffer name: ", bname, NBUFN);
      if (s == ABORT)		/* ^G to just quit */
	return (s);
      if (s == FALSE)
	{			/* CR to clobber it */
	  makename (bname, fname);
	  break;
	}
    }
  if (bp == (BUFFER*)0 && (bp = bfind (bname, TRUE, 0)) == (BUFFER*)0)
    {
      mlwrite ("Cannot create buffer");
      return (FALSE);
    }
  if (--curbp->b_nwnd == 0)
    {				/* Undisplay */
      curbp->b_dotp = curwp->w_dotp;
      curbp->b_doto = curwp->w_doto;
      curbp->b_markp = curwp->w_markp;
      curbp->b_marko = curwp->w_marko;
    }
  curbp = bp;			/* Switch to it */
  curwp->w_bufp = bp;
  curbp->b_nwnd++;
  return (readin (fname));	/* Read it in */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x93a8(%rip), %rax      # 0xdb30
movq (%rax), %r14
testq %r14, %r14
je 0x47b0
testb $0x1, 0x32(%r14)
jne 0x47ab
leaq 0x33(%r14), %rdi
movq %rbx, %rsi
callq 0x2170
testl %eax, %eax
je 0x4879
movq (%r14), %r14
jmp 0x478b
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4970
leaq 0x49e3(%rip), %r12      # 0x91a8
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2a42
testq %rax, %rax
je 0x4807
movq %rax, %r14
movq %r12, %rdi
movq %r15, %rsi
movl $0x10, %edx
callq 0x4705
movl %eax, %ebp
cmpl $0x2, %eax
je 0x491c
testl %ebp, %ebp
jne 0x47c5
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x4970
jmp 0x4826
xorl %ebp, %ebp
movq %rsp, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2a42
movq %rax, %r14
testq %rax, %rax
je 0x490e
leaq 0x920b(%rip), %rax      # 0xda38
movq (%rax), %rcx
decb 0x31(%rcx)
leaq 0x920e(%rip), %rdx      # 0xda48
movq (%rdx), %rdx
jne 0x485f
movq 0x18(%rdx), %rsi
movq %rsi, 0x8(%rcx)
movq 0x20(%rdx), %rsi
movq %rsi, 0x10(%rcx)
movq 0x28(%rdx), %rsi
movq %rsi, 0x18(%rcx)
movq 0x30(%rdx), %rsi
movq %rsi, 0x20(%rcx)
movq %r14, (%rax)
movq %r14, 0x8(%rdx)
incb 0x31(%r14)
movq %rbx, %rdi
callq 0x49c2
movl %eax, %ebp
jmp 0x491c
leaq 0x91b8(%rip), %rbx      # 0xda38
movq (%rbx), %rax
decb 0x31(%rax)
jne 0x48b2
leaq 0x91b9(%rip), %rcx      # 0xda48
movq (%rcx), %rcx
movq 0x18(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x20(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x28(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq 0x30(%rcx), %rcx
movq %rcx, 0x20(%rax)
movq %r14, %rdi
callq 0x2845
leaq 0x9187(%rip), %rax      # 0xda48
movq (%rax), %rax
movq 0x18(%rax), %rcx
movb 0x39(%rax), %dl
movl %edx, %esi
shrb $0x7, %sil
addb %dl, %sil
sarb %sil
movsbl %sil, %edx
movq (%rbx), %rsi
incl %edx
movq %rcx, %rdi
decl %edx
je 0x48f1
movq 0x8(%rdi), %rcx
cmpq 0x28(%rsi), %rcx
jne 0x48e0
movq %rdi, 0x10(%rax)
orb $0x18, 0x3b(%rax)
leaq 0x489b(%rip), %rdi      # 0x919b
xorl %eax, %eax
callq 0x4246
movl $0x1, %ebp
jmp 0x491c
leaq 0x48a1(%rip), %rdi      # 0x91b6
xorl %eax, %eax
callq 0x4246
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq