// File: /workspace/github_cpp_makefile_star2_O1/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 0x10a4d(%rip), %rdi     # 0x15428
leaq 0x10aa6(%rip), %rsi     # 0x15488
movq 0x105d7(%rip), %rcx     # 0x14fc0
xorl %edx, %edx
callq 0x3080
movl %eax, 0x10b5e(%rip)     # 0x15554
callq 0x3d7f
movl 0x10b9f(%rip), %edi     # 0x155a0
callq 0x42af
movl 0x10b48(%rip), %eax     # 0x15554
movl %eax, 0x10b3e(%rip)     # 0x15550
decl %eax
movl %eax, 0x10b3a(%rip)     # 0x15554
callq 0x6710
callq 0x3b3c
movl 0x1084a(%rip), %esi     # 0x15274
movl 0x10848(%rip), %edx     # 0x15278
leaq 0xc651(%rip), %r14      # 0x11088
movq %r14, %rdi
xorl %eax, %eax
callq 0x3060
leal 0x1(%r15), %ebp
movl 0x10b05(%rip), %eax     # 0x15550
cmpl %ebx, %eax
cmovll %eax, %ebx
movl %ebx, 0x28(%rsp)
movl 0x1081a(%rip), %esi     # 0x15274
movl 0x10818(%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 0x5019
leaq 0xc634(%rip), %rdi      # 0x110c4
movl %ebp, %esi
xorl %eax, %eax
callq 0x3060
movq 0x109e8(%rip), %rax     # 0x15488
movl %ebx, 0x4(%rsp)
movslq %ebx, %r15
movq (%rax,%r15,8), %rax
cmpb $0x4, 0x12(%rax)
jne 0x4abf
leaq 0xc611(%rip), %rdi      # 0x110c9
xorl %eax, %eax
callq 0x3060
movq 0x109c2(%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 0xffc4
cmpq $0x1a, 0x38(%rsp)
jb 0x4b5b
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 0x4b46
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x30(%rsp), %rsi
leaq 0xca2a(%rip), %rdi      # 0x1157c
xorl %eax, %eax
callq 0x3060
jmp 0x4b80
movq 0x10926(%rip), %rax     # 0x15488
movq (%rax,%r15,8), %rsi
addq $0x13, %rsi
leaq 0xca37(%rip), %rdi      # 0x115a8
xorl %eax, %eax
callq 0x3060
leaq 0xb8(%rsp), %rbx
movq 0x10901(%rip), %rax     # 0x15488
movq (%rax,%r15,8), %rax
cmpb $0x4, 0x12(%rax)
jne 0x4b9f
leaq 0xc5ec(%rip), %rdi      # 0x11184
xorl %eax, %eax
callq 0x3060
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x10878(%rip), %rsi     # 0x15428
movq 0x10879(%rip), %rdx     # 0x15430
addq %rsi, %rdx
movq %r14, %rdi
callq 0xfda0
movq %r14, %rdi
leaq 0xc4cd(%rip), %rsi      # 0x11099
callq 0x3480
movq 0x108b0(%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 0x4c10
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x4c17
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 0x4c4b
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 0x4fda
movl 0x4(%rsp), %r13d
subl 0x90(%rsp), %r13d
addl $0x3, %r13d
leaq 0xc453(%rip), %rdi      # 0x110cf
movl %r13d, %esi
xorl %eax, %eax
callq 0x3060
xorps %xmm0, %xmm0
cvtsi2ssl 0xe8(%rsp), %xmm0
movaps %xmm0, %xmm2
movss 0xc367(%rip), %xmm3     # 0x11004
mulss %xmm3, %xmm2
movss 0xc35f(%rip), %xmm4     # 0x11008
ucomiss %xmm4, %xmm2
leaq 0xc8e7(%rip), %rdi      # 0x1159a
leaq 0xc8e7(%rip), %rbx      # 0x115a1
jb 0x4cff
movaps %xmm2, %xmm1
mulss %xmm3, %xmm1
ucomiss %xmm4, %xmm1
movaps %xmm2, %xmm0
leaq 0xc8c2(%rip), %rdi      # 0x11592
jb 0x4cff
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 0xc88e(%rip), %rdi      # 0x11582
leaq 0xc88f(%rip), %rax      # 0x1158a
cmovbq %rax, %rdi
cvtss2sd %xmm0, %xmm0
movb $0x1, %al
callq 0x3060
leaq 0xc377(%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 0xc3eb(%rip), %rdx      # 0x1111f
movq %rdx, %rsi
callq 0xffc4
movl 0xd0(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x4000, %eax           # imm = 0x4000
movq %rbx, %rcx
leaq 0xc868(%rip), %rax      # 0x115c1
cmoveq %rax, %rcx
movq 0x10(%rsp), %rdx
movl $0x1, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x33d0
btl $0x8, 0xd0(%rsp)
leaq 0xc413(%rip), %rsi      # 0x11195
cmovaeq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
cmpb $0x0, 0xd0(%rsp)
leaq 0xc37d(%rip), %rsi      # 0x1111a
cmovnsq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x40, 0xd0(%rsp)
leaq 0xc7eb(%rip), %rsi      # 0x115a3
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x20, 0xd0(%rsp)
leaq 0xc3c2(%rip), %rsi      # 0x11195
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x10, 0xd0(%rsp)
leaq 0xc32c(%rip), %rsi      # 0x1111a
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x8, 0xd0(%rsp)
leaq 0xc79a(%rip), %rsi      # 0x115a3
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x4, 0xd0(%rsp)
leaq 0xc371(%rip), %rsi      # 0x11195
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x2, 0xd0(%rsp)
leaq 0xc2db(%rip), %rsi      # 0x1111a
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
testb $0x1, 0xd0(%rsp)
leaq 0xc749(%rip), %rsi      # 0x115a3
cmoveq %rbx, %rsi
movq %r14, %rdi
callq 0x3480
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x10151(%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 0xc1e4(%rip), %rbp      # 0x11088
movq %rbp, %rdi
movl %r13d, %esi
movl $0x32, %edx
xorl %eax, %eax
callq 0x3060
movq (%r15), %rsi
movq (%rbx), %rdx
leaq 0xc6e2(%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 0xf812
movl $0x1, %edx
movq 0x100be(%rip), %rdi     # 0x14fc8
leaq 0xc211(%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 0x10074(%rip), %rdi     # 0x14fc8
callq 0x32c0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x4f7b
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3260
movl $0x1, %edx
movq 0x10041(%rip), %rdi     # 0x14fc8
leaq 0xc190(%rip), %rsi      # 0x1111e
callq 0x32c0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x4fb8
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4fd4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
incl %ebp
incl %ebx
jmp 0x4fde
movl 0x4(%rsp), %ebx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x4ff5
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x500c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3260
cmpl $0x0, 0x2c(%rsp)
jns 0x4a7f
jmp 0x5033
movl 0x10255(%rip), %esi     # 0x15274
movl 0x10253(%rip), %edx     # 0x15278
leaq 0xc05c(%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 0x5086
jmp 0x50a9
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x50ac
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x50ac
jmp 0x5081
jmp 0x5081
movq %rax, %rbx
leaq 0x40(%rsp), %r13
jmp 0x5101
movq %rax, %rbx
jmp 0x50d1
movq %rax, %rbx
jmp 0x5118
jmp 0x5090
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5118
movq 0x18(%rsp), %rsi
jmp 0x5110
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x50d1
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x40(%rsp), %r13
leaq 0x60(%rsp), %r15
jmp 0x50e5
movq %rax, %rbx
leaq 0x40(%rsp), %r13
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5101
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x5118
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x512f
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3450