// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_read1
int glf3_read1(glfFile fp, glf3_t *g3)
{
	int r;
	uint8_t c;
	uint32_t y[2];
	r = bgzf_read(fp, &c, 1);
	if (r == 0) return 0;
	g3->ref_base = c & 0xf;
	g3->rtype = c>>4;
	if (g3->rtype == GLF3_RTYPE_END) return r;
	r += bgzf_read(fp, y, 8);
	if (glf3_is_BE) {
		y[0] = bam_swap_endian_4(y[0]);
		y[1] = bam_swap_endian_4(y[1]);
	}
	g3->offset = y[0];
	g3->min_lk = y[1]>>24;
	g3->depth = y[1]<<8>>8;
	r += bgzf_read(fp, &g3->rms_mapQ, 1);
	if (g3->rtype == GLF3_RTYPE_SUB) r += bgzf_read(fp, g3->lk, 10);
	else {
		int16_t x[2], max;
		r += bgzf_read(fp, g3->lk, 3);
		r += bgzf_read(fp, x, 4);
		if (glf3_is_BE) {
			x[0] = bam_swap_endian_2(x[0]);
			x[1] = bam_swap_endian_2(x[1]);
		}
		g3->indel_len[0] = x[0];
		g3->indel_len[1] = x[1];
		x[0] = abs(x[0]); x[1] = abs(x[1]);
		max = (x[0] > x[1]? x[0] : x[1]) + 1;
		if (g3->max_len < max) {
			g3->max_len = max;
			kv_roundup32(g3->max_len);
			g3->indel_seq[0] = (char*)realloc(g3->indel_seq[0], g3->max_len);
			g3->indel_seq[1] = (char*)realloc(g3->indel_seq[1], g3->max_len);
		}
		r += bgzf_read(fp, g3->indel_seq[0], x[0]);
		r += bgzf_read(fp, g3->indel_seq[1], x[1]);
		g3->indel_seq[0][x[0]] = g3->indel_seq[1][x[1]] = 0;
	}
	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xb(%rsp), %rsi
movl $0x1, %edx
callq 0x100b8
testl %eax, %eax
je 0x1a20c
movl %eax, %r15d
movb 0xb(%rsp), %al
movb %al, (%rbx)
cmpb $0x10, %al
jb 0x1a311
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x100b8
movl %eax, %ebp
addl %r15d, %ebp
movl (%r12), %eax
movl %eax, 0x10(%rbx)
movl 0x4(%r12), %eax
roll $0x8, %eax
movl %eax, 0xc(%rbx)
leaq 0x1(%rbx), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x100b8
movl %eax, %r12d
addl %ebp, %r12d
movb (%rbx), %al
andb $-0x10, %al
cmpb $0x10, %al
jne 0x1a214
addq $0x2, %rbx
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x100b8
movl %eax, %r15d
addl %r12d, %r15d
jmp 0x1a311
xorl %r15d, %r15d
jmp 0x1a311
leaq 0x2(%rbx), %rsi
movq %r14, %rdi
movl $0x3, %edx
callq 0x100b8
movl %eax, %r15d
leaq 0xc(%rsp), %r13
movq %r14, %rdi
movq %r13, %rsi
movl $0x4, %edx
callq 0x100b8
movl %eax, %ebp
addl %r15d, %ebp
addl %r12d, %ebp
movzwl (%r13), %eax
movw %ax, 0x14(%rbx)
movzwl 0x2(%r13), %ecx
movw %cx, 0x16(%rbx)
movl %eax, %edx
negw %dx
cmovsw %ax, %dx
movw %dx, (%r13)
movl %ecx, %eax
negw %ax
cmovsw %cx, %ax
movw %ax, 0x2(%r13)
cmpw %ax, %dx
cmovgl %edx, %eax
incl %eax
cwtl
cmpl %eax, 0x18(%rbx)
jge 0x1a2cb
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
incl %ecx
movl %ecx, 0x18(%rbx)
movq 0x20(%rbx), %rdi
movslq %ecx, %rsi
callq 0x3610
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
movslq 0x18(%rbx), %rsi
callq 0x3610
movq %rax, 0x28(%rbx)
movq 0x20(%rbx), %rsi
movswl 0xc(%rsp), %edx
movq %r14, %rdi
callq 0x100b8
addl %eax, %ebp
movq 0x28(%rbx), %rsi
movswl 0xe(%rsp), %edx
movq %r14, %rdi
callq 0x100b8
movl %eax, %r15d
addl %ebp, %r15d
movq 0x28(%rbx), %rax
movswq 0xe(%rsp), %rcx
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x20(%rbx), %rax
movswq 0xc(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq