// File: /workspace/github_c_makefile_star2_O0/DVaronos[P]AnLogProject1/hash.c
// Function: Readjson
LHash* Readjson(char* filename,LHash* H,LHash* Common,WHash** L){ //Diavazei to Json kai apothikei tis leksis sto leksilogio kai se ena WHash
  FILE* fp;
  if( (fp=fopen(filename,"r"))==NULL){
    perror("Fopen");
  }

  char symbols[] =  " /,\\,\n,[,],(,),*,&,^,%,$,#,@,!,:,;,<,>,`,~,+,_,-,=,{,}|,\",.," "";  //Ta simvolia ta opia tha xwrizoun tis lekseis
  (*L)=CreateWHash(200);
  char line[250];
  char* word;
  int count=0;

	while(fgets(line, sizeof(line),fp)){  //Diavazei to json grami gami

		word = strtok(line, """:");		//skip labels
		word=strtok(NULL,symbols);

		while(word!=NULL){ //Gia kathe leksi tis gramhs
			if(strlen(word)>2)
			{
				count++;
				for(int j=0; j<=strlen(word);j++){  //Metatrepei ta kefalea se peza
					if(word[j]>=65 && word[j]<=90)	word[j]=word[j]+32;
				}
				if(!LHashFind(Common,word)){  //Ean h leksh den einai mia apo tis common
					if(!WHashFind(*L,word))  H=LHashInsert(H,word); //Ean den exw isagi thn leksh allh fora sto stigekrimeno json
					*L=InsertWHash(*L,word);
				}
			}
			word=strtok(NULL,symbols);
		}
	}
	fclose(fp);
	(*L)=WHashTF(*L); //Ipoligismos twn tf gia kathe leksh tou TF
	for(int i=0 ; i<(*L)->size ; i++){
		if((*L)[i].word!=NULL){
			H=LHashIncreaseTf(H,(*L)[i].word,(*L)[i].tfidf);
		}
	}
return H;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xde0(%rip), %rsi       # 0x8016
callq 0x11f0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x7251
leaq 0xe57(%rip), %rdi       # 0x80a3
callq 0x1200
leaq -0x70(%rbp), %rdi
leaq 0x10b4(%rip), %rsi      # 0x8310
movl $0x3d, %edx
callq 0x1150
movl $0xc8, %edi
callq 0x4d10
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x17c(%rbp)
leaq -0x170(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0xfa, %esi
callq 0x1100
cmpq $0x0, %rax
je 0x7421
leaq -0x170(%rbp), %rdi
leaq 0x105c(%rip), %rsi      # 0x830d
callq 0x1210
movq %rax, -0x178(%rbp)
leaq -0x70(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x1210
movq %rax, -0x178(%rbp)
cmpq $0x0, -0x178(%rbp)
je 0x741c
movq -0x178(%rbp), %rdi
callq 0x10a0
cmpq $0x2, %rax
jbe 0x7403
movl -0x17c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x17c(%rbp)
movl $0x0, -0x180(%rbp)
movslq -0x180(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x178(%rbp), %rdi
callq 0x10a0
movq %rax, %rcx
movq -0x190(%rbp), %rax
cmpq %rcx, %rax
ja 0x73a3
movq -0x178(%rbp), %rax
movslq -0x180(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x41, %eax
jl 0x738d
movq -0x178(%rbp), %rax
movslq -0x180(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5a, %eax
jg 0x738d
movq -0x178(%rbp), %rax
movslq -0x180(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $0x20, %eax
movb %al, %dl
movq -0x178(%rbp), %rax
movslq -0x180(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x738f
movl -0x180(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x180(%rbp)
jmp 0x730e
movq -0x18(%rbp), %rdi
movq -0x178(%rbp), %rsi
callq 0x6c30
cmpl $0x0, %eax
jne 0x7401
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x178(%rbp), %rsi
callq 0x5230
cmpl $0x0, %eax
jne 0x73e4
movq -0x10(%rbp), %rdi
movq -0x178(%rbp), %rsi
callq 0x6660
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x178(%rbp), %rsi
callq 0x4da0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x7403
leaq -0x70(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x1210
movq %rax, -0x178(%rbp)
jmp 0x72d1
jmp 0x7284
movq -0x28(%rbp), %rdi
callq 0x1080
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x5130
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x184(%rbp)
movl -0x184(%rbp), %eax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x14(%rcx), %eax
jge 0x74ca
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x184(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x74b7
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x184(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x184(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
callq 0x7130
movq %rax, -0x10(%rbp)
jmp 0x74b9
movl -0x184(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x184(%rbp)
jmp 0x744a
movq -0x10(%rbp), %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw (%rax,%rax)