// File: /workspace/github_c_makefile_star2_O1/videolan[P]bitstream/examples/dvb_ecmg.c
// Function: send_stream_error
static void send_stream_error(uint16_t i_wanted_streamid, 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 stream ID=0x%hx error=0x%hx\n",
            i_wanted_streamid, i_error);

    tlvh_set_version(p_tlv_h, i_version);
    ecmg_init(p_tlv);
    tlv_set_type(p_tlv, ECMG_TYPE_STREAM_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_channelid);
    ecmg_append_streamid(p_tlv, i_wanted_streamid);
    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 0x5cc4(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x4079(%rip), %rsi      # 0x53b7
xorl %r15d, %r15d
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1070
movb 0x5d26(%rip), %al       # 0x7078
movb %al, -0x1(%r14)
leaq 0x5(%rsp), %rax
andw $0x0, (%rax)
movl $0xf7030601, -0x4(%rax) # imm = 0xF7030601
movzwl 0x5d1d(%rip), %edx      # 0x708a
xorl %ecx, %ecx
movq %rax, %rsi
testb %cl, %cl
je 0x13a5
movzbl %cl, %edi
movq %rax, %rsi
movq %rsi, %r8
subq %r14, %r8
cmpq $0x3f7, %r8             # imm = 0x3F7
jg 0x13bc
movzwl 0x2(%rsi), %r8d
rolw $0x8, %r8w
movzwl %r8w, %r8d
addq %r8, %rsi
addq $0x4, %rsi
decw %di
jne 0x137c
movq %rsi, %rdi
subq %r14, %rdi
addq $-0x4, %rdi
cmpq $0x3f7, %rdi            # imm = 0x3F7
cmovgeq %r15, %rsi
jmp 0x13be
xorl %esi, %esi
testq %rsi, %rsi
je 0x13d0
incb %cl
movb 0x1(%rsi), %dil
orb (%rsi), %dil
jne 0x136f
jmp 0x13d2
xorl %esi, %esi
movq %rsi, %rcx
subq %r14, %rcx
addq $0x4, %rcx
cmpq $0x3f7, %rcx            # imm = 0x3F7
jg 0x1415
movl $0x2000e00, (%rsi)      # imm = 0x2000E00
leaq 0x4(%rsi), %rdi
pushq $0x8
popq %rcx
movl %edx, %r8d
shrl %cl, %r8d
movb %r8b, (%rdi)
incq %rdi
addq $-0x8, %rcx
je 0x13f2
movzwl 0x2(%rsi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
andw $0x0, 0x4(%rsi,%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 0x145e
movzbl %r8b, %r9d
movq %rax, %rdx
movq %rdx, %r10
subq %r14, %r10
cmpq %rsi, %r10
jg 0x1471
movzwl 0x2(%rdx), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
addq %r10, %rdx
addq $0x4, %rdx
decw %r9w
jne 0x1438
movq %rdx, %r9
subq %r14, %r9
addq $-0x4, %r9
cmpq %rsi, %r9
cmovgeq %rdi, %rdx
jmp 0x1473
xorl %edx, %edx
testq %rdx, %rdx
je 0x1486
incb %r8b
movb 0x1(%rdx), %r9b
orb (%rdx), %r9b
jne 0x1429
jmp 0x1488
xorl %edx, %edx
movq %rdx, %rdi
subq %r14, %rdi
addq $0x4, %rdi
cmpq %rsi, %rdi
jg 0x14c2
movl $0x2000f00, (%rdx)      # imm = 0x2000F00
leaq 0x4(%rdx), %rsi
movl %ebp, %edi
shrl %cl, %edi
movb %dil, (%rsi)
incq %rsi
addq $-0x8, %rcx
je 0x14a1
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 %esi, %esi
xorl %edi, %edi
movq %rax, %rdx
testb %dil, %dil
je 0x1507
movzbl %dil, %r8d
movq %rax, %rdx
movq %rdx, %r9
subq %r14, %r9
cmpq %rcx, %r9
jg 0x151a
movzwl 0x2(%rdx), %r9d
rolw $0x8, %r9w
movzwl %r9w, %r9d
addq %r9, %rdx
addq $0x4, %rdx
decw %r8w
jne 0x14e1
movq %rdx, %r8
subq %r14, %r8
addq $-0x4, %r8
cmpq %rcx, %r8
cmovgeq %rsi, %rdx
jmp 0x151c
xorl %edx, %edx
testq %rdx, %rdx
je 0x152f
incb %dil
movb 0x1(%rdx), %r8b
orb (%rdx), %r8b
jne 0x14d2
jmp 0x1531
xorl %edx, %edx
movq %rdx, %rsi
subq %r14, %rsi
addq $0x4, %rsi
cmpq %rcx, %rsi
jg 0x156e
movl $0x2000070, (%rdx)      # imm = 0x2000070
leaq 0x4(%rdx), %rsi
pushq $0x8
popq %rcx
movl %ebx, %edi
shrl %cl, %edi
movb %dil, (%rsi)
incq %rsi
addq $-0x8, %rcx
je 0x154d
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 0x15b3
movzbl %dil, %r8d
movq %rax, %rsi
movq %rsi, %r9
subq %r14, %r9
cmpq %rcx, %r9
jg 0x15c6
movzwl 0x2(%rsi), %r9d
rolw $0x8, %r9w
movzwl %r9w, %r9d
addq %r9, %rsi
addq $0x4, %rsi
decw %r8w
jne 0x158d
movq %rsi, %r8
subq %r14, %r8
addq $-0x4, %r8
cmpq %rcx, %r8
cmovgeq %rdx, %rsi
jmp 0x15c8
xorl %esi, %esi
testq %rsi, %rsi
je 0x15db
incb %dil
movb 0x1(%rsi), %r8b
orb (%rsi), %r8b
jne 0x157e
jmp 0x15dd
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