// File: /workspace/github_cpp_makefile_star2_O2/emr4378[P]FAT-File-System/Shell.cpp
// Function: Shell::createFileSystem(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Shell::createFileSystem(string name) {
	int ret = -1;
	int num;
	bool condMet;
	string input;
	int fileSize;
	int clusterSize;

	do {
		condMet = true;
		cout << "Are you sure you want to create a new file system[Y]? ";
		getline(cin, input);
		if (input != "" && input[0] != 'Y' && input[0] != 'N') {
			condMet = false;
			cout << "Please enter Y or N" << endl;
		}
	} while (!condMet && !cin.eof());

	if (input[0] == 'N') {
		ret = -1;
	} else {
		do {
			condMet = true;
			cout << "Enter the maximum size for this file system in MB [10]: ";
			getline(cin, input);
			if (input == "") {
				num = 10;
			} else {
				num = atoi(input.c_str());
				if (num > MAX_FILE_SIZE || num < MIN_FILE_SIZE) {
					condMet = false;
					cout << "Please enter integer between " << MIN_FILE_SIZE;
					cout << " and " << MAX_FILE_SIZE << endl;
				}
			}
		} while (!condMet && !cin.eof());

		fileSize = num;

		do {
			condMet = true;
			cout << "Enter the cluster size for this file system in KB [8]:";
			getline(cin, input);
			if (input == "") {
				num = 8;
			} else {
				num = atoi(input.c_str());
				if (num > MAX_CLUSTER_SIZE || num < MIN_CLUSTER_SIZE) {
					condMet = false;
					cout << "Please enter integer between " << MIN_CLUSTER_SIZE;
					cout << " and " << MAX_CLUSTER_SIZE << endl;
				}
			}
		} while (!condMet && !cin.eof());

		clusterSize = num;

		ret = fileSystem->createFileSys(name, fileSize, clusterSize);
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, 0x30(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, 0x28(%rsp)
movb $0x0, (%rax)
movq 0x42f8(%rip), %rbx      # 0x8fd0
leaq 0x143d(%rip), %r14      # 0x611c
movq 0x42fa(%rip), %r15      # 0x8fe0
leaq 0x8(%rsp), %r12
leaq 0x1516(%rip), %r13      # 0x6208
leaq 0x145a(%rip), %rbp      # 0x6153
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2210
movq %r15, %rdi
movq %r12, %rsi
callq 0x2050
movq %r12, %rdi
movq %r13, %rsi
callq 0x5dba
movq 0x8(%rsp), %rcx
testb %al, %al
je 0x4d57
movzbl (%rcx), %eax
cmpl $0x4e, %eax
je 0x4d59
cmpl $0x59, %eax
je 0x4d59
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2210
movq %rax, %rdi
callq 0x2110
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x4cf9
movq 0x8(%rsp), %rcx
movb (%rcx), %al
cmpb $0x4e, %al
jne 0x4d65
pushq $-0x1
popq %rbx
jmp 0x4ee5
movq 0x4264(%rip), %r12      # 0x8fd0
leaq 0x13f4(%rip), %r13      # 0x6167
leaq 0x8(%rsp), %rbx
leaq 0x1489(%rip), %r14      # 0x6208
movq %r12, %rdi
movq %r13, %rsi
callq 0x2210
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2050
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43fc
testb %al, %al
jne 0x4e09
movq 0x8(%rsp), %rdi
callq 0x2360
movl %eax, %ebp
addl $-0x33, %eax
cmpl $-0x2f, %eax
ja 0x4e0c
movq %r12, %rdi
leaq 0x13de(%rip), %rsi      # 0x61a0
callq 0x2210
movq %rax, %rdi
pushq $0x5
popq %rsi
callq 0x23c0
movq %r12, %rdi
leaq 0x13e2(%rip), %rsi      # 0x61be
callq 0x2210
movq %rax, %rdi
pushq $0x32
popq %rsi
callq 0x23c0
movq %rax, %rdi
callq 0x2110
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x4d7f
jmp 0x4e0c
pushq $0xa
popq %rbp
movq 0x41bd(%rip), %r12      # 0x8fd0
leaq 0x8(%rsp), %r14
leaq 0x13e9(%rip), %r13      # 0x6208
movq %r12, %rdi
leaq 0x139b(%rip), %rsi      # 0x61c4
callq 0x2210
movq %r15, %rdi
movq %r14, %rsi
callq 0x2050
movq %r14, %rdi
movq %r13, %rsi
callq 0x43fc
testb %al, %al
jne 0x4ead
movq 0x8(%rsp), %rdi
callq 0x2360
movl %eax, %ebx
addl $-0x11, %eax
cmpl $-0xa, %eax
ja 0x4eb0
movq %r12, %rdi
leaq 0x133a(%rip), %rsi      # 0x61a0
callq 0x2210
movq %rax, %rdi
pushq $0x8
popq %rsi
callq 0x23c0
movq %r12, %rdi
leaq 0x133e(%rip), %rsi      # 0x61be
callq 0x2210
movq %rax, %rdi
pushq $0x10
popq %rsi
callq 0x23c0
movq %rax, %rdi
callq 0x2110
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x4e1f
jmp 0x4eb0
pushq $0x8
popq %rbx
movq 0x28(%rsp), %rax
movq 0x18(%rax), %r14
leaq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x22f0
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x2884
movl %eax, %ebx
leaq 0x38(%rsp), %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2100
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x2100
jmp 0x4f18
jmp 0x4f15
jmp 0x4f15
jmp 0x4f15
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x23d0