// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
leaq (%rax,%r12,4), %rsi
addq $0x8, %rsi
movslq %r9d, %r13
cmpb $0x0, 0x104(%r13,%rsi)
jne 0x3b06
movq %rdi, %r14
movl %edx, 0x4(%rsp)
leaq (%rax,%r12,4), %rax
addq $0x10c, %rax            # imm = 0x10C
movb $0x1, (%rax,%r13)
movl $0x448, %edi            # imm = 0x448
movq %rcx, 0x20(%rsp)
callq 0x2160
movq %rax, %rbx
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%rbx)
leaq 0x11383(%rip), %rax     # 0x14d30
movq %rax, (%rbx)
leaq 0x10(%rbx), %r15
movl $0x438, %edx            # imm = 0x438
movq %r15, %rdi
xorl %esi, %esi
callq 0x20d0
movq %rbx, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r15, 0x8(%rsp)
movq %r13, %rax
shlq $0x20, %rax
movl %r12d, %edx
orq %rax, %rdx
leaq 0xc4(%rbx), %rcx
movq %rdx, 0xc4(%rbx)
movq (%r14), %rsi
addq $0x14, %rsi
leaq 0x2c(%rsp), %rdi
movq 0x20(%rsp), %rdx
callq 0x2b7b
addq $0x2, %r12
leaq 0x24(%rbx), %rdi
leaq 0x2c(%rsp), %rsi
movq 0xa4(%rsi), %r15
movq %r15, 0xcc(%rbx)
subl 0xa0(%rsi), %ebp
movl $0xa0, %edx
callq 0x2120
movq (%r14), %rax
movq (%rax), %xmm0
movd %r15d, %xmm1
movdqa 0xb60e(%rip), %xmm2     # 0xf050
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
paddd %xmm0, %xmm2
movq %xmm2, 0x10(%rbx)
movl 0x8(%rax), %ecx
movslq 0x4(%rax), %rdx
addl %edx, %r15d
movslq %r15d, %rsi
imulq $-0x66666667, %rsi, %rsi # imm = 0x99999999
movq %rsi, %rdi
shrq $0x3f, %rdi
sarq $0x21, %rsi
addl %edi, %esi
imulq $0x66666667, %rdx, %rdx # imm = 0x66666667
movq %rdx, %rdi
shrq $0x3f, %rdi
sarq $0x21, %rdx
addl %edi, %edx
movl 0x4(%rsp), %edi
subl %edi, %ecx
addl %edx, %ecx
addl %esi, %ecx
movl %ecx, 0x18(%rbx)
addl 0xc(%rax), %edi
movl %edi, 0x1c(%rbx)
addl 0x10(%rax), %ebp
movl %ebp, 0x20(%rbx)
movl $0x0, 0x110(%rbx)
movq %rax, 0x100(%rbx)
leaq 0x8(%r14), %rsi
addq $0x108, %rbx            # imm = 0x108
movq %rbx, %rdi
callq 0xe55a
shlq $0x6, %r12
addq (%r14), %r12
shlq $0x4, %r13
leaq (%r12,%r13), %rdi
addq $0x140, %rdi            # imm = 0x140
movq 0x18(%rsp), %rax
movq %rax, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
callq 0x737e
leaq 0x8(%rsp), %rdi
callq 0x367d
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x3b06
movq %rbx, %rdi
callq 0x730e
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x3b2d
movq %rbx, %rdi
callq 0x730e
movq %r14, %rdi
callq 0x2230
movq %rax, %r14
cmpl $0x2, %edx
jne 0x3b4c
movq %r14, %rdi
callq 0x2090
callq 0x21f0
jmp 0x3afe
cmpl $0x1, %edx
jne 0x3b25
movq %r14, %rdi
callq 0x2090
callq 0x21f0
jmp 0x3afe
jmp 0x3b62
movq %rax, %r14
jmp 0x3b25