// File: /workspace/github_c_makefile_star2_O3/ToniWestbrook[P]paladin/main.c
// Function: main
int main(int argc, char *argv[]) {
	extern char *bwa_pg;
	int i, ret;
	double t_real;
	kstring_t pg = {0,0,0};
	t_real = realtime();

	ksprintf(&pg, "@PG\tID:PALADIN\tPN:PALADIN\tVN:%s\tCL:%s", PACKAGE_VERSION, argv[0]);

	// Process command argument
	for (i = 1; i < argc; ++i) ksprintf(&pg, " %s", argv[i]);
	bwa_pg = pg.s;

	if (argc < 2) return renderMainUsage();
	if (strcmp(argv[1], "index") == 0) ret = command_index(argc-1, argv+1);
	else if (strcmp(argv[1], "prepare") == 0) ret = command_prepare(argc-1, argv+1);
	else if (strcmp(argv[1], "align") == 0) ret = command_align(argc-1, argv+1);
	else if (strcmp(argv[1], "fa2pac") == 0) ret = bwa_fa2pac(argc-1, argv+1);
	else if (strcmp(argv[1], "pac2bwt") == 0) ret = command_pac2bwt(argc-1, argv+1);
	else if (strcmp(argv[1], "bwtupdate") == 0) ret = command_bwtupdate(argc-1, argv+1);
	else if (strcmp(argv[1], "bwt2sa") == 0) ret = command_bwt2sa(argc-1, argv+1);
	else if (strcmp(argv[1], "shm") == 0) ret = main_shm(argc-1, argv+1);
	else if (strcmp(argv[1], "version") == 0) return renderVersion();
	else {
		fprintf(stderr, "[main] unrecognized command '%s'\n", argv[1]);
		return 1;
	}

	err_fflush(stdout);
	err_fclose(stdout);

	// If execution was successful, print time and CPU statistics
	if (ret == 0) {
		fprintf(stderr, "[%s] Version: %s\n", __func__, PACKAGE_VERSION);
		fprintf(stderr, "[%s] CMD:", __func__);
		for (i = 0; i < argc; ++i)
			fprintf(stderr, " %s", argv[i]);
		fprintf(stderr, "\n[%s] Real time: %.3f sec; CPU: %.3f sec\n", __func__, realtime() - t_real, cputime());
	}

	free(bwa_pg);

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movl %edi, %r14d
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
xorl %eax, %eax
callq 0xe7c1
movsd %xmm0, 0x8(%rsp)
movq (%rbx), %rcx
leaq 0x1b664(%rip), %rsi     # 0x27b7b
leaq 0x18b2d(%rip), %rdx     # 0x2504b
movq %r15, %rdi
xorl %eax, %eax
callq 0xebb4
cmpl $0x1, %r14d
jle 0xc675
movl %r14d, %r13d
movl $0x1, %ebp
leaq 0x1bb80(%rip), %r15     # 0x280c1
leaq 0x10(%rsp), %r12
movq (%rbx,%rbp,8), %rdx
movq %r12, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xebb4
incq %rbp
cmpq %rbp, %r13
jne 0xc546
movq 0x20(%rsp), %rax
leaq 0x24905(%rip), %r13     # 0x30e70
movq %rax, (%r13)
leaq 0x8(%rbx), %r15
movq 0x8(%rbx), %r12
leaq 0x18e77(%rip), %rsi     # 0x253f5
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
je 0xc63d
leaq 0x1b60c(%rip), %rsi     # 0x27ba1
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
je 0xc64b
leaq 0x193e2(%rip), %rsi     # 0x2598e
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
je 0xc659
leaq 0x1be08(%rip), %rsi     # 0x283cb
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
je 0xc667
leaq 0x18b09(%rip), %rsi     # 0x250e3
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
je 0xc690
leaq 0x1b5b8(%rip), %rsi     # 0x27ba9
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
je 0xc69e
leaq 0x1b5ab(%rip), %rsi     # 0x27bb3
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
je 0xc6ac
leaq 0x1b4f4(%rip), %rsi     # 0x27b13
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
jne 0xc702
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0xc385
jmp 0xc6b8
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0x5e1d
jmp 0xc6b8
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0x6469
jmp 0xc6b8
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0x7554
jmp 0xc6b8
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0x113ea
jmp 0xc6b8
movq 0x20(%rsp), %rax
leaq 0x247ef(%rip), %rcx     # 0x30e70
movq %rax, (%rcx)
callq 0x4076
movl $0x1, %ebp
jmp 0xc6de
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0x5b65
jmp 0xc6b8
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0x5d0b
jmp 0xc6b8
leal -0x1(%r14), %edi
movq %r15, %rsi
callq 0x5d55
movl %eax, %ebp
movq 0x238e7(%rip), %r15     # 0x2ffa8
movq (%r15), %rdi
callq 0xe681
movq (%r15), %rdi
callq 0xe71e
testl %ebp, %ebp
je 0xc6ef
movq (%r13), %rdi
callq 0x3390
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %edi
movq %rbx, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x4245
jmp 0xc6d5
leaq 0x1b4b1(%rip), %rsi     # 0x27bba
movq %r12, %rdi
callq 0x34d0
testl %eax, %eax
jne 0xc71f
callq 0x41ca
jmp 0xc689
movq 0x238aa(%rip), %rax     # 0x2ffd0
movq (%rax), %rdi
leaq 0x1b492(%rip), %rsi     # 0x27bc2
movq %r12, %rdx
xorl %eax, %eax
callq 0x3500
jmp 0xc689
nop