// File: /workspace/github_cpp_makefile_star2_O3/hey-yahei[P]ConvNet/src/Concat.cpp
// Function: Concat::Concat(int*, ...)
Concat::Concat(int ishape[], ...) {
	va_list ap;
	int cnt = 0;
	int *temp;

	// First arg
	va_start(ap, ishape);
	temp = (int*)malloc(sizeof(int) * 4);
	memcpy(temp, ishape, sizeof(int) * 4);
	in_shape.push_back(temp);
	memcpy(out_shape, ishape, sizeof(int) * 4);
	cnt++;

	// Other args
	while(nullptr != (ishape=va_arg(ap, int*))){
		// Push into vector
		temp = (int*)malloc(sizeof(int) * 4);
		memcpy(temp, ishape, sizeof(int) * 4);
		in_shape.push_back(temp);

		// Check if shapes match
		if ((temp[0] != out_shape[0]) || (temp[2] != out_shape[2]) || (temp[3] != out_shape[3])) {
			cerr << "Concat: shapes of input not match." << endl;
			exit(1);
		}

		// Update out_channels and counter
		out_shape[1] += temp[1];
		cnt++;
	}
	va_end(ap);

	out_chw = out_shape[1] * out_shape[2] * out_shape[3];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0xf0(%rbp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x2d3b
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rax, 0x28(%rdi)
movl %eax, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movl %eax, 0x40(%rdi)
movq %rax, 0x48(%rdi)
movq %rax, 0x58(%rdi)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, -0x40(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %rsi, -0x30(%rbp)
movl $0x10, %edi
callq 0x2240
movq %rax, -0x28(%rbp)
movups (%r14), %xmm0
movups %xmm0, (%rax)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2da0
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x2dac
leaq -0x28(%rbp), %rdx
movq %rbx, %rdi
callq 0x31f0
leaq 0x18(%rbx), %r15
movups (%r14), %xmm0
movups %xmm0, 0x18(%rbx)
leaq -0x28(%rbp), %r14
movl -0x40(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x2dd4
movq %rcx, %rax
addq -0x30(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x40(%rbp)
jmp 0x2de0
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %r12
testq %r12, %r12
je 0x2e43
movl $0x10, %edi
callq 0x2240
movq %rax, -0x28(%rbp)
movups (%r12), %xmm0
movups %xmm0, (%rax)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2e12
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x2e1d
movq %rbx, %rdi
movq %r14, %rdx
callq 0x31f0
movq -0x28(%rbp), %rax
movl (%rax), %ecx
cmpl (%r15), %ecx
jne 0x2e61
movl 0x8(%rax), %ecx
cmpl 0x20(%rbx), %ecx
jne 0x2e61
movl 0xc(%rax), %ecx
cmpl 0x24(%rbx), %ecx
jne 0x2e61
movl 0x4(%rax), %eax
addl %eax, 0x1c(%rbx)
jmp 0x2dbc
movl 0x20(%rbx), %eax
imull 0x1c(%rbx), %eax
imull 0x24(%rbx), %eax
movl %eax, 0x50(%rbx)
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x6188(%rip), %rdi      # 0x8ff0
leaq 0x3421(%rip), %rsi      # 0x6290
movl $0x22, %edx
callq 0x21e0
movq 0x6170(%rip), %rdi      # 0x8ff0
callq 0x20d0
movl $0x1, %edi
callq 0x2210
jmp 0x2e91
movq %rax, %r14
leaq 0x28(%rbx), %rdi
callq 0x2c94
leaq 0x10(%rbx), %rsi
movq %rbx, %rdi
callq 0x2330
movq %r14, %rdi
callq 0x22e0
movq %rax, %rdi
callq 0x2ccb
nop