// File: /workspace/github_c_makefile_star2_O2/zhou-lab[P]tbmate/view.c
// Function: parse_tbk_from_tbf
void parse_tbk_from_tbf(tbf_t *tbf, tbk_t **tbks, int *n_tbks) {
  tbk_t *tbk;
  int n = 0;
  while (1) {
    (*tbks) = realloc((*tbks), (++(*n_tbks))*sizeof(tbk_t));
    tbk = &(*tbks)[(*n_tbks)-1];
    tbf_next(tbf, tbk);
    n++;
    if (tbf->sname_first != NULL) tbk->sname = strdup(tbf->sname_first);
    if (tbk->version < 100) break;
    tbf_skip_data(tbk);
  }

  if (n==1 && tbk->sname == NULL) {
    tbk_set_sname_by_fname(&(*tbks)[(*n_tbks)-1]);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r15
xorl %ebp, %ebp
movl %ebp, 0x4(%rsp)
movq 0x10(%rsp), %r14
movq (%r14), %rdi
movq 0x8(%rsp), %rbx
movslq (%rbx), %rax
incq %rax
movl %eax, (%rbx)
imulq $0x2028, %rax, %rsi     # imm = 0x2028
callq 0x37c0
movq %rax, %r12
movq %rax, (%r14)
movslq (%rbx), %rax
imulq $0x2028, %rax, %r14     # imm = 0x2028
leaq (%r12,%r14), %r13
addq $-0x2028, %r13          # imm = 0xDFD8
movl $0x2028, %edx           # imm = 0x2028
movq %r13, %rdi
xorl %esi, %esi
callq 0x3090
movq 0x8(%r15), %rax
movq %rax, 0x20(%r13)
movq %r15, 0x8(%r13)
movq %r15, %rdi
leaq 0x1(%rsp), %rsi
pushq $0x3
popq %rdx
pushq $0x1
popq %rcx
callq 0x41f1
cmpb $0x74, 0x1(%rsp)
jne 0x44d1
cmpb $0x62, 0x2(%rsp)
jne 0x44d1
cmpb $0x6b, 0x3(%rsp)
jne 0x44d1
addq %r14, %r12
leaq -0x2018(%r12), %r14
movq %r15, %rdi
movq %r14, %rsi
pushq $0x4
popq %rdx
pushq $0x1
popq %rbx
movq %rbx, %rcx
callq 0x41f1
leaq -0x10(%r12), %rsi
movq %r15, %rdi
pushq $0x8
popq %rbp
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x41f1
leaq -0x2010(%r12), %rsi
movq %r15, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x41f1
leaq -0x2000(%r12), %rbp
movl $0x1fe9, %edx           # imm = 0x1FE9
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rcx
callq 0x41f1
movq -0x2028(%r12), %rax
testq %rax, %rax
jne 0x4361
movq %rbp, %rdi
callq 0x3380
cmpb $0x0, 0x2(%rax,%rbp)
je 0x435f
leaq (%rax,%rbp), %rdi
addq $0x2, %rdi
callq 0x3600
movq %rax, (%r13)
jmp 0x4361
xorl %eax, %eax
movq 0x18(%r15), %rdi
testq %rdi, %rdi
movl 0x4(%rsp), %ebp
je 0x4377
callq 0x3600
movq %rax, (%r13)
cmpl $0x64, (%r14)
jl 0x440c
movq -0x2020(%r12), %rax
movq -0x10(%r12), %rcx
movq %rcx, %rdx
movl $0xff, %ebx
andq %rbx, %rdx
movl %edx, %esi
shrq $0x8, %rcx
cmpq $0x7, %rdx
movl $0x0, %r14d
cmovnel %r14d, %ecx
leaq 0x3ac5c(%rip), %r13     # 0x3f010
addl (%r13,%rsi,4), %ecx
movq (%rax), %rdi
movslq %ecx, %rsi
imulq -0x2010(%r12), %rsi
pushq $0x1
popq %rdx
callq 0x3120
movq -0x10(%r12), %rax
movq %rax, %rcx
andq %rbx, %rcx
movl %ecx, %edx
shrq $0x8, %rax
cmpq $0x7, %rcx
cmovnel %r14d, %eax
addl (%r13,%rdx,4), %eax
cltq
imulq -0x2010(%r12), %rax
movq -0x2020(%r12), %rcx
addq %rax, 0x8(%rcx)
decl %ebp
jmp 0x423b
testl %ebp, %ebp
jne 0x44c2
testq %rax, %rax
jne 0x44c2
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movslq (%rcx), %rcx
imulq $0x2028, %rcx, %rcx     # imm = 0x2028
leaq (%rax,%rcx), %r15
movq -0x2020(%rax,%rcx), %rax
movq 0x10(%rax), %rdi
callq 0x3600
movq %rax, %rbx
movq %rax, %rdi
callq 0x33f0
movq %rax, %r14
movq %rax, %rdi
callq 0x3380
cmpl $0x5, %eax
jl 0x449d
movl $0xfffffffc, %edx       # imm = 0xFFFFFFFC
leal (%rax,%rdx), %ecx
cmpb $0x2e, (%r14,%rcx)
jne 0x449d
leal (%rdx,%rax), %esi
incl %esi
cmpb $0x74, (%r14,%rsi)
jne 0x449d
leal (%rdx,%rax), %esi
addl $0x2, %esi
cmpb $0x62, (%r14,%rsi)
jne 0x449d
addl %edx, %eax
addl $0x3, %eax
cmpb $0x6b, (%r14,%rax)
jne 0x449d
movb $0x0, (%r14,%rcx)
movq %r14, %rdi
callq 0x3600
movq %rax, -0x2028(%r15)
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3370
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r15), %rsi
leaq 0x3aef1(%rip), %rdi     # 0x3f3cd
xorl %eax, %eax
callq 0x40db