// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_gen_si.c
// Function: generate_nit
static void generate_nit(void) {
    uint8_t *nit = psi_allocate();
    uint8_t *nit_tsloop;
    uint8_t *desc_loop, *desc;
    uint8_t desc_counter;

    // Generate empty nit
    nit_init(nit, true);
    psi_set_version(nit, 0);
    psi_set_current(nit);
    nit_set_nid(nit, onid);
    nit_set_length(nit, 2);

    nit_set_desclength(nit, 0);

    nit_tsloop = nit_get_header2(nit);
    nith_init(nit_tsloop);
    nith_set_tslength(nit_tsloop, 0);

    psi_set_crc(nit);

    output_psi_section(nit, NIT_PID, &cc);

    // Add descriptors and transport stream loop
    nit_init(nit, true);
    psi_set_version(nit, 1);
    psi_set_current(nit);
    nit_set_nid(nit, onid);
    nit_set_length(nit, PSI_MAX_SIZE);
    nit_set_desclength(nit, 0);

    {
        // Add descriptors to network descriptors
        desc_counter = 0;
        desc_loop = nit_get_descs(nit);

        nit_set_desclength(nit, DESCS_MAX_SIZE);
        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc40(desc);

        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc43(desc);

        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc44(desc);

        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc5a(desc);

        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc5b(desc);

        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc62(desc);

        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc6c(desc);

        desc = descs_get_desc(desc_loop, desc_counter++);
        build_desc6d(desc);

        // Finish descriptor generation
        desc = descs_get_desc(desc_loop, desc_counter); // Get next descriptor pos
        nit_set_desclength(nit, desc - desc_loop - DESCS_HEADER_SIZE);
        nit_set_length(nit, 2 + nit_get_desclength(nit));
    }

    // Process transport stream loop
    nit_tsloop = nit_get_header2(nit);
    nith_init(nit_tsloop);
    nit_set_length(nit, PSI_MAX_SIZE); // This needed so nit_get_ts works
    {
        uint8_t *nit_n;
        uint8_t nit_n_counter = 0;

        nit_n = nit_get_ts(nit, nit_n_counter++);
        nitn_init(nit_n);
        nitn_set_tsid(nit_n, tsid);
        nitn_set_onid(nit_n, onid);
        nitn_set_desclength(nit_n, 0);
        {
            // Add descriptors to transport_stream_n
            desc_counter = 0;
            desc_loop = nitn_get_descs(nit_n);
            descs_set_length(desc_loop, DESCS_MAX_SIZE); // This is needed so descs_get_desc(x, n) works

            desc = descs_get_desc(desc_loop, desc_counter++);
            build_desc41(desc);

            desc = descs_get_desc(desc_loop, desc_counter++);
            build_desc4a_std(desc);

            // Finish descriptor generation
            desc = descs_get_desc(desc_loop, desc_counter); // Get next descriptor pos
            descs_set_length(desc_loop, desc - desc_loop - DESCS_HEADER_SIZE);
        }

        nit_n = nit_get_ts(nit, nit_n_counter++);
        nitn_init(nit_n);
        nitn_set_tsid(nit_n, tsid + 100);
        nitn_set_onid(nit_n, onid + 100);
        nitn_set_desclength(nit_n, 0);

        nit_n = nit_get_ts(nit, nit_n_counter++);
        nitn_init(nit_n);
        nitn_set_tsid(nit_n, tsid + 200);
        nitn_set_onid(nit_n, onid + 200);
        nitn_set_onid(nit_n, onid + 200);
        nitn_set_desclength(nit_n, 0);
        {
            // Add descriptors to transport_stream_n
            desc_counter = 0;
            desc_loop = nitn_get_descs(nit_n);
            descs_set_length(desc_loop, DESCS_MAX_SIZE); // This is needed so descs_get_desc(x, n) works

            desc = descs_get_desc(desc_loop, desc_counter++);
            build_desc41(desc);

            desc = descs_get_desc(desc_loop, desc_counter++);
            build_desc4a_mobile(desc);

            // Finish descriptor generation
            desc = descs_get_desc(desc_loop, desc_counter); // Get next descriptor pos
            descs_set_length(desc_loop, desc - desc_loop - DESCS_HEADER_SIZE);
        }

        nit_n = nit_get_ts(nit, nit_n_counter++);
        nitn_init(nit_n);
        nitn_set_tsid(nit_n, tsid + 300);
        nitn_set_onid(nit_n, onid + 300);
        nitn_set_desclength(nit_n, 0);

        // Set transport_stream_loop length
        nit_n = nit_get_ts(nit, nit_n_counter); // Get last ts
        nith_set_tslength(nit_tsloop, nit_n - nit_tsloop - NIT_HEADER2_SIZE);
    }
    // Set NIT length
    nit_set_length(nit, 2 + nit_get_desclength(nit) + nith_get_tslength(nit_tsloop));
    psi_set_crc(nit);

    output_psi_section(nit, NIT_PID, &cc);

    free(nit);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
callq 0x4f30
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x5e60
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x4ff0
movq -0x8(%rbp), %rdi
callq 0x5020
movq -0x8(%rbp), %rdi
movzwl 0x1f6e0(%rip), %esi     # 0x2108e
callq 0x4fb0
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x5eb0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x5ee0
movq -0x8(%rbp), %rdi
callq 0x5f30
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5f70
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x5f90
movq -0x8(%rbp), %rdi
callq 0x5080
movq -0x8(%rbp), %rdi
movl $0x10, %esi
leaq 0x1f6b3(%rip), %rdx     # 0x210b9
callq 0x5170
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x5e60
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x4ff0
movq -0x8(%rbp), %rdi
callq 0x5020
movq -0x8(%rbp), %rdi
movzwl 0x1f653(%rip), %esi     # 0x2108e
callq 0x4fb0
movq -0x8(%rbp), %rdi
movl $0x3fd, %esi            # imm = 0x3FD
callq 0x5eb0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x5ee0
movb $0x0, -0x21(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5fe0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x5ee0
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3fa2(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6000
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3f77(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6050
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3f4c(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x60f0
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3f21(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6150
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3ef6(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6210
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3ecb(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6390
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3ea0(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x64f0
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3e75(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x68d0
movq -0x18(%rbp), %rdi
leaq 0x3e55(%rip), %rdx      # 0x5a30
movzbl -0x21(%rbp), %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
subq $0x2, %rax
movzwl %ax, %esi
callq 0x5ee0
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6b90
movq -0x48(%rbp), %rdi
movzwl %ax, %eax
addl $0x2, %eax
movzwl %ax, %esi
callq 0x5eb0
movq -0x8(%rbp), %rdi
callq 0x5f30
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5f70
movq -0x8(%rbp), %rdi
movl $0x3fd, %esi            # imm = 0x3FD
callq 0x5eb0
movb $0x0, -0x31(%rbp)
movq -0x8(%rbp), %rdi
movb -0x31(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x31(%rbp)
movzbl %al, %esi
callq 0x6bc0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6cc0
movq -0x30(%rbp), %rdi
movzwl 0x1f40b(%rip), %esi     # 0x21088
callq 0x6ce0
movq -0x30(%rbp), %rdi
movzwl 0x1f401(%rip), %esi     # 0x2108e
callq 0x6d20
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x6d60
movb $0x0, -0x21(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6db0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x5970
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3d5e(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6dd0
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3d33(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6f50
movq -0x18(%rbp), %rdi
leaq 0x3d13(%rip), %rdx      # 0x5a30
movzbl -0x21(%rbp), %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
subq $0x2, %rax
movzwl %ax, %esi
callq 0x5970
movq -0x8(%rbp), %rdi
movb -0x31(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x31(%rbp)
movzbl %al, %esi
callq 0x6bc0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6cc0
movq -0x30(%rbp), %rdi
movzwl 0x1f314(%rip), %eax     # 0x21088
addl $0x64, %eax
movzwl %ax, %esi
callq 0x6ce0
movq -0x30(%rbp), %rdi
movzwl 0x1f304(%rip), %eax     # 0x2108e
addl $0x64, %eax
movzwl %ax, %esi
callq 0x6d20
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x6d60
movq -0x8(%rbp), %rdi
movb -0x31(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x31(%rbp)
movzbl %al, %esi
callq 0x6bc0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6cc0
movq -0x30(%rbp), %rdi
movzwl 0x1f2b9(%rip), %eax     # 0x21088
addl $0xc8, %eax
movzwl %ax, %esi
callq 0x6ce0
movq -0x30(%rbp), %rdi
movzwl 0x1f2a7(%rip), %eax     # 0x2108e
addl $0xc8, %eax
movzwl %ax, %esi
callq 0x6d20
movq -0x30(%rbp), %rdi
movzwl 0x1f28f(%rip), %eax     # 0x2108e
addl $0xc8, %eax
movzwl %ax, %esi
callq 0x6d20
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x6d60
movb $0x0, -0x21(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6db0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x5970
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3be4(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6dd0
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x21(%rbp)
leaq 0x3bb9(%rip), %rdx      # 0x5a30
movzbl %al, %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6fc0
movq -0x18(%rbp), %rdi
leaq 0x3b99(%rip), %rdx      # 0x5a30
movzbl -0x21(%rbp), %esi
callq 0x59c0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
subq $0x2, %rax
movzwl %ax, %esi
callq 0x5970
movq -0x8(%rbp), %rdi
movb -0x31(%rbp), %al
movb %al, %cl
addb $0x1, %cl
movb %cl, -0x31(%rbp)
movzbl %al, %esi
callq 0x6bc0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6cc0
movq -0x30(%rbp), %rdi
movzwl 0x1f19a(%rip), %eax     # 0x21088
addl $0x12c, %eax            # imm = 0x12C
movzwl %ax, %esi
callq 0x6ce0
movq -0x30(%rbp), %rdi
movzwl 0x1f188(%rip), %eax     # 0x2108e
addl $0x12c, %eax            # imm = 0x12C
movzwl %ax, %esi
callq 0x6d20
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x6d60
movq -0x8(%rbp), %rdi
movzbl -0x31(%rbp), %esi
callq 0x6bc0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq $0x2, %rax
movzwl %ax, %esi
callq 0x5f90
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6b90
movzwl %ax, %eax
addl $0x2, %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7090
movq -0x40(%rbp), %rdi
movw %ax, %cx
movl -0x38(%rbp), %eax
movzwl %cx, %ecx
addl %ecx, %eax
movzwl %ax, %esi
callq 0x5eb0
movq -0x8(%rbp), %rdi
callq 0x5080
movq -0x8(%rbp), %rdi
movl $0x10, %esi
leaq 0x1f11c(%rip), %rdx     # 0x210b9
callq 0x5170
movq -0x8(%rbp), %rdi
callq 0x1030
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)