// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/sam_view.c
// Function: main_samview
int main_samview(int argc, char *argv[])
{
	int c, is_header = 0, is_header_only = 0, is_bamin = 1, ret = 0, compress_level = -1, is_bamout = 0, is_count = 0;
	int of_type = BAM_OFDEC, is_long_help = 0, n_threads = 0;
	int64_t count = 0;
	samfile_t *in = 0, *out = 0;
	char in_mode[5], out_mode[5], *fn_out = 0, *fn_list = 0, *fn_ref = 0, *fn_rg = 0, *q;

	/* parse command-line options */
	strcpy(in_mode, "r"); strcpy(out_mode, "w");
	while ((c = getopt(argc, argv, "SbBct:h1Ho:q:f:F:ul:r:xX?T:R:L:s:Q:@:m:")) >= 0) {
		switch (c) {
		case 's':
			if ((g_subsam_seed = strtol(optarg, &q, 10)) != 0) {
				srand(g_subsam_seed);
				g_subsam_seed = rand();
			}
			g_subsam_frac = strtod(q, &q);
			break;
		case 'm': g_min_qlen = atoi(optarg); break;
		case 'c': is_count = 1; break;
		case 'S': is_bamin = 0; break;
		case 'b': is_bamout = 1; break;
		case 't': fn_list = strdup(optarg); is_bamin = 0; break;
		case 'h': is_header = 1; break;
		case 'H': is_header_only = 1; break;
		case 'o': fn_out = strdup(optarg); break;
		case 'f': g_flag_on = strtol(optarg, 0, 0); break;
		case 'F': g_flag_off = strtol(optarg, 0, 0); break;
		case 'q': g_min_mapQ = atoi(optarg); break;
		case 'u': compress_level = 0; break;
		case '1': compress_level = 1; break;
		case 'l': g_library = strdup(optarg); break;
		case 'L': g_bed = bed_read(optarg); break;
		case 'r': g_rg = strdup(optarg); break;
		case 'R': fn_rg = strdup(optarg); break;
		case 'x': of_type = BAM_OFHEX; break;
		case 'X': of_type = BAM_OFSTR; break;
		case '?': is_long_help = 1; break;
		case 'T': fn_ref = strdup(optarg); is_bamin = 0; break;
		case 'B': bam_no_B = 1; break;
		case 'Q': g_qual_scale = atoi(optarg); break;
		case '@': n_threads = strtol(optarg, 0, 0); break;
		default: return usage(is_long_help);
		}
	}
	if (compress_level >= 0) is_bamout = 1;
	if (is_header_only) is_header = 1;
	if (is_bamout) strcat(out_mode, "b");
	else {
		if (of_type == BAM_OFHEX) strcat(out_mode, "x");
		else if (of_type == BAM_OFSTR) strcat(out_mode, "X");
	}
	if (is_bamin) strcat(in_mode, "b");
	if (is_header) strcat(out_mode, "h");
	if (compress_level >= 0) {
		char tmp[2];
		tmp[0] = compress_level + '0'; tmp[1] = '\0';
		strcat(out_mode, tmp);
	}
	if (argc == optind) return usage(is_long_help); // potential memory leak...

	// read the list of read groups
	if (fn_rg) {
		FILE *fp_rg;
		char buf[1024];
		int ret;
		g_rghash = kh_init(rg);
		fp_rg = fopen(fn_rg, "r");
		while (!feof(fp_rg) && fscanf(fp_rg, "%s", buf) > 0) // this is not a good style, but bear me...
			kh_put(rg, g_rghash, strdup(buf), &ret); // we'd better check duplicates...
		fclose(fp_rg);
	}

	// generate the fn_list if necessary
	if (fn_list == 0 && fn_ref) fn_list = samfaipath(fn_ref);
	// open file handlers
	if ((in = samopen(argv[optind], in_mode, fn_list)) == 0) {
		fprintf(stderr, "[main_samview] fail to open \"%s\" for reading.\n", argv[optind]);
		ret = 1;
		goto view_end;
	}
	if (in->header == 0) {
		fprintf(stderr, "[main_samview] fail to read the header from \"%s\".\n", argv[optind]);
		ret = 1;
		goto view_end;
	}
	if (g_rghash) { // FIXME: I do not know what "bam_header_t::n_text" is for...
		char *tmp;
		int l;
		tmp = drop_rg(in->header->text, g_rghash, &l);
		free(in->header->text);
		in->header->text = tmp;
		in->header->l_text = l;
	}
	if (!is_count && (out = samopen(fn_out? fn_out : "-", out_mode, in->header)) == 0) {
		fprintf(stderr, "[main_samview] fail to open \"%s\" for writing.\n", fn_out? fn_out : "standard output");
		ret = 1;
		goto view_end;
	}
	if (n_threads > 1) samthreads(out, n_threads, 256); 
	if (is_header_only) goto view_end; // no need to print alignments

	if (argc == optind + 1) { // convert/print the entire file
		bam1_t *b = bam_init1();
		int r;
		while ((r = samread(in, b)) >= 0) { // read one alignment from `in'
			if (!process_aln(in->header, b)) {
				if (!is_count) samwrite(out, b); // write the alignment to `out'
				count++;
			}
		}
		if (r < -1) {
			fprintf(stderr, "[main_samview] truncated file.\n");
			ret = 1;
		}
		bam_destroy1(b);
	} else { // retrieve alignments in specified regions
		int i;
		bam_index_t *idx = 0;
		if (is_bamin) idx = bam_index_load(argv[optind]); // load BAM index
		if (idx == 0) { // index is unavailable
			fprintf(stderr, "[main_samview] random alignment retrieval only works for indexed BAM files.\n");
			ret = 1;
			goto view_end;
		}
		for (i = optind + 1; i < argc; ++i) {
			int tid, beg, end, result;
			bam_parse_region(in->header, argv[i], &tid, &beg, &end); // parse a region in the format like `chr2:100-200'
			if (tid < 0) { // reference name is not found
				fprintf(stderr, "[main_samview] region \"%s\" specifies an unknown reference name. Continue anyway.\n", argv[i]);
				continue;
			}
			// fetch alignments
			if (is_count) {
				count_func_data_t count_data = { in->header, &count };
				result = bam_fetch(in->x.bam, idx, tid, beg, end, &count_data, count_func);
			} else
				result = bam_fetch(in->x.bam, idx, tid, beg, end, out, view_func);
			if (result < 0) {
				fprintf(stderr, "[main_samview] retrieval of region \"%s\" failed due to truncated file or corrupt BAM index file\n", argv[i]);
				ret = 1;
				break;
			}
		}
		bam_index_destroy(idx); // destroy the BAM index
	}

view_end:
	if (is_count && ret == 0) 
		printf("%" PRId64 "\n", count);

	// close files, free and return
	free(fn_list); free(fn_ref); free(fn_out); free(g_library); free(g_rg); free(fn_rg);
	if (g_bed) bed_destroy(g_bed);
	if (g_rghash) {
		khint_t k;
		for (k = 0; k < kh_end(g_rghash); ++k)
			if (kh_exist(g_rghash, k)) free((char*)kh_key(g_rghash, k));
		kh_destroy(rg, g_rghash);
	}
	samclose(in);
	if (!is_count)
		samclose(out);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4e8, %rsp            # imm = 0x4E8
movq $0x0, 0xa0(%rsp)
movw $0x72, 0x52(%rsp)
movw $0x77, 0x22(%rsp)
leaq 0x3594e(%rip), %rdx     # 0x3f258
movl %edi, 0x1c(%rsp)
movq %rsi, 0x48(%rsp)
callq 0x3210
testl %eax, %eax
js 0x9c07
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0x1, %r12d
movq $0x0, 0x10(%rsp)
leaq 0x3591d(%rip), %r15     # 0x3f258
leaq 0x3579e(%rip), %r13     # 0x3f0e0
movl $0x0, 0x30(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x88(%rsp)
movl $0x0, 0x28(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x40(%rsp)
xorl %r14d, %r14d
leal -0x3f(%rax), %ecx
cmpl $0x39, %ecx
ja 0x99af
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
movl $0x1, 0x28(%rsp)
jmp 0x9bc5
cmpl $0x31, %eax
jne 0xa576
movl $0x1, %ebx
jmp 0x9bc5
movl $0x1, %ebp
jmp 0x9bc5
movq 0x4560d(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x3570
movq %rax, 0x38(%rsp)
jmp 0x9b94
movq 0x455f4(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x3570
movq %rax, 0x46945(%rip)     # 0x50340
jmp 0x9bc5
movq 0x455d9(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x34c0
movl %eax, 0x46923(%rip)     # 0x50338
jmp 0x9bc5
movl $0x1, 0x30(%rsp)
jmp 0x9bc5
movq 0x455b2(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x3570
movq %rax, 0x68(%rsp)
jmp 0x9bc5
movl $0x1, %eax
movq %rax, 0x10(%rsp)
jmp 0x9bc5
movl $0x2, %ebp
jmp 0x9bc5
leaq 0x4690c(%rip), %rax     # 0x5036c
movl $0x1, (%rax)
jmp 0x9bc5
xorl %ebx, %ebx
jmp 0x9bc5
movq 0x45567(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
leaq 0xd8(%rsp), %rsi
movl $0xa, %edx
callq 0x34b0
movl %eax, 0x46894(%rip)     # 0x50328
testl %eax, %eax
je 0x9aaa
movl %eax, %edi
callq 0x35e0
callq 0x3740
movl %eax, 0x4687e(%rip)     # 0x50328
leaq 0xd8(%rsp), %rsi
movq (%rsi), %rdi
callq 0x37f0
movsd %xmm0, 0x459ce(%rip)    # 0x4f490
jmp 0x9bc5
movq 0x45512(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x34c0
movl %eax, 0x4687c(%rip)     # 0x50358
jmp 0x9bc5
movq 0x454f8(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x34b0
movq %rax, 0x88(%rsp)
jmp 0x9bc5
movl $0x1, %eax
movq %rax, 0x40(%rsp)
jmp 0x9bc5
movq 0x454c9(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x34b0
movl %eax, 0x4680b(%rip)     # 0x50334
jmp 0x9bc5
movq 0x454ab(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x34b0
movl %eax, 0x467e9(%rip)     # 0x50330
jmp 0x9bc5
movq 0x45490(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x306fa
movq %rax, 0x467e9(%rip)     # 0x50348
jmp 0x9bc5
movq 0x45478(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x34c0
movl %eax, 0x467b6(%rip)     # 0x5032c
jmp 0x9bc5
movl $0x1, %r14d
jmp 0x9bc5
movq 0x45459(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x3570
movq %rax, 0x60(%rsp)
xorl %r12d, %r12d
jmp 0x9bc5
movq 0x45440(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x3570
movq %rax, 0x467a1(%rip)     # 0x50350
jmp 0x9bc5
movq 0x45428(%rip), %rax     # 0x4efe0
movq (%rax), %rdi
callq 0x3570
movq %rax, 0x58(%rsp)
movl 0x1c(%rsp), %edi
movq 0x48(%rsp), %rsi
movq %r15, %rdx
callq 0x3210
testl %eax, %eax
jns 0x9990
cmpl $0x0, 0x30(%rsp)
sete 0xf(%rsp)
testl %r14d, %r14d
sete %al
testl %r12d, %r12d
sete %cl
movq %rcx, 0x80(%rsp)
cmpl $0x0, 0x10(%rsp)
sete %r14b
jmp 0x9c65
movq $0x0, 0x40(%rsp)
movb $0x1, %al
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movl $0x0, 0x28(%rsp)
movq $0x0, 0x88(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x80(%rsp)
movb $0x1, 0xf(%rsp)
movb $0x1, %r14b
testl %ebx, %ebx
sets %cl
andb %al, %cl
movw $0x62, %r15w
cmpb $0x1, %cl
jne 0x9c8c
cmpl $0x1, %ebp
je 0x9c87
cmpl $0x2, %ebp
jne 0x9c9c
movw $0x58, %r15w
jmp 0x9c8c
movw $0x78, %r15w
leaq 0x22(%rsp), %rdi
callq 0x3360
movw %r15w, 0x22(%rsp,%rax)
cmpb $0x0, 0x80(%rsp)
jne 0x9cb7
leaq 0x52(%rsp), %rdi
callq 0x3360
movw $0x62, 0x52(%rsp,%rax)
testb %r14b, 0xf(%rsp)
movq 0x38(%rsp), %r14
jne 0x9cd4
leaq 0x22(%rsp), %rdi
callq 0x3360
movw $0x68, 0x22(%rsp,%rax)
testl %ebx, %ebx
js 0x9cf3
addb $0x30, %bl
leaq 0xe0(%rsp), %rsi
movb %bl, (%rsi)
movb $0x0, 0x1(%rsi)
leaq 0x22(%rsp), %rdi
callq 0x3480
movq 0x452be(%rip), %rcx     # 0x4efb8
movl 0x1c(%rsp), %eax
cmpl %eax, (%rcx)
je 0xa576
cmpq $0x0, 0x68(%rsp)
je 0x9f7e
movl $0x1, %edi
movl $0x28, %esi
callq 0x3610
movq %rax, 0x46638(%rip)     # 0x50360
leaq 0x3af40(%rip), %rsi     # 0x44c6f
movq 0x68(%rsp), %rdi
callq 0x36f0
movq %rax, %r15
movq %rax, %rdi
callq 0x3630
testl %eax, %eax
jne 0x9f76
leaq 0xe0(%rsp), %rbx
movq %r15, 0x90(%rsp)
movq %r15, %rdi
leaq 0x3a9cb(%rip), %rsi     # 0x44731
movq %rbx, %rdx
xorl %eax, %eax
callq 0x30f0
testl %eax, %eax
jle 0x9f76
movq 0x465e1(%rip), %r12     # 0x50360
movq %rbx, %rdi
callq 0x3570
movq %r12, %rdi
movq %rax, %r8
movl 0x8(%r12), %eax
cmpl 0xc(%r12), %eax
movq %r12, 0x10(%rsp)
jb 0x9dc8
movl (%rdi), %eax
movl 0x4(%rdi), %ecx
addl %ecx, %ecx
cmpl %eax, %ecx
movl $0x0, %esi
sbbl %esi, %esi
orl $0x1, %esi
addl %eax, %esi
movq 0x10(%rsp), %rdi
movq %r8, %rbx
callq 0xadd3
movq %rbx, %r8
movq 0x10(%rsp), %rdi
movl (%rdi), %ebp
movsbl (%r8), %esi
testl %esi, %esi
je 0x9df8
movb 0x1(%r8), %al
testb %al, %al
je 0x9dfa
movq %r8, %rcx
addq $0x2, %rcx
movl %esi, %edx
shll $0x5, %edx
subl %esi, %edx
movsbl %al, %esi
addl %edx, %esi
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x9de1
jmp 0x9dfa
xorl %esi, %esi
movl %esi, %eax
xorl %edx, %edx
divl %ebp
movl %edx, %r11d
movq 0x10(%rdi), %r10
movl %edx, %eax
shrl $0x4, %eax
movl (%r10,%rax,4), %eax
leal (%r11,%r11), %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x9ef8
leal -0x1(%rbp), %ecx
movl %esi, %eax
xorl %edx, %edx
divl %ecx
incl %edx
movl %r11d, %r13d
movl %ebp, %r12d
movq %r10, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movl %edx, 0x98(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%r10,%rax,4), %r14d
leal (,%r13,2), %r15d
andl $0x1e, %r15d
movl %r14d, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x9ebe
testb $0x1, %al
jne 0x9e99
movq 0x18(%rdi), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
movq %r11, %rbx
callq 0x35a0
movl 0x98(%rsp), %edx
movq %rbx, %r11
movq 0x30(%rsp), %r10
movq 0x28(%rsp), %r8
movq 0x10(%rsp), %rdi
testl %eax, %eax
je 0x9ebe
btl %r15d, %r14d
cmovbl %r13d, %r12d
addl %edx, %r13d
cmpl %ebp, %r13d
movl %ebp, %eax
movl $0x0, %ecx
cmovbl %ecx, %eax
subl %eax, %r13d
movl %r12d, %eax
cmpl %r11d, %r13d
jne 0x9e40
jmp 0x9ec0
movl %ebp, %eax
movl %eax, %r11d
cmpl %ebp, %eax
movq 0x38(%rsp), %r14
movq 0x90(%rsp), %r15
jne 0x9ef8
movl %r13d, %eax
shrl $0x4, %eax
movl (%r10,%rax,4), %eax
leal (,%r13,2), %ecx
shrl %cl, %eax
cmpl %ebp, %r12d
cmovel %r13d, %r12d
testb $0x2, %al
cmovel %r13d, %r12d
movl %r12d, %r11d
movl %r11d, %eax
shrl $0x4, %eax
movl (%r10,%rax,4), %edx
leal (%r11,%r11), %ecx
andl $0x1e, %ecx
shrl %cl, %edx
testb $0x2, %dl
jne 0x9f3d
testb $0x1, %dl
leaq 0xe0(%rsp), %rbx
je 0x9f66
movq 0x18(%rdi), %rdx
movl %r11d, %esi
movq %r8, (%rdx,%rsi,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
jmp 0x9f66
movq 0x18(%rdi), %rdx
movl %r11d, %esi
movq %r8, (%rdx,%rsi,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
incl 0x8(%rdi)
leaq 0xe0(%rsp), %rbx
movq %r15, %rdi
callq 0x3630
testl %eax, %eax
je 0x9d5c
movq %r15, %rdi
callq 0x3640
testq %r14, %r14
sete %al
cmpq $0x0, 0x60(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x9fa1
movq 0x60(%rsp), %rdi
callq 0x27ea0
movq %rax, %r14
movq 0x45010(%rip), %rax     # 0x4efb8
movslq (%rax), %rax
movq 0x48(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
leaq 0x52(%rsp), %rsi
movq %r14, %rdx
callq 0x278cd
movq %rax, %rbx
testq %rax, %rax
je 0xa58a
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0xa596
movq 0x4637f(%rip), %rcx     # 0x50360
movq %rcx, 0x30(%rsp)
testq %rcx, %rcx
movq %rbx, 0x78(%rsp)
je 0xa300
movq %r14, 0x38(%rsp)
movq 0x38(%rax), %rbp
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %rbp, %rdi
movl $0xa, %esi
callq 0x34f0
movq %rax, %r15
testq %rax, %rax
jne 0xa028
movq %rbp, %rdi
callq 0x3360
movq %rax, %r15
addq %rbp, %r15
movq %r15, %r13
subq %rbp, %r13
cmpq $0x3, %r13
jl 0xa124
movl $0x4, %edx
movq %rbp, %rdi
leaq 0x35466(%rip), %rsi     # 0x3f4ad
callq 0x3230
testl %eax, %eax
je 0xa133
movq %r13, 0x10(%rsp)
movslq %r13d, %r13
leaq (%rbx,%r13), %rax
incq %rax
cmpq %r14, %rax
jb 0xa0aa
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %r14
shrq $0x10, %r14
orq %rax, %r14
incq %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x3720
movq %rax, %r12
leaq (%r12,%rbx), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x37d0
movq %r12, %rdi
leaq (%rbx,%r13), %r12
movb $0x0, (%rdi,%r12)
addq %r13, %rbx
incq %rbx
cmpq %r14, %rbx
jb 0xa10f
movq %rbx, %rax
shrq %rax
orq %rbx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq %r14, %rsi
callq 0x3720
movq %rax, %rdi
movq 0x10(%rsp), %r13
movw $0xa, (%rdi,%r12)
movq %rdi, %r12
incq %r15
movq %r15, %rbp
cmpq $0x2, %r13
jg 0xa005
jmp 0xa2db
movq %rbp, %rdi
leaq 0x35375(%rip), %rsi     # 0x3f4b2
callq 0x3460
testq %rax, %rax
je 0xa11e
movq %rbp, 0xc8(%rsp)
movq %r14, 0xd0(%rsp)
leaq 0x4(%rax), %r14
movq %r14, 0x28(%rsp)
movzbl (%r14), %edx
cmpl $0xa, %edx
ja 0xa173
movl $0x601, %ecx            # imm = 0x601
btl %edx, %ecx
jb 0xa178
incq %r14
jmp 0xa160
movl %edx, 0xa8(%rsp)
movb $0x0, (%r14)
movq 0x30(%rsp), %rcx
movl (%rcx), %edi
testl %edi, %edi
je 0xa1d9
movq 0x28(%rsp), %rcx
movsbl (%rcx), %ecx
testl %ecx, %ecx
movq %rbx, 0xc0(%rsp)
movq %r12, 0xb8(%rsp)
movq %r13, 0x10(%rsp)
movq %r14, 0xb0(%rsp)
je 0xa1e0
movb 0x5(%rax), %dl
testb %dl, %dl
je 0xa1e2
addq $0x6, %rax
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %dl, %ecx
addl %esi, %ecx
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0xa1c2
jmp 0xa1e2
xorl %edi, %edi
jmp 0xa2af
xorl %ecx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %edx, %r14d
leal -0x1(%rdi), %esi
movl %ecx, %eax
xorl %edx, %edx
divl %esi
movl %edx, %ebp
incl %ebp
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rsi
movl %r14d, %r13d
movq %r15, 0x98(%rsp)
movq %rdi, 0x90(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebx
leal (,%r13,2), %r12d
andl $0x1e, %r12d
movl %ebx, %eax
movl %r12d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0xa286
testb $0x1, %al
jne 0xa26c
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rsi, %r15
movq 0x28(%rsp), %rsi
callq 0x35a0
movq %r15, %rsi
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %r15
testl %eax, %eax
je 0xa286
addl %ebp, %r13d
cmpl %edi, %r13d
movl %edi, %eax
movl $0x0, %ecx
cmovbl %ecx, %eax
subl %eax, %r13d
cmpl %r14d, %r13d
jne 0xa214
jmp 0xa292
movl %r12d, %ecx
shrl %cl, %ebx
testb $0x3, %bl
cmovel %r13d, %edi
movq 0xc0(%rsp), %rbx
movq 0xb8(%rsp), %r12
movq 0x10(%rsp), %r13
movq 0xb0(%rsp), %r14
movl 0xa8(%rsp), %eax
movb %al, (%r14)
movq 0x30(%rsp), %rax
cmpl (%rax), %edi
movq 0xd0(%rsp), %r14
movq 0xc8(%rsp), %rbp
jne 0xa054
jmp 0xa11e
movq 0x78(%rsp), %r14
movq 0x10(%r14), %rax
movq 0x38(%rax), %rdi
callq 0x3350
movq 0x10(%r14), %rax
movq %r12, 0x38(%rax)
movl %ebx, 0x30(%rax)
movq %r14, %rbx
movq 0x38(%rsp), %r14
cmpl $0x0, 0x40(%rsp)
je 0xa30b
xorl %ebp, %ebp
jmp 0xa338
movq 0x58(%rsp), %rax
testq %rax, %rax
leaq 0x34b3e(%rip), %rdi     # 0x3ee58
cmovneq %rax, %rdi
movq 0x10(%rbx), %rdx
leaq 0x22(%rsp), %rsi
callq 0x278cd
movq %rax, %rbp
testq %rax, %rax
je 0xa6b8
movq 0x88(%rsp), %rsi
cmpl $0x2, %esi
jl 0xa352
movq %rbp, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x278ad
xorl %r12d, %r12d
cmpb $0x0, 0xf(%rsp)
je 0xa5a8
movq 0x44c51(%rip), %rax     # 0x4efb8
movslq (%rax), %rax
leal 0x1(%rax), %ecx
cmpl 0x1c(%rsp), %ecx
jne 0xa3c6
movl $0x1, %edi
movl $0x38, %esi
callq 0x3610
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x27d67
testl %eax, %eax
js 0xa3d5
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0xa715
testl %eax, %eax
jne 0xa3be
cmpl $0x0, 0x40(%rsp)
jne 0xa3b6
movq %rbp, %rdi
movq %r15, %rsi
callq 0x27d9c
incq 0xa0(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
jmp 0xa38b
cmpb $0x0, 0x80(%rsp)
je 0xa400
xorl %r12d, %r12d
jmp 0xa411
xorl %r12d, %r12d
cmpl $-0x1, %eax
jne 0xa6f0
testq %r15, %r15
je 0xa5a8
movq 0x30(%r15), %rdi
callq 0x3350
movq %r15, %rdi
callq 0x3350
jmp 0xa5a8
movq 0x48(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x29a74
movq %rax, %r12
testq %r12, %r12
je 0xa700
movq %rbx, %r13
movq %rbp, 0x10(%rsp)
movq %r14, 0x38(%rsp)
movq 0x44b8a(%rip), %rax     # 0x4efb8
movslq (%rax), %r14
movslq 0x1c(%rsp), %rbx
incq %r14
leaq 0x74(%rsp), %rbp
leaq 0x70(%rsp), %r15
movl $0x0, 0x1c(%rsp)
cmpq %rbx, %r14
jge 0xa54c
movq 0x10(%r13), %rdi
movq 0x48(%rsp), %rax
movq (%rax,%r14,8), %rsi
leaq 0xac(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
callq 0x22482
movl 0xac(%rsp), %edx
testl %edx, %edx
setns %r13b
js 0xa518
cmpl $0x0, 0x40(%rsp)
je 0xa4d4
movq 0x78(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0xe0(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq 0x8(%rcx), %rdi
movl 0x74(%rsp), %ecx
movl 0x70(%rsp), %r8d
leaq 0x4ca(%rip), %rax       # 0xa98d
movq %rax, (%rsp)
movq %r12, %rsi
leaq 0xe0(%rsp), %r9
jmp 0xa4f9
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x74(%rsp), %ecx
movl 0x70(%rsp), %r8d
leaq 0x4be(%rip), %rax       # 0xa9ab
movq %rax, (%rsp)
movq %r12, %rsi
movq 0x10(%rsp), %r9
callq 0x2a4e1
testl %eax, %eax
js 0xa521
xorl %r13d, %r13d
incq %r14
testb %r13b, %r13b
movq 0x78(%rsp), %r13
je 0xa44b
jmp 0xa54c
leaq 0x34e6f(%rip), %rsi     # 0x3f38e
jmp 0xa530
movl $0x1, 0x1c(%rsp)
leaq 0x34eb0(%rip), %rsi     # 0x3f3e0
movq 0x44ab1(%rip), %rax     # 0x4efe8
movq (%rax), %rdi
movq 0x48(%rsp), %rax
movq (%rax,%r14,8), %rdx
xorl %eax, %eax
callq 0x3750
jmp 0xa505
movq %r12, %rdi
callq 0x291f9
xorl %eax, %eax
movq 0x38(%rsp), %r14
movq 0x10(%rsp), %rbp
movl 0x1c(%rsp), %r12d
movq %r13, %rbx
cmpl $0x7, %eax
je 0xa5a8
testl %eax, %eax
je 0xa5a8
jmp 0xa6a3
movl 0x28(%rsp), %edi
callq 0x3a60
movl $0x1, %r12d
jmp 0xa6a3
movq 0x48(%rsp), %rdi
callq 0x3d60
jmp 0xa5a0
movq 0x48(%rsp), %rdi
callq 0x3d31
movl $0x1, %r12d
xorl %ebp, %ebp
cmpl $0x0, 0x40(%rsp)
je 0xa5ca
testl %r12d, %r12d
jne 0xa5ca
movq 0xa0(%rsp), %rsi
leaq 0x38854(%rip), %rdi     # 0x42e17
xorl %eax, %eax
callq 0x3060
movq %r14, %rdi
callq 0x3350
movq 0x60(%rsp), %rdi
callq 0x3350
movq 0x58(%rsp), %rdi
callq 0x3350
movq 0x45d53(%rip), %rdi     # 0x50340
callq 0x3350
movq 0x45d57(%rip), %rdi     # 0x50350
callq 0x3350
movq 0x68(%rsp), %rdi
callq 0x3350
movq 0x45d39(%rip), %rdi     # 0x50348
testq %rdi, %rdi
je 0xa619
callq 0x30e77
movq 0x45d40(%rip), %r15     # 0x50360
testq %r15, %r15
je 0xa68c
movq %rbx, %r13
cmpl $0x0, (%r15)
je 0xa666
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x10(%r15), %rax
movl %r14d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebx, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0xa658
movq 0x18(%r15), %rax
movq (%rax,%r14,8), %rdi
callq 0x3350
incq %r14
movl (%r15), %eax
addl $0x2, %ebx
cmpq %rax, %r14
jb 0xa633
movq 0x18(%r15), %rdi
callq 0x3350
movq 0x10(%r15), %rdi
callq 0x3350
movq 0x20(%r15), %rdi
callq 0x3350
movq %r15, %rdi
callq 0x3350
movq %r13, %rbx
movq %rbx, %rdi
callq 0x27d21
cmpl $0x0, 0x40(%rsp)
jne 0xa6a3
movq %rbp, %rdi
callq 0x27d21
movl %r12d, %eax
addq $0x4e8, %rsp            # imm = 0x4E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x58(%rsp), %rcx
testq %rcx, %rcx
movq 0x44921(%rip), %rax     # 0x4efe8
movq (%rax), %rdi
leaq 0x34c40(%rip), %rdx     # 0x3f311
cmovneq %rcx, %rdx
leaq 0x34c06(%rip), %rsi     # 0x3f2e2
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x3750
movl $0x1, %r12d
jmp 0xa5a8
callq 0x3d0f
movl $0x1, %r12d
jmp 0xa3e1
callq 0x3ced
movl $0x7, %eax
movl $0x1, %r12d
jmp 0xa568