// File: /workspace/github_cpp_makefile_star2_O2/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
movsd 0x16199(%rip), %xmm0    # 0x1c020
movsd %xmm0, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x27120(%rip), %r10     # 0x2cfb8
movq %r10, (%rdi)
movl %eax, 0x18(%rdi)
movl %edx, 0x1c(%rdi)
movw %cx, 0x134(%rdi)
movw %r8w, 0x136(%rdi)
andw $0x0, 0x138(%rdi)
movl 0x60(%rsp), %ecx
movw %r9w, 0x13a(%rdi)
movw %cx, 0x13c(%rdi)
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
cmpl %r10d, %r9d
setne %r8b
cmpl %r10d, %ecx
setne %cl
xorps %xmm0, %xmm0
movups %xmm0, 0x13e(%rdi)
movups %xmm0, 0x148(%rdi)
testb %cl, %r8b
jne 0x5f0e
decl %eax
decl %edx
movw %ax, 0x13a(%rdi)
movw %dx, 0x13c(%rdi)
andw $0x0, 0x13e(%rdi)
leaq 0x140(%rdi), %r14
movq %rdi, (%rsp)
leaq 0x20(%rdi), %r15
testq %rsi, %rsi
je 0x5f31
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x5340
jmp 0x5f45
leaq 0x16178(%rip), %rsi     # 0x1c0b0
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x51d0
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x7712
xorl %ebp, %ebp
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
cmpq $0x8, %rbp
je 0x5fc2
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
xorl %ebx, %ebx
cmpq $0x8, %rbx
je 0x5fa6
movss (%r15,%rbx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jae 0x5fa1
movd %xmm0, %eax
shlq $0x20, %rax
addq %rbx, %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x7aba
incq %rbx
jmp 0x5f72
movq %r14, %rdi
movq %r12, %rsi
callq 0x77a8
movq %r12, %rdi
callq 0x7d5e
incq %rbp
addq $0x20, %r15
jmp 0x5f5c
movq (%rsp), %rcx
addq $0x120, %rcx            # imm = 0x120
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x5fe5
movups (%rax), %xmm0
movl 0x10(%rax), %eax
movl %eax, 0x10(%rcx)
movups %xmm0, (%rcx)
jmp 0x5ff6
movaps 0x161c4(%rip), %xmm0    # 0x1c1b0
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 0x6019
jmp 0x600c
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x7d5e
movq %r14, %rdi
callq 0x77d4
movq %rbx, %rdi
callq 0x5390