// File: /workspace/github_cpp_makefile_star2_O2/danish241194[P]Linux-Terminal-Based-File-Explorer/start_page.cpp
// Function: copy_directory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void copy_directory(string dirname,string dir2,string foldername){

	infinite_loop++;
	if(infinite_loop>100){
	return;		
	}
	
	struct dirent ** list;
	int nn=scandir(dirname.c_str(),&list,NULL,alphasort);
	dir2 = dir2+"/"+foldername;	
	int status = mkdir(dir2.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
	struct stat perm;
	stat(dirname.c_str(),&perm);
	chown(dir2.c_str(),perm.st_uid,perm.st_gid);
	chmod(dir2.c_str(),perm.st_mode);
	for(int i = 2;i<nn;i++){
		if((int)list[i]->d_type==4){
			copy_directory(dirname+"/"+list[i]->d_name,dir2,list[i]->d_name);		
		}
		else if((int)list[i]->d_type==8){
			copy_file(dirname+"/"+list[i]->d_name,dir2+"/"+list[i]->d_name);
			struct stat perm;
			stat((dirname+"/"+list[i]->d_name).c_str(),&perm);
			chown((dir2+"/"+list[i]->d_name).c_str(),perm.st_uid,perm.st_gid);
			chmod((dir2+"/"+list[i]->d_name).c_str(),perm.st_mode);
		}
	}
		
	 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movl 0xa738(%rip), %eax      # 0xf62c
leal 0x1(%rax), %ecx
movl %ecx, 0xa72f(%rip)      # 0xf62c
cmpl $0x63, %eax
jle 0x4f14
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rdi
movq 0xa099(%rip), %rcx      # 0xefc0
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x3070
movl %eax, %ebp
leaq 0x615d(%rip), %rdx      # 0xb099
leaq 0xe8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xa27a
leaq 0x198(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xa25b
leaq 0x198(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3300
movq %rbx, %rdi
callq 0x34d8
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
callq 0x34d8
movq (%r15), %rdi
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x3110
movq %r14, 0x10(%rsp)
movq (%r14), %rdi
leaq 0x198(%rsp), %r12
movq %r12, %rsi
callq 0x3200
movq (%r15), %rdi
movl 0x1c(%r12), %esi
movl 0x20(%r12), %edx
callq 0x3180
movq (%r15), %rdi
movl 0x18(%r12), %esi
callq 0x3210
movslq %ebp, %rax
movq %rax, 0x20(%rsp)
pushq $0x2
popq %r12
leaq 0x60b5(%rip), %r14      # 0xb099
leaq 0x48(%rsp), %r13
movq %r15, 0x18(%rsp)
cmpq 0x20(%rsp), %r12
jge 0x4f02
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rax
movzbl 0x12(%rax), %eax
cmpl $0x8, %eax
je 0x50cd
cmpl $0x4, %eax
jne 0x5249
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0xa27a
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdx
addq $0x13, %rdx
leaq 0xc8(%rsp), %rdi
movq %rdi, %r13
movq %rbx, %rsi
callq 0xa2b2
movq %rbx, %r14
leaq 0x88(%rsp), %rdi
movq %r15, %rbp
movq %r15, %rsi
callq 0x3350
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rsi
addq $0x13, %rsi
leaq 0xa8(%rsp), %r15
movq %r15, %rdi
leaq 0x28(%rsp), %rdx
callq 0xa1da
movq %r13, %rdi
leaq 0x88(%rsp), %rbx
movq %rbx, %rsi
movq %r15, %rdx
callq 0x4edd
movq %r15, %rdi
callq 0x34d8
movq %rbx, %rdi
callq 0x34d8
movq %r13, %rdi
callq 0x34d8
movq %r14, %rbx
movq %r14, %rdi
callq 0x34d8
leaq 0x5fd9(%rip), %r14      # 0xb099
movq %rbp, %r15
leaq 0x48(%rsp), %r13
jmp 0x5249
leaq 0x28(%rsp), %rbp
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0xa27a
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdx
addq $0x13, %rdx
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0xa2b2
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
callq 0xa27a
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdx
addq $0x13, %rdx
leaq 0x178(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0xa2b2
leaq 0x68(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x52ca
movq %r15, %rdi
callq 0x34d8
movq %rbp, %rdi
callq 0x34d8
movq %r14, %rdi
callq 0x34d8
movq %rbx, %rdi
callq 0x34d8
movq %r13, %rdi
movq 0x10(%rsp), %rsi
leaq 0x5f2e(%rip), %r14      # 0xb099
movq %r14, %rdx
callq 0xa27a
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdx
addq $0x13, %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa2b2
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x3200
movq %rbp, %rdi
callq 0x34d8
movq %r13, %rdi
callq 0x34d8
movq %r13, %rdi
movq 0x18(%rsp), %r15
movq %r15, %rsi
movq %r14, %rdx
callq 0xa27a
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdx
addq $0x13, %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa2b2
movq 0x28(%rsp), %rdi
movl 0x104(%rsp), %esi
movl 0x108(%rsp), %edx
callq 0x3180
movq %rbp, %rdi
callq 0x34d8
movq %r13, %rdi
callq 0x34d8
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa27a
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdx
addq $0x13, %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa2b2
movq 0x28(%rsp), %rdi
movl 0x100(%rsp), %esi
callq 0x3210
movq %rbp, %rdi
callq 0x34d8
movq %r13, %rdi
callq 0x34d8
leaq 0x5e50(%rip), %r14      # 0xb099
incq %r12
jmp 0x4fee
jmp 0x527c
jmp 0x5281
movq %rax, %rbx
jmp 0x529b
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x34d8
jmp 0x5271
movq %rax, %rbx
jmp 0x52a8
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x52b0
jmp 0x527c
jmp 0x5281
movq %rax, %rbx
jmp 0x52b5
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x52bd
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x34d8
leaq 0x88(%rsp), %rdi
callq 0x34d8
leaq 0xc8(%rsp), %rdi
callq 0x34d8
leaq 0xe8(%rsp), %rdi
callq 0x34d8
movq %rbx, %rdi
callq 0x3430