// File: /workspace/github_cpp_makefile_star2_O2/jpbalarini[P]otsus/./framework/libparser.cpp
// Function: printusage(char const*, char const*, std::vector<optstruct*, std::allocator<optstruct*>>&, std::vector<parstruct*, std::allocator<parstruct*>>&)
void  printusage(const char *pname,
		 const char *gp,
		 vector<OptStruct*>  &opt,
		 vector<ParStruct*>  &par)
{
	
	//int nopt = opt.size();
	int npar = par.size();
	
	///// USAGE
	printf("\nusage: %s ", pname);
	for(int i=0; i < (int) strlen(gp); i++)
		if (gp[i] != ':')
		{
			printf("[-%c",gp[i]);
			
			if (i+1 < (int) strlen(gp) && gp[i+1] ==  ':') printf(" %c] ", gp[i]);
			else printf("] ");
			
		}
	
	for(int i=0; i < npar; i++)
		printf(" %s ", par[i]->name);
	
	printf("\n");
	//// PARAMETERS
	
	int j=0;
	for(int i=0; i < (int) strlen(gp); i++)
		if (gp[i] != ':')
		{
			printf("\t-%c",gp[i]);
			
			if (i+1 < (int) strlen(gp) && gp[i+1] ==  ':') {
				
				printf("  %c\t %s ", gp[i], opt[j]->comment);
				if (opt[j]->defvalue != NULL) printf("(Default: %s)",opt[j]->defvalue);
				
				printf("\n");
				
			}		
			else printf("\t %s \n", opt[j]->comment);
			
			j++;
		}
	
	
	for(int i=0; i < npar; i++)
	{
		printf("\t%s",par[i]->name);
		printf("\t %s\n", par[i]->comment);
	}
	
	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, (%rsp)
movq %rsi, %r15
movq %rdi, %rsi
movq 0x8(%rcx), %r13
subq (%rcx), %r13
shrq $0x3, %r13
leaq 0x3ed1(%rip), %rdi      # 0x8183
xorl %eax, %eax
callq 0x3070
leaq 0x3ecf(%rip), %r12      # 0x818f
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x3160
cltq
cmpq %rax, %r14
jge 0x432d
movsbl (%r15,%r14), %esi
cmpl $0x3a, %esi
jne 0x42e1
incq %r14
jmp 0x42c3
movq %r12, %rdi
xorl %eax, %eax
callq 0x3070
leaq 0x1(%r14), %rbp
movq %r15, %rdi
callq 0x3160
cmpl %eax, %ebp
jge 0x431a
cmpb $0x3a, (%r15,%rbp)
jne 0x431a
movsbl (%r15,%r14), %esi
leaq 0x3e86(%rip), %rdi      # 0x8194
xorl %eax, %eax
callq 0x3070
movq %rbp, %r14
jmp 0x42c3
leaq 0x3e76(%rip), %rdi      # 0x8197
xorl %eax, %eax
callq 0x3070
movq %rbp, %r14
jmp 0x42c3
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
leaq 0x3e67(%rip), %r12      # 0x81a4
xorl %r14d, %r14d
cmpq %r14, %r13
je 0x435e
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x3070
incq %r14
jmp 0x4340
pushq $0xa
popq %rdi
callq 0x33b0
leaq 0x3e2d(%rip), %rbp      # 0x819a
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x3160
cltq
incq %r14
leaq -0x1(%r14), %rcx
cmpq %rax, %rcx
jge 0x4434
movsbl -0x1(%r15,%r14), %esi
cmpl $0x3a, %esi
je 0x437d
movq %rbp, %rdi
xorl %eax, %eax
callq 0x3070
movq %r15, %rdi
callq 0x3160
movl %r12d, %ebp
cmpl %eax, %r14d
jge 0x4408
cmpb $0x3a, (%r15,%r14)
jne 0x4408
movsbl -0x1(%r15,%r14), %esi
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbp,8), %rax
movq 0x20(%rax), %rdx
leaq 0x3dca(%rip), %rdi      # 0x819f
xorl %eax, %eax
callq 0x3070
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbp,8), %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x43fe
leaq 0x3db2(%rip), %rdi      # 0x81a9
xorl %eax, %eax
callq 0x3070
pushq $0xa
popq %rdi
callq 0x33b0
jmp 0x4425
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbp,8), %rax
movq 0x20(%rax), %rsi
leaq 0x3d99(%rip), %rdi      # 0x81b7
xorl %eax, %eax
callq 0x3070
leaq 0x3d6e(%rip), %rbp      # 0x819a
incl %r12d
jmp 0x4373
leaq 0x3d83(%rip), %r14      # 0x81be
leaq 0x3d80(%rip), %r15      # 0x81c2
xorl %r12d, %r12d
cmpq %r12, %r13
je 0x4478
movq (%rbx), %rax
movq (%rax,%r12,8), %rax
movq (%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x3070
movq (%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x3070
incq %r12
jmp 0x4445
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq