// File: /workspace/github_c_makefile_star2_O1/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 0x58dc
movq 0x8(%rbx), %rsi
leaq 0x3aa9(%rip), %rdi      # 0x9378
callq 0x2170
testl %eax, %eax
je 0x5aec
xorl %eax, %eax
callq 0x78c4
movabsq $0x686374617263732a, %rax # imm = 0x686374617263732A
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movw $0x2a, 0x8(%rdi)
callq 0x5aff
xorl %eax, %eax
callq 0x349c
xorl %eax, %eax
callq 0x3705
cmpl $0x2, %ebp
jl 0x59f2
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 0x4b02
testb $0x1, %r15b
je 0x596b
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2a56
movq %rax, %r15
leaq 0x33(%rax), %rdi
movq (%rbx,%rbp,8), %rsi
movl $0x50, %edx
callq 0x2070
movb $0x0, 0x30(%r15)
jmp 0x59e3
movq 0x80c6(%rip), %r13      # 0xda38
movq (%rbx,%rbp,8), %rsi
movq %r14, %rdi
callq 0x4b02
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 0x4b54
cmpl $0x2, %eax
jne 0x59c9
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 0x592c
movl $0x0, 0x8044(%rip)      # 0xda40
movq 0x8045(%rip), %rax      # 0xda48
orb $0x10, 0x3b(%rax)
leaq 0x7e5a(%rip), %r14      # 0xd868
leaq 0x775b(%rip), %r15      # 0xd170
addq $0x1f4, %r15            # imm = 0x1F4
leaq 0x39d4(%rip), %rbx      # 0x93f7
xorl %eax, %eax
callq 0x3705
callq 0x5cb0
movl %eax, %ebp
cmpl $0x0, 0x7ffc(%rip)      # 0xda34
je 0x5a48
xorl %eax, %eax
callq 0x33c8
xorl %eax, %eax
callq 0x3705
cmpl $0x158, %ebp            # imm = 0x158
jne 0x5a76
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 0x7fd3(%rip), %rax      # 0xda50
testq %rax, %rax
je 0x5ad9
cmpl $0x429, %ebp            # imm = 0x429
setne %cl
cmpq %r15, %rax
seta %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x5acb
xorl %eax, %eax
callq *0x50(%r14)
cmpq $0x0, 0x7faa(%rip)      # 0xda50
je 0x5abc
movw $0x429, 0x76bf(%rip)    # imm = 0x429
movq $0x0, 0x7f94(%rip) # 0xda50
movq %rbx, %rdi
xorl %eax, %eax
callq 0x43cc
jmp 0x5a23
leaq 0x2(%rax), %rcx
movq %rcx, 0x7f7a(%rip)      # 0xda50
movw %bp, (%rax)
movl %ebp, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0x5bb0
jmp 0x5a23
leaq 0x3879(%rip), %rdi      # 0x936c
callq 0x2080
xorl %edi, %edi
callq 0x2260