// File: /workspace/github_cpp_makefile_star2_O1/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
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, 0x10(%rsp)
movq %rsi, %r15
movq %rdi, %rsi
movq 0x8(%rcx), %rax
subq (%rcx), %rax
shrq $0x3, %rax
movq %rax, 0x8(%rsp)
leaq 0x385c(%rip), %rdi      # 0x8183
xorl %eax, %eax
callq 0x3070
movq %r15, %rdi
callq 0x3160
testl %eax, %eax
jle 0x49aa
leaq 0x384e(%rip), %r12      # 0x818f
leaq 0x384c(%rip), %r13      # 0x8194
xorl %ebp, %ebp
movsbl (%r15,%rbp), %esi
cmpl $0x3a, %esi
je 0x4998
movq %r12, %rdi
xorl %eax, %eax
callq 0x3070
leaq 0x1(%rbp), %r14
movq %r15, %rdi
callq 0x3160
cltq
cmpq %rax, %r14
jge 0x498a
cmpb $0x3a, 0x1(%r15,%rbp)
jne 0x498a
movsbl (%r15,%rbp), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x3070
jmp 0x4998
leaq 0x3806(%rip), %rdi      # 0x8197
xorl %eax, %eax
callq 0x3070
incq %rbp
movq %r15, %rdi
callq 0x3160
cltq
cmpq %rax, %rbp
jl 0x494a
cmpl $0x0, 0x8(%rsp)
jle 0x49e2
movq 0x8(%rsp), %rbp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
leaq 0x37e1(%rip), %r12      # 0x81a4
xorl %r14d, %r14d
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x3070
incq %r14
cmpq %r14, %rbp
jne 0x49c6
movl $0xa, %edi
callq 0x3360
movq %r15, %rdi
callq 0x3160
testl %eax, %eax
jle 0x4ac1
xorl %ebp, %ebp
xorl %r12d, %r12d
movsbl (%r15,%rbp), %esi
cmpl $0x3a, %esi
je 0x4aab
leaq 0x3784(%rip), %rdi      # 0x819a
xorl %eax, %eax
callq 0x3070
leaq 0x1(%rbp), %r13
movq %r15, %rdi
callq 0x3160
cltq
movslq %r12d, %r14
cmpq %rax, %r13
jge 0x4a8a
cmpb $0x3a, 0x1(%r15,%rbp)
jne 0x4a8a
movsbl (%r15,%rbp), %esi
movq 0x10(%rsp), %r13
movq (%r13), %rax
movq (%rax,%r14,8), %rax
movq 0x20(%rax), %rdx
leaq 0x3747(%rip), %rdi      # 0x819f
xorl %eax, %eax
callq 0x3070
movq (%r13), %rax
movq (%rax,%r14,8), %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x4a7e
leaq 0x3732(%rip), %rdi      # 0x81a9
xorl %eax, %eax
callq 0x3070
movl $0xa, %edi
callq 0x3360
jmp 0x4aa8
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rax
movq 0x20(%rax), %rsi
leaq 0x3716(%rip), %rdi      # 0x81b7
xorl %eax, %eax
callq 0x3070
incl %r12d
incq %rbp
movq %r15, %rdi
callq 0x3160
cltq
cmpq %rax, %rbp
jl 0x4a01
movq 0x8(%rsp), %r13
testl %r13d, %r13d
jle 0x4b14
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
leaq 0x36e5(%rip), %r14      # 0x81be
leaq 0x36e2(%rip), %r15      # 0x81c2
xorl %r12d, %r12d
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
cmpq %r12, %r13
jne 0x4ae3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq