// File: /workspace/github_c_makefile_star2_O1/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 %r14d, %r14d
movq 0x10(%rsp), %r12
movq (%r12), %rdi
movq 0x8(%rsp), %rbx
movslq (%rbx), %rax
incq %rax
movl %eax, (%rbx)
imulq $0x2028, %rax, %rsi     # imm = 0x2028
callq 0x37b0
movq %rax, %r13
movq %rax, (%r12)
movslq (%rbx), %rax
imulq $0x2028, %rax, %r12     # imm = 0x2028
leaq (%r12,%r13), %rbp
addq $-0x2028, %rbp          # imm = 0xDFD8
movl $0x2028, %edx           # imm = 0x2028
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3090
movq 0x8(%r15), %rax
movq %rax, 0x20(%rbp)
movq %r15, 0x8(%rbp)
movq (%r15), %rcx
movl $0x3, %esi
movl $0x1, %edx
leaq 0x5(%rsp), %rdi
callq 0x35b0
addq $0x3, 0x8(%r15)
cmpb $0x74, 0x5(%rsp)
jne 0x64cb
cmpb $0x62, 0x6(%rsp)
jne 0x64cb
cmpb $0x6b, 0x7(%rsp)
jne 0x64cb
addq %r12, %r13
leaq -0x2018(%r13), %rdi
movq (%r15), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x35b0
addq $0x4, 0x8(%r15)
leaq -0x10(%r13), %rdi
movq (%r15), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x35b0
addq $0x8, 0x8(%r15)
leaq -0x2010(%r13), %rdi
movq (%r15), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x35b0
addq $0x8, 0x8(%r15)
leaq -0x2000(%r13), %r12
movq (%r15), %rcx
movl $0x1fe9, %esi           # imm = 0x1FE9
movl $0x1, %edx
movq %r12, %rdi
callq 0x35b0
addq $0x1fe9, 0x8(%r15)      # imm = 0x1FE9
cmpq $0x0, -0x2028(%r13)
jne 0x6369
movq %r12, %rdi
callq 0x3380
cmpb $0x0, 0x2(%rax,%r12)
je 0x6369
leaq (%rax,%r12), %rdi
addq $0x2, %rdi
callq 0x35f0
movq %rax, (%rbp)
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x637b
callq 0x35f0
movq %rax, (%rbp)
cmpl $0x64, -0x2018(%r13)
jl 0x640b
movq -0x2020(%r13), %rax
movq -0x10(%r13), %rcx
movq %rcx, %rdx
movl $0xff, %r12d
andq %r12, %rdx
movl %edx, %esi
shrq $0x8, %rcx
cmpq $0x7, %rdx
movl $0x0, %ebp
cmovnel %ebp, %ecx
leaq 0x46c57(%rip), %rbx     # 0x4d010
addl (%rbx,%rsi,4), %ecx
movq (%rax), %rdi
movslq %ecx, %rsi
imulq -0x2010(%r13), %rsi
movl $0x1, %edx
callq 0x3120
movq -0x10(%r13), %rax
movq %rax, %rcx
andq %r12, %rcx
movl %ecx, %edx
shrq $0x8, %rax
cmpq $0x7, %rcx
cmovnel %ebp, %eax
addl (%rbx,%rdx,4), %eax
cltq
imulq -0x2010(%r13), %rax
movq -0x2020(%r13), %rcx
addq %rax, 0x8(%rcx)
decl %r14d
jmp 0x622a
testl %r14d, %r14d
jne 0x6417
cmpq $0x0, (%rbp)
je 0x6426
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
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 0x35f0
movq %rax, %rbx
movq %rax, %rdi
callq 0x33f0
movq %rax, %r14
movq %rax, %rdi
callq 0x3380
cmpl $0x5, %eax
jl 0x64a6
movl $0xfffffffc, %edx       # imm = 0xFFFFFFFC
leal (%rax,%rdx), %ecx
cmpb $0x2e, (%r14,%rcx)
jne 0x64a6
leal (%rdx,%rax), %esi
incl %esi
cmpb $0x74, (%r14,%rsi)
jne 0x64a6
leal (%rdx,%rax), %esi
addl $0x2, %esi
cmpb $0x62, (%r14,%rsi)
jne 0x64a6
addl %edx, %eax
addl $0x3, %eax
cmpb $0x6b, (%r14,%rax)
jne 0x64a6
movb $0x0, (%r14,%rcx)
movq %r14, %rdi
callq 0x35f0
movq %rax, -0x2028(%r15)
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3370
movq 0x10(%r15), %rsi
leaq 0x46ef3(%rip), %rdi     # 0x4d3c9
xorl %eax, %eax
callq 0x6169