// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_print_si.c
// Function: handle_bat_section
static void handle_bat_section(uint16_t i_pid, uint8_t *p_section)
{
    uint16_t i_bouquet;
    bouquet_t *p_bouquet;
    int i;

    if (i_pid != BAT_PID || !bat_validate(p_section)) {
        switch (i_print_type) {
        case PRINT_XML:
            printf("<ERROR type=\"invalid_bat_section\" pid=\"%hu\"/>\n",
                   i_pid);
            break;
        default:
            printf("invalid BAT section received on PID %hu\n", i_pid);
        }
        free(p_section);
        return;
    }

    i_bouquet = psi_get_tableidext(p_section);
    for (i = 0; i < i_nb_bouquets; i++)
        if (pp_bouquets[i]->i_bouquet && pp_bouquets[i]->i_bouquet == i_bouquet)
            break;
    if (i == i_nb_bouquets) {
        p_bouquet = malloc(sizeof(bouquet_t));
        pp_bouquets = realloc(pp_bouquets, ++i_nb_bouquets * sizeof(bouquet_t *));
        pp_bouquets[i] = p_bouquet;
        p_bouquet->i_bouquet = i_bouquet;
        psi_table_init(p_bouquet->pp_current_bat_sections);
        psi_table_init(p_bouquet->pp_next_bat_sections);
    } else
        p_bouquet = pp_bouquets[i];

    if (!psi_table_section(p_bouquet->pp_next_bat_sections, p_section))
        return;

    handle_bat(p_bouquet);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq %rsi, -0x10(%rbp)
movzwl -0x2(%rbp), %eax
cmpl $0x11, %eax
jne 0x3a89
movq -0x10(%rbp), %rdi
callq 0x1dbd0
testb $0x1, %al
jne 0x3aca
movl 0x34861(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x3aaa
jmp 0x3a96
movzwl -0x2(%rbp), %esi
leaq 0x277b1(%rip), %rdi     # 0x2b252
movb $0x0, %al
callq 0x20b0
jmp 0x3abc
movzwl -0x2(%rbp), %esi
leaq 0x277cc(%rip), %rdi     # 0x2b281
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x3bde
movq -0x10(%rbp), %rdi
callq 0x4b90
movw %ax, -0x12(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl 0x69829(%rip), %eax     # 0x6d310
jge 0x3b29
movq 0x69828(%rip), %rax     # 0x6d318
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movzwl (%rax), %eax
cmpl $0x0, %eax
je 0x3b1c
movq 0x69811(%rip), %rax     # 0x6d318
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movzwl (%rax), %eax
movzwl -0x12(%rbp), %ecx
cmpl %ecx, %eax
jne 0x3b1c
jmp 0x3b29
jmp 0x3b1e
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3ade
movl -0x24(%rbp), %eax
cmpl 0x697de(%rip), %eax     # 0x6d310
jne 0x3ba8
movl $0x1008, %edi           # imm = 0x1008
callq 0x2150
movq %rax, -0x20(%rbp)
movq 0x697cf(%rip), %rdi     # 0x6d318
movl 0x697c1(%rip), %eax     # 0x6d310
addl $0x1, %eax
movl %eax, 0x697b8(%rip)     # 0x6d310
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x2180
movq %rax, 0x697ad(%rip)     # 0x6d318
movq -0x20(%rbp), %rdx
movq 0x697a2(%rip), %rax     # 0x6d318
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movw -0x12(%rbp), %cx
movq -0x20(%rbp), %rax
movw %cx, (%rax)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x2bb0
movq -0x20(%rbp), %rdi
addq $0x808, %rdi            # imm = 0x808
callq 0x2bb0
jmp 0x3bbb
movq 0x69769(%rip), %rax     # 0x6d318
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
addq $0x808, %rdi            # imm = 0x808
movq -0x10(%rbp), %rsi
callq 0x4400
testb $0x1, %al
jne 0x3bd5
jmp 0x3bde
movq -0x20(%rbp), %rdi
callq 0x1dd90
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)