// File: /workspace/github_cpp_makefile_star2_O2/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 0xafed(%rip), %rdi      # 0xf438
leaq 0xb046(%rip), %rsi      # 0xf498
movq 0xab67(%rip), %rcx      # 0xefc0
xorl %edx, %edx
callq 0x3070
movl %eax, 0xb0fe(%rip)      # 0xf564
callq 0x3ab9
movl 0xb13f(%rip), %edi      # 0xf5b0
callq 0x3edd
movl 0xb0e8(%rip), %eax      # 0xf564
movl %eax, 0xb0de(%rip)      # 0xf560
decl %eax
movl %eax, 0xb0da(%rip)      # 0xf564
callq 0x5511
callq 0x38cc
movl 0xade2(%rip), %esi      # 0xf27c
movl 0xade0(%rip), %edx      # 0xf280
leaq 0x6be1(%rip), %r14      # 0xb088
movq %r14, %rdi
xorl %eax, %eax
callq 0x3050
leal 0x1(%r15), %ebp
movl 0xb0a5(%rip), %eax      # 0xf560
cmpl %ebx, %eax
cmovll %eax, %ebx
movl %ebx, 0x8(%rsp)
movl 0xadb2(%rip), %esi      # 0xf27c
movl 0xadb0(%rip), %edx      # 0xf280
movq %r14, %rdi
xorl %eax, %eax
callq 0x3050
leaq 0x78(%rsp), %r12
leaq 0x98(%rsp), %r14
leaq 0x38(%rsp), %r13
movq %r15, %rax
movq %r15, 0x10(%rsp)
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %ebx
cmpl 0x8(%rsp), %ebx
jge 0x492e
leaq 0x6bb7(%rip), %rdi      # 0xb0c4
movl %ebp, %esi
xorl %eax, %eax
callq 0x3050
movq 0xaf7b(%rip), %rax      # 0xf498
movslq %ebx, %rbx
movq (%rax,%rbx,8), %rsi
cmpb $0x4, 0x12(%rsi)
jne 0x4543
leaq 0x6b98(%rip), %rdi      # 0xb0c9
xorl %eax, %eax
callq 0x3050
movq 0xaf59(%rip), %rax      # 0xf498
movq (%rax,%rbx,8), %rsi
addq $0x13, %rsi
movq %r12, %rdi
movq %r14, %rdx
callq 0xa1da
cmpq $0x1a, 0x80(%rsp)
jb 0x458e
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
pushq $0x16
popq %rcx
callq 0x3270
movq %r12, %rdi
movq %r14, %rsi
callq 0x3300
movq %r14, %rdi
callq 0x34d8
movq 0x78(%rsp), %rsi
leaq 0x6ff0(%rip), %rdi      # 0xb57c
jmp 0x45a4
movq 0xaf03(%rip), %rax      # 0xf498
movq (%rax,%rbx,8), %rsi
addq $0x13, %rsi
leaq 0x7004(%rip), %rdi      # 0xb5a8
xorl %eax, %eax
callq 0x3050
movq 0xaee6(%rip), %rax      # 0xf498
movq (%rax,%rbx,8), %rax
cmpb $0x4, 0x12(%rax)
jne 0x45ca
leaq 0x6bc1(%rip), %rdi      # 0xb184
xorl %eax, %eax
callq 0x3050
movq %r13, %rdi
leaq 0xae64(%rip), %rsi      # 0xf438
leaq 0x6abe(%rip), %rdx      # 0xb099
callq 0xa27a
movq 0xaeb1(%rip), %rax      # 0xf498
movq (%rax,%rbx,8), %rdx
addq $0x13, %rdx
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0xa2b2
movq %r13, %rdi
callq 0x34d8
movq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x3200
movl %eax, 0xc(%rsp)
testl %eax, %eax
js 0x490f
movl 0x4(%rsp), %ebx
subl 0x10(%rsp), %ebx
addl $0x3, %ebx
leaq 0x6aa0(%rip), %rdi      # 0xb0cf
movl %ebx, %esi
xorl %eax, %eax
callq 0x3050
cvtsi2ssl 0xc8(%rsp), %xmm0
movaps %xmm0, %xmm2
movss 0x69b8(%rip), %xmm3     # 0xb004
mulss %xmm3, %xmm2
movss 0x69b0(%rip), %xmm4     # 0xb008
ucomiss %xmm4, %xmm2
leaq 0x6f38(%rip), %rdi      # 0xb59a
jb 0x46a7
movaps %xmm2, %xmm1
mulss %xmm3, %xmm1
ucomiss %xmm4, %xmm1
movaps %xmm2, %xmm0
leaq 0x6f1a(%rip), %rdi      # 0xb592
jb 0x46a7
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 0x6ee6(%rip), %rdi      # 0xb582
leaq 0x6ee7(%rip), %rax      # 0xb58a
cmovbq %rax, %rdi
cvtss2sd %xmm0, %xmm0
movb $0x1, %al
callq 0x3050
leaq 0x69cf(%rip), %rdi      # 0xb088
movl %ebx, %esi
pushq $0x24
popq %rdx
xorl %eax, %eax
callq 0x3050
movq %r13, %rdi
leaq 0x6a50(%rip), %rsi      # 0xb11f
leaq 0x18(%rsp), %rdx
callq 0xa1da
leaq 0x6ec1(%rip), %r14      # 0xb5a1
movl 0xb0(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x4000, %eax           # imm = 0x4000
movq %r14, %rsi
leaq 0x6ec4(%rip), %rax      # 0xb5c1
cmoveq %rax, %rsi
movq %r13, %rdi
callq 0x3480
btl $0x8, 0xb0(%rsp)
leaq 0x6a7c(%rip), %rsi      # 0xb195
cmovaeq %r14, %rsi
movq %r13, %rdi
callq 0x3470
cmpb $0x0, 0xb0(%rsp)
leaq 0x69e6(%rip), %rsi      # 0xb11a
cmovnsq %r14, %rsi
movq %r13, %rdi
callq 0x3470
testb $0x40, 0xb0(%rsp)
leaq 0x6e54(%rip), %rsi      # 0xb5a3
cmoveq %r14, %rsi
movq %r13, %rdi
callq 0x3470
testb $0x20, 0xb0(%rsp)
leaq 0x6a2b(%rip), %rsi      # 0xb195
cmoveq %r14, %rsi
movq %r13, %rdi
callq 0x3470
testb $0x10, 0xb0(%rsp)
leaq 0x6995(%rip), %rsi      # 0xb11a
cmoveq %r14, %rsi
movq %r13, %rdi
callq 0x3470
testb $0x8, 0xb0(%rsp)
leaq 0x6e03(%rip), %rsi      # 0xb5a3
cmoveq %r14, %rsi
movq %r13, %rdi
callq 0x3470
testb $0x4, 0xb0(%rsp)
leaq 0x69da(%rip), %rsi      # 0xb195
cmoveq %r14, %rsi
movq %r13, %rdi
callq 0x3470
testb $0x2, 0xb0(%rsp)
leaq 0x6944(%rip), %rsi      # 0xb11a
cmoveq %r14, %rsi
movq %r13, %rdi
callq 0x3470
testb $0x1, 0xb0(%rsp)
leaq 0x6db2(%rip), %rsi      # 0xb5a3
cmoveq %r14, %rsi
movq %r13, %rdi
callq 0x3470
movq 0xa7c4(%rip), %rdi      # 0xefc8
movq %r13, %rsi
callq 0x31f0
movq %r12, %r14
movl 0xb4(%rsp), %edi
callq 0x32b0
movq %rax, %r12
movl %ebp, %r15d
movl 0xb8(%rsp), %edi
callq 0x3410
movq %rax, %r13
leaq 0x6851(%rip), %rbp      # 0xb088
movq %rbp, %rdi
movl %ebx, %esi
pushq $0x32
popq %rdx
xorl %eax, %eax
callq 0x3050
movq (%r13), %rsi
movq (%r12), %rdx
leaq 0x6d50(%rip), %rdi      # 0xb5a5
xorl %eax, %eax
callq 0x3050
movq %rbp, %rdi
movl %ebx, %esi
pushq $0x41
popq %rdx
xorl %eax, %eax
callq 0x3050
leaq 0xf0(%rsp), %rdi
callq 0x30e0
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
leaq 0x128(%rsp), %rdx
callq 0xa1da
movq 0xa734(%rip), %rdi      # 0xefc8
leaq 0x6887(%rip), %rsi      # 0xb122
callq 0x3230
movq %r14, %r12
leaq 0x98(%rsp), %r14
leaq 0x38(%rsp), %r13
movq %rax, %rbx
movl %r15d, %ebp
leaq 0x128(%rsp), %r15
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
pushq $0x4
popq %rdx
pushq $0xc
popq %rcx
callq 0x3270
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31f0
movq %r15, %rdi
callq 0x34d8
movq 0xa6dd(%rip), %rdi      # 0xefc8
leaq 0x682c(%rip), %rsi      # 0xb11e
callq 0x3230
incl %ebp
incl 0x4(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x34d8
movq %r13, %rdi
callq 0x34d8
leaq 0x58(%rsp), %rdi
callq 0x34d8
movq %r12, %rdi
callq 0x34d8
cmpl $0x0, 0xc(%rsp)
jns 0x44f8
jmp 0x4948
movl 0xa948(%rip), %esi      # 0xf27c
movl 0xa946(%rip), %edx      # 0xf280
leaq 0x6747(%rip), %rdi      # 0xb088
xorl %eax, %eax
callq 0x3050
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x497b
jmp 0x498a
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x34d8
jmp 0x498d
jmp 0x4999
jmp 0x4999
movq %rax, %rbx
jmp 0x49a6
jmp 0x4999
movq %rax, %rbx
jmp 0x49b0
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x49ab
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x34d8
jmp 0x499c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x34d8
leaq 0x58(%rsp), %rdi
callq 0x34d8
leaq 0x78(%rsp), %rdi
callq 0x34d8
movq %rbx, %rdi
callq 0x3430