// File: /workspace/github_cpp_makefile_star2_O1/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 0x4b438
movl $0x7, (%rax)
leaq -0x1e1(%rip), %rcx      # 0x4b094
movq %rcx, 0x18(%rax)
leaq -0x3d(%rip), %rcx       # 0x4b243
movq %rcx, 0x10(%rax)
movl $0xffffffff, 0x34(%rax) # imm = 0xFFFFFFFF
movslq %ebp, %rcx
cmpl $0x4, %ecx
jg 0x4b2b2
testl %ebp, %ebp
jle 0x4b2a9
movzbl (%rbx), %edx
shrl $0x4, %edx
leaq 0x945c(%rip), %rsi      # 0x54700
cmpl %ebp, (%rsi,%rdx,4)
jle 0x4b2b2
xorl %edx, %edx
xorl %esi, %esi
jmp 0x4b347
movzbl (%rbx), %edx
movl $0x1, %esi
testb %dl, %dl
jns 0x4b347
movzbl 0x1(%rbx), %esi
cmpb $-0x41, %dl
ja 0x4b2da
andl $0x3f, %edx
shll $0x8, %edx
orl %esi, %edx
movl $0x2, %esi
jmp 0x4b347
cmpb $-0x21, %dl
ja 0x4b2f7
shll $0x8, %esi
movzbl 0x2(%rbx), %edi
andl $0x1f, %edx
shll $0x10, %edx
orl %esi, %edx
orl %edi, %edx
movl $0x3, %esi
jmp 0x4b347
cmpb $-0x11, %dl
ja 0x4b31f
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 0x4b347
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 $0x4, %rdi
jg 0x4b37e
cmpq %rsi, %rcx
jle 0x4b375
movzbl (%rdx), %esi
shrl $0x4, %esi
leaq 0x9394(%rip), %r8       # 0x54700
movslq (%r8,%rsi,4), %rsi
cmpq %rsi, %rdi
jge 0x4b37e
xorl %esi, %esi
xorl %edi, %edi
jmp 0x4b41c
movzbl (%rdx), %esi
movl $0x1, %edi
testb %sil, %sil
jns 0x4b41c
movzbl 0x1(%rdx), %edi
cmpb $-0x41, %sil
ja 0x4b3a8
andl $0x3f, %esi
shll $0x8, %esi
orl %edi, %esi
movl $0x2, %edi
jmp 0x4b41c
cmpb $-0x21, %sil
ja 0x4b3c8
shll $0x8, %edi
movzbl 0x2(%rdx), %r8d
andl $0x1f, %esi
shll $0x10, %esi
orl %edi, %esi
orl %r8d, %esi
movl $0x3, %edi
jmp 0x4b41c
cmpb $-0x11, %sil
ja 0x4b3f4
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 0x4b41c
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 0x4b430
cmpl $0x0, 0x34(%rax)
jns 0x4b43a
movq %rax, %rdi
callq 0x61a1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq