// File: /workspace/github_c_makefile_star2_O1/videolan[P]bitstream/examples/dvb_ecmg.c
// Function: send_channel_error
static void send_channel_error(uint16_t i_wanted_channelid, uint16_t i_error)
{
    uint8_t p_tlv_h[MAX_TLV_SIZE];
    uint8_t *p_tlv = tlvh_get_tlv(p_tlv_h);
    uint8_t *p_tlv_n;

    fprintf(stderr, "sending error on channel ID=0x%hx error=0x%hx\n",
            i_wanted_channelid, i_error);

    tlvh_set_version(p_tlv_h, i_version);
    ecmg_init(p_tlv);
    tlv_set_type(p_tlv, ECMG_TYPE_CHANNEL_ERROR);
    /* 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_wanted_channelid);
    ecmg_append_errorstatus(p_tlv, i_error);

    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 %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movl %esi, %ebx
movl %edi, %ebp
leaq 0x1(%rsp), %r14
movq 0x5efb(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x41c3(%rip), %rsi      # 0x52ca
xorl %r15d, %r15d
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1070
movb 0x5f5d(%rip), %al       # 0x7078
movb %al, -0x1(%r14)
leaq 0x5(%rsp), %rax
andw $0x0, (%rax)
movl $0xf7030500, -0x4(%rax) # imm = 0xF7030500
xorl %ecx, %ecx
movq %rax, %rdx
testb %cl, %cl
je 0x1164
movzbl %cl, %esi
movq %rax, %rdx
movq %rdx, %rdi
subq %r14, %rdi
cmpq $0x3f7, %rdi            # imm = 0x3F7
jg 0x117b
movzwl 0x2(%rdx), %edi
rolw $0x8, %di
movzwl %di, %edi
addq %rdi, %rdx
addq $0x4, %rdx
decw %si
jne 0x113e
movq %rdx, %rsi
subq %r14, %rsi
addq $-0x4, %rsi
cmpq $0x3f7, %rsi            # imm = 0x3F7
cmovgeq %r15, %rdx
jmp 0x117d
xorl %edx, %edx
testq %rdx, %rdx
je 0x118f
incb %cl
movb 0x1(%rdx), %sil
orb (%rdx), %sil
jne 0x1131
jmp 0x1191
xorl %edx, %edx
movq %rdx, %rcx
subq %r14, %rcx
addq $0x4, %rcx
cmpq $0x3f7, %rcx            # imm = 0x3F7
jg 0x11d2
movl $0x2000e00, (%rdx)      # imm = 0x2000E00
leaq 0x4(%rdx), %rsi
pushq $0x8
popq %rcx
movl %ebp, %edi
shrl %cl, %edi
movb %dil, (%rsi)
incq %rsi
addq $-0x8, %rcx
je 0x11b1
movzwl 0x2(%rdx), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
andw $0x0, 0x4(%rdx,%rcx)
movzwl 0x3(%rsp), %edx
rolw $0x8, %dx
pushq $0x8
popq %rcx
movzwl %dx, %esi
xorl %edi, %edi
xorl %r8d, %r8d
movq %rax, %rdx
testb %r8b, %r8b
je 0x121b
movzbl %r8b, %r9d
movq %rax, %rdx
movq %rdx, %r10
subq %r14, %r10
cmpq %rsi, %r10
jg 0x122e
movzwl 0x2(%rdx), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
addq %r10, %rdx
addq $0x4, %rdx
decw %r9w
jne 0x11f5
movq %rdx, %r9
subq %r14, %r9
addq $-0x4, %r9
cmpq %rsi, %r9
cmovgeq %rdi, %rdx
jmp 0x1230
xorl %edx, %edx
testq %rdx, %rdx
je 0x1243
incb %r8b
movb 0x1(%rdx), %r9b
orb (%rdx), %r9b
jne 0x11e6
jmp 0x1245
xorl %edx, %edx
movq %rdx, %rdi
subq %r14, %rdi
addq $0x4, %rdi
cmpq %rsi, %rdi
jg 0x127f
movl $0x2000070, (%rdx)      # imm = 0x2000070
leaq 0x4(%rdx), %rsi
movl %ebx, %edi
shrl %cl, %edi
movb %dil, (%rsi)
incq %rsi
addq $-0x8, %rcx
je 0x125e
movzwl 0x2(%rdx), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
andw $0x0, 0x4(%rdx,%rcx)
movzwl 0x3(%rsp), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
xorl %edx, %edx
xorl %edi, %edi
movq %rax, %rsi
testb %dil, %dil
je 0x12c4
movzbl %dil, %r8d
movq %rax, %rsi
movq %rsi, %r9
subq %r14, %r9
cmpq %rcx, %r9
jg 0x12d7
movzwl 0x2(%rsi), %r9d
rolw $0x8, %r9w
movzwl %r9w, %r9d
addq %r9, %rsi
addq $0x4, %rsi
decw %r8w
jne 0x129e
movq %rsi, %r8
subq %r14, %r8
addq $-0x4, %r8
cmpq %rcx, %r8
cmovgeq %rdx, %rsi
jmp 0x12d9
xorl %esi, %esi
testq %rsi, %rsi
je 0x12ec
incb %dil
movb 0x1(%rsi), %r8b
orb (%rsi), %r8b
jne 0x128f
jmp 0x12ee
xorl %esi, %esi
movl %esi, %eax
subl %r14d, %eax
addl $-0x4, %eax
rolw $0x8, %ax
movq %rsp, %rdi
movw %ax, 0x3(%rdi)
subq %rdi, %rsi
callq 0x1c0d
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
popq %r15
popq %rbp
retq