// File: /workspace/github_c_makefile_star2_O0/DVaronos[P]AnLogProject1/logistic.c
// Function: InputMake
Input* InputMake(char* filename1,char* filename2,Hash* H){

	FILE* fptr;
  int   a,z,ismatch,size = H->Head->Next->vec_size,count=0;
  char line[300];
  char* first;
  char* second;
  char* token=NULL;
	HVector* F;
  HVector* S;
  HVector* Con;
	Input* input=InputInit();

	fptr = fopen(filename1, "r");	//Anigma tou protou arxiou(me tis thetikes sisxetiseis)
	ismatch=1;	//oi sisxetiseis einai oles thetikes
	a=0;
	z=0;
	for(int i=0 ; i<2; i++){ //Gia kathe ena ap ta dio arxia

		while (fgets(line,sizeof(line),fptr)){//Diavazei to csv file grami grami
			if(!i){	//Ean eimaste sto proto arxio
					a++;	//Metrame tis thetikes sisxetisis
			}else{	//Ean eimaste sto deftero arxio
					if(z==2*a){	//Ean oi arnitikes sisxetisis einai oi diplasies stamatame to trainig gia afthn thn epanalipsh
							break;
					}else{	//Alios afksanoume tis arnitikes sisxetisis
							z++;
					}
			}
			token=strtok(line,",");
			if(!strcmp(token,"left_spec_id"))  continue;	//Ean einai h proth gramh twn csv kanoume skip thn epanalipsh
			first=strdup(token);
			token = strtok(NULL, " \n");
			second=strdup(token);
			F=GetCameraVector(first,H);	//Pernoume to vector ths proths kameras
			S=GetCameraVector(second,H);	//Pernoume to vector ths defterhs kameras
			Con=VectorConcat(F,S,size);	//Ipologizoume to concatenation

			input->Cons=realloc(input->Cons, (count+1)*sizeof(HVector*));
			input->Cons[count] = Con;

			input->matches= realloc(input->matches, (count+1)*sizeof(int));
			input->matches[count] = ismatch;
			count++;


			free(first);
			free(second);
		}
		fclose(fptr);//klinoume to arxio
		if(!i){	//Ean imastan sto proto arxio anoigoume to deftero(me tis arnitikes sisxerisis)
			fptr = fopen(filename2, "r");
			ismatch = 0;
		}
	}
	input->size=count;
	return input;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movl 0x28(%rax), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq $0x0, -0x178(%rbp)
callq 0x2700
movq %rax, -0x198(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5804(%rip), %rsi      # 0x8016
callq 0x11f0
movq %rax, -0x20(%rbp)
movl $0x1, -0x2c(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x19c(%rbp)
cmpl $0x2, -0x19c(%rbp)
jge 0x2a42
jmp 0x2849
leaq -0x160(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x12c, %esi            # imm = 0x12C
callq 0x1100
cmpq $0x0, %rax
je 0x29ff
cmpl $0x0, -0x19c(%rbp)
jne 0x287c
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2898
movl -0x28(%rbp), %eax
movl -0x24(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jne 0x288d
jmp 0x29ff
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2898
leaq -0x160(%rbp), %rdi
leaq 0x5a47(%rip), %rsi      # 0x82ed
callq 0x1210
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
leaq 0x5860(%rip), %rsi      # 0x8120
callq 0x1120
cmpl $0x0, %eax
jne 0x28cf
jmp 0x2849
movq -0x178(%rbp), %rdi
callq 0x1250
movq %rax, -0x168(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x5963(%rip), %rsi      # 0x8250
callq 0x1210
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
callq 0x1250
movq %rax, -0x170(%rbp)
movq -0x168(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2330
movq %rax, -0x180(%rbp)
movq -0x170(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2330
movq %rax, -0x188(%rbp)
movq -0x180(%rbp), %rdi
movq -0x188(%rbp), %rsi
movl -0x30(%rbp), %edx
callq 0x2450
movq %rax, -0x190(%rbp)
movq -0x198(%rbp), %rax
movq (%rax), %rdi
movl -0x34(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x11b0
movq %rax, %rcx
movq -0x198(%rbp), %rax
movq %rcx, (%rax)
movq -0x190(%rbp), %rdx
movq -0x198(%rbp), %rax
movq (%rax), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x198(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x34(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x2, %rsi
callq 0x11b0
movq %rax, %rcx
movq -0x198(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x2c(%rbp), %edx
movq -0x198(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x168(%rbp), %rdi
callq 0x1030
movq -0x170(%rbp), %rdi
callq 0x1030
jmp 0x2849
movq -0x20(%rbp), %rdi
callq 0x1080
cmpl $0x0, -0x19c(%rbp)
jne 0x2a2c
movq -0x10(%rbp), %rdi
leaq 0x55fa(%rip), %rsi      # 0x8016
callq 0x11f0
movq %rax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x2a2e
movl -0x19c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x19c(%rbp)
jmp 0x283a
movl -0x34(%rbp), %ecx
movq -0x198(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x198(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nop