// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::setup_PEs()
void controller::setup_PEs() {
	PEs = new PE*[nRows_PE_Array];
  bus_trigger_PEs_exec            = new bool*[nRows_PE_Array];
  bus_trigger_PEs_zero_initialize = new bool*[nRows_PE_Array];
  bus_trigger_PEs_write_back      = new bool*[nRows_PE_Array];
  bus_trigger_PEs_spatial_reduce  = new bool*[nRows_PE_Array];
  bus_trigger_PEs_update_buf_num_Op1 = new bool*[nRows_PE_Array];
  bus_trigger_PEs_update_buf_num_Op2 = new bool*[nRows_PE_Array];
  bus_trigger_PEs_update_buf_num_Op3 = new bool*[nRows_PE_Array];

	for(auto i=0; i < nRows_PE_Array; i++) {
		PEs[i] = new PE[nCols_PE_Array];
    bus_trigger_PEs_exec[i]             = new bool[nCols_PE_Array]();
    bus_trigger_PEs_zero_initialize[i]  = new bool[nCols_PE_Array]();
    bus_trigger_PEs_write_back[i]       = new bool[nCols_PE_Array]();
    bus_trigger_PEs_spatial_reduce[i]   = new bool[nCols_PE_Array]();
    bus_trigger_PEs_update_buf_num_Op1[i] = new bool[nCols_PE_Array]();
    bus_trigger_PEs_update_buf_num_Op2[i] = new bool[nCols_PE_Array]();
    bus_trigger_PEs_update_buf_num_Op3[i] = new bool[nCols_PE_Array]();

		for(auto j=0; j < nCols_PE_Array; j++) {
      PEs[i][j].setup(i,j);
			PEs[i][j].initialize();
      PEs[i][j].setTriggerFromController( &bus_trigger_PEs_exec[i][j],
        &bus_trigger_PEs_zero_initialize[i][j],
        &bus_trigger_PEs_write_back[i][j],
        &bus_trigger_PEs_spatial_reduce[i][j],
        &bus_trigger_PEs_update_buf_num_Op1[i][j],
        &bus_trigger_PEs_update_buf_num_Op2[i][j],
        &bus_trigger_PEs_update_buf_num_Op3[i][j]);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq $0x60b5ac, %rax         # imm = 0x60B5AC
movzwl (%rax), %r15d
leal (,%r15,8), %r14d
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x10(%rbx)
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x18(%rbx)
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x20(%rbx)
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x28(%rbx)
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x30(%rbx)
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x38(%rbx)
movq %r14, %rdi
callq 0x418d20
movq %rax, 0x40(%rbx)
testl %r15d, %r15d
je 0x40f303
movq $0x60b5ae, %rax         # imm = 0x60B5AE
movzwl (%rax), %r12d
xorl %r13d, %r13d
movzwl %r12w, %r15d
imulq $0x148, %r15, %r14      # imm = 0x148
addq $0x8, %r14
movq %r14, %rdi
callq 0x418d20
movq %r15, (%rax)
leaq 0x8(%rax), %r12
testw %r15w, %r15w
je 0x40f140
movq %rax, 0x8(%rsp)
imulq $-0x148, %r15, %r15     # imm = 0xFEB8
movq %r12, 0x10(%rsp)
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x4163dc
addq $-0x148, %rbp           # imm = 0xFEB8
addq $0x148, %r12            # imm = 0x148
cmpq %rbp, %r15
jne 0x40f114
movq $0x60b5ae, %rax         # imm = 0x60B5AE
movzwl (%rax), %eax
movq 0x10(%rsp), %r12
jmp 0x40f142
xorl %eax, %eax
movq 0x8(%rbx), %rcx
movq %r12, (%rcx,%r13,8)
movzwl %ax, %r14d
movq %r14, %rdi
callq 0x418d20
movq %rax, %r15
xorl %r12d, %r12d
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
movq 0x10(%rbx), %rax
movq %r15, (%rax,%r13,8)
movq %r14, %rdi
callq 0x418d20
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
movq 0x18(%rbx), %rax
movq %r15, (%rax,%r13,8)
movq %r14, %rdi
callq 0x418d20
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
movq 0x20(%rbx), %rax
movq %r15, (%rax,%r13,8)
movq %r14, %rdi
callq 0x418d20
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
movq 0x28(%rbx), %rax
movq %r15, (%rax,%r13,8)
movq %r14, %rdi
callq 0x418d20
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
movq 0x30(%rbx), %rax
movq %r15, (%rax,%r13,8)
movq %r14, %rdi
callq 0x418d20
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
movq 0x38(%rbx), %rax
movq %r15, (%rax,%r13,8)
movq %r14, %rdi
callq 0x418d20
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
movq 0x40(%rbx), %rax
movq %r15, (%rax,%r13,8)
testw %r14w, %r14w
je 0x40f2ed
movzwl %r13w, %ebp
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %rdi
addq %r14, %rdi
movzwl %r15w, %edx
movl %ebp, %esi
callq 0x416908
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %rdi
addq %r14, %rdi
callq 0x416918
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq (%rax,%r13,8), %rdi
addq %r14, %rdi
movq (%rcx,%r13,8), %rsi
addq %r15, %rsi
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rdx
addq %r15, %rdx
movq 0x20(%rbx), %rax
movq (%rax,%r13,8), %rcx
addq %r15, %rcx
movq 0x28(%rbx), %rax
movq (%rax,%r13,8), %r8
addq %r15, %r8
movq 0x30(%rbx), %rax
movq (%rax,%r13,8), %r9
addq %r15, %r9
movq 0x38(%rbx), %rax
movq (%rax,%r13,8), %rax
addq %r15, %rax
movq 0x40(%rbx), %r10
movq (%r10,%r13,8), %r10
addq %r15, %r10
pushq %r10
pushq %rax
callq 0x4169a8
addq $0x10, %rsp
incq %r15
movq $0x60b5ae, %rax         # imm = 0x60B5AE
movzwl (%rax), %r12d
addq $0x148, %r14            # imm = 0x148
cmpq %r12, %r15
jb 0x40f245
incq %r13
movq $0x60b5ac, %rax         # imm = 0x60B5AC
movzwl (%rax), %eax
cmpq %rax, %r13
jb 0x40f0dd
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
testq %rbp, %rbp
je 0x40f33b
negq %rbp
movq 0x8(%rsp), %r15
addq $-0x140, %r15           # imm = 0xFEC0
leaq (%r15,%rbp), %rdi
callq 0x416738
addq $-0x148, %rbp           # imm = 0xFEB8
jne 0x40f329
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x417800
movq %rbx, %rdi
callq 0x4c34a0