// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_io.c
// Function: cram_get_ref
char *cram_get_ref(cram_fd *fd, int id, int start, int end) {
    ref_entry *r;
    char *seq;
    int ostart = start;

    if (id == -1)
	return NULL;

    /* FIXME: axiomatic query of r->seq being true?
     * Or shortcut for unsorted data where we load once and never free?
     */

    //fd->shared_ref = 1; // hard code for now to simplify things

    pthread_mutex_lock(&fd->ref_lock);

    RP("%d cram_get_ref on fd %p, id %d, range %d..%d\n", gettid(), fd, id, start, end);

    /*
     * Unsorted data implies we want to fetch an entire reference at a time.
     * We just deal with this at the moment by claiming we're sharing
     * references instead, which has the same requirement.
     */
    if (fd->unsorted)
	fd->shared_ref = 1;


    /* Sanity checking: does this ID exist? */
    if (id >= fd->refs->nref) {
	fprintf(stderr, "No reference found for id %d\n", id);
	pthread_mutex_unlock(&fd->ref_lock);
	return NULL;
    }

    if (!fd->refs || !fd->refs->ref_id[id]) {
	fprintf(stderr, "No reference found for id %d\n", id);
	pthread_mutex_unlock(&fd->ref_lock);
	return NULL;
    }

    if (!(r = fd->refs->ref_id[id])) {
	fprintf(stderr, "No reference found for id %d\n", id);
	pthread_mutex_unlock(&fd->ref_lock);
	return NULL;
    }


    /*
     * It has an entry, but may not have been populated yet.
     * Any manually loaded .fai files have their lengths known.
     * A ref entry computed from @SQ lines (M5 or UR field) will have
     * r->length == 0 unless it's been loaded once and verified that we have
     * an on-disk filename for it.
     *
     * 19 Sep 2013: Moved the lock here as the cram_populate_ref code calls
     * open_path_mfile and libcurl, which isn't multi-thread safe unless I
     * rewrite my code to have one curl handle per thread.
     */
    pthread_mutex_lock(&fd->refs->lock);
    if (r->length == 0) {
	if (cram_populate_ref(fd, id, r) == -1) {
	    fprintf(stderr, "Failed to populate reference for id %d\n", id);
	    pthread_mutex_unlock(&fd->refs->lock);
	    pthread_mutex_unlock(&fd->ref_lock);
	    return NULL;
	}
	r = fd->refs->ref_id[id];
	if (fd->unsorted)
	    cram_ref_incr_locked(fd->refs, id);
    }


    /*
     * We now know that we the filename containing the reference, so check
     * for limits. If it's over half the reference we'll load all of it in
     * memory as this will speed up subsequent calls.
     */
    if (end < 1)
	end = r->length;
    if (end >= r->length)
	end  = r->length; 
    assert(start >= 1);

    if (end - start >= 0.5*r->length || fd->shared_ref) {
	start = 1;
	end = r->length;
    }
    
    /*
     * Maybe we have it cached already? If so use it.
     *
     * Alternatively if we don't have the sequence but we're sharing
     * references and/or are asking for the entire length of it, then
     * load the full reference into the refs structure and return
     * a pointer to that one instead.
     */
    if (fd->shared_ref || r->seq || (start == 1 && end == r->length)) {
	char *cp;

	if (id >= 0) {
	    if (r->seq) {
		cram_ref_incr_locked(fd->refs, id);
	    } else {
		ref_entry *e;
		if (!(e = cram_ref_load(fd->refs, id, r->is_md5))) {
		    pthread_mutex_unlock(&fd->refs->lock);
		    pthread_mutex_unlock(&fd->ref_lock);
		    return NULL;
		}

		/* unsorted data implies cache ref indefinitely, to avoid
		 * continually loading and unloading.
		 */
		if (fd->unsorted)
		    cram_ref_incr_locked(fd->refs, id);
	    }	    

	    fd->ref = NULL; /* We never access it directly */
	    fd->ref_start = 1;
	    fd->ref_end   = r->length;
	    fd->ref_id    = id;

	    cp = fd->refs->ref_id[id]->seq + ostart-1;
	} else {
	    fd->ref = NULL;
	    cp = NULL;
	}

	RP("%d cram_get_ref returning for id %d, count %d\n", gettid(), id, (int)r->count);

	pthread_mutex_unlock(&fd->refs->lock);
	pthread_mutex_unlock(&fd->ref_lock);
	return cp;
    }

    /*
     * Otherwise we're not sharing, we don't have a copy of it already and
     * we're only asking for a small portion of it.
     *
     * In this case load up just that segment ourselves, freeing any old
     * small segments in the process.
     */

    /* Unmapped ref ID */
    if (id < 0) {
	if (fd->ref_free) {
	    free(fd->ref_free);
	    fd->ref_free = NULL;
	}
	fd->ref = NULL;
	fd->ref_id = id;
	pthread_mutex_unlock(&fd->refs->lock);
	pthread_mutex_unlock(&fd->ref_lock);
	return NULL;
    }

    /* Open file if it's not already the current open reference */
    if (strcmp(fd->refs->fn, r->fn) || fd->refs->fp == NULL) {
	if (fd->refs->fp)
	    if (bgzf_close(fd->refs->fp) != 0)
		return NULL;
	fd->refs->fn = r->fn;
	if (!(fd->refs->fp = bgzf_open_ref(fd->refs->fn, "r", r->is_md5))) {
	    pthread_mutex_unlock(&fd->refs->lock);
	    pthread_mutex_unlock(&fd->ref_lock);
	    return NULL;
	}
    }

    if (!(fd->ref = load_ref_portion(fd->refs->fp, r, start, end))) {
	pthread_mutex_unlock(&fd->refs->lock);
	pthread_mutex_unlock(&fd->ref_lock);
	return NULL;
    }

    if (fd->ref_free)
	free(fd->ref_free);

    fd->ref_id    = id;
    fd->ref_start = start;
    fd->ref_end   = end;
    fd->ref_free = fd->ref;
    seq = fd->ref;

    pthread_mutex_unlock(&fd->refs->lock);
    pthread_mutex_unlock(&fd->ref_lock);

    return seq + ostart - start;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4098, %rsp           # imm = 0x4098
cmpl $-0x1, %esi
je 0x3523b
movl %ecx, %ebx
movl %esi, %ebp
movq %rdi, %r15
movl %edx, 0xc(%rsp)
leaq 0x8898(%rdi), %r14
movq %r14, %rdi
callq 0x47a0
cmpl $0x0, 0x8854(%r15)
je 0x3478f
movl $0x1, 0x220(%r15)
movq 0x48(%r15), %rdi
cmpl %ebp, 0x18(%rdi)
jle 0x34979
testq %rdi, %rdi
je 0x34979
movq 0x10(%rdi), %rax
movslq %ebp, %rcx
movq %rcx, 0x48(%rsp)
movq (%rax,%rcx,8), %r12
testq %r12, %r12
je 0x34979
leaq 0x48(%r15), %r13
addq $0x38, %rdi
callq 0x47a0
cmpq $0x0, 0x10(%r12)
movq %r13, 0x10(%rsp)
je 0x348a1
movl 0xc(%rsp), %esi
testl %ebx, %ebx
jg 0x347e9
movl 0x10(%r12), %ebx
movslq %ebx, %rbx
movq 0x10(%r12), %rax
cmpq %rbx, %rax
cmovlel %eax, %ebx
testl %esi, %esi
jle 0x35376
movl %ebx, %ecx
subl %esi, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
cvtsi2sd %rax, %xmm1
mulsd 0x1e0e1(%rip), %xmm1    # 0x528f8
ucomisd %xmm1, %xmm0
jae 0x3482a
cmpl $0x0, 0x220(%r15)
movl %esi, %r13d
je 0x34832
movl $0x1, %r13d
movl %eax, %ebx
cmpl $0x0, 0x220(%r15)
jne 0x3485a
cmpq $0x0, 0x30(%r12)
jne 0x3485a
cmpl $0x1, %r13d
jne 0x34a5e
movslq %ebx, %rcx
cmpq %rcx, %rax
jne 0x34a5e
testl %ebp, %ebp
js 0x348ea
cmpq $0x0, 0x30(%r12)
movq 0x10(%rsp), %r13
movq (%r13), %rdi
je 0x34921
movq 0x10(%rdi), %rax
movl %ebp, %ecx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x30(%rax)
je 0x34a09
cmpl %ebp, 0x68(%rdi)
jne 0x34898
movl $0xffffffff, 0x68(%rdi) # imm = 0xFFFFFFFF
incq 0x28(%rax)
jmp 0x34a09
movl %ebx, 0x44(%rsp)
leaq 0x205b9(%rip), %rdi     # 0x54e65
callq 0x4650
movq %rax, %rbx
leaq 0x205b3(%rip), %rdi     # 0x54e6e
callq 0x4650
cmpl $0x0, 0x1fc(%r15)
jne 0x34e71
movb $0x0, 0x2090(%rsp)
testq %rbx, %rbx
je 0x348fe
cmpb $0x0, (%rbx)
je 0x348fe
movq %rax, 0x18(%rsp)
jmp 0x34b7b
movq $0x0, 0x50(%r15)
xorl %ebx, %ebx
movq 0x10(%rsp), %r13
jmp 0x34a44
testq %rax, %rax
je 0x3499a
cmpb $0x0, (%rax)
je 0x3499a
movq %rax, 0x18(%rsp)
leaq 0x2057f(%rip), %rbx     # 0x54e9b
jmp 0x34b7b
movl 0x40(%r12), %edx
movl %ebp, %esi
callq 0x343e3
movq %rax, %rbx
testq %rax, %rax
je 0x349e7
cmpl $0x0, 0x8854(%r15)
movl 0xc(%rsp), %esi
je 0x34a00
movq (%r13), %rax
movq 0x10(%rax), %rcx
movl %ebp, %edx
movq (%rcx,%rdx,8), %rcx
cmpq $0x0, 0x30(%rcx)
je 0x34a00
cmpl %ebp, 0x68(%rax)
jne 0x34970
movl $0xffffffff, 0x68(%rax) # imm = 0xFFFFFFFF
incq 0x28(%rcx)
jmp 0x34a00
movq 0x2f648(%rip), %rax     # 0x63fc8
movq (%rax), %rdi
leaq 0x201cb(%rip), %rsi     # 0x54b55
xorl %ebx, %ebx
movl %ebp, %edx
xorl %eax, %eax
callq 0x4770
jmp 0x34a51
leaq 0x20664(%rip), %rdi     # 0x55005
callq 0x4650
testq %rax, %rax
je 0x349b7
movq %rax, %rbx
cmpb $0x0, (%rax)
jne 0x34ae8
leaq 0x20651(%rip), %rdi     # 0x5500f
callq 0x4650
testq %rax, %rax
je 0x34acf
movq %rax, %rbx
cmpb $0x0, (%rax)
je 0x34acf
movq %r14, %r13
leaq 0x20632(%rip), %r14     # 0x55014
jmp 0x34b17
movq (%r13), %rdi
addq $0x38, %rdi
callq 0x43f0
movq %r14, %rdi
callq 0x43f0
movl 0xc(%rsp), %esi
testq %rbx, %rbx
je 0x3523b
movq $0x0, 0x50(%r15)
movl $0x1, 0x64(%r15)
movl 0x10(%r12), %eax
movl %eax, 0x68(%r15)
movl %ebp, 0x60(%r15)
movq 0x48(%r15), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rax), %rax
movl %esi, %ecx
leaq (%rax,%rcx), %rbx
decq %rbx
movq (%r13), %rdi
addq $0x38, %rdi
callq 0x43f0
movq %r14, %rdi
callq 0x43f0
jmp 0x3523d
testl %ebp, %ebp
js 0x34e3a
movq %r14, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %r14
movq 0x20(%r14), %rdi
movq 0x8(%r12), %rsi
callq 0x4750
testl %eax, %eax
je 0x34f30
movq 0x28(%r14), %rdi
testq %rdi, %rdi
je 0x34a9f
callq 0x4514a
testl %eax, %eax
jne 0x3523b
movq 0x8(%r12), %rdi
movq 0x10(%rsp), %r14
movq (%r14), %rax
movq %rdi, 0x20(%rax)
movl 0x40(%r12), %esi
callq 0x34515
movq (%r14), %rdi
movq %rax, 0x28(%rdi)
testq %rax, %rax
jne 0x34f3b
jmp 0x35228
leaq 0x20546(%rip), %rdi     # 0x5501c
callq 0x4650
testq %rax, %rax
je 0x34aed
movq %rax, %rbx
cmpb $0x0, (%rax)
je 0x34aed
movq %r14, %r13
jmp 0x34b10
movq %r14, %r13
leaq 0x2052c(%rip), %rdi     # 0x55023
callq 0x4650
testq %rax, %rax
je 0x34b09
movq %rax, %rbx
cmpb $0x0, (%rax)
jne 0x34b10
leaq 0x20518(%rip), %rbx     # 0x55028
leaq 0x1e068(%rip), %r14     # 0x52b7f
leaq 0x203a5(%rip), %rdx     # 0x54ec3
leaq 0x2090(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x4890
leaq 0x20391(%rip), %rdx     # 0x54ed0
leaq 0x3090(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rdi, 0x18(%rsp)
movq %rbx, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x4890
leaq 0x20336(%rip), %rbx     # 0x54e9b
cmpl $0x0, 0x1fc(%r15)
jne 0x35276
movq %r13, %r14
movq 0x10(%rsp), %r13
movq (%r12), %rcx
testq %rcx, %rcx
je 0x34dd2
movq 0x18(%r15), %rdi
leaq 0x1e805(%rip), %rsi     # 0x53398
leaq 0x20107(%rip), %rdx     # 0x54ca1
callq 0x3f792
testq %rax, %rax
je 0x34dd2
movq 0x18(%r15), %rdi
leaq 0x200f1(%rip), %rdx     # 0x54ca4
movq %rax, 0x38(%rsp)
movq %rax, %rsi
xorl %ecx, %ecx
callq 0x3ff24
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x34ce1
cmpl $0x0, 0x1fc(%r15)
jne 0x352c8
movq %r14, 0x20(%rsp)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x34c0e
cmpb $0x0, (%rsi)
je 0x34c0e
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdx
addq $0x3, %rdx
leaq 0x1090(%rsp), %rdi
callq 0x34128
jmp 0x34c57
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x3, %rdi
movq %rbx, %rsi
callq 0x3bee9
testq %rax, %rax
je 0x34c8f
movq %rax, %r14
leaq 0x1090(%rsp), %r13
movl $0x1000, %edx           # imm = 0x1000
movq %r13, %rdi
movq %rax, %rsi
callq 0x42b0
movq %r14, %rdi
callq 0x4610
movq %r13, %rdi
callq 0x3adf4
testl %eax, %eax
je 0x34c8f
leaq 0x1090(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x44a0
movb $0x1, %r13b
testl %eax, %eax
je 0x34eaf
testb %r13b, %r13b
movq 0x20(%rsp), %r14
movl 0xc(%rsp), %esi
movq 0x10(%rsp), %r13
jne 0x34c99
jmp 0x34ddb
movq 0x20(%rsp), %r14
movq 0x10(%rsp), %r13
movl %edx, 0x2c(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x3, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3bd51
testq %rax, %rax
je 0x34ce1
movq %rax, %rbx
leaq 0x90(%rsp), %rsi
movq %rax, %rdi
callq 0x3b4c0
movq %rax, 0x30(%r12)
testq %rax, %rax
je 0x34fa8
xorl %ebx, %ebx
jmp 0x34fb1
movq 0x18(%r15), %rdi
leaq 0x1ffbb(%rip), %rdx     # 0x54ca7
movq 0x38(%rsp), %rsi
xorl %ecx, %ecx
callq 0x3ff24
testq %rax, %rax
je 0x34dd2
movq 0x8(%rax), %rbx
movq %r14, %r12
leaq 0x3(%rbx), %r14
leaq 0x20205(%rip), %rsi     # 0x54f18
movl $0x5, %edx
movq %r14, %rdi
callq 0x4280
addq $0x8, %rbx
testl %eax, %eax
cmovneq %r14, %rbx
movq %r12, %r14
movq (%r13), %rax
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x34d53
callq 0x4514a
testl %eax, %eax
jne 0x34dd2
movq (%r13), %rax
movq $0x0, 0x28(%rax)
movq (%r13), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3546d
testq %rax, %rax
je 0x34dd2
movq %rax, %rbx
movq %r15, %rdi
callq 0x35885
movq %rbx, 0x48(%r15)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x34d93
callq 0x4514a
testl %eax, %eax
jne 0x34dd2
movq (%r13), %rax
movq $0x0, 0x28(%rax)
movq (%r13), %rdi
cmpq $0x0, 0x20(%rdi)
je 0x34dd2
movq 0x18(%r15), %rsi
callq 0x33c60
cmpl $-0x1, %eax
je 0x34dd2
movq (%r13), %rax
movq 0x10(%rax), %rax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
testq %rax, %rax
movl 0xc(%rsp), %esi
je 0x34ddb
xorl %edx, %edx
movq 0x48(%rsp), %rcx
cmpq $0x1, (%rax,%rcx,8)
sbbl %edx, %edx
jmp 0x34ddb
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl 0xc(%rsp), %esi
cmpl $-0x1, %edx
je 0x34e9d
movq 0x48(%r15), %rax
movq 0x10(%rax), %rcx
movq 0x48(%rsp), %rdx
movq (%rcx,%rdx,8), %r12
testl %ebp, %ebp
js 0x34e31
cmpl $0x0, 0x8854(%r15)
movl 0x44(%rsp), %ebx
je 0x347e0
movl %ebp, %edx
movq (%rcx,%rdx,8), %rcx
cmpq $0x0, 0x30(%rcx)
je 0x347e0
cmpl %ebp, 0x68(%rax)
jne 0x34e28
movl $0xffffffff, 0x68(%rax) # imm = 0xFFFFFFFF
incq 0x28(%rcx)
jmp 0x347e0
movl 0x44(%rsp), %ebx
jmp 0x347e0
movq 0x58(%r15), %rdi
testq %rdi, %rdi
je 0x34e50
callq 0x4610
movq $0x0, 0x58(%r15)
movq $0x0, 0x50(%r15)
movl %ebp, 0x60(%r15)
movq 0x48(%r15), %rdi
addq $0x38, %rdi
callq 0x43f0
movq %r14, %rdi
jmp 0x35236
movq 0x2f150(%rip), %rcx     # 0x63fc8
movq (%rcx), %rdi
leaq 0x1fff6(%rip), %rsi     # 0x54e78
movq %r15, %rdx
movq %rax, 0x18(%rsp)
movl %ebp, %ecx
xorl %eax, %eax
callq 0x4770
movq 0x18(%rsp), %rax
jmp 0x348ce
movl %ebp, %edi
movq %r13, %rsi
movq %r14, %rdx
callq 0x5798
jmp 0x3523b
leaq 0x1ea63(%rip), %rsi     # 0x53919
leaq 0x1090(%rsp), %rdi
callq 0x436f0
testq %rax, %rax
je 0x34c77
movq %rax, %r14
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%r12)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x18(%r12)
movq 0x10(%rsp), %r13
movq (%r13), %rax
movq (%rax), %rdi
leaq 0x1090(%rsp), %rsi
callq 0x41f30
movq %rax, 0x8(%r12)
movq (%r13), %rax
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x35252
callq 0x4514a
testl %eax, %eax
je 0x35252
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %r13d, %r13d
jmp 0x34c77
cmpq $0x0, 0x28(%r14)
je 0x34a89
movq 0x48(%r15), %rax
movq 0x28(%rax), %rdi
movq %r12, %rsi
movl %r13d, %edx
movl %ebx, %ecx
callq 0x345ea
movq %rax, 0x50(%r15)
testq %rax, %rax
je 0x35220
movq 0x58(%r15), %rdi
testq %rdi, %rdi
je 0x34f6b
callq 0x4610
movl %ebp, 0x60(%r15)
movl %r13d, 0x64(%r15)
movl %ebx, 0x68(%r15)
movq 0x48(%r15), %rdi
movq 0x50(%r15), %r14
movq %r14, 0x58(%r15)
addq $0x38, %rdi
callq 0x43f0
movq 0x20(%rsp), %rdi
callq 0x43f0
movl 0xc(%rsp), %ebx
addq %r14, %rbx
movl %r13d, %eax
subq %rax, %rbx
jmp 0x3523d
movq 0x8(%rbx), %rax
movq %rax, 0x30(%r12)
movl 0xc(%rsp), %esi
movq 0x18(%rsp), %rcx
movq %rbx, 0x38(%r12)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%r12)
movl $0x1, 0x40(%r12)
testq %rcx, %rcx
je 0x352fe
movq 0x18(%rsp), %rax
cmpb $0x0, (%rax)
je 0x352fe
callq 0x4790
movl %eax, 0x38(%rsp)
callq 0x4480
movq %rax, 0x90(%rsp)
xorl %ecx, %ecx
xorl %eax, %eax
movl %ecx, %ebx
shll $0x5, %ebx
subl %ecx, %ebx
movzbl 0x90(%rsp,%rax), %r14d
leal (%rbx,%r14), %ecx
incq %rax
cmpq $0x8, %rax
jne 0x35006
cmpb $0x0, 0x2090(%rsp)
je 0x3504e
leaq 0x2090(%rsp), %rdi
callq 0x3adc0
testl %eax, %eax
jne 0x3504e
leaq 0x2f50b(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
jg 0x3532a
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdx
addq $0x3, %rdx
leaq 0x1090(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x34128
cmpl $0x0, 0x1fc(%r15)
jne 0x35305
leaq 0x1090(%rsp), %rdi
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x34263
addl %ebx, %r14d
incl %r14d
leaq 0x90(%rsp), %r13
xorl %edi, %edi
callq 0x44d0
movq %rax, %rbx
callq 0x4370
xorl %eax, %ebx
movq %r13, %rdi
leaq 0x1fef4(%rip), %rsi     # 0x54faa
leaq 0x1090(%rsp), %rdx
movl 0x38(%rsp), %ecx
movl %r14d, %r8d
movl %ebx, %r9d
xorl %eax, %eax
callq 0x4110
movq %r13, %rdi
leaq 0x1fee1(%rip), %rsi     # 0x54fba
callq 0x4883b
testq %rax, %rax
jne 0x35114
callq 0x4070
incl %r14d
cmpl $0x11, (%rax)
je 0x3509b
leaq 0x90(%rsp), %rdi
callq 0x4440
xorl %eax, %eax
xorl %edx, %edx
movq 0x20(%rsp), %r14
movl 0xc(%rsp), %esi
movq 0x10(%rsp), %r13
jmp 0x352f6
movq %rax, %rbx
callq 0x49d74
testq %rax, %rax
je 0x352a0
movq %rax, %r14
movq 0x10(%r12), %rdx
movq 0x30(%r12), %rsi
movq %rax, %rdi
callq 0x4933f
leaq 0x50(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x49c4d
movq %r14, %rdi
callq 0x49d9c
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x49da6
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x3, %rdi
movl $0x20, %edx
movq %r14, %rsi
callq 0x4280
testl %eax, %eax
jne 0x3534f
movq 0x10(%r12), %r14
movq %r14, 0x18(%rsp)
movq 0x30(%r12), %rsi
movq 0x8(%rbx), %rdi
movq 0x18(%rbx), %r13
subq %rdi, %r13
cmpq %r14, %r13
cmovbq %r13, %r14
movq %rsi, 0x38(%rsp)
movq %r14, %rdx
callq 0x4420
movq 0x18(%rsp), %rdx
addq %r14, 0x8(%rbx)
cmpq %rdx, %r13
jae 0x351d3
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movq %r14, %rcx
callq 0x48356
movq %rax, %r14
cmpq 0x10(%r12), %r14
movq 0x10(%rsp), %r13
jne 0x35364
movq %rbx, %rdi
callq 0x484b2
testl %eax, %eax
movq 0x20(%rsp), %r14
js 0x3520e
leaq 0x90(%rsp), %rdi
movl $0x124, %esi            # imm = 0x124
callq 0x44b0
testl %eax, %eax
je 0x352d7
leaq 0x90(%rsp), %rdi
callq 0x4270
jmp 0x352ec
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq $0x38, %rdi
callq 0x43f0
movq 0x20(%rsp), %rdi
callq 0x43f0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x4098, %rsp           # imm = 0x4098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r13), %rax
movq %r14, 0x28(%rax)
movq 0x8(%r12), %rcx
movq %rcx, 0x20(%rax)
movl $0x1, 0x40(%r12)
xorl %r13d, %r13d
xorl %edx, %edx
jmp 0x34c77
movq 0x2ed4b(%rip), %rax     # 0x63fc8
movq (%rax), %rdi
leaq 0x1fc64(%rip), %rsi     # 0x54eeb
leaq 0x3090(%rsp), %rdx
movq %rdx, 0x18(%rsp)
xorl %eax, %eax
callq 0x4770
jmp 0x34b73
movq %rbx, %rdi
callq 0x4850c
leaq 0x90(%rsp), %rdi
callq 0x4270
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %eax, %eax
movq 0x20(%rsp), %r14
movq 0x10(%rsp), %r13
jmp 0x352f2
movq 0x30(%rsp), %rdi
callq 0x572e
jmp 0x34bde
leaq 0x90(%rsp), %rdi
leaq 0x1090(%rsp), %rsi
callq 0x4330
movb $0x1, %al
movl 0x2c(%rsp), %edx
movl 0xc(%rsp), %esi
testb %al, %al
je 0x34ddb
xorl %edx, %edx
jmp 0x34ddb
movq 0x2ecbc(%rip), %rax     # 0x63fc8
movq (%rax), %rdi
leaq 0x1fc7b(%rip), %rsi     # 0x54f91
leaq 0x1090(%rsp), %rdx
xorl %eax, %eax
callq 0x4770
jmp 0x3507b
movq 0x2ec97(%rip), %rax     # 0x63fc8
movq (%rax), %rdi
leaq 0x1fbe3(%rip), %rsi     # 0x54f1e
leaq 0x2090(%rsp), %rdx
xorl %eax, %eax
callq 0x4770
jmp 0x3504e
leaq 0x90(%rsp), %rsi
movq %rbx, %rdi
callq 0x5757
jmp 0x352b5
leaq 0x1090(%rsp), %rdi
callq 0x4440
jmp 0x351e3
leaq 0x1f81e(%rip), %rdi     # 0x54b9b
leaq 0x1f5f2(%rip), %rsi     # 0x54976
leaq 0x1f81b(%rip), %rcx     # 0x54ba6
movl $0xa73, %edx            # imm = 0xA73
callq 0x4350