#include <stdio.h>
#include <math.h>
int test(int a, int b)
{
   printf(">>%d, %d\n", a, b);
   return 0;
}


void* makeVectorAddArgsFloat(int size)
{
   float* mem = (float*)malloc(size);
   float* a1 = mem+1;
   float* b1 = a1+32;
   float* c1 = b1+32;
   for (int idx = 0; idx < 32; ++idx)
   {
      a1[idx] = idx;
      b1[idx] = idx;
      c1[idx] = 0;
   }
   mem[0] = 32;
   return (void*)mem;
}

void* makeVectorAddArgs(int N, int & size)
{
   size = (3*N+1)*sizeof(int);
   int* mem = (int*)malloc(size);
   int* a1 = mem+1;
   int* b1 = a1+N;
   int* c1 = b1+N;
   for (int idx = 0; idx < N; ++idx)
   {
      a1[idx] = idx;
      b1[idx] = idx;
      c1[idx] = 0;
   }
   mem[0] = N;
   return (void*)mem;
}


float *makeMatrixTranspose(int ROW, int& size)
{
  int COLUMN = ROW;

  int a=0, b=0;
  size = (2*ROW*ROW+1)*sizeof(float);
  float *stuff = (float *) malloc(size);
  stuff[0] = ROW;
  float* matrixIn = stuff+1;
  float* matrixOut = matrixIn + ROW*ROW;
  for(a=0; a<ROW;a++)
  {
      for(b=0; b<COLUMN;b++)
      {
         //matrix[b + a * ROW]=((float)rand())/((float) RAND_MAX);
         matrixIn[b + a * ROW]=b;
         matrixOut[b + a * ROW]=0;
      }
  }
  return stuff;
}

float *makeMatrixInverse(int ROW, int& size)
{
    float* stuff = makeMatrixTranspose(ROW, size);
    float* matrixIdent = stuff + 1 + ROW*ROW;
    for (int idx = 0; idx < ROW; ++idx)
    {
        for (int jdx = 0; jdx < ROW; ++jdx)
        {
           if (idx == jdx)
              matrixIdent[idx*ROW+jdx] = 1;
           else
              matrixIdent[idx*ROW+jdx] = 0;
        }
    }
    return stuff;
}


void *makeMatrix(int ROW, int& size)
{
  int COLUMN = ROW;

  int a=0, b=0;
  size = (1+2*ROW*COLUMN)*sizeof(float);
  float *stuff = (float *) malloc(size);
  stuff[0] = ROW;
  for(a=0; a<ROW;a++)
  {
    for(b=0; b<COLUMN;b++)
    {
      stuff[a + b * ROW]=((float)rand())/((float) RAND_MAX);
      stuff[a + b * ROW + ROW * COLUMN] = 0.0;
    }
  }
  return stuff;
}

void* makeMatrixMult(int ROW, int& size)
{
  int COLUMN = ROW;
  int a=0, b=0;
  size = (3*ROW*ROW+1)*sizeof(float);
  float *stuff = (float *) malloc(size);
  float* orig = stuff;
  // first parameter is the matrix size
  *stuff = ROW;
  // increment the pointer by one
   stuff = stuff+1;
  for(a=0; a<ROW;a++)
    {
      for(b=0; b<COLUMN;b++)
      {
         stuff[a + b * ROW]= ((float)rand())/((float) RAND_MAX);
         stuff[a + b * ROW + ROW * COLUMN] = 
                     ((float)rand())/((float) RAND_MAX);
         stuff[a + b * ROW + 2*ROW * COLUMN] = 0.0;
      }
    }
  return orig;
}

void* makeMatrixVectorArgs(int ROWS, int& size)
{
    size = (ROWS*ROWS+2*ROWS+1)*sizeof(int);
    int* param = (int*)malloc(size);
    param[0] = ROWS;
    int* matrix = param+1;
    int* vecA = matrix+ROWS*ROWS;
    int* vecB = vecA+ROWS;
    // idx = row
    for (int idx=0;idx<ROWS;++idx)
    {
        // for each column value, jdx = column
        for (int jdx=0;jdx<ROWS;++jdx)
            matrix[jdx+idx*ROWS]=idx;
        vecA[idx]=idx;
        vecB[idx]=idx;
    }
    return (void*)param;
}

void* allocateStencil(int N, int& size)
{
    float xmin     = 0.0f;
    float xmax     = 3.5f;
    float ymin     = 0.0f;
    //float ymax     = 2.0f;
    float h       = (xmax-xmin)/(N-1);
    float dt    = 0.00001f;    
    float alpha    = 0.645f;
    float time     = 0.4f;

    int steps = ceil(time/dt);
    int I;

    //float *u      = new float[N*N];
    //float *u_host = new float[N*N];

    size = sizeof(float)*(5+2*N*N);
    float* param = (float*)malloc(sizeof(float)*size);
     
    param[0] = N;
    param[1] = h;
    param[2] = dt;
    param[3] = alpha;
    param[4] = N;
    float* u = param+5;
    float* u_host = u + N*N;
    // Generate mesh and intial condition
    for (int j=0; j<N; j++)
    {    for (int i=0; i<N; i++)
        {    I = N*j + i;
            u[I] = 0.0f;
            u_host[I] = 0.0f;
            if ( (i==0) || (j==0)) 
                {u[I] = 200.0f;}
        }
    }

    return (void*)param;
}
float RandFloat(float low, float high)
{
    float t = (float)rand() / (float)RAND_MAX;
    return (1.0f - t) * low + t * high;
}
void* allocateBlackScholes(int N, int& size)
{
    const int   OPT_N = N;//4000000;
    const int   OPT_SZ = OPT_N * sizeof(float);
    const float RISKFREE = 0.02f;
    const float VOLATILITY = 0.30f;
    float *h_CallResultCPU, *h_PutResultCPU;
    float *h_StockPrice, *h_OptionStrike, *h_OptionYears;


    size = OPT_SZ*5+3*sizeof(float);
    
    float* param = (float*)malloc(size);
    param[0] = RISKFREE;
    param[1] = VOLATILITY;
    param[2] = OPT_N;
    h_CallResultCPU = param+3;
    h_PutResultCPU = h_CallResultCPU + OPT_N;
    h_StockPrice = h_PutResultCPU + OPT_N;
    h_OptionStrike = h_StockPrice + OPT_N;
    h_OptionYears = h_OptionStrike + OPT_N;
    srand(5347);
    //Generate options set
    for(int i = 0; i < OPT_N; i++)
    {
        h_CallResultCPU[i] = 0.0f;
        h_PutResultCPU[i]  = -1.0f;
        h_StockPrice[i]    = RandFloat(5.0f, 30.0f);
        h_OptionStrike[i]  = RandFloat(1.0f, 100.0f);
        h_OptionYears[i]   = RandFloat(0.25f, 10.0f);
   }
   return (void*)param;  
}

	.file	"tmpxft_002e5169_00000000-6_allocations.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2040:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2040:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	">>%d, %d\n"
	.text
	.globl	_Z4testii
	.type	_Z4testii, @function
_Z4testii:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	%edi, %edx
	movl	%esi, %ecx
	movl	$2, %edi
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z4testii, .-_Z4testii
	.globl	_Z22makeVectorAddArgsFloati
	.type	_Z22makeVectorAddArgsFloati, @function
_Z22makeVectorAddArgsFloati:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rcx
	.cfi_def_cfa_offset 16
	movslq	%edi, %rdi
	call	malloc@PLT
	xorl	%ecx, %ecx
	movq	%rax, %rdx
.L5:
	cvtsi2ssl	%ecx, %xmm0
	movss	%xmm0, 4(%rdx,%rcx,4)
	movss	%xmm0, 132(%rdx,%rcx,4)
	incq	%rcx
	cmpq	$32, %rcx
	jne	.L5
	leaq	260(%rdx), %rsi
	xorl	%eax, %eax
	movq	%rsi, %rdi
	rep stosl
	movq	%rdx, %rax
	movl	$0x42000000, (%rdx)
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z22makeVectorAddArgsFloati, .-_Z22makeVectorAddArgsFloati
	.globl	_Z17makeVectorAddArgsiRi
	.type	_Z17makeVectorAddArgsiRi, @function
_Z17makeVectorAddArgsiRi:
.LFB2029:
	.cfi_startproc
	endbr64
	leal	(%rdi,%rdi,2), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	%edi, %ebx
	leal	4(,%rax,4), %edi
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	call	malloc@PLT
	movslq	%ebx, %rdx
	salq	$2, %rdx
	leaq	4(%rax,%rdx), %rsi
	leaq	(%rsi,%rdx), %rcx
	xorl	%edx, %edx
.L10:
	cmpl	%edx, %ebx
	jle	.L13
	xorl	%edi, %edi
	movl	%edx, 4(%rax,%rdx,4)
	movl	%edx, (%rsi,%rdx,4)
	movl	%edi, (%rcx,%rdx,4)
	incq	%rdx
	jmp	.L10
.L13:
	movl	%ebx, (%rax)
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z17makeVectorAddArgsiRi, .-_Z17makeVectorAddArgsiRi
	.globl	_Z19makeMatrixTransposeiRi
	.type	_Z19makeMatrixTransposeiRi, @function
_Z19makeMatrixTransposeiRi:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	imull	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	leal	4(,%rbp,8), %edi
	movslq	%ebp, %rbp
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	call	malloc@PLT
	cvtsi2ssl	%ebx, %xmm0
	movslq	%ebx, %r8
	xorl	%esi, %esi
	salq	$2, %r8
	movq	%rax, %rdi
	movss	%xmm0, (%rax)
.L15:
	cmpl	%ebx, %esi
	jge	.L20
	movq	%rdi, %rcx
	xorl	%edx, %edx
.L16:
	cvtsi2ssl	%edx, %xmm0
	incl	%edx
	movss	%xmm0, 4(%rcx)
	movl	$0x00000000, 4(%rcx,%rbp,4)
	addq	$4, %rcx
	cmpl	%edx, %ebx
	jne	.L16
	incl	%esi
	addq	%r8, %rdi
	jmp	.L15
.L20:
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z19makeMatrixTransposeiRi, .-_Z19makeMatrixTransposeiRi
	.globl	_Z17makeMatrixInverseiRi
	.type	_Z17makeMatrixInverseiRi, @function
_Z17makeMatrixInverseiRi:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	%edi, %ebx
	call	_Z19makeMatrixTransposeiRi
	movl	%ebx, %edx
	xorl	%edi, %edi
	xorl	%esi, %esi
	imull	%ebx, %edx
	movslq	%edx, %rdx
	incq	%rdx
.L22:
	cmpl	%ebx, %esi
	jge	.L29
	movslq	%edi, %rcx
	addq	%rdx, %rcx
	leaq	(%rax,%rcx,4), %r8
	xorl	%ecx, %ecx
.L24:
	movss	.LC3(%rip), %xmm0
	cmpl	%ecx, %esi
	je	.L23
	xorps	%xmm0, %xmm0
.L23:
	movss	%xmm0, (%r8,%rcx,4)
	incq	%rcx
	cmpl	%ecx, %ebx
	jg	.L24
	incl	%esi
	addl	%ebx, %edi
	jmp	.L22
.L29:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z17makeMatrixInverseiRi, .-_Z17makeMatrixInverseiRi
	.globl	_Z10makeMatrixiRi
	.type	_Z10makeMatrixiRi, @function
_Z10makeMatrixiRi:
.LFB2032:
	.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
	movl	%edi, %r13d
	imull	%edi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	leal	4(,%r13,8), %edi
	movslq	%r13d, %r13
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	call	malloc@PLT
	cvtsi2ssl	%ebx, %xmm0
	movslq	%ebx, %rdx
	movq	%rax, %rbp
	leaq	0(,%rdx,4), %rcx
	movss	%xmm0, (%rax)
.L31:
	cmpl	%r12d, %ebx
	jle	.L36
	leaq	0(%rbp,%r12,4), %r14
	xorl	%r15d, %r15d
.L32:
	movq	%rdx, 8(%rsp)
	incq	%r15
	movq	%rcx, (%rsp)
	call	rand@PLT
	movq	(%rsp), %rcx
	movq	8(%rsp), %rdx
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC4(%rip), %xmm0
	movss	%xmm0, (%r14)
	movl	$0x00000000, (%r14,%r13,4)
	addq	%rcx, %r14
	cmpq	%r15, %rdx
	jne	.L32
	incq	%r12
	jmp	.L31
.L36:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	movq	%rbp, %rax
	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
.LFE2032:
	.size	_Z10makeMatrixiRi, .-_Z10makeMatrixiRi
	.globl	_Z14makeMatrixMultiRi
	.type	_Z14makeMatrixMultiRi, @function
_Z14makeMatrixMultiRi:
.LFB2033:
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edi, %r12d
	imull	%edi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	leal	(%r12,%r12,2), %eax
	leal	(%r12,%r12), %r15d
	movslq	%r12d, %r12
	leal	4(,%rax,4), %edi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movslq	%r15d, %r15
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	call	malloc@PLT
	cvtsi2ssl	%ebx, %xmm0
	movslq	%ebx, %rsi
	movq	%rax, %rbp
	movq	%rax, %rdx
	leaq	0(,%rsi,4), %rdi
	movss	%xmm0, (%rax)
.L38:
	cmpl	%ebx, %r14d
	jge	.L43
	movq	%rdx, %r13
	xorl	%ecx, %ecx
.L39:
	movq	%rdx, 24(%rsp)
	movq	%rcx, 16(%rsp)
	movq	%rsi, 8(%rsp)
	movq	%rdi, (%rsp)
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC4(%rip), %xmm0
	movss	%xmm0, 4(%r13)
	call	rand@PLT
	movq	16(%rsp), %rcx
	movq	(%rsp), %rdi
	cvtsi2ssl	%eax, %xmm0
	movq	8(%rsp), %rsi
	movq	24(%rsp), %rdx
	mulss	.LC4(%rip), %xmm0
	incq	%rcx
	movss	%xmm0, 4(%r13,%r12,4)
	movl	$0x00000000, 4(%r13,%r15,4)
	addq	%rdi, %r13
	cmpq	%rcx, %rsi
	jne	.L39
	incl	%r14d
	addq	$4, %rdx
	jmp	.L38
.L43:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	movq	%rbp, %rax
	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
.LFE2033:
	.size	_Z14makeMatrixMultiRi, .-_Z14makeMatrixMultiRi
	.globl	_Z20makeMatrixVectorArgsiRi
	.type	_Z20makeMatrixVectorArgsiRi, @function
_Z20makeMatrixVectorArgsiRi:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	imull	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	leal	1(%rbp,%rdi,2), %edi
	movslq	%ebp, %rbp
	sall	$2, %edi
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	call	malloc@PLT
	movslq	%ebx, %rcx
	xorl	%edx, %edx
	movl	%ebx, (%rax)
	leaq	4(%rax,%rbp,4), %r9
	salq	$2, %rcx
	movq	%rax, %r8
	leaq	(%r9,%rcx), %r10
.L45:
	movl	%edx, %edi
	cmpl	%edx, %ebx
	jle	.L50
	xorl	%esi, %esi
.L46:
	movl	%edi, 4(%r8,%rsi,4)
	incq	%rsi
	cmpl	%esi, %ebx
	jg	.L46
	movl	%edi, (%r9,%rdx,4)
	addq	%rcx, %r8
	movl	%edi, (%r10,%rdx,4)
	incq	%rdx
	jmp	.L45
.L50:
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_Z20makeMatrixVectorArgsiRi, .-_Z20makeMatrixVectorArgsiRi
	.globl	_Z15allocateStenciliRi
	.type	_Z15allocateStenciliRi, @function
_Z15allocateStenciliRi:
.LFB2035:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	imull	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	leal	20(,%rbp,8), %edi
	movslq	%ebp, %rbp
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	cvtsi2ssl	%ebx, %xmm1
	leal	-1(%rbx), %edx
	movslq	%ebx, %r8
	cvtsi2ssl	%edx, %xmm2
	salq	$2, %r8
	movq	%rax, %rdi
	xorl	%edx, %edx
	movss	.LC6(%rip), %xmm0
	movabsq	$4550076775075923372, %rcx
	movq	%rcx, 8(%rax)
	movss	%xmm1, (%rax)
	divss	%xmm2, %xmm0
	movss	%xmm1, 16(%rax)
	movss	%xmm0, 4(%rax)
.L52:
	cmpl	%ebx, %edx
	jge	.L62
	movq	%rdi, %rsi
	xorl	%ecx, %ecx
.L55:
	movl	$0x00000000, 20(%rsi,%rbp,4)
	testl	%ecx, %ecx
	je	.L58
	xorps	%xmm0, %xmm0
	testl	%edx, %edx
	jne	.L53
.L58:
	movss	.LC5(%rip), %xmm0
.L53:
	incl	%ecx
	movss	%xmm0, 20(%rsi)
	addq	$4, %rsi
	cmpl	%ecx, %ebx
	jne	.L55
	incl	%edx
	addq	%r8, %rdi
	jmp	.L52
.L62:
	popq	%rdx
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2035:
	.size	_Z15allocateStenciliRi, .-_Z15allocateStenciliRi
	.globl	_Z9RandFloatff
	.type	_Z9RandFloatff, @function
_Z9RandFloatff:
.LFB2036:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movss	%xmm0, 8(%rsp)
	movss	%xmm1, 12(%rsp)
	call	rand@PLT
	movss	.LC3(%rip), %xmm0
	cvtsi2ssl	%eax, %xmm1
	mulss	.LC4(%rip), %xmm1
	subss	%xmm1, %xmm0
	mulss	12(%rsp), %xmm1
	mulss	8(%rsp), %xmm0
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	addss	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE2036:
	.size	_Z9RandFloatff, .-_Z9RandFloatff
	.globl	_Z20allocateBlackScholesiRi
	.type	_Z20allocateBlackScholesiRi, @function
_Z20allocateBlackScholesiRi:
.LFB2037:
	.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
	movslq	%edi, %rbx
	leal	0(,%rbx,4), %edi
	movq	%rbx, %r12
	leal	(%rdi,%rdi,4), %edi
	addl	$12, %edi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, (%rsi)
	movslq	%edi, %rdi
	call	malloc@PLT
	cvtsi2ssl	%ebx, %xmm0
	salq	$2, %rbx
	movabsq	$4510805389509646090, %rdx
	leaq	12(%rax,%rbx), %r13
	movq	%rdx, (%rax)
	movl	$5347, %edi
	leaq	0(%r13,%rbx), %r14
	movq	%rax, 8(%rsp)
	leaq	(%r14,%rbx), %r15
	movss	%xmm0, 8(%rax)
	leaq	(%r15,%rbx), %rbp
	xorl	%ebx, %ebx
	call	srand@PLT
.L69:
	movq	8(%rsp), %rax
	cmpl	%ebx, %r12d
	jle	.L70
	movl	$0x00000000, 12(%rax,%rbx,4)
	movss	.LC8(%rip), %xmm1
	movss	.LC9(%rip), %xmm0
	movq	%rax, 8(%rsp)
	movl	$0xbf800000, 0(%r13,%rbx,4)
	call	_Z9RandFloatff
	movss	.LC10(%rip), %xmm1
	movss	%xmm0, (%r14,%rbx,4)
	movss	.LC3(%rip), %xmm0
	call	_Z9RandFloatff
	movss	.LC11(%rip), %xmm1
	movss	%xmm0, (%r15,%rbx,4)
	movss	.LC12(%rip), %xmm0
	call	_Z9RandFloatff
	movss	%xmm0, 0(%rbp,%rbx,4)
	incq	%rbx
	jmp	.L69
.L70:
	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
.LFE2037:
	.size	_Z20allocateBlackScholesiRi, .-_Z20allocateBlackScholesiRi
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2063:
	.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
.LFE2063:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC3:
	.long	1065353216
	.align 4
.LC4:
	.long	805306368
	.align 4
.LC5:
	.long	1128792064
	.align 4
.LC6:
	.long	1080033280
	.align 4
.LC8:
	.long	1106247680
	.align 4
.LC9:
	.long	1084227584
	.align 4
.LC10:
	.long	1120403456
	.align 4
.LC11:
	.long	1092616192
	.align 4
.LC12:
	.long	1048576000
	.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:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <math.h>
int test(int a, int b)
{
   printf(">>%d, %d\n", a, b);
   return 0;
}


void* makeVectorAddArgsFloat(int size)
{
   float* mem = (float*)malloc(size);
   float* a1 = mem+1;
   float* b1 = a1+32;
   float* c1 = b1+32;
   for (int idx = 0; idx < 32; ++idx)
   {
      a1[idx] = idx;
      b1[idx] = idx;
      c1[idx] = 0;
   }
   mem[0] = 32;
   return (void*)mem;
}

void* makeVectorAddArgs(int N, int & size)
{
   size = (3*N+1)*sizeof(int);
   int* mem = (int*)malloc(size);
   int* a1 = mem+1;
   int* b1 = a1+N;
   int* c1 = b1+N;
   for (int idx = 0; idx < N; ++idx)
   {
      a1[idx] = idx;
      b1[idx] = idx;
      c1[idx] = 0;
   }
   mem[0] = N;
   return (void*)mem;
}


float *makeMatrixTranspose(int ROW, int& size)
{
  int COLUMN = ROW;

  int a=0, b=0;
  size = (2*ROW*ROW+1)*sizeof(float);
  float *stuff = (float *) malloc(size);
  stuff[0] = ROW;
  float* matrixIn = stuff+1;
  float* matrixOut = matrixIn + ROW*ROW;
  for(a=0; a<ROW;a++)
  {
      for(b=0; b<COLUMN;b++)
      {
         //matrix[b + a * ROW]=((float)rand())/((float) RAND_MAX);
         matrixIn[b + a * ROW]=b;
         matrixOut[b + a * ROW]=0;
      }
  }
  return stuff;
}

float *makeMatrixInverse(int ROW, int& size)
{
    float* stuff = makeMatrixTranspose(ROW, size);
    float* matrixIdent = stuff + 1 + ROW*ROW;
    for (int idx = 0; idx < ROW; ++idx)
    {
        for (int jdx = 0; jdx < ROW; ++jdx)
        {
           if (idx == jdx)
              matrixIdent[idx*ROW+jdx] = 1;
           else
              matrixIdent[idx*ROW+jdx] = 0;
        }
    }
    return stuff;
}


void *makeMatrix(int ROW, int& size)
{
  int COLUMN = ROW;

  int a=0, b=0;
  size = (1+2*ROW*COLUMN)*sizeof(float);
  float *stuff = (float *) malloc(size);
  stuff[0] = ROW;
  for(a=0; a<ROW;a++)
  {
    for(b=0; b<COLUMN;b++)
    {
      stuff[a + b * ROW]=((float)rand())/((float) RAND_MAX);
      stuff[a + b * ROW + ROW * COLUMN] = 0.0;
    }
  }
  return stuff;
}

void* makeMatrixMult(int ROW, int& size)
{
  int COLUMN = ROW;
  int a=0, b=0;
  size = (3*ROW*ROW+1)*sizeof(float);
  float *stuff = (float *) malloc(size);
  float* orig = stuff;
  // first parameter is the matrix size
  *stuff = ROW;
  // increment the pointer by one
   stuff = stuff+1;
  for(a=0; a<ROW;a++)
    {
      for(b=0; b<COLUMN;b++)
      {
         stuff[a + b * ROW]= ((float)rand())/((float) RAND_MAX);
         stuff[a + b * ROW + ROW * COLUMN] = 
                     ((float)rand())/((float) RAND_MAX);
         stuff[a + b * ROW + 2*ROW * COLUMN] = 0.0;
      }
    }
  return orig;
}

void* makeMatrixVectorArgs(int ROWS, int& size)
{
    size = (ROWS*ROWS+2*ROWS+1)*sizeof(int);
    int* param = (int*)malloc(size);
    param[0] = ROWS;
    int* matrix = param+1;
    int* vecA = matrix+ROWS*ROWS;
    int* vecB = vecA+ROWS;
    // idx = row
    for (int idx=0;idx<ROWS;++idx)
    {
        // for each column value, jdx = column
        for (int jdx=0;jdx<ROWS;++jdx)
            matrix[jdx+idx*ROWS]=idx;
        vecA[idx]=idx;
        vecB[idx]=idx;
    }
    return (void*)param;
}

void* allocateStencil(int N, int& size)
{
    float xmin     = 0.0f;
    float xmax     = 3.5f;
    float ymin     = 0.0f;
    //float ymax     = 2.0f;
    float h       = (xmax-xmin)/(N-1);
    float dt    = 0.00001f;    
    float alpha    = 0.645f;
    float time     = 0.4f;

    int steps = ceil(time/dt);
    int I;

    //float *u      = new float[N*N];
    //float *u_host = new float[N*N];

    size = sizeof(float)*(5+2*N*N);
    float* param = (float*)malloc(sizeof(float)*size);
     
    param[0] = N;
    param[1] = h;
    param[2] = dt;
    param[3] = alpha;
    param[4] = N;
    float* u = param+5;
    float* u_host = u + N*N;
    // Generate mesh and intial condition
    for (int j=0; j<N; j++)
    {    for (int i=0; i<N; i++)
        {    I = N*j + i;
            u[I] = 0.0f;
            u_host[I] = 0.0f;
            if ( (i==0) || (j==0)) 
                {u[I] = 200.0f;}
        }
    }

    return (void*)param;
}
float RandFloat(float low, float high)
{
    float t = (float)rand() / (float)RAND_MAX;
    return (1.0f - t) * low + t * high;
}
void* allocateBlackScholes(int N, int& size)
{
    const int   OPT_N = N;//4000000;
    const int   OPT_SZ = OPT_N * sizeof(float);
    const float RISKFREE = 0.02f;
    const float VOLATILITY = 0.30f;
    float *h_CallResultCPU, *h_PutResultCPU;
    float *h_StockPrice, *h_OptionStrike, *h_OptionYears;


    size = OPT_SZ*5+3*sizeof(float);
    
    float* param = (float*)malloc(size);
    param[0] = RISKFREE;
    param[1] = VOLATILITY;
    param[2] = OPT_N;
    h_CallResultCPU = param+3;
    h_PutResultCPU = h_CallResultCPU + OPT_N;
    h_StockPrice = h_PutResultCPU + OPT_N;
    h_OptionStrike = h_StockPrice + OPT_N;
    h_OptionYears = h_OptionStrike + OPT_N;
    srand(5347);
    //Generate options set
    for(int i = 0; i < OPT_N; i++)
    {
        h_CallResultCPU[i] = 0.0f;
        h_PutResultCPU[i]  = -1.0f;
        h_StockPrice[i]    = RandFloat(5.0f, 30.0f);
        h_OptionStrike[i]  = RandFloat(1.0f, 100.0f);
        h_OptionYears[i]   = RandFloat(0.25f, 10.0f);
   }
   return (void*)param;  
}

	.text
	.file	"allocations.hip"
	.globl	_Z4testii                       # -- Begin function _Z4testii
	.type	_Z4testii,@function
_Z4testii:                              # @_Z4testii
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	%esi, %edx
	movl	%edi, %esi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z4testii, .Lfunc_end0-_Z4testii
	.cfi_endproc
                                        # -- End function
	.globl	_Z22makeVectorAddArgsFloati     # -- Begin function _Z22makeVectorAddArgsFloati
	.type	_Z22makeVectorAddArgsFloati,@function
_Z22makeVectorAddArgsFloati:            # @_Z22makeVectorAddArgsFloati
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movslq	%edi, %rdi
	callq	malloc
	xorl	%ecx, %ecx
.LBB1_1:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ecx, %xmm0
	movss	%xmm0, 4(%rax,%rcx,4)
	movss	%xmm0, 132(%rax,%rcx,4)
	movl	$0, 260(%rax,%rcx,4)
	incq	%rcx
	cmpq	$32, %rcx
	jne	.LBB1_1
# %bb.2:
	movl	$1107296256, (%rax)             # imm = 0x42000000
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z22makeVectorAddArgsFloati, .Lfunc_end1-_Z22makeVectorAddArgsFloati
	.cfi_endproc
                                        # -- End function
	.globl	_Z17makeVectorAddArgsiRi        # -- Begin function _Z17makeVectorAddArgsiRi
	.type	_Z17makeVectorAddArgsiRi,@function
_Z17makeVectorAddArgsiRi:               # @_Z17makeVectorAddArgsiRi
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%edi, %ebx
	leal	(%rbx,%rbx,2), %eax
	leal	4(,%rax,4), %eax
	movl	%eax, (%rsi)
	movslq	%eax, %rdi
	callq	malloc
	testl	%ebx, %ebx
	jle	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	movslq	%ebx, %rsi
	leaq	(%rax,%rsi,4), %rcx
	addq	$4, %rcx
	movq	%rax, %rdx
	addq	$4, %rdx
	leaq	(%rcx,%rsi,4), %rsi
	movl	%ebx, %edi
	xorl	%r8d, %r8d
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%r8d, (%rdx,%r8,4)
	movl	%r8d, (%rcx,%r8,4)
	movl	$0, (%rsi,%r8,4)
	incq	%r8
	cmpq	%r8, %rdi
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	movl	%ebx, (%rax)
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z17makeVectorAddArgsiRi, .Lfunc_end2-_Z17makeVectorAddArgsiRi
	.cfi_endproc
                                        # -- End function
	.globl	_Z19makeMatrixTransposeiRi      # -- Begin function _Z19makeMatrixTransposeiRi
	.type	_Z19makeMatrixTransposeiRi,@function
_Z19makeMatrixTransposeiRi:             # @_Z19makeMatrixTransposeiRi
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	%edi, %ebx
	movl	%edi, %r14d
	imull	%r14d, %r14d
	leal	4(,%r14,8), %eax
	movl	%eax, (%rsi)
	movslq	%eax, %rdi
	callq	malloc
	cvtsi2ss	%ebx, %xmm0
	movss	%xmm0, (%rax)
	testl	%ebx, %ebx
	jle	.LBB3_5
# %bb.1:                                # %.preheader.lr.ph
	movl	%ebx, %ecx
	leaq	(%rax,%r14,4), %rdx
	addq	$4, %rdx
	movq	%rax, %rsi
	addq	$4, %rsi
	xorl	%edi, %edi
	xorl	%r8d, %r8d
.LBB3_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_3 Depth 2
	movl	%edi, %r10d
	leaq	(%rdx,%r10,4), %r9
	leaq	(%rsi,%r10,4), %r10
	xorl	%r11d, %r11d
.LBB3_3:                                #   Parent Loop BB3_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r11d, %xmm0
	movss	%xmm0, (%r10,%r11,4)
	movl	$0, (%r9,%r11,4)
	incq	%r11
	cmpq	%r11, %rcx
	jne	.LBB3_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB3_2 Depth=1
	incq	%r8
	addl	%ebx, %edi
	cmpq	%rcx, %r8
	jne	.LBB3_2
.LBB3_5:                                # %._crit_edge30
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z19makeMatrixTransposeiRi, .Lfunc_end3-_Z19makeMatrixTransposeiRi
	.cfi_endproc
                                        # -- End function
	.globl	_Z17makeMatrixInverseiRi        # -- Begin function _Z17makeMatrixInverseiRi
	.type	_Z17makeMatrixInverseiRi,@function
_Z17makeMatrixInverseiRi:               # @_Z17makeMatrixInverseiRi
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%edi, %ebx
	callq	_Z19makeMatrixTransposeiRi
	testl	%ebx, %ebx
	jle	.LBB4_6
# %bb.1:                                # %.preheader.lr.ph
	movl	%ebx, %ecx
	imull	%ecx, %ecx
	leaq	(%rax,%rcx,4), %rcx
	addq	$4, %rcx
	movl	%ebx, %edx
	xorl	%esi, %esi
	xorl	%edi, %edi
.LBB4_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_3 Depth 2
	movl	%esi, %r8d
	leaq	(%rcx,%r8,4), %r8
	movl	%edi, %r9d
	imull	%ebx, %r9d
	leaq	(%rcx,%rdi,4), %r10
	xorl	%r11d, %r11d
.LBB4_3:                                #   Parent Loop BB4_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%r11, %rdi
	jne	.LBB4_7
# %bb.4:                                #   in Loop: Header=BB4_3 Depth=2
	movl	$1065353216, (%r10,%r9,4)       # imm = 0x3F800000
	jmp	.LBB4_8
.LBB4_7:                                #   in Loop: Header=BB4_3 Depth=2
	movl	$0, (%r8,%r11,4)
.LBB4_8:                                #   in Loop: Header=BB4_3 Depth=2
	incq	%r11
	cmpq	%r11, %rdx
	jne	.LBB4_3
# %bb.5:                                # %._crit_edge
                                        #   in Loop: Header=BB4_2 Depth=1
	incq	%rdi
	addl	%ebx, %esi
	cmpq	%rdx, %rdi
	jne	.LBB4_2
.LBB4_6:                                # %._crit_edge25
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z17makeMatrixInverseiRi, .Lfunc_end4-_Z17makeMatrixInverseiRi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z10makeMatrixiRi
.LCPI5_0:
	.long	0x30000000                      # float 4.65661287E-10
	.text
	.globl	_Z10makeMatrixiRi
	.type	_Z10makeMatrixiRi,@function
_Z10makeMatrixiRi:                      # @_Z10makeMatrixiRi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edi, %ebp
	movl	%edi, %r14d
	imull	%r14d, %r14d
	leal	4(,%r14,8), %eax
	movl	%eax, (%rsi)
	movslq	%eax, %rdi
	callq	malloc
	cvtsi2ss	%ebp, %xmm0
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movss	%xmm0, (%rax)
	testl	%ebp, %ebp
	jle	.LBB5_5
# %bb.1:                                # %.preheader.lr.ph
	movl	%ebp, %r15d
	leaq	(,%r15,4), %r12
	xorl	%r13d, %r13d
	movq	8(%rsp), %rbx                   # 8-byte Reload
	movq	%r15, 16(%rsp)                  # 8-byte Spill
.LBB5_2:                                # %.lr.ph.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_3 Depth 2
	movq	%rbx, %rbp
.LBB5_3:                                # %.lr.ph
                                        #   Parent Loop BB5_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	movss	.LCPI5_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	%xmm1, %xmm0
	movss	%xmm0, (%rbp)
	movl	$0, (%rbp,%r14,4)
	addq	%r12, %rbp
	decq	%r15
	jne	.LBB5_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB5_2 Depth=1
	incq	%r13
	addq	$4, %rbx
	movq	16(%rsp), %r15                  # 8-byte Reload
	cmpq	%r15, %r13
	jne	.LBB5_2
.LBB5_5:                                # %._crit_edge27
	movq	8(%rsp), %rax                   # 8-byte Reload
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z10makeMatrixiRi, .Lfunc_end5-_Z10makeMatrixiRi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z14makeMatrixMultiRi
.LCPI6_0:
	.long	0x30000000                      # float 4.65661287E-10
	.text
	.globl	_Z14makeMatrixMultiRi
	.type	_Z14makeMatrixMultiRi,@function
_Z14makeMatrixMultiRi:                  # @_Z14makeMatrixMultiRi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edi, %ebp
	movl	%edi, %ebx
	imull	%ebx, %ebx
	leal	(%rbx,%rbx,2), %eax
	leal	4(,%rax,4), %eax
	movl	%eax, (%rsi)
	movslq	%eax, %rdi
	callq	malloc
	cvtsi2ss	%ebp, %xmm0
	movq	%rax, (%rsp)                    # 8-byte Spill
	movss	%xmm0, (%rax)
	testl	%ebp, %ebp
	jle	.LBB6_5
# %bb.1:                                # %.preheader.lr.ph
	movq	(%rsp), %r14                    # 8-byte Reload
	addq	$4, %r14
	movl	%ebp, %r15d
	movslq	%ebx, %r12
	addl	%ebx, %ebx
	movslq	%ebx, %r13
	leaq	(,%r15,4), %rbp
	xorl	%ebx, %ebx
	movq	%r15, 8(%rsp)                   # 8-byte Spill
.LBB6_2:                                # %.lr.ph.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_3 Depth 2
	movq	%r14, 16(%rsp)                  # 8-byte Spill
.LBB6_3:                                # %.lr.ph
                                        #   Parent Loop BB6_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI6_0(%rip), %xmm0
	movss	%xmm0, (%r14)
	callq	rand
	movss	.LCPI6_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	%xmm1, %xmm0
	movss	%xmm0, (%r14,%r12,4)
	movl	$0, (%r14,%r13,4)
	addq	%rbp, %r14
	decq	%r15
	jne	.LBB6_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB6_2 Depth=1
	incq	%rbx
	movq	16(%rsp), %r14                  # 8-byte Reload
	addq	$4, %r14
	movq	8(%rsp), %r15                   # 8-byte Reload
	cmpq	%r15, %rbx
	jne	.LBB6_2
.LBB6_5:                                # %._crit_edge35
	movq	(%rsp), %rax                    # 8-byte Reload
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z14makeMatrixMultiRi, .Lfunc_end6-_Z14makeMatrixMultiRi
	.cfi_endproc
                                        # -- End function
	.globl	_Z20makeMatrixVectorArgsiRi     # -- Begin function _Z20makeMatrixVectorArgsiRi
	.type	_Z20makeMatrixVectorArgsiRi,@function
_Z20makeMatrixVectorArgsiRi:            # @_Z20makeMatrixVectorArgsiRi
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%edi, %ebx
	leal	2(%rbx), %eax
	imull	%edi, %eax
	leal	4(,%rax,4), %eax
	movl	%eax, (%rsi)
	movslq	%eax, %rdi
	callq	malloc
	movl	%ebx, (%rax)
	testl	%ebx, %ebx
	jle	.LBB7_5
# %bb.1:                                # %.preheader.lr.ph
	movl	%ebx, %ecx
	imull	%ecx, %ecx
	leaq	(%rax,%rcx,4), %rcx
	movslq	%ebx, %rdx
	leaq	(%rcx,%rdx,4), %rdx
	addq	$4, %rdx
	movl	%ebx, %esi
	movq	%rax, %rdi
	addq	$4, %rdi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
.LBB7_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_3 Depth 2
	movl	%r8d, %r10d
	leaq	(%rdi,%r10,4), %r10
	xorl	%r11d, %r11d
.LBB7_3:                                #   Parent Loop BB7_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r9d, (%r10,%r11,4)
	incq	%r11
	cmpq	%r11, %rsi
	jne	.LBB7_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB7_2 Depth=1
	movl	%r9d, 4(%rcx,%r9,4)
	movl	%r9d, (%rdx,%r9,4)
	incq	%r9
	addl	%ebx, %r8d
	cmpq	%rsi, %r9
	jne	.LBB7_2
.LBB7_5:                                # %._crit_edge34
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_Z20makeMatrixVectorArgsiRi, .Lfunc_end7-_Z20makeMatrixVectorArgsiRi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z15allocateStenciliRi
.LCPI8_0:
	.long	0x40600000                      # float 3.5
	.text
	.globl	_Z15allocateStenciliRi
	.type	_Z15allocateStenciliRi,@function
_Z15allocateStenciliRi:                 # @_Z15allocateStenciliRi
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	%edi, %ebx
	leal	-1(%rbx), %eax
	cvtsi2ss	%eax, %xmm0
	movss	.LCPI8_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	movss	%xmm1, 4(%rsp)                  # 4-byte Spill
	movl	%edi, %r14d
	imull	%r14d, %r14d
	leal	20(,%r14,8), %eax
	movl	%eax, (%rsi)
	movslq	%eax, %rdi
	shlq	$2, %rdi
	callq	malloc
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebx, %xmm0
	movss	%xmm0, (%rax)
	movss	4(%rsp), %xmm1                  # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	movss	%xmm1, 4(%rax)
	movabsq	$4550076775075923372, %rcx      # imm = 0x3F251EB83727C5AC
	movq	%rcx, 8(%rax)
	movss	%xmm0, 16(%rax)
	testl	%ebx, %ebx
	jle	.LBB8_8
# %bb.1:                                # %.preheader.lr.ph
	movl	%ebx, %ecx
	leaq	(%rax,%r14,4), %rdx
	addq	$20, %rdx
	movq	%rax, %rsi
	addq	$20, %rsi
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
.LBB8_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB8_3 Depth 2
	movl	%r8d, %r11d
	leaq	(%rdx,%r11,4), %r10
	leaq	(%rsi,%r11,4), %r11
	xorl	%r14d, %r14d
.LBB8_3:                                #   Parent Loop BB8_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%edi, (%r11,%r14,4)
	movl	%edi, (%r10,%r14,4)
	testq	%r9, %r9
	je	.LBB8_5
# %bb.4:                                #   in Loop: Header=BB8_3 Depth=2
	testq	%r14, %r14
	jne	.LBB8_6
.LBB8_5:                                #   in Loop: Header=BB8_3 Depth=2
	movl	$1128792064, (%r11,%r14,4)      # imm = 0x43480000
.LBB8_6:                                #   in Loop: Header=BB8_3 Depth=2
	incq	%r14
	cmpq	%r14, %rcx
	jne	.LBB8_3
# %bb.7:                                # %._crit_edge
                                        #   in Loop: Header=BB8_2 Depth=1
	incq	%r9
	addl	%ebx, %r8d
	cmpq	%rcx, %r9
	jne	.LBB8_2
.LBB8_8:                                # %._crit_edge45
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z15allocateStenciliRi, .Lfunc_end8-_Z15allocateStenciliRi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z9RandFloatff
.LCPI9_0:
	.long	0x30000000                      # float 4.65661287E-10
.LCPI9_1:
	.long	0x3f800000                      # float 1
	.text
	.globl	_Z9RandFloatff
	.type	_Z9RandFloatff,@function
_Z9RandFloatff:                         # @_Z9RandFloatff
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movss	%xmm1, 4(%rsp)                  # 4-byte Spill
	movss	%xmm0, (%rsp)                   # 4-byte Spill
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI9_0(%rip), %xmm0
	movss	.LCPI9_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	(%rsp), %xmm1                   # 4-byte Folded Reload
	mulss	4(%rsp), %xmm0                  # 4-byte Folded Reload
	addss	%xmm1, %xmm0
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end9:
	.size	_Z9RandFloatff, .Lfunc_end9-_Z9RandFloatff
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z20allocateBlackScholesiRi
.LCPI10_0:
	.long	0x30000000                      # float 4.65661287E-10
.LCPI10_1:
	.long	0x3f800000                      # float 1
.LCPI10_2:
	.long	0x40a00000                      # float 5
.LCPI10_3:
	.long	0x41f00000                      # float 30
.LCPI10_4:
	.long	0x42c80000                      # float 100
.LCPI10_5:
	.long	0x3e800000                      # float 0.25
.LCPI10_6:
	.long	0x41200000                      # float 10
	.text
	.globl	_Z20allocateBlackScholesiRi
	.type	_Z20allocateBlackScholesiRi,@function
_Z20allocateBlackScholesiRi:            # @_Z20allocateBlackScholesiRi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edi, %r14d
	leal	(%r14,%r14,4), %eax
	leal	12(,%rax,4), %eax
	movl	%eax, (%rsi)
	movslq	%eax, %rdi
	callq	malloc
	movabsq	$4510805389509646090, %rcx      # imm = 0x3E99999A3CA3D70A
	movq	%rcx, (%rax)
	cvtsi2ss	%r14d, %xmm0
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movss	%xmm0, 8(%rax)
	movl	$5347, %edi                     # imm = 0x14E3
	callq	srand
	testl	%r14d, %r14d
	jle	.LBB10_3
# %bb.1:                                # %.lr.ph.preheader
	movslq	%r14d, %r15
	movq	8(%rsp), %r12                   # 8-byte Reload
	addq	$12, %r12
	movl	%r14d, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	leaq	(,%r15,4), %r13
	xorl	%ebp, %ebp
.LBB10_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	leaq	(%r12,%rbp,4), %r14
	movl	$0, (%r14)
	leaq	(%r14,%r13), %rbx
	movl	$-1082130432, (%r14,%r15,4)     # imm = 0xBF800000
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	.LCPI10_0(%rip), %xmm1          # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	movss	.LCPI10_1(%rip), %xmm1          # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	.LCPI10_2(%rip), %xmm1
	mulss	.LCPI10_3(%rip), %xmm0
	addss	%xmm1, %xmm0
	addq	%r13, %rbx
	movss	%xmm0, (%r14,%r15,8)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI10_0(%rip), %xmm0
	movss	.LCPI10_1(%rip), %xmm1          # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	.LCPI10_4(%rip), %xmm0
	addss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI10_0(%rip), %xmm0
	movss	.LCPI10_1(%rip), %xmm1          # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	.LCPI10_5(%rip), %xmm1
	mulss	.LCPI10_6(%rip), %xmm0
	addss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r15,8)
	incq	%rbp
	cmpq	%rbp, 16(%rsp)                  # 8-byte Folded Reload
	jne	.LBB10_2
.LBB10_3:                               # %._crit_edge
	movq	8(%rsp), %rax                   # 8-byte Reload
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	_Z20allocateBlackScholesiRi, .Lfunc_end10-_Z20allocateBlackScholesiRi
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	">>%d, %d\n"
	.size	.L.str, 10

	.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
