// File: /workspace/github_cpp_makefile_star2_O3/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 0x1f2071(%rip), %rax    # 0x6018d8
movq %rax, (%rdi)
movq $0x60b5ac, %rax         # imm = 0x60B5AC
cmpw $0x0, (%rax)
je 0x40f989
xorl %r12d, %r12d
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %r14
testq %r14, %r14
je 0x40f8cb
movq -0x8(%r14), %r13
testq %r13, %r13
je 0x40f8b4
leaq -0x148(%r14), %rbp
imulq $0x148, %r13, %r15      # imm = 0x148
leaq (%r15,%rbp), %rdi
callq 0x416738
addq $-0x148, %r15           # imm = 0xFEB8
jne 0x40f8a2
addq $-0x8, %r14
imulq $0x148, %r13, %rsi      # imm = 0x148
addq $0x8, %rsi
movq %r14, %rdi
callq 0x417800
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f8dd
callq 0x4177f0
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f8ef
callq 0x4177f0
movq 0x20(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f901
callq 0x4177f0
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f913
callq 0x4177f0
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f925
callq 0x4177f0
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f937
callq 0x4177f0
movq 0x40(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f949
callq 0x4177f0
movq 0x90(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f95e
callq 0x4177f0
movq 0x98(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x40f973
callq 0x4177f0
incq %r12
movq $0x60b5ac, %rax         # imm = 0x60B5AC
movzwl (%rax), %eax
cmpq %rax, %r12
jb 0x40f87e
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x40f997
callq 0x4177f0
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x40f9a5
callq 0x4177f0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x40f9b3
callq 0x4177f0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x40f9c1
callq 0x4177f0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x40f9cf
callq 0x4177f0
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x40f9dd
callq 0x4177f0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x40f9eb
callq 0x4177f0
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x40f9f9
callq 0x4177f0
movq 0x50(%rbx), %r12
testq %r12, %r12
je 0x40fa3e
leaq -0x8(%r12), %r14
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x40fa2b
addq $-0x10, %r12
movq %r15, %r13
shlq $0x4, %r13
leaq (%r12,%r13), %rdi
callq 0x41132c
addq $-0x10, %r13
jne 0x40fa1c
shlq $0x4, %r15
orq $0x8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x417800
movq 0x88(%rbx), %r12
testq %r12, %r12
je 0x40fa86
leaq -0x8(%r12), %r14
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x40fa73
addq $-0x10, %r12
movq %r15, %r13
shlq $0x4, %r13
leaq (%r12,%r13), %rdi
callq 0x412330
addq $-0x10, %r13
jne 0x40fa64
shlq $0x4, %r15
orq $0x8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x417800
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x40fa94
callq 0x4177f0
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x40faa2
callq 0x4177f0
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x40fab0
callq 0x4177f0
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x40fabe
callq 0x4177f0
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x40facc
callq 0x4177f0
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x40fadd
callq 0x4177f0
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x40faee
callq 0x4177f0
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x40faff
callq 0x4177f0
movq 0xd8(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb10
callq 0x4177f0
movq 0xe8(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb21
callq 0x4177f0
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb32
callq 0x4177f0
movq 0xf0(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb43
callq 0x4177f0
movq 0x100(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb54
callq 0x4177f0
movq 0x108(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb65
callq 0x4177f0
movq 0x110(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb76
callq 0x4177f0
movq 0x118(%rbx), %rdi
testq %rdi, %rdi
je 0x40fb87
callq 0x4177f0
movq 0xa8(%rbx), %r14
testq %r14, %r14
je 0x40fb9b
movq %r14, %rdi
callq 0x411194
movl $0x28, %esi
movq %r14, %rdi
callq 0x4177e0
movq 0xb0(%rbx), %rbx
testq %rbx, %rbx
je 0x40fbbc
movq %rbx, %rdi
callq 0x4174e6
movl $0x8, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4177e0
nop