// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_subexp_decode_init
cram_codec *cram_subexp_decode_init(char *data, int size,
				    enum cram_external_type option,
				    int version) {
    cram_codec *c;
    char *cp = data;

    if (!(c = malloc(sizeof(*c))))
	return NULL;

    c->codec  = E_SUBEXP;
    c->decode = cram_subexp_decode;
    c->free   = cram_subexp_decode_free;
    c->subexp.k = -1;

    cp += safe_itf8_get(cp, data + size, &c->subexp.offset);
    cp += safe_itf8_get(cp, data + size, &c->subexp.k);

    if (cp - data != size || c->subexp.k < 0) {
	fprintf(stderr, "Malformed subexp header stream\n");
	free(c);
	return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl $0x240, %edi            # imm = 0x240
callq 0x4700
testq %rax, %rax
je 0x4a358
movl $0x7, (%rax)
leaq -0x1ba(%rip), %rcx      # 0x49fd3
movq %rcx, 0x18(%rax)
leaq -0x3d(%rip), %rcx       # 0x4a15b
movq %rcx, 0x10(%rax)
movslq %ebp, %rcx
cmpl $0x5, %ecx
jge 0x4a1c5
testl %ebp, %ebp
jle 0x4a1bc
movzbl (%rbx), %edi
movl %edi, %edx
shrl $0x4, %edx
leaq 0x86a9(%rip), %rsi      # 0x52860
cmpl %ebp, (%rsi,%rdx,4)
jle 0x4a1c8
xorl %edx, %edx
xorl %esi, %esi
jmp 0x4a261
movb (%rbx), %dil
movzbl %dil, %edx
movl $0x1, %esi
testb %dl, %dl
jns 0x4a261
movzbl 0x1(%rbx), %esi
cmpb $-0x41, %dil
ja 0x4a1f2
andl $0x3f, %edx
shll $0x8, %edx
orl %esi, %edx
movl $0x2, %esi
jmp 0x4a261
cmpb $-0x21, %dil
ja 0x4a210
shll $0x8, %esi
movzbl 0x2(%rbx), %edi
andl $0x1f, %edx
shll $0x10, %edx
orl %esi, %edx
orl %edi, %edx
movl $0x3, %esi
jmp 0x4a261
cmpb $-0x11, %dil
ja 0x4a239
shll $0x10, %esi
movzbl 0x2(%rbx), %edi
shll $0x8, %edi
movzbl 0x3(%rbx), %r8d
andl $0xf, %edx
shll $0x18, %edx
orl %esi, %edx
orl %edi, %edx
orl %r8d, %edx
movl $0x4, %esi
jmp 0x4a261
shll $0x1c, %edx
shll $0x14, %esi
orl %edx, %esi
movzbl 0x2(%rbx), %edx
shll $0xc, %edx
orl %esi, %edx
movzbl 0x3(%rbx), %esi
shll $0x4, %esi
orl %edx, %esi
movzbl 0x4(%rbx), %edx
andl $0xf, %edx
orl %esi, %edx
movl $0x5, %esi
movl %edx, 0x30(%rax)
leaq (%rbx,%rsi), %rdx
movq %rcx, %rdi
subq %rsi, %rdi
cmpq $0x5, %rdi
jge 0x4a29c
cmpq %rsi, %rcx
jle 0x4a293
movzbl (%rdx), %r8d
movl %r8d, %esi
shrl $0x4, %esi
leaq 0x85d6(%rip), %r9       # 0x52860
movslq (%r9,%rsi,4), %rsi
cmpq %rsi, %rdi
jge 0x4a29f
xorl %esi, %esi
xorl %edi, %edi
jmp 0x4a33e
movb (%rdx), %r8b
movzbl %r8b, %esi
movl $0x1, %edi
testb %sil, %sil
jns 0x4a33e
movzbl 0x1(%rdx), %edi
cmpb $-0x41, %r8b
ja 0x4a2ca
andl $0x3f, %esi
shll $0x8, %esi
orl %edi, %esi
movl $0x2, %edi
jmp 0x4a33e
cmpb $-0x21, %r8b
ja 0x4a2ea
shll $0x8, %edi
movzbl 0x2(%rdx), %r8d
andl $0x1f, %esi
shll $0x10, %esi
orl %edi, %esi
orl %r8d, %esi
movl $0x3, %edi
jmp 0x4a33e
cmpb $-0x11, %r8b
ja 0x4a316
shll $0x10, %edi
movzbl 0x2(%rdx), %r8d
shll $0x8, %r8d
movzbl 0x3(%rdx), %r9d
andl $0xf, %esi
shll $0x18, %esi
orl %edi, %esi
orl %r8d, %esi
orl %r9d, %esi
movl $0x4, %edi
jmp 0x4a33e
shll $0x1c, %esi
shll $0x14, %edi
orl %esi, %edi
movzbl 0x2(%rdx), %esi
shll $0xc, %esi
orl %edi, %esi
movzbl 0x3(%rdx), %edi
shll $0x4, %edi
orl %esi, %edi
movzbl 0x4(%rdx), %esi
andl $0xf, %esi
orl %edi, %esi
movl $0x5, %edi
movl %esi, 0x34(%rax)
addq %rdi, %rdx
subq %rbx, %rdx
cmpq %rcx, %rdx
jne 0x4a350
testl %esi, %esi
jns 0x4a35a
movq %rax, %rdi
callq 0x60ff
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq