// File: /workspace/github_cpp_makefile_star2_O3/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 0x127588
movl 0x4(%rsp), %eax
movl %eax, 0x28a0(%r14)
cmpl $0x0, 0x28a4(%r14)
jne 0x127599
movl %ecx, 0x28a4(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x0, 0x4(%rsp)
jle 0x12765e
xorl %ebp, %ebp
leaq 0x2901e(%rip), %r15     # 0x1505dc
leaq 0x30(%rsp), %r12
movl $0x8f0, %edi            # imm = 0x8F0
callq 0xb2e0
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x9fafe
movl %ebp, 0x39c(%r13)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x175a0
movq %r13, %rdi
movq %r12, %rsi
callq 0xa0002
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x127623
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 0xa22e8
movq %rbx, 0x30(%rsp)
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x1279d0
incl %ebp
cmpl %ebp, 0x4(%rsp)
jne 0x1275c3
movl $0xc68, %edi            # imm = 0xC68
callq 0xb2e0
movq %rax, %r14
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xa6a04
leaq 0x50(%rsp), %rdx
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0xa6a84
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1276a3
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1276ba
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 0x1276eb
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
jmp 0x1276eb
movq %rax, %r15
movl $0xc68, %esi            # imm = 0xC68
movq %r14, %rdi
jmp 0x12772f
jmp 0x127736
jmp 0x127736
movq %rax, %r15
movl $0x8f0, %esi            # imm = 0x8F0
movq %r13, %rdi
jmp 0x12772f
jmp 0x127736
movq %rax, %r15
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x127739
movq 0x40(%rsp), %rsi
incq %rsi
jmp 0x12772f
movq %rax, %r15
movl $0x11e0, %esi           # imm = 0x11E0
movq %rbx, %rdi
callq 0xb2f0
jmp 0x127739
movq %rax, %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x127750
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb2f0
movq %r15, %rdi
callq 0xb510