// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/./bitstream/mpeg/psi/psi.h
// Function: psi_split_section
static inline void psi_split_section(uint8_t *p_ts, uint8_t *pi_ts_offset,
                                     const uint8_t *p_section,
                                     uint16_t *pi_section_offset)
{
    uint16_t i_section_length = psi_get_length(p_section) + PSI_HEADER_SIZE
                                 - *pi_section_offset;
    uint8_t i_ts_length, i_copy;

    if (!*pi_ts_offset) {
        ts_init(p_ts);
        ts_set_payload(p_ts);
        *pi_ts_offset = ts_payload(p_ts) - p_ts;
    }

    if (!*pi_section_offset) {
        if (TS_SIZE - *pi_ts_offset < 2) {
            psi_split_end(p_ts, pi_ts_offset);
            return;
        }
        if (!ts_get_unitstart(p_ts)) {
            uint8_t *p_payload = ts_payload(p_ts);
            uint8_t i_payload_length = *pi_ts_offset - (p_payload - p_ts);
            if (i_payload_length)
                memmove(p_payload + 1, p_payload, i_payload_length);
            (*pi_ts_offset)++;
            *p_payload = i_payload_length; /* pointer_field */
            ts_set_unitstart(p_ts);
        }
    }
    i_ts_length = TS_SIZE - *pi_ts_offset;

    i_copy = i_ts_length < i_section_length ?
             i_ts_length : i_section_length;
    memcpy(p_ts + *pi_ts_offset, p_section + *pi_section_offset, i_copy);
    *pi_ts_offset += i_copy;
    *pi_section_offset += i_copy;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5490
movzwl %ax, %eax
addl $0x3, %eax
movq -0x20(%rbp), %rcx
movzwl (%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x22(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x5527
movq -0x8(%rbp), %rdi
callq 0x5740
movq -0x8(%rbp), %rdi
callq 0x5770
movq -0x8(%rbp), %rdi
callq 0x5790
movq -0x8(%rbp), %rcx
subq %rcx, %rax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movq -0x20(%rbp), %rax
cmpw $0x0, (%rax)
jne 0x55c8
movq -0x10(%rbp), %rax
movzbl (%rax), %ecx
movl $0xbc, %eax
subl %ecx, %eax
cmpl $0x2, %eax
jge 0x555a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x56e0
jmp 0x5645
movq -0x8(%rbp), %rdi
callq 0x5810
testb $0x1, %al
jne 0x55c6
movq -0x8(%rbp), %rdi
callq 0x5790
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rdx
subq %rdx, %rcx
subq %rcx, %rax
movb %al, -0x31(%rbp)
cmpb $0x0, -0x31(%rbp)
je 0x55a9
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
movq -0x30(%rbp), %rsi
movzbl -0x31(%rbp), %eax
movl %eax, %edx
callq 0x10d0
movq -0x10(%rbp), %rax
movb (%rax), %cl
addb $0x1, %cl
movb %cl, (%rax)
movb -0x31(%rbp), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rdi
callq 0x5840
jmp 0x55c8
movq -0x10(%rbp), %rax
movzbl (%rax), %ecx
movl $0xbc, %eax
subl %ecx, %eax
movb %al, -0x23(%rbp)
movzbl -0x23(%rbp), %eax
movzwl -0x22(%rbp), %ecx
cmpl %ecx, %eax
jge 0x55ee
movzbl -0x23(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x55f5
movzwl -0x22(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movb %al, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cltq
addq %rax, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movzwl (%rax), %eax
cltq
addq %rax, %rsi
movzbl -0x24(%rbp), %eax
movl %eax, %edx
callq 0x1090
movzbl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movzbl (%rax), %ecx
addl %edx, %ecx
movb %cl, (%rax)
movzbl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movzwl (%rax), %ecx
addl %edx, %ecx
movw %cx, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)