// File: /workspace/github_c_makefile_star2_O2/videolan[P]bitstream/examples/dvb_ecmg.c
// Function: send_channel_status
static void send_channel_status(void)
{
    uint8_t p_tlv_h[MAX_TLV_SIZE];
    uint8_t *p_tlv = tlvh_get_tlv(p_tlv_h);
    uint8_t *p_tlv_n;

    tlvh_set_version(p_tlv_h, i_version);
    ecmg_init(p_tlv);
    tlv_set_type(p_tlv, ECMG_TYPE_CHANNEL_STATUS);
    /* length will be written at the end */
    tlv_set_length(p_tlv, MAX_TLV_SIZE - TLV_HEADER_SIZE - TLVH_HEADER_SIZE);

    ecmg_append_channelid(p_tlv, i_channelid);
    ecmg_append_sectiontspkt(p_tlv, 0x0); /* sections */
    ecmg_append_delaystart(p_tlv, DELAY_START);
    ecmg_append_delaystop(p_tlv, DELAY_STOP);
    ecmg_append_repperiod(p_tlv, REP_PERIOD);
    ecmg_append_maxstreams(p_tlv, MAX_STREAMS);
    ecmg_append_mincpdur(p_tlv, MIN_CP_DUR);
    ecmg_append_leadcw(p_tlv, LEAD_CW);
    ecmg_append_cwpermsg(p_tlv, CW_PER_MSG);
    ecmg_append_maxcomptime(p_tlv, MAX_COMP_TIME);

    p_tlv_n = tlv_find_param(p_tlv, TLV_PARAM_EMPTY, 0);
    tlv_set_length(p_tlv, p_tlv_n - p_tlv - TLV_HEADER_SIZE);
    write_wrapper(p_tlv_h, p_tlv_n - p_tlv_h);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0x1(%rsp), %rbx
movb 0x3091(%rip), %al       # 0x5070
movb %al, -0x1(%rbx)
andw $0x0, 0x4(%rbx)
movl $0xf7030300, (%rbx)     # imm = 0xF7030300
movzwl 0x308e(%rip), %esi      # 0x5082
movq %rbx, %rdi
callq 0x1e57
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movzwl 0x2(%rbx), %ecx
rolw $0x8, %cx
movzwl %cx, %r14d
movq %rax, %rcx
subq %rbx, %rcx
addq $0x3, %rcx
cmpq %r14, %rcx
jg 0x203f
movl $0x1000200, (%rax)      # imm = 0x1000200
andw $0x0, 0x4(%rax)
movb $0x0, 0x6(%rax)
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x4, %rcx
cmpq %r14, %rcx
jg 0x2074
movabsq $0xc80002000300, %rcx   # imm = 0xC80002000300
movq %rcx, (%rax)
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x4, %rcx
cmpq %r14, %rcx
jg 0x20a3
movq $0x2000400, (%rax)      # imm = 0x2000400
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x4, %rcx
cmpq %r14, %rcx
jg 0x20d8
movabsq $0x2c0102000700, %rcx   # imm = 0x2C0102000700
movq %rcx, (%rax)
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x4, %rcx
cmpq %r14, %rcx
jg 0x210d
movabsq $0xf40102000800, %rcx   # imm = 0xF40102000800
movq %rcx, (%rax)
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x4, %rcx
cmpq %r14, %rcx
jg 0x2142
movabsq $0x30002000900, %rcx    # imm = 0x30002000900
movq %rcx, (%rax)
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x3, %rcx
cmpq %r14, %rcx
jg 0x217a
movl $0x1000a00, (%rax)      # imm = 0x1000A00
movw $0x1, 0x4(%rax)
movb $0x0, 0x6(%rax)
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x3, %rcx
cmpq %r14, %rcx
jg 0x21b2
movl $0x1000b00, (%rax)      # imm = 0x1000B00
movw $0x2, 0x4(%rax)
movb $0x0, 0x6(%rax)
movzwl 0x3(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movq %rax, %rcx
subq %rbx, %rcx
addq $0x4, %rcx
cmpq %r14, %rcx
jg 0x21da
movabsq $0x640002000c00, %rcx   # imm = 0x640002000C00
movq %rcx, (%rax)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1e9c
movl %eax, %ecx
subl %ebx, %ecx
addl $-0x4, %ecx
rolw $0x8, %cx
movq %rsp, %rdi
movw %cx, 0x3(%rdi)
subq %rdi, %rax
movq %rax, %rsi
callq 0x1248
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq