#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ compose_homographies(double **, double **, double **);
int /*<<< orphan*/ homography_from_four_points(double **, double *, double *,
                                               double *, double *);
int /*<<< orphan*/ invert_homography(double **, double **);
void homography_from_eight_points(double H[3][3], double x[2], double y[2],
                                  double z[2], double w[2], double a[2],
                                  double b[2], double c[2], double d[2]) {
  double H1[3][3], H2[3][3], iH1[3][3];
  homography_from_four_points(H1, x, y, z, w);
  homography_from_four_points(H2, a, b, c, d);
  invert_homography(iH1, H1);
  compose_homographies(H, H2, iH1);
}


x86 assembly (clang, -O0):
<homography_from_eight_points>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1050 <homography_from_four_points@plt>
lea    -0xd0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%rcx
mov    0x20(%rbp),%r8
call   1050 <homography_from_four_points@plt>
lea    -0x120(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <invert_homography@plt>
mov    -0x8(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1030 <compose_homographies@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<homography_from_eight_points>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %r9,%rbx
mov    %rdi,%r14
mov    0x128(%rsp),%r12
mov    0x130(%rsp),%r13
lea    0xa0(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <homography_from_four_points@plt>
lea    0x50(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    0x120(%rsp),%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1050 <homography_from_four_points@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <invert_homography@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <compose_homographies@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @homography_from_eight_points([3 x double]* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca [3 x double]*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca [3 x [3 x double]]
%20 = alloca [3 x [3 x double]]
%21 = alloca [3 x [3 x double]]
store [3 x double]* %0, [3 x double]** %10
store double* %1, double** %11
store double* %2, double** %12
store double* %3, double** %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
%22 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %19, i64 0, i64 0
%23 = bitcast [3 x double]* %22 to double**
%24 = load double*, double** %11
%25 = load double*, double** %12
%26 = load double*, double** %13
%27 = load double*, double** %14
%28 = call i32 @homography_from_four_points(double** %23, double* %24, double* %25, double* %26, double* %27)
%29 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %20, i64 0, i64 0
%30 = bitcast [3 x double]* %29 to double**
%31 = load double*, double** %15
%32 = load double*, double** %16
%33 = load double*, double** %17
%34 = load double*, double** %18
%35 = call i32 @homography_from_four_points(double** %30, double* %31, double* %32, double* %33, double* %34)
%36 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %21, i64 0, i64 0
%37 = bitcast [3 x double]* %36 to double**
%38 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %19, i64 0, i64 0
%39 = bitcast [3 x double]* %38 to double**
%40 = call i32 @invert_homography(double** %37, double** %39)
%41 = load [3 x double]*, [3 x double]** %10
%42 = bitcast [3 x double]* %41 to double**
%43 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %20, i64 0, i64 0
%44 = bitcast [3 x double]* %43 to double**
%45 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %21, i64 0, i64 0
%46 = bitcast [3 x double]* %45 to double**
%47 = call i32 @compose_homographies(double** %42, double** %44, double** %46)
ret void
}

LLVM IR (-O2):
define void @homography_from_eight_points([3 x double]* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca [3 x [3 x double]]
%11 = alloca [3 x [3 x double]]
%12 = alloca [3 x [3 x double]]
%13 = bitcast [3 x [3 x double]]* %10 to i8*
%14 = bitcast [3 x [3 x double]]* %11 to i8*
%15 = bitcast [3 x [3 x double]]* %12 to i8*
%16 = bitcast [3 x [3 x double]]* %10 to double**
%17 = call i32 @homography_from_four_points(double** %16, double* %1, double* %2, double* %3, double* %4)
%18 = bitcast [3 x [3 x double]]* %11 to double**
%19 = call i32 @homography_from_four_points(double** %18, double* %5, double* %6, double* %7, double* %8)
%20 = bitcast [3 x [3 x double]]* %12 to double**
%21 = call i32 @invert_homography(double** %20, double** %16)
%22 = bitcast [3 x double]* %0 to double**
%23 = call i32 @compose_homographies(double** %22, double** %18, double** %20)
ret void
}