// File: /workspace/github_cpp_makefile_star2_O3/bonetblai[P]mdp-engine/sailing/./sailing.h
// Function: problem_t::problem_t(int, int, int, int, int, int, float*, float*)
problem_t(int rows, int cols,
              int init_x = 0, int init_y = 0,
              int goal_x = std::numeric_limits<int>::max(),
              int goal_y = std::numeric_limits<int>::max(),
              float *wind_transition = 0, float *costs = 0)
      : Problem::problem_t<state_t>(DISCOUNT),
        rows_(rows), cols_(cols), init_(init_x, init_y), goal_(goal_x, goal_y) {

        if( (goal_x == std::numeric_limits<int>::max()) ||
            (goal_y == std::numeric_limits<int>::max()) ) {
            goal_ = state_t(rows - 1, cols - 1);
        }
        
        if( wind_transition != 0 ) {
            bcopy(wind_transition, wind_transition_, 64 * sizeof(float));
        } else {
            bcopy(default_wind_transition_, wind_transition_, 64 * sizeof(float));
        }

        // fill in sparse wind transition
        sparse_wind_transition_.reserve(8);
        for( int wind = 0; wind < 8; ++wind ) {
            std::vector<std::pair<int, float> > sparse_transition;
            for( int nwind = 0; nwind < 8; ++nwind ) {
                float p = wind_transition_[wind * 8 + nwind];
                if( p > 0 ) sparse_transition.push_back(std::make_pair(nwind, p));
            }
            sparse_wind_transition_.push_back(sparse_transition);
        }

        if( costs != 0 ) {
            bcopy(costs, costs_, 5 * sizeof(float));
        } else {
            bcopy(default_costs_, costs_, 5 * sizeof(float));
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %eax
movq 0x68(%rsp), %rsi
movl 0x60(%rsp), %r11d
movsd 0x1ec0e(%rip), %xmm0    # 0x25030
movsd %xmm0, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x2cb82(%rip), %r10     # 0x32fb8
movq %r10, (%rdi)
movl %eax, 0x18(%rdi)
movl %edx, 0x1c(%rdi)
movw %cx, 0x134(%rdi)
movw %r8w, 0x136(%rdi)
movw $0x0, 0x138(%rdi)
movw %r9w, 0x13a(%rdi)
movw %r11w, 0x13c(%rdi)
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %r9d
setne %r8b
cmpl %ecx, %r11d
setne %cl
xorps %xmm0, %xmm0
movups %xmm0, 0x13e(%rdi)
movups %xmm0, 0x148(%rdi)
testb %cl, %r8b
jne 0x64aa
decl %eax
decl %edx
movw %ax, 0x13a(%rdi)
movw %dx, 0x13c(%rdi)
movw $0x0, 0x13e(%rdi)
leaq 0x140(%rdi), %r14
movq %rdi, 0x18(%rsp)
leaq 0x20(%rdi), %r15
testq %rsi, %rsi
je 0x64ce
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x5320
jmp 0x64e2
leaq 0x1ec0b(%rip), %rsi     # 0x250e0
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x51c0
movl $0x8, %esi
movq %r14, %rdi
callq 0x8a82
xorl %ebp, %ebp
movq %rsp, %r12
leaq 0x20(%rsp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
xorl %ebx, %ebx
movss (%r15,%rbx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jae 0x654b
movd %xmm0, %eax
shlq $0x20, %rax
addq %rbx, %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x6540
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x654b
movq %r12, %rdi
movq %r13, %rdx
callq 0x8e3c
incq %rbx
cmpq $0x8, %rbx
jne 0x650b
movq %r14, %rdi
movq %r12, %rsi
callq 0x8b56
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x656d
callq 0x5200
incq %rbp
addq $0x20, %r15
cmpq $0x8, %rbp
jne 0x64f9
movq 0x18(%rsp), %rcx
addq $0x120, %rcx            # imm = 0x120
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x65a2
movups (%rax), %xmm0
movl 0x10(%rax), %eax
movl %eax, 0x10(%rcx)
movups %xmm0, (%rcx)
jmp 0x65b3
movaps 0x1ec37(%rip), %xmm0    # 0x251e0
movups %xmm0, (%rcx)
movl $0x7f7fffff, 0x10(%rcx) # imm = 0x7F7FFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x65da
jmp 0x65c9
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x65da
callq 0x5200
movq %r14, %rdi
callq 0x8b82
movq %rbx, %rdi
callq 0x5370