#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ endpar();
int /*<<< orphan*/ geoutm_(double *, double *, double *, double *, int *,
                           int *);
int /*<<< orphan*/ getpar(char *, char *, int *);
int /*<<< orphan*/ latlon2km(float *, float *, float *, float *, float *);
int /*<<< orphan*/ mstpar(char *, char *, float *);
int /*<<< orphan*/ printf(char *, float, float);
int scanf(char *, float *, float *);
int /*<<< orphan*/ set_g2(float *, float *);
int /*<<< orphan*/ setpar(int, char **);
main(int ac, char **av) {
  FILE *fpw, *fpr, *fopfile();
  float rlon, rlat, east, nort, ref_lon, ref_lat;
  float latavg, kmlon, kmlat;
  float rperd = 0.017453292;
  float erad = 6378.139;
  float fc = 298.256;
  float g2, radc;
  double geocen();
  double xr0, yr0, dlon, dlat, dxr, dyr;
  int geo2utm = 0;
  int utm2geo = 1;
  int utm_zone = 11;
  int utm = 0;
  setpar(ac, av);
  getpar("utm", "d", &utm);
  mstpar("ref_lon", "f", &ref_lon);
  mstpar("ref_lat", "f", &ref_lat);
  endpar();
  if (utm == 1) {
    dlon = ref_lon;
    dlat = ref_lat;
    geoutm_(&dlon, &dlat, &xr0, &yr0, &utm_zone, &geo2utm);
  } else {
    radc = 6378.139 * 0.017453292;
    set_g2(&g2, &fc);
    latavg = geocen(ref_lat * rperd);
    latlon2km(&latavg, &kmlat, &kmlon, &radc, &g2);
  }
  while (scanf("%f %f", &nort, &east) == 2) {
    if (utm == 1) {
      dxr = xr0 + 1000.0 * east;
      dyr = yr0 + 1000.0 * nort;
      geoutm_(&dlon, &dlat, &dxr, &dyr, &utm_zone, &utm2geo);
      rlon = dlon;
      rlat = dlat;
    } else {
      rlon = ref_lon + east / kmlon;
      rlat = ref_lat + nort / kmlat;
    }
    printf("%.5f %.5f\n", rlon, rlat);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xe47(%rip),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xe36(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  0xe25(%rip),%xmm0
movss  %xmm0,-0x50(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x1,-0x90(%rbp)
movl   $0xb,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <setpar@plt>
lea    0xdfd(%rip),%rdi
lea    0xdfa(%rip),%rsi
lea    -0x98(%rbp),%rdx
call   1080 <getpar@plt>
lea    0xde9(%rip),%rdi
lea    0xdf6(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1040 <mstpar@plt>
lea    0xdda(%rip),%rdi
lea    0xddf(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1040 <mstpar@plt>
mov    $0x0,%al
call   10b0 <endpar@plt>
cmpl   $0x1,-0x98(%rbp)
jne    12b4 <main+0x114>
movss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x78(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x68(%rbp),%rcx
lea    -0x94(%rbp),%r8
lea    -0x8c(%rbp),%r9
call   10a0 <geoutm_@plt>
jmp    1305 <main+0x165>
movss  0xd50(%rip),%xmm0
movss  %xmm0,-0x58(%rbp)
lea    -0x54(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1070 <set_g2@plt>
movss  -0x38(%rbp),%xmm0
mulss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <geocen@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
lea    -0x3c(%rbp),%rdi
lea    -0x44(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x58(%rbp),%rcx
lea    -0x54(%rbp),%r8
call   10c0 <latlon2km@plt>
jmp    130a <main+0x16a>
lea    0xd1d(%rip),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   1090 <scanf@plt>
cmp    $0x2,%eax
jne    140f <main+0x26f>
cmpl   $0x1,-0x98(%rbp)
jne    13c4 <main+0x224>
movsd  -0x60(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcc6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm1
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xca3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
lea    -0x70(%rbp),%rdi
lea    -0x78(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0x88(%rbp),%rcx
lea    -0x94(%rbp),%r8
lea    -0x90(%rbp),%r9
call   10a0 <geoutm_@plt>
movsd  -0x70(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movsd  -0x78(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13f4 <main+0x254>
movss  -0x34(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm1
divss  -0x40(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x38(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
divss  -0x44(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
lea    0xc2f(%rip),%rdi
call   1050 <printf@plt>
jmp    130a <main+0x16a>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movl   $0x439520c5,0x40(%rsp)
43
movl   $0x0,0x38(%rsp)
movl   $0x1,0x34(%rsp)
movl   $0xb,0x18(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <setpar@plt>
lea    0xe2e(%rip),%rdi
lea    0xe2b(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1080 <getpar@plt>
lea    0xe1c(%rip),%rdi
lea    0xe29(%rip),%rbx
lea    0x1c(%rsp),%rdx
mov    %rbx,%rsi
call   1040 <mstpar@plt>
lea    0xe09(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    %rbx,%rsi
call   1040 <mstpar@plt>
xor    %eax,%eax
call   10b0 <endpar@plt>
cmpl   $0x1,0x8(%rsp)
jne    1275 <main+0xd5>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x68(%rsp),%rdx
lea    0x60(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x38(%rsp),%r9
call   10a0 <geoutm_@plt>
jmp    12ce <main+0x12e>
movl   $0x42dea398,0x3c(%rsp)
42
lea    0x74(%rsp),%rbx
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <set_g2@plt>
movss  0xc(%rsp),%xmm0
mulss  0xd63(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1060 <geocen@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4c(%rsp)
lea    0x4c(%rsp),%rdi
lea    0x44(%rsp),%rsi
lea    0x48(%rsp),%rdx
lea    0x3c(%rsp),%rcx
mov    %rbx,%r8
call   10c0 <latlon2km@plt>
lea    0xd51(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
call   1090 <scanf@plt>
cmp    $0x2,%eax
jne    13ec <main+0x24c>
lea    0x18(%rsp),%rbx
lea    0x34(%rsp),%rbp
lea    0xd2e(%rip),%r14
lea    0xd21(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x14(%rsp),%r13
jmp    1375 <main+0x1d5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm2
unpcklps %xmm0,%xmm2
movss  0x48(%rsp),%xmm0
movss  0x44(%rsp),%xmm1
unpcklps %xmm0,%xmm1
divps  %xmm1,%xmm2
movss  0x1c(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
unpcklps %xmm0,%xmm1
addps  %xmm2,%xmm1
movaps %xmm1,%xmm0
shufps $0x55,%xmm1,%xmm0
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1090 <scanf@plt>
cmp    $0x2,%eax
jne    13ec <main+0x24c>
cmpl   $0x1,0x8(%rsp)
jne    1320 <main+0x180>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc7a(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp)
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
addsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x58(%rsp),%rdx
lea    0x50(%rsp),%rcx
mov    %rbx,%r8
mov    %rbp,%r9
call   10a0 <geoutm_@plt>
movsd  0x20(%rsp),%xmm0
movhpd 0x28(%rsp),%xmm0
cvtpd2ps %xmm0,%xmm1
jmp    1353 <main+0x1b3>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"utm\00"
@.str.1 = [2 x i8] c"d\00"
@.str.2 = [8 x i8] c"ref_lon\00"
@.str.3 = [2 x i8] c"f\00"
@.str.4 = [8 x i8] c"ref_lat\00"
@.str.5 = [6 x i8] c"%f %f\00"
@.str.6 = [11 x i8] c"%.5f %.5f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0x3F91DF46A0000000, float* %17
store float 0x40B8EA23A0000000, float* %18
store float 0x4072A418A0000000, float* %19
store i32 0, i32* %28
store i32 1, i32* %29
store i32 11, i32* %30
store i32 0, i32* %31
%32 = load i32, i32* %4
%33 = load i8**, i8*** %5
%34 = call i32 @setpar(i32 %32, i8** %33)
%35 = call i32 @getpar(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%36 = call i32 @mstpar(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), float* %12)
%37 = call i32 @mstpar(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), float* %13)
%38 = call i32 (...) @endpar()
%39 = load i32, i32* %31
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %47
41: ; preds = %2
%42 = load float, float* %12
%43 = fpext float %42 to double
store double %43, double* %24
%44 = load float, float* %13
%45 = fpext float %44 to double
store double %45, double* %25
%46 = call i32 @geoutm_(double* %24, double* %25, double* %22, double* %23, i32* %30, i32* %28)
br label %56
47: ; preds = %2
store float 0x405BD47300000000, float* %21
%48 = call i32 @set_g2(float* %20, float* %19)
%49 = load float, float* %13
%50 = load float, float* %17
%51 = fmul float %49, %50
%52 = fpext float %51 to double
%53 = call double (double, ...) bitcast (double (...)* @geocen to double (double, ...)*)(double %52)
%54 = fptrunc double %53 to float
store float %54, float* %14
%55 = call i32 @latlon2km(float* %14, float* %16, float* %15, float* %21, float* %20)
br label %56
56: ; preds = %47, %41
br label %57
57: ; preds = %88, %56
%58 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), float* %11, float* %10)
%59 = icmp eq i32 %58, 2
br i1 %59, label %60, label %92
60: ; preds = %57
%61 = load i32, i32* %31
%62 = icmp eq i32 %61, 1
br i1 %62, label %63, label %77
63: ; preds = %60
%64 = load double, double* %22
%65 = load float, float* %10
%66 = fpext float %65 to double
%67 = call double @llvm.fmuladd.f64(double 1.000000e+03, double %66, double %64)
store double %67, double* %26
%68 = load double, double* %23
%69 = load float, float* %11
%70 = fpext float %69 to double
%71 = call double @llvm.fmuladd.f64(double 1.000000e+03, double %70, double %68)
store double %71, double* %27
%72 = call i32 @geoutm_(double* %24, double* %25, double* %26, double* %27, i32* %30, i32* %29)
%73 = load double, double* %24
%74 = fptrunc double %73 to float
store float %74, float* %8
%75 = load double, double* %25
%76 = fptrunc double %75 to float
store float %76, float* %9
br label %88
77: ; preds = %60
%78 = load float, float* %12
%79 = load float, float* %10
%80 = load float, float* %15
%81 = fdiv float %79, %80
%82 = fadd float %78, %81
store float %82, float* %8
%83 = load float, float* %13
%84 = load float, float* %11
%85 = load float, float* %16
%86 = fdiv float %84, %85
%87 = fadd float %83, %86
store float %87, float* %9
br label %88
88: ; preds = %77, %63
%89 = load float, float* %8
%90 = load float, float* %9
%91 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), float %89, float %90)
br label %57
92: ; preds = %57
%93 = load i32, i32* %3
ret i32 %93
}

LLVM IR (-O2):
@.str = [4 x i8] c"utm\00"
@.str.1 = [2 x i8] c"d\00"
@.str.2 = [8 x i8] c"ref_lon\00"
@.str.3 = [2 x i8] c"f\00"
@.str.4 = [8 x i8] c"ref_lat\00"
@.str.5 = [6 x i8] c"%f %f\00"
@.str.6 = [11 x i8] c"%.5f %.5f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = bitcast float* %3 to i8*
%24 = bitcast float* %4 to i8*
%25 = bitcast float* %5 to i8*
%26 = bitcast float* %6 to i8*
%27 = bitcast float* %7 to i8*
%28 = bitcast float* %8 to i8*
%29 = bitcast float* %9 to i8*
%30 = bitcast float* %10 to i8*
store float 0x4072A418A0000000, float* %10
%31 = bitcast float* %11 to i8*
%32 = bitcast float* %12 to i8*
%33 = bitcast double* %13 to i8*
%34 = bitcast double* %14 to i8*
%35 = bitcast double* %15 to i8*
%36 = bitcast double* %16 to i8*
%37 = bitcast double* %17 to i8*
%38 = bitcast double* %18 to i8*
%39 = bitcast i32* %19 to i8*
store i32 0, i32* %19
%40 = bitcast i32* %20 to i8*
store i32 1, i32* %20
%41 = bitcast i32* %21 to i8*
store i32 11, i32* %21
%42 = bitcast i32* %22 to i8*
store i32 0, i32* %22
%43 = tail call i32 @setpar(i32 %0, i8** %1)
%44 = call i32 @getpar(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%45 = call i32 @mstpar(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), float* %5)
%46 = call i32 @mstpar(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), float* %6)
%47 = call i32 (...) @endpar()
%48 = load i32, i32* %22
%49 = icmp eq i32 %48, 1
br i1 %49, label %50, label %56
50: ; preds = %2
%51 = load float, float* %5
%52 = fpext float %51 to double
store double %52, double* %15
%53 = load float, float* %6
%54 = fpext float %53 to double
store double %54, double* %16
%55 = call i32 @geoutm_(double* %15, double* %16, double* %13, double* %14, i32* %21, i32* %19)
br label %64
56: ; preds = %2
store float 0x405BD47300000000, float* %12
%57 = call i32 @set_g2(float* %11, float* %10)
%58 = load float, float* %6
%59 = fmul float %58, 0x3F91DF46A0000000
%60 = fpext float %59 to double
%61 = call double (double, ...) bitcast (double (...)* @geocen to double (double, ...)*)(double %60)
%62 = fptrunc double %61 to float
store float %62, float* %7
%63 = call i32 @latlon2km(float* %7, float* %9, float* %8, float* %12, float* %11)
br label %64
64: ; preds = %56, %50
%65 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), float* %4, float* %3)
%66 = icmp eq i32 %65, 2
br i1 %66, label %67, label %107
67: ; preds = %64, %100
%68 = load i32, i32* %22
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %85
70: ; preds = %67
%71 = load double, double* %13
%72 = load float, float* %3
%73 = fpext float %72 to double
%74 = call double @llvm.fmuladd.f64(double %73, double 1.000000e+03, double %71)
store double %74, double* %17
%75 = load double, double* %14
%76 = load float, float* %4
%77 = fpext float %76 to double
%78 = call double @llvm.fmuladd.f64(double %77, double 1.000000e+03, double %75)
store double %78, double* %18
%79 = call i32 @geoutm_(double* %15, double* %16, double* %17, double* %18, i32* %21, i32* %20)
%80 = load double, double* %15
%81 = load double, double* %16
%82 = insertelement <2 x double> poison, double %81, i64 0
%83 = insertelement <2 x double> %82, double %80, i64 1
%84 = fptrunc <2 x double> %83 to <2 x float>
br label %100
85: ; preds = %67
%86 = load float, float* %5
%87 = load float, float* %3
%88 = load float, float* %8
%89 = load float, float* %6
%90 = load float, float* %4
%91 = load float, float* %9
%92 = insertelement <2 x float> poison, float %90, i64 0
%93 = insertelement <2 x float> %92, float %87, i64 1
%94 = insertelement <2 x float> poison, float %91, i64 0
%95 = insertelement <2 x float> %94, float %88, i64 1
%96 = fdiv <2 x float> %93, %95
%97 = insertelement <2 x float> poison, float %89, i64 0
%98 = insertelement <2 x float> %97, float %86, i64 1
%99 = fadd <2 x float> %98, %96
br label %100
100: ; preds = %85, %70
%101 = phi <2 x float> [ %84, %70 ], [ %99, %85 ]
%102 = extractelement <2 x float> %101, i64 0
%103 = extractelement <2 x float> %101, i64 1
%104 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), float %103, float %102)
%105 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), float* %4, float* %3)
%106 = icmp eq i32 %105, 2
br i1 %106, label %67, label %107
107: ; preds = %100, %64
ret i32 0
}