// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_gen_si.c
// Function: generate_scte35
static void generate_scte35(void) {
    uint8_t *scte35 = psi_allocate();

    // Generate empty section
    scte35_init(scte35);
    psi_set_length(scte35, PSI_MAX_SIZE);
    scte35_set_pts_adjustment(scte35, 0);
    scte35_null_init(scte35);
    scte35_set_desclength(scte35, 0);
    psi_set_length(scte35,
            scte35_get_descl(scte35) + PSI_CRC_SIZE - scte35 - PSI_HEADER_SIZE);
    psi_set_crc(scte35);
    output_psi_section(scte35, scte35_pid, &cc);

    // Generate insert section
    scte35_init(scte35);
    psi_set_length(scte35, PSI_MAX_SIZE);
    scte35_set_pts_adjustment(scte35, 0);
    scte35_insert_init(scte35,
            SCTE35_INSERT_HEADER2_SIZE +
            SCTE35_SPLICE_TIME_HEADER_SIZE + SCTE35_SPLICE_TIME_TIME_SIZE +
            SCTE35_BREAK_DURATION_HEADER_SIZE + SCTE35_INSERT_FOOTER_SIZE);
    scte35_insert_set_cancel(scte35, false);
    scte35_insert_set_event_id(scte35, 4242);
    scte35_insert_set_out_of_network(scte35, true);
    scte35_insert_set_program_splice(scte35, true);
    scte35_insert_set_duration(scte35, true);
    scte35_insert_set_splice_immediate(scte35, false);

    uint8_t *splice_time = scte35_insert_get_splice_time(scte35);
    scte35_splice_time_init(splice_time);
    scte35_splice_time_set_time_specified(splice_time, true);
    scte35_splice_time_set_pts_time(splice_time, 270000000);

    uint8_t *duration = scte35_insert_get_break_duration(scte35);
    scte35_break_duration_init(duration);
    scte35_break_duration_set_auto_return(duration, true);
    scte35_break_duration_set_duration(duration, 27000000);

    scte35_insert_set_unique_program_id(scte35, 2424);
    scte35_insert_set_avail_num(scte35, 0);
    scte35_insert_set_avails_expected(scte35, 0);
    scte35_set_desclength(scte35, 0);
    psi_set_length(scte35,
            scte35_get_descl(scte35) + PSI_CRC_SIZE - scte35 - PSI_HEADER_SIZE);
    psi_set_crc(scte35);
    output_psi_section(scte35, scte35_pid, &cc);

    free(scte35);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
callq 0x4f30
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16350
movq -0x8(%rbp), %rdi
movl $0x3fd, %esi            # imm = 0x3FD
callq 0x5290
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x163c0
movq -0x8(%rbp), %rdi
callq 0x16450
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x16490
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16500
movq -0x28(%rbp), %rdi
addq $0x4, %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
subq $0x3, %rax
movzwl %ax, %esi
callq 0x5290
movq -0x8(%rbp), %rdi
callq 0x5080
movq -0x8(%rbp), %rdi
leaq 0x1c310(%rip), %rdx     # 0x210b9
movzwl 0x1c2e2(%rip), %esi     # 0x21092
callq 0x5170
movq -0x8(%rbp), %rdi
callq 0x16350
movq -0x8(%rbp), %rdi
movl $0x3fd, %esi            # imm = 0x3FD
callq 0x5290
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x163c0
movq -0x8(%rbp), %rdi
movl $0xf, %esi
callq 0x16560
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x165d0
movq -0x8(%rbp), %rdi
movl $0x1092, %esi           # imm = 0x1092
callq 0x16630
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x166a0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x16700
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x16750
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x167a0
movq -0x8(%rbp), %rdi
callq 0x167f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x16820
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x16840
movq -0x10(%rbp), %rdi
movl $0x1017df80, %esi       # imm = 0x1017DF80
callq 0x16880
movq -0x8(%rbp), %rdi
callq 0x16910
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x169c0
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x169e0
movq -0x18(%rbp), %rdi
movl $0x19bfcc0, %esi        # imm = 0x19BFCC0
callq 0x16a20
movq -0x8(%rbp), %rdi
movl $0x978, %esi            # imm = 0x978
callq 0x16ab0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x16b00
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x16b30
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x16490
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16500
movq -0x20(%rbp), %rdi
addq $0x4, %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
subq $0x3, %rax
movzwl %ax, %esi
callq 0x5290
movq -0x8(%rbp), %rdi
callq 0x5080
movq -0x8(%rbp), %rdi
leaq 0x1c1b1(%rip), %rdx     # 0x210b9
movzwl 0x1c183(%rip), %esi     # 0x21092
callq 0x5170
movq -0x8(%rbp), %rdi
callq 0x1030
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)