// File: /workspace/github_cpp_makefile_star2_O1/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, 0xe0(%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 0xc0(%rsp), %rbx
movaps %xmm0, (%rbx)
xorl %eax, %eax
movq %rax, 0x10(%rbx)
leaq 0x70(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x100(%rsp), %r14
leaq 0x60(%rsp), %r15
movq 0x100(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x120(%rsp,%rax)
jne 0x276e
leaq (%rsp,%rax), %rdi
addq $0x100, %rdi            # imm = 0x100
movl $0xa, %esi
callq 0x2250
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x23c0
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3cb2
jmp 0x271a
leaq 0x100(%rsp), %rdi
callq 0x20b0
movq 0xc0(%rsp), %rdi
leaq 0x687a(%rip), %rsi      # 0x9004
callq 0x20e0
testl %eax, %eax
je 0x27de
movq 0x983e(%rip), %rbx      # 0xbfd8
leaq 0x6867(%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 0x980c(%rip), %rdi      # 0xbfd8
callq 0x2040
movq %rax, %rdi
callq 0x21a0
jmp 0x2e3b
leaq 0xc0(%rsp), %rdi
movq (%rdi), %rsi
callq 0x469c
movq 0xc0(%rsp), %rax
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x287d
movq (%rax), %r12
xorl %r13d, %r13d
movq 0x97cc(%rip), %rbx      # 0xbfd8
leaq 0x6816(%rip), %r14      # 0x9029
movsbl (%r12,%r13), %eax
movl $0x5, %ebp
cmpl $0x20, %eax
je 0x2868
addl $-0x30, %eax
xorl %ebp, %ebp
cmpl $0xa, %eax
jb 0x2868
movl $0x20, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movl $0x1, %ebp
movq %rax, %rdi
callq 0x21a0
cmpl $0x5, %ebp
je 0x2875
testl %ebp, %ebp
jne 0x2e3b
incq %r13
cmpq %r13, %r15
jne 0x2813
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x67ba(%rip), %rsi      # 0x904a
leaq 0x67b5(%rip), %rdx      # 0x904c
leaq 0xa0(%rsp), %rdi
callq 0x41c0
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rsi
movaps %xmm0, (%rsi)
xorl %eax, %eax
movq %rax, 0x10(%rsi)
movq %rax, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x25ac
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %r15
cmpq %r15, %r13
sete %bpl
je 0x2ab1
xorl %ebx, %ebx
leaq 0x10(%rsp), %r12
movq %rax, 0x58(%rsp)
movq %rax, 0xd8(%rsp)
movq %r12, (%rsp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0x4130
testl %ebx, %ebx
je 0x2a0e
cmpl $0x1, %ebx
je 0x299d
cmpl $0x2, %ebx
jne 0x2a80
movq (%rsp), %rbx
callq 0x2060
movq %rax, %r14
movl (%rax), %r12d
movl $0x0, (%rax)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x22e0
cmpq %rbx, 0x20(%rsp)
je 0x2e8f
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x2e83
movl (%r14), %eax
cmpl $0x22, %eax
je 0x2e83
testl %eax, %eax
jne 0x2990
movl %r12d, (%r14)
movb $0x1, %r14b
movl $0x3, %ebx
jmp 0x2a79
movq (%rsp), %rbx
callq 0x2060
movq %rax, %r14
movl (%rax), %r12d
movl $0x0, (%rax)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x22e0
cmpq %rbx, 0x20(%rsp)
je 0x2ea7
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x2e9b
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x2e9b
testl %ecx, %ecx
jne 0x29fc
movl %r12d, (%r14)
movq %rax, 0xd8(%rsp)
movb $0x1, %r14b
movl $0x2, %ebx
jmp 0x2a79
movq (%rsp), %rbx
callq 0x2060
movq %rax, %r14
movl (%rax), %r12d
movl $0x0, (%rax)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movl $0xa, %edx
callq 0x22e0
cmpq %rbx, 0x20(%rsp)
je 0x2ebf
movq %rax, 0x58(%rsp)
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x2eb3
movl (%r14), %eax
cmpl $0x22, %eax
je 0x2eb3
testl %eax, %eax
jne 0x2a71
movl %r12d, (%r14)
movb $0x1, %r14b
movl $0x1, %ebx
leaq 0x10(%rsp), %r12
jmp 0x2a83
xorl %r14d, %r14d
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x2a99
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2270
testb %r14b, %r14b
je 0x2abe
addq $0x20, %r13
cmpq %r15, %r13
sete %bpl
jne 0x2905
jmp 0x2abe
movq %rax, 0xd8(%rsp)
movq %rax, 0x58(%rsp)
testb $0x1, %bpl
je 0x2def
leaq 0xc0(%rsp), %rdi
movq (%rdi), %rsi
callq 0x469c
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r14
cmpq %rbx, %r14
je 0x2b14
leaq 0x10(%rbx), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x2aff
movq (%r15), %rsi
incq %rsi
callq 0x2270
leaq 0x20(%r15), %rax
addq $0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x2aeb
movq %rbx, 0x48(%rsp)
cmpl $0x0, 0x58(%rsp)
jle 0x2c62
leaq 0x10(%rsp), %r13
movl 0x58(%rsp), %eax
movq %rax, 0xf0(%rsp)
xorl %ebp, %ebp
leaq 0x80(%rsp), %rbx
movq %rsp, %r14
movq %rbp, %rdi
shlq $0x5, %rdi
addq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x25ac
movq 0x40(%rsp), %r12
movq 0x48(%rsp), %r15
cmpq %r15, %r12
je 0x2be3
movq %r13, (%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x4130
movq (%rsp), %rdi
xorl %esi, %esi
callq 0x22d0
movss %xmm0, 0x20(%rsp)
movq 0x88(%rsp), %rsi
cmpq 0x90(%rsp), %rsi
je 0x2bba
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x88(%rsp)
jmp 0x2bc7
movq %rbx, %rdi
leaq 0x20(%rsp), %rdx
callq 0x4714
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2bdd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2270
addq $0x20, %r12
jmp 0x2b68
movq 0xe0(%rsp), %rdi
movq %rbx, %rsi
callq 0x3d2e
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %r12
cmpq %r15, %r12
je 0x2c37
leaq 0x10(%r15), %rbx
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x2c1a
movq (%rbx), %rsi
incq %rsi
callq 0x2270
leaq 0x20(%rbx), %rax
addq $0x10, %rbx
cmpq %r12, %rbx
movq %rax, %rbx
jne 0x2c06
movq %r15, 0x48(%rsp)
leaq 0x80(%rsp), %rbx
movq 0x80(%rsp), %rax
cmpq %rax, 0x88(%rsp)
je 0x2c51
movq %rax, 0x88(%rsp)
incq %rbp
cmpq 0xf0(%rsp), %rbp
jne 0x2b3d
movq 0x58(%rsp), %r14
testl %r14d, %r14d
jle 0x2c89
leaq 0xc0(%rsp), %rbx
movq 0xc0(%rsp), %rsi
movq %rbx, %rdi
callq 0x469c
decl %r14d
jne 0x2c74
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0xd8(%rsp), %rax
testl %eax, %eax
jle 0x2dd8
leaq 0x10(%rsp), %rbp
movl %eax, %eax
movq %rax, 0xe0(%rsp)
xorl %r15d, %r15d
leaq 0x20(%rsp), %rbx
movq %rsp, %r12
movq %r15, %rdi
shlq $0x5, %rdi
addq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x25ac
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %r13
cmpq %r13, %r14
je 0x2d65
movq %rbp, (%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4130
movq (%rsp), %rdi
xorl %esi, %esi
callq 0x22d0
cvttss2si %xmm0, %eax
movl %eax, 0xec(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x2d39
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x2d49
movq %rbx, %rdi
leaq 0xec(%rsp), %rdx
callq 0x4a7e
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x2d5f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2270
addq $0x20, %r14
jmp 0x2cef
movq 0xf8(%rsp), %rdi
movq %rbx, %rsi
callq 0x3d5a
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %r13
cmpq %r14, %r13
je 0x2db6
leaq 0x10(%r14), %rbx
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x2d9c
movq (%rbx), %rsi
incq %rsi
callq 0x2270
leaq 0x20(%rbx), %rax
addq $0x10, %rbx
cmpq %r13, %rbx
movq %rax, %rbx
jne 0x2d88
movq %r14, 0x48(%rsp)
leaq 0x20(%rsp), %rbx
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x2dc7
movq %rax, 0x28(%rsp)
incq %r15
cmpq 0xe0(%rsp), %r15
jne 0x2cc4
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2def
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x2e0c
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
leaq 0x40(%rsp), %rdi
callq 0x3d86
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2e3b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2270
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x2e57
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2270
leaq 0xc0(%rsp), %rdi
callq 0x3d86
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 0x62e4(%rip), %rdi      # 0x916e
callq 0x2300
leaq 0x62d8(%rip), %rdi      # 0x916e
callq 0x2170
leaq 0x62cc(%rip), %rdi      # 0x916e
callq 0x2300
leaq 0x62c0(%rip), %rdi      # 0x916e
callq 0x2170
leaq 0x62b4(%rip), %rdi      # 0x916e
callq 0x2300
leaq 0x62a8(%rip), %rdi      # 0x916e
callq 0x2170
jmp 0x2f65
jmp 0x2f65
jmp 0x2f07
jmp 0x2f07
movq %rax, %rbx
jmp 0x2fe2
jmp 0x2ee5
jmp 0x2ee5
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x2ef1
movl %r12d, (%r14)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
jne 0x2f3f
jmp 0x2f68
jmp 0x2f65
jmp 0x2f65
jmp 0x2f07
movq %rax, %rbx
leaq 0x70(%rsp), %r12
jmp 0x2fbe
jmp 0x2f49
jmp 0x2f65
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x2f4c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2270
jmp 0x2f4c
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2f68
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0x2f5e
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2f68
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
jmp 0x2f68
movq %rax, %rbx
leaq 0x70(%rsp), %r12
leaq 0xb0(%rsp), %r14
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x2f92
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2270
leaq 0x40(%rsp), %rdi
callq 0x3d86
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2fbe
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2270
jmp 0x2fbe
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2fd5
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2270
leaq 0xc0(%rsp), %rdi
callq 0x3d86
leaq 0x100(%rsp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x2390