// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
leaq 0xad1d(%rip), %rax      # 0x10b40
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5fbb
movq -0x18(%rbp), %rax
movsbl 0x32(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x5fa9
movq -0x18(%rbp), %rdi
addq $0x33, %rdi
movq -0x10(%rbp), %rsi
callq 0x2180
cmpl $0x0, %eax
jne 0x5fa9
leaq 0xabde(%rip), %rax      # 0x10a48
movq (%rax), %rcx
movb 0x31(%rcx), %al
addb $-0x1, %al
movb %al, 0x31(%rcx)
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x5eed
leaq 0xabd4(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x18(%rax), %rcx
leaq 0xabb6(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x8(%rax)
leaq 0xabb8(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x20(%rax), %rcx
leaq 0xab9a(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x10(%rax)
leaq 0xab9c(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x28(%rax), %rcx
leaq 0xab7e(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x18(%rax)
leaq 0xab80(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x30(%rax), %rcx
leaq 0xab62(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rdi
callq 0x2d50
leaq 0xab5b(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
leaq 0xab49(%rip), %rax      # 0x10a58
movq (%rax), %rax
movsbl 0x39(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movl %ecx, %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x5f52
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0xab03(%rip), %rcx      # 0x10a48
movq (%rcx), %rcx
cmpq 0x28(%rcx), %rax
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x5f5b
jmp 0x5f69
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x5f21
movq -0x20(%rbp), %rcx
leaq 0xaae4(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq %rcx, 0x10(%rax)
leaq 0xaad6(%rip), %rax      # 0x10a58
movq (%rax), %rax
movsbl 0x3b(%rax), %ecx
orl $0x18, %ecx
movb %cl, 0x3b(%rax)
leaq 0x6352(%rip), %rdi      # 0xc2e8
movb $0x0, %al
callq 0x56d0
movl $0x1, -0x4(%rbp)
jmp 0x6127
jmp 0x5fab
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x5e2a
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6190
leaq -0x30(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
movb $0x0, %al
callq 0x31c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x6021
leaq -0x30(%rbp), %rsi
leaq 0x6309(%rip), %rdi      # 0xc2f5
movl $0x10, %edx
callq 0x5d40
movl %eax, -0x38(%rbp)
cmpl $0x2, -0x38(%rbp)
jne 0x600a
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6127
cmpl $0x0, -0x38(%rbp)
jne 0x601f
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6190
jmp 0x6021
jmp 0x5fc8
cmpq $0x0, -0x18(%rbp)
jne 0x605e
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x31c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x605e
leaq 0x62b8(%rip), %rdi      # 0xc303
movb $0x0, %al
callq 0x56d0
movl $0x0, -0x4(%rbp)
jmp 0x6127
leaq 0xa9e3(%rip), %rax      # 0x10a48
movq (%rax), %rcx
movb 0x31(%rcx), %al
addb $-0x1, %al
movb %al, 0x31(%rcx)
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x60e8
leaq 0xa9d9(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x18(%rax), %rcx
leaq 0xa9bb(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x8(%rax)
leaq 0xa9bd(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x20(%rax), %rcx
leaq 0xa99f(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x10(%rax)
leaq 0xa9a1(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x28(%rax), %rcx
leaq 0xa983(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x18(%rax)
leaq 0xa985(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x30(%rax), %rcx
leaq 0xa967(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
leaq 0xa955(%rip), %rax      # 0x10a48
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
leaq 0xa957(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq %rcx, 0x8(%rax)
leaq 0xa939(%rip), %rax      # 0x10a48
movq (%rax), %rax
movb 0x31(%rax), %cl
addb $0x1, %cl
movb %cl, 0x31(%rax)
movq -0x10(%rbp), %rdi
callq 0x6270
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq