// File: chhylp123[P]hifiasm/anchor.cpp
// Function: hpc_ext_check(All_reads*, unsigned int, long, long, long, unsigned long, char*)
void hpc_ext_check(All_reads *rref, uint32_t id, int64_t s0, int64_t e0, int64_t l, uint64_t rev, char *buf)
{
	if(s0 < 0) s0 = 0; if(e0 > l) e0 = l;
	int64_t s = s0 - 256, e = e0 + 256, n, k, os0, oe0, os1, oe1; char c; if(s < 0) s = 0; if(e > l) e = l;
	recover_UC_Read_sub_region(buf, s, e - s, rev, rref, id); 
	os0 = s0 - s; oe0 = e0 - s; n = e - s; os1 = os0; oe1 = oe0;
	c = buf[os0];
	for (k = os0 - 1; k >= 0 && buf[k] == c; k--); os1 = k + 1;

	c = buf[oe0-1];
	for (k = oe0; k < n && buf[k] == c; k++); oe1 = k;

	if(os1 != os0 || oe1 != oe0) {
		fprintf(stderr, "[M::%s]\to0::[%ld,%ld)\to1::[%ld,%ld)\n", __func__, os0 + s0, oe0 + s0, os1 + s0, oe1 + s0);
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x1b0a85
movq $0x0, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jle 0x1b0a97
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
subq $0x100, %rax            # imm = 0x100
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
jge 0x1b0ac2
movq $0x0, -0x38(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x28(%rbp), %rax
jle 0x1b0ad4
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
subq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %r8
movl -0xc(%rbp), %ecx
movl %ecx, %r9d
movzbl %al, %ecx
callq 0x9a30
movq -0x18(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq 0x10(%rbp), %rax
movq -0x58(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x71(%rbp)
movq -0x58(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x50(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x50(%rbp)
movb %al, -0x72(%rbp)
jl 0x1b0b6c
movq 0x10(%rbp), %rax
movq -0x50(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movsbl -0x71(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x72(%rbp)
movb -0x72(%rbp), %al
testb $0x1, %al
jne 0x1b0b75
jmp 0x1b0b85
jmp 0x1b0b77
movq -0x50(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x1b0b48
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq 0x10(%rbp), %rax
movq -0x60(%rbp), %rcx
subq $0x1, %rcx
movb (%rax,%rcx), %al
movb %al, -0x71(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
xorl %eax, %eax
cmpq -0x48(%rbp), %rcx
movb %al, -0x73(%rbp)
jge 0x1b0bd2
movq 0x10(%rbp), %rax
movq -0x50(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movsbl -0x71(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x73(%rbp)
movb -0x73(%rbp), %al
testb $0x1, %al
jne 0x1b0bdb
jmp 0x1b0beb
jmp 0x1b0bdd
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x1b0bab
movq -0x50(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x58(%rbp), %rax
jne 0x1b0c07
movq -0x70(%rbp), %rax
cmpq -0x60(%rbp), %rax
je 0x1b0c4a
movq 0x2133d2(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x58(%rbp), %rcx
addq -0x18(%rbp), %rcx
movq -0x60(%rbp), %r8
addq -0x18(%rbp), %r8
movq -0x68(%rbp), %r9
addq -0x18(%rbp), %r9
movq -0x70(%rbp), %rax
addq -0x18(%rbp), %rax
leaq 0x1db1dd(%rip), %rsi    # 0x38be15
leaq 0x1db1fb(%rip), %rdx    # 0x38be3a
movq %rax, (%rsp)
movb $0x0, %al
callq 0x22a0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)