// File: /workspace/github_cpp_makefile_star2_O1/sus304[P]ForRocket/src/interpolate.cpp
// Function: forrocket::interpolate::Interp1d::Interp1d(std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
forrocket::interpolate::Interp1d::Interp1d(const std::vector<double> x, const std::vector<double> y, const std::string kind, const std::string fill_value) {
    if (x.size() != y.size()) {
        std::cerr << "Error! Diffirent number of array: " << x.size() << "/" << y.size() << std::endl;
        exit(EXIT_FAILURE);
    }
    x_src = x;
    y_src = y;

    if (fill_value == "zero") this->fill_value = 0;
    else if (fill_value == "same") this->fill_value = 1;
    else if (fill_value == "extrapolate") this->fill_value = 2;
    else {
        std::cerr << "Error! Undefined reference to fill value type: " << fill_value << std::endl;
        std::cerr << "zero / same / extrapolate" << std::endl;;
        exit(EXIT_FAILURE);
    }

    if (need_sort(x_src)) ascending_order_sort(x_src, y_src);

    if (kind == "linear") {
        polator = new Linear1D();
    }
    else if (kind == "cubic" || kind == "spline") {
        polator = new CubicSpline1D(x, y);
    } else {
        std::cerr << "Error! Undifined polate kind" << std::endl;
        exit(EXIT_FAILURE);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rdi)
movupd %xmm0, 0x10(%rdi)
movupd %xmm0, (%rdi)
movq 0x8(%rsi), %rax
subq (%rsi), %rax
movq 0x8(%rdx), %rcx
subq (%rdx), %rcx
cmpq %rcx, %rax
jne 0x1342d
movq %r8, %rbp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x140be
movq %r14, %rdi
movq %r15, %rsi
callq 0x140be
leaq 0x27031(%rip), %rsi     # 0x3a2d5
movq %rbp, %rdi
callq 0x5110
testl %eax, %eax
je 0x1333c
leaq 0x2701f(%rip), %rsi     # 0x3a2da
movq %rbp, %rdi
callq 0x5110
testl %eax, %eax
je 0x13340
leaq 0x2704f(%rip), %rsi     # 0x3a31d
movq %rbp, %rdi
callq 0x5110
movl $0x2, %ecx
testl %eax, %eax
je 0x13345
movq 0x35d0a(%rip), %rdi     # 0x48ff0
leaq 0x26ff2(%rip), %rsi     # 0x3a2df
movl $0x2f, %edx
callq 0x53b0
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq 0x35cea(%rip), %rdi     # 0x48ff0
callq 0x53b0
movq %rax, %rdi
callq 0x51a0
movq 0x35cd6(%rip), %rdi     # 0x48ff0
leaq 0x26fee(%rip), %rsi     # 0x3a30f
movl $0x19, %edx
callq 0x53b0
movq 0x35cbe(%rip), %rdi     # 0x48ff0
callq 0x51a0
jmp 0x134b6
xorl %ecx, %ecx
jmp 0x13345
movl $0x1, %ecx
movl %ecx, 0x30(%rbx)
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0x2, %rax
setae %dl
jb 0x1338e
movsd (%rcx), %xmm0
ucomisd 0x8(%rcx), %xmm0
ja 0x1338e
movl $0x2, %esi
movq %rsi, %rdx
cmpq %rsi, %rax
je 0x13388
movsd -0x8(%rcx,%rdx,8), %xmm0
leaq 0x1(%rdx), %rsi
ucomisd (%rcx,%rdx,8), %xmm0
jbe 0x1336f
cmpq %rdx, %rax
seta %dl
testb %dl, %dl
je 0x1339d
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1309c
leaq 0x26f85(%rip), %rsi     # 0x3a329
movq %r13, %rdi
callq 0x5110
testl %eax, %eax
je 0x13402
leaq 0x26f79(%rip), %rsi     # 0x3a330
movq %r13, %rdi
callq 0x5110
testl %eax, %eax
je 0x133da
leaq 0x26f6c(%rip), %rsi     # 0x3a336
movq %r13, %rdi
callq 0x5110
testl %eax, %eax
jne 0x13492
movl $0x30, %edi
callq 0x5340
movq %rax, %r13
leaq 0x354c2(%rip), %rax     # 0x488b0
movq %rax, (%r13)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x13a86
jmp 0x1341a
movl $0x8, %edi
callq 0x5340
movq %rax, %r13
leaq 0x354b2(%rip), %rax     # 0x488c8
movq %rax, (%r13)
movq %r13, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x35bbc(%rip), %rdi     # 0x48ff0
leaq 0x26e75(%rip), %rsi     # 0x3a2b0
movl $0x22, %edx
callq 0x53b0
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
movq 0x35b97(%rip), %rdi     # 0x48ff0
callq 0x5240
movq %rax, %r12
leaq 0x26e6b(%rip), %rsi     # 0x3a2d3
movl $0x1, %edx
movq %rax, %rdi
callq 0x53b0
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x3, %rsi
movq %r12, %rdi
callq 0x5240
movq %rax, %rdi
callq 0x51a0
jmp 0x134b6
movq 0x35b57(%rip), %rdi     # 0x48ff0
leaq 0x26e9d(%rip), %rsi     # 0x3a33d
movl $0x1c, %edx
callq 0x53b0
movq 0x35b3f(%rip), %rdi     # 0x48ff0
callq 0x51a0
movl $0x1, %edi
callq 0x53e0
movq %rax, %r15
movl $0x30, %esi
movq %r13, %rdi
callq 0x5350
jmp 0x134d5
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x134e9
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0x5350
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x134fd
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x5350
movq %r15, %rdi
callq 0x55e0
nop