// File: /workspace/github_c_makefile_star2_O0/xtanitfy[P]Murphy/src/layers/output_layer.c
// Function: OutputLayerForward
int OutputLayerForward(NET_PARA_s *pNetPara,LAYER_s *pLayer)
{
	CHECK_EXPR_RET(pLayer == NULL,-1);
	BLOB_s *pPrevBlob = pLayer->pPrev[0]->pData;
	CHECK_EXPR_RET(pPrevBlob == NULL,-1);

	OUTPUT_LAYER_PARA_s *pPara = &pLayer->para->select.outputLayer;
	BLOB_s *pPrevData = pPrevBlob;
	BLOB_s *pCurrData = pLayer->pData;
	
	CHECK_EXPR_RET(pCurrData == NULL,-1);
	CHECK_EXPR_RET(pCurrData->heightSize!= 1,-1);
	CHECK_EXPR_RET(pCurrData->widthSize!= 1,-1);
	CHECK_EXPR_RET(pLayer->k == NULL,-1);
	CHECK_EXPR_RET(pLayer->b == NULL,-1);
	int kh = pLayer->k->heightSize;
	int kw = pLayer->k->widthSize;
	CHECK_EXPR_RET(kh != 1,-1);
	CHECK_EXPR_RET(kw != 1,-1);

	BLOB_DATA_PTR(pCurrData,ptrCurr);
	BLOB_DATA_PTR(pPrevData,ptrPrev);
	BLOB_DATA_PTR(pLayer->k,ptrK);
	BLOB_DATA_PTR(pLayer->b,ptrB);

	double tmp = 0;
	
	for (int i_batch = 0;i_batch < pCurrData->numSize;i_batch++) {
		for (int i_out = 0;i_out < pCurrData->channelSize;i_out++) {
			tmp = 0;
			for (int i_in = 0;i_in < pPrevBlob->channelSize;i_in++) {
				tmp += ptrPrev[i_batch][i_in][0][0] * \
					ptrK[i_out][i_in][0][0];
			}	
			ptrCurr[i_batch][i_out][0][0]  = pPara->function(tmp + \
						ptrB[0][i_out][0][0],FUNC_VALUE);
		}
	}
	
	//pCurrData->type = BLOB_TYPE_DATA;
	//LOG_writeBlobToTxtFile("output.txt",pCurrData);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x9237
leaq 0x1e04(%rip), %rdi      # 0xb015
leaq 0x25f8(%rip), %rsi      # 0xb810
leaq 0x2617(%rip), %rdx      # 0xb836
movl $0x44, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x18(%rbp), %rax
movq 0xa8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x927e
leaq 0x1dbd(%rip), %rdi      # 0xb015
leaq 0x25b1(%rip), %rsi      # 0xb810
leaq 0x25d0(%rip), %rdx      # 0xb836
movl $0x46, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x288, %rax            # imm = 0x288
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x92d8
leaq 0x1d63(%rip), %rdi      # 0xb015
leaq 0x2557(%rip), %rsi      # 0xb810
leaq 0x2576(%rip), %rdx      # 0xb836
movl $0x4c, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x38(%rbp), %rax
cmpq $0x1, 0x20(%rax)
je 0x9310
leaq 0x1d2b(%rip), %rdi      # 0xb015
leaq 0x251f(%rip), %rsi      # 0xb810
leaq 0x253e(%rip), %rdx      # 0xb836
movl $0x4d, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x38(%rbp), %rax
cmpq $0x1, 0x28(%rax)
je 0x9348
leaq 0x1cf3(%rip), %rdi      # 0xb015
leaq 0x24e7(%rip), %rsi      # 0xb810
leaq 0x2506(%rip), %rdx      # 0xb836
movl $0x4e, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x9380
leaq 0x1cbb(%rip), %rdi      # 0xb015
leaq 0x24af(%rip), %rsi      # 0xb810
leaq 0x24ce(%rip), %rdx      # 0xb836
movl $0x4f, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x93b8
leaq 0x1c83(%rip), %rdi      # 0xb015
leaq 0x2477(%rip), %rsi      # 0xb810
leaq 0x2496(%rip), %rdx      # 0xb836
movl $0x50, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x3c(%rbp)
je 0x9409
leaq 0x1c32(%rip), %rdi      # 0xb015
leaq 0x2426(%rip), %rsi      # 0xb810
leaq 0x2445(%rip), %rdx      # 0xb836
movl $0x53, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
cmpl $0x1, -0x40(%rbp)
je 0x943c
leaq 0x1bff(%rip), %rdi      # 0xb015
leaq 0x23f3(%rip), %rsi      # 0xb810
leaq 0x2412(%rip), %rdx      # 0xb836
movl $0x54, %ecx
movb $0x0, %al
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9717
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movslq -0x6c(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x9710
movl $0x0, -0x70(%rbp)
movslq -0x70(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x9700
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x0, -0x74(%rbp)
movslq -0x74(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x9650
movq -0x98(%rbp), %rcx
movq -0xa0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
movq -0xb8(%rbp), %r9
movq -0xc0(%rbp), %r10
movq -0x50(%rbp), %rax
movslq -0x6c(%rbp), %r8
imulq %r9, %r10
imulq %rdx, %r10
imulq %r10, %r8
shlq $0x3, %r8
addq %r8, %rax
movslq -0x74(%rbp), %r8
imulq %rdx, %r9
imulq %r9, %r8
shlq $0x3, %r8
addq %r8, %rax
imulq $0x0, %rdx, %rdx
movsd (%rax,%rdx,8), %xmm0
movq -0x58(%rbp), %rax
movslq -0x70(%rbp), %rdx
imulq %rsi, %rdi
imulq %rcx, %rdi
imulq %rdi, %rdx
shlq $0x3, %rdx
addq %rdx, %rax
movslq -0x74(%rbp), %rdx
imulq %rcx, %rsi
imulq %rsi, %rdx
shlq $0x3, %rdx
addq %rdx, %rax
imulq $0x0, %rcx, %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x68(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x9586
movq -0x80(%rbp), %rdx
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movsd -0x68(%rbp), %xmm0
movq -0x60(%rbp), %rcx
imulq %rdi, %rsi
imulq %rdx, %rsi
imulq $0x0, %rsi, %rsi
shlq $0x3, %rsi
addq %rsi, %rcx
movslq -0x70(%rbp), %rsi
imulq %rdx, %rdi
imulq %rdi, %rsi
shlq $0x3, %rsi
addq %rsi, %rcx
imulq $0x0, %rdx, %rdx
addsd (%rcx,%rdx,8), %xmm0
xorl %edi, %edi
callq *%rax
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rcx
movq -0x48(%rbp), %rax
movslq -0x6c(%rbp), %rdx
imulq %rsi, %rdi
imulq %rcx, %rdi
imulq %rdi, %rdx
shlq $0x3, %rdx
addq %rdx, %rax
movslq -0x70(%rbp), %rdx
imulq %rcx, %rsi
imulq %rsi, %rdx
shlq $0x3, %rdx
addq %rdx, %rax
imulq $0x0, %rcx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x9565
jmp 0x9702
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x954c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)