// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x2aa23(%rip), %rdx     # 0x3984d
callq 0x3090
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0xee6f
cmpl $0x6c, -0x14(%rbp)
jne 0xee46
movl $0x1, -0x18(%rbp)
jmp 0xee6d
cmpl $0x64, -0x14(%rbp)
jne 0xee55
movl $0x1, -0x1c(%rbp)
jmp 0xee6b
cmpl $0x66, -0x14(%rbp)
jne 0xee69
movq 0x3115e(%rip), %rax     # 0x3ffc0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xee6b
jmp 0xee6d
jmp 0xee1c
movq 0x3116a(%rip), %rax     # 0x3ffe0
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0xeef5
cmpl $0x0, -0x18(%rbp)
jne 0xeef5
cmpl $0x0, -0x1c(%rbp)
jne 0xeef5
movq 0x31148(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x2a9b8(%rip), %rsi     # 0x39852
movb $0x0, %al
callq 0x34e0
movq 0x31130(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x2a9d1(%rip), %rsi     # 0x39883
movb $0x0, %al
callq 0x34e0
movq 0x31118(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x2a9f1(%rip), %rsi     # 0x398bb
movb $0x0, %al
callq 0x34e0
movq 0x31100(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x2aa13(%rip), %rsi     # 0x398f5
movb $0x0, %al
callq 0x34e0
movl $0x1, -0x4(%rbp)
jmp 0xf02c
movq 0x310e4(%rip), %rax     # 0x3ffe0
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jge 0xef3a
cmpl $0x0, -0x18(%rbp)
jne 0xef0f
cmpl $0x0, -0x1c(%rbp)
je 0xef3a
movq 0x310c2(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x2aa0e(%rip), %rsi     # 0x3992e
leaq 0x2aa47(%rip), %rdx     # 0x3996e
movb $0x0, %al
callq 0x34e0
movl $0x1, -0x4(%rbp)
jmp 0xf02c
movq 0x3109f(%rip), %rax     # 0x3ffe0
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jge 0xf010
movq -0x10(%rbp), %rax
movq 0x31089(%rip), %rcx     # 0x3ffe0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xeaa0
cmpl $0x0, %eax
jne 0xefdd
movq -0x10(%rbp), %rax
movq 0x3106d(%rip), %rcx     # 0x3ffe0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movl $0x7, %esi
callq 0x19e00
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x31049(%rip), %rcx     # 0x3ffe0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x28(%rbp), %rdx
callq 0xe330
cmpl $0x0, %eax
jge 0xefd2
movq 0x31025(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x2a9ba(%rip), %rsi     # 0x39977
leaq 0x2a9aa(%rip), %rdx     # 0x3996e
movb $0x0, %al
callq 0x34e0
movl $0x1, -0x20(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1a050
jmp 0xf00e
movq 0x30ff4(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30fee(%rip), %rcx     # 0x3ffe0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x2a9ab(%rip), %rsi     # 0x399ab
leaq 0x2a967(%rip), %rdx     # 0x3996e
movb $0x0, %al
callq 0x34e0
jmp 0xf010
cmpl $0x0, -0x18(%rbp)
je 0xf01b
callq 0xec00
cmpl $0x0, -0x1c(%rbp)
je 0xf026
callq 0xece0
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop