// File: /workspace/github_cpp_makefile_star2_O3/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 $0x88, %rsp
movq %rdx, %r14
movl %esi, %ebx
cmpl $0x3, %esi
ja 0x3c03f
movl %ebx, %esi
movq %r14, %rdx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3b4d0
movq %rdi, 0x50(%rsp)
movl $0x100000, %edi         # imm = 0x100000
callq 0x4700
testq %rax, %rax
je 0x3c46b
movq %rax, %r15
movl $0x100, %edi            # imm = 0x100
movl $0x400, %esi            # imm = 0x400
callq 0x4360
testq %rax, %rax
je 0x3c477
movq %rax, %r12
movq %rbx, 0x18(%rsp)
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x4360
testq %rax, %rax
je 0x3c550
movq %rax, %rbx
movl 0x18(%rsp), %r13d
cvtsi2sd %r13, %xmm1
mulsd 0x16ad1(%rip), %xmm1    # 0x52b78
movsd 0x17509(%rip), %xmm0    # 0x535b8
movsd %xmm1, 0x8(%rsp)
addsd %xmm1, %xmm0
addsd 0x174ff(%rip), %xmm0    # 0x535c0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x14833(%rip), %xmm0    # 0x50908
cvttsd2si %xmm0, %rdi
andq %rcx, %rdi
orq %rax, %rdi
callq 0x4700
testq %rax, %rax
je 0x3c552
movq %r14, 0x68(%rsp)
movq %rax, %rcx
cvttsd2si 0x8(%rsp), %eax
cltq
movq %rcx, 0x48(%rsp)
addq %rcx, %rax
addq $0x3060c, %rax          # imm = 0x3060C
movq %rax, 0x40(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x50(%rsp), %rsi
movq %r15, %r11
movzbl (%rsi,%rax), %edx
incl (%rbx,%rcx,4)
shlq $0xa, %rcx
addq %r12, %rcx
incl (%rcx,%rdx,4)
incq %rax
movq %rdx, %rcx
cmpq %rax, %r13
jne 0x3c11d
movq %r13, 0x58(%rsp)
movq 0x18(%rsp), %rax
movl %eax, %ecx
shrl $0x2, %ecx
movzbl (%rsi,%rcx), %eax
incl (%r12,%rax,4)
movzbl (%rsi,%rcx,2), %eax
incl (%r12,%rax,4)
movq %rcx, 0x60(%rsp)
leaq (%rcx,%rcx,2), %rax
movq %rax, 0x30(%rsp)
movzbl (%rsi,%rax), %eax
incl (%r12,%rax,4)
addl $0x3, (%rbx)
movq 0x48(%rsp), %rax
leaq 0x9(%rax), %r13
leaq 0x4(%r12), %r8
xorl %r15d, %r15d
movl $0x1, %r9d
movsd 0x17438(%rip), %xmm0    # 0x535c8
movq %r12, %r10
xorl %r14d, %r14d
movq %r11, 0x10(%rsp)
movq %r12, 0x70(%rsp)
movq %rbx, 0x78(%rsp)
movl (%rbx,%r15,4), %eax
testl %eax, %eax
je 0x3c3ef
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 (%r10,%rcx,4), %edi
testl %edi, %edi
je 0x3c1f3
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, (%r10,%rcx,4)
addl %edi, %eax
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x3c1c8
movslq %edx, %rcx
movq %r15, %rdi
shlq $0xa, %rdi
addq %r12, %rdi
movl (%rdi,%rcx,4), %edx
subl %eax, %edx
addl $0xfff, %edx            # imm = 0xFFF
movl %edx, (%rdi,%rcx,4)
testl %r14d, %r14d
movq %r10, 0x38(%rsp)
je 0x3c40f
decl %r14d
movq %r13, %rax
movq %r14, 0x20(%rsp)
movq %r9, 0x28(%rsp)
xorl %r11d, %r11d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %r8, 0x8(%rsp)
movq %r8, %r13
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpl $0x0, (%rdi,%r11,4)
je 0x3c347
testl %ebp, %ebp
je 0x3c360
decl %ebp
movq %rax, %r9
movl (%rdi,%r11,4), %eax
movl $0x1, %r8d
cmpl $0x80, %eax
jge 0x3c27b
movq %r9, %rcx
jmp 0x3c291
shrl $0x8, %eax
orb $-0x80, %al
leaq 0x1(%r9), %rcx
movb %al, (%r9)
movl (%rdi,%r11,4), %eax
movl $0x2, %r8d
movb %al, (%rcx)
cmpl $0x1001, %ebx           # imm = 0x1001
jae 0x3ca44
movl (%rdi,%r11,4), %r10d
movl $0x1000, %eax           # imm = 0x1000
subl %ebx, %eax
cmpl %r10d, %eax
jb 0x3ca25
movq %r15, %r14
movq %r15, %rax
shlq $0xc, %rax
addq 0x10(%rsp), %rax
movq %r11, %r15
shlq $0x4, %r15
addq %rax, %r15
movl %r10d, %eax
shll $0x13, %eax
movl %eax, (%r15)
movl $0x1000, %eax           # imm = 0x1000
subl %r10d, %eax
movw %ax, 0xc(%r15)
cmpl $0x2, %r10d
jae 0x3c300
movl $0xffffffff, 0x4(%r15)  # imm = 0xFFFFFFFF
leal 0xfff(%rbx), %eax
movl %eax, 0x8(%r15)
movw $0x20, %si
jmp 0x3c333
movl $0x1e, %esi
leal -0x1e(%rsi), %ecx
movl $0x1, %eax
shll %cl, %eax
incl %esi
cmpl %r10d, %eax
jb 0x3c305
movl $0x1, %eax
movl %esi, %ecx
shlq %cl, %rax
addq %r10, %rax
decq %rax
xorl %edx, %edx
divq %r10
movl %eax, 0x4(%r15)
movl %ebx, 0x8(%r15)
addq %r8, %r9
movw %si, 0xe(%r15)
addl %ebx, %r10d
movl %r10d, %ebx
movq %r9, %rax
movq %r14, %r15
incq %r11
decq %r12
addq $0x4, %r13
cmpq $0x100, %r11            # imm = 0x100
jne 0x3c24d
jmp 0x3c3c3
leaq 0x1(%rax), %r9
movb %r11b, (%rax)
xorl %ebp, %ebp
testq %r11, %r11
je 0x3c265
cmpl $0x0, -0x4(%rdi,%r11,4)
je 0x3c265
leal 0x1(%r11), %ecx
movl %ecx, %ebp
cmpq $0xfe, %r11
ja 0x3c3b4
xorl %ebp, %ebp
cmpl $0x0, (%r13,%rbp,4)
je 0x3c3b1
leaq (%r11,%rbp), %rdx
incq %rdx
incq %rbp
cmpq $0xff, %rdx
jne 0x3c38f
movl $0x100, %ebp            # imm = 0x100
jmp 0x3c3b4
subl %r12d, %ebp
subl %ecx, %ebp
movb %bpl, 0x1(%rax)
addq $0x2, %rax
jmp 0x3c262
movb $0x0, (%rax)
incq %rax
movq %rax, %r13
movq 0x10(%rsp), %r11
movq 0x70(%rsp), %r12
movq 0x78(%rsp), %rbx
movq 0x8(%rsp), %r8
movq 0x28(%rsp), %r9
movq 0x38(%rsp), %r10
movq 0x20(%rsp), %r14
incq %r15
incq %r9
movl $0x400, %eax            # imm = 0x400
addq %rax, %r10
addq %rax, %r8
cmpq $0x100, %r15            # imm = 0x100
jne 0x3c1a5
jmp 0x3c481
leaq 0x1(%r13), %rax
movb %r15b, (%r13)
xorl %r14d, %r14d
testq %r15, %r15
je 0x3c22e
cmpl $0x0, -0x4(%rbx,%r15,4)
je 0x3c22e
leal 0x1(%r15), %eax
movl %eax, %r14d
cmpq $0xff, %r15
je 0x3c45b
movq %r9, %r14
cmpl $0x0, (%rbx,%r14,4)
je 0x3c45b
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x3c442
movl $0x100, %r14d           # imm = 0x100
subl %eax, %r14d
movb %r14b, 0x1(%r13)
addq $0x2, %r13
jmp 0x3c22b
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %ebp, %ebp
jmp 0x3c9f8
xorl %ebx, %ebx
xorl %r12d, %r12d
jmp 0x3c552
movb $0x0, (%r13)
subq 0x48(%rsp), %r13
incq %r13
cmpl $0x30603, %r13d         # imm = 0x30603
jae 0x3ca82
movq 0x18(%rsp), %rdx
movl %edx, %edi
andl $-0x4, %edi
addl $-0x2, %edi
movq 0x50(%rsp), %r10
movq 0x60(%rsp), %r14
movb -0x1(%r10,%r14), %al
movb %al, 0x6(%rsp)
movb -0x1(%r10,%r14,2), %al
movb %al, 0x7(%rsp)
movslq 0x30(%rsp), %rax
movb -0x1(%r10,%rax), %r15b
leal -0x1(%rdx), %eax
movb (%r10,%rax), %cl
leal -0x2(%rdx), %eax
movl $0x800000, %esi         # imm = 0x800000
cmpl %edi, %eax
jle 0x3c55c
movl $0x800000, %r8d         # imm = 0x800000
movq 0x40(%rsp), %rdx
movl %eax, %esi
movzbl (%r10,%rsi), %ebp
movl %ebp, %esi
shll $0xc, %esi
addq %r11, %rsi
movzbl %cl, %ecx
shll $0x4, %ecx
movl (%rcx,%rsi), %r9d
testl %r9d, %r9d
je 0x3ca63
cmpl %r9d, %r8d
jb 0x3c520
movb %r8b, -0x1(%rdx)
decq %rdx
shrl $0x8, %r8d
jmp 0x3c50e
addq %rcx, %rsi
movl %r8d, %ecx
movl 0x4(%rsi), %r9d
imulq %rcx, %r9
movb 0xe(%rsi), %cl
shrq %cl, %r9
addl 0x8(%rsi), %r8d
movzwl 0xc(%rsi), %esi
imull %r9d, %esi
addl %r8d, %esi
decl %eax
movl %ebp, %ecx
movl %esi, %r8d
cmpl %edi, %eax
jg 0x3c4ec
jmp 0x3c563
xorl %ebx, %ebx
xorl %ebp, %ebp
movq %r15, %rax
jmp 0x3c9f8
movq 0x40(%rsp), %rdx
movl %ecx, %ebp
cmpl $0x7, 0x18(%rsp)
jbe 0x3c7bf
movq %r13, 0x80(%rsp)
leal -0x2(%r14), %ecx
movq %rcx, 0x28(%rsp)
movq 0x30(%rsp), %rcx
addl $-0x2, %ecx
movslq %eax, %r14
movslq %ecx, %r12
movq 0x58(%rsp), %rax
shrl $0x2, %eax
leaq -0x2(,%rax,2), %rdi
movl $0x800000, 0x8(%rsp)    # imm = 0x800000
movl $0x800000, %eax         # imm = 0x800000
movl $0x800000, %ebx         # imm = 0x800000
movq 0x50(%rsp), %r13
movzbl (%r13,%r14), %r8d
movq %r8, 0x30(%rsp)
shll $0xc, %r8d
addq %r11, %r8
movzbl %bpl, %ecx
shll $0x4, %ecx
movl (%rcx,%r8), %r9d
testl %r9d, %r9d
je 0x3ca63
movq %r11, %r10
movzbl (%r13,%r12), %ebp
movzbl (%r13,%rdi), %r11d
movl %r11d, 0x38(%rsp)
movl 0x28(%rsp), %r11d
movzbl (%r13,%r11), %r13d
movq %r10, %r11
cmpl %r9d, %esi
jb 0x3c60d
movb %sil, -0x1(%rdx)
decq %rdx
shrl $0x8, %esi
jmp 0x3c5fc
addq %rcx, %r8
movl %ebp, 0x60(%rsp)
movl %ebp, %r9d
shll $0xc, %r9d
movl %esi, %ecx
movl 0x4(%r8), %ebp
imulq %rcx, %rbp
movzbl %r15b, %r15d
shll $0x4, %r15d
movb 0xe(%r8), %cl
shrq %cl, %rbp
addq %r11, %r15
addq %r9, %r15
movl (%r15), %ecx
testl %ecx, %ecx
je 0x3ca63
movl %r13d, 0x20(%rsp)
addl 0x8(%r8), %esi
movzwl 0xc(%r8), %r8d
movl %r8d, 0x58(%rsp)
cmpl %ecx, 0x8(%rsp)
jae 0x3c665
movl 0x8(%rsp), %r13d
jmp 0x3c67a
movl 0x8(%rsp), %r13d
movb %r13b, -0x1(%rdx)
decq %rdx
shrl $0x8, %r13d
cmpl %ecx, %r13d
jae 0x3c66a
movl 0x38(%rsp), %ecx
movl %ecx, %r8d
shll $0xc, %r8d
movl %r13d, %ecx
movl 0x4(%r15), %r11d
imulq %rcx, %r11
movzbl 0x7(%rsp), %r9d
shll $0x4, %r9d
movb 0xe(%r15), %cl
shrq %cl, %r11
addq %r10, %r9
addq %r8, %r9
movl (%r9), %ecx
testl %ecx, %ecx
je 0x3ca63
addl 0x8(%r15), %r13d
movl %r13d, 0x8(%rsp)
movzwl 0xc(%r15), %r10d
cmpl %ecx, %eax
jae 0x3c6cb
movl 0x20(%rsp), %r8d
jmp 0x3c6dd
movl 0x20(%rsp), %r8d
movb %al, -0x1(%rdx)
decq %rdx
shrl $0x8, %eax
cmpl %ecx, %eax
jae 0x3c6d0
movl %r8d, %r13d
shll $0xc, %r13d
movl %eax, %ecx
movl 0x4(%r9), %r15d
imulq %rcx, %r15
movzbl 0x6(%rsp), %r8d
shll $0x4, %r8d
movb 0xe(%r9), %cl
shrq %cl, %r15
addq 0x10(%rsp), %r8
addq %r13, %r8
movl (%r8), %ecx
testl %ecx, %ecx
je 0x3ca63
addl 0x8(%r9), %eax
movzwl 0xc(%r9), %r9d
cmpl %ecx, %ebx
jb 0x3c72a
movb %bl, -0x1(%rdx)
decq %rdx
shrl $0x8, %ebx
jmp 0x3c71b
movl %ebx, %ecx
movl 0x4(%r8), %r13d
imulq %rcx, %r13
movb 0xe(%r8), %cl
shrq %cl, %r13
imull 0x58(%rsp), %ebp
addl %ebp, %esi
imull %r10d, %r11d
addl %r11d, 0x8(%rsp)
imull %r9d, %r15d
addl %r15d, %eax
movl %ebx, %ecx
addl 0x8(%r8), %ecx
movzwl 0xc(%r8), %ebx
imull %r13d, %ebx
addl %ecx, %ebx
decq %rdi
decq %r12
decq %r14
movq 0x30(%rsp), %r8
movl %r8d, %ebp
movl 0x60(%rsp), %r9d
movl %r9d, %r15d
movl 0x38(%rsp), %r10d
movb %r10b, 0x7(%rsp)
movl 0x20(%rsp), %r13d
movb %r13b, 0x6(%rsp)
movq 0x28(%rsp), %rcx
testl %ecx, %ecx
leal -0x1(%rcx), %ecx
movq %rcx, 0x28(%rsp)
movq 0x10(%rsp), %r11
jg 0x3c5af
movl %r13d, %ebp
movl %r9d, %r15d
movq 0x70(%rsp), %r12
movq 0x80(%rsp), %r13
jmp 0x3c7df
movzbl %bpl, %r8d
movl $0x800000, %ebx         # imm = 0x800000
movl $0x800000, %eax         # imm = 0x800000
movl $0x800000, 0x8(%rsp)    # imm = 0x800000
movb 0x6(%rsp), %bpl
movb 0x7(%rsp), %r10b
shll $0x4, %r8d
movl (%r11,%r8), %ecx
testl %ecx, %ecx
je 0x3ca63
addq %r11, %r8
cmpl %ecx, %esi
jb 0x3c802
movb %sil, -0x1(%rdx)
decq %rdx
shrl $0x8, %esi
jmp 0x3c7f2
movl %esi, %ecx
movl 0x4(%r8), %edi
imulq %rcx, %rdi
movb 0xe(%r8), %cl
shrq %cl, %rdi
movzbl %r15b, %r11d
shll $0x4, %r11d
movq 0x10(%rsp), %r9
movl (%r9,%r11), %ecx
testl %ecx, %ecx
je 0x3ca63
addl 0x8(%r8), %esi
movzwl 0xc(%r8), %r15d
addq %r9, %r11
cmpl %ecx, 0x8(%rsp)
jae 0x3c845
movl 0x8(%rsp), %r8d
jmp 0x3c85a
movl 0x8(%rsp), %r8d
movb %r8b, -0x1(%rdx)
decq %rdx
shrl $0x8, %r8d
cmpl %ecx, %r8d
jae 0x3c84a
movl %r8d, %ecx
movl 0x4(%r11), %r9d
imulq %rcx, %r9
movb 0xe(%r11), %cl
shrq %cl, %r9
movzbl %r10b, %r10d
shll $0x4, %r10d
movq 0x10(%rsp), %r14
movl (%r14,%r10), %ecx
testl %ecx, %ecx
je 0x3ca63
addl 0x8(%r11), %r8d
movl %r8d, 0x8(%rsp)
movzwl 0xc(%r11), %r8d
addq %r14, %r10
movl %r15d, %r11d
cmpl %ecx, %eax
jb 0x3c8a8
movb %al, -0x1(%rdx)
decq %rdx
shrl $0x8, %eax
jmp 0x3c899
movl %eax, %ecx
movl 0x4(%r10), %r14d
imulq %rcx, %r14
movb 0xe(%r10), %cl
shrq %cl, %r14
movzbl %bpl, %r15d
shll $0x4, %r15d
movq 0x10(%rsp), %rbp
movl (%rbp,%r15), %ecx
testl %ecx, %ecx
je 0x3ca63
addl 0x8(%r10), %eax
movzwl 0xc(%r10), %r10d
imull %r14d, %r10d
addl %eax, %r10d
imull %r11d, %edi
addl %edi, %esi
imull %r8d, %r9d
movl 0x8(%rsp), %r8d
addl %r9d, %r8d
movl %r8d, %r9d
movq %rbp, %rax
addq %r15, %rax
cmpl %ecx, %ebx
jae 0x3c909
movq 0x68(%rsp), %r8
jmp 0x3c91b
movq 0x68(%rsp), %r8
movb %bl, -0x1(%rdx)
decq %rdx
shrl $0x8, %ebx
cmpl %ecx, %ebx
jae 0x3c90e
movl %ebx, %ecx
movl 0x4(%rax), %edi
imulq %rcx, %rdi
movb 0xe(%rax), %cl
shrq %cl, %rdi
addl 0x8(%rax), %ebx
movzwl 0xc(%rax), %eax
imull %edi, %eax
addl %ebx, %eax
movl %esi, -0x4(%rdx)
movl %r9d, %ebx
movb %bl, -0x8(%rdx)
movb %bh, -0x7(%rdx)
movl %r9d, %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 0x40(%rsp), %rdx
subq %rsi, %rdx
movl %r13d, %eax
addq %rdx, %r13
movl %r13d, (%r8)
movq 0x48(%rsp), %rbp
movb $0x1, (%rbp)
movl %r13d, %ecx
addb $-0x9, %cl
movb %cl, 0x1(%rbp)
leal 0xfff7(%r13), %ecx
movb %ch, 0x2(%rbp)
leal 0xfffff7(%r13), %ecx
shrl $0x10, %ecx
movb %cl, 0x3(%rbp)
leal -0x9(%r13), %ecx
shrl $0x18, %ecx
movb %cl, 0x4(%rbp)
movq 0x18(%rsp), %rbx
movb %bl, 0x5(%rbp)
movb %bh, 0x6(%rbp)
movl %ebx, %ecx
shrl $0x10, %ecx
movb %cl, 0x7(%rbp)
shrl $0x18, %ebx
movb %bl, 0x8(%rbp)
andl $0x3ffff, %eax          # imm = 0x3FFFF
movq %rbp, %rdi
addq %rax, %rdi
callq 0x48c0
movq 0x78(%rsp), %rbx
movq 0x10(%rsp), %rax
movq %rax, %rdi
callq 0x4610
movq %r12, %rdi
callq 0x4610
movq %rbx, %rdi
callq 0x4610
movq %rbp, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16dc1(%rip), %rdi     # 0x537ed
leaq 0x16d45(%rip), %rsi     # 0x53778
leaq 0x16d51(%rip), %rcx     # 0x5378b
movl $0xbb, %edx
callq 0x4350
leaq 0x16d86(%rip), %rdi     # 0x537d1
leaq 0x16d26(%rip), %rsi     # 0x53778
leaq 0x16d32(%rip), %rcx     # 0x5378b
movl $0xba, %edx
callq 0x4350
leaq 0x16da6(%rip), %rdi     # 0x53810
leaq 0x16d07(%rip), %rsi     # 0x53778
leaq 0x16da8(%rip), %rcx     # 0x53820
movl $0x10f, %edx            # imm = 0x10F
callq 0x4350
leaq 0x16c2d(%rip), %rdi     # 0x536b6
leaq 0x16b67(%rip), %rsi     # 0x535f7
leaq 0x16c34(%rip), %rcx     # 0x536cb
movl $0x1e3, %edx            # imm = 0x1E3
callq 0x4350