// File: /workspace/github_cpp_makefile_star2_O1/hyp1231[P]FMSS/filesystem.cpp
// Function: FileSystem::Inside_file2str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool FileSystem::Inside_file2str(const string& filepath, string& str) {
	/*
		step 1: get dir inode number and filename
	*/
	string filename;
	int dir_inodeNum = Analysis_path(filepath, filename);
	if(dir_inodeNum == -1) {
		return false;
	}

	/*
		step 2: get file inode number and get the inode
	*/

	int file_inodeNum = Get_file_inodeNum_from_dir(dir_inodeNum, filename);
	if(file_inodeNum == -1) {
		return false;
	}

	char inode_buf[64];
	Get_inode_from_inodeNum(inode_buf, file_inodeNum);

	/*
		step 3: travel each data block, add to string until find EOF
	*/

	str.clear();
	char buf[BLKsize];
	for(int i = 42; i < 58; i += 2) {
		D.Getblk(buf, Get_actual_dataBLKnumber(byte2int(inode_buf, i, i + 2)));
		int pos = FindEOF(buf);
		if(pos == -1) {
			for(int j = 0; j < BLKsize; ++j) {
				str += buf[j];
			}
		} else {
			for(int j = 0; j < pos; ++j) {
				str += buf[j];
			}
			break;
		}
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %rbx
movq %rdi, %r13
leaq -0x40(%rbp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
leaq -0x50(%rbp), %rdx
callq 0x48f6
cmpl $-0x1, %eax
je 0x64ea
leaq -0x50(%rbp), %rdx
movq %r13, %rdi
movl %eax, %esi
xorl %ecx, %ecx
callq 0x35de
cmpl $-0x1, %eax
setne %r15b
je 0x64ed
leaq -0xb0(%rbp), %rsi
movq %r13, %rdi
movl %eax, %edx
callq 0x37c4
movq %rsp, -0x60(%rbp)
movq $0x0, 0x8(%rbx)
movq (%rbx), %rax
movb $0x0, (%rax)
movl (%r13), %eax
movq %rsp, %r15
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
leaq 0x8(%r13), %rax
movq %rax, -0x68(%rbp)
movl $0x2a, %eax
movq %r13, -0x58(%rbp)
cmpl $0x3a, %eax
jae 0x64e1
movl %eax, %esi
leal 0x2(%rsi), %r14d
leaq -0xb0(%rbp), %rdi
movl %r14d, %edx
callq 0x2a38
addl $0x6, %eax
movq -0x68(%rbp), %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x26d0
movq %r13, %rdi
movq %r15, %rsi
callq 0x3a16
movl %eax, %r12d
movl %r14d, -0x2c(%rbp)
cmpl $-0x1, %eax
je 0x64aa
testl %r12d, %r12d
jle 0x64d0
movl %r12d, %r13d
xorl %r14d, %r14d
movsbl (%r15,%r14), %esi
movq %rbx, %rdi
callq 0x21b0
incq %r14
cmpq %r14, %r13
jne 0x6493
jmp 0x64d0
cmpl $0x0, (%r13)
jle 0x64d0
xorl %r13d, %r13d
movsbl (%r15,%r13), %esi
movq %rbx, %rdi
callq 0x21b0
incq %r13
movq -0x58(%rbp), %rax
movslq (%rax), %rax
cmpq %rax, %r13
jl 0x64b4
cmpl $-0x1, %r12d
movq -0x58(%rbp), %r13
movl -0x2c(%rbp), %eax
je 0x6442
movq -0x60(%rbp), %rsp
movb $0x1, %r15b
jmp 0x64ed
xorl %r15d, %r15d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x6506
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movl %r15d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6527
jmp 0x6527
movq %rax, %rbx
jmp 0x652e
jmp 0x6527
jmp 0x6527
jmp 0x6527
movq %rax, %rbx
leaq -0x40(%rbp), %r14
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x6543
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2350
nop