LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_encode_base.c
// Function: lzfse_backend_match
static int lzfse_backend_match(lzfse_encoder_state *s,
                               const lzfse_match *match) {
  // Try to push the match in state
  if (lzfse_push_match(s, match) == LZFSE_STATUS_OK)
    return LZFSE_STATUS_OK; // OK, match added to state

  // Here state tables are full, try to emit block
  if (lzfse_encode_matches(s) != LZFSE_STATUS_OK)
    return LZFSE_STATUS_DST_FULL; // DST full, match not added

  // Here block has been emitted, re-try to push the match in state
  return lzfse_push_match(s, match);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4084
testl %eax, %eax
je 0x3fc6
movq %r14, %rdi
callq 0x4147
testl %eax, %eax
je 0x3fd0
pushq $-0x2
popq %rax
jmp 0x3fc8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4084
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_encode_base.c
// Function: lzfse_backend_literals
static int lzfse_backend_literals(lzfse_encoder_state *s, lzfse_offset L) {
  // Create a fake match with M=0, D=1
  lzfse_match match;
  lzfse_offset pos = s->src_literal + L;
  match.pos = pos;
  match.ref = match.pos - 1;
  match.length = 0;
  return lzfse_backend_match(s, &match);
}

// Assembly:
subq $0x18, %rsp
movq 0x10(%rdi), %rcx
leaq (%rcx,%rsi), %rdx
movq %rsp, %rax
movq %rdx, (%rax)
addq %rsi, %rcx
decq %rcx
movq %rcx, 0x8(%rax)
andl $0x0, 0x10(%rax)
movq %rax, %rsi
callq 0x3fa2
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_encode_base.c
// Function: lzfse_encode_finish
int lzfse_encode_finish(lzfse_encoder_state *s) {
  const lzfse_match NO_MATCH = {0};

  // Emit pending match
  if (s->pending.length > 0) {
    if (lzfse_backend_match(s, &s->pending) != LZFSE_STATUS_OK)
      return LZFSE_STATUS_DST_FULL;
    s->pending = NO_MATCH;
  }

  // Emit final literals if any
  lzfse_offset L = s->src_end - s->src_literal;
  if (L > 0) {
    if (lzfse_backend_literals(s, L) != LZFSE_STATUS_OK)
      return LZFSE_STATUS_DST_FULL;
  }

  // Emit all matches, and end-of-stream block
  if (lzfse_backend_end_of_stream(s) != LZFSE_STATUS_OK)
    return LZFSE_STATUS_DST_FULL;

  return LZFSE_STATUS_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
cmpl $0x0, 0x50(%rdi)
pushq $-0x2
popq %rbx
je 0x403f
leaq 0x40(%r14), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3fa2
testl %eax, %eax
jne 0x407c
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
andq $0x0, 0x10(%r15)
movq 0x8(%r14), %rsi
subq 0x10(%r14), %rsi
jle 0x4055
movq %r14, %rdi
callq 0x3fe2
testl %eax, %eax
jne 0x407c
movq %r14, %rdi
callq 0x4147
testl %eax, %eax
jne 0x407c
movq 0x28(%r14), %rax
leaq 0x4(%rax), %rcx
cmpq 0x38(%r14), %rcx
ja 0x407c
movl $0x24787662, (%rax)     # imm = 0x24787662
addq $0x4, 0x28(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_encode_base.c
// Function: lzfse_push_match
static int lzfse_push_match(lzfse_encoder_state *s, const lzfse_match *match) {
  // Save the initial n_matches, n_literals, src_literal
  uint32_t n_matches0 = s->n_matches;
  uint32_t n_literals0 = s->n_literals;
  lzfse_offset src_literals0 = s->src_literal;

  // L,M,D
  uint32_t L = (uint32_t)(match->pos - s->src_literal); // literal count
  uint32_t M = match->length;                           // match length
  uint32_t D = (uint32_t)(match->pos - match->ref);     // match distance
  int ok = 1;

  // Split L if too large
  while (L > LZFSE_ENCODE_MAX_L_VALUE) {
    if (lzfse_push_lmd(s, LZFSE_ENCODE_MAX_L_VALUE, 0, 1) != 0) {
      ok = 0;
      goto END;
    } // take D=1 because most frequent, but not actually used
    L -= LZFSE_ENCODE_MAX_L_VALUE;
  }

  // Split if M too large
  while (M > LZFSE_ENCODE_MAX_M_VALUE) {
    if (lzfse_push_lmd(s, L, LZFSE_ENCODE_MAX_M_VALUE, D) != 0) {
      ok = 0;
      goto END;
    }
    L = 0;
    M -= LZFSE_ENCODE_MAX_M_VALUE;
  }

  // L,M in range
  if (L > 0 || M > 0) {
    if (lzfse_push_lmd(s, L, M, D) != 0) {
      ok = 0;
      goto END;
    }
    L = M = 0;
    (void)L;
    (void)M; // dead stores
  }

END:
  if (!ok) {
    // Revert state
    s->n_matches = n_matches0;
    s->n_literals = n_literals0;
    s->src_literal = src_literals0;

    return LZFSE_STATUS_DST_FULL; // state tables full
  }

  return LZFSE_STATUS_OK; // OK
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movsd 0x58(%rdi), %xmm0
movaps %xmm0, (%rsp)
movq 0x10(%rdi), %r13
movl (%rsi), %ebp
movl 0x10(%rsi), %r14d
movl %ebp, %r15d
subl %r13d, %r15d
subl 0x8(%rsi), %ebp
pushq $0x1
popq %r12
cmpl $0x13b, %r15d           # imm = 0x13B
jbe 0x40fd
movq %rbx, %rdi
movl $0x13b, %esi            # imm = 0x13B
xorl %edx, %edx
movl %r12d, %ecx
callq 0x4d71
testl %eax, %eax
jne 0x4125
addl $0xfffffec5, %r15d      # imm = 0xFFFFFEC5
jmp 0x40b5
movq %rbx, %rdi
movl %r15d, %esi
movl $0x937, %edx            # imm = 0x937
movl %ebp, %ecx
callq 0x4d71
testl %eax, %eax
jne 0x4125
addl $0xfffff6c9, %r14d      # imm = 0xFFFFF6C9
xorl %r15d, %r15d
cmpl $0x938, %r14d           # imm = 0x938
jae 0x40dd
xorl %r12d, %r12d
movl %r14d, %eax
orl %r15d, %eax
je 0x4135
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x4d71
testl %eax, %eax
je 0x4135
movaps (%rsp), %xmm0
movlps %xmm0, 0x58(%rbx)
movq %r13, 0x10(%rbx)
pushq $-0x2
popq %r12
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_encode_base.c
// Function: lzfse_push_lmd
static inline int lzfse_push_lmd(lzfse_encoder_state *s, uint32_t L,
                                 uint32_t M, uint32_t D) {
  // Check if we have enough space to push the match (we add some margin to copy
  // literals faster here, and round final count later)
  if (s->n_matches + 1 + 8 > LZFSE_MATCHES_PER_BLOCK)
    return LZFSE_STATUS_DST_FULL; // state full
  if (s->n_literals + L + 16 > LZFSE_LITERALS_PER_BLOCK)
    return LZFSE_STATUS_DST_FULL; // state full

  // Store match
  uint32_t n = s->n_matches++;
  s->l_values[n] = L;
  s->m_values[n] = M;
  s->d_values[n] = D;

  // Store literals
  uint8_t *dst = s->literals + s->n_literals;
  const uint8_t *src = s->src + s->src_literal;
  uint8_t *dst_end = dst + L;
  if (s->src_literal + L + 16 > s->src_end) {
    // Careful at the end of SRC, we can't read 16 bytes
    if (L > 0)
      memcpy(dst, src, L);
  } else {
    copy16(dst, src);
    dst += 16;
    src += 16;
    while (dst < dst_end) {
      copy16(dst, src);
      dst += 16;
      src += 16;
    }
  }
  s->n_literals += L;

  // Update state
  s->src_literal += L + M;

  return LZFSE_STATUS_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %r15d
movl 0x58(%rdi), %edx
leal -0x2708(%rdx), %esi
pushq $-0x2
popq %rax
cmpl $0xffffd8ef, %esi       # imm = 0xFFFFD8EF
jb 0x4dff
movq %rdi, %r14
movl 0x5c(%rdi), %edi
leal (%r15,%rdi), %esi
addl $0xffff63cf, %esi       # imm = 0xFFFF63CF
cmpl $0xffff63bf, %esi       # imm = 0xFFFF63BF
jb 0x4dff
leal 0x1(%rdx), %eax
movl %eax, 0x58(%r14)
movl %r15d, 0x60(%r14,%rdx,4)
movl %ebx, 0x9ca0(%r14,%rdx,4)
movl %ecx, 0x138e0(%r14,%rdx,4)
movq (%r14), %rsi
movq 0x10(%r14), %rcx
movl %r15d, %edx
leaq (%rdx,%rcx), %rax
addq $0x10, %rax
cmpq 0x8(%r14), %rax
jle 0x4e05
testl %r15d, %r15d
je 0x4df2
addq %r14, %rdi
addq $0x1d520, %rdi          # imm = 0x1D520
addq %rcx, %rsi
callq 0x30c0
addl %r15d, 0x5c(%r14)
addl %r15d, %ebx
addq %rbx, 0x10(%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq (%r14,%rdi), %rax
addq %rdx, %rax
addq $0x1d520, %rax          # imm = 0x1D520
leaq 0x10(%rsi,%rcx), %rcx
movups -0x10(%rcx), %xmm0
leaq (%r14,%rdi), %rdx
addq $0x1d530, %rdx          # imm = 0x1D530
movups %xmm0, -0x10(%rdx)
cmpq %rax, %rdx
jae 0x4df2
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
addq $0x10, %rdx
addq $0x10, %rcx
jmp 0x4e2a
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_encode_tables.h
// Function: d_base_from_value
static inline uint8_t d_base_from_value(int32_t value) {
  static const uint8_t sym[64 * 4] = {
      0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  7,  7,  8,  8,  8,  8,  9,  9,
      9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12,
      13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15,
      15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 18, 19, 20, 20, 21, 21,
      22, 22, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27,
      27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29,
      30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32,
      32, 32, 32, 33, 34, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 40,
      41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44,
      44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46,
      47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 50, 51, 52, 52,
      53, 53, 54, 54, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58,
      59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61,
      61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
      0,  0,  0,  0};
  int index = 0;
  int in_range_k;
  in_range_k = (value >= 0 && value < 60);
  index |= (((value - 0) >> 0) + 0) & -in_range_k;
  in_range_k = (value >= 60 && value < 1020);
  index |= (((value - 60) >> 4) + 64) & -in_range_k;
  in_range_k = (value >= 1020 && value < 16380);
  index |= (((value - 1020) >> 8) + 128) & -in_range_k;
  in_range_k = (value >= 16380 && value < 262140);
  index |= (((value - 16380) >> 12) + 192) & -in_range_k;
  return sym[index & 255];
}

// Assembly:
xorl %ecx, %ecx
movl %edi, %edx
subl $0x3c, %edx
movl $0x0, %esi
cmovbl %edi, %esi
movl %edx, %eax
shrl $0x4, %eax
addl $0x40, %eax
cmpl $0x3c0, %edx            # imm = 0x3C0
cmovael %ecx, %eax
orl %esi, %eax
leal -0x3fc(%rdi), %ecx
movl %ecx, %edx
shrl $0x8, %edx
xorl $0x80, %edx
movl $0x3c00, %esi           # imm = 0x3C00
cmpl %esi, %ecx
cmovael %esi, %edx
leal -0x3ffc(%rdi), %ecx
addl $0xfc004, %edi          # imm = 0xFC004
shrl $0xc, %edi
addl $0xc0, %edi
movl $0x3c000, %esi          # imm = 0x3C000
cmpl %esi, %ecx
cmovael %esi, %edi
orl %edx, %edi
orl %eax, %edi
movzbl %dil, %eax
leaq 0x3f16(%rip), %rcx      # 0x8dc0
movb (%rax,%rcx), %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzvn_encode_base.c
// Function: lzvn_find_matchN
static inline int lzvn_find_matchN(const unsigned char *src,
                                   lzvn_offset src_begin,
                                   lzvn_offset src_end, lzvn_offset l_begin,
                                   lzvn_offset m0_begin, lzvn_offset m_begin,
                                   lzvn_offset n, lzvn_match_info *match) {
  // We can skip the first comparison on 4 bytes
  if (n < 3)
    return 0; // no match

  lzvn_offset D = m_begin - m0_begin; // actual distance
  if (D <= 0 || D > LZVN_ENCODE_MAX_DISTANCE)
    return 0; // distance out of range

  // Expand forward
  lzvn_offset m_end = m_begin + n;
  while (n == 4 && m_end + 4 < src_end) {
    n = nmatch4(src, m_end, m_end - D);
    m_end += n;
  }

  // Expand backwards over literal
  while (m0_begin > src_begin && m_begin > l_begin &&
         src[m_begin - 1] == src[m0_begin - 1]) {
    m0_begin--;
    m_begin--;
  }

  // OK, we keep it, update MATCH
  lzvn_offset M = m_end - m_begin; // match length
  match->m_begin = m_begin;
  match->m_end = m_end;
  match->K = M - ((D < 0x600) ? 2 : 3);
  match->M = M;
  match->D = D;

  return 1; // OK
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movq 0x28(%rsp), %rbx
xorl %eax, %eax
cmpq $0x3, %rbx
jl 0x6722
movq %r9, %r10
subq %r8, %r10
leaq -0x10000(%r10), %r11
cmpq $-0xffff, %r11          # imm = 0xFFFF0001
jb 0x6722
movq 0x30(%rsp), %rax
leaq (%rbx,%r9), %r11
cmpq $0x4, %rbx
sete %bpl
movl $0x4, %ebx
testb $0x1, %bpl
je 0x66d8
leaq 0x4(%r11), %r14
cmpq %rdx, %r14
jge 0x66d8
movq %r11, %r14
subq %r10, %r14
movl (%rdi,%r11), %ebp
movl (%rdi,%r14), %r14d
movl %r14d, %r15d
xorl %ebp, %r15d
bsfl %r15d, %r15d
shrl $0x3, %r15d
cmpl %r14d, %ebp
sete %bpl
cmovel %ebx, %r15d
addq %r15, %r11
jmp 0x6697
decq %r8
decq %r9
cmpq %rsi, %r8
jle 0x66ee
cmpq %rcx, %r9
jle 0x66ee
movb -0x1(%rdi,%r9), %dl
cmpb -0x1(%rdi,%r8), %dl
je 0x66d2
movq %r11, %rcx
subq %r9, %rcx
movq %r9, (%rax)
movq %r11, 0x8(%rax)
xorl %edx, %edx
cmpq $0x600, %r10            # imm = 0x600
setl %dl
addq %r11, %rdx
subq %r9, %rdx
addq $-0x3, %rdx
movq %rdx, 0x20(%rax)
movq %rcx, 0x10(%rax)
movq %r10, 0x18(%rax)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzvn_encode_base.c
// Function: lzvn_emit_literal
static inline lzvn_offset lzvn_emit_literal(lzvn_encoder_state *state,
                                            lzvn_offset n) {
  size_t L = (size_t)n;
  unsigned char *dst = emit_literal(state->src + state->src_literal, state->dst,
                                    state->dst_end, L);
  // Check if DST is full
  if (dst >= state->dst_end)
    return 0; // FULL

  // Update state
  lzvn_offset dst_used = dst - state->dst;
  state->dst = dst;
  state->src_literal += n;
  return dst_used;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r13
movq %rdi, %r14
movq (%rdi), %r12
addq 0x28(%rdi), %r12
movq 0x30(%rdi), %rdi
movq 0x40(%r14), %r15
movl $0x10f, %ebx            # imm = 0x10F
movq %rsi, (%rsp)
cmpq $0x10, %r13
jb 0x69dd
cmpq %rbx, %r13
movl $0x10f, %ebp            # imm = 0x10F
cmovbq %r13, %rbp
leaq (%rdi,%rbp), %rax
addq $0xa, %rax
cmpq %r15, %rax
jae 0x6a0c
movl %ebp, %eax
shll $0x8, %eax
addl $0xfffff0e0, %eax       # imm = 0xFFFFF0E0
movw %ax, (%rdi)
addq $0x2, %rdi
subq %rbp, %r13
movq %r12, %rsi
movq %rbp, %rdx
callq 0x6b93
movq %rax, %rdi
addq %rbp, %r12
jmp 0x6997
testq %r13, %r13
je 0x6a09
leaq (%rdi,%r13), %rax
addq $0xa, %rax
cmpq %r15, %rax
jae 0x6a0c
movl %r13d, %eax
orb $-0x20, %al
movb %al, (%rdi)
incq %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x6b93
movq %rax, %r15
jmp 0x6a0c
movq %rdi, %r15
cmpq 0x40(%r14), %r15
jae 0x6a27
movq %r15, %rax
subq 0x30(%r14), %rax
movq %r15, 0x30(%r14)
movq (%rsp), %rcx
addq %rcx, 0x28(%r14)
jmp 0x6a29
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzvn_encode_base.c
// Function: lzvn_encode_buffer
size_t lzvn_encode_buffer(void *__restrict dst, size_t dst_size,
                          const void *__restrict src, size_t src_size,
                          void *__restrict work) {
  size_t src_used = 0;
  size_t dst_used =
      lzvn_encode_partial(dst, dst_size, src, src_size, &src_used, work);
  if (src_used != src_size)
    return 0;      // could not encode entire input stream = fail
  return dst_used; // return encoded size
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rcx, %rbx
cmpq $0x8, %rsi
jae 0x6a5c
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x6b61
movq %rsi, %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpq %rsi, %rbx
cmovbq %rbx, %rsi
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rsp)
movups %xmm0, 0x40(%rsp)
movups %xmm0, 0x60(%rsp)
movups %xmm0, 0x50(%rsp)
movups %xmm0, 0x20(%rsp)
andq $0x0, 0x70(%rsp)
movq %rdx, (%rsp)
andq $0x0, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movq %rdi, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
leaq (%rdi,%rax), %r15
addq %rdi, %rax
addq $-0x8, %rax
movq %rax, 0x40(%rsp)
movq %r8, 0x78(%rsp)
cmpq $0x8, %rbx
jb 0x6aee
addq $-0x8, %rsi
movq %rsi, 0x20(%rsp)
movl (%rdx), %eax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x6af2
andl $0x0, 0x80(%rsp,%rcx,4)
movl %eax, 0x90(%rsp,%rcx,4)
incq %rcx
jmp 0x6ad4
xorl %eax, %eax
jmp 0x6b30
xorl %eax, %eax
cmpq $0x80000, %rax          # imm = 0x80000
je 0x6b1d
movups 0x80(%rsp), %xmm0
movups 0x90(%rsp), %xmm1
movups %xmm1, 0x10(%r8,%rax)
movups %xmm0, (%r8,%rax)
addq $0x20, %rax
jmp 0x6af4
movq %rsp, %r14
movq %r14, %rdi
callq 0x5f0c
movq 0x10(%r14), %rsi
movq 0x28(%r14), %rax
subq %rax, %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0x696e
movq 0x30(%r14), %rax
leaq 0x8(%rax), %rcx
cmpq %rcx, %r15
jae 0x6b50
movq %rax, %rcx
jmp 0x6b57
movq $0x6, (%rax)
movq 0x28(%rsp), %rdx
subq 0x38(%rsp), %rcx
xorl %eax, %eax
cmpq %rbx, %rdx
cmoveq %rcx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_fse.c
// Function: fse_init_encoder_table
void fse_init_encoder_table(int nstates, int nsymbols,
                            const uint16_t *__restrict freq,
                            fse_encoder_entry *__restrict t) {
  int offset = 0; // current offset
  int n_clz = __builtin_clz(nstates);
  for (int i = 0; i < nsymbols; i++) {
    int f = (int)freq[i];
    if (f == 0)
      continue; // skip this symbol, no occurrences
    int k =
        __builtin_clz(f) - n_clz; // shift needed to ensure N <= (F<<K) < 2*N
    t[i].s0 = (int16_t)((f << k) - nstates);
    t[i].k = (int16_t)k;
    t[i].delta0 = (int16_t)(offset - f + (nstates >> k));
    t[i].delta1 = (int16_t)(offset - f + (nstates >> (k - 1)));
    offset += f;
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %rax
bsrl %edi, %r8d
xorl $0x1f, %r8d
xorl %r9d, %r9d
testl %esi, %esi
cmovlel %r9d, %esi
xorl %r10d, %r10d
cmpq %r9, %rsi
je 0x703d
movzwl (%rdx,%r9,2), %r11d
testl %r11d, %r11d
je 0x7038
bsrl %r11d, %ecx
xorl $0x1f, %ecx
subl %r8d, %ecx
movl %r11d, %ebx
shll %cl, %ebx
subl %edi, %ebx
movw %bx, (%rax,%r9,8)
movw %cx, 0x2(%rax,%r9,8)
movl %r10d, %ebx
movl %edi, %ebp
sarl %cl, %ebp
subl %r11d, %ebx
addl %ebx, %ebp
decl %ecx
movl %edi, %r14d
sarl %cl, %r14d
movw %bp, 0x4(%rax,%r9,8)
addl %ebx, %r14d
movw %r14w, 0x6(%rax,%r9,8)
addl %r11d, %r10d
incq %r9
jmp 0x6fe7
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_fse.c
// Function: fse_init_decoder_table
int fse_init_decoder_table(int nstates, int nsymbols,
                           const uint16_t *__restrict freq,
                           int32_t *__restrict t) {
  assert(nsymbols <= 256);
  assert(fse_check_freq(freq, nsymbols, nstates) == 0);
  int n_clz = __builtin_clz(nstates);
  int sum_of_freq = 0;
  for (int i = 0; i < nsymbols; i++) {
    int f = (int)freq[i];
    if (f == 0)
      continue; // skip this symbol, no occurrences

    sum_of_freq += f;

    if (sum_of_freq > nstates) {
      return -1;
    }

    int k =
        __builtin_clz(f) - n_clz; // shift needed to ensure N <= (F<<K) < 2*N
    int j0 = ((2 * nstates) >> k) - f;

    // Initialize all states S reached by this symbol: OFFSET <= S < OFFSET + F
    for (int j = 0; j < f; j++) {
      fse_decoder_entry e;

      e.symbol = (uint8_t)i;
      if (j < j0) {
        e.k = (int8_t)k;
        e.delta = (int16_t)(((f + j) << k) - nstates);
      } else {
        e.k = (int8_t)(k - 1);
        e.delta = (int16_t)((j - j0) << (k - 1));
      }

      memcpy(t, &e, sizeof(e));
      t++;
    }
  }

  return 0; // OK
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x101, %esi            # imm = 0x101
jge 0x7157
movq %rcx, %rax
movl %esi, %ecx
xorl %r10d, %r10d
xorl %r8d, %r8d
cmpq %r10, %rcx
je 0x7079
movzwl (%rdx,%r10,2), %r9d
addq %r9, %r8
incq %r10
jmp 0x7067
movslq %edi, %rcx
cmpq %rcx, %r8
ja 0x7170
bsrl %edi, %ecx
xorl $0x1f, %ecx
movl %ecx, 0x14(%rsp)
leal (%rdi,%rdi), %ecx
movl %ecx, 0x10(%rsp)
xorl %r11d, %r11d
testl %esi, %esi
movl $0x0, %r14d
movl %esi, 0xc(%rsp)
cmovgl %esi, %r14d
xorl %ebp, %ebp
cmpq %r14, %r11
je 0x7139
movzwl (%rdx,%r11,2), %esi
testl %esi, %esi
je 0x7131
addl %esi, %ebp
cmpl %edi, %ebp
jg 0x7139
bsrl %esi, %r8d
xorl $0x1f, %r8d
subl 0x14(%rsp), %r8d
movl 0x10(%rsp), %r15d
movl %r8d, %ecx
sarl %cl, %r15d
leal -0x1(%r8), %r9d
movl %esi, %r12d
negl %r12d
movl %esi, %r13d
subl %r15d, %r13d
subl %esi, %r15d
movl %esi, %ebx
xorl %esi, %esi
movl %r12d, %ecx
addl %esi, %ecx
je 0x7131
cmpl %r15d, %esi
jge 0x7110
leal (%rbx,%rsi), %r10d
movl %r8d, %ecx
shll %cl, %r10d
subl %edi, %r10d
movl %r8d, %ecx
jmp 0x711d
leal (%rsi,%r13), %r10d
movl %r9d, %ecx
shll %cl, %r10d
movl %r9d, %ecx
movb %cl, (%rax)
movb %r11b, 0x1(%rax)
movw %r10w, 0x2(%rax)
addq $0x4, %rax
incq %rsi
jmp 0x70f2
incq %r11
jmp 0x70ab
movslq 0xc(%rsp), %rcx
xorl %eax, %eax
cmpq %rcx, %r11
setl %al
negl %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2807(%rip), %rdi      # 0x9965
leaq 0x2810(%rip), %rsi      # 0x9975
leaq 0x2819(%rip), %rcx      # 0x9985
pushq $0x3c
jmp 0x7187
leaq 0x2860(%rip), %rdi      # 0x99d7
leaq 0x27f7(%rip), %rsi      # 0x9975
leaq 0x2800(%rip), %rcx      # 0x9985
pushq $0x3d
popq %rdx
callq 0x3070
// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_fse.c
// Function: fse_normalize_freq
void fse_normalize_freq(int nstates, int nsymbols, const uint32_t *__restrict t,
                        uint16_t *__restrict freq) {
  uint32_t s_count = 0;
  int remaining = nstates; // must be signed; this may become < 0
  int max_freq = 0;
  int max_freq_sym = 0;
  int shift = __builtin_clz(nstates) - 1;
  uint32_t highprec_step;

  // Compute the total number of symbol occurrences
  for (int i = 0; i < nsymbols; i++)
    s_count += t[i];

  if (s_count == 0)
    highprec_step = 0; // no symbols used
  else
    highprec_step = ((uint32_t)1 << 31) / s_count;

  for (int i = 0; i < nsymbols; i++) {

    // Rescale the occurrence count to get the normalized frequency.
    // Round up if the fractional part is >= 0.5; otherwise round down.
    // For efficiency, we do this calculation using integer arithmetic.
    int f = (((t[i] * highprec_step) >> shift) + 1) >> 1;

    // If a symbol was used, it must be given a nonzero normalized frequency.
    if (f == 0 && t[i] != 0)
      f = 1;

    freq[i] = f;
    remaining -= f;

    // Remember the maximum frequency and which symbol had it.
    if (f > max_freq) {
      max_freq = f;
      max_freq_sym = i;
    }
  }

  // If there remain states to be assigned, then just assign them to the most
  // frequent symbol.  Alternatively, if we assigned more states than were
  // actually available, then either remove states from the most frequent symbol
  // (for minor overruns) or use the slower adjustment algorithm (for major
  // overruns).
  if (-remaining < (max_freq >> 2)) {
    freq[max_freq_sym] += remaining;
  } else {
    fse_adjust_freqs(freq, -remaining, nsymbols);
  }
}

// Assembly:
movq %rcx, %r8
movq %rdx, %r9
bsrl %edi, %ecx
xorl $0x1f, %ecx
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %esi
xorl %r11d, %r11d
cmpq %rax, %rsi
je 0x730d
addl (%r9,%rax,4), %r11d
incq %rax
jmp 0x72ff
xorl %r10d, %r10d
movl $0x0, %eax
testl %r11d, %r11d
je 0x7324
movl $0x80000000, %eax       # imm = 0x80000000
xorl %edx, %edx
divl %r11d
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
decl %ecx
xorl %r11d, %r11d
xorl %edx, %edx
cmpq %r11, %rsi
je 0x7371
movl (%r9,%r11,4), %ebx
movl %ebx, %ebp
imull %eax, %ebp
shrl %cl, %ebp
incl %ebp
movl %ebp, %r14d
shrl %r14d
xorl %r15d, %r15d
testl %ebx, %ebx
setne %r15b
cmpl $0x2, %ebp
cmovael %r14d, %r15d
movw %r15w, (%r8,%r11,2)
subl %r15d, %edi
cmpl %r10d, %r15d
cmovgl %r15d, %r10d
cmoval %r11d, %edx
incq %r11
jmp 0x7331
movl %edi, %eax
negl %eax
shrl $0x2, %r10d
cmpl %eax, %r10d
popq %rbx
popq %r14
popq %r15
popq %rbp
jle 0x738d
movslq %edx, %rax
addw %di, (%r8,%rax,2)
retq
movl $0x3, %ecx
testl %eax, %eax
je 0x738c
xorl %edx, %edx
cmpq %rdx, %rsi
je 0x73c9
movzwl (%r8,%rdx,2), %edi
cmpl $0x2, %edi
jb 0x73c2
leal -0x1(%rdi), %r9d
shrl %cl, %r9d
cmpl %eax, %r9d
cmovgel %eax, %r9d
subl %r9d, %edi
movw %di, (%r8,%rdx,2)
subl %r9d, %eax
je 0x73c7
incq %rdx
jmp 0x7398
xorl %eax, %eax
decl %ecx
jmp 0x7392
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/./log.h
// Function: GET_MSG(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
char *GET_MSG(int level, string s)
{
    static char log_msg[1000];
    time_t t = time(0);
    struct tm *local = localtime(&t);
    char time_buf[128];
    strftime(time_buf, 64, "%Y/%m/%d %H:%M:%S", local);
    strcpy(log_msg, "[");
    strcat(log_msg, time_buf);
    strcat(log_msg, "] [");
    strcat(log_msg, LEVEL[level]);
    strcat(log_msg, "] ");
    strcat(log_msg, s.c_str());
    strcat(log_msg, "\n");
    return log_msg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorl %edi, %edi
callq 0x2230
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
callq 0x21c0
leaq 0x2a90(%rip), %rdx      # 0x5099
leaq 0x10(%rsp), %r15
pushq $0x40
popq %rsi
movq %r15, %rdi
movq %rax, %rcx
callq 0x21f0
movw $0x5b, 0x5c3b(%rip)     # 0x8260
leaq 0x5c34(%rip), %r14      # 0x8260
movq %r14, %rdi
movq %r15, %rsi
callq 0x23f0
movq %r14, %rdi
callq 0x2130
movl $0x5b205d, (%rax,%r14)  # imm = 0x5B205D
movslq %ebp, %rax
imulq $0x14, %rax, %rax
leaq 0x29fb(%rip), %rsi      # 0x5050
addq %rax, %rsi
movq %r14, %rdi
callq 0x23f0
movq %r14, %rdi
callq 0x2130
movw $0x205d, (%rax,%r14)    # imm = 0x205D
movb $0x0, 0x2(%rax,%r14)
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x23f0
movq %r14, %rdi
callq 0x2130
movw $0xa, (%rax,%r14)
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/ema_tool.cpp
// Function: StringToDatetime(char const*)
time_t StringToDatetime(const char* str)
{
	tm tm_;
	int year, month, day, hour, minute, second;
	sscanf(str, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &minute, &second);
	tm_.tm_year = year - 1900;
	tm_.tm_mon = month - 1;
	tm_.tm_mday = day;
	tm_.tm_hour = hour;
	tm_.tm_min = minute;
	tm_.tm_sec = second;
	tm_.tm_isdst = 0;

	time_t t_ = mktime(&tm_);
	return t_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x8(%rsp), %r13
leaq 0xc(%rsp), %rbp
leaq 0x29cb(%rip), %rsi      # 0x50ae
leaq 0x1c(%rsp), %rbx
leaq 0x18(%rsp), %r14
leaq 0x14(%rsp), %r15
leaq 0x10(%rsp), %r12
movq %rbx, %rdx
movq %r14, %rcx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r13
pushq %rbp
callq 0x2250
popq %rcx
popq %rdx
movl $0xfffff894, %eax       # imm = 0xFFFFF894
addl (%rbx), %eax
leaq 0x20(%rsp), %rdi
movl %eax, 0x14(%rdi)
movl (%r14), %eax
decl %eax
movl %eax, 0x10(%rdi)
movl (%r15), %eax
movl %eax, 0xc(%rdi)
movl (%r12), %eax
movl %eax, 0x8(%rdi)
movl (%rbp), %eax
movl %eax, 0x4(%rdi)
movl (%r13), %eax
movl %eax, (%rdi)
andl $0x0, 0x20(%rdi)
callq 0x21b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/cache_stat.cpp
// Function: StatCache::StatCache(long)
StatCache::StatCache(long st)
{
	total_seq = re_seq = map_size = current_hour = current_day = 0;
	start_time = st;
	for (int i = 0; i < 1024; i++)
	{
		reuse_dis_array[i] = 0l;
	}

	string output_path = "./result";
	string shell_str = "mkdir -p " + output_path;
	int ret = system(shell_str.c_str());
	assert(0 == ret);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
leaq 0x2030(%rdi), %rbx
leaq 0x2060(%rdi), %rax
movq %rax, 0x2030(%rdi)
pushq $0x1
popq %rax
movq %rax, 0x2038(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x2040(%rdi)
movl $0x3f800000, %ecx       # imm = 0x3F800000
movl %ecx, 0x2050(%rdi)
movups %xmm0, 0x2058(%rdi)
leaq 0x2068(%rdi), %r14
leaq 0x2098(%rdi), %rdx
movq %rdx, 0x2068(%rdi)
movq %rax, 0x2070(%rdi)
movups %xmm0, 0x2078(%rdi)
movl %ecx, 0x2088(%rdi)
movups %xmm0, 0x2090(%rdi)
andq $0x0, 0x20(%rdi)
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movq %rsi, 0x28(%rdi)
xorl %eax, %eax
cmpq $0x400, %rax            # imm = 0x400
je 0x374d
andq $0x0, 0x30(%rdi,%rax,8)
incq %rax
jmp 0x373a
leaq 0x1c44(%rip), %rsi      # 0x5398
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x2110
leaq 0x1c39(%rip), %rsi      # 0x53a1
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x3edd
movq (%rsp), %rdi
callq 0x2200
testl %eax, %eax
jne 0x379e
movq %rsp, %rdi
callq 0x2150
leaq 0x20(%rsp), %rdi
callq 0x2150
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1c06(%rip), %rdi      # 0x53ab
leaq 0x1c08(%rip), %rsi      # 0x53b4
leaq 0x1c10(%rip), %rcx      # 0x53c3
pushq $0x13
popq %rdx
callq 0x2190
movq %rax, %r15
movq %rsp, %rdi
callq 0x2150
jmp 0x37cb
movq %rax, %r15
leaq 0x20(%rsp), %rdi
callq 0x2150
jmp 0x37da
movq %rax, %r15
movq %r14, %rdi
callq 0x3f5e
movq %rbx, %rdi
callq 0x3ff0
movq %r15, %rdi
callq 0x23e0
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/cache_stat.cpp
// Function: StatCache::is_new_day(_IoRecord*)
bool StatCache::is_new_day(IoRecord* ir)
{
	bool result = false;
	long tmp = get_time_day(ir->alloc_time);
	if (tmp - current_day > 0)
	{
		result = true;
		current_day = tmp;
	}
	else if (tmp < current_day)
	{
		ir->alloc_time += 1;
	}
	return result;
}

// Assembly:
movq (%rsi), %rcx
leaq 0x7080(%rcx), %rax
movl $0x15180, %r8d          # imm = 0x15180
cqto
idivq %r8
movq 0x20(%rdi), %rdx
cmpq %rdx, %rax
jle 0x3cb8
movq %rax, 0x20(%rdi)
jmp 0x3cc0
jge 0x3cc0
incq %rcx
movq %rcx, (%rsi)
cmpq %rdx, %rax
setg %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/cache_stat.cpp
// Function: StatCache::plot_rar_curve(SeqNum*)
void StatCache::plot_rar_curve(struct SeqNum* sn_tmp)
{
	//y = a*log(t) + b
	//x = log(t)
	//a = (y1-y2)/(x1-x2)
	//b = (x1*y2-x2*y1)/(x1-x2)
	double x1 = log(3600);
	double x2 = log(3600 * 20);
	double x3 = log(3600 * 47);
	double y1 = sn_tmp->re_retio[0];
	double y2 = sn_tmp->re_retio[1];
	double y3 = sn_tmp->re_retio[2];
	sn_tmp->a[0] = (y1 - y2) / (x1 - x2);
	sn_tmp->a[1] = (y3 - y2) / (x3 - x2);
	sn_tmp->b[0] = (x1 * y2 - x2 * y1) / (x1 - x2);
	sn_tmp->b[1] = (x3 * y2 - x2 * y3) / (x3 - x2);

}

// Assembly:
movq (%rsi), %rax
movq 0x10(%rsi), %rcx
movsd (%rcx), %xmm0
movsd 0x8(%rcx), %xmm1
movhpd 0x10(%rcx), %xmm0       # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movapd %xmm0, %xmm2
subpd %xmm1, %xmm2
movapd 0x164d(%rip), %xmm3     # 0x5350
divpd %xmm3, %xmm2
movupd %xmm2, (%rax)
mulpd 0x164d(%rip), %xmm0     # 0x5360
mulpd 0x1655(%rip), %xmm1     # 0x5370
movq 0x8(%rsi), %rax
addpd %xmm0, %xmm1
divpd %xmm3, %xmm1
movupd %xmm1, (%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/cache_stat.cpp
// Function: StatCache::is_new_hour(_IoRecord*)
bool StatCache::is_new_hour(IoRecord* ir)
{
	bool result = false;
	long tmp = get_time_hour(ir->alloc_time);
	if (tmp - current_hour > 0)
	{
		result = true;
		current_hour = tmp;
	}
	else if (tmp < current_hour)
	{
		ir->alloc_time += 1;
	}
	return result;
}

// Assembly:
movq (%rsi), %rcx
movl $0xe10, %r8d            # imm = 0xE10
movq %rcx, %rax
cqto
idivq %r8
movq 0x18(%rdi), %rdx
cmpq %rdx, %rax
jle 0x3d4c
movq %rax, 0x18(%rdi)
jmp 0x3d54
jge 0x3d54
incq %rcx
movq %rcx, (%rsi)
cmpq %rdx, %rax
setg %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/cache_stat.cpp
// Function: StatCache::get_reuse_curve(long, long)
double StatCache::get_reuse_curve(long time_span, long timestamp)
{
	/*
	get reuse distance
	y = a*log(x) + b
	reusedistance = total_block_cnt * (1 - re_access_ratio)
	*/
	double result = 0;
	if (time_span <= 1 || (get_time_day(timestamp) - get_time_day(start_time) < 2))
	{
		result = 0;
	}
	else
	{
		SeqNum* sn_tmp = seq_map[get_time_day(timestamp) - 2];
		if (time_span <= 72000)
		{
			result = sn_tmp->a[0] * log(time_span) + sn_tmp->b[0];
		}
		else
		{
			result = sn_tmp->a[1] * log(time_span) + sn_tmp->b[1];
		}
	}

	return result < 0.99 ? result : 0.99;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
xorpd %xmm0, %xmm0
cmpq $0x2, %rsi
jl 0x3e21
movq %rsi, %rbx
movl $0x7080, %esi           # imm = 0x7080
addq %rsi, %rdx
movl $0x15180, %ecx          # imm = 0x15180
movq %rdx, %rax
cqto
idivq %rcx
movq %rax, %rcx
addq 0x28(%rdi), %rsi
movq $-0x15180, %r8          # imm = 0xFFFEAE80
movq %rsi, %rax
cqto
idivq %r8
addq %rcx, %rax
cmpq $0x2, %rax
jl 0x3e21
addq $0x2068, %rdi           # imm = 0x2068
addq $-0x2, %rcx
leaq 0x10(%rsp), %rsi
movq %rcx, (%rsi)
callq 0x43ea
movq (%rax), %r14
movq (%r14), %rax
cmpq $0x11940, %rbx          # imm = 0x11940
ja 0x3dff
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x3f53
movq 0x8(%r14), %rax
mulsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
jmp 0x3e21
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x3f53
movq 0x8(%r14), %rax
mulsd 0x8(%rsp), %xmm0
addsd 0x8(%rax), %xmm0
minsd 0x1567(%rip), %xmm0     # 0x5390
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/cache_stat.cpp
// Function: StatCache::output_reuse_distance()
void StatCache::output_reuse_distance()
{
	string filename = "./result/reuse_dis.txt";
	FILE* fp = fopen(filename.c_str(), "w");
	assert(NULL != fp);
	for (int i = 0; i < 1024; i++) {
		fprintf(fp, "%ld,", reuse_dis_array[i]);
	}
	fclose(fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x163e(%rip), %rsi      # 0x5485
leaq 0x8(%rsp), %r14
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x2110
movq (%r14), %rdi
leaq 0x15ce(%rip), %rsi      # 0x5431
callq 0x22b0
testq %rax, %rax
je 0x3eb8
movq %rax, %r14
leaq 0x164d(%rip), %r15      # 0x54c4
xorl %r12d, %r12d
cmpq $0x400, %r12            # imm = 0x400
je 0x3e9a
movq 0x30(%rbx,%r12,8), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2350
incq %r12
jmp 0x3e7a
movq %r14, %rdi
callq 0x2260
leaq 0x8(%rsp), %rdi
callq 0x2150
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x12e7(%rip), %rdi      # 0x51a6
leaq 0x14ee(%rip), %rsi      # 0x53b4
leaq 0x15cf(%rip), %rcx      # 0x549c
movl $0x97, %edx
callq 0x2190
nop
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/time_analysis_tool.cpp
// Function: TimeAnalysis::add_time(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void TimeAnalysis::add_time(string key)
{
	if (!TIME_ON)
	{
		return;
	}
	auto it = time_map.find(key);
	if (it == time_map.end())
	{
		struct time_struct* ts = (struct time_struct*)
			malloc(sizeof(struct time_struct));
		ts->cnt = 1;
		ts->latency = end_tv.tv_sec * 1000 + end_tv.tv_usec * 1.0 / 1000 -
			start_tv.tv_sec * 1000 - start_tv.tv_usec * 1.0 / 1000;
		time_map[key] = ts;

	}
	else
	{
		struct time_struct* ts = it->second;
		ts->cnt++;
		ts->latency += end_tv.tv_sec * 1000 + end_tv.tv_usec * 1.0 / 1000 -
			start_tv.tv_sec * 1000 - start_tv.tv_usec * 1.0 / 1000;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rdi), %r15
movq %r15, %rdi
callq 0x4b48
testq %rax, %rax
je 0x48a7
movq 0x28(%rax), %rax
incq (%rax)
imulq $0x3e8, 0x10(%rbx), %rcx # imm = 0x3E8
cvtsi2sd %rcx, %xmm0
cvtsi2sdq 0x18(%rbx), %xmm1
movsd 0xc5b(%rip), %xmm2      # 0x54d0
divsd %xmm2, %xmm1
addsd %xmm0, %xmm1
imulq $0x3e8, (%rbx), %rcx    # imm = 0x3E8
cvtsi2sd %rcx, %xmm0
subsd %xmm0, %xmm1
cvtsi2sdq 0x8(%rbx), %xmm0
divsd %xmm2, %xmm0
subsd %xmm0, %xmm1
addsd 0x8(%rax), %xmm1
movsd %xmm1, 0x8(%rax)
jmp 0x490f
pushq $0x10
popq %rdi
callq 0x2320
movq %rax, %r12
movq $0x1, (%rax)
imulq $0x3e8, 0x10(%rbx), %rax # imm = 0x3E8
cvtsi2sd %rax, %xmm0
cvtsi2sdq 0x18(%rbx), %xmm1
movsd 0xbfc(%rip), %xmm2      # 0x54d0
divsd %xmm2, %xmm1
addsd %xmm0, %xmm1
imulq $0x3e8, (%rbx), %rax    # imm = 0x3E8
cvtsi2sd %rax, %xmm0
cvtsi2sdq 0x8(%rbx), %xmm3
subsd %xmm0, %xmm1
divsd %xmm2, %xmm3
subsd %xmm3, %xmm1
movsd %xmm1, 0x8(%r12)
movq %r15, %rdi
movq %r14, %rsi
callq 0x4c34
movq %r12, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/time_analysis_tool.cpp
// Function: TimeAnalysis::get_latency(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
double TimeAnalysis::get_latency(string key)
{
	auto it = time_map.find(key);
	if (it == time_map.end())
	{
		return 0;
	}
	else
	{
		struct time_struct* ts = it->second;
		return ts->latency / ts->cnt;
	}
}

// Assembly:
pushq %rax
addq $0x20, %rdi
callq 0x4b48
testq %rax, %rax
je 0x4959
movq 0x28(%rax), %rax
movsd 0x8(%rax), %xmm0
movsd (%rax), %xmm1
unpcklps 0x6d1(%rip), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x6d9(%rip), %xmm1      # 0x5020
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
jmp 0x495d
xorpd %xmm0, %xmm0
popq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dudulu233[P]EMA-Tool/time_analysis_tool.cpp
// Function: TimeAnalysis::print_all_latency()
void TimeAnalysis::print_all_latency()
{
	char shell_str[256];
	strcpy(shell_str, "mkdir -p ./result");
	int ret = system(shell_str);
	assert(0 == ret);

	FILE* fp = fopen("./result/time_analysis.log", "w");
	double total_time = 0;
	for (auto it = time_map.begin();
		it != time_map.end();
		++it)
	{
		struct time_struct* ts = it->second;
		fprintf(fp, "%s : %.6f ms \t\t\t total_time : %.6f ms ( cnt : % llu )\n",
			(it->first).c_str(), ts->latency / ts->cnt,
			ts->latency, ts->cnt);
		total_time += ts->latency;
	}
	fprintf(fp, "---------------------------------------------\n");
	fprintf(fp, "total time-consuming : %.6f minutes\n", total_time / 1000 / 60);
	fclose(fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %r14
movapd 0xb67(%rip), %xmm0      # 0x54e0
leaq 0x10(%rsp), %rdi
movapd %xmm0, (%rdi)
movw $0x74, 0x10(%rdi)
callq 0x2200
testl %eax, %eax
jne 0x4a78
leaq 0xb94(%rip), %rdi       # 0x5530
leaq 0xa8e(%rip), %rsi       # 0x5431
callq 0x22b0
movq %rax, %rbx
addq $0x30, %r14
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xb8b(%rip), %r15       # 0x554b
movq (%r14), %r14
testq %r14, %r14
je 0x4a26
movq 0x8(%r14), %rdx
movq 0x28(%r14), %r12
movsd 0x8(%r12), %xmm1
movq (%r12), %rcx
movq %rcx, %xmm0
punpckldq 0x628(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x630(%rip), %xmm0      # 0x5020
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movb $0x2, %al
callq 0x2350
movsd 0x8(%rsp), %xmm0
addsd 0x8(%r12), %xmm0
movsd %xmm0, 0x8(%rsp)
jmp 0x49c0
leaq 0xb55(%rip), %rdi       # 0x5582
pushq $0x2e
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2420
movsd 0x8(%rsp), %xmm0
divsd 0xa87(%rip), %xmm0      # 0x54d0
divsd 0xa87(%rip), %xmm0      # 0x54d8
leaq 0xb59(%rip), %rsi       # 0x55b1
movq %rbx, %rdi
movb $0x1, %al
callq 0x2350
movq %rbx, %rdi
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2260
leaq 0x92c(%rip), %rdi       # 0x53ab
leaq 0xa6c(%rip), %rsi       # 0x54f2
leaq 0xa7c(%rip), %rcx       # 0x5509
pushq $0x47
popq %rdx
callq 0x2190
nop
// File: /workspace/github_cpp_makefile_star2_O2/gauravtewari[P]netlist/netlist.cpp
// Function: trim(char*)
char *trim(char *token){
		char *last;
		
		/* Remove leading spaces from token */
		while(isspace(*token)) token++;
		if(*token == 0) return token;	/* Check if its all spaces */
			
		/* Remove trailing spaces from token */
		last = token + strlen(token) - 1;				/* Got to last non null character of string */
		while(last > token && isspace(*last)) last--;		/* Check all the characters that are space by going back up */
		*(last+1) = '\0';									/* Null terminate the token */
		return token;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
decq %rbx
movb 0x1(%rbx), %bpl
incq %rbx
movsbl %bpl, %edi
callq 0x2060
testl %eax, %eax
jne 0x316c
testb %bpl, %bpl
je 0x31b2
movq %rbx, %rdi
callq 0x2100
leaq (%rbx,%rax), %rcx
decq %rcx
movq %rcx, %r14
cmpq %rbx, %rcx
jbe 0x31ad
movsbl (%r14), %edi
callq 0x2060
leaq -0x1(%r14), %rcx
testl %eax, %eax
jne 0x3194
movb $0x0, 0x1(%r14)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gauravtewari[P]netlist/netlist.cpp
// Function: circuit::add_net(net_t, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
u32 circuit::add_net(net_t type, string &tag){
	struct net temp;

	/* Check if the edge already exists */
	if(edge_map.find(tag) == edge_map.end()){
		/* Allocate a new net entry */
		struct net temp;
		edge_map[tag]=num_nets;
		temp.id = num_nets;
		temp.weight = 0;
		temp.type = type;
		temp.gates = list<u32>();
		net_list.push_back(temp);
		net_type[temp.type]++;
		num_nets++;
		return temp.id;
	}
	else
	 return edge_map[tag];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movabsq $-0x7fffffff00000001, %r15 # imm = 0x80000000FFFFFFFF
leaq 0x50(%rsp), %rbx
movq %r15, -0x10(%rbx)
movl $0x5, -0x8(%rbx)
movq %rbx, 0x8(%rbx)
movq %rbx, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0xc0(%rdi), %r13
movq %r13, %rdi
movq %rdx, %rsi
callq 0x3b6c
leaq 0xc8(%r14), %rcx
cmpq %rcx, %rax
je 0x346a
movq %r13, %rdi
movq %r12, %rsi
callq 0x398e
movl (%rax), %ebp
jmp 0x34fe
leaq 0x10(%rsp), %rax
movq %r15, -0x10(%rax)
movl $0x5, -0x8(%rax)
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
movl 0x4(%r14), %r15d
movq %r13, %rdi
movq %r12, %rsi
callq 0x398e
movl %r15d, (%rax)
movl 0x4(%r14), %eax
movq %rsp, %r12
movl %eax, (%r12)
andl $0x0, 0x4(%r12)
movl %ebp, 0x8(%r12)
leaq 0x28(%rsp), %r13
movq %r13, 0x8(%r13)
movq %r13, (%r13)
andq $0x0, 0x10(%r13)
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x3f62
movq %r13, %rdi
callq 0x2c82
leaq 0xa8(%r14), %rdi
movq %r12, %rsi
callq 0x39f4
movl 0x8(%rsp), %eax
incl 0x2c(%r14,%rax,4)
incl 0x4(%r14)
movl (%rsp), %ebp
leaq 0x10(%rsp), %rdi
callq 0x2c82
movq %rbx, %rdi
callq 0x2c82
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3528
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x2c82
jmp 0x352b
movq %rax, %r14
movq %rbx, %rdi
callq 0x2c82
movq %r14, %rdi
callq 0x22d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/gauravtewari[P]netlist/netlist.cpp
// Function: circuit::get_gate_type(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
u32 circuit::get_gate_type(string str){
	u32 size = (u32)gate_t.size();
	if(gate_t.find(str) == gate_t.end())
		gate_t[str]=size;
	return gate_t[str];
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xf0(%rdi), %r14
movq 0x118(%rdi), %r12
movq %r14, %rdi
callq 0x4502
addq $0xf8, %r15
cmpq %r15, %rax
jne 0x3612
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3a4c
movl %r12d, (%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3a4c
movl (%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/gauravtewari[P]netlist/netlist.cpp
// Function: circuit::add_outnet_to_gate(unsigned int, unsigned int)
int circuit::add_outnet_to_gate(u32 gate_id, u32 net_id){
	/* We assume that gate_id and net_id are valid and the corresponding entries exist */
	gate_list[gate_id].nets.push_back(net_id);
	
	/* We can update the fan_out of the gate here but we leave it for later */
	return 0;
}

// Assembly:
pushq %rax
leaq 0x4(%rsp), %rax
movl %edx, (%rax)
movl %esi, %ecx
movq 0x90(%rdi), %rdx
imulq $0x28, %rcx, %rcx
leaq (%rdx,%rcx), %rdi
addq $0x10, %rdi
movq %rax, %rsi
callq 0x3982
xorl %eax, %eax
popq %rcx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/gauravtewari[P]netlist/netlist.cpp
// Function: circuit::add_gate_to_net(unsigned int, unsigned int)
int circuit::add_gate_to_net(u32 net_id, u32 gate_id){
	
	/* We assume that gate_id and net_id are valid and the corresponding entries exist */
	if(!net_list[net_id].gates.empty()){
		net_type[net_list[net_id].type]--;
		net_list[net_id].type = HYPEREDGE;
		net_type[net_list[net_id].type]++;
	}
	
	net_list[net_id].gates.push_back(gate_id);
	/* We defer the fan_out updation till later */
	/* Fan in is updated here */
	gate_list[gate_id].fan_in ++;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %edx, 0x4(%rsp)
movl %esi, %ecx
movq 0xa8(%rdi), %rax
imulq $0x28, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x10, %rdi
cmpq %rdi, (%rdi)
je 0x368f
addq %rcx, %rax
movl 0x8(%rax), %ecx
decl 0x2c(%rbx,%rcx,4)
movl $0x3, 0x8(%rax)
incl 0x38(%rbx)
leaq 0x4(%rsp), %r14
movq %r14, %rsi
callq 0x3982
movl (%r14), %eax
movq 0x90(%rbx), %rcx
imulq $0x28, %rax, %rax
incl 0x8(%rcx,%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH03_StringsVectorsAndArrays/examples/square.cc
// Function: main
int main()
{
	vector<int> v{1,2,3,4,5,6,7,8,9};
	for (auto &i : v) // for each element in v (note: i is a reference)
		i *= i;           // square the element value
	for (auto i : v)      // for each element in v
		cout << i << " "; // print the element
	cout << endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movups 0xdb2(%rip), %xmm0      # 0x2014
leaq -0x70(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movups 0xd93(%rip), %xmm0      # 0x2004
movaps %xmm0, (%rsi)
movl $0x9, 0x20(%rsi)
leaq -0x40(%rbp), %rbx
pushq $0x9
popq %rdx
leaq -0x21(%rbp), %rcx
movq %rbx, %rdi
callq 0x1314
movq (%rbx), %r15
movq 0x8(%rbx), %r12
movq %r15, %rax
cmpq %r12, %rax
je 0x12aa
movl (%rax), %ecx
imull %ecx, %ecx
movl %ecx, (%rax)
addq $0x4, %rax
jmp 0x1298
movq 0x2d27(%rip), %rbx      # 0x3fd8
leaq 0xd70(%rip), %r14       # 0x2028
cmpq %r12, %r15
je 0x12d9
movl (%r15), %esi
movq %rbx, %rdi
callq 0x10f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x10a0
addq $0x4, %r15
jmp 0x12b8
movq 0x2cf8(%rip), %rdi      # 0x3fd8
callq 0x1060
leaq -0x40(%rbp), %rdi
callq 0x13a6
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12ff
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x13a6
movq %rbx, %rdi
callq 0x1100
nop
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/readStr.cc
// Function: main
int main()
{
	vector<string> vs;
	ReadLine rl(cin);    // object that read lines from cin
	string s;
	while (rl(s))        // store what rl reads into s
		vs.push_back(s);

	cout << "read : " << vs.size() << " elements" << endl;
	PrintString printer;   // uses the defaults; prints to cout
	printer(s);            // prints s followed by a space on cout

	PrintString errors(cerr, '\n');
	errors(s);             // prints s followed by a newline on cerr

	cerr << "for_each printing to cerr" << endl;
	for_each(vs.begin(), vs.end(), PrintString(cerr, '\n'));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rbx
andq $0x0, 0x10(%rbx)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movaps %xmm0, (%rbx)
movb $0x0, (%rax)
movq 0x2ce9(%rip), %r14      # 0x3fd8
leaq -0x50(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1030
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1319
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13fe
jmp 0x12f3
movq 0x2ca8(%rip), %rbx      # 0x3fc8
leaq 0xcdd(%rip), %rsi       # 0x2004
movq %rbx, %rdi
callq 0x10e0
movq -0x28(%rbp), %rsi
subq -0x30(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x10a0
leaq 0xcc2(%rip), %rsi       # 0x200c
movq %rax, %rdi
callq 0x10e0
movq %rax, %rdi
callq 0x1080
leaq -0x70(%rbp), %rdi
movq %rbx, (%rdi)
movb $0x20, 0x8(%rdi)
leaq -0x50(%rbp), %rsi
callq 0x143a
movq 0x2c7b(%rip), %rax      # 0x3ff0
leaq -0x60(%rbp), %rdi
movq %rax, (%rdi)
movb $0xa, 0x8(%rdi)
leaq -0x50(%rbp), %rsi
callq 0x143a
movq 0x2c60(%rip), %rdi      # 0x3ff0
leaq 0xc7f(%rip), %rsi       # 0x2016
callq 0x10e0
movq %rax, %rdi
callq 0x1080
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq 0x2c3d(%rip), %rdx      # 0x3ff0
pushq $0xa
popq %rcx
callq 0x145d
leaq -0x50(%rbp), %rdi
callq 0x1070
leaq -0x30(%rbp), %rdi
callq 0x14a4
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13e0
jmp 0x13e0
jmp 0x13e0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1070
leaq -0x30(%rbp), %rdi
callq 0x14a4
movq %rbx, %rdi
callq 0x1170
nop