// File: dcarrey[P]hgt-detection/./fonctions.cpp
// Function: sameHGT2(HGT, HGT)
int sameHGT2(struct HGT HGT1, struct HGT HGT2){
	int i,h1=0,h2=0;

	if(HGT1.listSource[0] == HGT2.listSource[0]){ 
		h1 = 1;
		for(i=1;i<=HGT1.listSource[0];i++){
			if(HGT1.listSource[i] != HGT2.listSource[i])
				h1=0;
		}
	}

	if(HGT1.listDestination[0] == HGT2.listDestination[0]){
		h2=1;
		for(i=1;i<=HGT1.listDestination[0];i++){
			if(HGT1.listDestination[i] != HGT2.listDestination[i])
				h2 = 0;
		}
	}

	if(h2 == 1 && h1 == 1) return 1;


	if(HGT1.listSource[0] == HGT2.listDestination[0]){ 
		h1=1;
		for(i=1;i<=HGT1.listSource[0];i++){
			if(HGT1.listSource[i] != HGT2.listDestination[i])
				h1=0;
		}
	}

	if(HGT1.listDestination[0] == HGT2.listSource[0]){
		h2=1;
		for(i=1;i<=HGT1.listDestination[0];i++){
			if(HGT1.listDestination[i] != HGT2.listSource[i])
				h2 = 0;
		}
	}

	if(h2 == 1 && h1 == 1) return 1;
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xb8(%rbp), %rcx
movq %rcx, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movq 0x10(%rax), %rax
movl (%rax), %eax
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x12c16
movl $0x1, -0xc(%rbp)
movl $0x1, -0x8(%rbp)
movq -0x18(%rbp), %rcx
movl -0x8(%rbp), %eax
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jg 0x12c14
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x8(%rbp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x10(%rcx), %rcx
movslq -0x8(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x12c07
movl $0x0, -0xc(%rbp)
jmp 0x12c09
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x12bd1
jmp 0x12c16
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
movq 0x18(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x12c7f
movl $0x1, -0x10(%rbp)
movl $0x1, -0x8(%rbp)
movq -0x18(%rbp), %rcx
movl -0x8(%rbp), %eax
movq 0x18(%rcx), %rcx
cmpl (%rcx), %eax
jg 0x12c7d
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x8(%rbp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x18(%rcx), %rcx
movslq -0x8(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x12c70
movl $0x0, -0x10(%rbp)
jmp 0x12c72
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x12c3a
jmp 0x12c7f
cmpl $0x1, -0x10(%rbp)
jne 0x12c97
cmpl $0x1, -0xc(%rbp)
jne 0x12c97
movl $0x1, -0x4(%rbp)
jmp 0x12d85
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movq 0x18(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x12d00
movl $0x1, -0xc(%rbp)
movl $0x1, -0x8(%rbp)
movq -0x18(%rbp), %rcx
movl -0x8(%rbp), %eax
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jg 0x12cfe
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x8(%rbp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x18(%rcx), %rcx
movslq -0x8(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x12cf1
movl $0x0, -0xc(%rbp)
jmp 0x12cf3
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x12cbb
jmp 0x12d00
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
jne 0x12d69
movl $0x1, -0x10(%rbp)
movl $0x1, -0x8(%rbp)
movq -0x18(%rbp), %rcx
movl -0x8(%rbp), %eax
movq 0x18(%rcx), %rcx
cmpl (%rcx), %eax
jg 0x12d67
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x8(%rbp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x10(%rcx), %rcx
movslq -0x8(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x12d5a
movl $0x0, -0x10(%rbp)
jmp 0x12d5c
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x12d24
jmp 0x12d69
cmpl $0x1, -0x10(%rbp)
jne 0x12d7e
cmpl $0x1, -0xc(%rbp)
jne 0x12d7e
movl $0x1, -0x4(%rbp)
jmp 0x12d85
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)