// File: /workspace/github_cpp_makefile_star2_O3/danish241194[P]Linux-Terminal-Based-File-Explorer/start_page.cpp
// Function: print_dirs(int, int)
void print_dirs(int j,int limit_y){



	n=scandir(path.c_str(),&namelist,NULL,alphasort);

	real_clean();
	change_mode_to(mode_num);
	nn=n;
	n--;
	init_Screen();
		pathshow();
	gotoxy(start_x,start_y);

	int numbers=j+1;
	int ini=j;
	if(nn<limit_y){
		limit_y=nn;
	}
	gotoxy(start_x,start_y);


	while(ini<limit_y){

	
	printf(" %d ",numbers);
	if((int)namelist[ini]->d_type==4){
		printf("\x1B[36m");
	}
	string cc = namelist[ini]->d_name;
	if(cc.size()>25){
		cc=cc.substr(0,22);
		printf("%s...",cc.c_str());
	}
	else{

		printf("%s",namelist[ini]->d_name);

	}	
	if((int)namelist[ini]->d_type==4){
		printf("\x1B[0m");

	}



	 struct stat fileStat;
	 string pp = path+"/"+namelist[ini]->d_name;
	 if(stat(pp.c_str(),&fileStat) < 0)    
	 {     
	    	return;
	 }


	 printf("\033[%d;28H",ini-j+3);
	
	 float sizedata =(int)fileStat.st_size;
	 if((sizedata/1024)>=1){
		sizedata = (sizedata/1024);
			     if((sizedata/1024)>=1){
					sizedata = (sizedata/1024);
						
			     if((sizedata/1024)>=1){
					sizedata = (sizedata/1024);
					 printf(" %.1fGB",sizedata);
					
			    }else{
				    printf(" %.0fMB",sizedata);
				}		
					
			    }else{
				    printf(" %.0fKB",sizedata);
				}		
		}else{
			    printf(" %.0fB",sizedata);

	}
	
	    printf("\033[%d;%dH", ini-j+3,36 ); 
		
		string permissions="";
		if(S_ISDIR(fileStat.st_mode)){
			permissions="d";
		}else{
			permissions="-";
			
		}
	
		
		if(fileStat.st_mode & 256){
			permissions+="r";
		}else{
			permissions+="-";
		}
		if(fileStat.st_mode & 128){
			permissions+="w";
		}else{
			permissions+="-";
		}
		if(fileStat.st_mode & 64){
			permissions+="x";
		}else{
			permissions+="-";
		}
		if(fileStat.st_mode & 32){
			permissions+="r";
		}else{
			permissions+="-";
		}
		if(fileStat.st_mode & 16){
			permissions+="w";
		}else{
			permissions+="-";
		}
		if(fileStat.st_mode & 8){
			permissions+="x";
		}else{
			permissions+="-";
		}   
		if(fileStat.st_mode & 4){
			permissions+="r";
		}else{
			permissions+="-";
		}
		if(fileStat.st_mode & 2){
			permissions+="w";
		}else{
			permissions+="-";
		}
		if(fileStat.st_mode & 1){
			permissions+="x";
		}else{
			permissions+="-";
		} 
		cout<<permissions;

	   	 struct passwd *pw = getpwuid(fileStat.st_uid);
	    	struct group  *gr = getgrgid(fileStat.st_gid);
	    

	   	 printf("\033[%d;%dH", ini-j+3,50);  
	   	 printf("%s %s",gr->gr_name,pw->pw_name);
	    
		printf("\033[%d;%dH", ini-j+3,65 );  
		string ss = ctime(&fileStat.st_mtime);

	    	cout<<" "<<ss.substr(4,12); 

		cout<<"\n";

	   
	    	numbers++;
	    	ini++;
		
	}
	gotoxy(start_x,start_y);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %esi, %ebx
movl %edi, %r15d
movq 0x10a30(%rip), %rdi     # 0x15428
leaq 0x10a89(%rip), %rsi     # 0x15488
movq 0x105ba(%rip), %rcx     # 0x14fc0
xorl %edx, %edx
callq 0x3080
movl %eax, 0x10b41(%rip)     # 0x15554
callq 0x3d7f
movl 0x10b82(%rip), %edi     # 0x155a0
callq 0x42af
movl 0x10b2b(%rip), %eax     # 0x15554
movl %eax, 0x10b21(%rip)     # 0x15550
decl %eax
movl %eax, 0x10b1d(%rip)     # 0x15554
callq 0x6723
callq 0x3b3c
movl 0x1082d(%rip), %esi     # 0x15274
movl 0x1082b(%rip), %edx     # 0x15278
leaq 0xc634(%rip), %r14      # 0x11088
movq %r14, %rdi
xorl %eax, %eax
callq 0x3060
leal 0x1(%r15), %ebp
movl 0x10ae8(%rip), %eax     # 0x15550
cmpl %ebx, %eax
cmovll %eax, %ebx
movl %ebx, 0x28(%rsp)
movl 0x107fd(%rip), %esi     # 0x15274
movl 0x107fb(%rip), %edx     # 0x15278
movq %r14, %rdi
xorl %eax, %eax
callq 0x3060
leaq 0x40(%rsp), %r13
leaq 0x8(%rsp), %r14
movq %r15, 0x90(%rsp)
movl %r15d, %ebx
cmpl 0x28(%rsp), %ebx
jge 0x5038
leaq 0xc617(%rip), %rdi      # 0x110c4
movl %ebp, %esi
xorl %eax, %eax
callq 0x3060
movq 0x109cb(%rip), %rax     # 0x15488
movl %ebx, 0x4(%rsp)
movslq %ebx, %r15
movq (%rax,%r15,8), %r12
cmpb $0x4, 0x12(%r12)
jne 0x4ae9
leaq 0xc5f2(%rip), %rdi      # 0x110c9
xorl %eax, %eax
callq 0x3060
movq 0x109a3(%rip), %rax     # 0x15488
movq (%rax,%r15,8), %r12
leaq 0x13(%r12), %rbx
movq %r13, 0x30(%rsp)
movq %rbx, %rdi
callq 0x3110
leaq (%r12,%rax), %rdx
addq $0x13, %rdx
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0xfec2
cmpq $0x1a, 0x38(%rsp)
jb 0x4b7a
movl $0x16, %ecx
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3270
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3320
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x4b65
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x30(%rsp), %rsi
leaq 0xca0b(%rip), %rdi      # 0x1157c
xorl %eax, %eax
callq 0x3060
jmp 0x4b9f
movq 0x10907(%rip), %rax     # 0x15488
movq (%rax,%r15,8), %rsi
addq $0x13, %rsi
leaq 0xca18(%rip), %rdi      # 0x115a8
xorl %eax, %eax
callq 0x3060
leaq 0xb8(%rsp), %rbx
movq 0x108e2(%rip), %rax     # 0x15488
movq (%rax,%r15,8), %rax
cmpb $0x4, 0x12(%rax)
jne 0x4bbe
leaq 0xc5cd(%rip), %rdi      # 0x11184
xorl %eax, %eax
callq 0x3060
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x10859(%rip), %rsi     # 0x15428
movq 0x1085a(%rip), %rdx     # 0x15430
addq %rsi, %rdx
movq %r14, %rdi
callq 0xfc98
movq %r14, %rdi
leaq 0xc4ae(%rip), %rsi      # 0x11099
callq 0x3480
movq 0x10891(%rip), %rax     # 0x15488
movq (%rax,%r15,8), %rsi
addq $0x13, %rsi
movq %r14, %rdi
callq 0x3480
leaq 0x60(%rsp), %r15
movq %r15, 0x50(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4c2f
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x4c36
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x58(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4c6a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x3200
testl %eax, %eax
movl %eax, 0x2c(%rsp)
js 0x4ff9
movl 0x4(%rsp), %r13d
subl 0x90(%rsp), %r13d
addl $0x3, %r13d
leaq 0xc434(%rip), %rdi      # 0x110cf
movl %r13d, %esi
xorl %eax, %eax
callq 0x3060
xorps %xmm0, %xmm0
cvtsi2ssl 0xe8(%rsp), %xmm0
movaps %xmm0, %xmm2
movss 0xc348(%rip), %xmm3     # 0x11004
mulss %xmm3, %xmm2
movss 0xc340(%rip), %xmm4     # 0x11008
ucomiss %xmm4, %xmm2
leaq 0xc8c8(%rip), %rdi      # 0x1159a
leaq 0xc8c8(%rip), %rbx      # 0x115a1
jb 0x4d1e
movaps %xmm2, %xmm1
mulss %xmm3, %xmm1
ucomiss %xmm4, %xmm1
movaps %xmm2, %xmm0
leaq 0xc8a3(%rip), %rdi      # 0x11592
jb 0x4d1e
movaps %xmm1, %xmm2
mulss %xmm3, %xmm2
ucomiss %xmm4, %xmm2
movaps %xmm4, %xmm0
cmpnless %xmm2, %xmm0
andps %xmm0, %xmm1
andnps %xmm2, %xmm0
orps %xmm1, %xmm0
leaq 0xc86f(%rip), %rdi      # 0x11582
leaq 0xc870(%rip), %rax      # 0x1158a
cmovbq %rax, %rdi
cvtss2sd %xmm0, %xmm0
movb $0x1, %al
callq 0x3060
leaq 0xc358(%rip), %rdi      # 0x11088
movl %r13d, %esi
movl $0x24, %edx
xorl %eax, %eax
callq 0x3060
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
leaq 0xc3cc(%rip), %rdx      # 0x1111f
movq %rdx, %rsi
callq 0xfec2
movl 0xd0(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x4000, %eax           # imm = 0x4000
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
leaq 0xc844(%rip), %rax      # 0x115c1
cmoveq %rax, %rcx
movl $0x1, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x33d0
btl $0x8, 0xd0(%rsp)
leaq 0xc3f4(%rip), %rsi      # 0x11195
cmovaeq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
cmpb $0x0, 0xd0(%rsp)
leaq 0xc35e(%rip), %rsi      # 0x1111a
cmovnsq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x40, 0xd0(%rsp)
leaq 0xc7cc(%rip), %rsi      # 0x115a3
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x20, 0xd0(%rsp)
leaq 0xc3a3(%rip), %rsi      # 0x11195
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x10, 0xd0(%rsp)
leaq 0xc30d(%rip), %rsi      # 0x1111a
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x8, 0xd0(%rsp)
leaq 0xc77b(%rip), %rsi      # 0x115a3
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x4, 0xd0(%rsp)
leaq 0xc352(%rip), %rsi      # 0x11195
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x2, 0xd0(%rsp)
leaq 0xc2bc(%rip), %rsi      # 0x1111a
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x1, 0xd0(%rsp)
leaq 0xc72a(%rip), %rsi      # 0x115a3
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x10132(%rip), %rdi     # 0x14fc8
callq 0x32c0
movl 0xd4(%rsp), %edi
callq 0x32d0
movq %rax, %rbx
movl %ebp, %r12d
movl 0xd8(%rsp), %edi
callq 0x3430
movq %rax, %r15
leaq 0xc1c5(%rip), %rbp      # 0x11088
movq %rbp, %rdi
movl %r13d, %esi
movl $0x32, %edx
xorl %eax, %eax
callq 0x3060
movq (%r15), %rsi
movq (%rbx), %rdx
leaq 0xc6c3(%rip), %rdi      # 0x115a5
xorl %eax, %eax
callq 0x3060
movq %rbp, %rdi
movl %r13d, %esi
movl $0x41, %edx
xorl %eax, %eax
callq 0x3060
leaq 0x110(%rsp), %rdi
callq 0x30f0
leaq 0x98(%rsp), %rdi
movq %rax, %rsi
leaq 0x70(%rsp), %rdx
callq 0xf6fa
movl $0x1, %edx
movq 0x1009f(%rip), %rdi     # 0x14fc8
leaq 0xc1f2(%rip), %rsi      # 0x11122
leaq 0x40(%rsp), %r13
leaq 0x60(%rsp), %r15
callq 0x32c0
movl 0x4(%rsp), %ebx
movl %r12d, %ebp
movl $0x4, %edx
movl $0xc, %ecx
leaq 0x70(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x3270
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x10055(%rip), %rdi     # 0x14fc8
callq 0x32c0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x4f9a
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3260
movl $0x1, %edx
movq 0x10022(%rip), %rdi     # 0x14fc8
leaq 0xc171(%rip), %rsi      # 0x1111e
callq 0x32c0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x4fd7
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4ff3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
incl %ebp
incl %ebx
jmp 0x4ffd
movl 0x4(%rsp), %ebx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x5014
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x502b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3260
cmpl $0x0, 0x2c(%rsp)
jns 0x4a9c
jmp 0x5052
movl 0x10236(%rip), %esi     # 0x15274
movl 0x10234(%rip), %edx     # 0x15278
leaq 0xc03d(%rip), %rdi      # 0x11088
xorl %eax, %eax
callq 0x3060
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x50a5
jmp 0x50c8
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x50cb
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x50cb
jmp 0x50a0
jmp 0x50a0
movq %rax, %rbx
leaq 0x40(%rsp), %r13
jmp 0x5120
movq %rax, %rbx
jmp 0x50f0
movq %rax, %rbx
jmp 0x5137
jmp 0x50af
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5137
movq 0x18(%rsp), %rsi
jmp 0x512f
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x50f0
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x40(%rsp), %r13
leaq 0x60(%rsp), %r15
jmp 0x5104
movq %rax, %rbx
leaq 0x40(%rsp), %r13
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5120
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x5137
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x514e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3450