// File: /workspace/github_c_makefile_star2_O3/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 $0x6f, %eax
je 0x1213
cmpl $0x67, %eax
jle 0x123a
cmpl $0x76, %eax
jne 0x1293
movb $0x1, %r13b
jmp 0x1213
cmpl $-0x1, %eax
jne 0x12a9
movq 0x2d9a(%rip), %rax      # 0x3fe0
movl (%rax), %eax
cmpl %eax, %ebx
setg %cl
andb %cl, %r13b
cmpb $0x1, %r13b
jne 0x127f
movslq %eax, %rcx
leaq (%r14,%rcx,8), %r15
subl %eax, %ebx
leaq 0xe64(%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 0x1269
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x68, %eax
jne 0x12c2
movq 0x2d21(%rip), %rax      # 0x3fc0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x118c
cmpl $0x3f, %eax
jne 0x12c2
movq 0x2d23(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
movl $0x1, %esi
callq 0x118c
callq 0x1040