#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 */
double M_PI;
double atan2(int /*<<< orphan*/, int /*<<< orphan*/);
double cos(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ printf(char *, double);
double sin(double);
int /*<<< orphan*/ sqrt(double);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strrchr(char *, char);
double strtold(char *, char **);
int main(int argc, char *argv[]) {
  int xc = 1;
  const char *program = (const char *)0;
  int debug = 0;
  double lat1 = 0.0;
  double lon1 = 0.0;
  double lat2 = 0.0;
  double lon2 = 0.0;
  double theta1 = 0.0;
  double theta2 = 0.0;
  double deltatheta = 0.0;
  double deltalambda = 0.0;
  double a = 0.0;
  double b = 0.0;
  double c = 0.0;
  double d = 0.0;
  static const double R = 6378100;
  char *end = (char *)0;
  char *arg = "";
  do {
    program = ((program = strrchr(argv[0], '/')) == (char *)0) ? argv[0]
                                                               : program + 1;
    argv++;
    argc--;
    if ((argc > 0) && (strcmp(*argv, "-?") == 0)) {
      fprintf(stderr, "usage: %s [ -? ] [ -d ] LATDD1 LONDD1 LATDD2 LONDD2\n",
              program);
      argv++;
      argc--;
    }
    if ((argc > 0) && (strcmp(*argv, "-d") == 0)) {
      debug = !0;
      argv++;
      argc--;
    }
    if (argc < 4) {
      break;
    }
    if ((argc--) <= 0) {
      break;
    }
    arg = *(argv++);
    lat1 = strtold(arg, &end);
    if (end == (char *)0) {
      break;
    }
    if ((*end != '\0') && (*end != ',')) {
      break;
    }
    if (!((-90.0 <= lat1) && (lat1 <= 90.0))) {
      break;
    }
    if ((argc--) <= 0) {
      break;
    }
    arg = *(argv++);
    lon1 = strtold(arg, &end);
    if (end == (char *)0) {
      break;
    }
    if (*end != '\0') {
      break;
    }
    if (!((-180.0 <= lon1) && (lon1 <= 180.0))) {
      break;
    }
    if ((argc--) <= 0) {
      break;
    }
    arg = *(argv++);
    lat2 = strtold(arg, &end);
    if (end == (char *)0) {
      break;
    }
    if ((*end != '\0') && (*end != ',')) {
      break;
    }
    if (!((-90.0 <= lat2) && (lat2 <= 90.0))) {
      break;
    }
    if ((argc--) <= 0) {
      break;
    }
    arg = *(argv++);
    lon2 = strtold(arg, &end);
    if (end == (char *)0) {
      break;
    }
    if (*end != '\0') {
      break;
    }
    if (!((-180.0 <= lon2) && (lon2 <= 180.0))) {
      break;
    }
    if (debug) {
      fprintf(stderr, "%s: ( %.10f , %.10f ) ( %.10f , %.10f )\n", program,
              lat1, lon1, lat2, lon2);
    }
    theta1 = (lat1 * M_PI) / 180.0;
    theta2 = (lat2 * M_PI) / 180.0;
    deltatheta = ((lat2 - lat1) * M_PI) / 180.0;
    deltalambda = ((lon2 - lon1) * M_PI) / 180.0;
    b = sin(deltalambda / 2.0);
    b *= b;
    a = sin(deltatheta / 2.0);
    a *= a;
    a += cos(theta1) * cos(theta2) * b;
    c = 2.0 * atan2(sqrt(a), sqrt(1.0 - a));
    d = R * c;
    printf("%.10f\n", d);
    xc = 0;
  } while (0);
  return xc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movq   $0x0,-0x90(%rbp)
lea    0xe6f(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    126d <main+0xdd>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xa0(%rbp)
jmp    127c <main+0xec>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    12f3 <main+0x163>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd8c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12f3 <main+0x163>
mov    0x2d0e(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1336 <main+0x1a6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd6d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1336 <main+0x1a6>
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1345 <main+0x1b5>
jmp    17cb <main+0x63b>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jg     135e <main+0x1ce>
jmp    17cb <main+0x63b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1090 <strtold@plt>
movsd  %xmm0,-0x30(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    13a2 <main+0x212>
jmp    17cb <main+0x63b>
mov    -0x90(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13cd <main+0x23d>
mov    -0x90(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     13cd <main+0x23d>
jmp    17cb <main+0x63b>
movsd  -0x30(%rbp),%xmm0
movsd  0xc26(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     13f7 <main+0x267>
movsd  0xc1c(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
jae    13fc <main+0x26c>
jmp    17cb <main+0x63b>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jg     1415 <main+0x285>
jmp    17cb <main+0x63b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1090 <strtold@plt>
movsd  %xmm0,-0x38(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    1459 <main+0x2c9>
jmp    17cb <main+0x63b>
mov    -0x90(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1471 <main+0x2e1>
jmp    17cb <main+0x63b>
movsd  -0x38(%rbp),%xmm0
movsd  0xb92(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     149b <main+0x30b>
movsd  0xb88(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jae    14a0 <main+0x310>
jmp    17cb <main+0x63b>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jg     14b9 <main+0x329>
jmp    17cb <main+0x63b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1090 <strtold@plt>
movsd  %xmm0,-0x40(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    14fd <main+0x36d>
jmp    17cb <main+0x63b>
mov    -0x90(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1528 <main+0x398>
mov    -0x90(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     1528 <main+0x398>
jmp    17cb <main+0x63b>
movsd  -0x40(%rbp),%xmm0
movsd  0xacb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1552 <main+0x3c2>
movsd  0xac1(%rip),%xmm0
ucomisd -0x40(%rbp),%xmm0
jae    1557 <main+0x3c7>
jmp    17cb <main+0x63b>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jg     1570 <main+0x3e0>
jmp    17cb <main+0x63b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1090 <strtold@plt>
movsd  %xmm0,-0x48(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    15b4 <main+0x424>
jmp    17cb <main+0x63b>
mov    -0x90(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     15cc <main+0x43c>
jmp    17cb <main+0x63b>
movsd  -0x48(%rbp),%xmm0
movsd  0xa37(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     15f6 <main+0x466>
movsd  0xa2d(%rip),%xmm0
ucomisd -0x48(%rbp),%xmm0
jae    15fb <main+0x46b>
jmp    17cb <main+0x63b>
cmpl   $0x0,-0x24(%rbp)
je     1634 <main+0x4a4>
mov    0x29cc(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
lea    0xa4e(%rip),%rsi
mov    $0x4,%al
call   1070 <fprintf@plt>
movsd  -0x30(%rbp),%xmm0
mov    0x29a8(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0x9cc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    0x2987(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0x9ab(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    0x2961(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0x985(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    0x293b(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0x95f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  0x959(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0x92f(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
call   10a0 <cos@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
call   10b0 <sqrt@plt>
mov    %eax,-0xa4(%rbp)
movsd  0x8c0(%rip),%xmm0
subsd  -0x70(%rbp),%xmm0
call   10b0 <sqrt@plt>
mov    -0xa4(%rbp),%edi
mov    %eax,%esi
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0x896(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0x87d(%rip),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
lea    0x8e5(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
movq   $0x0,0x8(%rsp)
mov    (%rsi),%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
lea    0x1(%rax),%r12
test   %rax,%rax
cmove  %rbx,%r12
mov    $0x1,%r15d
cmp    $0x2,%ebp
jl     129f <main+0x10f>
lea    0x8(%r14),%r13
mov    0x0(%r13),%rdi
lea    0xe53(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11f4 <main+0x64>
add    $0xffffffff,%ebp
jmp    121e <main+0x8e>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0xfffffffe,%ebp
je     129f <main+0x10f>
add    $0x10,%r14
mov    %r14,%r13
mov    0x0(%r13),%rdi
lea    0xe47(%rip),%rsi
call   1060 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
sub    %ebx,%ebp
cmp    $0x4,%ebp
jb     129f <main+0x10f>
mov    %rax,%r14
mov    0x0(%r13,%rbx,8),%rdi
lea    0x8(%rsp),%rsi
call   1090 <strtold@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     129f <main+0x10f>
mov    (%rax),%al
cmp    $0x2c,%al
je     1263 <main+0xd3>
test   %al,%al
jne    129f <main+0x10f>
ucomisd 0xd95(%rip),%xmm0
jb     129f <main+0x10f>
movsd  0xd93(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     129f <main+0x10f>
movsd  %xmm0,0x18(%rsp)
mov    0x8(%r13,%rbx,8),%rdi
lea    0x8(%rsp),%rsi
call   1090 <strtold@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     129f <main+0x10f>
cmpb   $0x0,(%rax)
je     12b1 <main+0x121>
mov    %r15d,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
ucomisd 0xd57(%rip),%xmm0
jb     129f <main+0x10f>
movsd  0xd55(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     129f <main+0x10f>
movsd  %xmm0,0x28(%rsp)
mov    0x10(%r13,%rbx,8),%rdi
lea    0x8(%rsp),%rsi
call   1090 <strtold@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     129f <main+0x10f>
mov    (%rax),%al
cmp    $0x2c,%al
je     12f2 <main+0x162>
test   %al,%al
jne    129f <main+0x10f>
ucomisd 0xd06(%rip),%xmm0
jb     129f <main+0x10f>
movsd  0xd04(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     129f <main+0x10f>
movsd  %xmm0,0x10(%rsp)
mov    0x18(%r13,%rbx,8),%rdi
lea    0x8(%rsp),%rsi
call   1090 <strtold@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     129f <main+0x10f>
cmpb   $0x0,(%rax)
jne    129f <main+0x10f>
movapd %xmm0,%xmm3
ucomisd 0xcce(%rip),%xmm0
jb     129f <main+0x10f>
movsd  0xcc8(%rip),%xmm2
ucomisd %xmm3,%xmm2
jb     129f <main+0x10f>
test   %r14,%r14
jne    13a5 <main+0x215>
mov    0x2c72(%rip),%rax
mov    (%rax),%edi
lea    0xd04(%rip),%rsi
mov    %r12,%rdx
movsd  0x18(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  %xmm3,0x20(%rsp)
movsd  0x20(%rsp),%xmm3
mov    $0x4,%al
call   1070 <fprintf@plt>
movsd  0x20(%rsp),%xmm3
movsd  0xc73(%rip),%xmm2
mov    0x2c3c(%rip),%rax
movsd  (%rax),%xmm0
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm4
mulsd  %xmm0,%xmm4
divsd  %xmm2,%xmm4
movsd  %xmm4,0x30(%rsp)
movsd  0x10(%rsp),%xmm5
movapd %xmm5,%xmm4
mulsd  %xmm0,%xmm4
divsd  %xmm2,%xmm4
movsd  %xmm4,0x20(%rsp)
subsd  %xmm1,%xmm5
mulsd  %xmm0,%xmm5
divsd  %xmm2,%xmm5
movsd  %xmm5,0x10(%rsp)
subsd  0x28(%rsp),%xmm3
mulsd  %xmm0,%xmm3
divsd  %xmm2,%xmm3
mulsd  0xc18(%rip),%xmm3
movapd %xmm3,%xmm0
call   1080 <sin@plt>
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xbf7(%rip),%xmm0
call   1080 <sin@plt>
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x30(%rsp),%xmm0
call   10a0 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
call   10a0 <cos@plt>
mulsd  0x10(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
call   10b0 <sqrt@plt>
mov    %eax,%ebx
movsd  0xbad(%rip),%xmm0
subsd  0x18(%rsp),%xmm0
call   10b0 <sqrt@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <atan2@plt>
addsd  %xmm0,%xmm0
mulsd  0xb95(%rip),%xmm0
lea    0xbfa(%rip),%rdi
call   1040 <printf@plt>
xor    %r15d,%r15d
jmp    129f <main+0x10f>

LLVM IR (-O0):
@main.R = internal constant double 6.378100e+06
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"-?\00"
@stderr = global i32 0
@.str.2 = [53 x i8] c"usage: %s [ -? ] [ -d ] LATDD1 LONDD1 LATDD2 LONDD2\0A\00"
@.str.3 = [3 x i8] c"-d\00"
@.str.4 = [41 x i8] c"%s: ( %.10f , %.10f ) ( %.10f , %.10f )\0A\00"
@M_PI = global double 0.000000e+00
@.str.5 = [7 x i8] c"%.10f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca i8*
%22 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i8* null, i8** %7
store i32 0, i32* %8
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %11
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %14
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %16
store double 0.000000e+00, double* %17
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
store i8* null, i8** %21
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %22
br label %23
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i8* @strrchr(i8* %26, i8 signext 47)
store i8* %27, i8** %7
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %33
29: ; preds = %23
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
br label %36
33: ; preds = %23
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %34, i64 1
br label %36
36: ; preds = %33, %29
%37 = phi i8* [ %32, %29 ], [ %35, %33 ]
store i8* %37, i8** %7
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i32 1
store i8** %39, i8*** %5
%40 = load i32, i32* %4
%41 = add nsw i32 %40, -1
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %57
44: ; preds = %36
%45 = load i8**, i8*** %5
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %57
49: ; preds = %44
%50 = load i32, i32* @stderr
%51 = load i8*, i8** %7
%52 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %51)
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i32 1
store i8** %54, i8*** %5
%55 = load i32, i32* %4
%56 = add nsw i32 %55, -1
store i32 %56, i32* %4
br label %57
57: ; preds = %49, %44, %36
%58 = load i32, i32* %4
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %70
60: ; preds = %57
%61 = load i8**, i8*** %5
%62 = load i8*, i8** %61
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %70
65: ; preds = %60
store i32 1, i32* %8
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i32 1
store i8** %67, i8*** %5
%68 = load i32, i32* %4
%69 = add nsw i32 %68, -1
store i32 %69, i32* %4
br label %70
70: ; preds = %65, %60, %57
%71 = load i32, i32* %4
%72 = icmp slt i32 %71, 4
br i1 %72, label %73, label %74
73: ; preds = %70
br label %255
74: ; preds = %70
%75 = load i32, i32* %4
%76 = add nsw i32 %75, -1
store i32 %76, i32* %4
%77 = icmp sle i32 %75, 0
br i1 %77, label %78, label %79
78: ; preds = %74
br label %255
79: ; preds = %74
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i32 1
store i8** %81, i8*** %5
%82 = load i8*, i8** %80
store i8* %82, i8** %22
%83 = load i8*, i8** %22
%84 = call double @strtold(i8* %83, i8** %21)
store double %84, double* %9
%85 = load i8*, i8** %21
%86 = icmp eq i8* %85, null
br i1 %86, label %87, label %88
87: ; preds = %79
br label %255
88: ; preds = %79
%89 = load i8*, i8** %21
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %99
93: ; preds = %88
%94 = load i8*, i8** %21
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp ne i32 %96, 44
br i1 %97, label %98, label %99
98: ; preds = %93
br label %255
99: ; preds = %93, %88
%100 = load double, double* %9
%101 = fcmp ole double -9.000000e+01, %100
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = load double, double* %9
%104 = fcmp ole double %103, 9.000000e+01
br i1 %104, label %106, label %105
105: ; preds = %102, %99
br label %255
106: ; preds = %102
%107 = load i32, i32* %4
%108 = add nsw i32 %107, -1
store i32 %108, i32* %4
%109 = icmp sle i32 %107, 0
br i1 %109, label %110, label %111
110: ; preds = %106
br label %255
111: ; preds = %106
%112 = load i8**, i8*** %5
%113 = getelementptr inbounds i8*, i8** %112, i32 1
store i8** %113, i8*** %5
%114 = load i8*, i8** %112
store i8* %114, i8** %22
%115 = load i8*, i8** %22
%116 = call double @strtold(i8* %115, i8** %21)
store double %116, double* %10
%117 = load i8*, i8** %21
%118 = icmp eq i8* %117, null
br i1 %118, label %119, label %120
119: ; preds = %111
br label %255
120: ; preds = %111
%121 = load i8*, i8** %21
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %126
125: ; preds = %120
br label %255
126: ; preds = %120
%127 = load double, double* %10
%128 = fcmp ole double -1.800000e+02, %127
br i1 %128, label %129, label %132
129: ; preds = %126
%130 = load double, double* %10
%131 = fcmp ole double %130, 1.800000e+02
br i1 %131, label %133, label %132
132: ; preds = %129, %126
br label %255
133: ; preds = %129
%134 = load i32, i32* %4
%135 = add nsw i32 %134, -1
store i32 %135, i32* %4
%136 = icmp sle i32 %134, 0
br i1 %136, label %137, label %138
137: ; preds = %133
br label %255
138: ; preds = %133
%139 = load i8**, i8*** %5
%140 = getelementptr inbounds i8*, i8** %139, i32 1
store i8** %140, i8*** %5
%141 = load i8*, i8** %139
store i8* %141, i8** %22
%142 = load i8*, i8** %22
%143 = call double @strtold(i8* %142, i8** %21)
store double %143, double* %11
%144 = load i8*, i8** %21
%145 = icmp eq i8* %144, null
br i1 %145, label %146, label %147
146: ; preds = %138
br label %255
147: ; preds = %138
%148 = load i8*, i8** %21
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %158
152: ; preds = %147
%153 = load i8*, i8** %21
%154 = load i8, i8* %153
%155 = sext i8 %154 to i32
%156 = icmp ne i32 %155, 44
br i1 %156, label %157, label %158
157: ; preds = %152
br label %255
158: ; preds = %152, %147
%159 = load double, double* %11
%160 = fcmp ole double -9.000000e+01, %159
br i1 %160, label %161, label %164
161: ; preds = %158
%162 = load double, double* %11
%163 = fcmp ole double %162, 9.000000e+01
br i1 %163, label %165, label %164
164: ; preds = %161, %158
br label %255
165: ; preds = %161
%166 = load i32, i32* %4
%167 = add nsw i32 %166, -1
store i32 %167, i32* %4
%168 = icmp sle i32 %166, 0
br i1 %168, label %169, label %170
169: ; preds = %165
br label %255
170: ; preds = %165
%171 = load i8**, i8*** %5
%172 = getelementptr inbounds i8*, i8** %171, i32 1
store i8** %172, i8*** %5
%173 = load i8*, i8** %171
store i8* %173, i8** %22
%174 = load i8*, i8** %22
%175 = call double @strtold(i8* %174, i8** %21)
store double %175, double* %12
%176 = load i8*, i8** %21
%177 = icmp eq i8* %176, null
br i1 %177, label %178, label %179
178: ; preds = %170
br label %255
179: ; preds = %170
%180 = load i8*, i8** %21
%181 = load i8, i8* %180
%182 = sext i8 %181 to i32
%183 = icmp ne i32 %182, 0
br i1 %183, label %184, label %185
184: ; preds = %179
br label %255
185: ; preds = %179
%186 = load double, double* %12
%187 = fcmp ole double -1.800000e+02, %186
br i1 %187, label %188, label %191
188: ; preds = %185
%189 = load double, double* %12
%190 = fcmp ole double %189, 1.800000e+02
br i1 %190, label %192, label %191
191: ; preds = %188, %185
br label %255
192: ; preds = %188
%193 = load i32, i32* %8
%194 = icmp ne i32 %193, 0
br i1 %194, label %195, label %203
195: ; preds = %192
%196 = load i32, i32* @stderr
%197 = load i8*, i8** %7
%198 = load double, double* %9
%199 = load double, double* %10
%200 = load double, double* %11
%201 = load double, double* %12
%202 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %196, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %197, double %198, double %199, double %200, double %201)
br label %203
203: ; preds = %195, %192
%204 = load double, double* %9
%205 = load double, double* @M_PI
%206 = fmul double %204, %205
%207 = fdiv double %206, 1.800000e+02
store double %207, double* %13
%208 = load double, double* %11
%209 = load double, double* @M_PI
%210 = fmul double %208, %209
%211 = fdiv double %210, 1.800000e+02
store double %211, double* %14
%212 = load double, double* %11
%213 = load double, double* %9
%214 = fsub double %212, %213
%215 = load double, double* @M_PI
%216 = fmul double %214, %215
%217 = fdiv double %216, 1.800000e+02
store double %217, double* %15
%218 = load double, double* %12
%219 = load double, double* %10
%220 = fsub double %218, %219
%221 = load double, double* @M_PI
%222 = fmul double %220, %221
%223 = fdiv double %222, 1.800000e+02
store double %223, double* %16
%224 = load double, double* %16
%225 = fdiv double %224, 2.000000e+00
%226 = call double @sin(double %225)
store double %226, double* %18
%227 = load double, double* %18
%228 = load double, double* %18
%229 = fmul double %228, %227
store double %229, double* %18
%230 = load double, double* %15
%231 = fdiv double %230, 2.000000e+00
%232 = call double @sin(double %231)
store double %232, double* %17
%233 = load double, double* %17
%234 = load double, double* %17
%235 = fmul double %234, %233
store double %235, double* %17
%236 = load double, double* %13
%237 = call double @cos(double %236)
%238 = load double, double* %14
%239 = call double @cos(double %238)
%240 = fmul double %237, %239
%241 = load double, double* %18
%242 = load double, double* %17
%243 = call double @llvm.fmuladd.f64(double %240, double %241, double %242)
store double %243, double* %17
%244 = load double, double* %17
%245 = call i32 @sqrt(double %244)
%246 = load double, double* %17
%247 = fsub double 1.000000e+00, %246
%248 = call i32 @sqrt(double %247)
%249 = call double @atan2(i32 %245, i32 %248)
%250 = fmul double 2.000000e+00, %249
store double %250, double* %19
%251 = load double, double* %19
%252 = fmul double 6.378100e+06, %251
store double %252, double* %20
%253 = load double, double* %20
%254 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %253)
store i32 0, i32* %6
br label %255
255: ; preds = %203, %191, %184, %178, %169, %164, %157, %146, %137, %132, %125, %119, %110, %105, %98, %87, %78, %73
%256 = load i32, i32* %6
ret i32 %256
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-?\00"
@stderr = global i32 0
@.str.2 = [53 x i8] c"usage: %s [ -? ] [ -d ] LATDD1 LONDD1 LATDD2 LONDD2\0A\00"
@.str.3 = [3 x i8] c"-d\00"
@.str.4 = [41 x i8] c"%s: ( %.10f , %.10f ) ( %.10f , %.10f )\0A\00"
@M_PI = global double 0.000000e+00
@.str.5 = [7 x i8] c"%.10f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = load i8*, i8** %1
%6 = tail call i8* @strrchr(i8* dereferenceable(1) %5, i8 signext 47)
%7 = icmp eq i8* %6, null
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = select i1 %7, i8* %5, i8* %8
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = icmp sgt i32 %0, 1
br i1 %11, label %12, label %116
12: ; preds = %2
%13 = add nsw i32 %0, -1
%14 = load i8*, i8** %10
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = add nsw i32 %0, -2
%22 = icmp eq i32 %21, 0
br i1 %22, label %116, label %23
23: ; preds = %12, %17
%24 = phi i8** [ %20, %17 ], [ %10, %12 ]
%25 = phi i32 [ %21, %17 ], [ %13, %12 ]
%26 = load i8*, i8** %24
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
%29 = sext i1 %28 to i32
%30 = add nsw i32 %25, %29
%31 = zext i1 %28 to i64
%32 = getelementptr i8*, i8** %24, i64 %31
%33 = icmp ult i32 %30, 4
br i1 %33, label %116, label %34
34: ; preds = %23
%35 = getelementptr inbounds i8*, i8** %32, i64 1
%36 = load i8*, i8** %32
%37 = call double @strtold(i8* %36, i8** %3)
%38 = load i8*, i8** %3
%39 = icmp eq i8* %38, null
br i1 %39, label %116, label %40
40: ; preds = %34
%41 = load i8, i8* %38
switch i8 %41, label %116 [
i8 0, label %42
i8 44, label %42
]
42: ; preds = %40, %40
%43 = fcmp oge double %37, -9.000000e+01
%44 = fcmp ole double %37, 9.000000e+01
%45 = and i1 %43, %44
br i1 %45, label %46, label %116
46: ; preds = %42
%47 = getelementptr inbounds i8*, i8** %32, i64 2
%48 = load i8*, i8** %35
%49 = call double @strtold(i8* %48, i8** %3)
%50 = load i8*, i8** %3
%51 = icmp eq i8* %50, null
br i1 %51, label %116, label %52
52: ; preds = %46
%53 = load i8, i8* %50
%54 = icmp eq i8 %53, 0
br i1 %54, label %55, label %116
55: ; preds = %52
%56 = fcmp oge double %49, -1.800000e+02
%57 = fcmp ole double %49, 1.800000e+02
%58 = and i1 %56, %57
br i1 %58, label %59, label %116
59: ; preds = %55
%60 = getelementptr inbounds i8*, i8** %32, i64 3
%61 = load i8*, i8** %47
%62 = call double @strtold(i8* %61, i8** %3)
%63 = load i8*, i8** %3
%64 = icmp eq i8* %63, null
br i1 %64, label %116, label %65
65: ; preds = %59
%66 = load i8, i8* %63
switch i8 %66, label %116 [
i8 0, label %67
i8 44, label %67
]
67: ; preds = %65, %65
%68 = fcmp oge double %62, -9.000000e+01
%69 = fcmp ole double %62, 9.000000e+01
%70 = and i1 %68, %69
br i1 %70, label %71, label %116
71: ; preds = %67
%72 = load i8*, i8** %60
%73 = call double @strtold(i8* %72, i8** %3)
%74 = load i8*, i8** %3
%75 = icmp eq i8* %74, null
br i1 %75, label %116, label %76
76: ; preds = %71
%77 = load i8, i8* %74
%78 = icmp eq i8 %77, 0
br i1 %78, label %79, label %116
79: ; preds = %76
%80 = fcmp oge double %73, -1.800000e+02
%81 = fcmp ole double %73, 1.800000e+02
%82 = and i1 %80, %81
br i1 %82, label %83, label %116
83: ; preds = %79
br i1 %28, label %84, label %87
84: ; preds = %83
%85 = load i32, i32* @stderr
%86 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %9, double %37, double %49, double %62, double %73)
br label %87
87: ; preds = %84, %83
%88 = load double, double* @M_PI
%89 = fmul double %37, %88
%90 = fdiv double %89, 1.800000e+02
%91 = fmul double %62, %88
%92 = fdiv double %91, 1.800000e+02
%93 = fsub double %62, %37
%94 = fmul double %93, %88
%95 = fdiv double %94, 1.800000e+02
%96 = fsub double %73, %49
%97 = fmul double %96, %88
%98 = fdiv double %97, 1.800000e+02
%99 = fmul double %98, 5.000000e-01
%100 = tail call double @sin(double %99)
%101 = fmul double %100, %100
%102 = fmul double %95, 5.000000e-01
%103 = tail call double @sin(double %102)
%104 = fmul double %103, %103
%105 = tail call double @cos(double %90)
%106 = tail call double @cos(double %92)
%107 = fmul double %105, %106
%108 = tail call double @llvm.fmuladd.f64(double %107, double %101, double %104)
%109 = tail call i32 @sqrt(double %108)
%110 = fsub double 1.000000e+00, %108
%111 = tail call i32 @sqrt(double %110)
%112 = tail call double @atan2(i32 %109, i32 %111)
%113 = fmul double %112, 2.000000e+00
%114 = fmul double %113, 6.378100e+06
%115 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %114)
br label %116
116: ; preds = %2, %17, %65, %40, %79, %76, %71, %67, %59, %55, %52, %46, %42, %34, %23, %87
%117 = phi i32 [ 1, %23 ], [ 1, %34 ], [ 1, %46 ], [ 1, %52 ], [ 1, %59 ], [ 1, %71 ], [ 1, %76 ], [ 0, %87 ], [ 1, %79 ], [ 1, %67 ], [ 1, %55 ], [ 1, %42 ], [ 1, %40 ], [ 1, %65 ], [ 1, %17 ], [ 1, %2 ]
ret i32 %117
}