// File: arinaschwartz[P]KNN-MNIST/MNISTDataset.cpp
// Function: MNISTDataset::createImage(unsigned char*, unsigned char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
MNISTImage* MNISTDataset::createImage(uint8 data[], uint8 label, string type)
{
	if(type == "full")
		return new FullArrayMNISTImage(data, this->numRows * this->numCols, label);
	else if(type == "downsample2")
		return new DownsampleMNISTImage(data, this->numRows * this->numCols, label, 2);
	else if(type == "downsample4")
		return new DownsampleMNISTImage(data, this->numRows * this->numCols, label, 4);
	else if(type == "downsample8")
		return new DownsampleMNISTImage(data, this->numRows * this->numCols, label, 8);
	else if(type == "scaled2")
		return new ScaledMNISTImage(data, this->numRows, this->numCols, label, 2);
	else if(type == "scaled4")
		return new ScaledMNISTImage(data, this->numRows, this->numCols, label, 4);
	else if(type == "scaled7")
		return new ScaledMNISTImage(data, this->numRows, this->numCols, label, 7);
	else if(type == "random")
		return new RandomMNISTImage(label);
	else if(type == "sum")
		return new SumMNISTImage(data, this->numRows * this->numCols, label);
	else
		throw MNISTFileException("Unknown MNIST type");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rcx, -0x48(%rbp)
movq %rdi, %rcx
movq -0x48(%rbp), %rdi
movb %dl, %al
movq %rcx, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq %rdi, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x3670(%rip), %rsi      # 0x7086
callq 0x3f30
testb $0x1, %al
jne 0x3a21
jmp 0x3a7d
movl $0x20, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x50(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %eax
imull %eax, %edx
movzbl -0x19(%rbp), %ecx
callq 0x41c0
jmp 0x3a51
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x20, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x3603(%rip), %rsi      # 0x708b
callq 0x3f30
testb $0x1, %al
jne 0x3a93
jmp 0x3af5
movl $0x20, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x58(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %eax
imull %eax, %edx
movzbl -0x19(%rbp), %ecx
movl $0x2, %r8d
callq 0x4280
jmp 0x3ac9
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x20, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x3597(%rip), %rsi      # 0x7097
callq 0x3f30
testb $0x1, %al
jne 0x3b0b
jmp 0x3b6d
movl $0x20, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x60(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %eax
imull %eax, %edx
movzbl -0x19(%rbp), %ecx
movl $0x4, %r8d
callq 0x4280
jmp 0x3b41
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x20, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x352b(%rip), %rsi      # 0x70a3
callq 0x3f30
testb $0x1, %al
jne 0x3b83
jmp 0x3be5
movl $0x20, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x68(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %eax
imull %eax, %edx
movzbl -0x19(%rbp), %ecx
movl $0x8, %r8d
callq 0x4280
jmp 0x3bb9
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x20, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x34bf(%rip), %rsi      # 0x70af
callq 0x3f30
testb $0x1, %al
jne 0x3bfb
jmp 0x3c5b
movl $0x20, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x70(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
movzbl -0x19(%rbp), %r8d
movl $0x2, %r9d
callq 0x4380
jmp 0x3c2f
movq -0x70(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x20, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x3451(%rip), %rsi      # 0x70b7
callq 0x3f30
testb $0x1, %al
jne 0x3c71
jmp 0x3cd1
movl $0x20, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x78(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
movzbl -0x19(%rbp), %r8d
movl $0x4, %r9d
callq 0x4380
jmp 0x3ca5
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x20, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x33e3(%rip), %rsi      # 0x70bf
callq 0x3f30
testb $0x1, %al
jne 0x3ce7
jmp 0x3d47
movl $0x20, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x80(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
movzbl -0x19(%rbp), %r8d
movl $0x7, %r9d
callq 0x4380
jmp 0x3d1b
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x20, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x3375(%rip), %rsi      # 0x70c7
callq 0x3f30
testb $0x1, %al
jne 0x3d5d
jmp 0x3db1
movl $0x10, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x88(%rbp)
movzbl -0x19(%rbp), %esi
callq 0x4000
jmp 0x3d7f
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x10, %esi
callq 0x31d0
jmp 0x3e6d
movq -0x48(%rbp), %rdi
leaq 0x3312(%rip), %rsi      # 0x70ce
callq 0x3f30
testb $0x1, %al
jne 0x3dc7
jmp 0x3e26
movl $0x10, %edi
callq 0x31c0
movq %rax, %rdi
movq -0x40(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x90(%rbp)
movq -0x18(%rbp), %rsi
movl 0xc(%rax), %edx
movl 0x10(%rax), %eax
imull %eax, %edx
movzbl -0x19(%rbp), %ecx
callq 0x44d0
jmp 0x3dfa
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e60
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x10, %esi
callq 0x31d0
jmp 0x3e6d
movl $0x10, %edi
callq 0x3100
movq %rax, %rdi
movq %rdi, -0x98(%rbp)
leaq 0x3291(%rip), %rsi      # 0x70d2
callq 0x3610
movq -0x98(%rbp), %rdi
leaq 0x6d6c(%rip), %rsi      # 0xabc0
leaq 0xb5(%rip), %rdx        # 0x3f10
callq 0x32f0
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x3310
nopw %cs:(%rax,%rax)