LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_gamma_decode
int cram_gamma_decode(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;

    for (i = 0, n = *out_size; i < n; i++) {
	int nz = 0;
	int val;
	//while (get_bit_MSB(in) == 0) nz++;
	nz = get_zero_bits_MSB(in);
        if (cram_not_enough_bits(in, nz))
            return -1;
	val = 1;
	while (nz > 0) {
	    //val <<= 1; val |= get_bit_MSB(in);
	    GET_BIT_MSB(in, val);
	    nz--;
	}

	out_i[i] = val - c->gamma.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x706bd
movl $0x0, -0x44(%rbp)
movq -0x20(%rbp), %rdi
callq 0x706d0
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x6eec0
cmpl $0x0, %eax
je 0x70620
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x706c4
movl $0x1, -0x48(%rbp)
cmpl $0x0, -0x44(%rbp)
jle 0x7069a
movl -0x48(%rbp), %eax
shll %eax
movl %eax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x30(%rcx), %rcx
movzbl (%rax,%rcx), %eax
movq -0x20(%rbp), %rcx
movl 0x38(%rcx), %ecx
sarl %cl, %eax
andl $0x1, %eax
orl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x20(%rbp), %rcx
movl 0x38(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x38(%rcx)
cmpl $0x0, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
movq -0x20(%rbp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq -0x20(%rbp), %rax
movl 0x38(%rax), %ecx
andl $0x7, %ecx
movl %ecx, 0x38(%rax)
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x70627
movl -0x48(%rbp), %edx
movq -0x18(%rbp), %rax
subl 0x30(%rax), %edx
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x705e4
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_free
void cram_huffman_decode_free(cram_codec *c) {
    if (!c)
	return;

    if (c->huffman.codes)
	free(c->huffman.codes);
    free(c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x70a25
jmp 0x70a46
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x70a3d
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rdi
callq 0x46a0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_char0
int cram_huffman_decode_char0(cram_slice *slice, cram_codec *c,
			      cram_block *in, char *out, int *out_size) {
    int i, n;

    if (!out)
	return 0;

    /* Special case of 0 length codes */
    for (i = 0, n = *out_size; i < n; i++) {
	out[i] = c->huffman.codes[0].symbol;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x70a98
movl $0x0, -0x4(%rbp)
jmp 0x70ad9
movl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x70ad2
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movl (%rax), %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x70aa8
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_decode_int0
int cram_huffman_decode_int0(cram_slice *slice, cram_codec *c,
			     cram_block *in, char *out, int *out_size) {
    int32_t *out_i = (int32_t *)out;
    int i, n;
    const cram_huffman_code * const codes = c->huffman.codes;

    /* Special case of 0 length codes */
    for (i = 0, n = *out_size; i < n; i++) {
	out_i[i] = codes[0].symbol;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x70d00
movq -0x40(%rbp), %rax
movl (%rax), %edx
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x70cdc
xorl %eax, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: code_sort
static int code_sort(const void *vp1, const void *vp2) {
    const cram_huffman_code *c1 = (const cram_huffman_code *)vp1;
    const cram_huffman_code *c2 = (const cram_huffman_code *)vp2;

    if (c1->len != c2->len)
	return c1->len - c2->len;
    else
	return c1->symbol - c2->symbol;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0xc(%rcx), %eax
je 0x7139f
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x4(%rbp)
jmp 0x713ae
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_huffman_encode_free
void cram_huffman_encode_free(cram_codec *c) {
    if (!c)
	return;

    if (c->e_huffman.codes)
	free(c->e_huffman.codes);
    free(c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x71755
jmp 0x71776
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x7176d
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rdi
callq 0x46a0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_decode
int cram_byte_array_len_decode(cram_slice *slice, cram_codec *c,
			       cram_block *in, char *out,
			       int *out_size) {
    /* Fetch length */
    int32_t len = 0, one = 1;
    int r;

    r = c->byte_array_len.len_codec->decode(slice, c->byte_array_len.len_codec,
                                            in, (char *)&len, &one);
    //printf("ByteArray Len=%d\n", len);

    if (!r && c->byte_array_len.val_codec && len >= 0) {
	r = c->byte_array_len.val_codec->decode(slice,
						c->byte_array_len.val_codec,
						in, out, &len);
    } else {
	return -1;
    }

    *out_size = len;

    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x1, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x30(%rcx), %rsi
movq -0x20(%rbp), %rdx
leaq -0x34(%rbp), %rcx
leaq -0x38(%rbp), %r8
callq *%rax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x72cd5
movq -0x18(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x72cd5
cmpl $0x0, -0x34(%rbp)
jl 0x72cd5
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq -0x34(%rbp), %r8
callq *%rax
movl %eax, -0x3c(%rbp)
jmp 0x72cde
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x72ced
movl -0x34(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_decode_free
void cram_byte_array_len_decode_free(cram_codec *c) {
    if (!c) return;

    if (c->byte_array_len.len_codec)
	c->byte_array_len.len_codec->free(c->byte_array_len.len_codec);

    if (c->byte_array_len.val_codec)
	c->byte_array_len.val_codec->free(c->byte_array_len.val_codec);

    free(c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x72d15
jmp 0x72d60
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x72d36
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x30(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x72d57
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x38(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x46a0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_decoder_init
cram_codec *cram_decoder_init(enum cram_encoding codec,
			      char *data, int size,
			      enum cram_external_type option,
			      int version) {
    if (codec >= E_NULL && codec < E_NUM_CODECS && decode_init[codec]) {
	return decode_init[codec](data, size, option, version);
    } else {
	fprintf(stderr, "Unimplemented codec of type %s\n", cram_encoding2str(codec));
	return NULL;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
cmpl $0x0, -0xc(%rbp)
jb 0x72fed
cmpl $0xa, -0xc(%rbp)
jae 0x72fed
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x177bf(%rip), %rax     # 0x8a780
cmpq $0x0, (%rax,%rcx,8)
je 0x72fed
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x177ac(%rip), %rax     # 0x8a780
movq (%rax,%rcx,8), %rax
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x24(%rbp), %ecx
callq *%rax
movq %rax, -0x8(%rbp)
jmp 0x73020
movq 0x16fdc(%rip), %rax     # 0x89fd0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movl -0xc(%rbp), %edi
callq 0x757d0
movq -0x30(%rbp), %rdi
movq %rax, %rdx
leaq 0xbd4b(%rip), %rsi      # 0x7ed5c
movb $0x0, %al
callq 0x4830
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_encode
int cram_byte_array_len_encode(cram_slice *slice, cram_codec *c,
			       char *in, int in_size) {
    int32_t i32 = in_size;
    int r = 0;

    r |= c->e_byte_array_len.len_codec->encode(slice,
					       c->e_byte_array_len.len_codec,
					       (char *)&i32, 1);
    r |= c->e_byte_array_len.val_codec->encode(slice,
					       c->e_byte_array_len.val_codec,
					       in, in_size);
    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0x48(%rcx), %rsi
leaq -0x20(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq *%rax
orl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_encode_free
void cram_byte_array_len_encode_free(cram_codec *c) {
    if (!c)
	return;

    if (c->e_byte_array_len.len_codec)
	c->e_byte_array_len.len_codec->free(c->e_byte_array_len.len_codec);

    if (c->e_byte_array_len.val_codec)
	c->e_byte_array_len.val_codec->free(c->e_byte_array_len.val_codec);

    free(c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x730c5
jmp 0x73110
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x730e6
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x73107
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x50(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x46a0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_encode_init
cram_codec *cram_byte_array_len_encode_init(cram_stats *st,
					    enum cram_external_type option,
					    void *dat,
					    int version) {
    cram_codec *c;
    cram_byte_array_len_encoder *e = (cram_byte_array_len_encoder *)dat;

    c = malloc(sizeof(*c));
    if (!c)
	return NULL;
    c->codec = E_BYTE_ARRAY_LEN;
    c->free = cram_byte_array_len_encode_free;
    c->encode = cram_byte_array_len_encode;
    c->store = cram_byte_array_len_encode_store;

    c->e_byte_array_len.len_codec = cram_encoder_init(e->len_encoding,
						      NULL, E_INT, 
						      e->len_dat,
						      version);
    c->e_byte_array_len.val_codec = cram_encoder_init(e->val_encoding,
						      NULL, E_BYTE_ARRAY, 
						      e->val_dat,
						      version);

    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x240, %edi            # imm = 0x240
callq 0x47a0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x73580
movq $0x0, -0x8(%rbp)
jmp 0x73616
movq -0x30(%rbp), %rax
movl $0x4, (%rax)
movq -0x30(%rbp), %rax
leaq -0x4e5(%rip), %rcx      # 0x730b0
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
leaq -0x574(%rip), %rcx      # 0x73030
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
leaq -0x493(%rip), %rcx      # 0x73120
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rax
movl (%rax), %edi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movl -0x24(%rbp), %r8d
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x73620
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
movl -0x24(%rbp), %r8d
xorl %eax, %eax
movl %eax, %esi
movl $0x4, %edx
callq 0x73620
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_encoder_init
cram_codec *cram_encoder_init(enum cram_encoding codec,
			      cram_stats *st,
			      enum cram_external_type option,
			      void *dat,
			      int version) {
    if (st && !st->nvals)
	return NULL;

    if (encode_init[codec]) {
	cram_codec *r;
	if ((r = encode_init[codec](st, option, dat, version)))
	    r->out = NULL;
	return r;
    } else {
	fprintf(stderr, "Unimplemented codec of type %s\n", cram_encoding2str(codec));
	abort();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7365b
movq -0x18(%rbp), %rax
cmpl $0x0, 0x100c(%rax)
jne 0x7365b
movq $0x0, -0x8(%rbp)
jmp 0x736de
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x17169(%rip), %rax     # 0x8a7d0
cmpq $0x0, (%rax,%rcx,8)
je 0x736ae
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x17156(%rip), %rax     # 0x8a7d0
movq (%rax,%rcx,8), %rax
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq *%rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x736a4
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x736de
movq 0x1691b(%rip), %rax     # 0x89fd0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movl -0xc(%rbp), %edi
callq 0x757d0
movq -0x40(%rbp), %rdi
movq %rax, %rdx
leaq 0xb68a(%rip), %rsi      # 0x7ed5c
movb $0x0, %al
callq 0x4830
callq 0x42e0
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_byte_array_stop_encode_init
cram_codec *cram_byte_array_stop_encode_init(cram_stats *st,
					     enum cram_external_type option,
					     void *dat,
					     int version) {
    cram_codec *c;

    c = malloc(sizeof(*c));
    if (!c)
	return NULL;
    c->codec = E_BYTE_ARRAY_STOP;
    c->free = cram_byte_array_stop_encode_free;
    c->encode = cram_byte_array_stop_encode;
    c->store = cram_byte_array_stop_encode_store;

    c->e_byte_array_stop.stop = ((int *)dat)[0];
    c->e_byte_array_stop.content_id = ((int *)dat)[1];

    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x240, %edi            # imm = 0x240
callq 0x47a0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x75765
movq $0x0, -0x8(%rbp)
jmp 0x757c1
movq -0x30(%rbp), %rax
movl $0x5, (%rax)
movq -0x30(%rbp), %rax
leaq -0x157a(%rip), %rcx     # 0x74200
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
leaq -0x17f9(%rip), %rcx     # 0x73f90
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
leaq -0x1568(%rip), %rcx     # 0x74230
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x30(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_encoding2str
const char *cram_encoding2str(enum cram_encoding t) {
    switch (t) {
    case E_NULL:            return "NULL";
    case E_EXTERNAL:        return "EXTERNAL";
    case E_GOLOMB:          return "GOLOMB";
    case E_HUFFMAN:         return "HUFFMAN";
    case E_BYTE_ARRAY_LEN:  return "BYTE_ARRAY_LEN";
    case E_BYTE_ARRAY_STOP: return "BYTE_ARRAY_STOP";
    case E_BETA:            return "BETA";
    case E_SUBEXP:          return "SUBEXP";
    case E_GOLOMB_RICE:     return "GOLOMB_RICE";
    case E_GAMMA:           return "GAMMA";
    case E_NUM_CODECS:
    default:                return "?";
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq %rax, -0x18(%rbp)
subq $0xa, %rax
ja 0x75883
movq -0x18(%rbp), %rax
leaq 0x91d9(%rip), %rcx      # 0x7e9cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x9508(%rip), %rax      # 0x7ed0b
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x76b8(%rip), %rax      # 0x7cecb
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94f0(%rip), %rax      # 0x7ed10
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94ea(%rip), %rax      # 0x7ed17
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94e5(%rip), %rax      # 0x7ed1f
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94e7(%rip), %rax      # 0x7ed2e
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94ea(%rip), %rax      # 0x7ed3e
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94e2(%rip), %rax      # 0x7ed43
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94dc(%rip), %rax      # 0x7ed4a
movq %rax, -0x8(%rbp)
jmp 0x7588e
leaq 0x94db(%rip), %rax      # 0x7ed56
movq %rax, -0x8(%rbp)
jmp 0x7588e
jmp 0x75883
leaq 0x5795(%rip), %rax      # 0x7b01f
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_codec_to_id
int cram_codec_to_id(cram_codec *c, int *id2) {
    int bnum1, bnum2 = -2;

    switch (c->codec) {
    case E_HUFFMAN:
	bnum1 = c->huffman.ncodes == 1 ? -2 : -1;
	break;
    case E_GOLOMB:
    case E_BETA:
    case E_SUBEXP:
    case E_GOLOMB_RICE:
    case E_GAMMA:
	bnum1 = -1;
	break;
    case E_EXTERNAL:
	bnum1 = c->external.content_id;
	break;
    case E_BYTE_ARRAY_LEN:
	bnum1 = cram_codec_to_id(c->byte_array_len.len_codec, NULL);
	bnum2 = cram_codec_to_id(c->byte_array_len.val_codec, NULL);
	break;
    case E_BYTE_ARRAY_STOP:
	bnum1 = c->byte_array_stop.content_id;
	break;
    case E_NULL:
	bnum1 = -2;
	break;
    default:
	fprintf(stderr, "Unknown codec type %d\n", c->codec);
	bnum1 = -1;
    }

    if (id2)
	*id2 = bnum2;
    return bnum1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
movq -0x8(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x20(%rbp)
subq $0x9, %rax
ja 0x7594f
movq -0x20(%rbp), %rax
leaq 0x9122(%rip), %rcx      # 0x7e9f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movl 0x30(%rax), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x75974
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
jmp 0x75974
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x14(%rbp)
jmp 0x75974
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x758a0
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x758a0
movl %eax, -0x18(%rbp)
jmp 0x75974
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x14(%rbp)
jmp 0x75974
movl $0xfffffffe, -0x14(%rbp) # imm = 0xFFFFFFFE
jmp 0x75974
movq 0x1467a(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %edx
leaq 0x9416(%rip), %rsi      # 0x7ed7c
movb $0x0, %al
callq 0x4830
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, -0x10(%rbp)
je 0x75984
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/pooled_alloc.c
// Function: pool_create
pool_alloc_t *pool_create(size_t dsize) {
    pool_alloc_t *p;

    if (NULL == (p = (pool_alloc_t *)malloc(sizeof(*p))))
	return NULL;

    /* Minimum size is a pointer, for free list */
    dsize = (dsize + sizeof(void *) - 1) & ~(sizeof(void *)-1);
    if (dsize < sizeof(void *))
	dsize = sizeof(void *);
    p->dsize = dsize;
    p->psize = MIN(PSIZE, next_power_2(p->dsize*1024));

    p->npools = 0;
    p->pools = NULL;
    p->free  = NULL;

    return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x28, %edi
callq 0x47a0
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x75d71
movq $0x0, -0x8(%rbp)
jmp 0x75e15
movq -0x10(%rbp), %rax
addq $0x8, %rax
subq $0x1, %rax
andq $-0x8, %rax
movq %rax, -0x10(%rbp)
cmpq $0x8, -0x10(%rbp)
jae 0x75d94
movq $0x8, -0x10(%rbp)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
shlq $0xa, %rax
movl %eax, %edi
callq 0x75e20
movl %eax, %ecx
movl $0x100000, %eax         # imm = 0x100000
cmpl %ecx, %eax
jge 0x75dc6
movl $0x100000, %eax         # imm = 0x100000
movl %eax, -0x1c(%rbp)
jmp 0x75ddb
movq -0x18(%rbp), %rax
movq (%rax), %rax
shlq $0xa, %rax
movl %eax, %edi
callq 0x75e20
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movslq %eax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: karel-brinda[P]ococo/ext/htslib/cram/pooled_alloc.c
// Function: pool_destroy
void pool_destroy(pool_alloc_t *p) {
    size_t i;

    for (i = 0; i < p->npools; i++) {
        free(p->pools[i].pool);
    }
    free(p->pools);
    free(p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x75ecb
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x46a0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x75e94
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x46a0
movq -0x8(%rbp), %rdi
callq 0x46a0
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/pooled_alloc.c
// Function: pool_alloc
void *pool_alloc(pool_alloc_t *p) {
    pool_t *pool;
    void *ret;

    /* Look on free list */
    if (NULL != p->free) {
        ret = p->free;
	p->free = *((void **)p->free);
	return ret;
    }

    /* Look for space in the last pool */
    if (p->npools) {
        pool = &p->pools[p->npools - 1];
        if (pool->used + p->dsize < p->psize) {
	    ret = ((char *) pool->pool) + pool->used;
	    pool->used += p->dsize;
	    return ret;
	}
    }

    /* Need a new pool */
    pool = new_pool(p);
    if (NULL == pool) return NULL;

    pool->used = p->dsize;
    return pool->pool;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq 0x20(%rcx), %rax
je 0x75f34
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x75fe2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x75fa9
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq $0x1, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
addq (%rcx), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x75fa7
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
addq 0x8(%rcx), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x75fe2
jmp 0x75fa9
movq -0x10(%rbp), %rdi
callq 0x75ff0
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
jne 0x75fc8
movq $0x0, -0x8(%rbp)
jmp 0x75fe2
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/cram/pooled_alloc.c
// Function: new_pool
static pool_t *new_pool(pool_alloc_t *p) {
    size_t n = p->psize / p->dsize;
    pool_t *pool;
    
    pool = realloc(p->pools, (p->npools + 1) * sizeof(*p->pools));
    if (NULL == pool) return NULL;
    p->pools = pool;
    pool = &p->pools[p->npools];

    pool->pool = malloc(n * p->dsize);
    if (NULL == pool->pool) return NULL;

    pool->used = 0;

    p->npools++;

    return pool;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divq (%rcx)
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
addq $0x1, %rsi
shlq $0x4, %rsi
callq 0x4990
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
jne 0x76044
movq $0x0, -0x8(%rbp)
jmp 0x760bf
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
imulq (%rax), %rdi
callq 0x47a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
jne 0x7609b
movq $0x0, -0x8(%rbp)
jmp 0x760bf
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: kftp_connect
int kftp_connect(knetFile *ftp)
{
	ftp->ctrl_fd = socket_connect(ftp->host, ftp->port);
	if (ftp->ctrl_fd == -1) return -1;
	kftp_get_response(ftp);
	kftp_send_cmd(ftp, "USER anonymous\r\n", 1);
	kftp_send_cmd(ftp, "PASS kftp@\r\n", 1);
	kftp_send_cmd(ftp, "TYPE I\r\n", 1);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x761a0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x20(%rax)
jne 0x7613d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7618c
movq -0x10(%rbp), %rdi
callq 0x76380
movq -0x10(%rbp), %rdi
leaq 0x8c42(%rip), %rsi      # 0x7ed93
movl $0x1, %edx
callq 0x76540
movq -0x10(%rbp), %rdi
leaq 0x8c3e(%rip), %rsi      # 0x7eda4
movl $0x1, %edx
callq 0x76540
movq -0x10(%rbp), %rdi
leaq 0x8c36(%rip), %rsi      # 0x7edb1
movl $0x1, %edx
callq 0x76540
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: kftp_send_cmd
static int kftp_send_cmd(knetFile *ftp, const char *cmd, int is_get)
{
	if (socket_wait(ftp->ctrl_fd, 0) <= 0) return -1; // socket is not ready for writing
    int len = strlen(cmd);
	if ( netwrite(ftp->ctrl_fd, cmd, len) != len ) return -1;
	return is_get? kftp_get_response(ftp) : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edi
xorl %esi, %esi
callq 0x778a0
cmpl $0x0, %eax
jg 0x7656f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x765c2
movq -0x18(%rbp), %rdi
callq 0x4230
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edi
movq -0x18(%rbp), %rsi
movslq -0x20(%rbp), %rdx
callq 0x41d0
movslq -0x20(%rbp), %rcx
cmpq %rcx, %rax
je 0x765a1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x765c2
cmpl $0x0, -0x1c(%rbp)
je 0x765b5
movq -0x10(%rbp), %rdi
callq 0x76380
movl %eax, -0x24(%rbp)
jmp 0x765bc
xorl %eax, %eax
movl %eax, -0x24(%rbp)
jmp 0x765bc
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: kftp_reconnect
int kftp_reconnect(knetFile *ftp)
{
	if (ftp->ctrl_fd != -1) {
		netclose(ftp->ctrl_fd);
		ftp->ctrl_fd = -1;
	}
	netclose(ftp->fd);
	ftp->fd = -1;
	return kftp_connect(ftp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $-0x1, 0x20(%rax)
je 0x765fd
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edi
callq 0x4b40
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x4b40
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
callq 0x76100
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: kftp_parse_url
knetFile *kftp_parse_url(const char *fn, const char *mode)
{
	knetFile *fp;
	char *p;
	int l;
	if (strstr(fn, "ftp://") != fn) return 0;
	for (p = (char*)fn + 6; *p && *p != '/'; ++p);
	if (*p != '/') return 0;
	l = p - fn - 6;
	fp = (knetFile*)calloc(1, sizeof(knetFile));
	fp->type = KNF_TYPE_FTP;
	fp->fd = -1;
	/* the Linux/Mac version of socket_connect() also recognizes a port
	 * like "ftp", but the Windows version does not. */
	fp->port = strdup("21");
	fp->host = (char*)calloc(l + 1, 1);
	if (strchr(mode, 'c')) fp->no_reconnect = 1;
	strncpy(fp->host, fn + 6, l);
	fp->retr = (char*)calloc(strlen(p) + 8, 1);
	sprintf(fp->retr, "RETR %s\r\n", p);
    fp->size_cmd = (char*)calloc(strlen(p) + 8, 1);
    sprintf(fp->size_cmd, "SIZE %s\r\n", p);
	fp->seek_offset = 0;
	return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x876f(%rip), %rsi      # 0x7edba
callq 0x4110
cmpq -0x10(%rbp), %rax
je 0x76663
movq $0x0, -0x8(%rbp)
jmp 0x767fb
movq -0x10(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2d(%rbp)
je 0x76690
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
setne %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x76699
jmp 0x766a9
jmp 0x7669b
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x7666f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x766c2
movq $0x0, -0x8(%rbp)
jmp 0x767fb
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq $0x6, %rax
movl %eax, -0x2c(%rbp)
movl $0x1, %edi
movl $0x80, %esi
callq 0x4370
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x2, (%rax)
movq -0x20(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
leaq 0x86be(%rip), %rdi      # 0x7edc1
callq 0x4aa0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
movl $0x1, %esi
callq 0x4370
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rdi
movl $0x63, %esi
callq 0x41e0
cmpq $0x0, %rax
je 0x76750
movq -0x20(%rbp), %rax
movl $0x1, 0x3c(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x6, %rsi
movslq -0x2c(%rbp), %rdx
callq 0x42c0
movq -0x28(%rbp), %rdi
callq 0x4230
movq %rax, %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x4370
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0x8623(%rip), %rsi      # 0x7edc4
movb $0x0, %al
callq 0x4100
movq -0x28(%rbp), %rdi
callq 0x4230
movq %rax, %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x4370
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0x85ee(%rip), %rsi      # 0x7edce
movb $0x0, %al
callq 0x4100
movq -0x20(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: kftp_connect_file
int kftp_connect_file(knetFile *fp)
{
	int ret;
	long long file_size;
	if (fp->fd != -1) {
		netclose(fp->fd);
		if (fp->no_reconnect) kftp_get_response(fp);
	}
	kftp_pasv_prep(fp);
    kftp_send_cmd(fp, fp->size_cmd, 1);
#ifndef _WIN32
    // If the file does not exist, the response will be "550 Could not get file
    // size". Be silent on failure, hts_idx_load can be trying the existence of .csi or .tbi.
    if ( sscanf(fp->response,"%*d %lld", &file_size) != 1 ) return -1;
#else
	const char *p = fp->response;
	while (*p != ' ') ++p;
	while (*p < '0' || *p > '9') ++p;
	file_size = strtoint64(p);
#endif
	fp->file_size = file_size;
	if (fp->offset>=0) {
		char tmp[32];
#ifndef _WIN32
		sprintf(tmp, "REST %lld\r\n", (long long)fp->offset);
#else
		strcpy(tmp, "REST ");
		int64tostr(tmp + 5, fp->offset);
		strcat(tmp, "\r\n");
#endif
		kftp_send_cmd(fp, tmp, 1);
	}
	kftp_send_cmd(fp, fp->retr, 0);
	kftp_pasv_connect(fp);
	ret = kftp_get_response(fp);
	if (ret != 150) {
		fprintf(stderr, "[kftp_connect_file] %s\n", fp->response);
		netclose(fp->fd);
		fp->fd = -1;
		return -1;
	}
	fp->is_ready = 1;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
je 0x76847
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x4b40
movq -0x10(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
je 0x76845
movq -0x10(%rbp), %rdi
callq 0x76380
jmp 0x76847
movq -0x10(%rbp), %rdi
callq 0x76960
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movl $0x1, %edx
callq 0x76540
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
leaq 0x8563(%rip), %rsi      # 0x7edd8
leaq -0x20(%rbp), %rdx
movb $0x0, %al
callq 0x4560
cmpl $0x1, %eax
je 0x76891
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x76957
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jl 0x768d4
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x8526(%rip), %rsi      # 0x7ede1
movb $0x0, %al
callq 0x4100
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x1, %edx
callq 0x76540
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
xorl %edx, %edx
callq 0x76540
movq -0x10(%rbp), %rdi
callq 0x76a70
movq -0x10(%rbp), %rdi
callq 0x76380
movl %eax, -0x14(%rbp)
cmpl $0x96, -0x14(%rbp)
je 0x76945
movq 0x136c4(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
leaq 0x84cf(%rip), %rsi      # 0x7eded
movb $0x0, %al
callq 0x4830
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x4b40
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x76957
movq -0x10(%rbp), %rax
movl $0x1, 0x40(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: kftp_pasv_prep
static int kftp_pasv_prep(knetFile *ftp)
{
	char *p;
	int v[6];
	kftp_send_cmd(ftp, "PASV\r\n", 1);
	for (p = ftp->response; *p && *p != '('; ++p);
	if (*p != '(') return -1;
	++p;
	sscanf(p, "%d,%d,%d,%d,%d,%d", &v[0], &v[1], &v[2], &v[3], &v[4], &v[5]);
	memcpy(ftp->pasv_ip, v, 4 * sizeof(int));
	ftp->pasv_port = (v[4]<<8&0xff00) + v[5];
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x8593(%rip), %rsi      # 0x7ef0a
movl $0x1, %edx
callq 0x76540
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x31(%rbp)
je 0x769ae
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x28, %eax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x769b7
jmp 0x769c7
jmp 0x769b9
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x7698d
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x28, %eax
je 0x769df
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x76a63
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rdx
leaq -0x30(%rbp), %rcx
addq $0x4, %rcx
leaq -0x30(%rbp), %r8
addq $0x8, %r8
leaq -0x30(%rbp), %r9
addq $0xc, %r9
leaq -0x30(%rbp), %r10
addq $0x10, %r10
leaq -0x30(%rbp), %rax
addq $0x14, %rax
leaq 0x84ef(%rip), %rsi      # 0x7ef11
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x4560
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, 0x24(%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x2c(%rax)
movl -0x20(%rbp), %ecx
shll $0x8, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
addl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: kftp_pasv_connect
static int kftp_pasv_connect(knetFile *ftp)
{
	char host[80], port[10];
	if (ftp->pasv_port == 0) {
		fprintf(stderr, "[kftp_pasv_connect] kftp_pasv_prep() is not called before hand.\n");
		return -1;
	}
	sprintf(host, "%d.%d.%d.%d", ftp->pasv_ip[0], ftp->pasv_ip[1], ftp->pasv_ip[2], ftp->pasv_ip[3]);
	sprintf(port, "%d", ftp->pasv_port);
	ftp->fd = socket_connect(host, port);
	if (ftp->fd == -1) return -1;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jne 0x76aa7
movq 0x13543(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
leaq 0x848c(%rip), %rsi      # 0x7ef23
movb $0x0, %al
callq 0x4830
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x76b20
leaq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x24(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %r8d
movq -0x10(%rbp), %rax
movl 0x30(%rax), %r9d
leaq 0x8494(%rip), %rsi      # 0x7ef64
movb $0x0, %al
callq 0x4100
leaq -0x6a(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x34(%rax), %edx
leaq 0x8437(%rip), %rsi      # 0x7ef20
movb $0x0, %al
callq 0x4100
leaq -0x60(%rbp), %rdi
leaq -0x6a(%rbp), %rsi
callq 0x761a0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
jne 0x76b19
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x76b20
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: my_netread
static off_t my_netread(int fd, void *buf, off_t len)
{
	off_t rest = len, curr, l = 0;
	/* recv() and read() may not read the required length of data with
	 * one call. They have to be called repeatedly. */
	while (rest) {
		if (socket_wait(fd, 1) <= 0) break; // socket is not ready for reading
		curr = netread(fd, (void*)((char*)buf + l), rest);
		/* According to the glibc manual, section 13.2, a zero returned
		 * value indicates end-of-file (EOF), which should mean that
		 * read() will not return zero if EOF has not been met but data
		 * are not immediately available. */
		if (curr == 0) break;
		l += curr; rest -= curr;
	}
	return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x7728c
movl -0x4(%rbp), %edi
movl $0x1, %esi
callq 0x778a0
cmpl $0x0, %eax
jg 0x7724e
jmp 0x7728c
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x4840
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x7726f
jmp 0x7728c
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x77233
movq -0x30(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: knet_open
knetFile *knet_open(const char *fn, const char *mode)
{
	knetFile *fp = 0;
	if (mode[0] != 'r') {
		fprintf(stderr, "[kftp_open] only mode \"r\" is supported.\n");
		return 0;
	}
	if (strstr(fn, "ftp://") == fn) {
		fp = kftp_parse_url(fn, mode);
		if (fp == 0) return 0;
		if (kftp_connect(fp) == -1) {
			knet_close(fp);
			return 0;
		}
		kftp_connect_file(fp);
	} else if (strstr(fn, "http://") == fn) {
		fp = khttp_parse_url(fn, mode);
		if (fp == 0) return 0;
		khttp_connect_file(fp);
	} else { // local file
#ifdef _WIN32
		/* In windows, O_BINARY is necessary. In Linux/Mac, O_BINARY may
		 * be undefined on some systems, although it is defined on my
		 * Mac and the Linux I have tested on. */
		int fd = open(fn, O_RDONLY | O_BINARY);
#else		
		int fd = open(fn, O_RDONLY);
#endif
		if (fd == -1) {
			perror("open");
			return 0;
		}
		fp = (knetFile*)calloc(1, sizeof(knetFile));
		fp->type = KNF_TYPE_LOCAL;
		fp->fd = fd;
		fp->ctrl_fd = -1;
	}
	if (fp && fp->fd == -1) {
		knet_close(fp);
		return 0;
	}
	return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x72, %eax
je 0x772e9
movq 0x12d05(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
leaq 0x7b7c(%rip), %rsi      # 0x7ee51
movb $0x0, %al
callq 0x4830
movq $0x0, -0x8(%rbp)
jmp 0x77428
movq -0x10(%rbp), %rdi
leaq 0x7ac6(%rip), %rsi      # 0x7edba
callq 0x4110
cmpq -0x10(%rbp), %rax
jne 0x77356
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x76630
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x77324
movq $0x0, -0x8(%rbp)
jmp 0x77428
movq -0x20(%rbp), %rdi
callq 0x76100
cmpl $-0x1, %eax
jne 0x77348
movq -0x20(%rbp), %rdi
callq 0x77440
movq $0x0, -0x8(%rbp)
jmp 0x77428
movq -0x20(%rbp), %rdi
callq 0x76810
jmp 0x773fc
movq -0x10(%rbp), %rdi
leaq 0x7aa4(%rip), %rsi      # 0x7ee05
callq 0x4110
cmpq -0x10(%rbp), %rax
jne 0x7739c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x76b30
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x77391
movq $0x0, -0x8(%rbp)
jmp 0x77428
movq -0x20(%rbp), %rdi
callq 0x76e50
jmp 0x773fa
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x43e0
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
jne 0x773c8
leaq 0x3c17(%rip), %rdi      # 0x7afd0
callq 0x4480
movq $0x0, -0x8(%rbp)
jmp 0x77428
movl $0x1, %edi
movl $0x80, %esi
callq 0x4370
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
jmp 0x773fc
cmpq $0x0, -0x20(%rbp)
je 0x77420
movq -0x20(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
jne 0x77420
movq -0x20(%rbp), %rdi
callq 0x77440
movq $0x0, -0x8(%rbp)
jmp 0x77428
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: knet_close
int knet_close(knetFile *fp)
{
	if (fp == 0) return 0;
	if (fp->ctrl_fd != -1) netclose(fp->ctrl_fd); // FTP specific
	if (fp->fd != -1) {
		/* On Linux/Mac, netclose() is an alias of close(), but on
		 * Windows, it is an alias of closesocket(). */
		if (fp->type == KNF_TYPE_LOCAL) close(fp->fd);
		else netclose(fp->fd);
	}
	free(fp->host); free(fp->port);
	free(fp->response); free(fp->retr); // FTP specific
	free(fp->path); free(fp->http_host); // HTTP specific
	free(fp);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x7745f
movl $0x0, -0x4(%rbp)
jmp 0x77502
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x20(%rax)
je 0x77475
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edi
callq 0x4b40
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
je 0x774a4
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x77496
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x4b40
jmp 0x774a2
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
callq 0x4b40
jmp 0x774a4
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x46a0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x46a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x46a0
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x46a0
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0x46a0
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x46a0
movq -0x10(%rbp), %rdi
callq 0x46a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: karel-brinda[P]ococo/ext/htslib/knetfile.c
// Function: knet_dopen
knetFile *knet_dopen(int fd, const char *mode)
{
	knetFile *fp = (knetFile*)calloc(1, sizeof(knetFile));
	fp->type = KNF_TYPE_LOCAL;
	fp->fd = fd;
	return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, %edi
movl $0x80, %esi
callq 0x4370
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movl -0x4(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq