// File: hantaoyin[P]ffxiv-crafting-mcts/ffxiv-crafting-mcts.C
// Function: Driver::simulate()
void simulate() {
    uct.reset(root_state);
    State s(root_state);
    std::vector<State> states;
    double score = 0.;

    const size_t size = training_data.size();
    ++simulate_count;
    bool track_simulation = simulate_count % 16 == 0;
    while(true) {
      if (s.done()) {
        LOG(track_simulation) << "Sample play: done, score = " << std::scientific << std::setprecision(3) << s.score() << "\n";
        score = s.score();
        break;
      }
      training_data.emplace_back(s, std::array<double, TotalActionCount>({}), 0.);
      for (size_t i = 0; i < SimulateCount; ++i) {
        uct.simulateFromState(s, track_simulation && i == SimulateCount - 1);
        // uct.simulateFromState(s, false);
      }
      // Select a move.
      Action ac = uct.select(s, inv_temp);
      LOG(track_simulation) << "Sample play: " << s.DebugString() << " ==> " << Action2Name(ac);
      if (ac == Action::NumActions) {
        LOG(track_simulation) << "Sample play: resigned.\n";
        break;
      } else {
        s.ExecuteAction(ac);
      }
    }

    for (size_t i = 0; i + size < training_data.size(); ++i) {
      auto& example = training_data[size + i];
      State& s = std::get<0>(example);
      uct.set_target_probability(s, inv_temp, std::get<1>(example));
      std::get<2>(example) = score;
    }
    while (training_data.size() > 10000) {
      training_data.pop_front();
    }
    LOG(track_simulation) << "Training data: has " << training_data.size() << " examples.";

    size_t example_id = random_real() * training_data.size();
    const auto& example = training_data[example_id];
    LOG(track_simulation) << "Training data: " << std::get<0>(example).DebugString() << " ==>";
    for (size_t i = 0; i < TotalActionCount; ++i) {
      LOG(track_simulation) << "Training data: " << std::setw(20) << std::setfill(' ')
          << Action2Name(static_cast<Action>(i)) << ": "
          << std::setfill('0') << std::scientific << std::setprecision(3) << std::get<1>(example)[i];
    }
    LOG(track_simulation) << "Training data: " << std::setfill(' ') << std::setw(20) << "Final score:"
        << std::scientific << std::setprecision(3) << std::get<2>(example);
  }

// Assembly:
subq $0x398, %rsp            # imm = 0x398
movq %rdi, 0x390(%rsp)
movq 0x390(%rsp), %rdi
movq %rdi, 0x180(%rsp)
addq $0x40, %rdi
leaq 0x1abee(%rip), %rsi     # 0x1d548
callq 0xa390
movq 0x1abe2(%rip), %rax     # 0x1d548
movq %rax, 0x37c(%rsp)
movq 0x1abdb(%rip), %rax     # 0x1d550
movq %rax, 0x384(%rsp)
movl 0x1abd5(%rip), %eax     # 0x1d558
movl %eax, 0x38c(%rsp)
leaq 0x360(%rsp), %rdi
callq 0xe260
movq 0x180(%rsp), %rdi
xorps %xmm0, %xmm0
movsd %xmm0, 0x358(%rsp)
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0xe270
movq %rax, %rcx
movq 0x180(%rsp), %rax
movq %rcx, 0x350(%rsp)
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq (%rax), %rax
andq $0xf, %rax
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movb %al, 0x34f(%rsp)
jmp 0x29ed
leaq 0x37c(%rsp), %rdi
callq 0xd0f0
testb $0x1, %al
jne 0x2a03
jmp 0x2b84
movb 0x34f(%rsp), %al
xorb $-0x1, %al
movb $0x0, 0x34d(%rsp)
testb $0x1, %al
jne 0x2a1a
jmp 0x2a1f
jmp 0x2af1
movb $0x1, 0x34d(%rsp)
movq 0x195aa(%rip), %rdi     # 0x1bfd8
leaq 0x10a42(%rip), %rsi     # 0x13477
callq 0x2180
movq %rax, 0x178(%rsp)
jmp 0x2a44
movq 0x178(%rsp), %rdi
leaq 0xb83d(%rip), %rsi      # 0xe290
callq 0x2050
movq %rax, 0x170(%rsp)
jmp 0x2a62
movl $0x3, %edi
callq 0xe2b0
movl %eax, 0x16c(%rsp)
jmp 0x2a75
movq 0x170(%rsp), %rdi
movl 0x16c(%rsp), %eax
movl %eax, 0x338(%rsp)
movl 0x338(%rsp), %esi
callq 0x2250
movq %rax, 0x160(%rsp)
jmp 0x2aa1
leaq 0x37c(%rsp), %rdi
callq 0xe2d0
movsd %xmm0, 0x158(%rsp)
jmp 0x2ab9
movsd 0x158(%rsp), %xmm0
movq 0x160(%rsp), %rdi
callq 0x22f0
movq %rax, 0x150(%rsp)
jmp 0x2ad9
movq 0x150(%rsp), %rdi
leaq 0x109d5(%rip), %rsi     # 0x134bd
callq 0x2180
jmp 0x2aef
jmp 0x2af1
testb $0x1, 0x34d(%rsp)
jne 0x2afd
jmp 0x2b0a
leaq 0x34e(%rsp), %rdi
callq 0xe320
leaq 0x37c(%rsp), %rdi
callq 0xe2d0
movsd %xmm0, 0x148(%rsp)
jmp 0x2b22
movsd 0x148(%rsp), %xmm0
movsd %xmm0, 0x358(%rsp)
jmp 0x2f31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
testb $0x1, 0x34d(%rsp)
jne 0x2b59
jmp 0x2b66
leaq 0x34e(%rsp), %rdi
callq 0xe320
jmp 0x3708
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x3708
movq 0x180(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
xorps %xmm0, %xmm0
movaps %xmm0, 0x130(%rsp)
movaps %xmm0, 0x320(%rsp)
movaps %xmm0, 0x310(%rsp)
movaps %xmm0, 0x300(%rsp)
movaps %xmm0, 0x2f0(%rsp)
movaps %xmm0, 0x2e0(%rsp)
movaps %xmm0, 0x2d0(%rsp)
movaps %xmm0, 0x2c0(%rsp)
movaps %xmm0, 0x2b0(%rsp)
movaps %xmm0, 0x2a0(%rsp)
movaps %xmm0, 0x290(%rsp)
movaps %xmm0, 0x280(%rsp)
movaps %xmm0, 0x270(%rsp)
movaps %xmm0, 0x260(%rsp)
movaps %xmm0, 0x250(%rsp)
movq $0x0, 0x330(%rsp)
movq $0x0, 0x248(%rsp)
leaq 0x37c(%rsp), %rsi
leaq 0x250(%rsp), %rdx
leaq 0x248(%rsp), %rcx
callq 0xe350
jmp 0x2c45
movq $0x0, 0x240(%rsp)
cmpq $0x2710, 0x240(%rsp) # imm = 0x2710
jae 0x2cdb
movq 0x180(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x120(%rsp)
xorl %eax, %eax
testb $0x1, 0x34f(%rsp)
movb %al, 0x12f(%rsp)
je 0x2c9c
cmpq $0x270f, 0x240(%rsp) # imm = 0x270F
sete %al
movb %al, 0x12f(%rsp)
movq 0x120(%rsp), %rdi
movb 0x12f(%rsp), %al
movzbl %al, %edx
andl $0x1, %edx
leaq 0x37c(%rsp), %rsi
callq 0xe3e0
jmp 0x2cc0
jmp 0x2cc2
movq 0x240(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x240(%rsp)
jmp 0x2c51
movq 0x180(%rsp), %rdi
addq $0x40, %rdi
leaq 0x37c(%rsp), %rsi
movsd 0x10319(%rip), %xmm0    # 0x13010
callq 0xee40
movb %al, 0x11f(%rsp)
jmp 0x2d05
movb 0x11f(%rsp), %al
movb %al, 0x23f(%rsp)
movb 0x34f(%rsp), %al
xorb $-0x1, %al
movb $0x0, 0x23d(%rsp)
movb $0x0, 0x217(%rsp)
testb $0x1, %al
jne 0x2d32
jmp 0x2d37
jmp 0x2de8
movb $0x1, 0x23d(%rsp)
movq 0x19292(%rip), %rdi     # 0x1bfd8
leaq 0x10746(%rip), %rsi     # 0x13493
callq 0x2180
movq %rax, 0x110(%rsp)
jmp 0x2d5c
leaq 0x218(%rsp), %rdi
leaq 0x37c(%rsp), %rsi
callq 0xf010
jmp 0x2d73
movq 0x110(%rsp), %rdi
movb $0x1, 0x217(%rsp)
leaq 0x218(%rsp), %rsi
callq 0x2140
movq %rax, 0x108(%rsp)
jmp 0x2d9a
movq 0x108(%rsp), %rdi
leaq 0x106f8(%rip), %rsi     # 0x134a1
callq 0x2180
movq %rax, 0x100(%rsp)
jmp 0x2db8
movzbl 0x23f(%rsp), %edi
callq 0x2530
movq %rax, 0xf8(%rsp)
jmp 0x2dcf
movq 0xf8(%rsp), %rsi
movq 0x100(%rsp), %rdi
callq 0x2180
jmp 0x2de6
jmp 0x2de8
testb $0x1, 0x217(%rsp)
jne 0x2df4
jmp 0x2e01
leaq 0x218(%rsp), %rdi
callq 0x20b0
testb $0x1, 0x23d(%rsp)
jne 0x2e0d
jmp 0x2e1a
leaq 0x23e(%rsp), %rdi
callq 0xe320
cmpb $0x1d, 0x23f(%rsp)
jne 0x2f13
movb 0x34f(%rsp), %al
xorb $-0x1, %al
movb $0x0, 0x215(%rsp)
testb $0x1, %al
jne 0x2e3f
jmp 0x2e41
jmp 0x2e60
movb $0x1, 0x215(%rsp)
movq 0x19188(%rip), %rdi     # 0x1bfd8
leaq 0x10650(%rip), %rsi     # 0x134a7
callq 0x2180
jmp 0x2e5e
jmp 0x2e60
testb $0x1, 0x215(%rsp)
jne 0x2e6c
jmp 0x2e79
leaq 0x216(%rsp), %rdi
callq 0xe320
jmp 0x2f31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x2ec3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
testb $0x1, 0x217(%rsp)
jne 0x2eb4
jmp 0x2ec1
leaq 0x218(%rsp), %rdi
callq 0x20b0
jmp 0x2ec3
testb $0x1, 0x23d(%rsp)
jne 0x2ecf
jmp 0x2edc
leaq 0x23e(%rsp), %rdi
callq 0xe320
jmp 0x3708
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
testb $0x1, 0x215(%rsp)
jne 0x2f01
jmp 0x2f0e
leaq 0x216(%rsp), %rdi
callq 0xe320
jmp 0x3708
movzbl 0x23f(%rsp), %esi
leaq 0x37c(%rsp), %rdi
callq 0xfa50
jmp 0x2f2a
jmp 0x2f2c
jmp 0x29eb
movq $0x0, 0x208(%rsp)
movq 0x180(%rsp), %rdi
movq 0x208(%rsp), %rax
addq 0x350(%rsp), %rax
movq %rax, 0xf0(%rsp)
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0xe270
movq %rax, %rcx
movq 0xf0(%rsp), %rax
cmpq %rcx, %rax
jae 0x305c
movq 0x180(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq 0x350(%rsp), %rsi
movq 0x208(%rsp), %rax
addq %rax, %rsi
callq 0xfb00
movq %rax, 0x200(%rsp)
movq 0x200(%rsp), %rdi
callq 0xfb30
movq %rax, %rcx
movq 0x180(%rsp), %rax
movq %rcx, 0x1f8(%rsp)
addq $0x40, %rax
movq %rax, 0xe0(%rsp)
movq 0x1f8(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq 0x200(%rsp), %rdi
callq 0xfce0
movq 0xe0(%rsp), %rdi
movq 0xe8(%rsp), %rsi
movq %rax, %rdx
movsd 0x10000(%rip), %xmm0    # 0x13010
callq 0xfb40
jmp 0x3017
movsd 0x358(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
movq 0x200(%rsp), %rdi
callq 0xfcf0
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x208(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x208(%rsp)
jmp 0x2f3d
jmp 0x305e
movq 0x180(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0xe270
cmpq $0x2710, %rax           # imm = 0x2710
jbe 0x3090
movq 0x180(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0xfd00
jmp 0x305e
movb 0x34f(%rsp), %al
xorb $-0x1, %al
movb $0x0, 0x1f6(%rsp)
testb $0x1, %al
jne 0x30a7
jmp 0x30a9
jmp 0x3114
movb $0x1, 0x1f6(%rsp)
movq 0x18f20(%rip), %rdi     # 0x1bfd8
leaq 0x10400(%rip), %rsi     # 0x134bf
callq 0x2180
movq %rax, 0xd0(%rsp)
jmp 0x30ce
movq 0x180(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0xe270
movq 0xd0(%rsp), %rdi
movq %rax, %rsi
callq 0x2030
movq %rax, 0xc8(%rsp)
jmp 0x30fc
movq 0xc8(%rsp), %rdi
leaq 0x103c8(%rip), %rsi     # 0x134d3
callq 0x2180
jmp 0x3112
jmp 0x3114
testb $0x1, 0x1f6(%rsp)
jne 0x3120
jmp 0x312d
leaq 0x1f7(%rsp), %rdi
callq 0xe320
leaq 0x1a3fc(%rip), %rdi     # 0x1d530
callq 0x26f0
movsd %xmm0, 0xc0(%rsp)
jmp 0x3144
movq 0x180(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0xe270
movsd 0xc0(%rsp), %xmm0
movq 0x180(%rsp), %rdi
movq %rax, %xmm1
movaps 0xffbb(%rip), %xmm2     # 0x13130
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0xffbf(%rip), %xmm2     # 0x13140
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0xfe6d(%rip), %xmm1     # 0x13018
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, 0x1e8(%rsp)
addq $0x1b0, %rdi            # imm = 0x1B0
movq 0x1e8(%rsp), %rsi
callq 0xfb00
movq %rax, 0x1e0(%rsp)
movb 0x34f(%rsp), %al
xorb $-0x1, %al
movb $0x0, 0x1de(%rsp)
movb $0x0, 0x1b7(%rsp)
testb $0x1, %al
jne 0x31fd
jmp 0x3202
jmp 0x3285
movb $0x1, 0x1de(%rsp)
movq 0x18dc7(%rip), %rdi     # 0x1bfd8
leaq 0x102c6(%rip), %rsi     # 0x134de
callq 0x2180
movq %rax, 0xb8(%rsp)
jmp 0x3227
movq 0x1e0(%rsp), %rdi
callq 0xfd80
movq %rax, %rsi
leaq 0x1b8(%rsp), %rdi
callq 0xf010
jmp 0x3246
movq 0xb8(%rsp), %rdi
movb $0x1, 0x1b7(%rsp)
leaq 0x1b8(%rsp), %rsi
callq 0x2140
movq %rax, 0xb0(%rsp)
jmp 0x326d
movq 0xb0(%rsp), %rdi
leaq 0x10272(%rip), %rsi     # 0x134ee
callq 0x2180
jmp 0x3283
jmp 0x3285
testb $0x1, 0x1b7(%rsp)
jne 0x3291
jmp 0x329e
leaq 0x1b8(%rsp), %rdi
callq 0x20b0
testb $0x1, 0x1de(%rsp)
jne 0x32aa
jmp 0x32b7
leaq 0x1df(%rsp), %rdi
callq 0xe320
movq $0x0, 0x1a8(%rsp)
cmpq $0x1d, 0x1a8(%rsp)
jae 0x3586
movb 0x34f(%rsp), %al
xorb $-0x1, %al
movb $0x0, 0x1a6(%rsp)
testb $0x1, %al
jne 0x32e9
jmp 0x32ee
jmp 0x348b
movb $0x1, 0x1a6(%rsp)
movq 0x18cdb(%rip), %rdi     # 0x1bfd8
leaq 0x101da(%rip), %rsi     # 0x134de
callq 0x2180
movq %rax, 0xa8(%rsp)
jmp 0x3313
movl $0x14, %edi
callq 0xfd90
movl %eax, 0xa4(%rsp)
jmp 0x3326
movq 0xa8(%rsp), %rdi
movl 0xa4(%rsp), %eax
movl %eax, 0x1a0(%rsp)
movl 0x1a0(%rsp), %esi
callq 0x21c0
movq %rax, 0x98(%rsp)
jmp 0x3352
movl $0x20, %edi
callq 0xfdb0
movb %al, 0x97(%rsp)
jmp 0x3365
movq 0x98(%rsp), %rdi
movb 0x97(%rsp), %al
movb %al, 0x19f(%rsp)
movzbl 0x19f(%rsp), %esi
callq 0x2240
movq %rax, 0x88(%rsp)
jmp 0x3392
movzbl 0x1a8(%rsp), %edi
callq 0x2530
movq %rax, 0x80(%rsp)
jmp 0x33a9
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdi
callq 0x2180
movq %rax, 0x78(%rsp)
jmp 0x33c5
movq 0x78(%rsp), %rdi
leaq 0x10257(%rip), %rsi     # 0x13628
callq 0x2180
movq %rax, 0x70(%rsp)
jmp 0x33dd
movl $0x30, %edi
callq 0xfdb0
movb %al, 0x6f(%rsp)
jmp 0x33ed
movq 0x70(%rsp), %rdi
movb 0x6f(%rsp), %al
movb %al, 0x19e(%rsp)
movzbl 0x19e(%rsp), %esi
callq 0x2240
movq %rax, 0x60(%rsp)
jmp 0x3411
movq 0x60(%rsp), %rdi
leaq 0xae73(%rip), %rsi      # 0xe290
callq 0x2050
movq %rax, 0x58(%rsp)
jmp 0x3429
movl $0x3, %edi
callq 0xe2b0
movl %eax, 0x54(%rsp)
jmp 0x3439
movq 0x58(%rsp), %rdi
movl 0x54(%rsp), %eax
movl %eax, 0x198(%rsp)
movl 0x198(%rsp), %esi
callq 0x2250
movq %rax, 0x48(%rsp)
jmp 0x345c
movq 0x1e0(%rsp), %rdi
callq 0xfdd0
movq %rax, %rdi
movq 0x1a8(%rsp), %rsi
callq 0xae20
movq 0x48(%rsp), %rdi
movsd (%rax), %xmm0
callq 0x22f0
jmp 0x3489
jmp 0x348b
testb $0x1, 0x1a6(%rsp)
jne 0x3497
jmp 0x34a4
leaq 0x1a7(%rsp), %rdi
callq 0xe320
jmp 0x34a6
movq 0x1a8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x1a8(%rsp)
jmp 0x32c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
testb $0x1, 0x1f6(%rsp)
jne 0x34df
jmp 0x34ec
leaq 0x1f7(%rsp), %rdi
callq 0xe320
jmp 0x3708
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
jmp 0x3536
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
testb $0x1, 0x1b7(%rsp)
jne 0x3527
jmp 0x3534
leaq 0x1b8(%rsp), %rdi
callq 0x20b0
jmp 0x3536
testb $0x1, 0x1de(%rsp)
jne 0x3542
jmp 0x354f
leaq 0x1df(%rsp), %rdi
callq 0xe320
jmp 0x3708
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
testb $0x1, 0x1a6(%rsp)
jne 0x3574
jmp 0x3581
leaq 0x1a7(%rsp), %rdi
callq 0xe320
jmp 0x3708
movb 0x34f(%rsp), %al
xorb $-0x1, %al
movb $0x0, 0x196(%rsp)
testb $0x1, %al
jne 0x359d
jmp 0x35a2
jmp 0x36ab
movb $0x1, 0x196(%rsp)
movq 0x18a27(%rip), %rdi     # 0x1bfd8
leaq 0xff26(%rip), %rsi      # 0x134de
callq 0x2180
movq %rax, 0x40(%rsp)
jmp 0x35c4
movl $0x20, %edi
callq 0xfdb0
movb %al, 0x3f(%rsp)
jmp 0x35d4
movq 0x40(%rsp), %rdi
movb 0x3f(%rsp), %al
movb %al, 0x195(%rsp)
movzbl 0x195(%rsp), %esi
callq 0x2240
movq %rax, 0x30(%rsp)
jmp 0x35f8
movl $0x14, %edi
callq 0xfd90
movl %eax, 0x2c(%rsp)
jmp 0x3608
movq 0x30(%rsp), %rdi
movl 0x2c(%rsp), %eax
movl %eax, 0x190(%rsp)
movl 0x190(%rsp), %esi
callq 0x21c0
movq %rax, 0x20(%rsp)
jmp 0x362b
movq 0x20(%rsp), %rdi
leaq 0xfebc(%rip), %rsi      # 0x134f3
callq 0x2180
movq %rax, 0x18(%rsp)
jmp 0x3643
movq 0x18(%rsp), %rdi
leaq 0xac41(%rip), %rsi      # 0xe290
callq 0x2050
movq %rax, 0x10(%rsp)
jmp 0x365b
movl $0x3, %edi
callq 0xe2b0
movl %eax, 0xc(%rsp)
jmp 0x366b
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %eax
movl %eax, 0x18c(%rsp)
movl 0x18c(%rsp), %esi
callq 0x2250
movq %rax, (%rsp)
jmp 0x368d
movq 0x1e0(%rsp), %rdi
callq 0xfde0
movq (%rsp), %rdi
movsd (%rax), %xmm0
callq 0x22f0
jmp 0x36a9
jmp 0x36ab
testb $0x1, 0x196(%rsp)
jne 0x36b7
jmp 0x36c4
leaq 0x197(%rsp), %rdi
callq 0xe320
leaq 0x360(%rsp), %rdi
callq 0xfdf0
addq $0x398, %rsp            # imm = 0x398
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x340(%rsp)
movl %eax, 0x33c(%rsp)
testb $0x1, 0x196(%rsp)
jne 0x36f9
jmp 0x3706
leaq 0x197(%rsp), %rdi
callq 0xe320
jmp 0x3708
leaq 0x360(%rsp), %rdi
callq 0xfdf0
movq 0x340(%rsp), %rdi
callq 0x22c0
nopw %cs:(%rax,%rax)
nopl (%rax)