#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*/ recgeo_c(double *, double, double, double *, double *,
                            double *);
void rect_2_geod(double r[], double geo[]) {
  int i;
  double mid[3];
  recgeo_c(r, 6378137.0, 0.003352819, &mid[2], &mid[1], &mid[0]);
  mid[0] = mid[0] / 1000.;
  mid[1] = mid[1] * (360. / (2. * 3.14159265359));
  mid[2] = mid[2] * (360. / (2. * 3.14159265359));
  for (i = 0; i < 3; i++) {
    geo[i] = mid[i];
  }
}


x86 assembly (clang, -O0):
<rect_2_geod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
add    $0x10,%rsi
lea    -0x30(%rbp),%rdx
add    $0x8,%rdx
lea    -0x30(%rbp),%rcx
movsd  0xed0(%rip),%xmm0
movsd  0xed0(%rip),%xmm1
call   1030 <recgeo_c@plt>
movsd  -0x30(%rbp),%xmm0
movsd  0xeae(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe95(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe83(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11bd <rect_2_geod+0xad>
movslq -0x14(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118e <rect_2_geod+0x7e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rect_2_geod>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
movsd  0xed6(%rip),%xmm0
movsd  0xed6(%rip),%xmm1
mov    %rsp,%rcx
call   1030 <recgeo_c@plt>
movsd  (%rsp),%xmm0
divsd  0xec9(%rip),%xmm0
movsd  %xmm0,(%rsp)
movupd 0x8(%rsp),%xmm0
mulpd  0xec6(%rip),%xmm0
movupd %xmm0,0x8(%rsp)
movaps (%rsp),%xmm0
movups %xmm0,(%rbx)
mov    0x10(%rsp),%rax
mov    %rax,0x10(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @rect_2_geod(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca [3 x double]
store double* %0, double** %3
store double* %1, double** %4
%7 = load double*, double** %3
%8 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%9 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%10 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%11 = call i32 @recgeo_c(double* %7, double 0x415854A640000000, double 0x3F6B775EFE8A8170, double* %8, double* %9, double* %10)
%12 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%13 = load double, double* %12
%14 = fdiv double %13, 1.000000e+03
%15 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
store double %14, double* %15
%16 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%17 = load double, double* %16
%18 = fmul double %17, 0x404CA5DC1A63BFE5
%19 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
store double %18, double* %19
%20 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%21 = load double, double* %20
%22 = fmul double %21, 0x404CA5DC1A63BFE5
%23 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %22, double* %23
store i32 0, i32* %5
br label %24
24: ; preds = %36, %2
%25 = load i32, i32* %5
%26 = icmp slt i32 %25, 3
br i1 %26, label %27, label %39
27: ; preds = %24
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 %29
%31 = load double, double* %30
%32 = load double*, double** %4
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
store double %31, double* %35
br label %36
36: ; preds = %27
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %24
39: ; preds = %24
ret void
}

LLVM IR (-O2):
define void @rect_2_geod(double* %0, double* nocapture writeonly %1) {
%3 = bitcast double* %1 to i8*
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%7 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%8 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%9 = call i32 @recgeo_c(double* %0, double 0x415854A640000000, double 0x3F6B775EFE8A8170, double* %6, double* %7, double* %8)
%10 = load double, double* %8
%11 = fdiv double %10, 1.000000e+03
store double %11, double* %8
%12 = bitcast double* %7 to <2 x double>*
%13 = load <2 x double>, <2 x double>* %12
%14 = fmul <2 x double> %13, <double 0x404CA5DC1A63BFE5, double 0x404CA5DC1A63BFE5>
%15 = bitcast double* %7 to <2 x double>*
store <2 x double> %14, <2 x double>* %15
ret void
}