// File: 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
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
movq %rdi, -0x380(%rbp)
movq %rsi, -0x378(%rbp)
movq %rdx, -0x370(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl 0x1178a(%rip), %eax     # 0x176cc
addl $0x1, %eax
movl %eax, 0x11781(%rip)     # 0x176cc
cmpl $0x64, 0x1177a(%rip)    # 0x176cc
jle 0x5f59
jmp 0x655a
movq -0x380(%rbp), %rdi
callq 0x3140
movq %rax, %rdi
movq 0x11051(%rip), %rcx     # 0x16fc0
xorl %eax, %eax
movl %eax, %edx
leaq -0x20(%rbp), %rsi
callq 0x3090
movq -0x378(%rbp), %rsi
movl %eax, -0x24(%rbp)
leaq 0xc0cc(%rip), %rdx      # 0x12059
leaq -0x68(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0xe2a0
movq -0x388(%rbp), %rsi
movq -0x370(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0xe250
jmp 0x5fb6
movq -0x378(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3400
leaq -0x48(%rbp), %rdi
callq 0x3628
leaq -0x68(%rbp), %rdi
callq 0x3628
movq -0x378(%rbp), %rdi
callq 0x3140
movq %rax, %rdi
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x3170
movq -0x380(%rbp), %rdi
movl %eax, -0x78(%rbp)
callq 0x3140
movq %rax, %rdi
leaq -0x108(%rbp), %rsi
callq 0x32a0
movq -0x378(%rbp), %rdi
callq 0x3140
movq %rax, %rdi
movl -0xec(%rbp), %esi
movl -0xe8(%rbp), %edx
callq 0x31e0
movq -0x378(%rbp), %rdi
callq 0x3140
movq %rax, %rdi
movl -0xf0(%rbp), %esi
callq 0x32b0
movl $0x2, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x655a
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jne 0x6213
movq -0x380(%rbp), %rsi
leaq 0xbfcd(%rip), %rdx      # 0x12059
leaq -0x150(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0xe2a0
movq -0x390(%rbp), %rsi
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x13, %rdx
leaq -0x130(%rbp), %rdi
callq 0xe320
jmp 0x60c7
movq -0x378(%rbp), %rsi
leaq -0x170(%rbp), %rdi
callq 0x3150
jmp 0x60dc
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x13, %rax
movq %rax, -0x3a0(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x3580
movq -0x3a0(%rbp), %rsi
movq -0x398(%rbp), %rdx
leaq -0x190(%rbp), %rdi
callq 0xe090
jmp 0x6125
leaq -0x130(%rbp), %rdi
leaq -0x170(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0x5f10
jmp 0x6141
leaq -0x190(%rbp), %rdi
callq 0x3628
leaq -0x191(%rbp), %rdi
callq 0x3360
leaq -0x170(%rbp), %rdi
callq 0x3628
leaq -0x130(%rbp), %rdi
callq 0x3628
leaq -0x150(%rbp), %rdi
callq 0x3628
jmp 0x6544
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x3628
jmp 0x6563
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x6202
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x61f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x61de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x3628
leaq -0x191(%rbp), %rdi
callq 0x3360
leaq -0x170(%rbp), %rdi
callq 0x3628
leaq -0x130(%rbp), %rdi
callq 0x3628
leaq -0x150(%rbp), %rdi
callq 0x3628
jmp 0x6563
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movzbl 0x12(%rax), %eax
cmpl $0x8, %eax
jne 0x6542
movq -0x380(%rbp), %rsi
leaq 0xbe1c(%rip), %rdx      # 0x12059
leaq -0x1d8(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0xe2a0
movq -0x3a8(%rbp), %rsi
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x13, %rdx
leaq -0x1b8(%rbp), %rdi
callq 0xe320
jmp 0x6278
movq -0x378(%rbp), %rsi
leaq 0xbdd3(%rip), %rdx      # 0x12059
leaq -0x218(%rbp), %rdi
callq 0xe2a0
jmp 0x6294
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x13, %rdx
leaq -0x1f8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0xe320
jmp 0x62bc
leaq -0x1b8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x6570
jmp 0x62d1
leaq -0x1f8(%rbp), %rdi
callq 0x3628
leaq -0x218(%rbp), %rdi
callq 0x3628
leaq -0x1b8(%rbp), %rdi
callq 0x3628
leaq -0x1d8(%rbp), %rdi
callq 0x3628
movq -0x380(%rbp), %rsi
leaq 0xbd4a(%rip), %rdx      # 0x12059
leaq -0x2e8(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0xe2a0
movq -0x3b0(%rbp), %rsi
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x13, %rdx
leaq -0x2c8(%rbp), %rdi
callq 0xe320
jmp 0x634a
leaq -0x2c8(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x3140
movq %rax, %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x32a0
movq -0x3c0(%rbp), %rdi
callq 0x3628
leaq -0x2e8(%rbp), %rdi
callq 0x3628
movq -0x378(%rbp), %rsi
leaq 0xbcc7(%rip), %rdx      # 0x12059
leaq -0x328(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0xe2a0
movq -0x3b8(%rbp), %rsi
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x13, %rdx
leaq -0x308(%rbp), %rdi
callq 0xe320
jmp 0x63cd
leaq -0x308(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x3140
movq %rax, %rdi
movl -0x28c(%rbp), %esi
movl -0x288(%rbp), %edx
callq 0x31e0
movq -0x3d0(%rbp), %rdi
callq 0x3628
leaq -0x328(%rbp), %rdi
callq 0x3628
movq -0x378(%rbp), %rsi
leaq 0xbc3f(%rip), %rdx      # 0x12059
leaq -0x368(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0xe2a0
movq -0x3c8(%rbp), %rsi
movq -0x20(%rbp), %rax
movslq -0x10c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x13, %rdx
leaq -0x348(%rbp), %rdi
callq 0xe320
jmp 0x6455
leaq -0x348(%rbp), %rdi
callq 0x3140
movq %rax, %rdi
movl -0x290(%rbp), %esi
callq 0x32b0
leaq -0x348(%rbp), %rdi
callq 0x3628
leaq -0x368(%rbp), %rdi
callq 0x3628
jmp 0x6542
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x64e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x64da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x64ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x3628
leaq -0x218(%rbp), %rdi
callq 0x3628
leaq -0x1b8(%rbp), %rdi
callq 0x3628
leaq -0x1d8(%rbp), %rdi
callq 0x3628
jmp 0x6563
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x3628
jmp 0x6563
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x3628
jmp 0x6563
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x3628
jmp 0x6563
jmp 0x6544
jmp 0x6546
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x6053
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x3570
nopl (%rax)