// File: dcarrey[P]hgt-detection/./fonctions.cpp
// Function: deleteSommet(DescTree*, int, int)
void deleteSommet(struct DescTree *tab, int t1, int t2){

	int i,j,k=0,toDel=1,tmp;
	
	// si les elements de tab1 se trouve dans tab2 on les supprimes dans tab2
	for(i=0;i<tab[t1].nbSommet;i++){
		tmp=0;
		for(j=0;j<tab[t2].nbSommet;j++){
			if(tab[t1].Tableau[i] == tab[t2].Tableau[j]){
				//printf("\n=>%d (%d)",tab[t1].Tableau[i],tab[t1].nbSommet);
				tmp=1;
			}
		}
		if(tmp==0) toDel=0;
	}
	for(i=0;i<tab[t1-1].nbSommet;i++){
		tmp=0;
		for(j=0;j<tab[t2].nbSommet;j++){
			if(tab[t1-1].Tableau[i] == tab[t2].Tableau[j]){
				//printf("\n=>%d (%d)",tab[t1-1].Tableau[i],tab[t1-1].nbSommet);
				tmp=1;
			}
		}
		if(tmp==0) toDel=0;
	}
	

	// suppression des sommets
	if(toDel == 1){
		for(i=0;i<tab[t1].nbSommet;i++){
			for(j=0;j<tab[t2].nbSommet;j++){
				if(tab[t1].Tableau[i] == tab[t2].Tableau[j]){
					tab[t2].Tableau[j]=-1;
					k=j;
				}
			}

			for(j=k;j<tab[t2].nbSommet-1;j++){
				tab[t2].Tableau[j] = tab[t2].Tableau[j+1];
			}
			tab[t2].nbSommet--;
		
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x1, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x1d498
movl $0x0, -0x24(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x1d47b
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movslq -0x18(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x1d46e
movl $0x1, -0x24(%rbp)
jmp 0x1d470
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1d41b
cmpl $0x0, -0x24(%rbp)
jne 0x1d488
movl $0x0, -0x20(%rbp)
jmp 0x1d48a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1d3f3
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movl -0xc(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x1d54e
movl $0x0, -0x24(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x1d531
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movslq -0x18(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x1d524
movl $0x1, -0x24(%rbp)
jmp 0x1d526
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1d4cc
cmpl $0x0, -0x24(%rbp)
jne 0x1d53e
movl $0x0, -0x20(%rbp)
jmp 0x1d540
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1d49f
cmpl $0x1, -0x20(%rbp)
jne 0x1d688
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x1d686
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x1d5fd
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movslq -0x18(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x1d5f0
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x1d5f2
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1d580
movl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x10(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1d662
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1d603
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1d55f
jmp 0x1d688
popq %rbp
retq
nopw (%rax,%rax)