#include "asset.cuh"

#include <math.h>
#include <numeric>
#include <algorithm>

#include <stdio.h>


namespace fin
{

CUDA_CALLABLE_MEMBER
Asset::Asset(int id)
{
  this->id = id;
  this->size = 0;
  this->closes = 0;
}

CUDA_CALLABLE_MEMBER
Asset::Asset()
{
  this->id = -1;
  this->size = 0;
  this->closes = 0;
}

CUDA_CALLABLE_MEMBER
Asset::Asset(const Asset& asset)
{
    this->id = asset.id;
    this->size = asset.size;
    this->closes = 0;
    if (asset.closes != 0)
    {
        // deep copy asset closes
        this->closes = new Close [asset.size];
        for (int i = 0; i < asset.size; ++i)
            this->closes[i] = asset.closes[i];
    }
}

CUDA_CALLABLE_MEMBER
Asset Asset::operator=(const Asset& asset)
{
    this->id = asset.id;
    this->size = asset.size;
    this->closes = 0;
    if (asset.closes != 0)
    {
        // deep copy asset closes
        this->closes = new Close [asset.size];
        for (int i = 0; i < asset.size; ++i)
            this->closes[i] = asset.closes[i];
    } else 
        printf("Hahaaa = \n");
    return *this;
}

    
CUDA_CALLABLE_MEMBER
Asset::~Asset()
{
    if (this->closes != 0) 
    {
        delete [] this->closes;
        this->closes = 0;
    }
}


void Asset::set_closes(std::vector<Close> closes)
{
  if (closes.size() == 0) 
  {
      printf("closes is empty\n");
      return;
  }
  // sort closes by date
  this->sort_closes(closes);
  // set closes size
  this->size = closes.size();
  // delete old closes if existing
  if (this->closes != 0)
  {
      delete [] this->closes;
      this->closes = 0;
  }
  // allocate closes
  this->closes = new Close[this->size];
  // set closes
  for (int i = 0; i < this->size; ++i)
    this->closes[i] = closes[i];
}

CUDA_CALLABLE_MEMBER
void Asset::set_id(int id)
{
  if (id > 0)
    this->id = id;
}

CUDA_CALLABLE_MEMBER
int Asset::get_id()
{
  return this->id;
}

CUDA_CALLABLE_MEMBER
Close* Asset::get_closes(int *n) const
{
  *n = this->size;
  // allocate memory for closes
  Close* closes = new Close[*n];
  // set closes
  for (int i = 0; i < *n; ++i)
    closes[i] = this->closes[i];
  return closes;
}

CUDA_CALLABLE_MEMBER
Close* Asset::get_closes(hlp::Date start_date, hlp::Date end_date,
        int *n) const
{
  int start = 0;
  int end = -1;
  // get period (start -> end)
  for(int i = 0; i < this->size; ++i)
  {
      if (this->closes[i].date == start_date)
          start = i;
      if (this->closes[i].date == end_date) 
      {
          end = i;
          continue;
      }
  }
  // set size of return array
  *n = end - start;
  if (*n <= 0)
  {
      printf("Woow, couldn't find closes with theses dates\n");
      return 0;
  }
  // allocate memory for closes
  Close* closes = new Close[*n];
  // set closes
  for (int i = 0; i < *n; ++i)
      closes[i] = this->closes[i + start];
  return closes;
}

CUDA_CALLABLE_MEMBER
float Asset::get_return() const
{
  float v1 = this->closes[0].value;
  float v2 = this->closes[this->size - 1].value;
  return (v2 - v1) / v1;
}

CUDA_CALLABLE_MEMBER
float Asset::get_return(hlp::Date start_date, hlp::Date end_date) const
{
  float v1, v2;
  for (int i = 0; i < this->size; ++i) {
    Close close = this->closes[i];
    if (close.date == start_date)
      v1 = close.value;
    if (close.date == end_date)
      v2 = close.value;
  }
  return (v2 - v1) / v1;
}

CUDA_CALLABLE_MEMBER
float* Asset::get_returns(int *n) const
{
  *n = this->size - 1;
  // allocate memory for returns
  float* returns = new float[*n];
  // compute all daily returns on that period
  for (int i = 0; i < *n; ++i) {
      float v1 = this->closes[i].value;
      float v2 = this->closes[i + 1].value;
      returns[i] = (v2 - v1) / v1;
  }

  return returns;
}

CUDA_CALLABLE_MEMBER
float* Asset::get_returns(hlp::Date start_date, hlp::Date end_date,
        int* n) const
{
  // get asset closes on this period (start->end)
  Close* closes = this->get_closes(start_date, end_date, n);
  // set n to returns size (closes - 1: it's dayly return)
  *n -= 1;
  // allocate memory for returns
  float* returns = new float[*n];
  // compute all daily returns on that period
  for (int i = 0; i < *n; ++i) {
    float v1 = closes[i].value;
    float v2 = closes[i + 1].value;
    returns[i] = (v2 - v1) / v1;
  }
  // free memory reserved for closes
  delete[] closes;
  return returns;
}

CUDA_CALLABLE_MEMBER
float Asset::get_volatility() const
{
  int n;
  // get daily returns
  float* returns = this->get_returns(&n);
  // compute average return
  float avg = 0;
  for (int i = 0; i < n; ++i)
    avg += returns[i];
  avg /= n;
  // compute variance
  float var = 0;
  for (int i = 0; i < n; ++i)
    var += pow(returns[i] - avg, 2);
  var /= n;
  // free memory of daily returns
  delete[] returns;
  // return volatility: sqrt(variance)
  return sqrtf(var);
}

CUDA_CALLABLE_MEMBER
float Asset::get_volatility(hlp::Date start_date, hlp::Date end_date) const
{
  int n;
  // get dayly returns
  float* returns = this->get_returns(start_date, end_date, &n);
  // compute average return
  float avg = 0;
  for (int i = 0; i < n; ++i)
    avg += returns[i];
  avg /= n;
  // compute variance
  float var = 0;
  for (int i = 0; i < n; ++i)
    var += pow(returns[i] - avg, 2);
  var /= n;
  // free memory of daily returns
  delete[] returns;
  // return volatility: sqrt(variance)
  return sqrtf(var);
}

CUDA_CALLABLE_MEMBER 
float Asset::get_sharp() const
{
    float ret = this->get_return();
    float vol = this->get_volatility();
    return ret / vol;
}
  
CUDA_CALLABLE_MEMBER 
float Asset::get_sharp(hlp::Date start_date, hlp::Date end_date) const
{
    float ret = this->get_return(start_date, end_date);
    float vol = this->get_volatility(start_date, end_date);
    return ret / vol;
}

// sort using a custom function object
bool date_less(Close a, Close b)
{
  return a.date < b.date;
}

// sort closes by date
void Asset::sort_closes(std::vector<Close> closes)
{
  std::sort(closes.begin(), closes.end(), date_less);
}

}

	.file	"tmpxft_0021fb55_00000000-6_asset.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.globl	_ZN3fin9date_lessENS_5CloseES0_
	.type	_ZN3fin9date_lessENS_5CloseES0_, @function
_ZN3fin9date_lessENS_5CloseES0_:
.LFB4305:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	%rdi, 16(%rsp)
	leaq	16(%rsp), %rdi
	movq	%rsi, 24(%rsp)
	movq	%rsp, %rsi
	movq	%rdx, (%rsp)
	movq	%rcx, 8(%rsp)
	call	_ZNK3hlp4DateltERKS0_@PLT
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4305:
	.size	_ZN3fin9date_lessENS_5CloseES0_, .-_ZN3fin9date_lessENS_5CloseES0_
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4309:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4309:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0, @function
_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0:
.LFB5089:
	.cfi_startproc
	movq	8(%rdx), %rcx
	movq	%rdi, %rax
	movq	(%rdx), %rdx
	movq	(%rsi), %rdi
	movq	8(%rsi), %rsi
	jmp	*%rax
	.cfi_endproc
.LFE5089:
	.size	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0, .-_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	.align 2
	.globl	_ZN3fin5AssetC2Ei
	.type	_ZN3fin5AssetC2Ei, @function
_ZN3fin5AssetC2Ei:
.LFB4280:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	xorl	%edx, %edx
	movl	%esi, (%rdi)
	movl	%eax, 4(%rdi)
	movq	%rdx, 8(%rdi)
	ret
	.cfi_endproc
.LFE4280:
	.size	_ZN3fin5AssetC2Ei, .-_ZN3fin5AssetC2Ei
	.globl	_ZN3fin5AssetC1Ei
	.set	_ZN3fin5AssetC1Ei,_ZN3fin5AssetC2Ei
	.align 2
	.globl	_ZN3fin5AssetC2Ev
	.type	_ZN3fin5AssetC2Ev, @function
_ZN3fin5AssetC2Ev:
.LFB4283:
	.cfi_startproc
	endbr64
	movl	$4294967295, %eax
	movq	%rax, (%rdi)
	xorl	%eax, %eax
	movq	%rax, 8(%rdi)
	ret
	.cfi_endproc
.LFE4283:
	.size	_ZN3fin5AssetC2Ev, .-_ZN3fin5AssetC2Ev
	.globl	_ZN3fin5AssetC1Ev
	.set	_ZN3fin5AssetC1Ev,_ZN3fin5AssetC2Ev
	.align 2
	.globl	_ZN3fin5AssetC2ERKS0_
	.type	_ZN3fin5AssetC2ERKS0_, @function
_ZN3fin5AssetC2ERKS0_:
.LFB4286:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	xorl	%ecx, %ecx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	pushq	%rdx
	.cfi_def_cfa_offset 32
	movq	(%rsi), %rax
	cmpq	$0, 8(%rsi)
	movslq	4(%rsi), %rdi
	movq	%rcx, 8(%rbp)
	movq	%rax, 0(%rbp)
	je	.L7
	movabsq	$576460752303423487, %rax
	cmpq	%rdi, %rax
	jb	.L9
	salq	$4, %rdi
	movq	%rsi, %rbx
	call	_Znam@PLT
	movl	4(%rbx), %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movq	%rax, 8(%rbp)
	jmp	.L10
.L9:
	call	__cxa_throw_bad_array_new_length@PLT
.L10:
	cmpl	%ecx, %esi
	jle	.L7
	movq	8(%rbx), %rdi
	incl	%ecx
	movups	(%rdi,%rdx), %xmm0
	movups	%xmm0, (%rax,%rdx)
	addq	$16, %rdx
	jmp	.L10
.L7:
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4286:
	.size	_ZN3fin5AssetC2ERKS0_, .-_ZN3fin5AssetC2ERKS0_
	.globl	_ZN3fin5AssetC1ERKS0_
	.set	_ZN3fin5AssetC1ERKS0_,_ZN3fin5AssetC2ERKS0_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Hahaaa = \n"
	.text
	.align 2
	.globl	_ZN3fin5AssetaSERKS0_
	.type	_ZN3fin5AssetaSERKS0_, @function
_ZN3fin5AssetaSERKS0_:
.LFB4288:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	(%rdx), %eax
	movq	%rsi, %rbx
	movslq	4(%rdx), %rdi
	movl	%eax, (%rsi)
	xorl	%eax, %eax
	movq	%rax, 8(%rsi)
	cmpq	$0, 8(%rdx)
	movl	%edi, 4(%rsi)
	je	.L16
	movabsq	$576460752303423487, %rax
	cmpq	%rdi, %rax
	jb	.L17
	salq	$4, %rdi
	movq	%rdx, %rbp
	call	_Znam@PLT
	movl	4(%rbp), %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movq	%rax, 8(%rbx)
	jmp	.L18
.L17:
	call	__cxa_throw_bad_array_new_length@PLT
.L18:
	cmpl	%ecx, %esi
	jle	.L20
	movq	8(%rbp), %rdi
	incl	%ecx
	movups	(%rdi,%rdx), %xmm0
	movups	%xmm0, (%rax,%rdx)
	addq	$16, %rdx
	jmp	.L18
.L16:
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	_ZN3fin5AssetC1ERKS0_
	movq	%r12, %rax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4288:
	.size	_ZN3fin5AssetaSERKS0_, .-_ZN3fin5AssetaSERKS0_
	.align 2
	.globl	_ZN3fin5AssetD2Ev
	.type	_ZN3fin5AssetD2Ev, @function
_ZN3fin5AssetD2Ev:
.LFB4290:
	.cfi_startproc
	endbr64
	movq	8(%rdi), %rdi
	testq	%rdi, %rdi
	je	.L22
	jmp	_ZdaPv@PLT
.L22:
	ret
	.cfi_endproc
.LFE4290:
	.size	_ZN3fin5AssetD2Ev, .-_ZN3fin5AssetD2Ev
	.globl	_ZN3fin5AssetD1Ev
	.set	_ZN3fin5AssetD1Ev,_ZN3fin5AssetD2Ev
	.align 2
	.globl	_ZN3fin5Asset6set_idEi
	.type	_ZN3fin5Asset6set_idEi, @function
_ZN3fin5Asset6set_idEi:
.LFB4293:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L24
	movl	%esi, (%rdi)
.L24:
	ret
	.cfi_endproc
.LFE4293:
	.size	_ZN3fin5Asset6set_idEi, .-_ZN3fin5Asset6set_idEi
	.align 2
	.globl	_ZN3fin5Asset6get_idEv
	.type	_ZN3fin5Asset6get_idEv, @function
_ZN3fin5Asset6get_idEv:
.LFB4294:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE4294:
	.size	_ZN3fin5Asset6get_idEv, .-_ZN3fin5Asset6get_idEv
	.align 2
	.globl	_ZNK3fin5Asset10get_closesEPi
	.type	_ZNK3fin5Asset10get_closesEPi, @function
_ZNK3fin5Asset10get_closesEPi:
.LFB4295:
	.cfi_startproc
	endbr64
	movabsq	$576460752303423487, %rax
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	movslq	4(%rdi), %rdi
	movl	%edi, (%rsi)
	cmpq	%rdi, %rax
	jb	.L28
	movq	%rsi, %rbp
	salq	$4, %rdi
	call	_Znam@PLT
	movl	0(%rbp), %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L29
.L28:
	call	__cxa_throw_bad_array_new_length@PLT
.L29:
	cmpl	%ecx, %esi
	jle	.L32
	movq	8(%rbx), %rdi
	incl	%ecx
	movups	(%rdi,%rdx), %xmm0
	movups	%xmm0, (%rax,%rdx)
	addq	$16, %rdx
	jmp	.L29
.L32:
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4295:
	.size	_ZNK3fin5Asset10get_closesEPi, .-_ZNK3fin5Asset10get_closesEPi
	.section	.rodata.str1.1
.LC1:
	.string	"Woow, couldn't find closes with theses dates\n"
	.text
	.align 2
	.globl	_ZNK3fin5Asset10get_closesEN3hlp4DateES2_Pi
	.type	_ZNK3fin5Asset10get_closesEN3hlp4DateES2_Pi, @function
_ZNK3fin5Asset10get_closesEN3hlp4DateES2_Pi:
.LFB4296:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r9, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	orl	$-1, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	leaq	32(%rsp), %rax
	movq	%rsi, 32(%rsp)
	movl	%edx, 40(%rsp)
	movq	%rcx, 16(%rsp)
	movl	%r8d, 24(%rsp)
	movq	%rax, (%rsp)
.L34:
	movl	%r14d, %r15d
	cmpl	%r14d, 4(%r13)
	jle	.L44
	movq	%r14, %rdx
	movq	(%rsp), %rsi
	salq	$4, %rdx
	movq	%rdx, %rdi
	addq	8(%r13), %rdi
	movq	%rdx, 8(%rsp)
	call	_ZNK3hlp4DateeqERKS0_@PLT
	movq	8(%rsp), %rdx
	leaq	16(%rsp), %rsi
	testb	%al, %al
	cmovne	%r14d, %ebp
	addq	8(%r13), %rdx
	movq	%rdx, %rdi
	call	_ZNK3hlp4DateeqERKS0_@PLT
	testb	%al, %al
	cmove	%ebx, %r15d
	incq	%r14
	movl	%r15d, %ebx
	jmp	.L34
.L44:
	subl	%ebp, %ebx
	movl	%ebx, (%r12)
	testl	%ebx, %ebx
	jg	.L38
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L33
.L38:
	movslq	%ebx, %rdi
	movslq	%ebp, %rbp
	salq	$4, %rdi
	salq	$4, %rbp
	call	_Znam@PLT
	movl	(%r12), %ecx
	xorl	%edx, %edx
.L40:
	cmpl	%edx, %ecx
	jle	.L33
	movq	8(%r13), %rdi
	movq	%rdx, %rsi
	incq	%rdx
	salq	$4, %rsi
	movups	(%rdi,%rbp), %xmm0
	addq	$16, %rbp
	movups	%xmm0, (%rax,%rsi)
	jmp	.L40
.L33:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4296:
	.size	_ZNK3fin5Asset10get_closesEN3hlp4DateES2_Pi, .-_ZNK3fin5Asset10get_closesEN3hlp4DateES2_Pi
	.align 2
	.globl	_ZNK3fin5Asset10get_returnEv
	.type	_ZNK3fin5Asset10get_returnEv, @function
_ZNK3fin5Asset10get_returnEv:
.LFB4297:
	.cfi_startproc
	endbr64
	movslq	4(%rdi), %rax
	movq	8(%rdi), %rdx
	salq	$4, %rax
	movss	12(%rdx), %xmm1
	movss	-4(%rdx,%rax), %xmm0
	subss	%xmm1, %xmm0
	divss	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE4297:
	.size	_ZNK3fin5Asset10get_returnEv, .-_ZNK3fin5Asset10get_returnEv
	.align 2
	.globl	_ZNK3fin5Asset10get_returnEN3hlp4DateES2_
	.type	_ZNK3fin5Asset10get_returnEN3hlp4DateES2_, @function
_ZNK3fin5Asset10get_returnEN3hlp4DateES2_:
.LFB4298:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	xorl	%ebx, %ebx
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	movq	%rsi, 32(%rsp)
	leaq	32(%rsp), %r12
	movl	%edx, 40(%rsp)
	movq	%rcx, 16(%rsp)
	movl	%r8d, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
.L47:
	cmpl	%ebx, 4(%rbp)
	jle	.L59
	movq	%rbx, %rax
	leaq	56(%rsp), %r13
	movq	%r12, %rsi
	salq	$4, %rax
	addq	8(%rbp), %rax
	movq	%r13, %rdi
	movups	(%rax), %xmm1
	movups	%xmm1, 56(%rsp)
	call	_ZNK3hlp4DateeqERKS0_@PLT
	testb	%al, %al
	je	.L48
	movss	68(%rsp), %xmm2
	movss	%xmm2, 12(%rsp)
.L48:
	leaq	16(%rsp), %rsi
	movq	%r13, %rdi
	call	_ZNK3hlp4DateeqERKS0_@PLT
	testb	%al, %al
	je	.L49
	movss	68(%rsp), %xmm3
	movd	%xmm3, %r14d
.L49:
	incq	%rbx
	jmp	.L47
.L59:
	movd	%r14d, %xmm0
	subss	12(%rsp), %xmm0
	divss	12(%rsp), %xmm0
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L51
	call	__stack_chk_fail@PLT
.L51:
	addq	$80, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4298:
	.size	_ZNK3fin5Asset10get_returnEN3hlp4DateES2_, .-_ZNK3fin5Asset10get_returnEN3hlp4DateES2_
	.align 2
	.globl	_ZNK3fin5Asset11get_returnsEPi
	.type	_ZNK3fin5Asset11get_returnsEPi, @function
_ZNK3fin5Asset11get_returnsEPi:
.LFB4299:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	movl	4(%rdi), %eax
	leal	-1(%rax), %edi
	movabsq	$2305843009213693950, %rax
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	cmpq	%rdi, %rax
	jb	.L61
	movq	%rsi, %rbp
	salq	$2, %rdi
	call	_Znam@PLT
	movl	0(%rbp), %r8d
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L62
.L61:
	call	__cxa_throw_bad_array_new_length@PLT
.L62:
	leaq	16(%rcx), %rsi
	cmpl	%edx, %r8d
	jle	.L65
	movq	8(%rbx), %rdi
	movss	12(%rdi,%rcx), %xmm1
	movss	12(%rdi,%rsi), %xmm0
	movq	%rsi, %rcx
	subss	%xmm1, %xmm0
	divss	%xmm1, %xmm0
	movss	%xmm0, (%rax,%rdx,4)
	incq	%rdx
	jmp	.L62
.L65:
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4299:
	.size	_ZNK3fin5Asset11get_returnsEPi, .-_ZNK3fin5Asset11get_returnsEPi
	.align 2
	.globl	_ZNK3fin5Asset11get_returnsEN3hlp4DateES2_Pi
	.type	_ZNK3fin5Asset11get_returnsEN3hlp4DateES2_Pi, @function
_ZNK3fin5Asset11get_returnsEN3hlp4DateES2_Pi:
.LFB4300:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%r9, %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%rsi, 16(%rsp)
	movl	%edx, 24(%rsp)
	movq	%rcx, (%rsp)
	movl	%r8d, 8(%rsp)
	call	_ZNK3fin5Asset10get_closesEN3hlp4DateES2_Pi
	movq	%rax, %rbp
	movl	(%rbx), %eax
	leal	-1(%rax), %edi
	movabsq	$2305843009213693950, %rax
	movl	%edi, (%rbx)
	movslq	%edi, %rdi
	cmpq	%rdi, %rax
	jb	.L67
	salq	$2, %rdi
	call	_Znam@PLT
	movl	(%rbx), %ecx
	leaq	12(%rbp), %rdx
	movq	%rax, %r12
	xorl	%eax, %eax
	jmp	.L68
.L67:
	call	__cxa_throw_bad_array_new_length@PLT
.L68:
	addq	$16, %rdx
	cmpl	%eax, %ecx
	jle	.L75
	movss	-16(%rdx), %xmm1
	movss	(%rdx), %xmm0
	subss	%xmm1, %xmm0
	divss	%xmm1, %xmm0
	movss	%xmm0, (%r12,%rax,4)
	incq	%rax
	jmp	.L68
.L75:
	testq	%rbp, %rbp
	je	.L66
	movq	%rbp, %rdi
	call	_ZdaPv@PLT
.L66:
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	movq	%r12, %rax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4300:
	.size	_ZNK3fin5Asset11get_returnsEN3hlp4DateES2_Pi, .-_ZNK3fin5Asset11get_returnsEN3hlp4DateES2_Pi
	.align 2
	.globl	_ZNK3fin5Asset14get_volatilityEv
	.type	_ZNK3fin5Asset14get_volatilityEv, @function
_ZNK3fin5Asset14get_volatilityEv:
.LFB4301:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	_ZNK3fin5Asset11get_returnsEPi
	movl	20(%rsp), %edx
	xorps	%xmm2, %xmm2
	movq	%rax, %rdi
	xorl	%eax, %eax
.L77:
	cmpl	%eax, %edx
	jle	.L88
	addss	(%rdi,%rax,4), %xmm2
	incq	%rax
	jmp	.L77
.L88:
	cvtsi2ssl	%edx, %xmm3
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
	divss	%xmm3, %xmm2
.L79:
	cmpl	%eax, %edx
	jle	.L89
	movss	(%rdi,%rax,4), %xmm1
	cvtss2sd	%xmm0, %xmm0
	incq	%rax
	subss	%xmm2, %xmm1
	cvtss2sd	%xmm1, %xmm1
	mulsd	%xmm1, %xmm1
	addsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	jmp	.L79
.L89:
	divss	%xmm3, %xmm0
	testq	%rdi, %rdi
	je	.L81
	movss	%xmm0, 12(%rsp)
	call	_ZdaPv@PLT
	movss	12(%rsp), %xmm0
.L81:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L82
	call	__stack_chk_fail@PLT
.L82:
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	sqrtf@PLT
	.cfi_endproc
.LFE4301:
	.size	_ZNK3fin5Asset14get_volatilityEv, .-_ZNK3fin5Asset14get_volatilityEv
	.align 2
	.globl	_ZNK3fin5Asset14get_volatilityEN3hlp4DateES2_
	.type	_ZNK3fin5Asset14get_volatilityEN3hlp4DateES2_, @function
_ZNK3fin5Asset14get_volatilityEN3hlp4DateES2_:
.LFB4302:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	movl	%edx, 40(%rsp)
	leaq	52(%rsp), %r9
	movq	%rsi, 32(%rsp)
	movq	%rcx, 16(%rsp)
	movl	%r8d, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	_ZNK3fin5Asset11get_returnsEN3hlp4DateES2_Pi
	movl	52(%rsp), %edx
	xorps	%xmm2, %xmm2
	movq	%rax, %rdi
	xorl	%eax, %eax
.L91:
	cmpl	%eax, %edx
	jle	.L102
	addss	(%rdi,%rax,4), %xmm2
	incq	%rax
	jmp	.L91
.L102:
	cvtsi2ssl	%edx, %xmm3
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
	divss	%xmm3, %xmm2
.L93:
	cmpl	%eax, %edx
	jle	.L103
	movss	(%rdi,%rax,4), %xmm1
	cvtss2sd	%xmm0, %xmm0
	incq	%rax
	subss	%xmm2, %xmm1
	cvtss2sd	%xmm1, %xmm1
	mulsd	%xmm1, %xmm1
	addsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	jmp	.L93
.L103:
	divss	%xmm3, %xmm0
	testq	%rdi, %rdi
	je	.L95
	movss	%xmm0, 12(%rsp)
	call	_ZdaPv@PLT
	movss	12(%rsp), %xmm0
.L95:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L96
	call	__stack_chk_fail@PLT
.L96:
	addq	$72, %rsp
	.cfi_def_cfa_offset 8
	jmp	sqrtf@PLT
	.cfi_endproc
.LFE4302:
	.size	_ZNK3fin5Asset14get_volatilityEN3hlp4DateES2_, .-_ZNK3fin5Asset14get_volatilityEN3hlp4DateES2_
	.align 2
	.globl	_ZNK3fin5Asset9get_sharpEv
	.type	_ZNK3fin5Asset9get_sharpEv, @function
_ZNK3fin5Asset9get_sharpEv:
.LFB4303:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	call	_ZNK3fin5Asset10get_returnEv
	movss	%xmm0, 12(%rsp)
	call	_ZNK3fin5Asset14get_volatilityEv
	movss	12(%rsp), %xmm1
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	divss	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE4303:
	.size	_ZNK3fin5Asset9get_sharpEv, .-_ZNK3fin5Asset9get_sharpEv
	.align 2
	.globl	_ZNK3fin5Asset9get_sharpEN3hlp4DateES2_
	.type	_ZNK3fin5Asset9get_sharpEN3hlp4DateES2_, @function
_ZNK3fin5Asset9get_sharpEN3hlp4DateES2_:
.LFB4304:
	.cfi_startproc
	endbr64
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	movq	%rsi, 32(%rsp)
	movl	%edx, 40(%rsp)
	movq	%rcx, 16(%rsp)
	movl	%r8d, 24(%rsp)
	movq	%rdi, 8(%rsp)
	call	_ZNK3fin5Asset10get_returnEN3hlp4DateES2_
	movq	16(%rsp), %rcx
	movl	24(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	movss	%xmm0, 4(%rsp)
	movq	8(%rsp), %rdi
	call	_ZNK3fin5Asset14get_volatilityEN3hlp4DateES2_
	movss	4(%rsp), %xmm1
	addq	$56, %rsp
	.cfi_def_cfa_offset 8
	divss	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE4304:
	.size	_ZNK3fin5Asset9get_sharpEN3hlp4DateES2_, .-_ZNK3fin5Asset9get_sharpEN3hlp4DateES2_
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4332:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4332:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev,"axG",@progbits,_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED5Ev,comdat
	.align 2
	.weak	_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev
	.type	_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev, @function
_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev:
.LFB4795:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L110
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L110:
	ret
	.cfi_endproc
.LFE4795:
	.size	_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev, .-_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev
	.weak	_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED1Ev
	.set	_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED1Ev,_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev
	.section	.text._ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_,"axG",@progbits,_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_,comdat
	.weak	_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_
	.type	_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_, @function
_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_:
.LFB5034:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-16(%rdi), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movups	(%rdi), %xmm0
	movups	%xmm0, (%rsp)
.L113:
	movq	(%rbx), %rdx
	movq	8(%rbx), %rcx
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	call	*%rbp
	testb	%al, %al
	je	.L116
	movups	(%rbx), %xmm1
	subq	$16, %rbx
	movups	%xmm1, 32(%rbx)
	jmp	.L113
.L116:
	movups	(%rsp), %xmm2
	movups	%xmm2, 16(%rbx)
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5034:
	.size	_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_, .-_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_
	.section	.text._ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_,"axG",@progbits,_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_,comdat
	.weak	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_
	.type	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_, @function
_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_:
.LFB4993:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%rdx, (%rsp)
	cmpq	%rdi, %rsi
	je	.L117
	movq	%rdi, %rbp
	movq	%rsi, %r12
	leaq	16(%rdi), %rbx
.L119:
	cmpq	%rbx, %r12
	je	.L117
	movq	(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	testb	%al, %al
	je	.L120
	movq	%rbx, %rdx
	movl	(%rbx), %r14d
	movl	4(%rbx), %r13d
	subq	%rbp, %rdx
	movl	8(%rbx), %r15d
	movss	12(%rbx), %xmm0
	cmpq	$16, %rdx
	jle	.L121
	movl	$16, %edi
	movq	%rbp, %rsi
	movss	%xmm0, 12(%rsp)
	subq	%rdx, %rdi
	addq	%rbx, %rdi
	call	memmove@PLT
	movss	12(%rsp), %xmm0
	jmp	.L122
.L121:
	jne	.L122
	movups	0(%rbp), %xmm1
	movups	%xmm1, (%rbx)
.L122:
	movl	%r14d, 0(%rbp)
	movl	%r13d, 4(%rbp)
	movl	%r15d, 8(%rbp)
	movss	%xmm0, 12(%rbp)
	jmp	.L123
.L120:
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	call	_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_
.L123:
	addq	$16, %rbx
	jmp	.L119
.L117:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4993:
	.size	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_, .-_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_
	.section	.text._ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_,"axG",@progbits,_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_,comdat
	.weak	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_
	.type	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_, @function
_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_:
.LFB5070:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	-1(%rdx), %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r9, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	cqto
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rcx, 16(%rsp)
	movl	$2, %ecx
	idivq	%rcx
	movq	%r8, 24(%rsp)
	movq	%rax, (%rsp)
.L130:
	cmpq	%rbx, (%rsp)
	jle	.L141
	leaq	1(%rbx), %rcx
	movq	%r14, %rdi
	addq	%rcx, %rcx
	leaq	-1(%rcx), %r15
	movq	%rcx, %rsi
	movq	%rcx, 8(%rsp)
	movq	%r15, %rdx
	salq	$4, %rsi
	salq	$4, %rdx
	addq	%rbp, %rsi
	addq	%rbp, %rdx
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	movq	8(%rsp), %rcx
	testb	%al, %al
	cmove	%rcx, %r15
	salq	$4, %rbx
	movq	%r15, %rax
	salq	$4, %rax
	movups	0(%rbp,%rax), %xmm0
	movups	%xmm0, 0(%rbp,%rbx)
	movq	%r15, %rbx
	jmp	.L130
.L141:
	testl	$1, %r12d
	jne	.L133
	leaq	-2(%r12), %rax
	movl	$2, %ecx
	cqto
	idivq	%rcx
	cmpq	%rbx, %rax
	jne	.L133
	leaq	1(%rbx,%rbx), %rax
	salq	$4, %rbx
	movq	%rax, %rdx
	salq	$4, %rdx
	movups	0(%rbp,%rdx), %xmm1
	movups	%xmm1, 0(%rbp,%rbx)
	movq	%rax, %rbx
.L133:
	leaq	-1(%rbx), %rax
	movl	$2, %ecx
	movups	16(%rsp), %xmm2
	cqto
	idivq	%rcx
	movups	%xmm2, 32(%rsp)
.L140:
	movq	%rbx, %r8
	movq	%rax, %r12
	salq	$4, %r8
	leaq	0(%rbp,%r8), %r15
	cmpq	%rbx, %r13
	jge	.L134
	movq	%rax, %rbx
	movq	32(%rsp), %rdx
	movq	40(%rsp), %rcx
	salq	$4, %rbx
	addq	%rbp, %rbx
	movq	(%rbx), %rdi
	movq	8(%rbx), %rsi
	call	*%r14
	testb	%al, %al
	je	.L134
	movups	(%rbx), %xmm3
	leaq	-1(%r12), %rax
	movl	$2, %edi
	movq	%r12, %rbx
	cqto
	idivq	%rdi
	movups	%xmm3, (%r15)
	jmp	.L140
.L134:
	movups	32(%rsp), %xmm4
	movups	%xmm4, (%r15)
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5070:
	.size	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_, .-_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_
	.section	.text._ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_,"axG",@progbits,_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_,comdat
	.weak	_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_
	.type	_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_, @function
_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_:
.LFB5071:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rdx
	movq	8(%rdi), %rax
	movups	(%rsi), %xmm0
	movups	%xmm0, (%rdi)
	movq	%rdx, (%rsi)
	movq	%rax, 8(%rsi)
	ret
	.cfi_endproc
.LFE5071:
	.size	_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_, .-_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_
	.section	.text._ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_,"axG",@progbits,_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_,comdat
	.weak	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_
	.type	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_, @function
_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_:
.LFB4918:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	16(%rdi), %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%rcx, (%rsp)
	movq	%rax, 8(%rsp)
.L144:
	movq	%rbp, %rax
	subq	%rbx, %rax
	cmpq	$256, %rax
	jle	.L143
	movq	%rax, %r12
	sarq	$4, %r12
	testq	%r13, %r13
	jne	.L145
	leaq	-2(%r12), %r13
	sarq	%r13
.L148:
	movq	%r13, %rax
	movq	(%rsp), %r9
	movq	%r12, %rdx
	movq	%r13, %rsi
	salq	$4, %rax
	movq	%rbx, %rdi
	movups	(%rbx,%rax), %xmm0
	movups	%xmm0, 16(%rsp)
	movq	24(%rsp), %r8
	movq	%xmm0, %rcx
	call	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_
	testq	%r13, %r13
	je	.L147
	decq	%r13
	jmp	.L148
.L147:
	movq	%rbp, %rax
	subq	$16, %rbp
	subq	%rbx, %rax
	cmpq	$16, %rax
	jle	.L143
	movups	0(%rbp), %xmm0
	movups	(%rbx), %xmm1
	movq	%rbp, %rdx
	xorl	%esi, %esi
	subq	%rbx, %rdx
	movq	(%rsp), %r9
	movq	%rbx, %rdi
	movups	%xmm0, 16(%rsp)
	movq	24(%rsp), %r8
	movq	%xmm0, %rcx
	sarq	$4, %rdx
	movups	%xmm1, 0(%rbp)
	call	_ZSt13__adjust_heapIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElS3_NS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_T0_SF_T1_T2_
	jmp	.L147
.L145:
	sarq	$5, %rax
	movq	8(%rsp), %r12
	movq	(%rsp), %rdi
	leaq	-16(%rbp), %r15
	salq	$4, %rax
	leaq	(%rbx,%rax), %r14
	movq	%r12, %rsi
	movq	%r14, %rdx
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	movq	%r15, %rdx
	testb	%al, %al
	je	.L151
	movq	(%rsp), %rdi
	movq	%r14, %rsi
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	testb	%al, %al
	jne	.L156
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movq	%r15, %rdx
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	testb	%al, %al
	je	.L166
	jmp	.L167
.L151:
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	testb	%al, %al
	je	.L155
.L166:
	movq	8(%rsp), %rsi
	jmp	.L165
.L155:
	movq	(%rsp), %rdi
	movq	%r15, %rdx
	movq	%r14, %rsi
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	testb	%al, %al
	je	.L156
.L167:
	movq	%r15, %rsi
	jmp	.L165
.L156:
	movq	%r14, %rsi
.L165:
	movq	%rbx, %rdi
	movq	%rbp, %r15
	call	_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_
.L160:
	movq	%r12, %rax
.L157:
	movq	(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%rax, %rsi
	movq	%rax, %r12
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	movl	%eax, %edx
	leaq	16(%r12), %rax
	testb	%dl, %dl
	jne	.L157
	leaq	-16(%r15), %r14
.L158:
	movq	(%rsp), %rdi
	movq	%r14, %rdx
	movq	%rbx, %rsi
	movq	%r14, %r15
	subq	$16, %r14
	call	_ZN9__gnu_cxx5__ops15_Iter_comp_iterIPFbN3fin5CloseES3_EEclINS_17__normal_iteratorIPS3_St6vectorIS3_SaIS3_EEEESD_EEbT_T0_.isra.0
	testb	%al, %al
	jne	.L158
	cmpq	%r15, %r12
	jb	.L159
	movq	(%rsp), %rcx
	decq	%r13
	movq	%rbp, %rsi
	movq	%r12, %rdi
	movq	%r13, %rdx
	movq	%r12, %rbp
	call	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_
	jmp	.L144
.L159:
	movq	%r12, %rdi
	movq	%r15, %rsi
	addq	$16, %r12
	call	_ZSt4swapIN3fin5CloseEENSt9enable_ifIXsrSt6__and_IJSt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS6_ESt18is_move_assignableIS6_EEE5valueEvE4typeERS6_SG_
	jmp	.L160
.L143:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4918:
	.size	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_, .-_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_
	.text
	.align 2
	.globl	_ZN3fin5Asset11sort_closesESt6vectorINS_5CloseESaIS2_EE
	.type	_ZN3fin5Asset11sort_closesESt6vectorINS_5CloseESaIS2_EE, @function
_ZN3fin5Asset11sort_closesESt6vectorINS_5CloseESaIS2_EE:
.LFB4306:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	8(%rsi), %rbx
	movq	(%rsi), %rdi
	cmpq	%rbx, %rdi
	je	.L168
	movq	%rbx, %r12
	leaq	_ZN3fin9date_lessENS_5CloseES0_(%rip), %rbp
	movq	%rbx, %rsi
	movq	%rdi, 8(%rsp)
	subq	%rdi, %r12
	movq	%rbp, %rcx
	movq	%r12, %rax
	sarq	$4, %rax
	bsrq	%rax, %rdx
	xorq	$63, %rdx
	testq	%rax, %rax
	movl	$64, %eax
	cmovne	%edx, %eax
	movl	$63, %edx
	subl	%eax, %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	call	_ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEElNS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_T1_
	cmpq	$256, %r12
	movq	8(%rsp), %rdi
	jle	.L171
	leaq	256(%rdi), %r12
	movq	%rbp, %rdx
	movq	%r12, %rsi
	call	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_
.L172:
	cmpq	%r12, %rbx
	je	.L168
	movq	%r12, %rdi
	movq	%rbp, %rsi
	addq	$16, %r12
	call	_ZSt25__unguarded_linear_insertIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops14_Val_comp_iterIPFbS3_S3_EEEEvT_T0_
	jmp	.L172
.L171:
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__insertion_sortIN9__gnu_cxx17__normal_iteratorIPN3fin5CloseESt6vectorIS3_SaIS3_EEEENS0_5__ops15_Iter_comp_iterIPFbS3_S3_EEEEvT_SE_T0_
.L168:
	.cfi_restore_state
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4306:
	.size	_ZN3fin5Asset11sort_closesESt6vectorINS_5CloseESaIS2_EE, .-_ZN3fin5Asset11sort_closesESt6vectorINS_5CloseESaIS2_EE
	.section	.rodata.str1.1
.LC3:
	.string	"closes is empty\n"
	.text
	.align 2
	.globl	_ZN3fin5Asset10set_closesESt6vectorINS_5CloseESaIS2_EE
	.type	_ZN3fin5Asset10set_closesESt6vectorINS_5CloseESaIS2_EE, @function
_ZN3fin5Asset10set_closesESt6vectorINS_5CloseESaIS2_EE:
.LFB4292:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4292
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	8(%rsi), %r12
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	(%rsi), %rax
	cmpq	%r12, %rax
	jne	.L178
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L199
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
.LEHB0:
	jmp	__printf_chk@PLT
.L178:
	.cfi_restore_state
	subq	%rax, %r12
	movabsq	$9223372036854775792, %rax
	cmpq	%r12, %rax
	jnb	.L180
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L199
	call	_ZSt28__throw_bad_array_new_lengthv@PLT
.L180:
	movq	%rdi, %rbp
	movq	%r12, %rdi
	movq	%rsi, %rbx
	call	_Znwm@PLT
.LEHE0:
	movq	(%rbx), %rsi
	addq	%rax, %r12
	movq	%rax, (%rsp)
	movq	%rax, %rcx
	movq	%r12, 16(%rsp)
	movq	8(%rbx), %r12
	subq	%rsi, %r12
	cmpq	$16, %r12
	jle	.L182
	movq	%r12, %rdx
	movq	%rax, %rdi
	call	memmove@PLT
	movq	%rax, %rcx
	jmp	.L183
.L182:
	jne	.L183
	movups	(%rsi), %xmm0
	movups	%xmm0, (%rax)
.L183:
	addq	%r12, %rcx
	movq	%rsp, %r12
	movq	%rbp, %rdi
	movq	%r12, %rsi
	movq	%rcx, 8(%rsp)
.LEHB1:
	call	_ZN3fin5Asset11sort_closesESt6vectorINS_5CloseESaIS2_EE
.LEHE1:
	movq	%r12, %rdi
	call	_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev
	movq	8(%rbx), %rax
	movq	8(%rbp), %rdi
	subq	(%rbx), %rax
	sarq	$4, %rax
	movl	%eax, 4(%rbp)
	testq	%rdi, %rdi
	je	.L184
	call	_ZdaPv@PLT
	xorl	%eax, %eax
	movq	%rax, 8(%rbp)
.L184:
	movabsq	$576460752303423487, %rax
	movslq	4(%rbp), %rdi
	cmpq	%rdi, %rax
	jb	.L185
	salq	$4, %rdi
.LEHB2:
	call	_Znam@PLT
	movl	4(%rbp), %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movq	%rax, 8(%rbp)
	jmp	.L186
.L185:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L199
	call	__cxa_throw_bad_array_new_length@PLT
.L186:
	cmpl	%ecx, %esi
	jle	.L200
	movq	(%rbx), %rdi
	incl	%ecx
	movups	(%rdi,%rdx), %xmm1
	movups	%xmm1, (%rax,%rdx)
	addq	$16, %rdx
	jmp	.L186
.L192:
	endbr64
	movq	%rax, %rbx
.L189:
	movq	%r12, %rdi
	call	_ZNSt12_Vector_baseIN3fin5CloseESaIS1_EED2Ev
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L199
	movq	%rbx, %rdi
	call	_Unwind_Resume@PLT
.LEHE2:
.L200:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L191
.L199:
	call	__stack_chk_fail@PLT
.L191:
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4292:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4292:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4292-.LLSDACSB4292
.LLSDACSB4292:
	.uleb128 .LEHB0-.LFB4292
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4292
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L192-.LFB4292
	.uleb128 0
	.uleb128 .LEHB2-.LFB4292
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4292:
	.text
	.size	_ZN3fin5Asset10set_closesESt6vectorINS_5CloseESaIS2_EE, .-_ZN3fin5Asset10set_closesESt6vectorINS_5CloseESaIS2_EE
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#pragma once
#include <hip/hip_runtime.h>


#ifdef __HIPCC__
#define CUDA_CALLABLE_MEMBER __host__ __device__
#else
#define CUDA_CALLABLE_MEMBER
#endif

#include <cstdio>
#include <cstdlib>

#include <vector>

#include "../helpers/date.cuh"

namespace fin
{

struct Close
{
  hlp::Date date;
  float value;
};

class Asset
{
public:
  CUDA_CALLABLE_MEMBER Asset();
  CUDA_CALLABLE_MEMBER Asset(int id);
  CUDA_CALLABLE_MEMBER Asset(const Asset& asset);

  CUDA_CALLABLE_MEMBER ~Asset();

  CUDA_CALLABLE_MEMBER Asset operator=(const Asset& asset);
  
  void set_closes(std::vector<Close> closes);
  CUDA_CALLABLE_MEMBER void set_id(int id);
  CUDA_CALLABLE_MEMBER int get_id();

  CUDA_CALLABLE_MEMBER Close* get_closes(int *n) const;
  CUDA_CALLABLE_MEMBER Close* get_closes(hlp::Date start_date, hlp::Date end_date, int *n) const;

  // methods for asset evaluation
  // get the return of an asset
  CUDA_CALLABLE_MEMBER float get_return() const;
  CUDA_CALLABLE_MEMBER float get_return(hlp::Date start_date, hlp::Date end_date) const;
  // get the volatility of an asset
  CUDA_CALLABLE_MEMBER float get_volatility() const;
  CUDA_CALLABLE_MEMBER float get_volatility(hlp::Date start_date, hlp::Date end_date) const;
  // get sharp
  CUDA_CALLABLE_MEMBER float get_sharp() const;
  CUDA_CALLABLE_MEMBER float get_sharp(hlp::Date start_date, hlp::Date end_date) const;



  // methods for optimizing portfolio
  CUDA_CALLABLE_MEMBER float* get_returns(int* n) const;
  CUDA_CALLABLE_MEMBER float* get_returns(hlp::Date start_date, hlp::Date end_date, int* n) const;

private:
  int id;
  int size;
  Close* closes;

  void sort_closes(std::vector<Close> closes);
};

}

	.text
	.file	"asset.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
