// File: 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
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rsi, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x70(%rbp)
movq %r8, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x76d0
movq -0x60(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x58(%rbp)
callq 0x76d0
movq -0x50(%rbp), %rdi
callq 0x86e0
movq -0x48(%rbp), %rdi
movq %rax, -0x40(%rbp)
callq 0x86e0
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
je 0x260c1
movq 0xbdfc6(%rip), %rdi     # 0xe3ff0
leaq 0x6f037(%rip), %rsi     # 0x95068
callq 0x6420
movq %rax, -0x78(%rbp)
jmp 0x2603c
movq -0x50(%rbp), %rdi
callq 0x86e0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, -0x80(%rbp)
jmp 0x26057
movq -0x80(%rbp), %rdi
leaq 0x6f029(%rip), %rsi     # 0x9508b
callq 0x6420
movq %rax, -0x88(%rbp)
jmp 0x26070
movq -0x48(%rbp), %rdi
callq 0x86e0
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, -0x90(%rbp)
jmp 0x26091
movq -0x90(%rbp), %rdi
movq 0xbded9(%rip), %rsi     # 0xe3f78
callq 0x6470
jmp 0x260a6
movl $0x1, %edi
callq 0x6500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x26382
movq -0x50(%rbp), %rsi
movq -0x60(%rbp), %rdi
callq 0x27ef0
jmp 0x260d0
movq -0x48(%rbp), %rsi
movq -0x60(%rbp), %rdi
addq $0x18, %rdi
callq 0x27ef0
jmp 0x260e3
movq -0x68(%rbp), %rdi
leaq 0x6ef9f(%rip), %rsi     # 0x9508d
callq 0x28140
movb %al, -0x91(%rbp)
jmp 0x260fb
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x26107
jmp 0x26117
movq -0x60(%rbp), %rax
movl $0x0, 0x30(%rax)
jmp 0x26208
movq -0x68(%rbp), %rdi
leaq 0x6ef70(%rip), %rsi     # 0x95092
callq 0x28140
movb %al, -0x92(%rbp)
jmp 0x2612f
movb -0x92(%rbp), %al
testb $0x1, %al
jne 0x2613b
jmp 0x2614b
movq -0x60(%rbp), %rax
movl $0x1, 0x30(%rax)
jmp 0x26206
movq -0x68(%rbp), %rdi
leaq 0x6ef7f(%rip), %rsi     # 0x950d5
callq 0x28140
movb %al, -0x93(%rbp)
jmp 0x26163
movb -0x93(%rbp), %al
testb $0x1, %al
jne 0x2616f
jmp 0x2617f
movq -0x60(%rbp), %rax
movl $0x2, 0x30(%rax)
jmp 0x26204
movq 0xbde6a(%rip), %rdi     # 0xe3ff0
leaq 0x6ef0a(%rip), %rsi     # 0x95097
callq 0x6420
movq %rax, -0xa0(%rbp)
jmp 0x2619b
movq -0x68(%rbp), %rsi
movq -0xa0(%rbp), %rdi
callq 0x6400
movq %rax, -0xa8(%rbp)
jmp 0x261b4
movq -0xa8(%rbp), %rdi
movq 0xbddb6(%rip), %rsi     # 0xe3f78
callq 0x6470
jmp 0x261c9
movq 0xbde20(%rip), %rdi     # 0xe3ff0
leaq 0x6eef0(%rip), %rsi     # 0x950c7
callq 0x6420
movq %rax, -0xb0(%rbp)
jmp 0x261e5
movq -0xb0(%rbp), %rdi
movq 0xbdd85(%rip), %rsi     # 0xe3f78
callq 0x6470
jmp 0x261fa
movl $0x1, %edi
callq 0x6500
jmp 0x26206
jmp 0x26208
movq -0x60(%rbp), %rsi
movq %rsi, %rdi
callq 0x25d40
testb $0x1, %al
jne 0x2621a
jmp 0x26231
movq -0x60(%rbp), %rsi
movq %rsi, %rdx
addq $0x18, %rdx
movq %rsi, %rdi
callq 0x25de0
jmp 0x2622f
jmp 0x26231
movq -0x70(%rbp), %rdi
leaq 0x6eea5(%rip), %rsi     # 0x950e1
callq 0x28140
movb %al, -0xb1(%rbp)
jmp 0x26249
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x26255
jmp 0x2629b
movl $0x8, %edi
callq 0x6430
movq %rax, -0xc0(%rbp)
jmp 0x26268
movq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x6270
movq -0xc0(%rbp), %rdi
callq 0x28170
movq -0xc0(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x26379
movq -0x70(%rbp), %rdi
leaq 0x6ee42(%rip), %rsi     # 0x950e8
callq 0x28140
movb %al, -0xc1(%rbp)
jmp 0x262b3
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x262e3
jmp 0x262bf
movq -0x70(%rbp), %rdi
leaq 0x6ee24(%rip), %rsi     # 0x950ee
callq 0x28140
movb %al, -0xc2(%rbp)
jmp 0x262d7
movb -0xc2(%rbp), %al
testb $0x1, %al
jne 0x262e3
jmp 0x2633c
movl $0x30, %edi
callq 0x6430
movq %rax, -0xd0(%rbp)
jmp 0x262f6
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rsi
movq -0xd0(%rbp), %rdi
callq 0x26eb0
jmp 0x2630c
movq -0x60(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, 0x38(%rax)
jmp 0x26377
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x30, %esi
callq 0x6440
jmp 0x26382
movq 0xbdcad(%rip), %rdi     # 0xe3ff0
leaq 0x6edab(%rip), %rsi     # 0x950f5
callq 0x6420
movq %rax, -0xd8(%rbp)
jmp 0x26358
movq -0xd8(%rbp), %rdi
movq 0xbdc12(%rip), %rsi     # 0xe3f78
callq 0x6470
jmp 0x2636d
movl $0x1, %edi
callq 0x6500
jmp 0x26379
addq $0xe0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x7760
movq -0x60(%rbp), %rdi
callq 0x7760
movq -0x30(%rbp), %rdi
callq 0x6760
nopl (%rax)