```
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int area1=abs((C-A)*(D-B)), area2=abs((G-E)*(H-F));
int intersect_area=0;
int A1=A, A2=B, B1=C, B2=D, C1=E, C2=F, D1=G, D2=H;
if(A<C){
A1=A;
A2=B;
B1=C;
B2=D;
}
else{
A1=C;
A2=D;
B1=A;
B2=B;
}
if(E<G){
C1=E;
C2=F;
D1=G;
D2=H;
}
else{
C1=G;
C2=H;
D1=E;
D2=F;
}
if(A1>=D1 || C1>=B1 || A2>=D2 || C2>=B2) return area2+area1;
return area2+area1-(min(B1,D1)-max(A1,C1))*(min(B2,D2)-max(C2,A2));
}
```