// File: /workspace/github_c_makefile_star2_O3/videolan[P]bitstream/examples/dvb_ecmg.c
// Function: send_stream_status
static void send_stream_status(stream_t *p_stream)
{
    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_STREAM_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_streamid(p_tlv, p_stream->i_streamid);
    if (i_version >= 2)
        ecmg_append_ecmid(p_tlv, p_stream->i_ecmid);
    ecmg_append_accesscritmode(p_tlv, true);

    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 %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0x1(%rsp), %rax
movb 0x2ee4(%rip), %cl       # 0x6078
movb %cl, -0x1(%rax)
leaq 0x5(%rsp), %rcx
movw $0x0, (%rcx)
movl $0xf7030301, -0x4(%rcx) # imm = 0xF7030301
movzwl 0x2edb(%rip), %edx      # 0x608a
xorl %r8d, %r8d
movq %rcx, %rsi
testb %r8b, %r8b
je 0x31eb
movzbl %r8b, %r9d
movq %rcx, %rsi
movq %rsi, %r10
subq %rax, %r10
cmpq $0x3f7, %r10            # imm = 0x3F7
jg 0x320c
movzwl 0x2(%rsi), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
addq %r10, %rsi
addq $0x4, %rsi
decw %r9w
jne 0x31c1
movq %rsi, %r9
subq %rax, %r9
addq $-0x4, %r9
cmpq $0x3f6, %r9             # imm = 0x3F6
jg 0x320c
incb %r8b
movb 0x1(%rsi), %r9b
orb (%rsi), %r9b
jne 0x31b2
jmp 0x320e
xorl %esi, %esi
movq %rsi, %r8
subq %rax, %r8
addq $0x4, %r8
cmpq $0x3f7, %r8             # imm = 0x3F7
jg 0x323e
movl $0x2000e00, (%rsi)      # imm = 0x2000E00
movb %dh, 0x4(%rsi)
movb %dl, 0x5(%rsi)
movw $0x0, 0x6(%rsi)
movb 0x3(%rsp), %sil
movb 0x4(%rsp), %dl
jmp 0x3243
movb $0x3, %sil
movb $-0x9, %dl
movzwl (%rdi), %ebx
movzbl %sil, %r9d
shll $0x8, %r9d
movzbl %dl, %r8d
orq %r9, %r8
xorl %r9d, %r9d
movq %rcx, %rbp
testb %r9b, %r9b
je 0x328d
movzbl %r9b, %r10d
movq %rcx, %rbp
movq %rbp, %r11
subq %rax, %r11
cmpq %r8, %r11
jg 0x32ab
movzwl 0x2(%rbp), %r11d
rolw $0x8, %r11w
movzwl %r11w, %r11d
addq %r11, %rbp
addq $0x4, %rbp
decw %r10w
jne 0x3267
movq %rbp, %r10
subq %rax, %r10
addq $-0x4, %r10
cmpq %r8, %r10
jge 0x32ab
incb %r9b
movb 0x1(%rbp), %r10b
orb (%rbp), %r10b
jne 0x3258
jmp 0x32ad
xorl %ebp, %ebp
movq %rbp, %r9
subq %rax, %r9
addq $0x4, %r9
cmpq %r8, %r9
jg 0x32d8
movl $0x2000f00, (%rbp)      # imm = 0x2000F00
movb %bh, 0x4(%rbp)
movb %bl, 0x5(%rbp)
movw $0x0, 0x6(%rbp)
movb 0x3(%rsp), %sil
movb 0x4(%rsp), %dl
cmpb $0x2, 0x2d99(%rip)      # 0x6078
jb 0x337a
movzwl 0x2(%rdi), %ebx
movzbl %sil, %r8d
shll $0x8, %r8d
movzbl %dl, %edi
orq %r8, %rdi
xorl %r8d, %r8d
movq %rcx, %rbp
testb %r8b, %r8b
je 0x332f
movzbl %r8b, %r9d
movq %rcx, %rbp
movq %rbp, %r10
subq %rax, %r10
cmpq %rdi, %r10
jg 0x334d
movzwl 0x2(%rbp), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
addq %r10, %rbp
addq $0x4, %rbp
decw %r9w
jne 0x3309
movq %rbp, %r9
subq %rax, %r9
addq $-0x4, %r9
cmpq %rdi, %r9
jge 0x334d
incb %r8b
movb 0x1(%rbp), %r9b
orb (%rbp), %r9b
jne 0x32fa
jmp 0x334f
xorl %ebp, %ebp
movq %rbp, %r8
subq %rax, %r8
addq $0x4, %r8
cmpq %rdi, %r8
jg 0x337a
movl $0x2001900, (%rbp)      # imm = 0x2001900
movb %bh, 0x4(%rbp)
movb %bl, 0x5(%rbp)
movw $0x0, 0x6(%rbp)
movb 0x3(%rsp), %sil
movb 0x4(%rsp), %dl
movzbl %sil, %esi
shll $0x8, %esi
movzbl %dl, %edx
orq %rsi, %rdx
xorl %edi, %edi
movq %rcx, %rsi
testb %dil, %dil
je 0x33be
movzbl %dil, %r8d
movq %rcx, %rsi
movq %rsi, %r9
subq %rax, %r9
cmpq %rdx, %r9
jg 0x33db
movzwl 0x2(%rsi), %r9d
rolw $0x8, %r9w
movzwl %r9w, %r9d
addq %r9, %rsi
addq $0x4, %rsi
decw %r8w
jne 0x3398
movq %rsi, %r8
subq %rax, %r8
addq $-0x4, %r8
cmpq %rdx, %r8
jge 0x33db
incb %dil
movb 0x1(%rsi), %r8b
orb (%rsi), %r8b
jne 0x3389
jmp 0x33dd
xorl %esi, %esi
movq %rsi, %rdi
subq %rax, %rdi
addq $0x3, %rdi
cmpq %rdx, %rdi
jg 0x3408
movl $0x1001100, (%rsi)      # imm = 0x1001100
movw $0x1, 0x4(%rsi)
movb $0x0, 0x6(%rsi)
movzwl 0x3(%rsp), %edx
rolw $0x8, %dx
movzwl %dx, %edx
xorl %edi, %edi
movq %rcx, %rsi
testb %dil, %dil
je 0x343f
movzbl %dil, %r8d
movq %rcx, %rsi
movq %rsi, %r9
subq %rax, %r9
cmpq %rdx, %r9
jg 0x345c
movzwl 0x2(%rsi), %r9d
rolw $0x8, %r9w
movzwl %r9w, %r9d
addq %r9, %rsi
addq $0x4, %rsi
decw %r8w
jne 0x3419
movq %rsi, %r8
subq %rax, %r8
addq $-0x4, %r8
cmpq %rdx, %r8
jge 0x345c
incb %dil
movb 0x1(%rsi), %r8b
orb (%rsi), %r8b
jne 0x340a
jmp 0x345e
xorl %esi, %esi
movl %esi, %ecx
subl %eax, %ecx
addl $-0x4, %ecx
rolw $0x8, %cx
movq %rsp, %rdi
movw %cx, 0x3(%rdi)
subq %rdi, %rsi
callq 0x195e
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %rbp
retq