// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, -0x68(%rbp)
movq %rdi, %rbx
movq %rdx, -0x60(%rbp)
movq 0x8(%rdx), %rax
movq 0x20(%rax), %rax
movl 0x28(%rax), %eax
movl %eax, -0x4c(%rbp)
movl $0x18, %edi
callq 0x11a0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, -0x38(%rbp)
movl $0x0, 0x10(%rax)
leaq 0x3ec8(%rip), %rsi      # 0x6010
movq %rbx, %rdi
callq 0x1200
movq %rax, %rbx
movl $0x1, -0x30(%rbp)
xorl %r15d, %r15d
movb $0x1, %al
movl %eax, -0x2c(%rbp)
xorl %r13d, %r13d
xorl %eax, %eax
cltq
movq %rax, -0x40(%rbp)
leaq -0x1b0(%rbp), %r12
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %rbx, %rdx
callq 0x1110
testq %rax, %rax
je 0x2296
testb $0x1, -0x2c(%rbp)
je 0x2198
incl %r15d
jmp 0x21a8
leal (%r15,%r15), %eax
cmpl %eax, %r13d
je 0x22ce
incl %r13d
movq %r12, %rdi
leaq 0x4136(%rip), %rsi      # 0x62e8
callq 0x1220
movq %rax, %r14
movq %rax, %rdi
leaq 0x3e8c(%rip), %rsi      # 0x6050
callq 0x1140
testl %eax, %eax
je 0x2174
movq %r14, %rdi
callq 0x1270
movq %rax, %r14
movq %rax, -0x78(%rbp)
xorl %edi, %edi
leaq 0x406b(%rip), %rsi      # 0x6250
callq 0x1220
movq %rax, %rdi
callq 0x1270
movq %rax, -0x58(%rbp)
movq %r14, %rdi
movq -0x60(%rbp), %r14
movq %r14, %rsi
callq 0x1e7e
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rdi
movq %r14, %rsi
callq 0x1e7e
movq -0x48(%rbp), %rdi
movq %rax, %rsi
movl -0x4c(%rbp), %edx
callq 0x1f1e
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %r14
leaq 0x1(%r14), %rax
movq %rax, -0x48(%rbp)
leaq 0x8(,%r14,8), %rsi
callq 0x11c0
movq -0x38(%rbp), %rcx
movq %rax, (%rcx)
movq -0x70(%rbp), %rdx
movq %rdx, (%rax,%r14,8)
movq 0x8(%rcx), %rdi
leaq 0x4(,%r14,4), %rsi
callq 0x11c0
movq -0x38(%rbp), %rcx
movq %rax, 0x8(%rcx)
movl -0x30(%rbp), %ecx
movl %ecx, (%rax,%r14,4)
movq -0x78(%rbp), %rdi
callq 0x1030
movq -0x58(%rbp), %rdi
callq 0x1030
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x2174
movq %rbx, %rdi
callq 0x10a0
testb $0x1, -0x2c(%rbp)
je 0x22d6
movq -0x68(%rbp), %rdi
leaq 0x3d61(%rip), %rsi      # 0x6010
callq 0x1200
movq %rax, %rbx
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x40(%rbp), %rax
jmp 0x2167
movq %rbx, %rdi
callq 0x10a0
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movl %ecx, 0x10(%rax)
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq