#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 */
struct rpc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ eval_rpc(double *, struct rpc *, double, double, double);
double rpc_height(struct rpc *, struct rpc *, double, double, double, double,
                  double *);
void intersect_rays(double out[3], double p[2], double q[2], struct rpc *r1,
                    struct rpc *r2) {
  double err;
  out[2] = rpc_height(r1, r2, p[0], p[1], q[0], q[1], &err);
  eval_rpc(out, r1, p[0], p[1], out[2]);
}


x86 assembly (clang, -O0):
<intersect_rays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm3
lea    -0x30(%rbp),%rdx
call   1030 <rpc_height@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
call   1040 <eval_rpc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intersect_rays>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
movsd  (%rdx),%xmm2
movsd  0x8(%rdx),%xmm3
lea    0x8(%rsp),%rdx
mov    %rcx,%rdi
mov    %r8,%rsi
call   1030 <rpc_height@plt>
movaps %xmm0,%xmm2
movsd  %xmm0,0x10(%r15)
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <eval_rpc@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.rpc = type { i32 }
define void @intersect_rays(double* %0, double* %1, double* %2, %struct.rpc* %3, %struct.rpc* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca %struct.rpc*
%10 = alloca %struct.rpc*
%11 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store %struct.rpc* %3, %struct.rpc** %9
store %struct.rpc* %4, %struct.rpc** %10
%12 = load %struct.rpc*, %struct.rpc** %9
%13 = load %struct.rpc*, %struct.rpc** %10
%14 = load double*, double** %7
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
%17 = load double*, double** %7
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = load double*, double** %8
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = load double*, double** %8
%24 = getelementptr inbounds double, double* %23, i64 1
%25 = load double, double* %24
%26 = call double @rpc_height(%struct.rpc* %12, %struct.rpc* %13, double %16, double %19, double %22, double %25, double* %11)
%27 = load double*, double** %6
%28 = getelementptr inbounds double, double* %27, i64 2
store double %26, double* %28
%29 = load double*, double** %6
%30 = load %struct.rpc*, %struct.rpc** %9
%31 = load double*, double** %7
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
%34 = load double*, double** %7
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 2
%39 = load double, double* %38
%40 = call i32 @eval_rpc(double* %29, %struct.rpc* %30, double %33, double %36, double %39)
ret void
}

LLVM IR (-O2):
%struct.rpc = type { i32 }
define void @intersect_rays(double* %0, double* nocapture %1, double* nocapture %2, %struct.rpc* %3, %struct.rpc* %4) {
%6 = alloca double
%7 = bitcast double* %6 to i8*
%8 = load double, double* %1
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = load double, double* %2
%12 = getelementptr inbounds double, double* %2, i64 1
%13 = load double, double* %12
%14 = call double @rpc_height(%struct.rpc* %3, %struct.rpc* %4, double %8, double %10, double %11, double %13, double* %6)
%15 = getelementptr inbounds double, double* %0, i64 2
store double %14, double* %15
%16 = load double, double* %1
%17 = load double, double* %9
%18 = call i32 @eval_rpc(double* %0, %struct.rpc* %3, double %16, double %17, double %14)
ret void
}