// File: /workspace/github_cpp_makefile_star2_O3/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 0x3894(%rip), %rdi      # 0x8183
xorl %eax, %eax
callq 0x3070
movq %r15, %rdi
callq 0x3160
testl %eax, %eax
jle 0x497a
leaq 0x3886(%rip), %r12      # 0x818f
leaq 0x3884(%rip), %r13      # 0x8194
xorl %r14d, %r14d
movsbl (%r15,%r14), %esi
cmpl $0x3a, %esi
jne 0x4925
incq %r14
movq %r14, %rbp
jmp 0x4968
movq %r12, %rdi
xorl %eax, %eax
callq 0x3070
leaq 0x1(%r14), %rbp
movq %r15, %rdi
callq 0x3160
cltq
cmpq %rax, %rbp
jge 0x495a
cmpb $0x3a, (%r15,%rbp)
jne 0x495a
movsbl (%r15,%r14), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x3070
jmp 0x4968
leaq 0x3836(%rip), %rdi      # 0x8197
xorl %eax, %eax
callq 0x3070
movq %r15, %rdi
callq 0x3160
cltq
movq %rbp, %r14
cmpq %rax, %rbp
jl 0x4913
movq 0x8(%rsp), %r14
testl %r14d, %r14d
jle 0x49b1
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq 0x3812(%rip), %r12      # 0x81a4
xorl %r13d, %r13d
movq (%rbx), %rax
movq (%rax,%r13,8), %rax
movq (%rax), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x3070
incq %r13
cmpq %r13, %r14
jne 0x4995
movl $0xa, %edi
callq 0x3360
movq %r15, %rdi
callq 0x3160
testl %eax, %eax
jle 0x4a96
xorl %r12d, %r12d
xorl %ebp, %ebp
movsbl (%r15,%r12), %esi
cmpl $0x3a, %esi
jne 0x49e5
incq %r12
movq %r12, %r14
jmp 0x4a83
leaq 0x37ae(%rip), %rdi      # 0x819a
xorl %eax, %eax
callq 0x3070
leaq 0x1(%r12), %r14
movq %r15, %rdi
callq 0x3160
cltq
movslq %ebp, %r13
cmpq %rax, %r14
jge 0x4a60
cmpb $0x3a, (%r15,%r14)
jne 0x4a60
movsbl (%r15,%r12), %esi
movq 0x10(%rsp), %r12
movq (%r12), %rax
movq (%rax,%r13,8), %rax
movq 0x20(%rax), %rdx
leaq 0x3771(%rip), %rdi      # 0x819f
xorl %eax, %eax
callq 0x3070
movq (%r12), %rax
movq (%rax,%r13,8), %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x4a54
leaq 0x375c(%rip), %rdi      # 0x81a9
xorl %eax, %eax
callq 0x3070
movl $0xa, %edi
callq 0x3360
jmp 0x4a7e
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13,8), %rax
movq 0x20(%rax), %rsi
leaq 0x3740(%rip), %rdi      # 0x81b7
xorl %eax, %eax
callq 0x3070
incl %ebp
movq %r14, %r12
movq %r15, %rdi
callq 0x3160
cltq
cmpq %rax, %r14
jl 0x49d0
movq 0x8(%rsp), %r13
testl %r13d, %r13d
jle 0x4ae9
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
leaq 0x3710(%rip), %r14      # 0x81be
leaq 0x370d(%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 0x4ab8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq