#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*/ latlon2xyz(int, double const *, double const *, double *,
                              double *, double *);
int /*<<< orphan*/ mid_pt3_cart(double *, double *, double *);
int /*<<< orphan*/ xyz2latlon(int, double *, double *, double *, double *,
                              double *);
void mid_pt_sphere(const double *p1, const double *p2, double *pm) {
  double e1[3], e2[3], e3[3];
  latlon2xyz(1, p1, p1 + 1, e1, e1 + 1, e1 + 2);
  latlon2xyz(1, p2, p2 + 1, e2, e2 + 1, e2 + 2);
  mid_pt3_cart(e1, e2, e3);
  xyz2latlon(1, e3, e3 + 1, e3 + 2, pm, pm + 1);
}


x86 assembly (clang, -O0):
<mid_pt_sphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
add    $0x8,%rdx
lea    -0x30(%rbp),%rcx
lea    -0x30(%rbp),%r8
add    $0x8,%r8
lea    -0x30(%rbp),%r9
add    $0x10,%r9
mov    $0x1,%edi
call   1050 <latlon2xyz@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
lea    -0x50(%rbp),%rcx
lea    -0x50(%rbp),%r8
add    $0x8,%r8
lea    -0x50(%rbp),%r9
add    $0x10,%r9
mov    $0x1,%edi
call   1050 <latlon2xyz@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1030 <mid_pt3_cart@plt>
lea    -0x70(%rbp),%rsi
lea    -0x70(%rbp),%rdx
add    $0x8,%rdx
lea    -0x70(%rbp),%rcx
add    $0x10,%rcx
mov    -0x18(%rbp),%r8
mov    -0x18(%rbp),%r9
add    $0x8,%r9
mov    $0x1,%edi
call   1040 <xyz2latlon@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mid_pt_sphere>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x8(%rdi),%rdx
lea    0x48(%rsp),%r8
lea    0x50(%rsp),%r9
lea    0x40(%rsp),%r15
mov    $0x1,%edi
mov    %r15,%rcx
call   1050 <latlon2xyz@plt>
lea    0x8(%rbx),%rdx
lea    0x28(%rsp),%r8
lea    0x30(%rsp),%r9
lea    0x20(%rsp),%r12
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rcx
call   1050 <latlon2xyz@plt>
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1030 <mid_pt3_cart@plt>
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%r14),%r9
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %r14,%r8
call   1040 <xyz2latlon@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @mid_pt_sphere(double* %0, double* %1, double* %2) {
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %4 to i8*
%8 = bitcast [3 x double]* %5 to i8*
%9 = bitcast [3 x double]* %6 to i8*
%10 = getelementptr inbounds double, double* %0, i64 1
%11 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%12 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%13 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%14 = call i32 @latlon2xyz(i32 1, double* %0, double* %10, double* %11, double* %12, double* %13)
%15 = getelementptr inbounds double, double* %1, i64 1
%16 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%17 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%18 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%19 = call i32 @latlon2xyz(i32 1, double* %1, double* %15, double* %16, double* %17, double* %18)
%20 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%21 = call i32 @mid_pt3_cart(double* %11, double* %16, double* %20)
%22 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%23 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%24 = getelementptr inbounds double, double* %2, i64 1
%25 = call i32 @xyz2latlon(i32 1, double* %20, double* %22, double* %23, double* %2, double* %24)
ret void
}