// File: /workspace/github_cpp_makefile_star2_O1/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 0x1fb72(%rip), %xmm0    # 0x26020
movsd %xmm0, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x2d7c6(%rip), %r10     # 0x33c88
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 0x6536
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 0x655a
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x5320
jmp 0x656e
leaq 0x1fb6f(%rip), %rsi     # 0x260d0
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x51c0
movl $0x8, %esi
movq %r14, %rdi
callq 0x8ae2
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 0x65d7
movd %xmm0, %eax
shlq $0x20, %rax
addq %rbx, %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x65cc
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x65d7
movq %r12, %rdi
movq %r13, %rdx
callq 0x8e98
incq %rbx
cmpq $0x8, %rbx
jne 0x6597
movq %r14, %rdi
movq %r12, %rsi
callq 0x8bb6
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x65f9
callq 0x5200
incq %rbp
addq $0x20, %r15
cmpq $0x8, %rbp
jne 0x6585
movq 0x18(%rsp), %rcx
addq $0x120, %rcx            # imm = 0x120
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x662e
movups (%rax), %xmm0
movl 0x10(%rax), %eax
movl %eax, 0x10(%rcx)
movups %xmm0, (%rcx)
jmp 0x663f
movaps 0x1fb9b(%rip), %xmm0    # 0x261d0
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 0x6666
jmp 0x6655
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6666
callq 0x5200
movq %r14, %rdi
callq 0x8be2
movq %rbx, %rdi
callq 0x5370