// File: Lut99[P]RayTracer/src/lib/Image.cpp
// Function: RayTracer::Image::pixel(unsigned int, unsigned int)
Pixel Image::pixel(unsigned int row, unsigned int col) {
    // Check if the indices are within bounds
    if (row >= this->width || col >= this->height) {
        throw out_of_range("Pixel at (" + to_string(col) + ", " + to_string(row) + ") is out of range for Image with size (" + to_string(this->width) + ", " + to_string(this->height) + ")");
    }

    // Get a pointer to the data
    double* pixel = this->data + 3 * (row * this->width + col);
    return Pixel(pixel);
}

// Assembly:
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, 0x1b8(%rsp)
movl %esi, 0x1b4(%rsp)
movl %edx, 0x1b0(%rsp)
movq 0x1b8(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movl 0x1b4(%rsp), %eax
cmpl 0x8(%rcx), %eax
jae 0x13b58b
movq 0x8(%rsp), %rcx
movl 0x1b0(%rsp), %eax
cmpl 0xc(%rcx), %eax
jb 0x13b8eb
movb $0x1, 0x1f(%rsp)
movl $0x10, %edi
callq 0xd02b0
movq %rax, (%rsp)
movl 0x1b0(%rsp), %esi
leaq 0x90(%rsp), %rdi
callq 0x139a70
jmp 0x13b5b4
leaq 0x3ab2a(%rip), %rsi     # 0x1760e5
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x12d820
jmp 0x13b5d2
leaq 0x3ab17(%rip), %rdx     # 0x1760f0
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0xe6bb0
jmp 0x13b5f0
movl 0x1b4(%rsp), %esi
leaq 0x60(%rsp), %rdi
callq 0x139a70
jmp 0x13b603
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x122650
jmp 0x13b61f
leaq 0x3aacd(%rip), %rdx     # 0x1760f3
leaq 0x110(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0xe6bb0
jmp 0x13b63d
movq 0x8(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x40(%rsp), %rdi
callq 0x139a70
jmp 0x13b651
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x122650
jmp 0x13b66d
leaq 0x3aa7c(%rip), %rdx     # 0x1760f0
leaq 0x150(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0xe6bb0
jmp 0x13b68b
movq 0x8(%rsp), %rax
movl 0xc(%rax), %esi
leaq 0x20(%rsp), %rdi
callq 0x139a70
jmp 0x13b69f
leaq 0x170(%rsp), %rdi
leaq 0x150(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x122650
jmp 0x13b6bb
leaq 0x38409(%rip), %rdx     # 0x173acb
leaq 0x190(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0xe6bb0
jmp 0x13b6d9
movq (%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0xd08a0
jmp 0x13b6ec
movq (%rsp), %rdi
movb $0x0, 0x1f(%rsp)
movq 0x708ac(%rip), %rsi     # 0x1abfa8
movq 0x7088d(%rip), %rdx     # 0x1abf90
callq 0xd09b0
jmp 0x13b945
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b8d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b8ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b8bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b8b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b8a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b899
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b88c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b882
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b875
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b868
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b85e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x13b851
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x190(%rsp), %rdi
callq 0xd0b38
leaq 0x170(%rsp), %rdi
callq 0xd0b38
leaq 0x20(%rsp), %rdi
callq 0xd0b38
leaq 0x150(%rsp), %rdi
callq 0xd0b38
leaq 0x130(%rsp), %rdi
callq 0xd0b38
leaq 0x40(%rsp), %rdi
callq 0xd0b38
leaq 0x110(%rsp), %rdi
callq 0xd0b38
leaq 0xf0(%rsp), %rdi
callq 0xd0b38
leaq 0x60(%rsp), %rdi
callq 0xd0b38
leaq 0xd0(%rsp), %rdi
callq 0xd0b38
leaq 0xb0(%rsp), %rdi
callq 0xd0b38
leaq 0x90(%rsp), %rdi
callq 0xd0b38
testb $0x1, 0x1f(%rsp)
jne 0x13b8e0
jmp 0x13b8e9
movq (%rsp), %rdi
callq 0xd0430
jmp 0x13b938
movq 0x8(%rsp), %rdx
movq (%rdx), %rax
movl 0x1b4(%rsp), %ecx
imull 0x8(%rdx), %ecx
addl 0x1b0(%rsp), %ecx
imull $0x3, %ecx, %ecx
movl %ecx, %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x13aec0
movq 0x1c0(%rsp), %rax
addq $0x1c8, %rsp            # imm = 0x1C8
retq
movq 0x88(%rsp), %rdi
callq 0xd0a10
nopw %cs:(%rax,%rax)