// File: /workspace/github_cpp_makefile_star2_O2/CodyNault[P]Image-Filter-Dataflow/src/filters.cpp
// Function: LRConcat::Execute()
void LRConcat::Execute()
{
	TwoInputCheck();
	if(inputImg1->GetHeight() != inputImg2->GetHeight()){
		char msg[1028];
		sprintf(msg, "LRConcat: heights must match: %d, %d", inputImg1->GetHeight(), inputImg2->GetHeight());
		DataFlowException except("LRConcat", msg);
		throw except;
	}
	int leftWidth = inputImg1->GetWidth();
	int rightWidth = inputImg2->GetWidth();
	int newWidth = leftWidth + rightWidth;
	int newHeight = inputImg1->GetHeight();
	Pixel *leftBuffer = inputImg1->GetBuffer();
	Pixel *rightBuffer = inputImg2->GetBuffer();
	Pixel *combinedBuffer = new Pixel[ newWidth * newHeight];
	for(int i = 0; i < newHeight; i++)
	{
		for(int j = 0; j < newWidth; j++)
		{
			if( j < leftWidth)
			{
				combinedBuffer[i*newWidth + j] = leftBuffer[i * leftWidth + j];	
			}else{
				combinedBuffer[i*newWidth + j] = rightBuffer[i * rightWidth + j - leftWidth];	
			}
		}
	}
	outputImg.ResetSize(newWidth, newHeight);
	outputImg.SetBuffer(combinedBuffer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movq %rdi, %rbx
addq $0x28, %rdi
callq 0x3a3a
movq 0x30(%rbx), %rdi
callq 0x38e2
movl %eax, %r14d
movq 0x38(%rbx), %rdi
callq 0x38e2
cmpl %eax, %r14d
jne 0x46f6
movq 0x30(%rbx), %rdi
callq 0x38d8
movl %eax, %r14d
movq %r14, -0x38(%rbp)
movq 0x38(%rbx), %rdi
callq 0x38d8
movq %rax, -0x30(%rbp)
addl %eax, %r14d
movq 0x30(%rbx), %rdi
callq 0x38e2
movl %eax, %r15d
movq 0x30(%rbx), %rdi
callq 0x38ec
movq %rax, %r12
movq %rbx, -0x48(%rbp)
movq 0x38(%rbx), %rdi
callq 0x38ec
movq %rax, %r13
movl %r15d, %eax
imull %r14d, %eax
cltq
pushq $0x3
popq %rcx
mulq %rcx
pushq $-0x1
popq %rdi
cmovnoq %rax, %rdi
callq 0x3030
xorl %esi, %esi
testl %r14d, %r14d
movl $0x0, %ecx
cmovgl %r14d, %ecx
movslq -0x38(%rbp), %rdx
movl %r14d, -0x40(%rbp)
movslq %r14d, %rdi
testl %r15d, %r15d
movl %r15d, -0x3c(%rbp)
movl %r15d, %r8d
cmovlel %esi, %r8d
leaq (%rdi,%rdi,2), %rdi
movq %rdi, -0x38(%rbp)
leaq (%rdx,%rdx,2), %rdi
movq %rdi, -0x50(%rbp)
movl %edx, %r9d
negl %r9d
movl -0x30(%rbp), %r10d
movq %rax, -0x30(%rbp)
movq %rax, %r14
movq %r8, %rax
cmpq %rax, %rsi
je 0x46c3
movq %r12, %r15
movq %r14, %r11
xorl %ebx, %ebx
cmpq %rbx, %rcx
je 0x46b3
leal (%r9,%rbx), %edi
movslq %edi, %rdi
leaq (%rdi,%rdi,2), %rdi
addq %r13, %rdi
cmpq %rdx, %rbx
cmovlq %r15, %rdi
movb 0x2(%rdi), %r8b
movb %r8b, 0x2(%r11)
movzwl (%rdi), %edi
movw %di, (%r11)
incq %rbx
addq $0x3, %r11
addq $0x3, %r15
jmp 0x467d
incq %rsi
addq -0x38(%rbp), %r14
addq -0x50(%rbp), %r12
addq %r10, %r9
jmp 0x4670
movq -0x48(%rbp), %rbx
addq $0x8, %rbx
movq %rbx, %rdi
movl -0x40(%rbp), %esi
movl -0x3c(%rbp), %edx
callq 0x3936
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3942
movq 0x30(%rbx), %rdi
callq 0x38e2
movl %eax, %r14d
movq 0x38(%rbx), %rdi
callq 0x38e2
leaq 0x1a5a(%rip), %rsi      # 0x616c
leaq -0x860(%rbp), %rbx
movq %rbx, %rdi
movl %r14d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x3050
leaq 0x1a62(%rip), %rsi      # 0x6191
leaq -0x458(%rbp), %rdi
movq %rbx, %rdx
callq 0x5b4c
movl $0x408, %edi            # imm = 0x408
callq 0x30a0
movq %rax, %rbx
leaq 0x515e(%rip), %rax      # 0x98b0
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
leaq -0x450(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x30d0
leaq 0x5117(%rip), %rsi      # 0x9888
movq 0x5868(%rip), %rdx      # 0x9fe0
movq %rbx, %rdi
callq 0x31c0
movq %rax, %rbx
leaq -0x458(%rbp), %rdi
callq 0x3208
movq %rbx, %rdi
callq 0x31d0
nop