// File: /workspace/github_c_makefile_star2_O1/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 %rbx
subq $0x400, %rsp            # imm = 0x400
leaq 0x1(%rsp), %rax
movb 0x36cb(%rip), %cl       # 0x7078
movb %cl, -0x1(%rax)
leaq 0x5(%rsp), %rdx
movw $0x0, (%rdx)
movl $0xf7030301, -0x4(%rdx) # imm = 0xF7030301
movzwl 0x36c2(%rip), %esi      # 0x708a
xorl %ecx, %ecx
xorl %r9d, %r9d
movq %rdx, %r8
testb %r9b, %r9b
je 0x3a06
movzbl %r9b, %r10d
movq %rdx, %r8
movq %r8, %r11
subq %rax, %r11
cmpq $0x3f7, %r11            # imm = 0x3F7
jg 0x3a1d
movzwl 0x2(%r8), %r11d
rolw $0x8, %r11w
movzwl %r11w, %r11d
addq %r11, %r8
addq $0x4, %r8
decw %r10w
jne 0x39dc
movq %r8, %r10
subq %rax, %r10
addq $-0x4, %r10
cmpq $0x3f7, %r10            # imm = 0x3F7
cmovgeq %rcx, %r8
jmp 0x3a20
xorl %r8d, %r8d
testq %r8, %r8
je 0x3a33
incb %r9b
movb 0x1(%r8), %r10b
orb (%r8), %r10b
jne 0x39cd
jmp 0x3a36
xorl %r8d, %r8d
movq %r8, %rcx
subq %rax, %rcx
addq $0x4, %rcx
cmpq $0x3f7, %rcx            # imm = 0x3F7
jg 0x3a7f
movl $0x2000e00, (%r8)       # imm = 0x2000E00
leaq 0x4(%r8), %r9
movl $0x8, %ecx
movl %esi, %r10d
shrl %cl, %r10d
movb %r10b, (%r9)
incq %r9
addq $-0x8, %rcx
je 0x3a59
movzwl 0x2(%r8), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movw $0x0, 0x4(%r8,%rcx)
movzwl 0x3(%rsp), %ecx
rolw $0x8, %cx
movzwl (%rdi), %esi
movzwl %cx, %ecx
xorl %r9d, %r9d
xorl %r10d, %r10d
movq %rdx, %r8
testb %r10b, %r10b
je 0x3ac7
movzbl %r10b, %r11d
movq %rdx, %r8
movq %r8, %rbx
subq %rax, %rbx
cmpq %rcx, %rbx
jg 0x3ada
movzwl 0x2(%r8), %ebx
rolw $0x8, %bx
movzwl %bx, %ebx
addq %rbx, %r8
addq $0x4, %r8
decw %r11w
jne 0x3aa3
movq %r8, %r11
subq %rax, %r11
addq $-0x4, %r11
cmpq %rcx, %r11
cmovgeq %r9, %r8
jmp 0x3add
xorl %r8d, %r8d
testq %r8, %r8
je 0x3af0
incb %r10b
movb 0x1(%r8), %r11b
orb (%r8), %r11b
jne 0x3a94
jmp 0x3af3
xorl %r8d, %r8d
movq %r8, %r9
subq %rax, %r9
addq $0x4, %r9
cmpq %rcx, %r9
jg 0x3b38
movl $0x2000f00, (%r8)       # imm = 0x2000F00
leaq 0x4(%r8), %r9
movl $0x8, %ecx
movl %esi, %r10d
shrl %cl, %r10d
movb %r10b, (%r9)
incq %r9
addq $-0x8, %rcx
je 0x3b12
movzwl 0x2(%r8), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movw $0x0, 0x4(%r8,%rcx)
cmpb $0x2, 0x3539(%rip)      # 0x7078
jb 0x3bfc
movzwl 0x3(%rsp), %ecx
rolw $0x8, %cx
movzwl 0x2(%rdi), %esi
movzwl %cx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
movq %rdx, %rdi
testb %r9b, %r9b
je 0x3b90
movzbl %r9b, %r10d
movq %rdx, %rdi
movq %rdi, %r11
subq %rax, %r11
cmpq %rcx, %r11
jg 0x3ba3
movzwl 0x2(%rdi), %r11d
rolw $0x8, %r11w
movzwl %r11w, %r11d
addq %r11, %rdi
addq $0x4, %rdi
decw %r10w
jne 0x3b6a
movq %rdi, %r10
subq %rax, %r10
addq $-0x4, %r10
cmpq %rcx, %r10
cmovgeq %r8, %rdi
jmp 0x3ba5
xorl %edi, %edi
testq %rdi, %rdi
je 0x3bb8
incb %r9b
movb 0x1(%rdi), %r10b
orb (%rdi), %r10b
jne 0x3b5b
jmp 0x3bba
xorl %edi, %edi
movq %rdi, %r8
subq %rax, %r8
addq $0x4, %r8
cmpq %rcx, %r8
jg 0x3bfc
movl $0x2001900, (%rdi)      # imm = 0x2001900
leaq 0x4(%rdi), %r8
movl $0x8, %ecx
movl %esi, %r9d
shrl %cl, %r9d
movb %r9b, (%r8)
incq %r8
addq $-0x8, %rcx
je 0x3bd8
movzwl 0x2(%rdi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movw $0x0, 0x4(%rdi,%rcx)
movzwl 0x3(%rsp), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
movq %rdx, %rsi
testb %r8b, %r8b
je 0x3c42
movzbl %r8b, %r9d
movq %rdx, %rsi
movq %rsi, %r10
subq %rax, %r10
cmpq %rcx, %r10
jg 0x3c55
movzwl 0x2(%rsi), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
addq %r10, %rsi
addq $0x4, %rsi
decw %r9w
jne 0x3c1c
movq %rsi, %r9
subq %rax, %r9
addq $-0x4, %r9
cmpq %rcx, %r9
cmovgeq %rdi, %rsi
jmp 0x3c57
xorl %esi, %esi
testq %rsi, %rsi
je 0x3c6a
incb %r8b
movb 0x1(%rsi), %r9b
orb (%rsi), %r9b
jne 0x3c0d
jmp 0x3c6c
xorl %esi, %esi
movq %rsi, %rdi
subq %rax, %rdi
addq $0x3, %rdi
cmpq %rcx, %rdi
jg 0x3c8b
movl $0x1001100, (%rsi)      # imm = 0x1001100
movw $0x1, 0x4(%rsi)
movb $0x0, 0x6(%rsi)
movzwl 0x3(%rsp), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
movq %rdx, %rsi
testb %r8b, %r8b
je 0x3cd1
movzbl %r8b, %r9d
movq %rdx, %rsi
movq %rsi, %r10
subq %rax, %r10
cmpq %rcx, %r10
jg 0x3ce4
movzwl 0x2(%rsi), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r10d
addq %r10, %rsi
addq $0x4, %rsi
decw %r9w
jne 0x3cab
movq %rsi, %r9
subq %rax, %r9
addq $-0x4, %r9
cmpq %rcx, %r9
cmovgeq %rdi, %rsi
jmp 0x3ce6
xorl %esi, %esi
testq %rsi, %rsi
je 0x3cf9
incb %r8b
movb 0x1(%rsi), %r9b
orb (%rsi), %r9b
jne 0x3c9c
jmp 0x3cfb
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 0x1c0d
addq $0x400, %rsp            # imm = 0x400
popq %rbx
retq