// File: /workspace/github_cpp_makefile_star2_O1/kmyk[P]codevs-for-student-2016/Main.cpp
// Function: step_photon_inner(std::shared_ptr<photon_t> const&, int, int, primitive::blocks_t<3ul, 3ul> const&, int, int)
void step_photon_inner(shared_ptr<photon_t> const & pho, int numbers, int consumed, pack_t const & filled_pack, int x, rotate_t r) {
    if (pho->cached[x+pack_size-1][r]) return;
    pho->cached[x+pack_size-1][r] = true;
    shared_ptr<photon_t> npho = make_shared<photon_t>();
    npho->output = make_output(x, r);
    int erased;
    try {
        tie(npho->result, erased, npho->field) = simulate_with_output(pho->field, filled_pack, npho->output);
    } catch (simulate_invalid_output_exception e) {
        return;
    } catch (simulate_gameover_exception e) {
        return;
    }
    npho->turn = pho->turn + 1;
    npho->score = pho->score + npho->result.score;
    npho->obstacles = pho->obstacles - consumed - count_obstacles_from_delta(pho->score, npho->result.score);
    npho->dropped_obstacles = pho->dropped_obstacles + consumed;
    npho->dropped_numbers = pho->dropped_numbers + numbers - erased;
    npho->beam_generation = 0;
    npho->parent = pho;
    pho->next[x+pack_size-1][r] = npho;
    evaluate_photon_for_search(npho);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %esi, %ebp
movq (%rdi), %rax
movslq %r8d, %r15
leaq (%rax,%r15,4), %rsi
addq $0x8, %rsi
movslq %r9d, %r14
cmpb $0x0, 0x104(%r14,%rsi)
jne 0x3a5d
movq %rdi, %rbx
movl %edx, 0xc(%rsp)
leaq (%rax,%r15,4), %rax
addq $0x10c, %rax            # imm = 0x10C
movb $0x1, (%rax,%r14)
movq $0x0, 0x10(%rsp)
movl $0x448, %edi            # imm = 0x448
movq %rcx, 0x20(%rsp)
callq 0x2160
movq %rax, %r12
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r12)
leaq 0x113fe(%rip), %rax     # 0x14cf8
movq %rax, (%r12)
leaq 0x10(%r12), %r13
movl $0x438, %edx            # imm = 0x438
movq %r13, %rdi
xorl %esi, %esi
callq 0x20d0
movq %r12, 0x18(%rsp)
movq %r13, 0x10(%rsp)
movq %r14, %rax
shlq $0x20, %rax
movl %r15d, %ecx
orq %rax, %rcx
movq %rcx, 0xc4(%r12)
addq $0xc4, %r12
movq (%rbx), %rsi
addq $0x14, %rsi
leaq 0x2c(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq %r12, %rcx
callq 0x2b1f
addq $0x2, %r15
leaq 0x18(%rsp), %r13
movq -0x8(%r13), %r12
leaq 0x14(%r12), %rdi
leaq 0x2c(%rsp), %rsi
movq 0xa4(%rsi), %rax
movq %rax, 0xbc(%r12)
subl 0xa0(%rsi), %ebp
movl $0xa0, %edx
callq 0x2120
movq (%rbx), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%r12)
movl 0xbc(%r12), %ecx
movl 0x4(%rax), %edx
addl %ecx, %edx
movl %edx, 0x4(%r12)
movl 0x8(%rax), %edx
movslq 0x4(%rax), %rsi
addl %esi, %ecx
movslq %ecx, %rcx
imulq $-0x66666667, %rcx, %rcx # imm = 0x99999999
movq %rcx, %rdi
shrq $0x3f, %rdi
sarq $0x21, %rcx
addl %edi, %ecx
imulq $0x66666667, %rsi, %rsi # imm = 0x66666667
movq %rsi, %rdi
shrq $0x3f, %rdi
sarq $0x21, %rsi
addl %edi, %esi
movl 0xc(%rsp), %edi
subl %edi, %edx
addl %esi, %edx
addl %ecx, %edx
movl %edx, 0x8(%r12)
addl 0xc(%rax), %edi
movl %edi, 0xc(%r12)
addl 0x10(%rax), %ebp
movl %ebp, 0x10(%r12)
movl $0x0, 0x100(%r12)
movq %rax, 0xf0(%r12)
leaq 0x8(%rbx), %rsi
addq $0xf8, %r12
movq %r12, %rdi
callq 0xe364
shlq $0x6, %r15
addq (%rbx), %r15
shlq $0x4, %r14
movq -0x8(%r13), %rax
leaq (%r14,%r15), %rdi
addq $0x140, %rdi            # imm = 0x140
movq %rax, -0x8(%rdi)
movq %r13, %rsi
callq 0x71a6
leaq 0x10(%rsp), %rdi
callq 0x35af
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3a5d
callq 0x7136
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3a81
callq 0x7136
movq %rbx, %rdi
callq 0x2230
movq %rax, %rbx
cmpl $0x2, %edx
jne 0x3aa0
movq %rbx, %rdi
callq 0x2090
callq 0x21f0
jmp 0x3a4e
cmpl $0x1, %edx
jne 0x3a72
movq %rbx, %rdi
callq 0x2090
callq 0x21f0
jmp 0x3a4e
jmp 0x3a6f
jmp 0x3a6f