// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/./bitstream/dvb/si/nit.h
// Function: nit_validate
static inline bool nit_validate(const uint8_t *p_nit)
{
    uint16_t i_section_size = psi_get_length(p_nit) + PSI_HEADER_SIZE
                               - PSI_CRC_SIZE;
    const uint8_t *p_nit_n;

    if (!psi_get_syntax(p_nit)
         || (psi_get_tableid(p_nit) != NIT_TABLE_ID_ACTUAL
              && psi_get_tableid(p_nit) != NIT_TABLE_ID_OTHER))
        return false;

    if (i_section_size < NIT_HEADER_SIZE
         || i_section_size < NIT_HEADER_SIZE + nit_get_desclength(p_nit))
        return false;

    if (!descs_validate(p_nit + 8))
        return false;

    p_nit_n = p_nit + NIT_HEADER_SIZE + nit_get_desclength(p_nit);

    if (nith_get_tslength(p_nit_n) != p_nit + i_section_size - p_nit_n
         - NIT_HEADER2_SIZE)
        return false;
    p_nit_n += NIT_HEADER2_SIZE;

    while (p_nit_n + NIT_TS_SIZE - p_nit <= i_section_size
            && p_nit_n + NIT_TS_SIZE + nitn_get_desclength(p_nit_n) - p_nit
                <= i_section_size) {
        if (!descs_validate(p_nit_n + 4))
            return false;

        p_nit_n += NIT_TS_SIZE + nitn_get_desclength(p_nit_n);
    }

    return (p_nit_n - p_nit == i_section_size);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3500
movzwl %ax, %eax
addl $0x3, %eax
subl $0x4, %eax
movw %ax, -0x12(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4360
testb $0x1, %al
jne 0x1d231
jmp 0x1d253
movq -0x10(%rbp), %rdi
callq 0x3530
movzbl %al, %eax
cmpl $0x40, %eax
je 0x1d25c
movq -0x10(%rbp), %rdi
callq 0x3530
movzbl %al, %eax
cmpl $0x41, %eax
je 0x1d25c
movb $0x0, -0x1(%rbp)
jmp 0x1d3c4
movzwl -0x12(%rbp), %eax
cmpl $0xa, %eax
jl 0x1d285
movzwl -0x12(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1d4d0
movw %ax, %cx
movl -0x24(%rbp), %eax
movzwl %cx, %ecx
addl $0xa, %ecx
cmpl %ecx, %eax
jge 0x1d28e
movb $0x0, -0x1(%rbp)
jmp 0x1d3c4
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x1ce60
testb $0x1, %al
jne 0x1d2a8
movb $0x0, -0x1(%rbp)
jmp 0x1d3c4
movq -0x10(%rbp), %rax
addq $0xa, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1d4d0
movw %ax, %cx
movq -0x30(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1d500
movzwl %ax, %eax
movq -0x10(%rbp), %rcx
movzwl -0x12(%rbp), %edx
movslq %edx, %rdx
addq %rdx, %rcx
movq -0x20(%rbp), %rdx
subq %rdx, %rcx
subq $0x2, %rcx
cmpq %rcx, %rax
je 0x1d304
movb $0x0, -0x1(%rbp)
jmp 0x1d3c4
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
addq $0x6, %rcx
movq -0x10(%rbp), %rax
subq %rax, %rcx
movzwl -0x12(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x31(%rbp)
jg 0x1d368
movq -0x20(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1d530
movw %ax, %cx
movq -0x40(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movzwl -0x12(%rbp), %ecx
cmpq %rcx, %rax
setle %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x1d371
jmp 0x1d3aa
movq -0x20(%rbp), %rdi
addq $0x4, %rdi
callq 0x1ce60
testb $0x1, %al
jne 0x1d388
movb $0x0, -0x1(%rbp)
jmp 0x1d3c4
movq -0x20(%rbp), %rdi
callq 0x1d530
movzwl %ax, %ecx
addl $0x6, %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x1d310
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movzwl -0x12(%rbp), %ecx
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nop