// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rsi), %r12
movslq %r12d, %rax
movslq %ebx, %rcx
addq $0x18, %rsi
xorl %edx, %edx
incq %rdx
cmpq %rcx, %rdx
jge 0x2ab9
leaq 0x10(%rsi), %rdi
cmpq (%rsi), %rax
movq %rdi, %rsi
je 0x2a75
pushq $0x10
popq %rdi
callq 0x20c0
movq %rax, %r14
leaq 0x7569(%rip), %rsi      # 0xa004
movq %rax, %rdi
callq 0x2260
movq 0xc536(%rip), %rsi      # 0xefe0
movq 0xc51f(%rip), %rdx      # 0xefd0
movq %r14, %rdi
callq 0x21f0
cmpl %ebx, 0x8(%r15)
jne 0x2b05
cmpl %r12d, 0xc(%r15)
jne 0x2b9a
xorl %r12d, %r12d
testl %ebx, %ebx
cmovlel %r12d, %ebx
shlq $0x4, %rbx
cmpq %r12, %rbx
je 0x2af5
movq (%r14,%r12), %rsi
movq 0x8(%r14,%r12), %rdx
movq (%r15), %rdi
addq %r12, %rdi
callq 0x8438
addq $0x10, %r12
jmp 0x2ad6
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x20c0
movq %rax, %r14
movl 0x8(%r15), %esi
leaq -0x60(%rbp), %rdi
callq 0x3ab5
leaq 0x74ee(%rip), %rsi      # 0xa012
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x3a87
leaq 0x74f4(%rip), %rdx      # 0xa02c
leaq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3a5e
leaq -0x40(%rbp), %rdi
movl %ebx, %esi
callq 0x3ab5
leaq -0xc0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x39ed
movb $0x1, %r15b
leaq -0xc0(%rbp), %rsi
movq %r14, %rdi
callq 0x2210
xorl %r15d, %r15d
movq 0xc45a(%rip), %rsi      # 0xefe0
movq 0xc443(%rip), %rdx      # 0xefd0
movq %r14, %rdi
callq 0x21f0
jmp 0x2c2b
pushq $0x10
popq %rdi
callq 0x20c0
movq %rax, %r14
movl 0xc(%r15), %esi
leaq -0x60(%rbp), %rdi
callq 0x3ab5
leaq 0x747a(%rip), %rsi      # 0xa033
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x3a87
leaq 0x745f(%rip), %rdx      # 0xa02c
leaq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3a5e
leaq -0x40(%rbp), %rdi
movl %r12d, %esi
callq 0x3ab5
leaq -0xc0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x39ed
movb $0x1, %r15b
leaq -0xc0(%rbp), %rsi
movq %r14, %rdi
callq 0x2210
xorl %r15d, %r15d
movq 0xc3c4(%rip), %rsi      # 0xefe0
movq 0xc3ad(%rip), %rdx      # 0xefd0
movq %r14, %rdi
callq 0x21f0
jmp 0x2c2f
jmp 0x2c40
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x20a0
jmp 0x2c46
movq %rax, %rbx
movb $0x1, %r15b
leaq -0x40(%rbp), %rdi
callq 0x20a0
jmp 0x2c59
jmp 0x2c53
movq %rax, %rbx
movb $0x1, %r15b
leaq -0xa0(%rbp), %rdi
callq 0x20a0
jmp 0x2c6f
jmp 0x2c69
movq %rax, %rbx
movb $0x1, %r15b
leaq -0x80(%rbp), %rdi
callq 0x20a0
jmp 0x2c82
jmp 0x2c7c
movq %rax, %rbx
movb $0x1, %r15b
leaq -0x60(%rbp), %rdi
callq 0x20a0
testb %r15b, %r15b
jne 0x2c99
jmp 0x2ca1
jmp 0x2c96
jmp 0x2c96
movq %rax, %rbx
movq %r14, %rdi
callq 0x2110
movq %rbx, %rdi
callq 0x2230
nop