// File: /workspace/github_cpp_makefile_star2_O3/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 0x13191
movq %r8, %rbp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13ea0
movq %r14, %rdi
movq %r15, %rsi
callq 0x13ea0
leaq 0x272c5(%rip), %rsi     # 0x3a2d5
movq %rbp, %rdi
callq 0x5110
testl %eax, %eax
je 0x130a8
leaq 0x272b3(%rip), %rsi     # 0x3a2da
movq %rbp, %rdi
callq 0x5110
testl %eax, %eax
je 0x130ac
leaq 0x272e3(%rip), %rsi     # 0x3a31d
movq %rbp, %rdi
callq 0x5110
movl $0x2, %ecx
testl %eax, %eax
je 0x130b1
movq 0x35f9e(%rip), %rdi     # 0x48ff0
leaq 0x27286(%rip), %rsi     # 0x3a2df
movl $0x2f, %edx
callq 0x53b0
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq 0x35f7e(%rip), %rdi     # 0x48ff0
callq 0x53b0
movq %rax, %rdi
callq 0x51a0
movq 0x35f6a(%rip), %rdi     # 0x48ff0
leaq 0x27282(%rip), %rsi     # 0x3a30f
movl $0x19, %edx
callq 0x53b0
movq 0x35f52(%rip), %rdi     # 0x48ff0
callq 0x51a0
jmp 0x1321a
xorl %ecx, %ecx
jmp 0x130b1
movl $0x1, %ecx
movl %ecx, 0x30(%rbx)
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0x2, %rax
jb 0x13101
movsd (%rcx), %xmm0
ucomisd 0x8(%rcx), %xmm0
ja 0x130f6
movl $0x2, %esi
movq %rsi, %rdx
cmpq %rsi, %rax
je 0x130f1
movsd -0x8(%rcx,%rdx,8), %xmm0
leaq 0x1(%rdx), %rsi
ucomisd (%rcx,%rdx,8), %xmm0
jbe 0x130d8
cmpq %rdx, %rax
jbe 0x13101
movq %rbx, %rsi
movq %r14, %rdx
callq 0x12e02
leaq 0x27221(%rip), %rsi     # 0x3a329
movq %r13, %rdi
callq 0x5110
testl %eax, %eax
je 0x13166
leaq 0x27215(%rip), %rsi     # 0x3a330
movq %r13, %rdi
callq 0x5110
testl %eax, %eax
je 0x1313e
leaq 0x27208(%rip), %rsi     # 0x3a336
movq %r13, %rdi
callq 0x5110
testl %eax, %eax
jne 0x131f6
movl $0x30, %edi
callq 0x5340
movq %rax, %r13
leaq 0x3575e(%rip), %rax     # 0x488b0
movq %rax, (%r13)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x137f6
jmp 0x1317e
movl $0x8, %edi
callq 0x5340
movq %rax, %r13
leaq 0x3574e(%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 0x35e58(%rip), %rdi     # 0x48ff0
leaq 0x27111(%rip), %rsi     # 0x3a2b0
movl $0x22, %edx
callq 0x53b0
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
movq 0x35e33(%rip), %rdi     # 0x48ff0
callq 0x5240
movq %rax, %r12
leaq 0x27107(%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 0x1321a
movq 0x35df3(%rip), %rdi     # 0x48ff0
leaq 0x27139(%rip), %rsi     # 0x3a33d
movl $0x1c, %edx
callq 0x53b0
movq 0x35ddb(%rip), %rdi     # 0x48ff0
callq 0x51a0
movl $0x1, %edi
callq 0x53e0
movq %rax, %r15
movl $0x30, %esi
movq %r13, %rdi
callq 0x5350
jmp 0x13239
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1324d
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0x5350
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x13261
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x5350
movq %r15, %rdi
callq 0x55e0
nop