// File: /workspace/github_cpp_makefile_star2_O3/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 0x4e5e
cmpl $-0x1, %eax
je 0x6a5d
leaq -0x50(%rbp), %rdx
movq %r13, %rdi
movl %eax, %esi
xorl %ecx, %ecx
callq 0x35dc
cmpl $-0x1, %eax
je 0x6a5d
leaq -0xb0(%rbp), %rsi
movq %r13, %rdi
movl %eax, %edx
callq 0x3d48
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 0x6a51
movl %eax, %esi
leal 0x2(%rsi), %r14d
leaq -0xb0(%rbp), %rdi
movl %r14d, %edx
callq 0x2a36
addl $0x6, %eax
movq -0x68(%rbp), %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x26e0
movq %r13, %rdi
movq %r15, %rsi
callq 0x3f56
movl %eax, %r12d
cmpl $-0x1, %eax
movl %r14d, -0x2c(%rbp)
je 0x6a1a
testl %r12d, %r12d
jle 0x6a51
movl %r12d, %r13d
xorl %r14d, %r14d
movsbl (%r15,%r14), %esi
movq %rbx, %rdi
callq 0x21b0
incq %r14
cmpq %r14, %r13
jne 0x6a03
jmp 0x6a40
cmpl $0x0, (%r13)
jle 0x6a40
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 0x6a24
cmpl $-0x1, %r12d
movq -0x58(%rbp), %r13
movl -0x2c(%rbp), %eax
je 0x69b2
movq -0x60(%rbp), %rsp
movb $0x1, %bl
leaq -0x40(%rbp), %r14
jmp 0x6a5f
xorl %ebx, %ebx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x6a74
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6a94
jmp 0x6a89
movq %rax, %rbx
jmp 0x6a9b
jmp 0x6a94
jmp 0x6a94
jmp 0x6a94
movq %rax, %rbx
leaq -0x40(%rbp), %r14
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x6ab0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2350