// File: /workspace/github_c_makefile_star2_O3/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 0x579c
movq 0x8(%rbx), %rsi
leaq 0x3be9(%rip), %rdi      # 0x9378
callq 0x2170
testl %eax, %eax
je 0x59ac
xorl %eax, %eax
callq 0x7938
movabsq $0x686374617263732a, %rax # imm = 0x686374617263732A
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movw $0x2a, 0x8(%rdi)
callq 0x59bf
xorl %eax, %eax
callq 0x345a
xorl %eax, %eax
callq 0x370f
cmpl $0x2, %ebp
jl 0x58b2
movl %ebp, %r12d
movl $0x1, %ebp
leaq 0x10(%rsp), %r14
xorl %r15d, %r15d
movq %r12, 0x8(%rsp)
movq (%rbx,%rbp,8), %rsi
movq %r14, %rdi
callq 0x4970
testb $0x1, %r15b
je 0x582b
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2a42
movq %rax, %r15
leaq 0x33(%rax), %rdi
movq (%rbx,%rbp,8), %rsi
movl $0x50, %edx
callq 0x2070
movb $0x0, 0x30(%r15)
jmp 0x58a3
movq 0x8206(%rip), %r13      # 0xda38
movq (%rbx,%rbp,8), %rsi
movq %r14, %rdi
callq 0x4970
leaq 0x83(%r13), %r15
movl $0x10, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x2070
leaq 0x33(%r13), %r12
movq (%rbx,%rbp,8), %rsi
movl $0x50, %edx
movq %r12, %rdi
callq 0x2070
movq (%rbx,%rbp,8), %rdi
callq 0x49c2
cmpl $0x2, %eax
jne 0x5889
xorl %eax, %eax
movb %al, 0x4(%r15)
movl $0x6e69616d, (%r15)     # imm = 0x6E69616D
movb %al, (%r12)
movq 0x28(%r13), %rax
movq %rax, 0x8(%r13)
movq $0x0, 0x10(%r13)
movq 0x8(%rsp), %r12
leaq 0x10(%rsp), %r14
incq %rbp
movb $0x1, %r15b
cmpq %rbp, %r12
jne 0x57ec
movl $0x0, 0x8184(%rip)      # 0xda40
movq 0x8185(%rip), %rax      # 0xda48
orb $0x10, 0x3b(%rax)
leaq 0x7f9a(%rip), %r14      # 0xd868
leaq 0x789b(%rip), %r15      # 0xd170
addq $0x1f4, %r15            # imm = 0x1F4
leaq 0x3b14(%rip), %rbx      # 0x93f7
xorl %eax, %eax
callq 0x370f
callq 0x5b70
movl %eax, %ebp
cmpl $0x0, 0x813c(%rip)      # 0xda34
je 0x5908
xorl %eax, %eax
callq 0x3384
xorl %eax, %eax
callq 0x370f
cmpl $0x158, %ebp            # imm = 0x158
jne 0x5936
xorl %eax, %eax
callq *0x20(%r14)
leal -0x61(%rax), %ecx
leal -0x20(%rax), %edx
cmpl $0x1a, %ecx
cmovael %eax, %edx
movl %edx, %ebp
orl $0x140, %ebp            # imm = 0x140
cmpl $0x20, %edx
cmovael %edx, %ebp
orl $0x400, %ebp            # imm = 0x400
movq 0x8113(%rip), %rax      # 0xda50
testq %rax, %rax
je 0x5999
cmpl $0x429, %ebp            # imm = 0x429
setne %cl
cmpq %r15, %rax
seta %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x598b
xorl %eax, %eax
callq *0x50(%r14)
cmpq $0x0, 0x80ea(%rip)      # 0xda50
je 0x597c
movw $0x429, 0x77ff(%rip)    # imm = 0x429
movq $0x0, 0x80d4(%rip) # 0xda50
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4246
jmp 0x58e3
leaq 0x2(%rax), %rcx
movq %rcx, 0x80ba(%rip)      # 0xda50
movw %bp, (%rax)
movl %ebp, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0x5a70
jmp 0x58e3
leaq 0x39b9(%rip), %rdi      # 0x936c
callq 0x2080
xorl %edi, %edi
callq 0x2260