// File: /workspace/github_c_makefile_star2_O0/lh3[P]bgt/fmf.c
// Function: fmf_read
fmf_t *fmf_read(const char *fn)
{
	kstream_t *ks;
	gzFile fp;
	fmf_t *fmf = 0;
	kstring_t s = {0,0,0};
	int dret;
	khash_t(s2i) *kh, *vh;

	fp = fn && strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r");
	if (fp == 0) return 0;
	ks = ks_init(fp);
	fmf = (fmf_t*)calloc(1, sizeof(fmf_t));
	kh = kh_init(s2i);
	vh = kh_init(s2i);
	while (ks_getuntil(ks, KS_SEP_LINE, &s, &dret) >= 0) {
		char *p, *q, *r;
		int i, absent, n_meta;
		khint_t k;
		fmf1_t *u = 0;
		if (s.l == 0) continue;
		for (p = s.s, n_meta = 0; *p; ++p)
			if (*p == '\t') ++n_meta;
		for (p = q = s.s, i = 0;; ++p) {
			if (*p == 0 || *p == '\t') {
				int c = *p, c2;
				*p = 0;
				if (i == 0) { // row name
					if (fmf->n_rows == fmf->m_rows) {
						fmf->m_rows = fmf->m_rows? fmf->m_rows<<1 : 16;
						fmf->rows = (fmf1_t*)realloc(fmf->rows, fmf->m_rows * sizeof(fmf1_t));
					}
					u = &fmf->rows[fmf->n_rows++];
					u->name = strdup(q);
					u->m_meta = n_meta, u->n_meta = 0;
					u->meta = (fmf_meta_t*)calloc(u->m_meta, sizeof(fmf_meta_t));
				} else { // metadata
					fmf_meta_t *m;
					for (r = q; *r && *r != ':'; ++r);
					c2 = *r; *r = 0;
					k = kh_put(s2i, kh, q, &absent);
					if (absent) {
						if (fmf->n_keys == fmf->m_keys) {
							fmf->m_keys = fmf->m_keys? fmf->m_keys<<1 : 8;
							fmf->keys = (char**)realloc(fmf->keys, fmf->m_keys * sizeof(char*));
						}
						kh_val(kh, k) = fmf->n_keys;
						kh_key(kh, k) = fmf->keys[fmf->n_keys++] = strdup(q);
					}
					m = &u->meta[u->n_meta++];
					m->key = kh_val(kh, k), m->v.i = 0;
					if (c2 == ':' && p - r >= 3) {
						if (r[1] == 'i') m->type = FMF_INT, m->v.i = strtol(r + 3, &r, 0);
						else if (r[1] == 'f') m->type = FMF_REAL, m->v.r = strtod(r + 3, &r);
						else {
							char *s = r + 3;
							m->type = FMF_STR;
							k = kh_put(s2i, vh, s, &absent);
							if (absent) {
								if (fmf->n_vals == fmf->m_vals) {
									fmf->m_vals = fmf->m_vals? fmf->m_vals<<1 : 8;
									fmf->vals = (char**)realloc(fmf->vals, fmf->m_vals * sizeof(char*));
								}
								kh_val(vh, k) = fmf->n_vals;
								kh_key(vh, k) = fmf->vals[fmf->n_vals++] = strdup(s);
							}
							m->v.s = kh_val(vh, k);
						}
					} else m->type = FMF_FLAG;
				}
				q = p + 1; ++i;
				if (c == 0) break; // end-of-line
			}
		}
	}
	free(s.s);
	ks_destroy(ks);
	gzclose(fp);
	kh_destroy(s2i, kh);
	kh_destroy(s2i, vh);
	return fmf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x21e0
cmpq $0x0, -0x10(%rbp)
je 0xd51c
movq -0x10(%rbp), %rdi
leaq 0x19fbb(%rip), %rsi     # 0x274b4
callq 0x2240
cmpl $0x0, %eax
je 0xd51c
movq -0x10(%rbp), %rdi
leaq 0x1abd0(%rip), %rsi     # 0x280de
callq 0x2380
movq %rax, -0xa8(%rbp)
jmp 0xd540
movq 0x20a65(%rip), %rax     # 0x2df88
movq (%rax), %rdi
callq 0x22b0
movl %eax, %edi
leaq 0x1abaa(%rip), %rsi     # 0x280de
callq 0x2140
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xd55f
movq $0x0, -0x8(%rbp)
jmp 0xdb2f
movq -0x20(%rbp), %rdi
callq 0x7500
movq %rax, -0x18(%rbp)
movl $0x1, %edi
movl $0x30, %esi
callq 0x2230
movq %rax, -0x28(%rbp)
movb $0x0, %al
callq 0x7a30
movq %rax, -0x50(%rbp)
movb $0x0, %al
callq 0x7a30
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
leaq -0x40(%rbp), %rdx
leaq -0x44(%rbp), %rcx
callq 0xdb40
cmpl $0x0, %eax
jl 0xdafa
movq $0x0, -0x88(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xd5c8
jmp 0xd595
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x7c(%rbp)
movq -0x60(%rbp), %rax
cmpb $0x0, (%rax)
je 0xd605
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0xd5f5
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0xd5f7
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xd5d7
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movl $0x0, -0x74(%rbp)
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xd634
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0xdae2
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x8c(%rbp)
movq -0x60(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x74(%rbp)
jne 0xd73c
movq -0x28(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jne 0xd6bb
movq -0x28(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0xd67d
movq -0x28(%rbp), %rax
movl 0x24(%rax), %eax
shll %eax
movl %eax, -0xac(%rbp)
jmp 0xd68a
movl $0x10, %eax
movl %eax, -0xac(%rbp)
jmp 0xd68a
movl -0xac(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x28(%rbp), %rax
movslq 0x24(%rax), %rax
imulq $0x18, %rax, %rsi
callq 0x2340
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x28(%rbp), %rdx
movl 0x20(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x20(%rdx)
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x68(%rbp), %rdi
callq 0x2440
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq %rcx, (%rax)
movl -0x7c(%rbp), %ecx
movq -0x88(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x88(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x88(%rbp), %rax
movslq 0xc(%rax), %rdi
movl $0x8, %esi
callq 0x2230
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xdac0
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xad(%rbp)
je 0xd76b
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
setne %al
movb %al, -0xad(%rbp)
movb -0xad(%rbp), %al
testb $0x1, %al
jne 0xd777
jmp 0xd787
jmp 0xd779
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0xd744
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x90(%rbp)
movq -0x70(%rbp), %rax
movb $0x0, (%rax)
movq -0x50(%rbp), %rdi
movq -0x68(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x8140
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x78(%rbp)
je 0xd86e
movq -0x28(%rbp), %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0xd821
movq -0x28(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0xd7e3
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
movl %eax, -0xb4(%rbp)
jmp 0xd7f0
movl $0x8, %eax
movl %eax, -0xb4(%rbp)
jmp 0xd7f0
movl -0xb4(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movslq 0x4(%rax), %rsi
shlq $0x3, %rsi
callq 0x2340
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movslq (%rax), %rdx
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x68(%rbp), %rdi
callq 0x2440
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x80(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x88(%rbp), %rdx
movl 0x8(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x8(%rdx)
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %edx
movq -0x98(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffff, %edx        # imm = 0xFFFFFFF
andl $0xf0000000, %ecx       # imm = 0xF0000000
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x98(%rbp), %rax
movl $0x0, 0x4(%rax)
cmpl $0x3a, -0x90(%rbp)
jne 0xdaaa
movq -0x60(%rbp), %rax
movq -0x70(%rbp), %rcx
subq %rcx, %rax
cmpq $0x3, %rax
jl 0xdaaa
movq -0x70(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x69, %eax
jne 0xd93e
movq -0x98(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
orl $0x10000000, %ecx       # imm = 0x10000000
movl %ecx, (%rax)
movq -0x70(%rbp), %rdi
addq $0x3, %rdi
leaq -0x70(%rbp), %rsi
xorl %edx, %edx
callq 0x2280
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0xdaa8
movq -0x70(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x66, %eax
jne 0xd988
movq -0x98(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
orl $0x20000000, %ecx       # imm = 0x20000000
movl %ecx, (%rax)
movq -0x70(%rbp), %rdi
addq $0x3, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2100
cvtsd2ss %xmm0, %xmm0
movq -0x98(%rbp), %rax
movss %xmm0, 0x4(%rax)
jmp 0xdaa6
movq -0x70(%rbp), %rax
addq $0x3, %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
orl $0x30000000, %ecx       # imm = 0x30000000
movl %ecx, (%rax)
movq -0x58(%rbp), %rdi
movq -0xa0(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x8140
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x78(%rbp)
je 0xda8b
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0xda38
movq -0x28(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0xd9fa
movq -0x28(%rbp), %rax
movl 0x14(%rax), %eax
shll %eax
movl %eax, -0xb8(%rbp)
jmp 0xda07
movl $0x8, %eax
movl %eax, -0xb8(%rbp)
jmp 0xda07
movl -0xb8(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rax
movslq 0x14(%rax), %rsi
shlq $0x3, %rsi
callq 0x2340
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movslq 0x10(%rax), %rdx
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0xa0(%rbp), %rdi
callq 0x2440
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x28(%rbp), %rsi
movl 0x10(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x10(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x80(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0xdaa8
jmp 0xdabe
movq -0x98(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
orl $0x0, %ecx
movl %ecx, (%rax)
jmp 0xdac0
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x8c(%rbp)
jne 0xdae0
jmp 0xdaf5
jmp 0xdae2
jmp 0xdae4
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xd618
jmp 0xd595
movq -0x30(%rbp), %rdi
callq 0x2040
movq -0x18(%rbp), %rdi
callq 0x7560
movq -0x20(%rbp), %rdi
callq 0x2030
movq -0x50(%rbp), %rdi
callq 0x7a50
movq -0x58(%rbp), %rdi
callq 0x7a50
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)