// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/yahs.c
// Function: find_aseq_telos
int8_t *find_aseq_telos(asm_dict_t *dict, int8_t *telo_ends)
{   
    int i, n;
    int8_t *telos;
    sdict_t *sdict;
    sd_aseq_t *aseq;
    sd_seg_t *segs, *seg;
    
    sdict = dict->sdict;
    n = dict->n;
    telos = (int8_t *) calloc(dict->n * 2, sizeof(int8_t));

    segs = dict->seg;
    for (i = 0; i < n; i++) {
        aseq = &dict->s[i];
        // first seg
        seg = &segs[aseq->s];
        if ((telo_ends[seg->c>>1<<1] && seg->x <= MAX_TELO_CLIP && (seg->c&1) == 0) ||
            (telo_ends[seg->c>>1<<1|1] && (seg->x + seg->y + MAX_TELO_CLIP) >= sdict->s[seg->c>>1].len && (seg->c&1) == 1))
            telos[i<<1] = 1;
        // last seg
        seg = &segs[aseq->s + aseq->n - 1];
        if ((telo_ends[seg->c>>1<<1] && seg->x <= MAX_TELO_CLIP && (seg->c&1) == 1) ||
            (telo_ends[seg->c>>1<<1|1] && (seg->x + seg->y + MAX_TELO_CLIP) >= sdict->s[seg->c>>1].len && (seg->c&1) == 0))
            telos[i<<1|1] = 1;
    }

    return telos;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shll %eax
movl %eax, %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x2290
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x2bece
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x1c(%rcx), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl %ecx
shll %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2bd8e
movq -0x40(%rbp), %rax
cmpl $0x32, 0x1c(%rax)
ja 0x2bd8e
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2bdea
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl %ecx
shll %ecx
orl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2bdfa
movq -0x40(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x40(%rbp), %rcx
addl 0x20(%rcx), %eax
addl $0x32, %eax
movq -0x28(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x40(%rbp), %rdx
movl 0x18(%rdx), %edx
shrl %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jb 0x2bdfa
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x2bdfa
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x1c(%rcx), %ecx
movq -0x30(%rbp), %rdx
addl 0x18(%rdx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl %ecx
shll %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2be4f
movq -0x40(%rbp), %rax
cmpl $0x32, 0x1c(%rax)
ja 0x2be4f
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x2beab
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl %ecx
shll %ecx
orl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2bebe
movq -0x40(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x40(%rbp), %rcx
addl 0x20(%rcx), %eax
addl $0x32, %eax
movq -0x28(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x40(%rbp), %rdx
movl 0x18(%rdx), %edx
shrl %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jb 0x2bebe
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2bebe
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
shll %ecx
orl $0x1, %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
jmp 0x2bec0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2bd22
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)