// File: /workspace/github_c_makefile_star2_O0/xtanitfy[P]Murphy/src/layers/samp_layer.c
// Function: SampLayerForward
int SampLayerForward(NET_PARA_s *pNetPara,LAYER_s *pLayer)
{
	SAMP_LAYER_PARA_s *pPara = &pLayer->para->select.sampLayer;

	BLOB_s *pPrevBlob = pLayer->pPrev[0]->pData;
	int nx =  pPrevBlob->widthSize/ pPara->stride;
	int ny =  pPrevBlob->heightSize/ pPara->stride;

	BLOB_s *pData = pLayer->pData;
	BLOB_DATA_PTR(pData,ptrCurr);
	BLOB_DATA_PTR(pPrevBlob,ptrPrev);
	double scale = (double)1 / (pPara->stride * pPara->stride);
	int xStart = 0,yStart = 0;
	
	
	for (int i_batch = 0;i_batch < pData->numSize;i_batch++) {
		for (int i_out = 0;i_out < pData->channelSize;i_out++) {
			for (int y =0;y < ny;y++) {
				for (int x = 0;x < nx;x++) {
					yStart = y * pPara->stride;
					xStart = x * pPara->stride;
					ptrCurr[i_batch][i_out][y][x] = 0;
					for (int by = yStart; by < yStart + pPara->stride;by++) {
						for (int bx = xStart; bx < xStart + pPara->stride;bx++) {
							ptrCurr[i_batch][i_out][y][x] += \
									ptrPrev[i_batch][i_out][by][bx] * scale;
						}
					}
				}
			}
		}
	}
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x18, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x288, %rax            # imm = 0x288
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x4(%rcx), %rcx
xorl %edx, %edx
divq %rcx
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x4(%rcx), %rcx
xorl %edx, %edx
divq %rcx
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
imull 0x4(%rcx), %eax
cvtsi2sd %eax, %xmm1
movsd 0xe93(%rip), %xmm0      # 0xb008
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movslq -0x54(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0xa3b1
movl $0x0, -0x58(%rbp)
movslq -0x58(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0xa3a1
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xa391
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xa381
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdi
movl -0x5c(%rbp), %eax
movq -0x18(%rbp), %rcx
imull 0x4(%rcx), %eax
movl %eax, -0x50(%rbp)
movl -0x60(%rbp), %eax
movq -0x18(%rbp), %rcx
imull 0x4(%rcx), %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rax
movslq -0x54(%rbp), %rcx
imulq %rsi, %rdi
imulq %rdx, %rdi
imulq %rdi, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x58(%rbp), %rcx
imulq %rdx, %rsi
imulq %rsi, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x5c(%rbp), %rcx
imulq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x60(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl -0x50(%rbp), %ecx
movq -0x18(%rbp), %rdx
addl 0x4(%rdx), %ecx
cmpl %ecx, %eax
jge 0xa371
movl -0x4c(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl -0x4c(%rbp), %ecx
movq -0x18(%rbp), %rdx
addl 0x4(%rdx), %ecx
cmpl %ecx, %eax
jge 0xa361
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdi
movq -0x70(%rbp), %r8
movq -0x78(%rbp), %r9
movq -0x80(%rbp), %r10
movq -0x40(%rbp), %rax
movslq -0x54(%rbp), %rcx
imulq %r9, %r10
imulq %r8, %r10
imulq %r10, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x58(%rbp), %rcx
imulq %r8, %r9
imulq %r9, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x64(%rbp), %rcx
imulq %r8, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x68(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd -0x48(%rbp), %xmm2
movq -0x38(%rbp), %rax
movslq -0x54(%rbp), %rcx
imulq %rsi, %rdi
imulq %rdx, %rdi
imulq %rdi, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x58(%rbp), %rcx
imulq %rdx, %rsi
imulq %rsi, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x5c(%rbp), %rcx
imulq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x60(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0xa27f
jmp 0xa363
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xa264
jmp 0xa373
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0xa1d8
jmp 0xa383
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0xa1c5
jmp 0xa393
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xa1ac
jmp 0xa3a3
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xa193
xorl %eax, %eax
addq $0x18, %rsp
popq %rbp
retq
nopl (%rax)