// File: /workspace/github_cpp_makefile_star2_O2/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 0x1f27ef(%rip), %rax    # 0x5fe8d8
movq %rax, (%rdi)
xorl %r15d, %r15d
movq $0x6085ac, %rax         # imm = 0x6085AC
movzwl (%rax), %eax
movq 0x8(%rbx), %rdi
cmpq %rax, %r15
jae 0x40c1ff
movq (%rdi,%r15,8), %r14
testq %r14, %r14
je 0x40c14f
movq -0x8(%r14), %r13
testq %r13, %r13
je 0x40c138
leaq -0x148(%r14), %rbp
imulq $0x148, %r13, %r12      # imm = 0x148
leaq (%r12,%rbp), %rdi
callq 0x411d3c
addq $-0x148, %r12           # imm = 0xFEB8
jne 0x40c126
addq $-0x8, %r14
imulq $0x148, %r13, %rsi      # imm = 0x148
addq $0x8, %rsi
movq %r14, %rdi
callq 0x412c70
movq 0x10(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c161
callq 0x412c60
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c173
callq 0x412c60
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c185
callq 0x412c60
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c197
callq 0x412c60
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c1a9
callq 0x412c60
movq 0x38(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c1bb
callq 0x412c60
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c1cd
callq 0x412c60
movq 0x90(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c1e2
callq 0x412c60
movq 0x98(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x40c1f7
callq 0x412c60
incq %r15
jmp 0x40c0ef
testq %rdi, %rdi
je 0x40c209
callq 0x412c60
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x40c217
callq 0x412c60
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x40c225
callq 0x412c60
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x40c233
callq 0x412c60
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x40c241
callq 0x412c60
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x40c24f
callq 0x412c60
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x40c25d
callq 0x412c60
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x40c26b
callq 0x412c60
movq 0x50(%rbx), %r12
testq %r12, %r12
je 0x40c2b0
leaq -0x8(%r12), %r14
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x40c29d
addq $-0x10, %r12
movq %r15, %r13
shlq $0x4, %r13
leaq (%r12,%r13), %rdi
callq 0x40da0c
addq $-0x10, %r13
jne 0x40c28e
shlq $0x4, %r15
orq $0x8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x412c70
movq 0x88(%rbx), %r12
testq %r12, %r12
je 0x40c2f8
leaq -0x8(%r12), %r14
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x40c2e5
addq $-0x10, %r12
movq %r15, %r13
shlq $0x4, %r13
leaq (%r12,%r13), %rdi
callq 0x40e9b0
addq $-0x10, %r13
jne 0x40c2d6
shlq $0x4, %r15
orq $0x8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x412c70
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x40c306
callq 0x412c60
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x40c314
callq 0x412c60
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x40c322
callq 0x412c60
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x40c330
callq 0x412c60
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x40c33e
callq 0x412c60
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x40c34f
callq 0x412c60
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x40c360
callq 0x412c60
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x40c371
callq 0x412c60
movq 0xd8(%rbx), %rdi
testq %rdi, %rdi
je 0x40c382
callq 0x412c60
movq 0xe8(%rbx), %rdi
testq %rdi, %rdi
je 0x40c393
callq 0x412c60
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x40c3a4
callq 0x412c60
movq 0xf0(%rbx), %rdi
testq %rdi, %rdi
je 0x40c3b5
callq 0x412c60
movq 0x100(%rbx), %rdi
testq %rdi, %rdi
je 0x40c3c6
callq 0x412c60
movq 0x108(%rbx), %rdi
testq %rdi, %rdi
je 0x40c3d7
callq 0x412c60
movq 0x110(%rbx), %rdi
testq %rdi, %rdi
je 0x40c3e8
callq 0x412c60
movq 0x118(%rbx), %rdi
testq %rdi, %rdi
je 0x40c3f9
callq 0x412c60
movq 0xa8(%rbx), %r14
testq %r14, %r14
je 0x40c40d
movq %r14, %rdi
callq 0x40d890
pushq $0x28
popq %rsi
movq %r14, %rdi
callq 0x412c50
movq 0xb0(%rbx), %rbx
testq %rbx, %rbx
je 0x40c42c
movq %rbx, %rdi
callq 0x412956
pushq $0x8
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x412c50
nop