// File: /workspace/github_c_makefile_star2_O1/negge[P]xlink/src/paq.c
// Function: xlink_modeler_load_binary
void xlink_modeler_load_binary(xlink_modeler *mod, xlink_list *bytes) {
  unsigned char buf[8];
  int i, j, k;
  printf("Scanning %i bytes for counts... ", xlink_list_length(bytes));
  fflush(stdout);
  memset(buf, 0, sizeof(buf));
  for (k = 0; k < xlink_list_length(bytes); k++) {
    unsigned char byte;
    unsigned char partial;
    xlink_match key;
    byte = *xlink_list_get_byte(bytes, k);
    partial = 1;
    memcpy(key.buf, buf, sizeof(buf));
    for (i = 8; i-- > 0; ) {
      int bit;
      xlink_counts counts;
      key.partial = partial;
      bit = !!(byte & (1 << i));
      for (j = 0; j < 256; j++) {
        xlink_match *match;
        key.mask = j;
        match = xlink_set_get(&mod->matches, &key);
        if (match == NULL) {
          memset(key.counts, 0, sizeof(key.counts));
          match = xlink_set_put(&mod->matches, &key);
        }
        XLINK_ERROR(match == NULL,
         ("Null pointer for match, should point to allocated xlink_match"));
        counts[j][0] = match->counts[0];
        counts[j][1] = match->counts[1];
        match->counts[bit] = XLINK_MIN(255, match->counts[bit] + 1);
        if (match->counts[1 - bit] > 1) {
          match->counts[1 - bit] >>= 1;
        }
      }
      xlink_list_add(&mod->counts, &counts);
      partial <<= 1;
      partial |= bit;
    }
    for (i = 8; i-- > 1; ) {
      buf[i] = buf[i - 1];
    }
    buf[0] = byte;
    xlink_list_add(&mod->bytes, &byte);
  }
  printf("done\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, %r14
movq %rdi, 0x20(%rsp)
movq %rsi, %rdi
callq 0x931a
leaq 0x3378(%rip), %rdi      # 0xbf9c
xorl %r15d, %r15d
movl %eax, %esi
xorl %eax, %eax
callq 0x20c0
movq 0x7389(%rip), %rax      # 0xffc0
movq (%rax), %rdi
callq 0x2160
movq $0x0, 0x10(%rsp)
movq %r14, %rdi
callq 0x931a
testl %eax, %eax
jle 0x8db0
movq 0x20(%rsp), %rax
leaq 0x30(%rax), %r12
addq $0x18, %rax
movq %rax, 0x48(%rsp)
leaq 0x28(%rsp), %rbp
movl $0xff, %ebx
movq %r14, 0x38(%rsp)
movq %r14, %rdi
movq %r15, 0x40(%rsp)
movl %r15d, %esi
callq 0x9366
movb (%rax), %al
movb %al, 0xe(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x2e(%rsp)
movb $0x1, %al
movl $0x7, %ecx
movb %al, 0xf(%rsp)
movb %al, 0x2c(%rsp)
movzbl 0xe(%rsp), %eax
xorl %r13d, %r13d
movl %ecx, 0x1c(%rsp)
btl %ecx, %eax
setb %r13b
movq %r13, %r15
xorq $0x1, %r15
xorl %r14d, %r14d
movb %r14b, 0x2d(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x9b12
testq %rax, %rax
jne 0x8cec
movw $0x0, 0x36(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x9bbc
testq %rax, %rax
je 0x8dce
movb 0xe(%rax), %cl
movb %cl, 0x50(%rsp,%r14,2)
movb 0xf(%rax), %cl
movb %cl, 0x51(%rsp,%r14,2)
movb 0xe(%rax,%r13), %cl
leal 0x1(%rcx), %edx
cmpb $-0x2, %cl
movzbl %dl, %ecx
cmovael %ebx, %ecx
movb %cl, 0xe(%rax,%r13)
movb 0xe(%rax,%r15), %cl
cmpb $0x2, %cl
jb 0x8d2c
shrb %cl
movb %cl, 0xe(%rax,%r15)
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x8cc5
movq 0x48(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x93e4
movb 0xf(%rsp), %al
addb %al, %al
orb %al, %r13b
movl %r13d, %eax
movl 0x1c(%rsp), %ecx
subl $0x1, %ecx
jae 0x8ca0
movl 0x10(%rsp), %eax
movzwl 0x14(%rsp), %ecx
movb 0x16(%rsp), %dl
leaq 0x11(%rsp), %rsi
movb %dl, 0x6(%rsi)
movw %cx, 0x4(%rsi)
movl %eax, (%rsi)
movb 0xe(%rsp), %al
movb %al, 0x10(%rsp)
movq 0x20(%rsp), %rdi
leaq 0xe(%rsp), %rsi
callq 0x93e4
movq 0x40(%rsp), %r15
incl %r15d
movq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x931a
cmpl %eax, %r15d
jl 0x8c79
leaq 0x330f(%rip), %rdi      # 0xc0c6
callq 0x2060
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31e8(%rip), %rdi      # 0xbfbd
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0