// File: /workspace/github_cpp_makefile_star2_O1/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::~controller()
controller::~controller()
{
  for(auto i=0; i < nRows_PE_Array; i++) {
    delete[] PEs[i];
    delete[] bus_trigger_PEs_exec[i];
    delete[] bus_trigger_PEs_zero_initialize[i];
    delete[] bus_trigger_PEs_write_back[i];
    delete[] bus_trigger_PEs_spatial_reduce[i];
    delete[] bus_trigger_PEs_update_buf_num_Op1[i];
    delete[] bus_trigger_PEs_update_buf_num_Op2[i];
    delete[] bus_trigger_PEs_update_buf_num_Op3[i];

    delete[] dataInFromNetwork[i];
    delete[] writeBackFromNetwork[i];
  }
  delete[] PEs;
  delete[] bus_trigger_PEs_exec;
  delete[] bus_trigger_PEs_zero_initialize;
  delete[] bus_trigger_PEs_write_back;
  delete[] bus_trigger_PEs_spatial_reduce;
  delete[] bus_trigger_PEs_update_buf_num_Op1;
  delete[] bus_trigger_PEs_update_buf_num_Op2;
  delete[] bus_trigger_PEs_update_buf_num_Op3;

  delete[] network_inputs;
  delete[] network_outputs;
  delete[] configNetwork;
  delete[] forwardDataToNetwork;
  delete[] dataOutToNetwork;
  delete[] rowTagDataToNetwork;
  delete[] colTagDataToNetwork;
  delete[] cnt_data_distribution;
  delete[] dataInFromNetwork;
  delete[] writeBackFromNetwork;

  delete[] cnt_prefetch_via_network_RF_pass;
  delete[] idx_read_network_packet;
	delete[] cnt_writeback_via_network_RF_pass;
  delete[] idx_write_network_packet;
  delete[] network_read_op_comm_completed;
  delete[] network_write_op_comm_completed;

  delete[] is_data_collected;
  delete[] collected_data;

  delete DMAC;
  delete scratchpad_mem;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1f20f5(%rip), %rax    # 0x6018d8
movq %rax, (%rdi)
movq $0x60b5ac, %rax         # imm = 0x60B5AC
cmpw $0x0, (%rax)
je 0x40f905
xorl %r12d, %r12d
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %r14
testq %r14, %r14
je 0x40f847
movq -0x8(%r14), %r13
testq %r13, %r13
je 0x40f830
leaq -0x148(%r14), %rbp
imulq $0x148, %r13, %r15      # imm = 0x148
leaq (%r15,%rbp), %rdi
callq 0x415bd6
addq $-0x148, %r15           # imm = 0xFEB8
jne 0x40f81e
addq $-0x8, %r14
imulq $0x148, %r13, %rsi      # imm = 0x148
addq $0x8, %rsi
movq %r14, %rdi
callq 0x416cc0
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f859
callq 0x416cb0
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f86b
callq 0x416cb0
movq 0x20(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f87d
callq 0x416cb0
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f88f
callq 0x416cb0
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f8a1
callq 0x416cb0
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f8b3
callq 0x416cb0
movq 0x40(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f8c5
callq 0x416cb0
movq 0x90(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f8da
callq 0x416cb0
movq 0x98(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f8ef
callq 0x416cb0
incq %r12
movq $0x60b5ac, %rax         # imm = 0x60B5AC
movzwl (%rax), %eax
cmpq %rax, %r12
jb 0x40f7fa
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x40f913
callq 0x416cb0
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x40f921
callq 0x416cb0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x40f92f
callq 0x416cb0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x40f93d
callq 0x416cb0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x40f94b
callq 0x416cb0
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x40f959
callq 0x416cb0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x40f967
callq 0x416cb0
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x40f975
callq 0x416cb0
movq 0x50(%rbx), %r12
testq %r12, %r12
je 0x40f9ba
leaq -0x8(%r12), %r14
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x40f9a7
addq $-0x10, %r12
movq %r15, %r13
shlq $0x4, %r13
leaq (%r12,%r13), %rdi
callq 0x411290
addq $-0x10, %r13
jne 0x40f998
shlq $0x4, %r15
orq $0x8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x416cc0
movq 0x88(%rbx), %r12
testq %r12, %r12
je 0x40fa02
leaq -0x8(%r12), %r14
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x40f9ef
addq $-0x10, %r12
movq %r15, %r13
shlq $0x4, %r13
leaq (%r12,%r13), %rdi
callq 0x41181a
addq $-0x10, %r13
jne 0x40f9e0
shlq $0x4, %r15
orq $0x8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x416cc0
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa10
callq 0x416cb0
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa1e
callq 0x416cb0
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa2c
callq 0x416cb0
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa3a
callq 0x416cb0
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa48
callq 0x416cb0
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa59
callq 0x416cb0
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa6a
callq 0x416cb0
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa7b
callq 0x416cb0
movq 0xd8(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa8c
callq 0x416cb0
movq 0xe8(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa9d
callq 0x416cb0
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x40faae
callq 0x416cb0
movq 0xf0(%rbx), %rdi
testq %rdi, %rdi
je 0x40fabf
callq 0x416cb0
movq 0x100(%rbx), %rdi
testq %rdi, %rdi
je 0x40fad0
callq 0x416cb0
movq 0x108(%rbx), %rdi
testq %rdi, %rdi
je 0x40fae1
callq 0x416cb0
movq 0x110(%rbx), %rdi
testq %rdi, %rdi
je 0x40faf2
callq 0x416cb0
movq 0x118(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb03
callq 0x416cb0
movq 0xa8(%rbx), %r14
testq %r14, %r14
je 0x40fb24
movq %r14, %rdi
callq 0x4110f8
movl $0x28, %esi
movq %r14, %rdi
callq 0x416ca0
movq 0xb0(%rbx), %rbx
testq %rbx, %rbx
je 0x40fb53
movq %rbx, %rdi
callq 0x4169a2
movl $0x8, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x416ca0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq