// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/rANS_static.c
// Function: rans_compress_O1
unsigned char *rans_compress_O1(unsigned char *in, unsigned int in_size,
				unsigned int *out_size) {
    unsigned char *out_buf = NULL, *out_end, *cp;
    unsigned int last_i, tab_size, rle_i, rle_j;
    RansEncSymbol (*syms)[256] = NULL;  /* syms[256][256] */
    int (*F)[256] = NULL;               /* F[256][256]    */
    int *T = NULL;                      /* T[256]         */
    int i, j;
    unsigned char c;

    if (in_size < 4)
	return rans_compress_O0(in, in_size, out_size);

    syms = malloc(256 * sizeof(*syms));
    if (!syms) goto cleanup;
    F = calloc(256, sizeof(*F));
    if (!F) goto cleanup;
    T = calloc(256, sizeof(*T));
    if (!T) goto cleanup;
    out_buf = malloc(1.05*in_size + 257*257*3 + 9);
    if (!out_buf) goto cleanup;

    out_end = out_buf + (int)(1.05*in_size) + 257*257*3 + 9;
    cp = out_buf+9;

    //for (last = 0, i=in_size-1; i>=0; i--) {
    //	F[last][c = in[i]]++;
    //	T[last]++;
    //	last = c;
    //}

    for (last_i=i=0; i<in_size; i++) {
	F[last_i][c = in[i]]++;
	T[last_i]++;
	last_i = c;
    }
    F[0][in[1*(in_size>>2)]]++;
    F[0][in[2*(in_size>>2)]]++;
    F[0][in[3*(in_size>>2)]]++;
    T[0]+=3;

    // Normalise so T[i] == TOTFREQ
    for (rle_i = i = 0; i < 256; i++) {
	int t2, m, M;
	unsigned int x;

	if (T[i] == 0)
	    continue;

	//uint64_t p = (TOTFREQ * TOTFREQ) / t;
	double p = ((double)TOTFREQ)/T[i];
	for (t2 = m = M = j = 0; j < 256; j++) {
	    if (!F[i][j])
		continue;

	    if (m < F[i][j])
		m = F[i][j], M = j;

	    //if ((F[i][j] = (F[i][j] * p) / TOTFREQ) == 0)
	    if ((F[i][j] *= p) == 0)
		F[i][j] = 1;
	    t2 += F[i][j];
	}

	t2++;
	if (t2 < TOTFREQ)
	    F[i][M] += TOTFREQ-t2;
	else
	    F[i][M] -= t2-TOTFREQ;

	// Store frequency table
	// i
	if (rle_i) {
	    rle_i--;
	} else {
	    *cp++ = i;
	    // FIXME: could use order-0 statistics to observe which alphabet
	    // symbols are present and base RLE on that ordering instead.
	    if (i && T[i-1]) {
		for(rle_i=i+1; rle_i<256 && T[rle_i]; rle_i++)
		    ;
		rle_i -= i+1;
		*cp++ = rle_i;
	    }
	}

	int *F_i_ = F[i];
	x = 0;
	rle_j = 0;
	for (j = 0; j < 256; j++) {
	    if (F_i_[j]) {
		//fprintf(stderr, "F[%d][%d]=%d, x=%d\n", i, j, F_i_[j], x);

		// j
		if (rle_j) {
		    rle_j--;
		} else {
		    *cp++ = j;
		    if (!rle_j && j && F_i_[j-1]) {
			for(rle_j=j+1; rle_j<256 && F_i_[rle_j]; rle_j++)
			    ;
			rle_j -= j+1;
			*cp++ = rle_j;
		    }
		}

		// F_i_[j]
		if (F_i_[j]<128) {
		    *cp++ = F_i_[j];
		} else {
		    *cp++ = 128 | (F_i_[j]>>8);
		    *cp++ = F_i_[j]&0xff;
		}

		RansEncSymbolInit(&syms[i][j], x, F_i_[j], TF_SHIFT);
		x += F_i_[j];
	    }
	}
	*cp++ = 0;
    }
    *cp++ = 0;

    //write(1, out_buf+4, cp-(out_buf+4));
    tab_size = cp - out_buf;
    assert(tab_size < 257*257*3);

    RansState rans0, rans1, rans2, rans3;
    RansEncInit(&rans0);
    RansEncInit(&rans1);
    RansEncInit(&rans2);
    RansEncInit(&rans3);

    uint8_t* ptr = out_end;

    int isz4 = in_size>>2;
    int i0 = 1*isz4-2;
    int i1 = 2*isz4-2;
    int i2 = 3*isz4-2;
    int i3 = 4*isz4-2;

    unsigned char l0 = in[i0+1];
    unsigned char l1 = in[i1+1];
    unsigned char l2 = in[i2+1];
    unsigned char l3 = in[i3+1];

    // Deal with the remainder
    l3 = in[in_size-1];
    for (i3 = in_size-2; i3 > 4*isz4-2; i3--) {
	unsigned char c3 = in[i3];
	RansEncPutSymbol(&rans3, &ptr, &syms[c3][l3]);
	l3 = c3;
    }

    for (; i0 >= 0; i0--, i1--, i2--, i3--) {
	unsigned char c0, c1, c2, c3;
	RansEncSymbol *s3 = &syms[c3 = in[i3]][l3];
	RansEncSymbol *s2 = &syms[c2 = in[i2]][l2];
	RansEncSymbol *s1 = &syms[c1 = in[i1]][l1];
	RansEncSymbol *s0 = &syms[c0 = in[i0]][l0];

	RansEncPutSymbol(&rans3, &ptr, s3);
	RansEncPutSymbol(&rans2, &ptr, s2);
	RansEncPutSymbol(&rans1, &ptr, s1);
	RansEncPutSymbol(&rans0, &ptr, s0);

	l0 = c0;
	l1 = c1;
	l2 = c2;
	l3 = c3;
    }

    RansEncPutSymbol(&rans3, &ptr, &syms[0][l3]);
    RansEncPutSymbol(&rans2, &ptr, &syms[0][l2]);
    RansEncPutSymbol(&rans1, &ptr, &syms[0][l1]);
    RansEncPutSymbol(&rans0, &ptr, &syms[0][l0]);

    RansEncFlush(&rans3, &ptr);
    RansEncFlush(&rans2, &ptr);
    RansEncFlush(&rans1, &ptr);
    RansEncFlush(&rans0, &ptr);

    *out_size = (out_end - ptr) + tab_size;

    cp = out_buf;
    *cp++ = 1; // order

    *cp++ = ((*out_size-9)>> 0) & 0xff;
    *cp++ = ((*out_size-9)>> 8) & 0xff;
    *cp++ = ((*out_size-9)>>16) & 0xff;
    *cp++ = ((*out_size-9)>>24) & 0xff;

    *cp++ = (in_size>> 0) & 0xff;
    *cp++ = (in_size>> 8) & 0xff;
    *cp++ = (in_size>>16) & 0xff;
    *cp++ = (in_size>>24) & 0xff;

    memmove(out_buf + tab_size, ptr, out_end-ptr);

 cleanup:
    free(syms);
    free(F);
    free(T);

    return out_buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rdi, %r14
cmpl $0x3, %esi
ja 0x3cd77
movq %r14, %rdi
movq %rbx, %rdx
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c1a4
movq %rsi, 0x20(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0x4700
testq %rax, %rax
je 0x3d1b0
movq %rax, 0x8(%rsp)
movl $0x100, %edi            # imm = 0x100
movl $0x400, %esi            # imm = 0x400
callq 0x4360
testq %rax, %rax
je 0x3d1bd
movq %rax, %r15
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x4360
testq %rax, %rax
je 0x3d29c
movq %rax, %r12
movl 0x20(%rsp), %r13d
cvtsi2sd %r13, %xmm1
mulsd 0x17aec(%rip), %xmm1    # 0x548c8
movsd 0x18524(%rip), %xmm0    # 0x55308
movsd %xmm1, 0x10(%rsp)
addsd %xmm1, %xmm0
addsd 0x1851a(%rip), %xmm0    # 0x55310
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x15afe(%rip), %xmm0    # 0x52908
cvttsd2si %xmm0, %rdi
andq %rcx, %rdi
orq %rax, %rdi
callq 0x4700
testq %rax, %rax
je 0x3d29f
movq %rbx, 0x80(%rsp)
movq %rax, %rcx
cvttsd2si 0x10(%rsp), %eax
cltq
movq %rcx, 0x50(%rsp)
addq %rcx, %rax
addq $0x3060c, %rax          # imm = 0x3060C
movq %rax, 0x48(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
movzbl (%r14,%rax), %edx
incl (%r12,%rcx,4)
shlq $0xa, %rcx
addq %r15, %rcx
incl (%rcx,%rdx,4)
incq %rax
movq %rdx, %rcx
cmpq %rax, %r13
jne 0x3ce4d
movq %r13, 0x68(%rsp)
movq 0x20(%rsp), %rax
movl %eax, %ecx
shrl $0x2, %ecx
movzbl (%r14,%rcx), %eax
incl (%r15,%rax,4)
movzbl (%r14,%rcx,2), %eax
incl (%r15,%rax,4)
movq %rcx, 0x70(%rsp)
leaq (%rcx,%rcx,2), %rax
movq %r14, 0x88(%rsp)
movq %rax, 0x30(%rsp)
movzbl (%r14,%rax), %eax
incl (%r15,%rax,4)
addl $0x3, (%r12)
movq 0x50(%rsp), %rax
leaq 0x9(%rax), %r13
leaq 0x4(%r15), %r11
xorl %r8d, %r8d
movl $0x1, %r9d
movsd 0x1844a(%rip), %xmm0    # 0x55318
movq %r15, %r14
xorl %r10d, %r10d
movq %r15, 0x60(%rsp)
movq %r12, 0x58(%rsp)
movl (%r12,%r8,4), %eax
testl %eax, %eax
je 0x3d12c
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
xorl %eax, %eax
movl (%r14,%rcx,4), %edi
testl %edi, %edi
je 0x3cf2c
cmpl %edi, %esi
cmovlel %edi, %esi
cmovll %ecx, %edx
xorps %xmm2, %xmm2
cvtsi2sd %edi, %xmm2
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %edi
cmpl $0x1, %edi
adcl $0x0, %edi
movl %edi, (%r14,%rcx,4)
addl %edi, %eax
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x3cf01
movslq %edx, %rcx
movq %r8, %rdi
shlq $0xa, %rdi
addq %r15, %rdi
movl (%rdi,%rcx,4), %edx
subl %eax, %edx
addl $0xfff, %edx            # imm = 0xFFF
movl %edx, (%rdi,%rcx,4)
testl %r10d, %r10d
je 0x3d14c
decl %r10d
movq %r13, %rax
movq 0x8(%rsp), %rsi
movq %r10, 0x28(%rsp)
movq %r9, 0x38(%rsp)
movq %r8, 0x10(%rsp)
xorl %ebx, %ebx
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %r11, 0x40(%rsp)
xorl %ebp, %ebp
xorl %r8d, %r8d
cmpl $0x0, (%rdi,%rbx,4)
je 0x3d08c
testl %ebp, %ebp
je 0x3d0a5
decl %ebp
movq %rax, %r9
movl (%rdi,%rbx,4), %eax
movl $0x1, %r10d
cmpl $0x80, %eax
jge 0x3cfb4
movq %r9, %rcx
jmp 0x3cfc9
shrl $0x8, %eax
orb $-0x80, %al
leaq 0x1(%r9), %rcx
movb %al, (%r9)
movl (%rdi,%rbx,4), %eax
movl $0x2, %r10d
movb %al, (%rcx)
cmpl $0x1001, %r8d           # imm = 0x1001
jae 0x3d786
movl (%rdi,%rbx,4), %r13d
movl $0x1000, %eax           # imm = 0x1000
subl %r8d, %eax
cmpl %r13d, %eax
jb 0x3d767
movq 0x10(%rsp), %rax
shlq $0xc, %rax
addq %rsi, %rax
movq %rbx, %r15
shlq $0x4, %r15
addq %rax, %r15
movl %r13d, %eax
shll $0x13, %eax
movl %eax, (%r15)
movl $0x1000, %eax           # imm = 0x1000
subl %r13d, %eax
movw %ax, 0xc(%r15)
cmpl $0x2, %r13d
jae 0x3d037
movl $0xffffffff, 0x4(%r15)  # imm = 0xFFFFFFFF
movw $0x0, 0xe(%r15)
leal 0xfff(%r8), %eax
jmp 0x3d076
movl $0x1e, %esi
leal -0x1e(%rsi), %ecx
movl $0x1, %eax
shll %cl, %eax
incl %esi
cmpl %r13d, %eax
jb 0x3d03c
movl $0x1, %eax
movl %esi, %ecx
shlq %cl, %rax
addq %r13, %rax
decq %rax
xorl %edx, %edx
divq %r13
movl %eax, 0x4(%r15)
addl $-0x20, %esi
movw %si, 0xe(%r15)
movl %r8d, %eax
movq 0x8(%rsp), %rsi
movl %eax, 0x8(%r15)
addw $0x20, 0xe(%r15)
addq %r10, %r9
addl %r8d, %r13d
movl %r13d, %r8d
movq %r9, %rax
incq %rbx
decq %r12
addq $0x4, %r11
cmpq $0x100, %rbx            # imm = 0x100
jne 0x3cf88
jmp 0x3d105
leaq 0x1(%rax), %r9
movb %bl, (%rax)
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x3cf9f
cmpl $0x0, -0x4(%rdi,%rbx,4)
je 0x3cf9f
leaq 0x1(%rbx), %rcx
movl %ecx, %ebp
cmpq $0xfe, %rbx
ja 0x3d0f6
xorl %ebp, %ebp
cmpl $0x0, (%r11,%rbp,4)
je 0x3d0f3
leaq (%rbx,%rbp), %rdx
incq %rdx
incq %rbp
cmpq $0xff, %rdx
jne 0x3d0d2
movl $0x100, %ebp            # imm = 0x100
jmp 0x3d0f6
subl %r12d, %ebp
subl %ecx, %ebp
movb %bpl, 0x1(%rax)
addq $0x2, %rax
jmp 0x3cf9c
movb $0x0, (%rax)
incq %rax
movq %rax, %r13
movq 0x60(%rsp), %r15
movq 0x58(%rsp), %r12
movq 0x40(%rsp), %r11
movq 0x10(%rsp), %r8
movq 0x38(%rsp), %r9
movq 0x28(%rsp), %r10
incq %r8
incq %r9
movl $0x400, %eax            # imm = 0x400
addq %rax, %r14
addq %rax, %r11
cmpq $0x100, %r8             # imm = 0x100
jne 0x3cede
jmp 0x3d1c8
leaq 0x1(%r13), %rax
movb %r8b, (%r13)
xorl %r10d, %r10d
testq %r8, %r8
movq 0x8(%rsp), %rsi
je 0x3cf67
cmpl $0x0, -0x4(%r12,%r8,4)
je 0x3cf67
leaq 0x1(%r8), %rax
movl %eax, %r10d
cmpq $0xff, %r8
je 0x3d19d
movq %r9, %r10
cmpl $0x0, (%r12,%r10,4)
je 0x3d19d
incq %r10
cmpq $0x100, %r10            # imm = 0x100
jne 0x3d184
movl $0x100, %r10d           # imm = 0x100
subl %eax, %r10d
movb %r10b, 0x1(%r13)
addq $0x2, %r13
movq %r13, %rax
jmp 0x3cf67
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %ebx, %ebx
jmp 0x3d73a
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x3d29f
movb $0x0, (%r13)
subq 0x50(%rsp), %r13
incq %r13
cmpl $0x30603, %r13d         # imm = 0x30603
jae 0x3d7c4
movq 0x20(%rsp), %rdx
movl %edx, %edi
andl $-0x4, %edi
addl $-0x2, %edi
movq 0x88(%rsp), %rbx
movq 0x70(%rsp), %r14
movb -0x1(%rbx,%r14), %al
movb %al, 0x28(%rsp)
movb -0x1(%rbx,%r14,2), %bpl
movslq 0x30(%rsp), %rax
movb -0x1(%rbx,%rax), %r11b
leal -0x1(%rdx), %eax
movb (%rbx,%rax), %cl
leal -0x2(%rdx), %eax
movl $0x800000, 0x10(%rsp)   # imm = 0x800000
cmpl %edi, %eax
jle 0x3d2a6
movl $0x800000, %r9d         # imm = 0x800000
movq 0x48(%rsp), %rdx
movl %eax, %esi
movzbl (%rbx,%rsi), %r8d
movl %r8d, %esi
shll $0xc, %esi
addq 0x8(%rsp), %rsi
movzbl %cl, %ecx
shll $0x4, %ecx
movl (%rcx,%rsi), %r10d
testl %r10d, %r10d
je 0x3d7a5
cmpl %r10d, %r9d
jb 0x3d26b
movb %r9b, -0x1(%rdx)
decq %rdx
shrl $0x8, %r9d
jmp 0x3d259
addq %rcx, %rsi
movl %r9d, %ecx
movl 0x4(%rsi), %r10d
imulq %rcx, %r10
movb 0xe(%rsi), %cl
shrq %cl, %r10
addl 0x8(%rsi), %r9d
movzwl 0xc(%rsi), %esi
imull %r10d, %esi
addl %r9d, %esi
decl %eax
movl %r8d, %ecx
movl %esi, %r9d
cmpl %edi, %eax
jg 0x3d234
jmp 0x3d2b3
xorl %r12d, %r12d
xorl %ebx, %ebx
jmp 0x3d735
movl $0x800000, %esi         # imm = 0x800000
movq 0x48(%rsp), %rdx
movl %ecx, %r8d
movq %r13, 0x90(%rsp)
cmpl $0x8, 0x20(%rsp)
jb 0x3d4f1
movb %bpl, 0x1c(%rsp)
leal -0x2(%r14), %r13d
movq 0x30(%rsp), %rcx
addl $-0x2, %ecx
movslq %eax, %r12
movslq %ecx, %rdi
movq 0x68(%rsp), %rax
shrl $0x2, %eax
leaq -0x2(,%rax,2), %r15
movl $0x800000, %ebx         # imm = 0x800000
movl $0x800000, %eax         # imm = 0x800000
movl $0x800000, 0x10(%rsp)   # imm = 0x800000
movq 0x88(%rsp), %r9
movzbl (%r9,%r12), %ecx
movl %ecx, 0x30(%rsp)
movl %ecx, %r10d
shll $0xc, %r10d
addq 0x8(%rsp), %r10
movzbl %r8b, %ecx
shll $0x4, %ecx
movl (%rcx,%r10), %ebp
testl %ebp, %ebp
je 0x3d7a5
movzbl (%r9,%rdi), %r14d
movl %r14d, 0x40(%rsp)
movzbl (%r9,%r15), %r14d
movl %r14d, 0x38(%rsp)
movq %r13, 0x70(%rsp)
movl %r13d, %r13d
movzbl (%r9,%r13), %r14d
cmpl %ebp, %esi
jb 0x3d360
movb %sil, -0x1(%rdx)
decq %rdx
shrl $0x8, %esi
jmp 0x3d350
addq %rcx, %r10
movl 0x40(%rsp), %ecx
movl %ecx, %ebp
shll $0xc, %ebp
movl %esi, %ecx
movl 0x4(%r10), %r13d
imulq %rcx, %r13
movzbl %r11b, %r11d
shll $0x4, %r11d
movb 0xe(%r10), %cl
shrq %cl, %r13
addq 0x8(%rsp), %r11
addq %rbp, %r11
movl (%r11), %ecx
testl %ecx, %ecx
je 0x3d7a5
addl 0x8(%r10), %esi
movzwl 0xc(%r10), %r9d
cmpl %ecx, %ebx
jb 0x3d3b0
movb %bl, -0x1(%rdx)
decq %rdx
shrl $0x8, %ebx
jmp 0x3d3a1
movl 0x38(%rsp), %ecx
movl %ecx, %r10d
shll $0xc, %r10d
movl %ebx, %ecx
movl 0x4(%r11), %ebp
imulq %rcx, %rbp
movzbl 0x1c(%rsp), %r8d
shll $0x4, %r8d
movb 0xe(%r11), %cl
shrq %cl, %rbp
addq 0x8(%rsp), %r8
addq %r10, %r8
movl (%r8), %ecx
testl %ecx, %ecx
je 0x3d7a5
addl 0x8(%r11), %ebx
movzwl 0xc(%r11), %r10d
cmpl %ecx, %eax
movl %r9d, 0x68(%rsp)
movl %r10d, 0x1c(%rsp)
jb 0x3d40d
movb %al, -0x1(%rdx)
decq %rdx
shrl $0x8, %eax
cmpl %ecx, %eax
jae 0x3d400
movl %r14d, %r9d
shll $0xc, %r9d
movl %eax, %ecx
movl 0x4(%r8), %r11d
imulq %rcx, %r11
movzbl 0x28(%rsp), %r10d
shll $0x4, %r10d
movb 0xe(%r8), %cl
shrq %cl, %r11
addq 0x8(%rsp), %r10
addq %r9, %r10
movl (%r10), %ecx
testl %ecx, %ecx
je 0x3d7a5
movl %r14d, 0x7c(%rsp)
addl 0x8(%r8), %eax
movzwl 0xc(%r8), %r8d
cmpl %ecx, 0x10(%rsp)
jae 0x3d45d
movl 0x10(%rsp), %r14d
jmp 0x3d472
movl 0x10(%rsp), %r14d
movb %r14b, -0x1(%rdx)
decq %rdx
shrl $0x8, %r14d
cmpl %ecx, %r14d
jae 0x3d462
movl %r14d, %ecx
movl 0x4(%r10), %r9d
imulq %rcx, %r9
movb 0xe(%r10), %cl
shrq %cl, %r9
imull 0x68(%rsp), %r13d
addl %r13d, %esi
imull 0x1c(%rsp), %ebp
addl %ebp, %ebx
imull %r8d, %r11d
addl %r11d, %eax
addl 0x8(%r10), %r14d
movzwl 0xc(%r10), %ecx
imull %r9d, %ecx
addl %ecx, %r14d
movl %r14d, 0x10(%rsp)
decq %r15
decq %rdi
decq %r12
movl 0x30(%rsp), %ebp
movl %ebp, %r8d
movl 0x40(%rsp), %r9d
movl %r9d, %r11d
movl 0x38(%rsp), %r14d
movb %r14b, 0x1c(%rsp)
movl 0x7c(%rsp), %r10d
movb %r10b, 0x28(%rsp)
movq 0x70(%rsp), %rcx
testl %ecx, %ecx
leal -0x1(%rcx), %ecx
movl %ecx, %r13d
jg 0x3d2ff
jmp 0x3d50b
movl $0x800000, %eax         # imm = 0x800000
movl $0x800000, %ebx         # imm = 0x800000
movb 0x28(%rsp), %cl
movl %ecx, %r10d
movl %ebp, %r14d
movl %r11d, %r9d
movl %r8d, %ebp
movzbl %bpl, %r8d
shll $0x4, %r8d
movq 0x8(%rsp), %rdi
movl (%rdi,%r8), %ecx
testl %ecx, %ecx
je 0x3d7a5
addq %rdi, %r8
cmpl %ecx, %esi
movq 0x90(%rsp), %r13
jb 0x3d541
movb %sil, -0x1(%rdx)
decq %rdx
shrl $0x8, %esi
cmpl %ecx, %esi
jae 0x3d533
movl %esi, %ecx
movl 0x4(%r8), %edi
imulq %rcx, %rdi
movb 0xe(%r8), %cl
shrq %cl, %rdi
movzbl %r9b, %r11d
shll $0x4, %r11d
movq 0x8(%rsp), %r9
movl (%r9,%r11), %ecx
testl %ecx, %ecx
je 0x3d7a5
addl 0x8(%r8), %esi
movzwl 0xc(%r8), %r8d
addq %r9, %r11
movl %r10d, %ebp
cmpl %ecx, %ebx
jb 0x3d589
movb %bl, -0x1(%rdx)
decq %rdx
shrl $0x8, %ebx
jmp 0x3d57a
movl %ebx, %ecx
movl 0x4(%r11), %r9d
imulq %rcx, %r9
movb 0xe(%r11), %cl
shrq %cl, %r9
movzbl %r14b, %r10d
shll $0x4, %r10d
movq 0x8(%rsp), %r14
movl (%r14,%r10), %ecx
testl %ecx, %ecx
je 0x3d7a5
addl 0x8(%r11), %ebx
movzwl 0xc(%r11), %r11d
addq %r14, %r10
cmpl %ecx, %eax
jb 0x3d5ce
movb %al, -0x1(%rdx)
decq %rdx
shrl $0x8, %eax
jmp 0x3d5bf
movl %eax, %ecx
movl 0x4(%r10), %r14d
imulq %rcx, %r14
movb 0xe(%r10), %cl
shrq %cl, %r14
movzbl %bpl, %r15d
shll $0x4, %r15d
movq 0x8(%rsp), %r12
movl (%r12,%r15), %ecx
testl %ecx, %ecx
je 0x3d7a5
addl 0x8(%r10), %eax
movzwl 0xc(%r10), %r10d
imull %r14d, %r10d
addl %eax, %r10d
imull %r8d, %edi
addl %edi, %esi
imull %r11d, %r9d
addl %r9d, %ebx
movq %r12, %rax
addq %r15, %rax
cmpl %ecx, 0x10(%rsp)
jae 0x3d63a
movq 0x60(%rsp), %r15
movq 0x58(%rsp), %r12
movq 0x80(%rsp), %r8
movl 0x10(%rsp), %r9d
jmp 0x3d661
movq 0x60(%rsp), %r15
movq 0x58(%rsp), %r12
movq 0x80(%rsp), %r8
movl 0x10(%rsp), %r9d
movb %r9b, -0x1(%rdx)
decq %rdx
shrl $0x8, %r9d
cmpl %ecx, %r9d
jae 0x3d651
movl %r9d, %ecx
movl 0x4(%rax), %edi
imulq %rcx, %rdi
movb 0xe(%rax), %cl
shrq %cl, %rdi
addl 0x8(%rax), %r9d
movzwl 0xc(%rax), %eax
imull %edi, %eax
addl %r9d, %eax
movl %esi, -0x4(%rdx)
movb %bl, -0x8(%rdx)
movb %bh, -0x7(%rdx)
movl %ebx, %ecx
shrl $0x10, %ecx
movb %cl, -0x6(%rdx)
shrl $0x18, %ebx
movb %bl, -0x5(%rdx)
movl %r10d, %ebx
movb %bl, -0xc(%rdx)
movb %bh, -0xb(%rdx)
movl %r10d, %ecx
shrl $0x10, %ecx
movb %cl, -0xa(%rdx)
shrl $0x18, %ebx
movb %bl, -0x9(%rdx)
leaq -0x10(%rdx), %rsi
movb %al, -0x10(%rdx)
movb %ah, -0xf(%rdx)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, -0xe(%rdx)
shrl $0x18, %eax
movb %al, -0xd(%rdx)
movq 0x48(%rsp), %r9
subq %rsi, %r9
movl %r13d, %eax
addq %r9, %r13
movl %r13d, (%r8)
movq 0x50(%rsp), %rbx
movb $0x1, (%rbx)
movl %r13d, %ecx
addb $-0x9, %cl
movb %cl, 0x1(%rbx)
leal 0xfff7(%r13), %ecx
movb %ch, 0x2(%rbx)
leal 0xfffff7(%r13), %ecx
shrl $0x10, %ecx
movb %cl, 0x3(%rbx)
leal -0x9(%r13), %ecx
shrl $0x18, %ecx
movb %cl, 0x4(%rbx)
movq 0x20(%rsp), %rdx
movb %dl, 0x5(%rbx)
movb %dh, 0x6(%rbx)
movl %edx, %ecx
shrl $0x10, %ecx
movb %cl, 0x7(%rbx)
shrl $0x18, %edx
movb %dl, 0x8(%rbx)
andl $0x3ffff, %eax          # imm = 0x3FFFF
movq %rbx, %rdi
addq %rax, %rdi
movq %r9, %rdx
callq 0x48c0
movq 0x8(%rsp), %rax
movq %rax, %rdi
callq 0x4610
movq %r15, %rdi
callq 0x4610
movq %r12, %rdi
callq 0x4610
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17dcf(%rip), %rdi     # 0x5553d
leaq 0x17d53(%rip), %rsi     # 0x554c8
leaq 0x17d5f(%rip), %rcx     # 0x554db
movl $0xbb, %edx
callq 0x4350
leaq 0x17d94(%rip), %rdi     # 0x55521
leaq 0x17d34(%rip), %rsi     # 0x554c8
leaq 0x17d40(%rip), %rcx     # 0x554db
movl $0xba, %edx
callq 0x4350
leaq 0x17db4(%rip), %rdi     # 0x55560
leaq 0x17d15(%rip), %rsi     # 0x554c8
leaq 0x17db6(%rip), %rcx     # 0x55570
movl $0x10f, %edx            # imm = 0x10F
callq 0x4350
leaq 0x17c3b(%rip), %rdi     # 0x55406
leaq 0x17b75(%rip), %rsi     # 0x55347
leaq 0x17c42(%rip), %rcx     # 0x5541b
movl $0x1e3, %edx            # imm = 0x1E3
callq 0x4350