// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_external_decode_init
cram_codec *cram_external_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_EXTERNAL;
    if (option == E_INT || option == E_LONG)
	c->decode = cram_external_decode_int;
    else if (option == E_BYTE_ARRAY || option == E_BYTE)
	c->decode = cram_external_decode_char;
    else
	c->decode = cram_external_decode_block;
    c->free   = cram_external_decode_free;
    
    cp += itf8_get(cp, &c->external.content_id);

    if (cp - data != size) {
	fprintf(stderr, "Malformed external header stream\n");
	free(c);
	return NULL;
    }

    c->external.type = option;

    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x240, %edi            # imm = 0x240
callq 0x69c0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0xcd5ae
movq $0x0, -0x8(%rbp)
jmp 0xcd7d7
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
cmpl $0x1, -0x18(%rbp)
je 0xcd5c4
cmpl $0x2, -0x18(%rbp)
jne 0xcd5d5
movq -0x28(%rbp), %rax
leaq -0x4bf(%rip), %rcx      # 0xcd110
movq %rcx, 0x18(%rax)
jmp 0xcd603
cmpl $0x4, -0x18(%rbp)
je 0xcd5e1
cmpl $0x3, -0x18(%rbp)
jne 0xcd5f2
movq -0x28(%rbp), %rax
leaq -0x1ac(%rip), %rcx      # 0xcd440
movq %rcx, 0x18(%rax)
jmp 0xcd601
movq -0x28(%rbp), %rax
leaq 0x1f3(%rip), %rcx       # 0xcd7f0
movq %rcx, 0x18(%rax)
jmp 0xcd603
movq -0x28(%rbp), %rax
leaq -0xce(%rip), %rcx       # 0xcd540
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0xcd63b
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xcd775
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xc0, %eax
jge 0xcd677
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
shll $0x8, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
orl %eax, %ecx
andl $0x3fff, %ecx           # imm = 0x3FFF
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movl $0x2, %eax
movl %eax, -0x38(%rbp)
jmp 0xcd76f
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xe0, %eax
jge 0xcd6c0
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
shll $0x10, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
orl %eax, %ecx
andl $0x1fffff, %ecx         # imm = 0x1FFFFF
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movl $0x3, %eax
movl %eax, -0x3c(%rbp)
jmp 0xcd769
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xf0, %eax
jge 0xcd713
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
shll $0x18, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x10, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x8, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
orl %eax, %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movl $0x4, %eax
movl %eax, -0x40(%rbp)
jmp 0xcd763
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
andl $0xf, %ecx
shll $0x1c, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x14, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0xc, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
shll $0x4, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x4(%rax), %eax
andl $0xf, %eax
orl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movl $0x5, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movslq -0x14(%rbp), %rcx
cmpq %rcx, %rax
je 0xcd7c5
movq 0x3782f(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
leaq 0x18301(%rip), %rsi     # 0xe5aac
movb $0x0, %al
callq 0x6a80
movq -0x28(%rbp), %rdi
callq 0x6880
movq $0x0, -0x8(%rbp)
jmp 0xcd7d7
movl -0x18(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)