// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/align.c
// Function: mm_update_dp_max
void mm_update_dp_max(int qlen, int n_regs, mm_reg1_t *regs, float frac, int a, int b)
{
	int32_t max = -1, max2 = -1, i, max_i = -1;
	double div, b2;
	if (n_regs < 2) return;
	for (i = 0; i < n_regs; ++i) {
		mm_reg1_t *r = &regs[i];
		if (r->p == 0) continue;
		if (r->p->dp_max > max) max2 = max, max = r->p->dp_max, max_i = i;
		else if (r->p->dp_max > max2) max2 = r->p->dp_max;
	}
	if (max_i < 0 || max < 0 || max2 < 0) return;
	if (regs[max_i].qe - regs[max_i].qs < (double)qlen * frac) return;
	if (max2 < (double)max * frac) return;
	div = 1. - mm_event_identity(&regs[max_i]);
	if (div < 0.02) div = 0.02;
	b2 = 0.5 / div; // max value: 25
	if (b2 * a < b) b2 = (double)a / b;
	for (i = 0; i < n_regs; ++i) {
		mm_reg1_t *r = &regs[i];
		if (r->p == 0) continue;
		r->p->dp_max = mm_recal_max_dp(r, b2, a);
		if (r->p->dp_max < 0) r->p->dp_max = 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
cmpl $0x2, -0x8(%rbp)
jge 0x2289e
jmp 0x22aa0
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x22929
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x228cd
jmp 0x2291b
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x8(%rax), %eax
cmpl -0x20(%rbp), %eax
jle 0x228f9
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x22919
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x8(%rax), %eax
cmpl -0x24(%rbp), %eax
jle 0x22917
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x22919
jmp 0x2291b
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x228a5
cmpl $0x0, -0x2c(%rbp)
jl 0x2293b
cmpl $0x0, -0x20(%rbp)
jl 0x2293b
cmpl $0x0, -0x24(%rbp)
jge 0x22940
jmp 0x22aa0
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
imulq $0x50, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
cvtsi2sd %eax, %xmm1
cvtsi2sdl -0x4(%rbp), %xmm0
movss -0x14(%rbp), %xmm2
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x22985
jmp 0x22aa0
cvtsi2sdl -0x24(%rbp), %xmm1
cvtsi2sdl -0x20(%rbp), %xmm0
movss -0x14(%rbp), %xmm2
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x229a7
jmp 0x22aa0
movq -0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rax
imulq $0x50, %rax, %rax
addq %rax, %rdi
callq 0x22720
movaps %xmm0, %xmm1
movsd 0x3264a(%rip), %xmm0    # 0x55010
subsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x357b1(%rip), %xmm0    # 0x58188
ucomisd -0x38(%rbp), %xmm0
jbe 0x229eb
movsd 0x357a2(%rip), %xmm0    # 0x58188
movsd %xmm0, -0x38(%rbp)
movsd 0x34305(%rip), %xmm0    # 0x56cf8
divsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm1
cvtsi2sdl -0x18(%rbp), %xmm0
mulsd %xmm0, %xmm1
cvtsi2sdl -0x1c(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x22a29
cvtsi2sdl -0x18(%rbp), %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x22aa0
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x22a58
jmp 0x22a95
movq -0x50(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
movl -0x18(%rbp), %esi
callq 0x22ab0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rax
movl %ecx, 0x8(%rax)
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x8(%rax)
jge 0x22a93
movq -0x50(%rbp), %rax
movq 0x48(%rax), %rax
movl $0x0, 0x8(%rax)
jmp 0x22a95
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x22a30
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)