// File: /workspace/github_c_makefile_star2_O2/akumrao[P]videoAnalyzer/encoder/set.c
// Function: x264_sps_write(bs_s*, x264_sps_t*)
void x264_sps_write(bs_t *s, x264_sps_t *sps) {LOG_CALL;
    bs_write(s, 8, sps->i_profile_idc, "i_profile_idc");
    bs_write(s, 1, sps->b_constraint_set0,"b_constraint_set0");
    bs_write(s, 1, sps->b_constraint_set1,"b_constraint_set1");
    bs_write(s, 1, sps->b_constraint_set2,"b_constraint_set2");

    bs_write(s, 5, 0,"reserved"); /* reserved */

    bs_write(s, 8, sps->i_level_idc,"i_level_idc");

    bs_write_ue(s, sps->i_id,"i_id");
    bs_write_ue(s, sps->i_log2_max_frame_num - 4,"i_log2_max_frame_num");
    bs_write_ue(s, sps->i_poc_type,"i_poc_type");
    if (sps->i_poc_type == 0)
    {
        bs_write_ue(s, sps->i_log2_max_poc_lsb - 4,"i_log2_max_poc_lsb");
    }
    else if (sps->i_poc_type == 1)
    {
        int i;

        bs_write(s, 1, sps->b_delta_pic_order_always_zero,"b_delta_pic_order_always_zero");
        bs_write_se(s, sps->i_offset_for_non_ref_pic,"i_offset_for_non_ref_pic");
        bs_write_se(s, sps->i_offset_for_top_to_bottom_field,"i_offset_for_top_to_bottom_field");
        bs_write_ue(s, sps->i_num_ref_frames_in_poc_cycle,"i_num_ref_frames_in_poc_cycle");

        for (i = 0; i < sps->i_num_ref_frames_in_poc_cycle; i++)
        {
            bs_write_se(s, sps->i_offset_for_ref_frame[i],"i_offset_for_ref_frame");
        }
    }
    bs_write_ue(s, sps->i_num_ref_frames,"i_num_ref_frames");
    bs_write(s, 1, sps->b_gaps_in_frame_num_value_allowed,"b_gaps_in_frame_num_value_allowed");
    bs_write_ue(s, sps->i_mb_width - 1,"i_mb_width");
    bs_write_ue(s, sps->i_mb_height - 1,"i_mb_height");
    bs_write(s, 1, sps->b_frame_mbs_only,"b_frame_mbs_only");
    if (!sps->b_frame_mbs_only)
    {
        bs_write(s, 1, sps->b_mb_adaptive_frame_field,"b_mb_adaptive_frame_field");
    }
    bs_write(s, 1, sps->b_direct8x8_inference,"b_direct8x8_inference");

    bs_write(s, 1, sps->b_crop, "b_crop");
    if (sps->b_crop)
    {
        bs_write_ue(s, sps->crop.i_left, "crop.i_left");
        bs_write_ue(s, sps->crop.i_right, "crop.i_right");
        bs_write_ue(s, sps->crop.i_top, "crop.i_top");
        bs_write_ue(s, sps->crop.i_bottom,"crop.i_bottom");
    }

    bs_write(s, 1, sps->b_vui,"b_vui");
    if (sps->b_vui)
    {
        int i;

        static const struct
        {
            int w, h;
            int sar;
        } sar[] ={
            { 1, 1, 1},
            { 12, 11, 2},
            { 10, 11, 3},
            { 16, 11, 4},
            { 40, 33, 5},
            { 24, 11, 6},
            { 20, 11, 7},
            { 32, 11, 8},
            { 80, 33, 9},
            { 18, 11, 10},
            { 15, 11, 11},
            { 64, 33, 12},
            { 160, 99, 13},
            { 0, 0, -1}
        };
        bs_write1(s, 1,"aspect_ratio_info_present_flag"); /* aspect_ratio_info_present_flag */
        for (i = 0; sar[i].sar != -1; i++)
        {
            if (sar[i].w == sps->vui.i_sar_width && sar[i].h == sps->vui.i_sar_height)
                break;
        }
        if (sar[i].sar != -1)
        {
            bs_write(s, 8, sar[i].sar, "sar");
        }
        else
        {
            bs_write(s, 8, 255,"aspect_ration_idc (extented)"); /* aspect_ration_idc (extented) */
            bs_write(s, 16, sps->vui.i_sar_width,"vui.i_sar_width");
            bs_write(s, 16, sps->vui.i_sar_height,"vui.i_sar_height");
        }

        bs_write1(s, 0,"overscan_info_present_flag"); /* overscan_info_present_flag */

        bs_write1(s, 0,"video_signal_type_present_flag"); /* video_signal_type_present_flag */
#if 0  
        bs_write(s, 3, 5); /* unspecified video format */
        bs_write1(s, 1); /* video full range flag */
        bs_write1(s, 0); /* colour description present flag */
#endif  
        bs_write1(s, 0,"chroma_loc_info_present_flag"); /* chroma_loc_info_present_flag */
        bs_write1(s, 0,"timing_info_present_flag"); /* timing_info_present_flag */
        bs_write1(s, 0,"nal_hrd_parameters_present_flag"); /* nal_hrd_parameters_present_flag */
        bs_write1(s, 0,"vcl_hrd_parameters_present_flag"); /* vcl_hrd_parameters_present_flag */
        bs_write1(s, 0,"pic_struct_present_flag"); /* pic_struct_present_flag */
        bs_write1(s, 0,"bitstream_restriction_flag"); /* bitstream_restriction_flag */
    }

    bs_rbsp_trailing(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x572a(%rip), %rdi      # 0x1b1b4
leaq 0xcb0f(%rip), %rsi      # 0x225a0
leaq 0xcb83(%rip), %rdx      # 0x2261b
xorl %eax, %eax
callq 0x39ba
movl 0x4(%r14), %edx
leaq 0x8af6(%rip), %rcx      # 0x1e5a0
pushq $0x8
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ea2
movl 0xc(%r14), %edx
leaq 0x8aea(%rip), %rcx      # 0x1e5ae
pushq $0x1
popq %r12
movq %rbx, %rdi
movl %r12d, %esi
callq 0x15ea2
movl 0x10(%r14), %edx
leaq 0x8ae2(%rip), %rcx      # 0x1e5c0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x15ea2
movl 0x14(%r14), %edx
leaq 0x8ade(%rip), %rcx      # 0x1e5d2
movq %rbx, %rdi
movl %r12d, %esi
callq 0x15ea2
leaq 0xcb24(%rip), %rcx      # 0x2262a
pushq $0x5
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x15ea2
movl 0x8(%r14), %edx
leaq 0x8ac6(%rip), %rcx      # 0x1e5e4
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ea2
movl (%r14), %esi
leaq 0xcb00(%rip), %rdx      # 0x22633
movq %rbx, %rdi
callq 0x15f27
movl 0x18(%r14), %esi
addl $-0x4, %esi
leaq 0x7dc7(%rip), %rdx      # 0x1d910
movq %rbx, %rdi
callq 0x15f27
movl 0x1c(%r14), %esi
leaq 0x8a94(%rip), %rdx      # 0x1e5f0
movq %rbx, %rdi
callq 0x15f27
movl 0x1c(%r14), %eax
cmpl $0x1, %eax
je 0x15d7a
testl %eax, %eax
jne 0x15b8b
movl 0x20(%r14), %esi
addl $-0x4, %esi
leaq 0x7dca(%rip), %rdx      # 0x1d94d
movq %rbx, %rdi
callq 0x15f27
movl 0x434(%r14), %esi
leaq 0x8aef(%rip), %rdx      # 0x1e688
movq %rbx, %rdi
callq 0x15f27
movl 0x438(%r14), %edx
leaq 0x8aea(%rip), %rcx      # 0x1e699
pushq $0x1
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ea2
movl 0x43c(%r14), %esi
decl %esi
leaq 0x8aed(%rip), %rdx      # 0x1e6bb
movq %rbx, %rdi
callq 0x15f27
movl 0x440(%r14), %esi
decl %esi
leaq 0x8ae0(%rip), %rdx      # 0x1e6c6
movq %rbx, %rdi
callq 0x15f27
movl 0x444(%r14), %edx
leaq 0x8ad6(%rip), %rcx      # 0x1e6d2
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ea2
cmpl $0x0, 0x444(%r14)
jne 0x15c2a
movl 0x448(%r14), %edx
leaq 0x8ac4(%rip), %rcx      # 0x1e6e3
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x15ea2
movl 0x44c(%r14), %edx
leaq 0x8ac5(%rip), %rcx      # 0x1e6fd
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ea2
movl 0x450(%r14), %edx
leaq 0x8ac2(%rip), %rcx      # 0x1e713
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ea2
cmpl $0x0, 0x450(%r14)
je 0x15cbe
movl 0x454(%r14), %esi
leaq 0x8aa6(%rip), %rdx      # 0x1e71a
movq %rbx, %rdi
callq 0x15f27
movl 0x458(%r14), %esi
leaq 0xc9ae(%rip), %rdx      # 0x22638
movq %rbx, %rdi
callq 0x15f27
movl 0x45c(%r14), %esi
leaq 0xc9a5(%rip), %rdx      # 0x22645
movq %rbx, %rdi
callq 0x15f27
movl 0x460(%r14), %esi
leaq 0x8a84(%rip), %rdx      # 0x1e73a
movq %rbx, %rdi
callq 0x15f27
movl 0x464(%r14), %edx
leaq 0x8a7c(%rip), %rcx      # 0x1e748
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x15ea2
cmpl $0x0, 0x464(%r14)
je 0x15e92
leaq 0xc964(%rip), %rdx      # 0x22650
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1601d
movl 0x468(%r14), %ecx
pushq $0x8
popq %rax
leaq 0xcac8(%rip), %rdx      # 0x227d0
cmpq $0xa4, %rax
je 0x15d2d
cmpl %ecx, -0x8(%rax,%rdx)
jne 0x15d27
movl -0x4(%rax,%rdx), %esi
cmpl 0x46c(%r14), %esi
je 0x15df5
addq $0xc, %rax
jmp 0x15d08
leaq 0xc93b(%rip), %rcx      # 0x2266f
pushq $0x8
popq %rsi
movq %rbx, %rdi
movl $0xff, %edx
callq 0x15ea2
movl 0x468(%r14), %edx
leaq 0xc93a(%rip), %rcx      # 0x2268c
pushq $0x10
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15ea2
movl 0x46c(%r14), %edx
leaq 0xc92d(%rip), %rcx      # 0x2269c
movq %rbx, %rdi
movl %r15d, %esi
jmp 0x15e05
movl 0x24(%r14), %edx
leaq 0x8876(%rip), %rcx      # 0x1e5fb
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x15ea2
movl 0x28(%r14), %esi
leaq 0x887e(%rip), %rdx      # 0x1e619
movq %rbx, %rdi
callq 0x15f99
movl 0x2c(%r14), %esi
leaq 0x8884(%rip), %rdx      # 0x1e632
movq %rbx, %rdi
callq 0x15f99
movl 0x30(%r14), %esi
leaq 0x8892(%rip), %rdx      # 0x1e653
movq %rbx, %rdi
callq 0x15f27
xorl %r12d, %r12d
leaq 0x889e(%rip), %r15      # 0x1e671
movslq 0x30(%r14), %rax
cmpq %rax, %r12
jge 0x15b8b
movl 0x34(%r14,%r12,4), %esi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x15f99
incq %r12
jmp 0x15dd3
movl (%rax,%rdx), %edx
leaq 0x129b(%rip), %rcx      # 0x1709a
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x15ea2
leaq 0xc89c(%rip), %rdx      # 0x226ad
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
leaq 0xc8a6(%rip), %rdx      # 0x226c8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
leaq 0xc8b4(%rip), %rdx      # 0x226e7
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
leaq 0xc8c0(%rip), %rdx      # 0x22704
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
leaq 0xc8c8(%rip), %rdx      # 0x2271d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
leaq 0xc8d7(%rip), %rdx      # 0x2273d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
leaq 0xc8e6(%rip), %rdx      # 0x2275d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
leaq 0xc8ed(%rip), %rdx      # 0x22775
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1601d
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x16096