// File: Eshaancoding[P]AutoDiff/src/Matrix/operations.cpp
// Function: Matrix::operator=(std::initializer_list<std::initializer_list<Variable>>)
void Matrix::operator= (initializer_list<initializer_list<Variable>> 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");
    if (this->width != ar_width) throw invalid_argument("width invalid");
    // assign
    for (int i = 0; i < ar_height; i++) {
        this->array[i] = *(ar.begin() + i);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x4880
movl %eax, -0x1c(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x48a0
movq %rax, %rdi
callq 0x48c0
movl %eax, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x32a2
movslq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x48a0
movq %rax, %rdi
movslq -0x24(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x48c0
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
je 0x3292
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x60(%rbp)
leaq 0xbdaa(%rip), %rsi      # 0xf004
callq 0x22c0
jmp 0x3261
movq -0x60(%rbp), %rdi
movq 0x11d74(%rip), %rsi     # 0x14fe0
movq 0x11d5d(%rip), %rdx     # 0x14fd0
callq 0x2240
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x2150
jmp 0x33c2
jmp 0x3294
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3203
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x1c(%rbp), %eax
je 0x3301
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
leaq 0xbd83(%rip), %rsi      # 0xf04c
callq 0x22c0
jmp 0x32d0
movq -0x68(%rbp), %rdi
movq 0x11d05(%rip), %rsi     # 0x14fe0
movq 0x11cee(%rip), %rdx     # 0x14fd0
callq 0x2240
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x2150
jmp 0x33c2
movq -0x50(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x20(%rbp), %eax
je 0x335d
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
leaq 0xbd33(%rip), %rsi      # 0xf05b
callq 0x22c0
jmp 0x332f
movq -0x70(%rbp), %rdi
movq 0x11ca6(%rip), %rsi     # 0x14fe0
movq 0x11c8f(%rip), %rdx     # 0x14fd0
callq 0x2240
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x2150
jmp 0x33c2
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x33bc
leaq -0x10(%rbp), %rdi
callq 0x48a0
movq %rax, %rcx
movq -0x50(%rbp), %rax
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, -0x48(%rbp)
movq 0x8(%rcx), %rcx
movq %rcx, -0x40(%rbp)
movq (%rax), %rdi
movslq -0x38(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0xcbe0
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3364
addq $0x70, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x2280
nopl (%rax,%rax)