// File: /workspace/github_c_makefile_star2_O1/ramirezsebas[P]TP-LISTINGS/./src/capitulo_2/2.2/getopt_long.c
// Function: main
int main (int argc, char* argv[])
{
  int next_option;
  /* A string listing valid short options letters.*/
  const char* const short_options = "ho:v";
     /* An array describing valid long options. */
  const struct option long_options[] = {
    { "help",   0, NULL,'h' },
    { "output", 1, NULL,'o' },
    { "verbose",0, NULL,'v' },
    { NULL,     0, NULL, 0  }    /* Required at end of array.*/
  };
  
  /* The name of the file to receive program output, or NULL for
     standard output. */
  const char* output_filename = NULL;
  /* Whether to display verbose messages. */
  int verbose = 0;

  /* Remember the name of the program, to incorporate in messages.
     The name is stored in argv[0]. */
  program_name = argv[0];
  
  do {
     next_option = getopt_long (argc, argv, short_options,
    			       long_options, NULL);
    switch (next_option)
      {
      case 'h':  /* -h or --help */
	/* User has requested usage information. Print it to standard
	   output, and exit with exit code zero (normal termination). */
		print_usage (stdout, 0);

      case 'o':    /* -o or --output */
	/* This option takes an argument, the name of the output file.*/
	   output_filename = optarg;
	   break;

      case 'v':   /* -v or --verbose */
		verbose = 1;
		break;
      
      case '?':
	/* The user specified an invalid option. */
	/* Print usage information to standard error, and exit with exit
	   code one (indicating abnormal termination). */
		print_usage (stderr, 1);

      case -1:
		break;
	/* Done with options. */

      default:
	/* Something else: unexpected.*/
		abort ();
      }
  }
  while (next_option != -1);
  
  /* Done with options. OPTIND points to first nonoption argument.
     For demonstration purposes, print them if the verbose option was
     specified. */
  if (verbose) {
    int i;
    for (i = optind; i < argc; ++i)
      printf ("Argument: %s\n", argv[i]);
  }
  
  /* The main program goes here. */
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movl %edi, %ebx
leaq 0x2b43(%rip), %rsi      # 0x3d30
leaq -0xb0(%rbp), %r15
movl $0x10, %ecx
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq (%r14), %rax
movq %rax, 0x2e57(%rip)      # 0x4060
xorl %r13d, %r13d
leaq 0xe9e(%rip), %r12       # 0x20b1
movl %ebx, %edi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x1070
cmpl $0x6e, %eax
jle 0x1241
cmpl $0x6f, %eax
je 0x1246
cmpl $0x76, %eax
jne 0x12d2
movl $0x1, %r13d
jmp 0x1246
cmpl $-0x1, %eax
jne 0x12a3
cmpl $-0x1, %eax
jne 0x1213
testl %r13d, %r13d
setne %cl
movq 0x2d88(%rip), %rax      # 0x3fe0
movl (%rax), %eax
cmpl %eax, %ebx
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x128f
movslq %eax, %rcx
leaq (%r14,%rcx,8), %r15
subl %eax, %ebx
leaq 0xe54(%rip), %r14       # 0x20ca
xorl %r12d, %r12d
movq (%r15,%r12,8), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1030
incq %r12
cmpl %r12d, %ebx
jne 0x1279
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3f, %eax
je 0x12be
cmpl $0x68, %eax
jne 0x12d2
movq 0x2d0c(%rip), %rax      # 0x3fc0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x118c
movq 0x2d13(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
movl $0x1, %esi
callq 0x118c
callq 0x1040