// File: kobanium[P]Ray/src/learn/FactorizationMachines.cpp
// Function: LearningSecondOrderBradleyTerryModel()
static void
LearningSecondOrderBradleyTerryModel( void  )
{
  train_thread_arg_t targ[TRAIN_THREAD_NUM];
  std::thread *handle[TRAIN_THREAD_NUM];

  for (int i = 0; i < thread_num; i++) {
    targ[i].id = i;
  }
  
  for (int step = 0; step <= BTFM_UPDATE_STEPS; step++){
    for (int i = 0; i < thread_num; i++) {
      targ[i].step = step;
    }
    
    const std::chrono::system_clock::time_point train_start = std::chrono::system_clock::now();

    if (lr_schedule.count(step) != 0 &&
        lr_schedule[step] != learning_rate) {
      if (lr_schedule[step] < 0) {
        break;
      }
      learning_rate = lr_schedule[step];
    }

    for (int i = 0; i < thread_num; i++) {
      handle[i] = new std::thread(LearningLoop, &targ[i]);
    }

    for (int i = 0; i < thread_num; i++) {
      handle[i]->join();
      delete handle[i];
    }

    const std::chrono::system_clock::time_point train_end = std::chrono::system_clock::now();
    const double train_elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(train_end - train_start).count() * 0.001;
    const double train_accuracy = static_cast<double>(prediction[0].load()) / counter.load();

    // 学習のログファイル出力
    OutputLearningLogFile(step, all_moves.load(), train_elapsed_time, train_accuracy, true);

    std::cerr << "Train data accuracy : " << train_accuracy << std::endl;

    // 算出結果を消去
    for (int i = 0; i < PURE_BOARD_MAX + 1; i++) {
      prediction[i].store(0);
    }
    likelihood = 0.0;
    counter.store(0);

    // Output parameter files.
    Output();

    // Validation phase.
    const std::chrono::system_clock::time_point test_start = std::chrono::system_clock::now();
    for (int i = 0; i < thread_num; i++) {
      handle[i] = new std::thread(TestingLoop, &targ[i]);
    }

    for (int i = 0; i < thread_num; i++) {
      handle[i]->join();
      delete handle[i];
    }

    const std::chrono::system_clock::time_point test_end = std::chrono::system_clock::now();
    const double test_elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(test_end - test_start).count() * 0.001;
    const double test_accuracy = static_cast<double>(prediction[0].load()) / counter.load();
    OutputLearningLogFile(step, counter.load(), test_elapsed_time, test_accuracy, false);

    std::cerr << "Test data accuracy : " << test_accuracy << std::endl;

    for (int i = 0; i < PURE_BOARD_MAX + 1; i++) {
      prediction[i].store(0);
    }
    counter.store(0);

    Backup(step);

    all_moves.store(0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x340, %rsp            # imm = 0x340
movl $0x0, -0x194(%rbp)
movl -0x194(%rbp), %eax
cmpl 0x8d6cf(%rip), %eax     # 0xe79a0
jge 0x5a2f8
movl -0x194(%rbp), %ecx
movslq -0x194(%rbp), %rax
movl %ecx, -0x150(%rbp,%rax,8)
movl -0x194(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x194(%rbp)
jmp 0x5a2c5
movl $0x0, -0x198(%rbp)
cmpl $0x64, -0x198(%rbp)
jg 0x5af11
movl $0x0, -0x19c(%rbp)
movl -0x19c(%rbp), %eax
cmpl 0x8d67b(%rip), %eax     # 0xe79a0
jge 0x5a34c
movl -0x198(%rbp), %ecx
movslq -0x19c(%rbp), %rax
movl %ecx, -0x14c(%rbp,%rax,8)
movl -0x19c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x19c(%rbp)
jmp 0x5a319
callq 0x7090
movq %rax, -0x1a8(%rbp)
leaq 0x8f1c9(%rip), %rdi     # 0xe9528
leaq -0x198(%rbp), %rsi
callq 0x65e80
cmpq $0x0, %rax
je 0x5a3d6
leaq 0x8f1b0(%rip), %rdi     # 0xe9528
leaq -0x198(%rbp), %rsi
callq 0x65ee0
movsd (%rax), %xmm0
ucomisd 0x8d618(%rip), %xmm0    # 0xe79a8
jne 0x5a396
jp 0x5a396
jmp 0x5a3d6
leaq 0x8f18b(%rip), %rdi     # 0xe9528
leaq -0x198(%rbp), %rsi
callq 0x65ee0
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x5a3b7
jmp 0x5af11
leaq 0x8f16a(%rip), %rdi     # 0xe9528
leaq -0x198(%rbp), %rsi
callq 0x65ee0
movsd (%rax), %xmm0
movsd %xmm0, 0x8d5d2(%rip)    # 0xe79a8
movl $0x0, -0x1ac(%rbp)
movl -0x1ac(%rbp), %eax
cmpl 0x8d5b4(%rip), %eax     # 0xe79a0
jge 0x5a483
movl $0x8, %edi
callq 0x7550
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x250(%rbp)
movslq -0x1ac(%rbp), %rax
leaq -0x150(%rbp,%rax,8), %rax
movq %rax, -0x1b8(%rbp)
leaq 0xbea(%rip), %rsi       # 0x5b010
leaq -0x1b8(%rbp), %rdx
callq 0x65fc0
jmp 0x5a434
movq -0x250(%rbp), %rcx
movslq -0x1ac(%rbp), %rax
movq %rcx, -0x190(%rbp,%rax,8)
movl -0x1ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1ac(%rbp)
jmp 0x5a3e0
movq -0x250(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
movl $0x8, %esi
callq 0x7560
jmp 0x5af1a
movl $0x0, -0x1c8(%rbp)
movl -0x1c8(%rbp), %eax
cmpl 0x8d507(%rip), %eax     # 0xe79a0
jge 0x5a4fb
movslq -0x1c8(%rbp), %rax
movq -0x190(%rbp,%rax,8), %rdi
callq 0x7940
movslq -0x1c8(%rbp), %rax
movq -0x190(%rbp,%rax,8), %rax
movq %rax, -0x258(%rbp)
cmpq $0x0, %rax
je 0x5a4e8
movq -0x258(%rbp), %rdi
callq 0x66080
movq -0x258(%rbp), %rdi
movl $0x8, %esi
callq 0x7560
jmp 0x5a4ea
movl -0x1c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c8(%rbp)
jmp 0x5a48d
callq 0x7090
movq %rax, -0x1d0(%rbp)
leaq -0x1d0(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x660e0
movq %rax, -0x1e8(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x660b0
movq %rax, -0x1e0(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x66130
cvtsi2sd %rax, %xmm0
movsd 0x539bb(%rip), %xmm1    # 0xadf08
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1d8(%rbp)
leaq 0x8f160(%rip), %rax     # 0xe96c0
movq %rax, -0x8(%rbp)
movl $0x5, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x268(%rbp)
movl -0xc(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x25c(%rbp)
decl %eax
subl $0x2, %eax
jb 0x5a5b3
jmp 0x5a598
movl -0x25c(%rbp), %eax
subl $0x5, %eax
je 0x5a5c1
jmp 0x5a5a5
movq -0x268(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
jmp 0x5a5cd
movq -0x268(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
jmp 0x5a5cd
movq -0x268(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd %xmm0, -0x280(%rbp)
leaq 0x8f0cb(%rip), %rax     # 0xe96ac
movq %rax, -0x20(%rbp)
movl $0x5, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x278(%rbp)
movl -0x24(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x26c(%rbp)
decl %eax
subl $0x2, %eax
jb 0x5a634
jmp 0x5a619
movl -0x26c(%rbp), %eax
subl $0x5, %eax
je 0x5a642
jmp 0x5a626
movq -0x278(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
jmp 0x5a64e
movq -0x278(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
jmp 0x5a64e
movq -0x278(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movsd -0x280(%rbp), %xmm0
cvtsi2sdl -0x2c(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x1f0(%rbp)
movl -0x198(%rbp), %eax
movl %eax, -0x294(%rbp)
leaq 0x8f02e(%rip), %rax     # 0xe96a8
movq %rax, -0x38(%rbp)
movl $0x5, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x290(%rbp)
movl -0x3c(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x284(%rbp)
decl %eax
subl $0x2, %eax
jb 0x5a6cd
jmp 0x5a6b2
movl -0x284(%rbp), %eax
subl $0x5, %eax
je 0x5a6db
jmp 0x5a6bf
movq -0x290(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
jmp 0x5a6e7
movq -0x290(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
jmp 0x5a6e7
movq -0x290(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x294(%rbp), %edi
movl -0x44(%rbp), %esi
movsd -0x1d8(%rbp), %xmm0
movsd -0x1f0(%rbp), %xmm1
movl $0x1, %edx
callq 0x81450
movq 0x8c8df(%rip), %rdi     # 0xe6ff0
leaq 0x5397e(%rip), %rsi     # 0xae096
callq 0x7530
movq %rax, %rdi
movsd -0x1f0(%rbp), %xmm0
callq 0x7a60
movq %rax, %rdi
movq 0x8c831(%rip), %rsi     # 0xe6f68
callq 0x75b0
movl $0x0, -0x1f4(%rbp)
cmpl $0x16a, -0x1f4(%rbp)    # imm = 0x16A
jge 0x5a832
movslq -0x1f4(%rbp), %rcx
leaq 0x8ef5c(%rip), %rax     # 0xe96c0
leaq (%rax,%rcx,4), %rax
movq %rax, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x5, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x2a0(%rbp)
movl -0xa0(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x298(%rbp)
jmp 0x5a7a9
movl -0x298(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x2a4(%rbp)
movl -0x9c(%rbp), %ecx
movl %ecx, -0xa8(%rbp)
subl $0x3, %eax
je 0x5a7f2
jmp 0x5a7d4
movl -0x2a4(%rbp), %eax
subl $0x5, %eax
je 0x5a803
jmp 0x5a7e1
movq -0x2a0(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5a81c
movq -0x2a0(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5a81c
movq -0x2a0(%rbp), %rcx
movl -0xa8(%rbp), %eax
xchgl %eax, (%rcx)
jmp 0x5a81c
movq %rax, %rdi
callq 0x25ac0
jmp 0x5a81e
movl -0x1f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f4(%rbp)
jmp 0x5a746
movq $0x0, 0x8f42b(%rip) # 0xe9c68
leaq 0x8ee68(%rip), %rax     # 0xe96ac
movq %rax, -0xb0(%rbp)
movl $0x0, -0xb4(%rbp)
movl $0x5, -0xb8(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movl -0xb8(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x2a8(%rbp)
jmp 0x5a885
movl -0x2a8(%rbp), %eax
movl %eax, -0xbc(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x2b4(%rbp)
movl -0xb4(%rbp), %ecx
movl %ecx, -0xc0(%rbp)
subl $0x3, %eax
je 0x5a8ce
jmp 0x5a8b0
movl -0x2b4(%rbp), %eax
subl $0x5, %eax
je 0x5a8df
jmp 0x5a8bd
movq -0x2b0(%rbp), %rax
movl -0xc0(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5a8f8
movq -0x2b0(%rbp), %rax
movl -0xc0(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5a8f8
movq -0x2b0(%rbp), %rcx
movl -0xc0(%rbp), %eax
xchgl %eax, (%rcx)
jmp 0x5a8f8
movq %rax, %rdi
callq 0x25ac0
callq 0x5b220
callq 0x7090
movq %rax, -0x200(%rbp)
movl $0x0, -0x204(%rbp)
movl -0x204(%rbp), %eax
cmpl 0x8d081(%rip), %eax     # 0xe79a0
jge 0x5a9b6
movl $0x8, %edi
callq 0x7550
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x2c0(%rbp)
movslq -0x204(%rbp), %rax
leaq -0x150(%rbp,%rax,8), %rax
movq %rax, -0x210(%rbp)
leaq 0x1907(%rip), %rsi      # 0x5c260
leaq -0x210(%rbp), %rdx
callq 0x65fc0
jmp 0x5a967
movq -0x2c0(%rbp), %rcx
movslq -0x204(%rbp), %rax
movq %rcx, -0x190(%rbp,%rax,8)
movl -0x204(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x204(%rbp)
jmp 0x5a913
movq -0x2c0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
movl $0x8, %esi
callq 0x7560
jmp 0x5af1a
movl $0x0, -0x214(%rbp)
movl -0x214(%rbp), %eax
cmpl 0x8cfd4(%rip), %eax     # 0xe79a0
jge 0x5aa2e
movslq -0x214(%rbp), %rax
movq -0x190(%rbp,%rax,8), %rdi
callq 0x7940
movslq -0x214(%rbp), %rax
movq -0x190(%rbp,%rax,8), %rax
movq %rax, -0x2c8(%rbp)
cmpq $0x0, %rax
je 0x5aa1b
movq -0x2c8(%rbp), %rdi
callq 0x66080
movq -0x2c8(%rbp), %rdi
movl $0x8, %esi
callq 0x7560
jmp 0x5aa1d
movl -0x214(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x214(%rbp)
jmp 0x5a9c0
callq 0x7090
movq %rax, -0x220(%rbp)
leaq -0x220(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x660e0
movq %rax, -0x238(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x660b0
movq %rax, -0x230(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x66130
cvtsi2sd %rax, %xmm0
movsd 0x53488(%rip), %xmm1    # 0xadf08
mulsd %xmm1, %xmm0
movsd %xmm0, -0x228(%rbp)
leaq 0x8ec2d(%rip), %rax     # 0xe96c0
movq %rax, -0x50(%rbp)
movl $0x5, -0x54(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movl -0x54(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x2cc(%rbp)
decl %eax
subl $0x2, %eax
jb 0x5aae6
jmp 0x5aacb
movl -0x2cc(%rbp), %eax
subl $0x5, %eax
je 0x5aaf4
jmp 0x5aad8
movq -0x2d8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
jmp 0x5ab00
movq -0x2d8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
jmp 0x5ab00
movq -0x2d8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
cvtsi2sdl -0x5c(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
leaq 0x8eb98(%rip), %rax     # 0xe96ac
movq %rax, -0x68(%rbp)
movl $0x5, -0x6c(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movl -0x6c(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x70(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x2dc(%rbp)
decl %eax
subl $0x2, %eax
jb 0x5ab67
jmp 0x5ab4c
movl -0x2dc(%rbp), %eax
subl $0x5, %eax
je 0x5ab75
jmp 0x5ab59
movq -0x2e8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0x5ab81
movq -0x2e8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0x5ab81
movq -0x2e8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x74(%rbp)
movsd -0x2f0(%rbp), %xmm0
cvtsi2sdl -0x74(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x240(%rbp)
movl -0x198(%rbp), %eax
movl %eax, -0x304(%rbp)
leaq 0x8eaff(%rip), %rax     # 0xe96ac
movq %rax, -0x80(%rbp)
movl $0x5, -0x84(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x300(%rbp)
movl -0x84(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x88(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x2f4(%rbp)
decl %eax
subl $0x2, %eax
jb 0x5ac0f
jmp 0x5abf1
movl -0x2f4(%rbp), %eax
subl $0x5, %eax
je 0x5ac20
jmp 0x5abfe
movq -0x300(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x8c(%rbp)
jmp 0x5ac2f
movq -0x300(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x8c(%rbp)
jmp 0x5ac2f
movq -0x300(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x8c(%rbp)
movl -0x304(%rbp), %edi
movl -0x8c(%rbp), %esi
movsd -0x228(%rbp), %xmm0
movsd -0x240(%rbp), %xmm1
xorl %edx, %edx
callq 0x81450
movq 0x8c397(%rip), %rdi     # 0xe6ff0
leaq 0x5344d(%rip), %rsi     # 0xae0ad
callq 0x7530
movq %rax, %rdi
movsd -0x240(%rbp), %xmm0
callq 0x7a60
movq %rax, %rdi
movq 0x8c2e9(%rip), %rsi     # 0xe6f68
callq 0x75b0
movl $0x0, -0x244(%rbp)
cmpl $0x16a, -0x244(%rbp)    # imm = 0x16A
jge 0x5ad7a
movslq -0x244(%rbp), %rcx
leaq 0x8ea14(%rip), %rax     # 0xe96c0
leaq (%rax,%rcx,4), %rax
movq %rax, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
movl $0x5, -0xd0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x310(%rbp)
movl -0xd0(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x308(%rbp)
jmp 0x5acf1
movl -0x308(%rbp), %eax
movl %eax, -0xd4(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x314(%rbp)
movl -0xcc(%rbp), %ecx
movl %ecx, -0xd8(%rbp)
subl $0x3, %eax
je 0x5ad3a
jmp 0x5ad1c
movl -0x314(%rbp), %eax
subl $0x5, %eax
je 0x5ad4b
jmp 0x5ad29
movq -0x310(%rbp), %rax
movl -0xd8(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5ad64
movq -0x310(%rbp), %rax
movl -0xd8(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5ad64
movq -0x310(%rbp), %rcx
movl -0xd8(%rbp), %eax
xchgl %eax, (%rcx)
jmp 0x5ad64
movq %rax, %rdi
callq 0x25ac0
jmp 0x5ad66
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0x5ac8e
leaq 0x8e92b(%rip), %rax     # 0xe96ac
movq %rax, -0xe0(%rbp)
movl $0x0, -0xe4(%rbp)
movl $0x5, -0xe8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x320(%rbp)
movl -0xe8(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x318(%rbp)
jmp 0x5adc2
movl -0x318(%rbp), %eax
movl %eax, -0xec(%rbp)
movl -0xe8(%rbp), %eax
movl %eax, -0x324(%rbp)
movl -0xe4(%rbp), %ecx
movl %ecx, -0xf0(%rbp)
subl $0x3, %eax
je 0x5ae0b
jmp 0x5aded
movl -0x324(%rbp), %eax
subl $0x5, %eax
je 0x5ae1c
jmp 0x5adfa
movq -0x320(%rbp), %rax
movl -0xf0(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5ae35
movq -0x320(%rbp), %rax
movl -0xf0(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5ae35
movq -0x320(%rbp), %rcx
movl -0xf0(%rbp), %eax
xchgl %eax, (%rcx)
jmp 0x5ae35
movq %rax, %rdi
callq 0x25ac0
movl -0x198(%rbp), %edi
callq 0x5c460
leaq 0x8e861(%rip), %rax     # 0xe96a8
movq %rax, -0xf8(%rbp)
movl $0x0, -0xfc(%rbp)
movl $0x5, -0x100(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x330(%rbp)
movl -0x100(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x25b00
movl %eax, -0x328(%rbp)
jmp 0x5ae88
movl -0x328(%rbp), %eax
movl %eax, -0x104(%rbp)
movl -0x100(%rbp), %eax
movl %eax, -0x334(%rbp)
movl -0xfc(%rbp), %ecx
movl %ecx, -0x108(%rbp)
subl $0x3, %eax
je 0x5aed1
jmp 0x5aeb3
movl -0x334(%rbp), %eax
subl $0x5, %eax
je 0x5aee2
jmp 0x5aec0
movq -0x330(%rbp), %rax
movl -0x108(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5aefb
movq -0x330(%rbp), %rax
movl -0x108(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x5aefb
movq -0x330(%rbp), %rcx
movl -0x108(%rbp), %eax
xchgl %eax, (%rcx)
jmp 0x5aefb
movq %rax, %rdi
callq 0x25ac0
jmp 0x5aefd
movl -0x198(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x198(%rbp)
jmp 0x5a302
addq $0x340, %rsp            # imm = 0x340
popq %rbp
retq
movq -0x1c0(%rbp), %rdi
callq 0x79b0
nopw %cs:(%rax,%rax)