// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/./bitstream/scte/35.h
// Function: scte35_insert_validate
static inline bool scte35_insert_validate(const uint8_t *p_scte35)
{
    size_t i_length = scte35_get_command_length(p_scte35);
    if (i_length < SCTE35_INSERT_HEADER_SIZE)
        return false;

    if (scte35_insert_has_cancel(p_scte35))
        return i_length <= SCTE35_INSERT_HEADER_SIZE;
    if (i_length < SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE)
        return false;

    if (scte35_insert_has_program_splice(p_scte35)) {
        if (scte35_insert_has_splice_immediate(p_scte35)) {
            if (scte35_insert_has_duration(p_scte35))
                return i_length >= SCTE35_INSERT_HEADER_SIZE +
                                   SCTE35_INSERT_HEADER2_SIZE +
                                   SCTE35_BREAK_DURATION_HEADER_SIZE +
                                   SCTE35_INSERT_FOOTER_SIZE;
            return i_length >= SCTE35_INSERT_HEADER_SIZE +
                               SCTE35_INSERT_HEADER2_SIZE +
                               SCTE35_INSERT_FOOTER_SIZE;
        }

        if (i_length < SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE +
                       SCTE35_SPLICE_TIME_HEADER_SIZE ||
            i_length < SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE +
                       scte35_splice_time_size(
                           scte35_insert_get_splice_time(p_scte35)))
            return false;

        if (scte35_insert_has_duration(p_scte35))
            return i_length >= SCTE35_INSERT_HEADER_SIZE +
                SCTE35_INSERT_HEADER2_SIZE +
                scte35_splice_time_size(scte35_insert_get_splice_time(p_scte35))
                + SCTE35_BREAK_DURATION_HEADER_SIZE +
                SCTE35_INSERT_FOOTER_SIZE;
        return i_length >= SCTE35_INSERT_HEADER_SIZE +
            SCTE35_INSERT_HEADER2_SIZE +
            scte35_splice_time_size(scte35_insert_get_splice_time(p_scte35))
            + SCTE35_INSERT_FOOTER_SIZE;
    }

    if (i_length < SCTE35_INSERT_HEADER_SIZE + SCTE35_INSERT_HEADER2_SIZE +
                   SCTE35_INSERT_COMPONENT_COUNT_SIZE)
        return false;

    const uint8_t *p_command = scte35_get_command(p_scte35);
    const uint8_t *p_end = scte35_insert_get_component(p_scte35,
            scte35_insert_get_component_count(p_scte35) + 1);
    if (p_end == NULL)
        return false;

    if (scte35_insert_has_duration(p_scte35))
        return i_length >= p_end + SCTE35_BREAK_DURATION_HEADER_SIZE +
                                   SCTE35_INSERT_FOOTER_SIZE - p_command;
    return i_length >= p_end + SCTE35_INSERT_FOOTER_SIZE - p_command;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20710
movzwl %ax, %eax
movq %rax, -0x18(%rbp)
cmpq $0x5, -0x18(%rbp)
jae 0x207ec
movb $0x0, -0x1(%rbp)
jmp 0x209d8
movq -0x10(%rbp), %rdi
callq 0x20b00
testb $0x1, %al
jne 0x207fb
jmp 0x2080d
cmpq $0x5, -0x18(%rbp)
setbe %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x209d8
cmpq $0x6, -0x18(%rbp)
jae 0x2081d
movb $0x0, -0x1(%rbp)
jmp 0x209d8
movq -0x10(%rbp), %rdi
callq 0x20b40
testb $0x1, %al
jne 0x2082f
jmp 0x20936
movq -0x10(%rbp), %rdi
callq 0x20b80
testb $0x1, %al
jne 0x2083e
jmp 0x20871
movq -0x10(%rbp), %rdi
callq 0x20bc0
testb $0x1, %al
jne 0x2084d
jmp 0x2085f
cmpq $0xf, -0x18(%rbp)
setae %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x209d8
cmpq $0xa, -0x18(%rbp)
setae %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x209d8
cmpq $0x7, -0x18(%rbp)
jb 0x208a5
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20c30
movq %rax, %rdi
callq 0x20c00
movb %al, %cl
movq -0x30(%rbp), %rax
movzbl %cl, %ecx
addl $0x6, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jae 0x208ae
movb $0x0, -0x1(%rbp)
jmp 0x209d8
movq -0x10(%rbp), %rdi
callq 0x20bc0
testb $0x1, %al
jne 0x208bd
jmp 0x208fb
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20c30
movq %rax, %rdi
callq 0x20c00
movb %al, %cl
movq -0x38(%rbp), %rax
movzbl %cl, %ecx
addl $0x6, %ecx
addl $0x5, %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
setae %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x209d8
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20c30
movq %rax, %rdi
callq 0x20c00
movb %al, %cl
movq -0x40(%rbp), %rax
movzbl %cl, %ecx
addl $0x6, %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
setae %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x209d8
cmpq $0x7, -0x18(%rbp)
jae 0x20946
movb $0x0, -0x1(%rbp)
jmp 0x209d8
movq -0x10(%rbp), %rdi
callq 0x20ae0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20d70
movq -0x48(%rbp), %rdi
movzbl %al, %eax
addl $0x1, %eax
movzbl %al, %esi
callq 0x20c60
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x20987
movb $0x0, -0x1(%rbp)
jmp 0x209d8
movq -0x10(%rbp), %rdi
callq 0x20bc0
testb $0x1, %al
jne 0x20996
jmp 0x209ba
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x5, %rcx
addq $0x4, %rcx
movq -0x20(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
setae %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x209d8
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
movq -0x20(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
setae %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)