// File: WeiqiangZhou[P]BIRD/source/create_library_function.cpp
// Function: ReadMatrix_i(char*, int**)
int ReadMatrix_i(char *file, int **data)
{
	std::ifstream infile(file);
	std::string line_temp;
	std::string line_token;
	int m, k;
	m = 0;
	if (infile.is_open())
	{
		std::cout << "Reading " << file << "..." << std::endl;
		while (!infile.eof())
		{
			std::getline(infile, line_temp);
			if (line_temp.empty()){ break; }
			std::stringstream each_line(line_temp);
			k = 0;
			while (std::getline(each_line, line_token, '\t'))
			{
				data[k][m] = atoi(line_token.c_str());
				k++;
			}
			m++;
		}

		infile.close();
	}
	else
	{
		std::cout << "Error! File " << file << " not found!" << std::endl;
		return 1;
	}

	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x460, %rsp            # imm = 0x460
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x220(%rbp), %rdi
movq %rdi, -0x410(%rbp)
movl $0x8, %edx
callq 0x2200
leaq -0x240(%rbp), %rdi
callq 0x2160
leaq -0x260(%rbp), %rdi
callq 0x2160
movq -0x410(%rbp), %rdi
movl $0x0, -0x264(%rbp)
callq 0x21c0
movb %al, -0x405(%rbp)
jmp 0x4c15
movb -0x405(%rbp), %al
testb $0x1, %al
jne 0x4c24
jmp 0x4e1d
movq 0x33ad(%rip), %rdi      # 0x7fd8
leaq 0x1759(%rip), %rsi      # 0x638b
callq 0x20f0
movq %rax, -0x418(%rbp)
jmp 0x4c40
movq -0x418(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x20f0
movq %rax, -0x420(%rbp)
jmp 0x4c59
movq -0x420(%rbp), %rdi
leaq 0x16e6(%rip), %rsi      # 0x634d
callq 0x20f0
movq %rax, -0x428(%rbp)
jmp 0x4c75
movq -0x428(%rbp), %rdi
movq 0x3345(%rip), %rsi      # 0x7fc8
callq 0x2110
jmp 0x4c8a
jmp 0x4c8c
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x2220
movb %al, -0x429(%rbp)
jmp 0x4cac
movb -0x429(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4cbd
jmp 0x4e0d
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2040
jmp 0x4cd2
leaq -0x240(%rbp), %rdi
callq 0x21d0
testb $0x1, %al
jne 0x4ce4
jmp 0x4d00
jmp 0x4e0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0x4ed7
movl $0x10, %edi
movl $0x8, %esi
callq 0x5180
movl %eax, -0x430(%rbp)
jmp 0x4d17
movl -0x430(%rbp), %edx
leaq -0x400(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x21b0
jmp 0x4d32
movl $0x0, -0x268(%rbp)
leaq -0x400(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0x9, %edx
callq 0x2230
movq %rax, -0x438(%rbp)
jmp 0x4d5d
movq -0x438(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2140
movb %al, -0x439(%rbp)
jmp 0x4d7b
movb -0x439(%rbp), %al
testb $0x1, %al
jne 0x4d87
jmp 0x4ded
leaq -0x260(%rbp), %rdi
callq 0x2070
movq %rax, %rdi
callq 0x21a0
movl %eax, %edx
movq -0x18(%rbp), %rax
movslq -0x268(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x264(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x268(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x268(%rbp)
jmp 0x4d3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x20b0
jmp 0x4ed7
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x20b0
jmp 0x4c8c
leaq -0x220(%rbp), %rdi
callq 0x2050
jmp 0x4e1b
jmp 0x4e96
movq 0x31b4(%rip), %rdi      # 0x7fd8
leaq 0x170d(%rip), %rsi      # 0x6538
callq 0x20f0
movq %rax, -0x448(%rbp)
jmp 0x4e39
movq -0x448(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x20f0
movq %rax, -0x450(%rbp)
jmp 0x4e52
movq -0x450(%rbp), %rdi
leaq 0x16e5(%rip), %rsi      # 0x6545
callq 0x20f0
movq %rax, -0x458(%rbp)
jmp 0x4e6e
movq -0x458(%rbp), %rdi
movq 0x314c(%rip), %rsi      # 0x7fc8
callq 0x2110
jmp 0x4e83
movl $0x1, -0x4(%rbp)
movl $0x1, -0x404(%rbp)
jmp 0x4ea7
movl $0x0, -0x4(%rbp)
movl $0x1, -0x404(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x20a0
leaq -0x240(%rbp), %rdi
callq 0x20a0
leaq -0x220(%rbp), %rdi
callq 0x2060
movl -0x4(%rbp), %eax
addq $0x460, %rsp            # imm = 0x460
popq %rbp
retq
leaq -0x260(%rbp), %rdi
callq 0x20a0
leaq -0x240(%rbp), %rdi
callq 0x20a0
leaq -0x220(%rbp), %rdi
callq 0x2060
movq -0x270(%rbp), %rdi
callq 0x21f0
nopw (%rax,%rax)