// File: /workspace/github_cpp_makefile_star2_O3/mlugo2[P]SunshineGPU/inc/main.h
// Function: object_file_interface(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::vector<float, std::allocator<float>>, std::allocator<std::vector<float, std::allocator<float>>>>*, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>*)
void object_file_interface(std::string fileName, 
	std::vector<std::vector<float> > *vertex, 
	std::vector<std::vector<int> > *face)
{
	// Opening file
	std::ifstream myFile;
	myFile.open(fileName.data());

	// Read file into vector for easier processing
	std::vector<std::string> data;
	std::string line;
	while( myFile.good() )
	{
		getline(myFile, line);
		line[line.length()] = '\0';
		data.push_back(line);
	}

	myFile.close();

	// Validate file
	if ( data[0] != "OFF" )
	{
		std::cout << "ERORR(1): incorrect file format." << std::endl;
		return;
	}

	// Header not needed anymore
	data.erase(data.begin());

	// Check that they are numbers
	// #verticies #faces #edges
	for ( auto i : data[0] )
	{
		// Skip over spaces
		if ( i == ' ')
			continue;
		
		if (!isdigit(i))
		{
			std::cout << "ERORR(2): incorrect file format." << std::endl;
			return;
		}
	}


	// Now to get all the data out..
	std::string delims = " \t";
	std::vector<std::string> tempData;
	std::vector<float> temp;

	// Get the number of vertices, faces, and edges
	// in that order.
	tokenize(data[0], tempData, delims);
	int vertNum;
	int faceNum;
	int edgeNum;

	int index = 0;
	for ( auto i : tempData )
	{
		switch(index)
		{
			case 0: vertNum = stoi(i); index++; break;
			case 1: faceNum = stoi(i); index++; break;
			case 2: edgeNum = stoi(i); index++; break;
			default: return;
		}
	}

	// Erase more of the header
	data.erase(data.begin());
	tempData.clear();

	// Go through the rows of vertex data
	for (int i = 0; i < vertNum; ++i)
	{
		tokenize(data[i], tempData, delims);

		for ( auto j : tempData )
		{
			temp.push_back( std::strtof((j).c_str(), 0) );
		}

		vertex->push_back(temp);

		tempData.clear();
		temp.clear();
	}

	for (int i = 0; i < vertNum; ++i)
		data.erase(data.begin());


	std::vector<int> int_temp;
	for ( int i = 0; i < faceNum; ++i )
	{
		tokenize(data[i], tempData, delims);

		for ( auto j : tempData )
		{
			int_temp.push_back( (int)strtof((j).c_str(), 0) );
		}

		face->push_back(int_temp);

		tempData.clear();
		int_temp.clear();
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movq %rdx, 0xf8(%rsp)
movq %rsi, 0xa0(%rsp)
movq %rdi, %rbx
leaq 0x100(%rsp), %r14
movq %r14, %rdi
callq 0x2290
movq (%rbx), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x2180
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %rbx
movaps %xmm0, (%rbx)
xorl %eax, %eax
movq %rax, 0x10(%rbx)
leaq 0xd8(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x100(%rsp), %r14
leaq 0xc8(%rsp), %r15
movq 0x100(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x120(%rsp,%rax)
jne 0x279a
leaq (%rsp,%rax), %rdi
addq $0x100, %rdi            # imm = 0x100
movl $0xa, %esi
callq 0x2250
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x23b0
movq 0xc8(%rsp), %rax
movq 0xd0(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3ca0
jmp 0x2740
leaq 0x100(%rsp), %rdi
callq 0x20b0
movq 0x80(%rsp), %rdi
leaq 0x684e(%rip), %rsi      # 0x9004
callq 0x20e0
testl %eax, %eax
je 0x280a
movq 0x9812(%rip), %rbx      # 0xbfd8
leaq 0x683b(%rip), %rsi      # 0x9008
movl $0x20, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2250
movsbl %al, %esi
movq 0x97e0(%rip), %rdi      # 0xbfd8
callq 0x2040
movq %rax, %rdi
callq 0x21a0
jmp 0x2e2f
leaq 0x80(%rsp), %rdi
movq (%rdi), %rsi
callq 0x4662
movq 0x80(%rsp), %rcx
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0x285b
movq (%rcx), %rcx
xorl %edx, %edx
movb (%rcx,%rdx), %sil
cmpb $0x20, %sil
sete %dil
movsbl %sil, %esi
addl $-0x30, %esi
cmpl $0xa, %esi
setb %sil
orb %dil, %sil
je 0x2a7e
incq %rdx
cmpq %rdx, %rax
jne 0x2830
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x67dc(%rip), %rsi      # 0x904a
leaq 0x67d7(%rip), %rdx      # 0x904c
leaq 0xa8(%rsp), %rdi
callq 0x41b0
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rsi
movaps %xmm0, (%rsi)
xorl %eax, %eax
movq %rax, 0x10(%rsi)
movq %rax, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movq 0x80(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x25cc
movq 0x20(%rsp), %rbp
movq 0x28(%rsp), %r13
cmpq %r13, %rbp
je 0x2ac9
xorl %ebx, %ebx
leaq 0x48(%rsp), %r15
movq %rax, 0x58(%rsp)
movq %rax, 0x98(%rsp)
movq %r15, 0x38(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x411a
testl %ebx, %ebx
je 0x29e1
cmpl $0x1, %ebx
je 0x2972
cmpl $0x2, %ebx
jne 0x2a4c
movq 0x38(%rsp), %rbx
callq 0x2060
movq %rax, %r14
movl (%rax), %r12d
movl $0x0, (%rax)
movq %rbx, %rdi
movq %rsp, %rsi
movl $0xa, %edx
callq 0x22e0
cmpq %rbx, (%rsp)
je 0x2e84
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x2e78
movl (%r14), %eax
cmpl $0x22, %eax
je 0x2e78
testl %eax, %eax
jne 0x2965
movl %r12d, (%r14)
movb $0x1, %r14b
movl $0x3, %ebx
jmp 0x2a4f
movq 0x38(%rsp), %rbx
callq 0x2060
movq %rax, %r14
movl (%rax), %r12d
movl $0x0, (%rax)
movq %rbx, %rdi
movq %rsp, %rsi
movl $0xa, %edx
callq 0x22e0
cmpq %rbx, (%rsp)
je 0x2e9c
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x2e90
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x2e90
testl %ecx, %ecx
jne 0x29cf
movl %r12d, (%r14)
movq %rax, 0x98(%rsp)
movb $0x1, %r14b
movl $0x2, %ebx
jmp 0x2a4f
movq 0x38(%rsp), %rbx
callq 0x2060
movq %rax, %r14
movl (%rax), %r12d
movl $0x0, (%rax)
movq %rbx, %rdi
movq %rsp, %rsi
movl $0xa, %edx
callq 0x22e0
cmpq %rbx, (%rsp)
je 0x2eb4
movq %rax, 0x58(%rsp)
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x2ea8
movl (%r14), %eax
cmpl $0x22, %eax
je 0x2ea8
testl %eax, %eax
jne 0x2a42
movl %r12d, (%r14)
movb $0x1, %r14b
movl $0x1, %ebx
jmp 0x2a4f
xorl %r14d, %r14d
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a66
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2270
testb %r14b, %r14b
je 0x2de1
addq $0x20, %rbp
cmpq %r13, %rbp
jne 0x28d9
jmp 0x2ad6
movq 0x9553(%rip), %rbx      # 0xbfd8
leaq 0x659d(%rip), %rsi      # 0x9029
movl $0x20, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2250
movsbl %al, %esi
movq 0x9521(%rip), %rdi      # 0xbfd8
callq 0x2040
movq %rax, %rdi
callq 0x21a0
jmp 0x2e2f
movq %rax, 0x98(%rsp)
movq %rax, 0x58(%rsp)
leaq 0x80(%rsp), %rdi
movq (%rdi), %rsi
callq 0x4662
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r14
cmpq %rbx, %r14
je 0x2b22
leaq 0x10(%rbx), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x2b0d
movq (%r15), %rsi
incq %rsi
callq 0x2270
leaq 0x20(%r15), %rax
addq $0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x2af9
movq %rbx, 0x28(%rsp)
movq 0x58(%rsp), %rax
testl %eax, %eax
jle 0x2c81
leaq 0x48(%rsp), %r13
movl %eax, %eax
movq %rax, 0xf0(%rsp)
xorl %ebp, %ebp
leaq 0x60(%rsp), %rbx
leaq 0x38(%rsp), %r15
movq %rbp, %rdi
shlq $0x5, %rdi
addq 0x80(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x25cc
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %r14
cmpq %r14, %r12
je 0x2be7
movq %r13, 0x38(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x411a
movq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x22d0
movss %xmm0, (%rsp)
movq 0x68(%rsp), %rsi
cmpq 0x70(%rsp), %rsi
je 0x2bbf
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%rsp)
jmp 0x2bca
movq %rbx, %rdi
movq %rsp, %rdx
callq 0x46de
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x2be1
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2270
addq $0x20, %r12
jmp 0x2b75
movq 0xa0(%rsp), %rdi
movq %rbx, %rsi
callq 0x3d1c
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r12
cmpq %r14, %r12
je 0x2c38
leaq 0x10(%r14), %rbx
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x2c1e
movq (%rbx), %rsi
incq %rsi
callq 0x2270
leaq 0x20(%rbx), %rax
addq $0x10, %rbx
cmpq %r12, %rbx
movq %rax, %rbx
jne 0x2c0a
movq %r14, 0x28(%rsp)
leaq 0x60(%rsp), %rbx
movq 0x60(%rsp), %rax
cmpq %rax, 0x68(%rsp)
je 0x2c49
movq %rax, 0x68(%rsp)
incq %rbp
cmpq 0xf0(%rsp), %rbp
jne 0x2b4a
movq 0x58(%rsp), %r14
testl %r14d, %r14d
jle 0x2c81
leaq 0x80(%rsp), %rbx
movq 0x80(%rsp), %rsi
movq %rbx, %rdi
callq 0x4662
decl %r14d
jne 0x2c6c
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x98(%rsp), %rax
testl %eax, %eax
jle 0x2de1
leaq 0x48(%rsp), %rbp
movl %eax, %eax
movq %rax, 0xa0(%rsp)
xorl %r15d, %r15d
movq %rsp, %rbx
leaq 0x38(%rsp), %r12
movq %r15, %rdi
shlq $0x5, %rdi
addq 0x80(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x25cc
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r13
cmpq %r13, %r14
je 0x2d5f
movq %rbp, 0x38(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x411a
movq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x22d0
cvttss2si %xmm0, %eax
movl %eax, 0xec(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x2d32
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x2d42
movq %rbx, %rdi
leaq 0xec(%rsp), %rdx
callq 0x4a38
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2d59
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2270
addq $0x20, %r14
jmp 0x2ce6
movq 0xf8(%rsp), %rdi
movq %rbx, %rsi
callq 0x3d48
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r13
cmpq %r14, %r13
je 0x2dae
leaq 0x10(%r14), %rbx
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x2d96
movq (%rbx), %rsi
incq %rsi
callq 0x2270
leaq 0x20(%rbx), %rax
addq $0x10, %rbx
cmpq %r13, %rbx
movq %rax, %rbx
jne 0x2d82
movq %r14, 0x28(%rsp)
movq %rsp, %rbx
movq (%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x2dbe
movq %rdi, 0x8(%rsp)
incq %r15
cmpq 0xa0(%rsp), %r15
jne 0x2cbb
testq %rdi, %rdi
je 0x2de1
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x2df8
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
leaq 0x20(%rsp), %rdi
callq 0x3d74
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
leaq 0xd8(%rsp), %r12
je 0x2e2f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2270
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e4c
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x3d74
leaq 0x100(%rsp), %rdi
callq 0x20c0
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x62ef(%rip), %rdi      # 0x916e
callq 0x2300
leaq 0x62e3(%rip), %rdi      # 0x916e
callq 0x2170
leaq 0x62d7(%rip), %rdi      # 0x916e
callq 0x2300
leaq 0x62cb(%rip), %rdi      # 0x916e
callq 0x2170
leaq 0x62bf(%rip), %rdi      # 0x916e
callq 0x2300
leaq 0x62b3(%rip), %rdi      # 0x916e
callq 0x2170
jmp 0x2f63
movq %rax, %rbx
leaq 0xd8(%rsp), %r12
jmp 0x2f76
jmp 0x2fb6
jmp 0x2fb6
jmp 0x2fb6
movq %rax, %rbx
jmp 0x2fe3
jmp 0x2ef0
jmp 0x2ef0
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x2efc
movl %r12d, (%r14)
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
jne 0x2f3e
jmp 0x2f66
jmp 0x2f63
jmp 0x2f63
jmp 0x2fb6
jmp 0x2f48
jmp 0x2f63
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f4b
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2270
jmp 0x2f4b
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x2f66
movq 0x48(%rsp), %rsi
incq %rsi
jmp 0x2f5c
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2f66
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
jmp 0x2f66
movq %rax, %rbx
leaq 0xd8(%rsp), %r12
leaq 0xb8(%rsp), %r14
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x2f8d
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
leaq 0x20(%rsp), %rdi
callq 0x3d74
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2fb9
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2270
jmp 0x2fb9
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2fd6
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x2270
leaq 0x80(%rsp), %rdi
callq 0x3d74
leaq 0x100(%rsp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x2390