#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, double *);
int /*<<< orphan*/ sphdpa(int, double, double, double *, double *, double *,
                          double *);
int /*<<< orphan*/ sphpad(int, double, double, double *, double *, double *,
                          double *);
int main() {
  double dist, lat, lat0, lng, lng0, pa;
  printf("\nEnter reference (lng,lat): ");
  scanf("%lf%*[ ,	]%lf", &lng0, &lat0);
  while (1) {
    printf("\nEnter   field   (lng,lat): ");
    scanf("%lf%*[ ,	]%lf", &lng, &lat);
    sphdpa(1, lng0, lat0, &lng, &lat, &dist, &pa);
    printf("(%.4f,%.4f) - (%.4f,%.4f) -> (%.4f,%.4f) (dist,pa)\n", lng0, lat0,
           lng, lat, dist, pa);
    sphpad(1, lng0, lat0, &dist, &pa, &lng, &lat);
    printf("(%.4f,%.4f) + (%.4f,%.4f) -> (%.4f,%.4f) (lng,lat)\n", lng0, lat0,
           dist, pa, lng, lat);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    $0x1,%edi
lea    -0x28(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x38(%rbp),%r8
call   1060 <sphdpa@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
lea    0xe6c(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    $0x1,%edi
lea    -0x10(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <sphpad@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
lea    0xe50(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
jmp    1171 <main+0x31>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <scanf@plt>
lea    0x20(%rsp),%r12
lea    0x28(%rsp),%rbx
lea    0x30(%rsp),%r13
lea    0x18(%rsp),%rbp
lea    0xebb(%rip),%r14
lea    0xee8(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe68(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x1,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
call   1060 <sphdpa@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
movsd  0x30(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
mov    %r14,%rdi
mov    $0x6,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x1,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
call   1040 <sphpad@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x28(%rsp),%xmm5
mov    %r15,%rdi
mov    $0x6,%al
call   1030 <printf@plt>
jmp    11a0 <main+0x60>

LLVM IR (-O0):
@.str = [29 x i8] c"\0AEnter reference (lng,lat): \00"
@.str.1 = [14 x i8] c"%lf%*[ ,\09]%lf\00"
@.str.2 = [29 x i8] c"\0AEnter field (lng,lat): \00"
@.str.3 = [52 x i8] c"(%.4f,%.4f) - (%.4f,%.4f) -> (%.4f,%.4f) (dist,pa)\0A\00"
@.str.4 = [52 x i8] c"(%.4f,%.4f) + (%.4f,%.4f) -> (%.4f,%.4f) (lng,lat)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double* %6, double* %4)
br label %10
10: ; preds = %0, %10
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %3)
%13 = load double, double* %6
%14 = load double, double* %4
%15 = call i32 @sphdpa(i32 1, double %13, double %14, double* %5, double* %3, double* %2, double* %7)
%16 = load double, double* %6
%17 = load double, double* %4
%18 = load double, double* %5
%19 = load double, double* %3
%20 = load double, double* %2
%21 = load double, double* %7
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), double %16, double %17, double %18, double %19, double %20, double %21)
%23 = load double, double* %6
%24 = load double, double* %4
%25 = call i32 @sphpad(i32 1, double %23, double %24, double* %2, double* %7, double* %5, double* %3)
%26 = load double, double* %6
%27 = load double, double* %4
%28 = load double, double* %2
%29 = load double, double* %7
%30 = load double, double* %5
%31 = load double, double* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), double %26, double %27, double %28, double %29, double %30, double %31)
br label %10
}

LLVM IR (-O2):
@.str = [29 x i8] c"\0AEnter reference (lng,lat): \00"
@.str.1 = [14 x i8] c"%lf%*[ ,\09]%lf\00"
@.str.2 = [29 x i8] c"\0AEnter field (lng,lat): \00"
@.str.3 = [52 x i8] c"(%.4f,%.4f) - (%.4f,%.4f) -> (%.4f,%.4f) (dist,pa)\0A\00"
@.str.4 = [52 x i8] c"(%.4f,%.4f) + (%.4f,%.4f) -> (%.4f,%.4f) (lng,lat)\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %1 to i8*
%8 = bitcast double* %2 to i8*
%9 = bitcast double* %3 to i8*
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %3)
br label %15
15: ; preds = %15, %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double* %4, double* %2)
%18 = load double, double* %5
%19 = load double, double* %3
%20 = call i32 @sphdpa(i32 1, double %18, double %19, double* %4, double* %2, double* %1, double* %6)
%21 = load double, double* %5
%22 = load double, double* %3
%23 = load double, double* %4
%24 = load double, double* %2
%25 = load double, double* %1
%26 = load double, double* %6
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), double %21, double %22, double %23, double %24, double %25, double %26)
%28 = load double, double* %5
%29 = load double, double* %3
%30 = call i32 @sphpad(i32 1, double %28, double %29, double* %1, double* %6, double* %4, double* %2)
%31 = load double, double* %5
%32 = load double, double* %3
%33 = load double, double* %1
%34 = load double, double* %6
%35 = load double, double* %4
%36 = load double, double* %2
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), double %31, double %32, double %33, double %34, double %35, double %36)
br label %15
}