// File: /workspace/github_c_makefile_star2_O2/hughbarney[P]pEmacs/main.c
// Function: main
int main (int argc, char *argv[])
{
  BUFFER *bp;
  char bname[NBUFN];		/* buffer name of file to read */
  int c, f, n;
  int ffile;			/* first file flag */
  int carg;			/* current arg to scan */

  if (argc == 2 && 0 == strcmp("--version", argv[1]))
  {
     printf("%s\n", version);
     exit(0);
  }


  /* initialize the editor and process the startup file */
  getwinsize();			/* find out the "real" screen size */
  strncpy (bname, "*scratch*", 10);	/* default buffer name */
  edinit (bname);		/* Buffers, windows */
  vtinit ();			/* Displays */
  ffile = TRUE;			/* no file to edit yet */
  update ();			/* let the user know we are here */

  /* scan through the command line and get the files to edit */
  for (carg = 1; carg < argc; ++carg)
    {
      /* set up a buffer for this file */
      makename (bname, argv[carg]);

      /* if this is the first file, read it in */
      if (ffile)
	{
	  bp = curbp;
	  makename (bname, argv[carg]);
	  strncpy (bp->b_bname, bname, NBUFN);
	  strncpy (bp->b_fname, argv[carg], NFILEN);
	  if (readin (argv[carg]) == ABORT)
	    {
	      strncpy (bp->b_bname, "main", 5);
	      strncpy (bp->b_fname, "", 1);
	    }
	  bp->b_dotp = bp->b_linep;
	  bp->b_doto = 0;
	  ffile = FALSE;
	}
      else
	{
	  /* set this to inactive */
	  bp = bfind (bname, TRUE, 0);
	  strncpy (bp->b_fname, argv[carg], NFILEN);
	  bp->b_active = FALSE;
	}
    }

  /* setup to process commands */
  lastflag = 0;			/* Fake last flags */
  curwp->w_flag |= WFMODE;	/* and force an update */

 loop:
  update ();			/* Fix up the screen */
  c = getkey (TRUE);

  if (mpresf != FALSE)
    {
      mlerase ();
      update ();
    }
  f = FALSE;
  n = 1;

  if (c == (CTRL | 'X'))       /* ^X is a prefix */
    c = CTLX | getctl ();
  if (kbdmip != NULL)
    {				 /* Save macro strokes */
      if (c != (CTLX | ')') && kbdmip > &kbdm[NKBDM - 6])
	{
	  ctrlg (FALSE, 0);
	  goto loop;
	}
      if (f != FALSE)
	{
	  *kbdmip++ = (CTRL | 'U');
	  *kbdmip++ = n;
	}
      *kbdmip++ = c;
    }
  execute (c, f, n);	       /* Do it */
  goto loop;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movl %edi, %ebp
cmpl $0x2, %edi
jne 0x5198
movq 0x8(%rbx), %rsi
leaq 0x31ed(%rip), %rdi      # 0x8378
callq 0x2160
testl %eax, %eax
je 0x533d
xorl %eax, %eax
callq 0x6eb2
movabsq $0x686374617263732a, %rax # imm = 0x686374617263732A
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
movw $0x2a, 0x8(%r14)
movq %r14, %rdi
callq 0x5350
xorl %eax, %eax
callq 0x32ba
xorl %eax, %eax
callq 0x34fc
movslq %ebp, %r12
pushq $0x1
popq %r15
xorl %ebp, %ebp
movq %r12, 0x8(%rsp)
cmpq %r12, %r15
jge 0x529c
movq (%rbx,%r15,8), %rsi
movq %r14, %rdi
callq 0x4449
testb $0x1, %bpl
je 0x5220
movq %r14, %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x29df
movq %rax, %r13
leaq 0x33(%rax), %rdi
movq (%rbx,%r15,8), %rsi
pushq $0x50
popq %rdx
callq 0x2070
movb $0x0, 0x30(%r13)
jmp 0x5291
movq 0x7801(%rip), %r12      # 0xca28
movq (%rbx,%r15,8), %rsi
movq %r14, %rdi
callq 0x4449
leaq 0x83(%r12), %r13
movq %r13, %rdi
movq %r14, %rsi
pushq $0x10
popq %rdx
callq 0x2070
leaq 0x33(%r12), %rbp
movq (%rbx,%r15,8), %rsi
movq %rbp, %rdi
pushq $0x50
popq %rdx
callq 0x2070
movq (%rbx,%r15,8), %rdi
callq 0x4492
cmpl $0x2, %eax
jne 0x527c
xorl %eax, %eax
movb %al, 0x4(%r13)
movl $0x6e69616d, (%r13)     # imm = 0x6E69616D
movb %al, (%rbp)
movq 0x28(%r12), %rax
movq %rax, 0x8(%r12)
andq $0x0, 0x10(%r12)
movq 0x8(%rsp), %r12
incq %r15
movb $0x1, %bpl
jmp 0x51dc
andl $0x0, 0x778d(%rip)      # 0xca30
movq 0x778e(%rip), %rax      # 0xca38
orb $0x10, 0x3b(%rax)
pushq $0x1
popq %rbx
leaq 0x6ea8(%rip), %r14      # 0xc160
addq $0x1f4, %r14            # imm = 0x1F4
xorl %eax, %eax
callq 0x34fc
callq 0x54c7
movl %eax, %ebp
cmpl $0x0, 0x7750(%rip)      # 0xca24
je 0x52e4
xorl %eax, %eax
callq 0x324c
xorl %eax, %eax
callq 0x34fc
cmpl $0x158, %ebp            # imm = 0x158
jne 0x52f9
callq 0x54f4
movl %eax, %ebp
orl $0x400, %ebp            # imm = 0x400
movq 0x7740(%rip), %rax      # 0xca40
testq %rax, %rax
je 0x5330
cmpl $0x429, %ebp            # imm = 0x429
setne %cl
cmpq %r14, %rax
seta %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x5322
callq 0x5694
jmp 0x52bf
leaq 0x2(%rax), %rcx
movq %rcx, 0x7713(%rip)      # 0xca40
movw %bp, (%rax)
movl %ebp, %edi
xorl %esi, %esi
movl %ebx, %edx
callq 0x53f1
jmp 0x52bf
leaq 0x3028(%rip), %rdi      # 0x836c
callq 0x2080
xorl %edi, %edi
callq 0x2250