// File: NishadSaraf[P]Championship-Simulator/inc/dram_controller.h
// Function: MEMORY_CONTROLLER::MEMORY_CONTROLLER(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
MEMORY_CONTROLLER(string v1) : NAME (v1) {
        for (uint32_t i=0; i<NUM_TYPES+1; i++) {
            for (uint32_t j=0; j<NUM_TYPES+1; j++) {
                dbus_congested[i][j] = 0;
            }
        }
        do_write = 0;
        processed_writes = 0;
        scheduled_reads = 0;
        scheduled_writes = 0;
        for (uint32_t i=0; i<DRAM_CHANNELS; i++) {
            dbus_cycle_available[i] = 0;
            dbus_cycle_congested[i] = 0;
            write_mode[i] = 0;

            for (uint32_t j=0; j<DRAM_RANKS; j++) {
                for (uint32_t k=0; k<DRAM_BANKS; k++)
                    bank_cycle_available[i][j][k] = 0;
            }
        }

        fill_level = FILL_DRAM;
    }

// Assembly:
subq $0xd8, %rsp
movq %rsi, 0x50(%rsp)
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq 0xd0(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x1d3e0
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
leaq 0xaf51(%rip), %rax      # 0x28c80
addq $0x10, %rax
movq %rax, (%rdi)
addq $0x7348, %rdi           # imm = 0x7348
movq %rdi, 0x58(%rsp)
callq 0x3100
jmp 0x1dd49
movq 0x48(%rsp), %rax
addq $0x7368, %rax           # imm = 0x7368
movq %rax, %rcx
addq $0x200, %rcx            # imm = 0x200
movq %rcx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x1e100
jmp 0x1dd79
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %rax
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, 0x40(%rsp)
jne 0x1dd68
movq 0x48(%rsp), %rax
addq $0x7858, %rax           # imm = 0x7858
movq %rax, %rcx
addq $0xa00, %rcx            # imm = 0xA00
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x1e120
jmp 0x1ddc1
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
addq $0x28, %rax
cmpq %rcx, %rax
movq %rax, 0x28(%rsp)
jne 0x1ddb0
movq 0x48(%rsp), %rsi
movq %rsi, %rax
addq $0x8258, %rax           # imm = 0x8258
movq %rax, 0x10(%rsp)
addq $0x7348, %rsi           # imm = 0x7348
leaq 0x5d03(%rip), %rdx      # 0x23afd
leaq 0x98(%rsp), %rdi
callq 0x1d770
jmp 0x1de09
movq 0x10(%rsp), %rdi
leaq 0x98(%rsp), %rsi
movl $0x30, %edx
callq 0x1d800
jmp 0x1de22
leaq 0x98(%rsp), %rdi
callq 0x3150
movq 0x48(%rsp), %rsi
movq %rsi, %rax
addq $0x9ef8, %rax           # imm = 0x9EF8
movq %rax, 0x8(%rsp)
addq $0x7348, %rsi           # imm = 0x7348
leaq 0x60f7(%rip), %rdx      # 0x23f47
leaq 0x78(%rsp), %rdi
callq 0x1d770
jmp 0x1de5c
movq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movl $0x30, %edx
callq 0x1d800
jmp 0x1de72
leaq 0x78(%rsp), %rdi
callq 0x3150
movl $0x0, 0x74(%rsp)
cmpl $0x5, 0x74(%rsp)
jae 0x1df77
movl $0x0, 0x70(%rsp)
cmpl $0x5, 0x70(%rsp)
jae 0x1df65
movq 0x48(%rsp), %rax
addq $0x7578, %rax           # imm = 0x7578
movl 0x74(%rsp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x70(%rsp), %ecx
movq $0x0, (%rax,%rcx,8)
movl 0x70(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x70(%rsp)
jmp 0x1de97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
jmp 0x1e089
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
jmp 0x1e07f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x3150
jmp 0x1e07f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
jmp 0x1e075
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x3150
jmp 0x1e075
jmp 0x1df67
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x1de84
movq 0x48(%rsp), %rax
movb $0x0, 0x7840(%rax)
movl $0x0, 0x7844(%rax)
movl $0x0, 0x7848(%rax)
movl $0x0, 0x784c(%rax)
movl $0x0, 0x6c(%rsp)
cmpl $0x1, 0x6c(%rsp)
jae 0x1e05e
movq 0x48(%rsp), %rax
movl 0x6c(%rsp), %ecx
movq $0x0, 0x7568(%rax,%rcx,8)
movl 0x6c(%rsp), %ecx
movq $0x0, 0x7570(%rax,%rcx,8)
movl 0x6c(%rsp), %ecx
movb $0x0, 0x7841(%rax,%rcx)
movl $0x0, 0x68(%rsp)
cmpl $0x8, 0x68(%rsp)
jae 0x1e04c
movl $0x0, 0x64(%rsp)
cmpl $0x8, 0x64(%rsp)
jae 0x1e03d
movq 0x48(%rsp), %rax
addq $0x7640, %rax           # imm = 0x7640
movl 0x6c(%rsp), %ecx
shlq $0x9, %rcx
addq %rcx, %rax
movl 0x68(%rsp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x64(%rsp), %ecx
movq $0x0, (%rax,%rcx,8)
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x1dffc
jmp 0x1e03f
movl 0x68(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x68(%rsp)
jmp 0x1dfed
jmp 0x1e04e
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x1dfa9
movq 0x48(%rsp), %rax
movl $0x10, 0x7850(%rax)
addq $0xd8, %rsp
retq
movq 0x10(%rsp), %rdi
callq 0x1da80
movq 0x58(%rsp), %rdi
callq 0x3150
movq 0x48(%rsp), %rdi
callq 0x1dac0
movq 0xc0(%rsp), %rdi
callq 0x33c0