// File: /workspace/github_c_makefile_star2_O1/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 0x9228(%rip), %rax      # 0xdb30
movq (%rax), %r14
testq %r14, %r14
je 0x4930
testb $0x1, 0x32(%r14)
jne 0x492b
leaq 0x33(%r14), %rdi
movq %rbx, %rsi
callq 0x2170
testl %eax, %eax
je 0x4a03
movq (%r14), %r14
jmp 0x490b
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4b02
leaq 0x4863(%rip), %r12      # 0x91a8
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2a56
testq %rax, %rax
je 0x4987
movq %rax, %r14
movq %r12, %rdi
movq %r15, %rsi
movl $0x10, %edx
callq 0x4884
movl %eax, %ebp
cmpl $0x2, %eax
je 0x4aa6
testl %ebp, %ebp
jne 0x4945
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x4b02
jmp 0x49a6
xorl %ebp, %ebp
movq %rsp, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2a56
movq %rax, %r14
testq %rax, %rax
je 0x4a98
leaq 0x908b(%rip), %rax      # 0xda38
movq (%rax), %rcx
decb 0x31(%rcx)
jne 0x49df
leaq 0x908c(%rip), %rdx      # 0xda48
movq (%rdx), %rdx
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), %rdx
movq %rdx, 0x20(%rcx)
movq %r14, (%rax)
leaq 0x905f(%rip), %rax      # 0xda48
movq (%rax), %rax
movq %r14, 0x8(%rax)
incb 0x31(%r14)
movq %rbx, %rdi
callq 0x4b54
movl %eax, %ebp
jmp 0x4aa6
leaq 0x902e(%rip), %rbx      # 0xda38
movq (%rbx), %rax
decb 0x31(%rax)
jne 0x4a3c
leaq 0x902f(%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 0x2859
leaq 0x8ffd(%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 0x4a7b
movq 0x8(%rdi), %rcx
cmpq 0x28(%rsi), %rcx
jne 0x4a6a
movq %rdi, 0x10(%rax)
orb $0x18, 0x3b(%rax)
leaq 0x4711(%rip), %rdi      # 0x919b
xorl %eax, %eax
callq 0x43cc
movl $0x1, %ebp
jmp 0x4aa6
leaq 0x4717(%rip), %rdi      # 0x91b6
xorl %eax, %eax
callq 0x43cc
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq