// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jne 0x7b64
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x49c5(%rip), %rdi      # 0xc500
callq 0x2180
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x7b64
leaq 0x4c8b(%rip), %rdi      # 0xc7da
leaq 0x499e(%rip), %rsi      # 0xc4f4
movb $0x0, %al
callq 0x2110
xorl %edi, %edi
callq 0x2280
movb $0x0, %al
callq 0xaab0
leaq -0x30(%rbp), %rdi
leaq 0x44c6(%rip), %rsi      # 0xc03c
movl $0xa, %edx
callq 0x2070
leaq -0x30(%rbp), %rdi
callq 0x7e00
movb $0x0, %al
callq 0x4310
movl $0x1, -0x40(%rbp)
movb $0x0, %al
callq 0x46b0
movl $0x1, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x7ce3
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x6190
cmpl $0x0, -0x40(%rbp)
je 0x7c97
movq 0x8e71(%rip), %rax      # 0x10a48
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x6190
movq -0x18(%rbp), %rdi
addq $0x83, %rdi
leaq -0x30(%rbp), %rsi
movl $0x10, %edx
callq 0x2070
movq -0x18(%rbp), %rdi
addq $0x33, %rdi
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x50, %edx
callq 0x2070
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x6270
cmpl $0x2, %eax
jne 0x7c72
movq -0x18(%rbp), %rdi
addq $0x83, %rdi
leaq 0x48bb(%rip), %rsi      # 0xc50a
movl $0x5, %edx
callq 0x2070
movq -0x18(%rbp), %rdi
addq $0x33, %rdi
leaq 0x4c71(%rip), %rsi      # 0xc8d9
movl $0x1, %edx
callq 0x2070
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
movl $0x0, -0x40(%rbp)
jmp 0x7cd3
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x31c0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
addq $0x33, %rdi
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0x50, %edx
callq 0x2070
movq -0x18(%rbp), %rax
movb $0x0, 0x30(%rax)
jmp 0x7cd5
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x7ba5
movl $0x0, 0x8d63(%rip)      # 0x10a50
movq 0x8d64(%rip), %rax      # 0x10a58
movsbl 0x3b(%rax), %ecx
orl $0x10, %ecx
movb %cl, 0x3b(%rax)
movb $0x0, %al
callq 0x46b0
callq 0x80a0
movl %eax, -0x34(%rbp)
cmpl $0x0, 0x8d30(%rip)      # 0x10a44
je 0x7d24
movb $0x0, %al
callq 0x4260
movb $0x0, %al
callq 0x46b0
movl $0x0, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
cmpl $0x158, -0x34(%rbp)     # imm = 0x158
jne 0x7d48
callq 0x8100
orl $0x400, %eax            # imm = 0x400
movl %eax, -0x34(%rbp)
cmpq $0x0, 0x8d10(%rip)      # 0x10a60
je 0x7ddf
cmpl $0x429, -0x34(%rbp)     # imm = 0x429
je 0x7d83
leaq 0x841a(%rip), %rax      # 0x10180
addq $0x1f4, %rax            # imm = 0x1F4
cmpq %rax, 0x8ced(%rip)      # 0x10a60
jbe 0x7d83
xorl %esi, %esi
movl %esi, %edi
callq 0x83d0
jmp 0x7cfe
cmpl $0x0, -0x38(%rbp)
je 0x7dc1
movq 0x8cd0(%rip), %rax      # 0x10a60
movq %rax, %rcx
addq $0x2, %rcx
movq %rcx, 0x8cc2(%rip)      # 0x10a60
movw $0x155, (%rax)          # imm = 0x155
movl -0x3c(%rbp), %eax
movw %ax, %cx
movq 0x8cb0(%rip), %rax      # 0x10a60
movq %rax, %rdx
addq $0x2, %rdx
movq %rdx, 0x8ca2(%rip)      # 0x10a60
movw %cx, (%rax)
movl -0x34(%rbp), %eax
movw %ax, %cx
movq 0x8c92(%rip), %rax      # 0x10a60
movq %rax, %rdx
addq $0x2, %rdx
movq %rdx, 0x8c84(%rip)      # 0x10a60
movw %cx, (%rax)
movl -0x34(%rbp), %edi
movl -0x38(%rbp), %esi
movl -0x3c(%rbp), %edx
callq 0x7f30
jmp 0x7cfe
nopw %cs:(%rax,%rax)