// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/bwashm.c
// Function: main_shm
int main_shm(int argc, char *argv[])
{
	int c, to_list = 0, to_drop = 0, ret = 0;
	char *tmpfn = 0;
	while ((c = getopt(argc, argv, "ldf:")) >= 0) {
		if (c == 'l') to_list = 1;
		else if (c == 'd') to_drop = 1;
		else if (c == 'f') tmpfn = optarg;
	}
	if (optind == argc && !to_list && !to_drop) {
		fprintf(stderr, "\nUsage: bwa shm [-d|-l] [-f tmpFile] [idxbase]\n\n");
		fprintf(stderr, "Options: -d       destroy all indices in shared memory\n");
		fprintf(stderr, "         -l       list names of indices in shared memory\n");
		fprintf(stderr, "         -f FILE  temporary file to reduce peak memory\n\n");
		return 1;
	}
	if (optind < argc && (to_list || to_drop)) {
		fprintf(stderr, "[E::%s] open -l or -d cannot be used when 'idxbase' is present\n", __func__);
		return 1;
	}
	if (optind < argc) {
		if (bwa_shm_test(argv[optind]) == 0) {
			bwaidx_t *idx;
			idx = index_load_from_disk(argv[optind], BWA_IDX_ALL);
			if (bwa_shm_stage(idx, argv[optind], tmpfn) < 0) {
				fprintf(stderr, "[E::%s] failed to stage the index in shared memory\n", __func__);
				ret = 1;
			}
			index_destroy(idx);
		} else fprintf(stderr, "[M::%s] index '%s' is already in shared memory\n", __func__, argv[optind]);
	}
	if (to_list) bwa_shm_list();
	if (to_drop) bwa_shm_destroy();
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
xorl %r14d, %r14d
leaq 0x17e39(%rip), %r15     # 0x2299d
pushq $0x1
popq %r12
xorl %r13d, %r13d
movq $0x0, (%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3090
testl %eax, %eax
js 0xabad
cmpl $0x6c, %eax
je 0xab98
cmpl $0x66, %eax
je 0xab9d
cmpl $0x64, %eax
jne 0xab73
movl %r12d, %r13d
jmp 0xab73
movb $0x1, %r14b
jmp 0xab73
movq 0x21414(%rip), %rax     # 0x2bfb8
movq (%rax), %rax
movq %rax, (%rsp)
jmp 0xab73
movq 0x21424(%rip), %r12     # 0x2bfd8
movslq (%r12), %rax
cmpl %ebp, %eax
setne %cl
testl %r13d, %r13d
setne %dl
orb %r14b, %dl
orb %cl, %dl
testb $0x1, %dl
je 0xac65
testl %r13d, %r13d
setne %cl
cmpl %ebp, %eax
setl %dl
orb %r14b, %cl
andb %dl, %cl
cmpb $0x1, %cl
je 0xacc5
xorl %r15d, %r15d
cmpl %ebp, %eax
jge 0xac3e
movq (%rbx,%rax,8), %rdi
callq 0xa940
testl %eax, %eax
jne 0xaced
movslq (%r12), %rax
movq (%rbx,%rax,8), %rdi
pushq $0x7
popq %rsi
callq 0x10e63
movq %r12, %rcx
movq %rax, %r12
movslq (%rcx), %rax
movq (%rbx,%rax,8), %rsi
movq %r12, %rdi
movq (%rsp), %rdx
callq 0xa4d0
xorl %r15d, %r15d
testl %eax, %eax
js 0xad1c
movq %r12, %rdi
callq 0x10fed
testb $0x1, %r14b
je 0xac49
callq 0xa9f7
testl %r13d, %r13d
je 0xac53
callq 0xaa84
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x21364(%rip), %r14     # 0x2bfd0
movq (%r14), %rcx
leaq 0x17d2c(%rip), %rdi     # 0x229a2
pushq $0x30
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x3790
movq (%r14), %rcx
leaq 0x17d45(%rip), %rdi     # 0x229d3
pushq $0x37
popq %rsi
movq %rbx, %rdx
callq 0x3790
movq (%r14), %rcx
leaq 0x17d68(%rip), %rdi     # 0x22a0b
pushq $0x39
popq %rsi
movq %rbx, %rdx
callq 0x3790
movq (%r14), %rcx
leaq 0x17d8d(%rip), %rdi     # 0x22a45
pushq $0x38
popq %rsi
movq %rbx, %rdx
callq 0x3790
jmp 0xace4
movq 0x21304(%rip), %rax     # 0x2bfd0
movq (%rax), %rdi
leaq 0x17da8(%rip), %rsi     # 0x22a7e
leaq 0x17de1(%rip), %rdx     # 0x22abe
xorl %eax, %eax
callq 0x3500
pushq $0x1
popq %r15
jmp 0xac53
movq 0x212dc(%rip), %rax     # 0x2bfd0
movq (%rax), %rdi
movslq (%r12), %rax
movq (%rbx,%rax,8), %rcx
leaq 0x17df5(%rip), %rsi     # 0x22afb
leaq 0x17db1(%rip), %rdx     # 0x22abe
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x3500
jmp 0xac3e
movq 0x212ad(%rip), %rax     # 0x2bfd0
movq (%rax), %rdi
leaq 0x17d9a(%rip), %rsi     # 0x22ac7
leaq 0x17d8a(%rip), %rdx     # 0x22abe
xorl %eax, %eax
callq 0x3500
pushq $0x1
popq %r15
jmp 0xac36