#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 atan(double);
double cos(double);
int fabs(double);
int /*<<< orphan*/ fatal_error(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ get_nxny_(unsigned char **, unsigned int *, unsigned int *,
                             unsigned int *, int *, int *);
double int4(unsigned char *);
double log(double);
scalar_t__ malloc(size_t);
double pow(double, double);
double radius_earth(unsigned char **);
double sin(double);
double sqrt(double);
scalar_t__ stagger(unsigned char **, unsigned int, double *, double *);
int /*<<< orphan*/ stderr;
double tan(double);
double todegrees(double);
int lambert2ll(unsigned char **sec, double **llat, double **llon) {
  double n;
  double *lat, *lon;
  double dx, dy, lat1r, lon1r, lon2d, lon2r, latin1r, latin2r;
  double lond, latd, d_lon;
  double f, rho, rhoref, theta, startx, starty;
  unsigned int nnx, nny;
  int nres, nscan;
  double x, y, tmp;
  unsigned char *gds;
  double latDr;
  double earth_radius;
  unsigned int j, nnpnts;
  get_nxny_(sec, &nnx, &nny, &nnpnts, &nres, &nscan);
  if (nnx < 1 || nny < 1) {
    fprintf(stderr, "Sorry code does not handle variable nx/ny yet\n");
    return 0;
  }
  earth_radius = radius_earth(sec);
  gds = sec[3];
  dy = (int4(gds + 59) * 0.001);
  dx = (int4(gds + 55) * 0.001);
  lat1r = (int4(gds + 38) * 0.000001) * (3.14159265358979323846 / 180.0);
  lon1r = (int4(gds + 42) * 0.000001) * (3.14159265358979323846 / 180.0);
  lon2d = (int4(gds + 51) * 0.000001);
  lon2r = lon2d * (3.14159265358979323846 / 180.0);
  latin1r = (int4(gds + 65) * 0.000001) * (3.14159265358979323846 / 180.0);
  latin2r = (int4(gds + 69) * 0.000001) * (3.14159265358979323846 / 180.0);
  latDr = (int4(gds + 47) * 0.000001) * (3.14159265358979323846 / 180.0);
  if (lon1r < 0)
    fatal_error("bad grid definition, lon1r < 0.0", "");
  if (fabs(latin1r - latin2r) < 1E-09) {
    n = sin(latin1r);
  } else {
    n = log(cos(latin1r) / cos(latin2r)) /
        log(tan(0.78539816339744830962 + latin2r / 2.0) /
            tan(0.78539816339744830962 + latin1r / 2.0));
  }
  f = (cos(latin1r) * pow(tan(0.78539816339744830962 + latin1r / 2.0), n)) / n;
  rho = earth_radius * f * pow(tan(0.78539816339744830962 + lat1r / 2.0), -n);
  rhoref =
      earth_radius * f * pow(tan(0.78539816339744830962 + latDr / 2.0), -n);
  d_lon = lon1r - lon2r;
  if (d_lon > 3.14159265358979323846)
    d_lon -= 2 * 3.14159265358979323846;
  if (d_lon < -3.14159265358979323846)
    d_lon += 2 * 3.14159265358979323846;
  theta = n * d_lon;
  startx = rho * sin(theta);
  starty = rhoref - rho * cos(theta);
  if ((*llat = (double *)malloc(((size_t)nnpnts) * sizeof(double))) == NULL) {
    fatal_error("lambert2ll memory allocation failed", "");
  }
  if ((*llon = (double *)malloc(((size_t)nnpnts) * sizeof(double))) == NULL) {
    fatal_error("lambert2ll memory allocation failed", "");
  }
  lat = *llat;
  lon = *llon;
  if (stagger(sec, nnpnts, lon, lat))
    fatal_error("geo: stagger problem", "");
  dx = fabs(dx);
  dy = fabs(dy);
#pragma omp parallel for private(j, x, y, tmp, theta, rho, lond, latd)
  for (j = 0; j < nnpnts; j++) {
    y = starty + lat[j] * dy;
    x = startx + lon[j] * dx;
    tmp = rhoref - y;
    theta = atan(x / tmp);
    rho = sqrt(x * x + tmp * tmp);
    rho = n > 0 ? rho : -rho;
    lond = lon2d + todegrees(theta / n);
    latd = todegrees(2.0 * atan(pow(earth_radius * f / rho, 1.0 / n)) -
                     1.57079632679489661923);
    lond = lond >= 360.0 ? lond - 360.0 : lond;
    lond = lond < 0.0 ? lond + 360.0 : lond;
    lon[j] = lond;
    lat[j] = latd;
  }
  return 0;
}


x86 assembly (clang, -O0):
<lambert2ll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0xc4(%rbp),%rsi
lea    -0xc8(%rbp),%rdx
lea    -0x108(%rbp),%rcx
lea    -0xcc(%rbp),%r8
lea    -0xd0(%rbp),%r9
call   1050 <get_nxny_@plt>
cmpl   $0x1,-0xc4(%rbp)
jb     125d <lambert2ll+0x5d>
cmpl   $0x1,-0xc8(%rbp)
jae    127e <lambert2ll+0x7e>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    0xdf3(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1ad0 <lambert2ll+0x8d0>
mov    -0x10(%rbp),%rdi
call   1040 <radius_earth@plt>
movsd  %xmm0,-0x100(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0xf0(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x3b,%rdi
call   1030 <int4@plt>
movsd  0xd5a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x37,%rdi
call   1030 <int4@plt>
movsd  0xd39(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x26,%rdi
call   1030 <int4@plt>
movsd  0xd10(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcfc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x2a,%rdi
call   1030 <int4@plt>
movsd  0xce3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xccf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x33,%rdi
call   1030 <int4@plt>
movsd  0xcb6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xc9d(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x41,%rdi
call   1030 <int4@plt>
movsd  0xc83(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc6f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x45,%rdi
call   1030 <int4@plt>
movsd  0xc56(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc42(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0xf0(%rbp),%rdi
add    $0x2f,%rdi
call   1030 <int4@plt>
movsd  0xc29(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc15(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    1418 <lambert2ll+0x218>
lea    0xc83(%rip),%rdi
lea    0xc7b(%rip),%rsi
call   10a0 <fatal_error@plt>
movsd  -0x70(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
call   1060 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xbe5(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1451 <lambert2ll+0x251>
movsd  -0x70(%rbp),%xmm0
call   1080 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    14fd <lambert2ll+0x2fd>
movsd  -0x70(%rbp),%xmm0
call   10e0 <cos@plt>
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
call   10e0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x120(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
call   10f0 <log@plt>
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x78(%rbp),%xmm1
movsd  0xb92(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xb7e(%rip),%xmm0
addsd  %xmm1,%xmm0
call   10c0 <tan@plt>
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x70(%rbp),%xmm1
movsd  0xb68(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xb54(%rip),%xmm0
addsd  %xmm1,%xmm0
call   10c0 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x118(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
call   10f0 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x110(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x70(%rbp),%xmm0
call   10e0 <cos@plt>
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0x70(%rbp),%xmm1
movsd  0xb0c(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xaf8(%rip),%xmm0
addsd  %xmm1,%xmm0
call   10c0 <tan@plt>
movsd  -0x28(%rbp),%xmm1
call   1100 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x138(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
mulsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0x50(%rbp),%xmm1
movsd  0xaac(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xa98(%rip),%xmm0
addsd  %xmm1,%xmm0
call   10c0 <tan@plt>
movsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1100 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x130(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
mulsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0xf8(%rbp),%xmm1
ff
movsd  0xa37(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xa23(%rip),%xmm0
addsd  %xmm1,%xmm0
call   10c0 <tan@plt>
movsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1100 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x128(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  0x9d0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1686 <lambert2ll+0x486>
movsd  -0x90(%rbp),%xmm0
ff
movsd  0x9be(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0x9b2(%rip),%xmm0
ucomisd -0x90(%rbp),%xmm0
ff
jbe    16b4 <lambert2ll+0x4b4>
movsd  0x994(%rip),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x150(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x150(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x148(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
call   10e0 <cos@plt>
movsd  -0x148(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x140(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x108(%rbp),%eax
mov    %eax,%edi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    -0x18(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1799 <lambert2ll+0x599>
lea    0x923(%rip),%rdi
lea    0x8fa(%rip),%rsi
call   10a0 <fatal_error@plt>
mov    -0x108(%rbp),%eax
mov    %eax,%edi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    17ce <lambert2ll+0x5ce>
lea    0x8ee(%rip),%rdi
lea    0x8c5(%rip),%rsi
call   10a0 <fatal_error@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x108(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1110 <stagger@plt>
cmp    $0x0,%rax
je     1818 <lambert2ll+0x618>
lea    0x8c8(%rip),%rdi
lea    0x87b(%rip),%rsi
call   10a0 <fatal_error@plt>
movsd  -0x40(%rbp),%xmm0
call   1060 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1060 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x104(%rbp)
mov    -0x104(%rbp),%eax
cmp    -0x108(%rbp),%eax
jae    1ac9 <lambert2ll+0x8c9>
movsd  -0xc0(%rbp),%xmm1
ff
mov    -0x30(%rbp),%rax
mov    -0x104(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xb8(%rbp),%xmm1
ff
mov    -0x38(%rbp),%rax
mov    -0x104(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
subsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
divsd  -0xe8(%rbp),%xmm0
ff
call   1090 <atan@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  -0xd8(%rbp),%xmm2
ff
movsd  -0xe8(%rbp),%xmm1
ff
mulsd  -0xe8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1120 <sqrt@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1943 <lambert2ll+0x743>
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x158(%rbp)
ff
jmp    196a <lambert2ll+0x76a>
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x158(%rbp)
ff
movsd  -0x158(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x160(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
divsd  -0x28(%rbp),%xmm0
call   10d0 <todegrees@plt>
movaps %xmm0,%xmm1
movsd  -0x160(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x100(%rbp),%xmm0
ff
mulsd  -0x98(%rbp),%xmm0
ff
divsd  -0xa0(%rbp),%xmm0
ff
movsd  0x68b(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
call   1100 <pow@plt>
call   1090 <atan@plt>
addsd  %xmm0,%xmm0
movsd  0x668(%rip),%xmm1
addsd  %xmm1,%xmm0
call   10d0 <todegrees@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  0x642(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1a2e <lambert2ll+0x82e>
movsd  -0x80(%rbp),%xmm0
movsd  0x62b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
jmp    1a3b <lambert2ll+0x83b>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
movsd  -0x168(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    1a70 <lambert2ll+0x870>
movsd  0x5ea(%rip),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
jmp    1a7d <lambert2ll+0x87d>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
movsd  -0x170(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x104(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x30(%rbp),%rax
mov    -0x104(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    1848 <lambert2ll+0x648>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lambert2ll>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
lea    0x7c(%rsp),%rsi
lea    0x78(%rsp),%rdx
lea    0x4(%rsp),%rcx
lea    0xb4(%rsp),%r8
lea    0xb0(%rsp),%r9
call   1050 <get_nxny_@plt>
cmpl   $0x0,0x7c(%rsp)
je     144e <lambert2ll+0x24e>
cmpl   $0x0,0x78(%rsp)
je     144e <lambert2ll+0x24e>
mov    %r12,%rdi
call   1040 <radius_earth@plt>
movsd  %xmm0,0x70(%rsp)
mov    0x18(%r12),%rbx
lea    0x3b(%rbx),%rdi
call   1030 <int4@plt>
movsd  %xmm0,0x50(%rsp)
lea    0x37(%rbx),%rdi
call   1030 <int4@plt>
movsd  %xmm0,0x48(%rsp)
lea    0x26(%rbx),%rdi
call   1030 <int4@plt>
mulsd  0xd72(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0x2a(%rbx),%rdi
call   1030 <int4@plt>
mulsd  0xd5b(%rip),%xmm0
mulsd  0xd5b(%rip),%xmm0
movapd %xmm0,0x80(%rsp)
lea    0x33(%rbx),%rdi
call   1030 <int4@plt>
mulsd  0xd39(%rip),%xmm0
movsd  %xmm0,0xa0(%rsp)
lea    0x41(%rbx),%rdi
call   1030 <int4@plt>
mulsd  0xd1f(%rip),%xmm0
mulsd  0xd1f(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x45(%rbx),%rdi
call   1030 <int4@plt>
mulsd  0xd00(%rip),%xmm0
mulsd  0xd00(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0x2f,%rbx
mov    %rbx,%rdi
call   1030 <int4@plt>
mulsd  0xcde(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd 0x80(%rsp),%xmm1
jbe    1358 <lambert2ll+0x158>
lea    0xd6f(%rip),%rdi
lea    0xd67(%rip),%rsi
movsd  %xmm0,0x40(%rsp)
call   10a0 <fatal_error@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0xcaa(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0xa0(%rsp),%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x68(%rsp)
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
call   1060 <fabs@plt>
test   %eax,%eax
jle    1468 <lambert2ll+0x268>
movsd  0x10(%rsp),%xmm0
call   10e0 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   10e0 <cos@plt>
movsd  0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   10f0 <log@plt>
movapd %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xc2f(%rip),%xmm0
addsd  0xc2f(%rip),%xmm0
call   10c0 <tan@plt>
movsd  %xmm0,0x90(%rsp)
movsd  0xc11(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xc0b(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   10c0 <tan@plt>
movsd  0x90(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   10f0 <log@plt>
movapd 0x30(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
jmp    149c <lambert2ll+0x29c>
mov    0x2b8b(%rip),%rax
mov    (%rax),%edi
lea    0xc22(%rip),%rsi
call   1070 <fprintf@plt>
jmp    189d <lambert2ll+0x69d>
movsd  0x10(%rsp),%xmm0
call   1080 <sin@plt>
movaps %xmm0,0x30(%rsp)
movsd  0xb98(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xb8e(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
call   10e0 <cos@plt>
movsd  %xmm0,0x90(%rsp)
movsd  0x8(%rsp),%xmm0
call   10c0 <tan@plt>
movaps 0x30(%rsp),%xmm1
call   1100 <pow@plt>
movsd  %xmm0,0xa8(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  0xb42(%rip),%xmm0
addsd  0xb42(%rip),%xmm0
call   10c0 <tan@plt>
movaps 0xb86(%rip),%xmm1
xorps  0x30(%rsp),%xmm1
movaps %xmm1,0x10(%rsp)
call   1100 <pow@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x40(%rsp),%xmm0
mulsd  0xb0b(%rip),%xmm0
addsd  0xb0b(%rip),%xmm0
call   10c0 <tan@plt>
movaps 0x10(%rsp),%xmm1
call   1100 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x80(%rsp),%xmm2
subsd  0x68(%rsp),%xmm2
movsd  0xae7(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  0xae3(%rip),%xmm1
cmpltsd %xmm2,%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm0,%xmm1
movsd  0xad2(%rip),%xmm2
addsd  %xmm1,%xmm2
movapd %xmm1,%xmm0
cmpltsd 0xac9(%rip),%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
mulsd  0x30(%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
call   1080 <sin@plt>
movsd  %xmm0,0x80(%rsp)
movaps 0x10(%rsp),%xmm0
call   10e0 <cos@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x4(%rsp),%edi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,(%r14)
test   %rax,%rax
jne    15d5 <lambert2ll+0x3d5>
lea    0xb07(%rip),%rdi
lea    0xade(%rip),%rsi
call   10a0 <fatal_error@plt>
mov    0x4(%rsp),%edi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,%r13
mov    %rax,(%r15)
test   %rax,%rax
jne    1603 <lambert2ll+0x403>
lea    0xadc(%rip),%rdi
lea    0xab3(%rip),%rsi
call   10a0 <fatal_error@plt>
mov    (%r15),%r13
movsd  0x50(%rsp),%xmm0
movsd  0x9ef(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x50(%rsp)
movsd  0x48(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x48(%rsp)
mov    (%r14),%rbx
mov    0x4(%rsp),%esi
mov    %r12,%rdi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1110 <stagger@plt>
test   %rax,%rax
je     1658 <lambert2ll+0x458>
lea    0xaa8(%rip),%rdi
lea    0xa5b(%rip),%rsi
call   10a0 <fatal_error@plt>
movsd  0x48(%rsp),%xmm0
call   1060 <fabs@plt>
mov    %eax,%ebp
movsd  0x50(%rsp),%xmm0
call   1060 <fabs@plt>
cmpl   $0x0,0x4(%rsp)
je     189d <lambert2ll+0x69d>
movsd  0x90(%rsp),%xmm2
mulsd  0xa8(%rsp),%xmm2
movapd 0x30(%rsp),%xmm1
divsd  %xmm1,%xmm2
movsd  0x70(%rsp),%xmm0
mulsd  %xmm2,%xmm0
movsd  0x28(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm0,0x70(%rsp)
movsd  0x8(%rsp),%xmm3
mulsd  %xmm0,%xmm3
movsd  0x10(%rsp),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x80(%rsp),%xmm2
movsd  %xmm2,0x28(%rsp)
movsd  %xmm3,0x8(%rsp)
subsd  %xmm0,%xmm3
movsd  %xmm3,0x48(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x80(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0x93f(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x68(%rsp)
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
cmpltsd %xmm1,%xmm0
movapd %xmm0,0x90(%rsp)
jmp    1820 <lambert2ll+0x620>
nopl   0x0(%rax)
movsd  %xmm4,0x10(%rsp)
call   1120 <sqrt@plt>
movsd  0x10(%rsp),%xmm4
movapd 0x30(%rsp),%xmm2
movapd 0x90(%rsp),%xmm3
movapd %xmm3,%xmm1
andpd  %xmm0,%xmm1
xorpd  0x910(%rip),%xmm0
andnpd %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x50(%rsp)
divsd  %xmm2,%xmm4
movapd %xmm4,%xmm0
call   10d0 <todegrees@plt>
addsd  0xa0(%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0x70(%rsp),%xmm0
divsd  0x50(%rsp),%xmm0
movsd  0x68(%rsp),%xmm1
call   1100 <pow@plt>
call   1090 <atan@plt>
addsd  %xmm0,%xmm0
addsd  0x89e(%rip),%xmm0
call   10d0 <todegrees@plt>
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm1
addsd  0x88f(%rip),%xmm1
movsd  0x88f(%rip),%xmm3
movapd %xmm3,%xmm2
cmplesd %xmm4,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm4,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm2,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm2,%xmm3
xorpd  %xmm4,%xmm4
cmpltsd %xmm4,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm3
orpd   %xmm1,%xmm3
movlpd %xmm3,0x0(%r13,%rbp,8)
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
mov    0x4(%rsp),%eax
cmp    %rax,%rbp
jae    189d <lambert2ll+0x69d>
movsd  (%rbx,%rbp,8),%xmm0
mulsd  0x40(%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  0x0(%r13,%rbp,8),%xmm1
mulsd  0x80(%rsp),%xmm1
addsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x50(%rsp)
movapd %xmm1,%xmm0
divsd  %xmm2,%xmm0
call   1090 <atan@plt>
movapd %xmm0,%xmm4
movsd  0x10(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0x7da(%rip),%xmm0
jb     1730 <lambert2ll+0x530>
sqrtsd %xmm0,%xmm0
jmp    1741 <lambert2ll+0x541>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"Sorry code does not handle variable nx/ny yet\0A\00"
@.str.1 = [33 x i8] c"bad grid definition, lon1r < 0.0\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [36 x i8] c"lambert2ll memory allocation failed\00"
@.str.4 = [21 x i8] c"geo: stagger problem\00"
define i32 @lambert2ll(i8** %0, double** %1, double** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double**
%7 = alloca double**
%8 = alloca double
%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 double
%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
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca i8*
%36 = alloca double
%37 = alloca double
%38 = alloca i32
%39 = alloca i32
store i8** %0, i8*** %5
store double** %1, double*** %6
store double** %2, double*** %7
%40 = load i8**, i8*** %5
%41 = call i32 @get_nxny_(i8** %40, i32* %28, i32* %29, i32* %39, i32* %30, i32* %31)
%42 = load i32, i32* %28
%43 = icmp ult i32 %42, 1
br i1 %43, label %47, label %44
44: ; preds = %3
%45 = load i32, i32* %29
%46 = icmp ult i32 %45, 1
br i1 %46, label %47, label %50
47: ; preds = %44, %3
%48 = load i32, i32* @stderr
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %321
50: ; preds = %44
%51 = load i8**, i8*** %5
%52 = call double @radius_earth(i8** %51)
store double %52, double* %37
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 3
%55 = load i8*, i8** %54
store i8* %55, i8** %35
%56 = load i8*, i8** %35
%57 = getelementptr inbounds i8, i8* %56, i64 59
%58 = call double @int4(i8* %57)
%59 = fmul double %58, 1.000000e-03
store double %59, double* %12
%60 = load i8*, i8** %35
%61 = getelementptr inbounds i8, i8* %60, i64 55
%62 = call double @int4(i8* %61)
%63 = fmul double %62, 1.000000e-03
store double %63, double* %11
%64 = load i8*, i8** %35
%65 = getelementptr inbounds i8, i8* %64, i64 38
%66 = call double @int4(i8* %65)
%67 = fmul double %66, 0x3EB0C6F7A0B5ED8D
%68 = fmul double %67, 0x3F91DF46A2529D39
store double %68, double* %13
%69 = load i8*, i8** %35
%70 = getelementptr inbounds i8, i8* %69, i64 42
%71 = call double @int4(i8* %70)
%72 = fmul double %71, 0x3EB0C6F7A0B5ED8D
%73 = fmul double %72, 0x3F91DF46A2529D39
store double %73, double* %14
%74 = load i8*, i8** %35
%75 = getelementptr inbounds i8, i8* %74, i64 51
%76 = call double @int4(i8* %75)
%77 = fmul double %76, 0x3EB0C6F7A0B5ED8D
store double %77, double* %15
%78 = load double, double* %15
%79 = fmul double %78, 0x3F91DF46A2529D39
store double %79, double* %16
%80 = load i8*, i8** %35
%81 = getelementptr inbounds i8, i8* %80, i64 65
%82 = call double @int4(i8* %81)
%83 = fmul double %82, 0x3EB0C6F7A0B5ED8D
%84 = fmul double %83, 0x3F91DF46A2529D39
store double %84, double* %17
%85 = load i8*, i8** %35
%86 = getelementptr inbounds i8, i8* %85, i64 69
%87 = call double @int4(i8* %86)
%88 = fmul double %87, 0x3EB0C6F7A0B5ED8D
%89 = fmul double %88, 0x3F91DF46A2529D39
store double %89, double* %18
%90 = load i8*, i8** %35
%91 = getelementptr inbounds i8, i8* %90, i64 47
%92 = call double @int4(i8* %91)
%93 = fmul double %92, 0x3EB0C6F7A0B5ED8D
%94 = fmul double %93, 0x3F91DF46A2529D39
store double %94, double* %36
%95 = load double, double* %14
%96 = fcmp olt double %95, 0.000000e+00
br i1 %96, label %97, label %99
97: ; preds = %50
%98 = call i32 @fatal_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %99
99: ; preds = %97, %50
%100 = load double, double* %17
%101 = load double, double* %18
%102 = fsub double %100, %101
%103 = call i32 @fabs(double %102)
%104 = sitofp i32 %103 to double
%105 = fcmp olt double %104, 1.000000e-09
br i1 %105, label %106, label %109
106: ; preds = %99
%107 = load double, double* %17
%108 = call double @sin(double %107)
store double %108, double* %8
br label %127
109: ; preds = %99
%110 = load double, double* %17
%111 = call double @cos(double %110)
%112 = load double, double* %18
%113 = call double @cos(double %112)
%114 = fdiv double %111, %113
%115 = call double @log(double %114)
%116 = load double, double* %18
%117 = fdiv double %116, 2.000000e+00
%118 = fadd double 0x3FE921FB54442D18, %117
%119 = call double @tan(double %118)
%120 = load double, double* %17
%121 = fdiv double %120, 2.000000e+00
%122 = fadd double 0x3FE921FB54442D18, %121
%123 = call double @tan(double %122)
%124 = fdiv double %119, %123
%125 = call double @log(double %124)
%126 = fdiv double %115, %125
store double %126, double* %8
br label %127
127: ; preds = %109, %106
%128 = load double, double* %17
%129 = call double @cos(double %128)
%130 = load double, double* %17
%131 = fdiv double %130, 2.000000e+00
%132 = fadd double 0x3FE921FB54442D18, %131
%133 = call double @tan(double %132)
%134 = load double, double* %8
%135 = call double @pow(double %133, double %134)
%136 = fmul double %129, %135
%137 = load double, double* %8
%138 = fdiv double %136, %137
store double %138, double* %22
%139 = load double, double* %37
%140 = load double, double* %22
%141 = fmul double %139, %140
%142 = load double, double* %13
%143 = fdiv double %142, 2.000000e+00
%144 = fadd double 0x3FE921FB54442D18, %143
%145 = call double @tan(double %144)
%146 = load double, double* %8
%147 = fneg double %146
%148 = call double @pow(double %145, double %147)
%149 = fmul double %141, %148
store double %149, double* %23
%150 = load double, double* %37
%151 = load double, double* %22
%152 = fmul double %150, %151
%153 = load double, double* %36
%154 = fdiv double %153, 2.000000e+00
%155 = fadd double 0x3FE921FB54442D18, %154
%156 = call double @tan(double %155)
%157 = load double, double* %8
%158 = fneg double %157
%159 = call double @pow(double %156, double %158)
%160 = fmul double %152, %159
store double %160, double* %24
%161 = load double, double* %14
%162 = load double, double* %16
%163 = fsub double %161, %162
store double %163, double* %21
%164 = load double, double* %21
%165 = fcmp ogt double %164, 0x400921FB54442D18
br i1 %165, label %166, label %169
166: ; preds = %127
%167 = load double, double* %21
%168 = fsub double %167, 0x401921FB54442D18
store double %168, double* %21
br label %169
169: ; preds = %166, %127
%170 = load double, double* %21
%171 = fcmp olt double %170, 0xC00921FB54442D18
br i1 %171, label %172, label %175
172: ; preds = %169
%173 = load double, double* %21
%174 = fadd double %173, 0x401921FB54442D18
store double %174, double* %21
br label %175
175: ; preds = %172, %169
%176 = load double, double* %8
%177 = load double, double* %21
%178 = fmul double %176, %177
store double %178, double* %25
%179 = load double, double* %23
%180 = load double, double* %25
%181 = call double @sin(double %180)
%182 = fmul double %179, %181
store double %182, double* %26
%183 = load double, double* %24
%184 = load double, double* %23
%185 = load double, double* %25
%186 = call double @cos(double %185)
%187 = fneg double %184
%188 = call double @llvm.fmuladd.f64(double %187, double %186, double %183)
store double %188, double* %27
%189 = load i32, i32* %39
%190 = zext i32 %189 to i64
%191 = mul i64 %190, 8
%192 = call i64 @malloc(i64 %191)
%193 = inttoptr i64 %192 to double*
%194 = load double**, double*** %6
store double* %193, double** %194
%195 = icmp eq double* %193, null
br i1 %195, label %196, label %198
196: ; preds = %175
%197 = call i32 @fatal_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %198
198: ; preds = %196, %175
%199 = load i32, i32* %39
%200 = zext i32 %199 to i64
%201 = mul i64 %200, 8
%202 = call i64 @malloc(i64 %201)
%203 = inttoptr i64 %202 to double*
%204 = load double**, double*** %7
store double* %203, double** %204
%205 = icmp eq double* %203, null
br i1 %205, label %206, label %208
206: ; preds = %198
%207 = call i32 @fatal_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %208
208: ; preds = %206, %198
%209 = load double**, double*** %6
%210 = load double*, double** %209
store double* %210, double** %9
%211 = load double**, double*** %7
%212 = load double*, double** %211
store double* %212, double** %10
%213 = load i8**, i8*** %5
%214 = load i32, i32* %39
%215 = load double*, double** %10
%216 = load double*, double** %9
%217 = call i64 @stagger(i8** %213, i32 %214, double* %215, double* %216)
%218 = icmp ne i64 %217, 0
br i1 %218, label %219, label %221
219: ; preds = %208
%220 = call i32 @fatal_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %221
221: ; preds = %219, %208
%222 = load double, double* %11
%223 = call i32 @fabs(double %222)
%224 = sitofp i32 %223 to double
store double %224, double* %11
%225 = load double, double* %12
%226 = call i32 @fabs(double %225)
%227 = sitofp i32 %226 to double
store double %227, double* %12
store i32 0, i32* %38
br label %228
228: ; preds = %317, %221
%229 = load i32, i32* %38
%230 = load i32, i32* %39
%231 = icmp ult i32 %229, %230
br i1 %231, label %232, label %320
232: ; preds = %228
%233 = load double, double* %27
%234 = load double*, double** %9
%235 = load i32, i32* %38
%236 = zext i32 %235 to i64
%237 = getelementptr inbounds double, double* %234, i64 %236
%238 = load double, double* %237
%239 = load double, double* %12
%240 = call double @llvm.fmuladd.f64(double %238, double %239, double %233)
store double %240, double* %33
%241 = load double, double* %26
%242 = load double*, double** %10
%243 = load i32, i32* %38
%244 = zext i32 %243 to i64
%245 = getelementptr inbounds double, double* %242, i64 %244
%246 = load double, double* %245
%247 = load double, double* %11
%248 = call double @llvm.fmuladd.f64(double %246, double %247, double %241)
store double %248, double* %32
%249 = load double, double* %24
%250 = load double, double* %33
%251 = fsub double %249, %250
store double %251, double* %34
%252 = load double, double* %32
%253 = load double, double* %34
%254 = fdiv double %252, %253
%255 = call double @atan(double %254)
store double %255, double* %25
%256 = load double, double* %32
%257 = load double, double* %32
%258 = load double, double* %34
%259 = load double, double* %34
%260 = fmul double %258, %259
%261 = call double @llvm.fmuladd.f64(double %256, double %257, double %260)
%262 = call double @sqrt(double %261)
store double %262, double* %23
%263 = load double, double* %8
%264 = fcmp ogt double %263, 0.000000e+00
br i1 %264, label %265, label %267
265: ; preds = %232
%266 = load double, double* %23
br label %270
267: ; preds = %232
%268 = load double, double* %23
%269 = fneg double %268
br label %270
270: ; preds = %267, %265
%271 = phi double [ %266, %265 ], [ %269, %267 ]
store double %271, double* %23
%272 = load double, double* %15
%273 = load double, double* %25
%274 = load double, double* %8
%275 = fdiv double %273, %274
%276 = call double @todegrees(double %275)
%277 = fadd double %272, %276
store double %277, double* %19
%278 = load double, double* %37
%279 = load double, double* %22
%280 = fmul double %278, %279
%281 = load double, double* %23
%282 = fdiv double %280, %281
%283 = load double, double* %8
%284 = fdiv double 1.000000e+00, %283
%285 = call double @pow(double %282, double %284)
%286 = call double @atan(double %285)
%287 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %286, double 0xBFF921FB54442D18)
%288 = call double @todegrees(double %287)
store double %288, double* %20
%289 = load double, double* %19
%290 = fcmp oge double %289, 3.600000e+02
br i1 %290, label %291, label %294
291: ; preds = %270
%292 = load double, double* %19
%293 = fsub double %292, 3.600000e+02
br label %296
294: ; preds = %270
%295 = load double, double* %19
br label %296
296: ; preds = %294, %291
%297 = phi double [ %293, %291 ], [ %295, %294 ]
store double %297, double* %19
%298 = load double, double* %19
%299 = fcmp olt double %298, 0.000000e+00
br i1 %299, label %300, label %303
300: ; preds = %296
%301 = load double, double* %19
%302 = fadd double %301, 3.600000e+02
br label %305
303: ; preds = %296
%304 = load double, double* %19
br label %305
305: ; preds = %303, %300
%306 = phi double [ %302, %300 ], [ %304, %303 ]
store double %306, double* %19
%307 = load double, double* %19
%308 = load double*, double** %10
%309 = load i32, i32* %38
%310 = zext i32 %309 to i64
%311 = getelementptr inbounds double, double* %308, i64 %310
store double %307, double* %311
%312 = load double, double* %20
%313 = load double*, double** %9
%314 = load i32, i32* %38
%315 = zext i32 %314 to i64
%316 = getelementptr inbounds double, double* %313, i64 %315
store double %312, double* %316
br label %317
317: ; preds = %305
%318 = load i32, i32* %38
%319 = add i32 %318, 1
store i32 %319, i32* %38
br label %228
320: ; preds = %228
store i32 0, i32* %4
br label %321
321: ; preds = %320, %47
%322 = load i32, i32* %4
ret i32 %322
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"Sorry code does not handle variable nx/ny yet\0A\00"
@.str.1 = [33 x i8] c"bad grid definition, lon1r < 0.0\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [36 x i8] c"lambert2ll memory allocation failed\00"
@.str.4 = [21 x i8] c"geo: stagger problem\00"
define i32 @lambert2ll(i8** %0, double** nocapture %1, double** nocapture %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = bitcast i32* %8 to i8*
%14 = call i32 @get_nxny_(i8** %0, i32* %4, i32* %5, i32* %8, i32* %6, i32* %7)
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 0
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %185
23: ; preds = %3
%24 = call double @radius_earth(i8** %0)
%25 = getelementptr inbounds i8*, i8** %0, i64 3
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8, i8* %26, i64 59
%28 = call double @int4(i8* %27)
%29 = fmul double %28, 1.000000e-03
%30 = getelementptr inbounds i8, i8* %26, i64 55
%31 = call double @int4(i8* %30)
%32 = fmul double %31, 1.000000e-03
%33 = getelementptr inbounds i8, i8* %26, i64 38
%34 = call double @int4(i8* %33)
%35 = fmul double %34, 0x3EB0C6F7A0B5ED8D
%36 = fmul double %35, 0x3F91DF46A2529D39
%37 = getelementptr inbounds i8, i8* %26, i64 42
%38 = call double @int4(i8* %37)
%39 = fmul double %38, 0x3EB0C6F7A0B5ED8D
%40 = fmul double %39, 0x3F91DF46A2529D39
%41 = getelementptr inbounds i8, i8* %26, i64 51
%42 = call double @int4(i8* %41)
%43 = fmul double %42, 0x3EB0C6F7A0B5ED8D
%44 = fmul double %43, 0x3F91DF46A2529D39
%45 = getelementptr inbounds i8, i8* %26, i64 65
%46 = call double @int4(i8* %45)
%47 = fmul double %46, 0x3EB0C6F7A0B5ED8D
%48 = fmul double %47, 0x3F91DF46A2529D39
%49 = getelementptr inbounds i8, i8* %26, i64 69
%50 = call double @int4(i8* %49)
%51 = fmul double %50, 0x3EB0C6F7A0B5ED8D
%52 = fmul double %51, 0x3F91DF46A2529D39
%53 = getelementptr inbounds i8, i8* %26, i64 47
%54 = call double @int4(i8* %53)
%55 = fmul double %54, 0x3EB0C6F7A0B5ED8D
%56 = fmul double %55, 0x3F91DF46A2529D39
%57 = fcmp olt double %40, 0.000000e+00
br i1 %57, label %58, label %60
58: ; preds = %23
%59 = call i32 @fatal_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %58, %23
%61 = fsub double %48, %52
%62 = call i32 @fabs(double %61)
%63 = icmp slt i32 %62, 1
br i1 %63, label %64, label %68
64: ; preds = %60
%65 = call double @sin(double %48)
%66 = fmul double %48, 5.000000e-01
%67 = fadd double %66, 0x3FE921FB54442D18
br label %82
68: ; preds = %60
%69 = call double @cos(double %48)
%70 = call double @cos(double %52)
%71 = fdiv double %69, %70
%72 = call double @log(double %71)
%73 = fmul double %52, 5.000000e-01
%74 = fadd double %73, 0x3FE921FB54442D18
%75 = call double @tan(double %74)
%76 = fmul double %48, 5.000000e-01
%77 = fadd double %76, 0x3FE921FB54442D18
%78 = call double @tan(double %77)
%79 = fdiv double %75, %78
%80 = call double @log(double %79)
%81 = fdiv double %72, %80
br label %82
82: ; preds = %68, %64
%83 = phi double [ %77, %68 ], [ %67, %64 ]
%84 = phi double [ %81, %68 ], [ %65, %64 ]
%85 = call double @cos(double %48)
%86 = call double @tan(double %83)
%87 = call double @pow(double %86, double %84)
%88 = fmul double %85, %87
%89 = fdiv double %88, %84
%90 = fmul double %24, %89
%91 = fmul double %36, 5.000000e-01
%92 = fadd double %91, 0x3FE921FB54442D18
%93 = call double @tan(double %92)
%94 = fneg double %84
%95 = call double @pow(double %93, double %94)
%96 = fmul double %95, %90
%97 = fmul double %56, 5.000000e-01
%98 = fadd double %97, 0x3FE921FB54442D18
%99 = call double @tan(double %98)
%100 = call double @pow(double %99, double %94)
%101 = fmul double %90, %100
%102 = fsub double %40, %44
%103 = fcmp ogt double %102, 0x400921FB54442D18
%104 = fadd double %102, 0xC01921FB54442D18
%105 = select i1 %103, double %104, double %102
%106 = fcmp olt double %105, 0xC00921FB54442D18
%107 = fadd double %105, 0x401921FB54442D18
%108 = select i1 %106, double %107, double %105
%109 = fmul double %108, %84
%110 = call double @sin(double %109)
%111 = fmul double %96, %110
%112 = call double @cos(double %109)
%113 = fneg double %96
%114 = call double @llvm.fmuladd.f64(double %113, double %112, double %101)
%115 = load i32, i32* %8
%116 = zext i32 %115 to i64
%117 = shl nuw nsw i64 %116, 3
%118 = call i64 @malloc(i64 %117)
%119 = inttoptr i64 %118 to double*
store double* %119, double** %1
%120 = icmp eq i64 %118, 0
br i1 %120, label %121, label %123
121: ; preds = %82
%122 = call i32 @fatal_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %123
123: ; preds = %121, %82
%124 = load i32, i32* %8
%125 = zext i32 %124 to i64
%126 = shl nuw nsw i64 %125, 3
%127 = call i64 @malloc(i64 %126)
%128 = inttoptr i64 %127 to double*
store double* %128, double** %2
%129 = icmp eq i64 %127, 0
br i1 %129, label %130, label %133
130: ; preds = %123
%131 = call i32 @fatal_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%132 = load double*, double** %2
br label %133
133: ; preds = %130, %123
%134 = phi double* [ %132, %130 ], [ %128, %123 ]
%135 = load double*, double** %1
%136 = load i32, i32* %8
%137 = call i64 @stagger(i8** %0, i32 %136, double* %134, double* %135)
%138 = icmp eq i64 %137, 0
br i1 %138, label %141, label %139
139: ; preds = %133
%140 = call i32 @fatal_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %141
141: ; preds = %139, %133
%142 = call i32 @fabs(double %32)
%143 = sitofp i32 %142 to double
%144 = call i32 @fabs(double %29)
%145 = sitofp i32 %144 to double
%146 = load i32, i32* %8
%147 = icmp eq i32 %146, 0
br i1 %147, label %185, label %148
148: ; preds = %141
%149 = fcmp ogt double %84, 0.000000e+00
%150 = fdiv double 1.000000e+00, %84
br label %151
151: ; preds = %148, %151
%152 = phi i64 [ 0, %148 ], [ %181, %151 ]
%153 = getelementptr inbounds double, double* %135, i64 %152
%154 = load double, double* %153
%155 = call double @llvm.fmuladd.f64(double %154, double %145, double %114)
%156 = getelementptr inbounds double, double* %134, i64 %152
%157 = load double, double* %156
%158 = call double @llvm.fmuladd.f64(double %157, double %143, double %111)
%159 = fsub double %101, %155
%160 = fdiv double %158, %159
%161 = call double @atan(double %160)
%162 = fmul double %159, %159
%163 = call double @llvm.fmuladd.f64(double %158, double %158, double %162)
%164 = call double @sqrt(double %163)
%165 = fneg double %164
%166 = select i1 %149, double %164, double %165
%167 = fdiv double %161, %84
%168 = call double @todegrees(double %167)
%169 = fadd double %43, %168
%170 = fdiv double %90, %166
%171 = call double @pow(double %170, double %150)
%172 = call double @atan(double %171)
%173 = call double @llvm.fmuladd.f64(double %172, double 2.000000e+00, double 0xBFF921FB54442D18)
%174 = call double @todegrees(double %173)
%175 = fcmp oge double %169, 3.600000e+02
%176 = fadd double %169, -3.600000e+02
%177 = select i1 %175, double %176, double %169
%178 = fcmp olt double %177, 0.000000e+00
%179 = fadd double %177, 3.600000e+02
%180 = select i1 %178, double %179, double %177
store double %180, double* %156
store double %174, double* %153
%181 = add nuw nsw i64 %152, 1
%182 = load i32, i32* %8
%183 = zext i32 %182 to i64
%184 = icmp ult i64 %181, %183
br i1 %184, label %151, label %185
185: ; preds = %151, %141, %20
ret i32 0
}