// File: /workspace/github_cpp_makefile_star2_O2/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
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movq 0x8(%rsi), %rax
subq (%rsi), %rax
movq 0x8(%rdx), %rcx
subq (%rdx), %rcx
cmpq %rcx, %rax
jne 0xf206
movq %r8, %rbp
movq %rbx, %rdi
movq %r12, %rsi
callq 0xfd6a
movq %r14, %rdi
movq %r15, %rsi
callq 0xfd6a
leaq 0x22339(%rip), %rsi     # 0x31465
movq %rbp, %rdi
callq 0xfe34
xorl %ecx, %ecx
testb %al, %al
jne 0xf16b
leaq 0x22329(%rip), %rsi     # 0x3146a
movq %rbp, %rdi
callq 0xfe34
testb %al, %al
je 0xf151
pushq $0x1
jmp 0xf16a
leaq 0x22355(%rip), %rsi     # 0x314ad
movq %rbp, %rdi
callq 0xfe34
testb %al, %al
je 0xf25a
pushq $0x2
popq %rcx
movl %ecx, 0x30(%rbx)
movq %rbx, %rsi
callq 0xefbc
testb %al, %al
je 0xf185
movq %rbx, %rsi
movq %r14, %rdx
callq 0xefee
leaq 0x2232d(%rip), %rsi     # 0x314b9
movq %r13, %rdi
callq 0xfe34
testb %al, %al
je 0xf1b0
pushq $0x8
popq %rdi
callq 0x5330
movq %rax, %r13
leaq 0x396f6(%rip), %rax     # 0x488a0
movq %rax, (%r13)
jmp 0xf1f3
leaq 0x22309(%rip), %rsi     # 0x314c0
movq %r13, %rdi
callq 0xfe34
testb %al, %al
jne 0xf1da
leaq 0x222fc(%rip), %rsi     # 0x314c6
movq %r13, %rdi
callq 0xfe34
testb %al, %al
je 0xf29d
pushq $0x30
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xf764
movq %r13, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x39de3(%rip), %rdi     # 0x48ff0
leaq 0x2222c(%rip), %rsi     # 0x31440
callq 0x5320
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x5250
leaq 0x2222e(%rip), %rsi     # 0x31463
movq %rax, %rdi
callq 0x5320
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x5250
movq %rax, %rdi
callq 0x51a0
jmp 0xf2b8
movq 0x39d8f(%rip), %rdi     # 0x48ff0
leaq 0x22207(%rip), %rsi     # 0x3146f
callq 0x5320
movq %rax, %rdi
movq %rbp, %rsi
callq 0x5300
movq %rax, %rdi
callq 0x51a0
movq 0x39d69(%rip), %rdi     # 0x48ff0
leaq 0x22211(%rip), %rsi     # 0x3149f
callq 0x5320
movq %rax, %rdi
callq 0x51a0
jmp 0xf2b8
movq 0x39d4c(%rip), %rdi     # 0x48ff0
leaq 0x22222(%rip), %rsi     # 0x314cd
callq 0x5320
movq %rax, %rdi
callq 0x51a0
pushq $0x1
popq %rdi
callq 0x53b0
movq %rax, %r15
pushq $0x30
popq %rsi
movq %r13, %rdi
callq 0x5340
jmp 0xf2d3
movq %rax, %r15
movq %r14, %rdi
callq 0x6002
movq %rbx, %rdi
callq 0x6002
movq %r15, %rdi
callq 0x55b0
nop