// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]ramulator/src/MemoryFactory.h
// Function: ramulator::MemoryFactory<ramulator::WideIO2>::populate_memory(ramulator::Config const&, ramulator::WideIO2*, int, int)
static Memory<T> *populate_memory(const Config& configs, T *spec, int channels, int ranks) {
        int& default_ranks = spec->org_entry.count[int(T::Level::Rank)];
        int& default_channels = spec->org_entry.count[int(T::Level::Channel)];

        if (default_channels == 0) default_channels = channels;
        if (default_ranks == 0) default_ranks = ranks;

        vector<Controller<T> *> ctrls;
        for (int c = 0; c < channels; c++){
            DRAM<T>* channel = new DRAM<T>(spec, T::Level::Channel);
            channel->id = c;
            channel->regStats("");
            ctrls.push_back(new Controller<T>(configs, channel));
        }
        return new Memory<T>(configs, ctrls);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
cmpl $0x0, 0x28a0(%rsi)
jne 0x12a6a8
movl 0x4(%rsp), %eax
movl %eax, 0x28a0(%r14)
cmpl $0x0, 0x28a4(%r14)
jne 0x12a6b9
movl %ecx, 0x28a4(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x0, 0x4(%rsp)
jle 0x12a77e
xorl %ebp, %ebp
leaq 0x28ebe(%rip), %r15     # 0x15359c
leaq 0x30(%rsp), %r12
movl $0x8f0, %edi            # imm = 0x8F0
callq 0xb2e0
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xa107a
movl %ebp, 0x39c(%r13)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x17586
movq %r13, %rdi
movq %r12, %rsi
callq 0xa1582
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x12a743
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xb2f0
movl $0x11e0, %edi           # imm = 0x11E0
callq 0xb2e0
movq %rax, %rbx
movq %rax, %rdi
movq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0xa3870
movq %rbx, 0x30(%rsp)
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x12aaf0
incl %ebp
cmpl %ebp, 0x4(%rsp)
jne 0x12a6e3
movl $0xc68, %edi            # imm = 0xC68
callq 0xb2e0
movq %rax, %r14
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xa7faa
leaq 0x50(%rsp), %rdx
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0xa802a
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x12a7c3
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x12a7da
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %r14, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x12a80b
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
jmp 0x12a80b
movq %rax, %r15
movl $0xc68, %esi            # imm = 0xC68
movq %r14, %rdi
jmp 0x12a84f
jmp 0x12a856
jmp 0x12a856
movq %rax, %r15
movl $0x8f0, %esi            # imm = 0x8F0
movq %r13, %rdi
jmp 0x12a84f
jmp 0x12a856
movq %rax, %r15
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x12a859
movq 0x40(%rsp), %rsi
incq %rsi
jmp 0x12a84f
movq %rax, %r15
movl $0x11e0, %esi           # imm = 0x11E0
movq %rbx, %rdi
callq 0xb2f0
jmp 0x12a859
movq %rax, %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x12a870
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %r15, %rdi
callq 0xb510