// File: /workspace/github_c_makefile_star2_O0/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
subq $0xc0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xeb1(%rip), %rax       # 0x20b1
movq %rax, -0x20(%rbp)
leaq -0xa0(%rbp), %rdi
leaq 0x2b0e(%rip), %rsi      # 0x3d20
movl $0x80, %edx
callq 0x1050
movq $0x0, -0xa8(%rbp)
movl $0x0, -0xac(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x2e21(%rip)      # 0x4060
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0xe64(%rip), %rdx       # 0x20b1
xorl %eax, %eax
movl %eax, %r8d
leaq -0xa0(%rbp), %rcx
callq 0x1080
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xb4(%rbp)
subl $-0x1, %eax
je 0x12e9
jmp 0x1271
movl -0xb4(%rbp), %eax
subl $0x3f, %eax
je 0x12d5
jmp 0x127e
movl -0xb4(%rbp), %eax
subl $0x68, %eax
je 0x12a5
jmp 0x128b
movl -0xb4(%rbp), %eax
subl $0x6f, %eax
je 0x12b6
jmp 0x1298
movl -0xb4(%rbp), %eax
subl $0x76, %eax
je 0x12c9
jmp 0x12eb
movq 0x2d04(%rip), %rax      # 0x3fb0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x1190
movq 0x2d03(%rip), %rax      # 0x3fc0
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
jmp 0x12f0
movl $0x1, -0xac(%rbp)
jmp 0x12f0
movq 0x2cf4(%rip), %rax      # 0x3fd0
movq (%rax), %rdi
movl $0x1, %esi
callq 0x1190
jmp 0x12f0
callq 0x1040
jmp 0x12f2
cmpl $-0x1, -0x14(%rbp)
jne 0x123f
cmpl $0x0, -0xac(%rbp)
je 0x134f
movq 0x2ccc(%rip), %rax      # 0x3fd8
movl (%rax), %eax
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x134d
movq -0x10(%rbp), %rax
movslq -0xb0(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd95(%rip), %rdi       # 0x20ca
movb $0x0, %al
callq 0x1030
movl -0xb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0(%rbp)
jmp 0x1314
jmp 0x134f
xorl %eax, %eax
addq $0xc0, %rsp
popq %rbp
retq