// File: /workspace/github_cpp_makefile_star2_O1/enferex[P]fnplot/cs.cc
// Function: CS::initTrailer(unsigned char const*, unsigned long)
void CS::initTrailer(const uint8_t *data, size_t data_len)
{
    int i;
    char line[1024] = {0};
    pos_t pos = {0};

    pos.data = data;
    pos.data_len = data_len;
    pos.off = this->_hdr.trailer;

    if (!VALID(&pos))
      return;

    // Viewpaths
    getLine(&pos, line, sizeof(line));
    this->_trailer.n_viewpaths = atoi(line);
    for (i=0; i<this->_trailer.n_viewpaths; ++i) {
        getLine(&pos, line, sizeof(line));
        DBG("[%d of %d] Viewpath: %s", i+1, this->_trailer.n_viewpaths, line);
    }

    // Sources
    getLine(&pos, line, sizeof(line));
    this->_trailer.n_srcs = atoi(line);
    for (i=0; i<this->_trailer.n_srcs; ++i) {
        getLine(&pos, line, sizeof(line));
        DBG("[%d of %d] Sources: %s", i+1, this->_trailer.n_srcs, line);
    }

    // Includes
    getLine(&pos, line, sizeof(line));
    this->_trailer.n_incs = atoi(line);
    getLine(&pos, line, sizeof(line));
    for (i=0; i<this->_trailer.n_incs; ++i) {
        getLine(&pos, line, sizeof(line));
        DBG("[%d of %d] Includes: %s", i+1, this->_trailer.n_incs, line);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r13
leaq 0x10(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x2120
movq 0x10(%r13), %rsi
cmpq %rbx, %rsi
ja 0x2cb7
movq %rsi, %r12
cmpb $0xa, (%r14,%r12)
je 0x2a1a
incq %r12
cmpq %rbx, %r12
jbe 0x2a0b
movq %r12, %r15
subq %rsi, %r15
incq %r12
cmpq %rbx, %r12
setae %al
cmpq $0x401, %r15            # imm = 0x401
setae %cl
orb %al, %cl
jne 0x2a4d
addq %r14, %rsi
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
callq 0x2170
movb $0x0, 0x10(%rsp,%r15)
leaq 0x10(%rsp), %rdi
callq 0x2290
movq %r13, 0x8(%rsp)
movl %eax, 0x20(%r13)
testl %eax, %eax
jle 0x2ac7
xorl %ebp, %ebp
movq %r12, %r13
cmpq %rbx, %r12
ja 0x2a80
movq %r12, %r13
cmpb $0xa, (%r14,%r13)
je 0x2a80
incq %r13
cmpq %rbx, %r13
jbe 0x2a71
movq %r13, %r15
subq %r12, %r15
incq %r13
cmpq %rbx, %r13
setae %dl
cmpq $0x401, %r15            # imm = 0x401
setae %cl
orb %dl, %cl
jne 0x2abc
addq %r14, %r12
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movl %eax, %r12d
movq %r15, %rdx
callq 0x2170
movl %r12d, %eax
movb $0x0, 0x10(%rsp,%r15)
incl %ebp
movq %r13, %r12
cmpl %eax, %ebp
jne 0x2a69
jmp 0x2aca
movq %r12, %r13
movq %r13, %r12
cmpq %rbx, %r13
ja 0x2ae4
movq %r13, %r12
cmpb $0xa, (%r14,%r12)
je 0x2ae4
incq %r12
cmpq %rbx, %r12
jbe 0x2ad5
movq %r12, %r15
subq %r13, %r15
incq %r12
cmpq %rbx, %r12
setae %al
cmpq $0x401, %r15            # imm = 0x401
setae %cl
orb %al, %cl
jne 0x2b1a
addq %r14, %r13
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x2170
movb $0x0, 0x10(%rsp,%r15)
leaq 0x10(%rsp), %rdi
callq 0x2290
movl %eax, %edx
movq 0x8(%rsp), %rax
movl %edx, 0x30(%rax)
testl %edx, %edx
jle 0x2b95
xorl %ebp, %ebp
movq %r12, %r13
cmpq %rbx, %r12
ja 0x2b4e
movq %r12, %r13
cmpb $0xa, (%r14,%r13)
je 0x2b4e
incq %r13
cmpq %rbx, %r13
jbe 0x2b3f
movq %r13, %r15
subq %r12, %r15
incq %r13
cmpq %rbx, %r13
setae %al
cmpq $0x401, %r15            # imm = 0x401
setae %cl
orb %al, %cl
jne 0x2b8a
addq %r14, %r12
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movl %edx, %r12d
movq %r15, %rdx
callq 0x2170
movl %r12d, %edx
movb $0x0, 0x10(%rsp,%r15)
incl %ebp
movq %r13, %r12
cmpl %edx, %ebp
jne 0x2b37
jmp 0x2b98
movq %r12, %r13
movq %r13, %r15
cmpq %rbx, %r13
ja 0x2bb2
movq %r13, %r15
cmpb $0xa, (%r14,%r15)
je 0x2bb2
incq %r15
cmpq %rbx, %r15
jbe 0x2ba3
movq %r15, %r12
subq %r13, %r12
incq %r15
cmpq %rbx, %r15
setae %al
cmpq $0x401, %r12            # imm = 0x401
setae %cl
orb %al, %cl
jne 0x2be8
addq %r14, %r13
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x2170
movb $0x0, 0x10(%rsp,%r12)
leaq 0x10(%rsp), %rdi
callq 0x2290
movl %eax, %edx
movq 0x8(%rsp), %rax
movl %edx, 0x40(%rax)
movq %r15, %r12
cmpq %rbx, %r15
ja 0x2c16
movq %r15, %r12
cmpb $0xa, (%r14,%r12)
je 0x2c16
incq %r12
cmpq %rbx, %r12
jbe 0x2c07
movq %r12, %r13
subq %r15, %r13
incq %r12
cmpq %rbx, %r12
setae %al
cmpq $0x401, %r13            # imm = 0x401
setae %cl
orb %al, %cl
movl %edx, 0x8(%rsp)
jne 0x2c54
addq %r14, %r15
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2170
movl 0x8(%rsp), %edx
movb $0x0, 0x10(%rsp,%r13)
testl %edx, %edx
jle 0x2cb7
xorl %ebp, %ebp
movq %r12, %r15
cmpq %rbx, %r12
ja 0x2c74
movq %r12, %r15
cmpb $0xa, (%r14,%r15)
je 0x2c74
incq %r15
cmpq %rbx, %r15
jbe 0x2c65
movq %r15, %r13
subq %r12, %r13
incq %r15
cmpq %rbx, %r15
setae %al
cmpq $0x401, %r13            # imm = 0x401
setae %cl
orb %al, %cl
jne 0x2cae
addq %r14, %r12
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2170
movl 0x8(%rsp), %edx
movb $0x0, 0x10(%rsp,%r13)
incl %ebp
movq %r15, %r12
cmpl %edx, %ebp
jne 0x2c5d
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop