// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x88a8(%rip), %r14      # 0xcb20
movq (%r14), %r14
testq %r14, %r14
je 0x432b
testb $0x1, 0x32(%r14)
jne 0x4278
leaq 0x33(%r14), %rdi
movq %rbx, %rsi
callq 0x2160
testl %eax, %eax
jne 0x4278
leaq 0x8786(%rip), %rbx      # 0xca28
movq (%rbx), %rax
decb 0x31(%rax)
jne 0x42d4
leaq 0x8787(%rip), %rcx      # 0xca38
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 0x27eb
leaq 0x8755(%rip), %rax      # 0xca38
movq (%rax), %rcx
movq 0x18(%rcx), %rdx
movsbl 0x39(%rcx), %eax
movb $0x2, %sil
idivb %sil
movsbl %al, %eax
movq (%rbx), %rsi
incl %eax
movq %rdx, %rdi
decl %eax
je 0x430d
movq 0x8(%rdi), %rdx
cmpq 0x28(%rsi), %rdx
jne 0x42fc
movq %rdi, 0x10(%rcx)
orb $0x18, 0x3b(%rcx)
leaq 0x3e7f(%rip), %rdi      # 0x819b
xorl %eax, %eax
callq 0x3dec
pushq $0x1
popq %rbp
jmp 0x43e7
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4449
leaq 0x3e68(%rip), %r12      # 0x81a8
pushq $0x10
popq %r13
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x29df
testq %rax, %rax
je 0x4380
movq %rax, %r14
movq %r12, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x4202
movl %eax, %ebp
cmpl $0x2, %eax
je 0x43e7
testl %ebp, %ebp
jne 0x4344
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x4449
jmp 0x4399
xorl %ebp, %ebp
movq %rsp, %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x29df
movq %rax, %r14
testq %rax, %rax
je 0x43f8
leaq 0x8688(%rip), %rax      # 0xca28
movq (%rax), %rcx
decb 0x31(%rcx)
leaq 0x868b(%rip), %rdx      # 0xca38
movq (%rdx), %rdx
jne 0x43d2
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 0x4492
movl %eax, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3db7(%rip), %rdi      # 0x81b6
xorl %eax, %eax
callq 0x3dec
jmp 0x43e7