// File: /workspace/github_cpp_makefile_star2_O3/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 0x1096a
testl %eax, %eax
je 0x1a87b
movl %eax, %ebp
movb 0xb(%rsp), %al
movb %al, (%rbx)
cmpb $0x10, %al
jb 0x1a984
leaq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x1096a
movl %eax, %r12d
addl %ebp, %r12d
movl (%r15), %eax
movl %eax, 0x10(%rbx)
movl 0x4(%r15), %eax
roll $0x8, %eax
movl %eax, 0xc(%rbx)
leaq 0x1(%rbx), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x1096a
movl %eax, %r15d
addl %r12d, %r15d
movb (%rbx), %al
andb $-0x10, %al
cmpb $0x10, %al
jne 0x1a882
addq $0x2, %rbx
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x1096a
movl %eax, %ebp
addl %r15d, %ebp
jmp 0x1a984
xorl %ebp, %ebp
jmp 0x1a984
leaq 0x2(%rbx), %rsi
movq %r14, %rdi
movl $0x3, %edx
callq 0x1096a
movl %eax, %r12d
leaq 0xc(%rsp), %r13
movq %r14, %rdi
movq %r13, %rsi
movl $0x4, %edx
callq 0x1096a
movl %eax, %ebp
addl %r12d, %ebp
addl %r15d, %ebp
movl (%r13), %eax
movd %eax, %xmm0
movw %ax, 0x14(%rbx)
shrl $0x10, %eax
movw %ax, 0x16(%rbx)
pxor %xmm1, %xmm1
psubw %xmm0, %xmm1
pmaxsw %xmm0, %xmm1
movd %xmm1, (%r13)
pextrw $0x1, %xmm1, %ecx
movd %xmm1, %eax
cmpw %cx, %ax
cmovgl %eax, %ecx
incl %ecx
movswl %cx, %ecx
cmpl %ecx, 0x18(%rbx)
jge 0x1a940
decl %ecx
movl %ecx, %eax
sarl %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x10, %eax
orl %ecx, %eax
incl %eax
movl %eax, 0x18(%rbx)
movq 0x20(%rbx), %rdi
movslq %eax, %rsi
callq 0x3610
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
movslq 0x18(%rbx), %rsi
callq 0x3610
movq %rax, 0x28(%rbx)
movzwl 0xc(%rsp), %eax
movq 0x20(%rbx), %rsi
movswl %ax, %edx
movq %r14, %rdi
callq 0x1096a
movl %eax, %r15d
movq 0x28(%rbx), %rsi
movswl 0xe(%rsp), %edx
movq %r14, %rdi
callq 0x1096a
addl %eax, %ebp
addl %r15d, %ebp
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 %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq