// File: kobanium[P]Ray/src/mcts/UctRating.cpp
// Function: CalculateMoveScoreWithBTFM(game_info_t const*, int, unsigned int const*, int)
double
CalculateMoveScoreWithBTFM( const game_info_t *game, const int pos, const unsigned int *tactical_features, const int distance_index )
{
  const int moves = game->moves;
  const int pm1 = (moves > 1) ? game->record[moves - 1].pos : PASS;
  const int pm2 = (moves > 2) ? game->record[moves - 2].pos : PASS;
  const int pm3 = (moves > 3) ? game->record[moves - 3].pos : PASS;
  const int pm4 = (moves > 4) ? game->record[moves - 4].pos : PASS;
  int dis = 0;
  std::vector<fm_t*> active_features;
  pattern_hash_t hash_pat;

  if (pos == PASS) {
    if (moves > 1 && pm1 == PASS) {
      active_features.push_back(&uct_pass[UCT_PASS_AFTER_PASS]);
    } else {
      active_features.push_back(&uct_pass[UCT_PASS_AFTER_MOVE]);
    }
  } else {
    if (pm1 != PASS) {
      dis = DIS(pos, pm1);
      if (dis >= MOVE_DISTANCE_MAX - 1) {
        dis = MOVE_DISTANCE_MAX - 1;
      }
      active_features.push_back(&uct_move_distance_1[dis + distance_index]);
    }

    if (pm2 != PASS) {
      dis = DIS(pos, pm2);
      if (dis >= MOVE_DISTANCE_MAX - 1) {
        dis = MOVE_DISTANCE_MAX - 1;
      }
      active_features.push_back(&uct_move_distance_2[dis + distance_index]);
    }

    if (pm3 != PASS) {
      dis = DIS(pos, pm3);
      if (dis >= MOVE_DISTANCE_MAX - 1) {
        dis = MOVE_DISTANCE_MAX - 1;
      }
      active_features.push_back(&uct_move_distance_3[dis + distance_index]);
    }

    if (pm4 != PASS) {
      dis = DIS(pos, pm4);
      if (dis >= MOVE_DISTANCE_MAX - 1) {
        dis = MOVE_DISTANCE_MAX - 1;
      }
      active_features.push_back(&uct_move_distance_4[dis + distance_index]);
    }

    const unsigned int *features = &tactical_features[pos * UCT_INDEX_MAX];

    if (features[UCT_CAPTURE_INDEX]        > 0) active_features.push_back(&uct_capture[features[UCT_CAPTURE_INDEX]]);
    if (features[UCT_SAVE_EXTENSION_INDEX] > 0) active_features.push_back(&uct_save_extension[features[UCT_SAVE_EXTENSION_INDEX]]);
    if (features[UCT_ATARI_INDEX]          > 0) active_features.push_back(&uct_atari[features[UCT_ATARI_INDEX]]);
    if (features[UCT_EXTENSION_INDEX]      > 0) active_features.push_back(&uct_extension[features[UCT_EXTENSION_INDEX]]);
    if (features[UCT_DAME_INDEX]           > 0) active_features.push_back(&uct_dame[features[UCT_DAME_INDEX]]);
    if (features[UCT_CONNECT_INDEX]        > 0) active_features.push_back(&uct_connect[features[UCT_CONNECT_INDEX]]);
    if (features[UCT_THROW_IN_INDEX]       > 0) active_features.push_back(&uct_throw_in[features[UCT_THROW_IN_INDEX]]);

    PatternHash(&game->pat[pos], &hash_pat);
    const int pat3_idx = Pat3(game->pat, pos);
    const int md2_idx = md2_index[MD2(game->pat, pos)];
    const int md3_idx = SearchIndex(md3_index, hash_pat.list[MD_3]);
    const int md4_idx = SearchIndex(md4_index, hash_pat.list[MD_4]);
    const int md5_idx = SearchIndex(md5_index, hash_pat.list[MD_5 + MD_MAX]);

    // 盤上の位置
    active_features.push_back(&uct_pos_id[board_pos_id[pos]]);

    // パターン
    if (md5_idx != -1) {
      active_features.push_back(&uct_md5[md5_idx]);
    } else if (md4_idx != -1) {
      active_features.push_back(&uct_md4[md4_idx]);
    } else if (md3_idx != -1) {
      active_features.push_back(&uct_md3[md3_idx]);
    } else if (md2_idx != -1) {
      active_features.push_back(&uct_md2[md2_idx]);
    } else {
      active_features.push_back(&uct_pat3[pat3_idx]);
    }
  }

  if (moves > 1 && game->ko_move == game->moves - 1) {
    active_features.push_back(&uct_ko_exist);
  }

  const int feature_num = active_features.size();
  const double gamma = Gamma(active_features);
  double theta = feature_num > 1 ? 1.0 : 0.0;

  for (int i = 0; i < feature_num - 1; i++) {
    for (int j = i + 1; j < feature_num; j++) {
      theta *= Theta(active_features, i, j);
    }
  }

  return gamma + theta;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0x43b0(%rax), %eax
movl %eax, -0x20(%rbp)
cmpl $0x1, -0x20(%rbp)
jle 0x85f8b
movq -0x8(%rbp), %rax
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x164(%rbp)
jmp 0x85f95
xorl %eax, %eax
movl %eax, -0x164(%rbp)
jmp 0x85f95
movl -0x164(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x2, -0x20(%rbp)
jle 0x85fc3
movq -0x8(%rbp), %rax
movl -0x20(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x168(%rbp)
jmp 0x85fcd
xorl %eax, %eax
movl %eax, -0x168(%rbp)
jmp 0x85fcd
movl -0x168(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x3, -0x20(%rbp)
jle 0x85ffb
movq -0x8(%rbp), %rax
movl -0x20(%rbp), %ecx
subl $0x3, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x16c(%rbp)
jmp 0x86005
xorl %eax, %eax
movl %eax, -0x16c(%rbp)
jmp 0x86005
movl -0x16c(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x4, -0x20(%rbp)
jle 0x86033
movq -0x8(%rbp), %rax
movl -0x20(%rbp), %ecx
subl $0x4, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x170(%rbp)
jmp 0x8603d
xorl %eax, %eax
movl %eax, -0x170(%rbp)
jmp 0x8603d
movl -0x170(%rbp), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x87380
cmpl $0x0, -0xc(%rbp)
jne 0x860c8
cmpl $0x1, -0x20(%rbp)
jle 0x860a1
cmpl $0x0, -0x24(%rbp)
jne 0x860a1
leaq 0x80a6911(%rip), %rax   # 0x812c980
movq %rax, -0x78(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x873a0
jmp 0x86082
jmp 0x860c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x873f0
jmp 0x86959
leaq 0x80a68a8(%rip), %rax   # 0x812c950
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x873a0
jmp 0x860c1
jmp 0x860c3
jmp 0x867ca
cmpl $0x0, -0x24(%rbp)
je 0x86176
movslq -0xc(%rbp), %rcx
leaq 0x1aaf8d23(%rip), %rax  # 0x1ab7ee00
movl (%rax,%rcx,4), %eax
movslq -0x24(%rbp), %rdx
leaq 0x1aaf8d15(%rip), %rcx  # 0x1ab7ee00
subl (%rcx,%rdx,4), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movslq %eax, %rcx
leaq 0x1ab4c1c1(%rip), %rax  # 0x1abd22c0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movslq -0xc(%rbp), %rdx
leaq 0x1aaf9a1f(%rip), %rcx  # 0x1ab7fb30
movl (%rcx,%rdx,4), %ecx
movslq -0x24(%rbp), %rsi
leaq 0x1aaf9a11(%rip), %rdx  # 0x1ab7fb30
subl (%rdx,%rsi,4), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0xf, -0x34(%rbp)
jl 0x8613f
movl $0xf, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl %ecx, %eax
cltq
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a6858(%rip), %rax   # 0x812c9b0
addq %rcx, %rax
movq %rax, -0x98(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x873a0
jmp 0x86174
jmp 0x86176
cmpl $0x0, -0x28(%rbp)
je 0x86224
movslq -0xc(%rbp), %rcx
leaq 0x1aaf8c75(%rip), %rax  # 0x1ab7ee00
movl (%rax,%rcx,4), %eax
movslq -0x28(%rbp), %rdx
leaq 0x1aaf8c67(%rip), %rcx  # 0x1ab7ee00
subl (%rcx,%rdx,4), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movslq %eax, %rcx
leaq 0x1ab4c113(%rip), %rax  # 0x1abd22c0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movslq -0xc(%rbp), %rdx
leaq 0x1aaf9971(%rip), %rcx  # 0x1ab7fb30
movl (%rcx,%rdx,4), %ecx
movslq -0x28(%rbp), %rsi
leaq 0x1aaf9963(%rip), %rdx  # 0x1ab7fb30
subl (%rdx,%rsi,4), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0xf, -0x34(%rbp)
jl 0x861ed
movl $0xf, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl %ecx, %eax
cltq
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a73aa(%rip), %rax   # 0x812d5b0
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x873a0
jmp 0x86222
jmp 0x86224
cmpl $0x0, -0x2c(%rbp)
je 0x862d2
movslq -0xc(%rbp), %rcx
leaq 0x1aaf8bc7(%rip), %rax  # 0x1ab7ee00
movl (%rax,%rcx,4), %eax
movslq -0x2c(%rbp), %rdx
leaq 0x1aaf8bb9(%rip), %rcx  # 0x1ab7ee00
subl (%rcx,%rdx,4), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movslq %eax, %rcx
leaq 0x1ab4c065(%rip), %rax  # 0x1abd22c0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movslq -0xc(%rbp), %rdx
leaq 0x1aaf98c3(%rip), %rcx  # 0x1ab7fb30
movl (%rcx,%rdx,4), %ecx
movslq -0x2c(%rbp), %rsi
leaq 0x1aaf98b5(%rip), %rdx  # 0x1ab7fb30
subl (%rdx,%rsi,4), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0xf, -0x34(%rbp)
jl 0x8629b
movl $0xf, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl %ecx, %eax
cltq
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a7efc(%rip), %rax   # 0x812e1b0
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x873a0
jmp 0x862d0
jmp 0x862d2
cmpl $0x0, -0x30(%rbp)
je 0x86380
movslq -0xc(%rbp), %rcx
leaq 0x1aaf8b19(%rip), %rax  # 0x1ab7ee00
movl (%rax,%rcx,4), %eax
movslq -0x30(%rbp), %rdx
leaq 0x1aaf8b0b(%rip), %rcx  # 0x1ab7ee00
subl (%rcx,%rdx,4), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movslq %eax, %rcx
leaq 0x1ab4bfb7(%rip), %rax  # 0x1abd22c0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movslq -0xc(%rbp), %rdx
leaq 0x1aaf9815(%rip), %rcx  # 0x1ab7fb30
movl (%rcx,%rdx,4), %ecx
movslq -0x30(%rbp), %rsi
leaq 0x1aaf9807(%rip), %rdx  # 0x1ab7fb30
subl (%rdx,%rsi,4), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0xf, -0x34(%rbp)
jl 0x86349
movl $0xf, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl %ecx, %eax
cltq
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a8a4e(%rip), %rax   # 0x812edb0
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x873a0
jmp 0x8637e
jmp 0x86380
movq -0x18(%rbp), %rax
imull $0x7, -0xc(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
cmpl $0x0, (%rax)
jbe 0x863db
movq -0xb8(%rbp), %rax
movl (%rax), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a95f3(%rip), %rax   # 0x812f9b0
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x873a0
jmp 0x863d9
jmp 0x863db
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jbe 0x8641f
movq -0xb8(%rbp), %rax
movl 0x4(%rax), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a9abf(%rip), %rax   # 0x812fec0
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x873a0
jmp 0x8641d
jmp 0x8641f
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0x86463
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a9b6b(%rip), %rax   # 0x812ffb0
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x873a0
jmp 0x86461
jmp 0x86463
movq -0xb8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jbe 0x864a7
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a9e87(%rip), %rax   # 0x8130310
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x873a0
jmp 0x864a5
jmp 0x864a7
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jbe 0x864eb
movq -0xb8(%rbp), %rax
movl 0x10(%rax), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80a9f93(%rip), %rax   # 0x8130460
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x873a0
jmp 0x864e9
jmp 0x864eb
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jbe 0x8652f
movq -0xb8(%rbp), %rax
movl 0x14(%rax), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80aa03f(%rip), %rax   # 0x8130550
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x873a0
jmp 0x8652d
jmp 0x8652f
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jbe 0x86573
movq -0xb8(%rbp), %rax
movl 0x18(%rax), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x80aa05b(%rip), %rax   # 0x81305b0
addq %rcx, %rax
movq %rax, -0xf0(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x873a0
jmp 0x86571
jmp 0x86573
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq 0x4748(%rax,%rcx,8), %rdi
leaq -0x70(%rbp), %rsi
callq 0x97cc0
jmp 0x86592
movq -0x8(%rbp), %rdi
addq $0x4748, %rdi           # imm = 0x4748
movl -0xc(%rbp), %esi
callq 0x93d30
movl %eax, -0x174(%rbp)
jmp 0x865ad
movl -0x174(%rbp), %eax
movl %eax, -0xf4(%rbp)
movq -0x8(%rbp), %rdi
addq $0x4748, %rdi           # imm = 0x4748
movl -0xc(%rbp), %esi
callq 0x93d60
movl %eax, -0x178(%rbp)
jmp 0x865d4
movl -0x178(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x80aa02b(%rip), %rax   # 0x8130610
movl (%rax,%rcx,4), %eax
movl %eax, -0xf8(%rbp)
movq -0x68(%rbp), %rsi
leaq 0xc0aa017(%rip), %rdi   # 0xc130610
callq 0x98220
movl %eax, -0x17c(%rbp)
jmp 0x86606
movl -0x17c(%rbp), %eax
movl %eax, -0xfc(%rbp)
movq -0x60(%rbp), %rsi
leaq 0xd0a9ff3(%rip), %rdi   # 0xd130610
callq 0x98220
movl %eax, -0x180(%rbp)
jmp 0x8662a
movl -0x180(%rbp), %eax
movl %eax, -0x100(%rbp)
movq -0x58(%rbp), %rsi
leaq 0xe0a9fcf(%rip), %rdi   # 0xe130610
callq 0x98220
movl %eax, -0x184(%rbp)
jmp 0x8664e
movl -0x184(%rbp), %eax
movl %eax, -0x104(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x1aaf7a6b(%rip), %rax  # 0x1ab7e0d0
movslq (%rax,%rcx,4), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0xf0a9f98(%rip), %rax   # 0xf130610
addq %rcx, %rax
movq %rax, -0x110(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x873a0
jmp 0x86694
cmpl $-0x1, -0x104(%rbp)
je 0x866d4
movslq -0x104(%rbp), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0xf0aab5d(%rip), %rax   # 0xf131210
addq %rcx, %rax
movq %rax, -0x118(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x873a0
jmp 0x866cf
jmp 0x867c8
cmpl $-0x1, -0x100(%rbp)
je 0x86714
movslq -0x100(%rbp), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x11e7171d(%rip), %rax  # 0x11ef7e10
addq %rcx, %rax
movq %rax, -0x120(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x873a0
jmp 0x8670f
jmp 0x867c6
cmpl $-0x1, -0xfc(%rbp)
je 0x86751
movslq -0xfc(%rbp), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x14c382dd(%rip), %rax  # 0x14cbea10
addq %rcx, %rax
movq %rax, -0x128(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x873a0
jmp 0x8674f
jmp 0x867c4
cmpl $-0x1, -0xf8(%rbp)
je 0x8678e
movslq -0xf8(%rbp), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x179feea0(%rip), %rax  # 0x17a85610
addq %rcx, %rax
movq %rax, -0x130(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x873a0
jmp 0x8678c
jmp 0x867c2
movslq -0xf4(%rbp), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
leaq 0x1a7c5a6c(%rip), %rax  # 0x1a84c210
addq %rcx, %rax
movq %rax, -0x138(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x873a0
jmp 0x867c0
jmp 0x867c2
jmp 0x867c4
jmp 0x867c6
jmp 0x867c8
jmp 0x867ca
cmpl $0x1, -0x20(%rbp)
jle 0x8680d
movq -0x8(%rbp), %rax
movl 0x43c8(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x43b0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x8680d
leaq 0x1aac5a1e(%rip), %rax  # 0x1ab4c210
movq %rax, -0x140(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x873a0
jmp 0x8680b
jmp 0x8680d
leaq -0x50(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x873d0
movq -0x198(%rbp), %rdi
movl %eax, -0x144(%rbp)
callq 0x86970
movsd %xmm0, -0x190(%rbp)
jmp 0x86839
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x150(%rbp)
movl -0x144(%rbp), %eax
movsd 0x257b1(%rip), %xmm0    # 0xac008
xorps %xmm1, %xmm1
movsd %xmm1, -0x1a8(%rbp)
cmpl $0x1, %eax
movsd %xmm0, -0x1a0(%rbp)
jg 0x8687f
movsd -0x1a8(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0x1a0(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
movl $0x0, -0x15c(%rbp)
movl -0x15c(%rbp), %eax
movl -0x144(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x86927
movl -0x15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x160(%rbp)
movl -0x160(%rbp), %eax
cmpl -0x144(%rbp), %eax
jge 0x86911
movl -0x15c(%rbp), %esi
movl -0x160(%rbp), %edx
leaq -0x50(%rbp), %rdi
callq 0x86a00
movsd %xmm0, -0x1b0(%rbp)
jmp 0x868e8
movsd -0x1b0(%rbp), %xmm0
mulsd -0x158(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
movl -0x160(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x160(%rbp)
jmp 0x868bb
jmp 0x86913
movl -0x15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x15c(%rbp)
jmp 0x86899
movsd -0x150(%rbp), %xmm0
addsd -0x158(%rbp), %xmm0
movsd %xmm0, -0x1b8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x873f0
movsd -0x1b8(%rbp), %xmm0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x79b0
nopw %cs:(%rax,%rax)