// File: 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
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq 0x1fe84a(%rip), %rcx    # 0x6148a8
addq $0x10, %rcx
movq %rcx, (%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq $0x61e5ac, %rcx         # imm = 0x61E5AC
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x41625c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x416105
movq -0x20(%rbp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rcx), %rax
movq %rax, -0x30(%rbp)
imulq $0x148, %rax, %rdx      # imm = 0x148
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x28(%rbp)
je 0x4160ed
movq -0x28(%rbp), %rdi
addq $-0x148, %rdi           # imm = 0xFEB8
movq %rdi, -0x40(%rbp)
callq 0x422d10
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x28(%rbp)
jne 0x4160c8
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq $0x8, %rsi
callq 0x4248b0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x416128
movq -0x48(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x41614b
movq -0x50(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x41616e
movq -0x58(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
je 0x416191
movq -0x60(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x4161b4
movq -0x68(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, %rax
je 0x4161d7
movq -0x70(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0x4161fa
movq -0x78(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
je 0x416220
movq -0x80(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x41624c
movq -0x88(%rbp), %rdi
callq 0x4248a0
jmp 0x41624e
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x41606c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
je 0x41627d
movq -0x90(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, %rax
je 0x41629e
movq -0x98(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, %rax
je 0x4162bf
movq -0xa0(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, %rax
je 0x4162e0
movq -0xa8(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, %rax
je 0x416301
movq -0xb0(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, %rax
je 0x416322
movq -0xb8(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, %rax
je 0x416343
movq -0xc0(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
je 0x416364
movq -0xc8(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, %rax
je 0x4163ff
movq -0xd0(%rbp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rcx), %rdx
movq %rdx, -0xe0(%rbp)
shlq $0x4, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0xd8(%rbp)
je 0x4163e4
movq -0xd8(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0xf0(%rbp)
callq 0x419130
movq -0xd0(%rbp), %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xd8(%rbp)
jne 0x4163b3
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
shlq $0x4, %rsi
addq $0x8, %rsi
callq 0x4248b0
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, %rax
je 0x41649d
movq -0xf8(%rbp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, -0x110(%rbp)
movq -0x8(%rcx), %rdx
movq %rdx, -0x108(%rbp)
shlq $0x4, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x100(%rbp)
je 0x416482
movq -0x100(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x118(%rbp)
callq 0x419df0
movq -0xf8(%rbp), %rcx
movq -0x118(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x100(%rbp)
jne 0x416451
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %rsi
shlq $0x4, %rsi
addq $0x8, %rsi
callq 0x4248b0
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x120(%rbp)
cmpq $0x0, %rax
je 0x4164be
movq -0x120(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0x4164df
movq -0x128(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x130(%rbp)
cmpq $0x0, %rax
je 0x416500
movq -0x130(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x138(%rbp)
cmpq $0x0, %rax
je 0x416521
movq -0x138(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x140(%rbp)
cmpq $0x0, %rax
je 0x416542
movq -0x140(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x148(%rbp)
cmpq $0x0, %rax
je 0x416566
movq -0x148(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x150(%rbp)
cmpq $0x0, %rax
je 0x41658a
movq -0x150(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq %rax, -0x158(%rbp)
cmpq $0x0, %rax
je 0x4165ae
movq -0x158(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x160(%rbp)
cmpq $0x0, %rax
je 0x4165d2
movq -0x160(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0xe8(%rax), %rax
movq %rax, -0x168(%rbp)
cmpq $0x0, %rax
je 0x4165f6
movq -0x168(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0xe0(%rax), %rax
movq %rax, -0x170(%rbp)
cmpq $0x0, %rax
je 0x41661a
movq -0x170(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0xf0(%rax), %rax
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
je 0x41663e
movq -0x178(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x100(%rax), %rax
movq %rax, -0x180(%rbp)
cmpq $0x0, %rax
je 0x416662
movq -0x180(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x108(%rax), %rax
movq %rax, -0x188(%rbp)
cmpq $0x0, %rax
je 0x416686
movq -0x188(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x110(%rax), %rax
movq %rax, -0x190(%rbp)
cmpq $0x0, %rax
je 0x4166aa
movq -0x190(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0x118(%rax), %rax
movq %rax, -0x198(%rbp)
cmpq $0x0, %rax
je 0x4166ce
movq -0x198(%rbp), %rdi
callq 0x4248a0
movq -0x18(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x1a0(%rbp)
cmpq $0x0, %rax
je 0x416703
movq -0x1a0(%rbp), %rdi
callq 0x418cf0
movq -0x1a0(%rbp), %rdi
movl $0x28, %esi
callq 0x424890
movq -0x18(%rbp), %rax
movq 0xb0(%rax), %rax
movq %rax, -0x1a8(%rbp)
cmpq $0x0, %rax
je 0x416738
movq -0x1a8(%rbp), %rdi
callq 0x424520
movq -0x1a8(%rbp), %rdi
movl $0x8, %esi
callq 0x424890
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw %cs:(%rax,%rax)