// File: /workspace/github_cpp_makefile_star2_O1/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 $0x848, %rsp            # imm = 0x848
movq %rdi, %rbx
addq $0x28, %rdi
callq 0x3aee
movq 0x30(%rbx), %rdi
callq 0x3982
movl %eax, %r14d
movq 0x38(%rbx), %rdi
callq 0x3982
cmpl %eax, %r14d
jne 0x4661
movq 0x30(%rbx), %rdi
callq 0x3978
movl %eax, %r14d
movq 0x38(%rbx), %rdi
callq 0x3978
movq %rax, -0x40(%rbp)
addl %r14d, %eax
movl %eax, -0x2c(%rbp)
movq 0x30(%rbx), %rdi
callq 0x3982
movl %eax, %r15d
movq 0x30(%rbx), %rdi
callq 0x398c
movq %rax, %r13
movq %rbx, -0x48(%rbp)
movq 0x38(%rbx), %rdi
callq 0x398c
movq %rax, %r12
movl %r15d, %eax
imull -0x2c(%rbp), %eax
cltq
movl $0x3, %ecx
mulq %rcx
movq $-0x1, %rdi
cmovnoq %rax, %rdi
callq 0x3030
movq %rax, -0x38(%rbp)
movl %r15d, -0x30(%rbp)
testl %r15d, %r15d
jle 0x462e
movslq %r14d, %rax
movl -0x30(%rbp), %ecx
movq %rcx, -0x58(%rbp)
movl -0x2c(%rbp), %edx
leaq (%rdx,%rdx,2), %rcx
movq %rcx, -0x50(%rbp)
leaq (%rax,%rax,2), %rdi
negl %r14d
movl -0x40(%rbp), %r8d
xorl %r9d, %r9d
movq -0x38(%rbp), %rbx
cmpl $0x0, -0x2c(%rbp)
jle 0x461b
movq %r13, %r11
movq %rbx, %r10
xorl %r15d, %r15d
leal (%r14,%r15), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
addq %r12, %rcx
cmpq %rax, %r15
cmovlq %r11, %rcx
movb 0x2(%rcx), %sil
movb %sil, 0x2(%r10)
movzwl (%rcx), %ecx
movw %cx, (%r10)
incq %r15
addq $0x3, %r10
addq $0x3, %r11
cmpq %r15, %rdx
jne 0x45e7
incq %r9
addq -0x50(%rbp), %rbx
addq %rdi, %r13
addq %r8, %r14
cmpq -0x58(%rbp), %r9
jne 0x45d8
movq -0x48(%rbp), %rbx
addq $0x8, %rbx
movq %rbx, %rdi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0x39ea
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
addq $0x848, %rsp            # imm = 0x848
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x39f6
movq 0x30(%rbx), %rdi
callq 0x3982
movl %eax, %r14d
movq 0x38(%rbx), %rdi
callq 0x3982
leaq 0x1aef(%rip), %rsi      # 0x616c
leaq -0x870(%rbp), %rbx
movq %rbx, %rdi
movl %r14d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x3050
leaq 0x1af7(%rip), %rsi      # 0x6191
leaq -0x460(%rbp), %rdi
movq %rbx, %rdx
callq 0x5ae8
movl $0x408, %edi            # imm = 0x408
callq 0x3090
movq %rax, %rbx
leaq 0x41f3(%rip), %rax      # 0x88b0
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
leaq -0x458(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x30b0
leaq 0x41ac(%rip), %rsi      # 0x8888
movq 0x48fd(%rip), %rdx      # 0x8fe0
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rbx
leaq -0x460(%rbp), %rdi
callq 0x31e8
movq %rbx, %rdi
callq 0x31b0