// File: Eshaancoding[P]AutoDiff/src/Matrix/operations.cpp
// Function: Matrix::operator=(std::initializer_list<std::initializer_list<double>>)
void Matrix::operator= (initializer_list<initializer_list<double>> ar) {
    // find height / width
    int ar_height = ar.size();
    int ar_width = ar.begin()->size();
    for (int i = 1; i < ar_height; i++) {
        if (ar_width != (ar.begin()+i)->size()) {
            throw invalid_argument("array invalid");
        }
    }
    // check height / width
    if (this->height != ar_height) throw invalid_argument("height invalid. Expected " + to_string(this->height) + " got: " + to_string(ar_height));
    if (this->width != ar_width) throw invalid_argument("width invalid. Expected " + to_string(this->width) + " got: " + to_string(ar_width));
    // assign
    for (int i = 0; i < ar_height; i++) {
        this->array[i] = *(ar.begin() + i);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rsi, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x4590
movl %eax, -0x1c(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x45b0
movq %rax, %rdi
callq 0x45d0
movl %eax, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2e17
movslq -0x20(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x45b0
movq %rax, %rdi
movslq -0x24(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x45d0
movq %rax, %rcx
movq -0x1a8(%rbp), %rax
cmpq %rcx, %rax
je 0x2e07
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x1b0(%rbp)
leaq 0xc23b(%rip), %rsi      # 0xf004
callq 0x22c0
jmp 0x2dd0
movq -0x1b0(%rbp), %rdi
movq 0x12202(%rip), %rsi     # 0x14fe0
movq 0x121eb(%rip), %rdx     # 0x14fd0
callq 0x2240
movq -0x1b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x2150
jmp 0x31b1
jmp 0x2e09
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2d69
movq -0x1a0(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x1c(%rbp), %eax
je 0x2f95
movb $0x1, -0xd9(%rbp)
movl $0x10, %edi
callq 0x20c0
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
movq %rcx, -0x1b8(%rbp)
movl 0x8(%rax), %esi
leaq -0xb8(%rbp), %rdi
callq 0x4760
jmp 0x2e5d
leaq 0xc1ae(%rip), %rsi      # 0xf012
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0x4710
jmp 0x2e79
leaq 0xc1ac(%rip), %rdx      # 0xf02c
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x46c0
jmp 0x2e92
movl -0x1c(%rbp), %esi
leaq -0xd8(%rbp), %rdi
callq 0x4760
jmp 0x2ea3
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x45f0
jmp 0x2eb9
movq -0x1b8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2260
jmp 0x2ecb
movq -0x1b8(%rbp), %rdi
movb $0x0, -0xd9(%rbp)
movq 0x12100(%rip), %rsi     # 0x14fe0
movq 0x120e9(%rip), %rdx     # 0x14fd0
callq 0x2240
jmp 0x31ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2f79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2f6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2f61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2f58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2f4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x2110
leaq -0xd8(%rbp), %rdi
callq 0x2110
leaq -0x78(%rbp), %rdi
callq 0x2110
leaq -0x98(%rbp), %rdi
callq 0x2110
leaq -0xb8(%rbp), %rdi
callq 0x2110
testb $0x1, -0xd9(%rbp)
jne 0x2f84
jmp 0x2f90
movq -0x1b8(%rbp), %rdi
callq 0x2150
jmp 0x31b1
movq -0x1a0(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x20(%rbp), %eax
je 0x3128
movb $0x1, -0x181(%rbp)
movl $0x10, %edi
callq 0x20c0
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
movq %rcx, -0x1c0(%rbp)
movl 0xc(%rax), %esi
leaq -0x160(%rbp), %rdi
callq 0x4760
jmp 0x2fdb
leaq 0xc051(%rip), %rsi      # 0xf033
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rdx
callq 0x4710
jmp 0x2ff7
leaq 0xc02e(%rip), %rdx      # 0xf02c
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x46c0
jmp 0x3013
movl -0x20(%rbp), %esi
leaq -0x180(%rbp), %rdi
callq 0x4760
jmp 0x3024
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x180(%rbp), %rdx
callq 0x45f0
jmp 0x3040
movq -0x1c0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x2260
jmp 0x3055
movq -0x1c0(%rbp), %rdi
movb $0x0, -0x181(%rbp)
movq 0x11f76(%rip), %rsi     # 0x14fe0
movq 0x11f5f(%rip), %rdx     # 0x14fd0
callq 0x2240
jmp 0x31ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x310c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x3100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x30f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x30e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x30dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2110
leaq -0x180(%rbp), %rdi
callq 0x2110
leaq -0x120(%rbp), %rdi
callq 0x2110
leaq -0x140(%rbp), %rdi
callq 0x2110
leaq -0x160(%rbp), %rdi
callq 0x2110
testb $0x1, -0x181(%rbp)
jne 0x3117
jmp 0x3123
movq -0x1c0(%rbp), %rdi
callq 0x2150
jmp 0x31b1
movl $0x0, -0x188(%rbp)
movl -0x188(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x31a8
leaq -0x10(%rbp), %rdi
callq 0x45b0
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
movslq -0x188(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, -0x198(%rbp)
movq 0x8(%rcx), %rcx
movq %rcx, -0x190(%rbp)
movq (%rax), %rdi
movslq -0x188(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x198(%rbp), %rsi
movq -0x190(%rbp), %rdx
callq 0xcb60
movl -0x188(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x188(%rbp)
jmp 0x3132
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x2280
nopw (%rax,%rax)