// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/break.c
// Function: make_dual_break
static int make_dual_break(int64_t *link, uint32_t s, uint32_t e, uint32_t d, double fold_thres, uint32_t *bp_s, uint32_t *bp_e)
{
    // make dual break if there is a bump
    // find the exact break points
    uint32_t i, l, lm, u, ls, le;

    ls = u = 0;
    lm = UINT32_MAX;
    for (i = s; i <= e; ++i) {
        l = (uint32_t) link[i];
        if (l < lm) {
            u = 0;
            ls = i;
            lm = l;
        } else if (l > MAX(10., lm / fold_thres)) {
            if (++u >= d)
                break;
        }
    }

    le = u = 0;
    lm = UINT32_MAX;
    for (i = s; i <= e; ++i) {
        l = (uint32_t) link[e - i + s];
        if (l < lm) {
            u = 0;
            le = e - i + s;
            lm = l;
        } else if (l > MAX(10., lm / fold_thres)) {
            if (++u >= d)
                break;
        }
    }
    
    if (le >= ls + d) {
        *bp_s = ls;
        *bp_e = le;
        return 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movsd %xmm0, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x18(%rbp), %eax
ja 0x608d
movq -0x10(%rbp), %rax
movl -0x3c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x44(%rbp), %eax
jae 0x6010
movl $0x0, -0x48(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x607d
movl -0x40(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x44(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd -0x28(%rbp), %xmm1
movsd 0x2b196(%rip), %xmm0    # 0x311c8
ucomisd %xmm1, %xmm0
jbe 0x6047
movsd 0x2b188(%rip), %xmm0    # 0x311c8
movsd %xmm0, -0x60(%rbp)
jmp 0x6059
movl -0x44(%rbp), %eax
cvtsi2sd %rax, %xmm0
divsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x58(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x607b
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
cmpl -0x1c(%rbp), %eax
jb 0x6079
jmp 0x608d
jmp 0x607b
jmp 0x607d
jmp 0x607f
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5fd9
movl $0x0, -0x48(%rbp)
movl $0x0, -0x50(%rbp)
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x18(%rbp), %eax
ja 0x616a
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
subl -0x3c(%rbp), %ecx
addl -0x14(%rbp), %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x44(%rbp), %eax
jae 0x60ed
movl $0x0, -0x48(%rbp)
movl -0x18(%rbp), %eax
subl -0x3c(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x615a
movl -0x40(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x44(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd -0x28(%rbp), %xmm1
movsd 0x2b0b9(%rip), %xmm0    # 0x311c8
ucomisd %xmm1, %xmm0
jbe 0x6124
movsd 0x2b0ab(%rip), %xmm0    # 0x311c8
movsd %xmm0, -0x70(%rbp)
jmp 0x6136
movl -0x44(%rbp), %eax
cvtsi2sd %rax, %xmm0
divsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x68(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x6158
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
cmpl -0x1c(%rbp), %eax
jb 0x6156
jmp 0x616a
jmp 0x6158
jmp 0x615a
jmp 0x615c
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x60a8
movl -0x50(%rbp), %eax
movl -0x4c(%rbp), %ecx
addl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jb 0x6192
movl -0x4c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl -0x50(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x6199
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop