// File: /workspace/github_cpp_makefile_star2_O1/BleuLlama[P]msf-tools/DiskUtils.cpp
// Function: DiskUtils::CopyFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
bool DiskUtils::CopyFile( std::string fromPath, std::string toPath, bool skipIfExists )
{
	char buf[ kCopyFileBufSize ];

	// if the file is already there, and it's okay to skip, we're done
	if( skipIfExists ) {
		if( DiskUtils::IsSimilarFile( fromPath, toPath )) return true;
	}
	
	// copy the file from fromPath to toPath. ;)

	// open the files
	FILE * inf = fopen( fromPath.c_str(), "rb" );
	if( !inf ) {
		std::cerr << "Couldn't open input file " << fromPath << std::endl;
		return true;
	}

	FILE * outf = fopen( toPath.c_str(), "wb" );
	if( !outf ) {
		std::cerr << "Couldn't open output file " << toPath << std::endl;
		fclose( inf );
		return true;
	}


	// copy it over one buffer at a time
	size_t n = 0;
	do {
		n = fread( buf, 1, kCopyFileBufSize, inf );
		fwrite( buf, n, 1, outf );
	} while( n!= 0 );

	// close the files
	fclose( inf );
	fclose( outf );

	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40048, %rsp          # imm = 0x40048
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x2ab9
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x2c9a
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0x2c9a
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x2520
movl %eax, %r15d
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2a96
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2110
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x2aad
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2110
movb $0x1, %bpl
testb %r15b, %r15b
jne 0x2bee
movq (%r14), %rdi
leaq 0x255c(%rip), %rsi      # 0x501f
callq 0x2140
testq %rax, %rax
je 0x2b39
movq %rax, %r15
movq (%rbx), %rdi
leaq 0x2562(%rip), %rsi      # 0x503c
callq 0x2140
testq %rax, %rax
sete %bpl
je 0x2b8f
movq %rax, %r14
leaq 0x40(%rsp), %rbx
movl $0x1, %esi
movl $0x40000, %edx          # imm = 0x40000
movq %rbx, %rdi
movq %r15, %rcx
callq 0x2180
movq %rax, %r12
movl $0x1, %edx
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rcx
callq 0x2260
testq %r12, %r12
jne 0x2af4
movq %r15, %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2100
jmp 0x2bee
movq 0x54b0(%rip), %rbx      # 0x7ff0
leaq 0x24db(%rip), %rsi      # 0x5022
movl $0x19, %edx
movq %rbx, %rdi
callq 0x2130
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20a0
jmp 0x2beb
movq 0x545a(%rip), %r14      # 0x7ff0
leaq 0x24a2(%rip), %rsi      # 0x503f
movl $0x1a, %edx
movq %r14, %rdi
callq 0x2130
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20a0
movq %r15, %rdi
callq 0x2100
movb $0x1, %bpl
movl %ebp, %eax
addq $0x40048, %rsp          # imm = 0x40048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2c20
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x2c20
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c37
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2110
movq %rbx, %rdi
callq 0x2230