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

/* Variables and functions */
int atof(char *);
int atol(char const *);
int /*<<< orphan*/ err_exit();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(const int argc, const char **argv) {
  long epoch, idx = -1, line_no = 0, obj_number;
  char buff[300];
  FILE *ifile = fopen("asteroid_indices.txt", "rb");
  double a, ecc;
  if (!ifile) {
    fprintf(stderr, "Couldn't open 'asteroid_indices.txt'\n");
    err_exit();
  }
  if (argc < 3) {
    fprintf(stderr, "Need object number and epoch on command line\n");
    err_exit();
  }
  obj_number = atol(argv[1]);
  while (idx == -1 && fgets(buff, sizeof(buff), ifile)) {
    if (obj_number == atol(buff))
      idx = line_no;
    line_no++;
  }
  fclose(ifile);
  if (idx == -1) {
    fprintf(stderr, "'%s' is not a valid object index\n", argv[1]);
    fprintf(stderr,
            "(Valid asteroid numbers are listed in 'asteroid_indices.txt')\n");
    err_exit();
  }
  epoch = atol(argv[2]) - 2378495;
  if (epoch > 2524615 - 2378495 || epoch < 0) {
    fprintf(stderr, "'%s' is not a valid epoch\n", argv[2]);
    fprintf(stderr, "(BC430 covers JD %d to %d)\n", 2378495, 2524615);
    err_exit();
  }
  epoch += 40 / 2;
  printf("Epoch = JD %ld\n", 2378495 + epoch - (epoch % 40));
  idx = (idx + (epoch / 40) * 300) * 6;
  ifile = fopen("asteroid_ephemeris.txt", "rb");
  if (!ifile) {
    fprintf(stderr, "Couldn't open 'asteroid_ephemeris.txt'\n");
    err_exit();
  }
  while (idx--)
    if (!fgets(buff, sizeof(buff), ifile))
      return (-1);
  if (!fgets(buff, sizeof(buff), ifile))
    return (-1);
  a = atof(buff);
  printf("Semimajor axis (AU) %s", buff);
  if (!fgets(buff, sizeof(buff), ifile))
    return (-1);
  ecc = atof(buff);
  printf("Eccentricity %s", buff);
  printf("Perihelion dist (AU) %.8f\n", a * (1. - ecc));
  if (!fgets(buff, sizeof(buff), ifile))
    return (-1);
  printf(
      "Incl (deg)      %12.8f\n",
      atof(buff) * 180. /
          3.1415926535897932384626433832795028841971693993751058209749445923);
  if (!fgets(buff, sizeof(buff), ifile))
    return (-1);
  printf(
      "Arg per (deg)   %12.8f\n",
      atof(buff) * 180. /
          3.1415926535897932384626433832795028841971693993751058209749445923);
  if (!fgets(buff, sizeof(buff), ifile))
    return (-1);
  printf(
      "Asc node (deg)  %12.8f\n",
      atof(buff) * 180. /
          3.1415926535897932384626433832795028841971693993751058209749445923);
  if (!fgets(buff, sizeof(buff), ifile))
    return (-1);
  printf(
      "Mean anom (deg) %12.8f\n",
      atof(buff) * 180. /
          3.1415926535897932384626433832795028841971693993751058209749445923);
  fclose(ifile);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xffffffffffffffff,-0x20(%rbp)
ff
movq   $0x0,-0x28(%rbp)
lea    0xe68(%rip),%rdi
lea    0xe76(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x168(%rbp)
cmpq   $0x0,-0x168(%rbp)
jne    11ef <main+0x6f>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1080 <err_exit@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1217 <main+0x97>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1080 <err_exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atol@plt>
cltq
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
cmpq   $0xffffffffffffffff,-0x20(%rbp)
mov    %al,-0x179(%rbp)
jne    1262 <main+0xe2>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x179(%rbp)
mov    -0x179(%rbp),%al
test   $0x1,%al
jne    1275 <main+0xf5>
jmp    12ba <main+0x13a>
mov    -0x30(%rbp),%rax
mov    %rax,-0x188(%rbp)
lea    -0x160(%rbp),%rdi
call   1090 <atol@plt>
mov    %eax,%ecx
mov    -0x188(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jne    12a9 <main+0x129>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    122a <main+0xaa>
mov    -0x168(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0xffffffffffffffff,-0x20(%rbp)
jne    130e <main+0x18e>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
lea    0xda6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1080 <err_exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atol@plt>
sub    $0x244aff,%eax
cltq
mov    %rax,-0x18(%rbp)
cmpq   $0x23ac8,-0x18(%rbp)
jg     133f <main+0x1bf>
cmpq   $0x0,-0x18(%rbp)
jge    1386 <main+0x206>
mov    0x2c9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
mov    $0x244aff,%edx
mov    $0x2685c7,%ecx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1080 <err_exit@plt>
mov    -0x18(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
add    $0x244aff,%rsi
mov    -0x18(%rbp),%rax
mov    $0x28,%ecx
cqto
idiv   %rcx
sub    %rdx,%rsi
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x190(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x28,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x190(%rbp),%rax
imul   $0x12c,%rcx,%rcx
add    %rcx,%rax
imul   $0x6,%rax,%rax
mov    %rax,-0x20(%rbp)
lea    0xd34(%rip),%rdi
lea    0xc2e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x168(%rbp)
cmpq   $0x0,-0x168(%rbp)
jne    1437 <main+0x2b7>
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
lea    0xd1a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1080 <err_exit@plt>
jmp    143c <main+0x2bc>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1488 <main+0x308>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    1483 <main+0x303>
movl   $0xffffffff,-0x4(%rbp)
jmp    170b <main+0x58b>
jmp    143c <main+0x2bc>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    14b6 <main+0x336>
movl   $0xffffffff,-0x4(%rbp)
jmp    170b <main+0x58b>
lea    -0x160(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
lea    -0x160(%rbp),%rsi
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    1511 <main+0x391>
movl   $0xffffffff,-0x4(%rbp)
jmp    170b <main+0x58b>
lea    -0x160(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
lea    -0x160(%rbp),%rsi
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x170(%rbp),%xmm0
ff
movsd  0xab2(%rip),%xmm1
subsd  -0x178(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
lea    0xc31(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    1596 <main+0x416>
movl   $0xffffffff,-0x4(%rbp)
jmp    170b <main+0x58b>
lea    -0x160(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  0xa62(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xa4e(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xbe8(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    15fa <main+0x47a>
movl   $0xffffffff,-0x4(%rbp)
jmp    170b <main+0x58b>
lea    -0x160(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  0x9fe(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x9ea(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xb9c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    165e <main+0x4de>
movl   $0xffffffff,-0x4(%rbp)
jmp    170b <main+0x58b>
lea    -0x160(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  0x99a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x986(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xb50(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    $0x12c,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    16c2 <main+0x542>
movl   $0xffffffff,-0x4(%rbp)
jmp    170b <main+0x58b>
lea    -0x160(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  0x936(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x922(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xb04(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x168(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x140,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xe7d(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
je     1579 <main+0x3f9>
cmp    $0x2,%ebx
jg     11d6 <main+0x56>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1080 <err_exit@plt>
mov    0x8(%r14),%rdi
call   1090 <atol@plt>
mov    %eax,%r12d
mov    $0xffffffffffffffff,%rbx
lea    0x10(%rsp),%rbp
xchg   %ax,%ax
mov    %rbp,%rdi
mov    $0x12c,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1220 <main+0xa0>
mov    %rbp,%rdi
call   1090 <atol@plt>
add    $0x1,%rbx
cmp    %eax,%r12d
jne    11f0 <main+0x70>
mov    %r15,%rdi
call   1040 <fclose@plt>
jmp    1261 <main+0xe1>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    0x2db1(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%r14),%rdx
lea    0xe48(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe5a(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1080 <err_exit@plt>
mov    $0xffffffffffffffff,%rbx
mov    0x10(%r14),%rbp
mov    %rbp,%rdi
call   1090 <atol@plt>
mov    %eax,%r14d
lea    -0x2685c8(%r14),%eax
cmp    $0xfffdc536,%eax
ja     12bb <main+0x13b>
mov    0x2d5b(%rip),%r15
mov    (%r15),%edi
lea    0xe56(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%r15),%edi
lea    0xe5d(%rip),%rsi
mov    $0x244aff,%edx
mov    $0x2685c7,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1080 <err_exit@plt>
movslq %r14d,%rax
add    $0xffffffffffdbb515,%rax
movabs $0x6666666666666667,%rcx
66 66 66
imul   %rcx
mov    %rdx,%rbp
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x4,%rbp
add    %rax,%rbp
lea    0x0(,%rbp,4),%rax
add    %rbp,%rax
lea    0x244aff(,%rax,8),%rsi
lea    0xe20(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe22(%rip),%rdi
lea    0xd1c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    133c <main+0x1bc>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1080 <err_exit@plt>
lea    (%rbx,%rbx,2),%rax
imul   $0x708,%rbp,%rcx
lea    (%rcx,%rax,2),%rbx
not    %rbx
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
inc    %rbx
je     1385 <main+0x205>
mov    %rbp,%rdi
mov    $0x12c,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    1360 <main+0x1e0>
mov    $0xffffffff,%r14d
jmp    1566 <main+0x3e6>
lea    0x10(%rsp),%rdi
mov    $0x12c,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
je     1566 <main+0x3e6>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <atof@plt>
mov    %eax,%r15d
lea    0xdae(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    $0x12c,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1566 <main+0x3e6>
cvtsi2sd %r15d,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
lea    0xd77(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xbe3(%rip),%xmm0
subsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
lea    0xd63(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    $0x12c,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1566 <main+0x3e6>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xb9d(%rip),%xmm0
divsd  0xb9d(%rip),%xmm0
lea    0xd33(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    $0x12c,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1566 <main+0x3e6>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xb52(%rip),%xmm0
divsd  0xb52(%rip),%xmm0
lea    0xd00(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    $0x12c,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1566 <main+0x3e6>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xb07(%rip),%xmm0
divsd  0xb07(%rip),%xmm0
lea    0xccd(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    $0x12c,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1566 <main+0x3e6>
lea    0x10(%rsp),%rdi
call   1030 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xac3(%rip),%xmm0
divsd  0xac3(%rip),%xmm0
lea    0xca1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x140,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a60(%rip),%rax
mov    (%rax),%edi
lea    0xaa7(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1080 <err_exit@plt>
cmp    $0x2,%ebx
jle    11b8 <main+0x38>
jmp    11d6 <main+0x56>

LLVM IR (-O0):
@.str = [21 x i8] c"asteroid_indices.txt\00"
@.str.1 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.2 = [38 x i8] c"Couldn't open 'asteroid_indices.txt'\0A\00"
@.str.3 = [46 x i8] c"Need object number and epoch on command line\0A\00"
@.str.4 = [34 x i8] c"'%s' is not a valid object index\0A\00"
@.str.5 = [63 x i8] c"(Valid asteroid numbers are listed in 'asteroid_indices.txt')\0A\00"
@.str.6 = [27 x i8] c"'%s' is not a valid epoch\0A\00"
@.str.7 = [28 x i8] c"(BC430 covers JD %d to %d)\0A\00"
@.str.8 = [16 x i8] c"Epoch = JD %ld\0A\00"
@.str.9 = [23 x i8] c"asteroid_ephemeris.txt\00"
@.str.10 = [40 x i8] c"Couldn't open 'asteroid_ephemeris.txt'\0A\00"
@.str.11 = [23 x i8] c"Semimajor axis (AU) %s\00"
@.str.12 = [16 x i8] c"Eccentricity %s\00"
@.str.13 = [27 x i8] c"Perihelion dist (AU) %.8f\0A\00"
@.str.14 = [24 x i8] c"Incl (deg) %12.8f\0A\00"
@.str.15 = [24 x i8] c"Arg per (deg) %12.8f\0A\00"
@.str.16 = [24 x i8] c"Asc node (deg) %12.8f\0A\00"
@.str.17 = [24 x i8] c"Mean anom (deg) %12.8f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca [300 x i8]
%11 = alloca i32*
%12 = alloca double
%13 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 -1, i64* %7
store i64 0, i64* %8
%14 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %11
%15 = load i32*, i32** %11
%16 = icmp ne i32* %15, null
br i1 %16, label %21, label %17
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (...) @err_exit()
br label %21
21: ; preds = %17, %2
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 (...) @err_exit()
br label %28
28: ; preds = %24, %21
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @atol(i8* %31)
%33 = sext i32 %32 to i64
store i64 %33, i64* %9
br label %34
34: ; preds = %52, %28
%35 = load i64, i64* %7
%36 = icmp eq i64 %35, -1
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%39 = load i32*, i32** %11
%40 = call i64 @fgets(i8* %38, i32 300, i32* %39)
%41 = icmp ne i64 %40, 0
br label %42
42: ; preds = %37, %34
%43 = phi i1 [ false, %34 ], [ %41, %37 ]
br i1 %43, label %44, label %55
44: ; preds = %42
%45 = load i64, i64* %9
%46 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%47 = call i32 @atol(i8* %46)
%48 = sext i32 %47 to i64
%49 = icmp eq i64 %45, %48
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = load i64, i64* %8
store i64 %51, i64* %7
br label %52
52: ; preds = %50, %44
%53 = load i64, i64* %8
%54 = add nsw i64 %53, 1
store i64 %54, i64* %8
br label %34
55: ; preds = %42
%56 = load i32*, i32** %11
%57 = call i32 @fclose(i32* %56)
%58 = load i64, i64* %7
%59 = icmp eq i64 %58, -1
br i1 %59, label %60, label %69
60: ; preds = %55
%61 = load i32, i32* @stderr
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %64)
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0))
%68 = call i32 (...) @err_exit()
br label %69
69: ; preds = %60, %55
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = call i32 @atol(i8* %72)
%74 = sub nsw i32 %73, 2378495
%75 = sext i32 %74 to i64
store i64 %75, i64* %6
%76 = load i64, i64* %6
%77 = icmp sgt i64 %76, 146120
br i1 %77, label %81, label %78
78: ; preds = %69
%79 = load i64, i64* %6
%80 = icmp slt i64 %79, 0
br i1 %80, label %81, label %90
81: ; preds = %78, %69
%82 = load i32, i32* @stderr
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 2
%85 = load i8*, i8** %84
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %85)
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 2378495, i32 2524615)
%89 = call i32 (...) @err_exit()
br label %90
90: ; preds = %81, %78
%91 = load i64, i64* %6
%92 = add nsw i64 %91, 20
store i64 %92, i64* %6
%93 = load i64, i64* %6
%94 = add nsw i64 2378495, %93
%95 = load i64, i64* %6
%96 = srem i64 %95, 40
%97 = sub nsw i64 %94, %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i64 %97)
%99 = load i64, i64* %7
%100 = load i64, i64* %6
%101 = sdiv i64 %100, 40
%102 = mul nsw i64 %101, 300
%103 = add nsw i64 %99, %102
%104 = mul nsw i64 %103, 6
store i64 %104, i64* %7
%105 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %105, i32** %11
%106 = load i32*, i32** %11
%107 = icmp ne i32* %106, null
br i1 %107, label %112, label %108
108: ; preds = %90
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
%111 = call i32 (...) @err_exit()
br label %112
112: ; preds = %108, %90
br label %113
113: ; preds = %123, %112
%114 = load i64, i64* %7
%115 = add nsw i64 %114, -1
store i64 %115, i64* %7
%116 = icmp ne i64 %114, 0
br i1 %116, label %117, label %124
117: ; preds = %113
%118 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%119 = load i32*, i32** %11
%120 = call i64 @fgets(i8* %118, i32 300, i32* %119)
%121 = icmp ne i64 %120, 0
br i1 %121, label %123, label %122
122: ; preds = %117
store i32 -1, i32* %3
br label %202
123: ; preds = %117
br label %113
124: ; preds = %113
%125 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%126 = load i32*, i32** %11
%127 = call i64 @fgets(i8* %125, i32 300, i32* %126)
%128 = icmp ne i64 %127, 0
br i1 %128, label %130, label %129
129: ; preds = %124
store i32 -1, i32* %3
br label %202
130: ; preds = %124
%131 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%132 = call i32 @atof(i8* %131)
%133 = sitofp i32 %132 to double
store double %133, double* %12
%134 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i8* %134)
%136 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%137 = load i32*, i32** %11
%138 = call i64 @fgets(i8* %136, i32 300, i32* %137)
%139 = icmp ne i64 %138, 0
br i1 %139, label %141, label %140
140: ; preds = %130
store i32 -1, i32* %3
br label %202
141: ; preds = %130
%142 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%143 = call i32 @atof(i8* %142)
%144 = sitofp i32 %143 to double
store double %144, double* %13
%145 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* %145)
%147 = load double, double* %12
%148 = load double, double* %13
%149 = fsub double 1.000000e+00, %148
%150 = fmul double %147, %149
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), double %150)
%152 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%153 = load i32*, i32** %11
%154 = call i64 @fgets(i8* %152, i32 300, i32* %153)
%155 = icmp ne i64 %154, 0
br i1 %155, label %157, label %156
156: ; preds = %141
store i32 -1, i32* %3
br label %202
157: ; preds = %141
%158 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%159 = call i32 @atof(i8* %158)
%160 = sitofp i32 %159 to double
%161 = fmul double %160, 1.800000e+02
%162 = fdiv double %161, 0x400921FB54442D18
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), double %162)
%164 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%165 = load i32*, i32** %11
%166 = call i64 @fgets(i8* %164, i32 300, i32* %165)
%167 = icmp ne i64 %166, 0
br i1 %167, label %169, label %168
168: ; preds = %157
store i32 -1, i32* %3
br label %202
169: ; preds = %157
%170 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%171 = call i32 @atof(i8* %170)
%172 = sitofp i32 %171 to double
%173 = fmul double %172, 1.800000e+02
%174 = fdiv double %173, 0x400921FB54442D18
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), double %174)
%176 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%177 = load i32*, i32** %11
%178 = call i64 @fgets(i8* %176, i32 300, i32* %177)
%179 = icmp ne i64 %178, 0
br i1 %179, label %181, label %180
180: ; preds = %169
store i32 -1, i32* %3
br label %202
181: ; preds = %169
%182 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%183 = call i32 @atof(i8* %182)
%184 = sitofp i32 %183 to double
%185 = fmul double %184, 1.800000e+02
%186 = fdiv double %185, 0x400921FB54442D18
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), double %186)
%188 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%189 = load i32*, i32** %11
%190 = call i64 @fgets(i8* %188, i32 300, i32* %189)
%191 = icmp ne i64 %190, 0
br i1 %191, label %193, label %192
192: ; preds = %181
store i32 -1, i32* %3
br label %202
193: ; preds = %181
%194 = getelementptr inbounds [300 x i8], [300 x i8]* %10, i64 0, i64 0
%195 = call i32 @atof(i8* %194)
%196 = sitofp i32 %195 to double
%197 = fmul double %196, 1.800000e+02
%198 = fdiv double %197, 0x400921FB54442D18
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), double %198)
%200 = load i32*, i32** %11
%201 = call i32 @fclose(i32* %200)
store i32 0, i32* %3
br label %202
202: ; preds = %193, %192, %180, %168, %156, %140, %129, %122
%203 = load i32, i32* %3
ret i32 %203
}

LLVM IR (-O2):
@.str = [21 x i8] c"asteroid_indices.txt\00"
@.str.1 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.2 = [38 x i8] c"Couldn't open 'asteroid_indices.txt'\0A\00"
@.str.3 = [46 x i8] c"Need object number and epoch on command line\0A\00"
@.str.4 = [34 x i8] c"'%s' is not a valid object index\0A\00"
@.str.5 = [63 x i8] c"(Valid asteroid numbers are listed in 'asteroid_indices.txt')\0A\00"
@.str.6 = [27 x i8] c"'%s' is not a valid epoch\0A\00"
@.str.7 = [28 x i8] c"(BC430 covers JD %d to %d)\0A\00"
@.str.8 = [16 x i8] c"Epoch = JD %ld\0A\00"
@.str.9 = [23 x i8] c"asteroid_ephemeris.txt\00"
@.str.10 = [40 x i8] c"Couldn't open 'asteroid_ephemeris.txt'\0A\00"
@.str.11 = [23 x i8] c"Semimajor axis (AU) %s\00"
@.str.12 = [16 x i8] c"Eccentricity %s\00"
@.str.13 = [27 x i8] c"Perihelion dist (AU) %.8f\0A\00"
@.str.14 = [24 x i8] c"Incl (deg) %12.8f\0A\00"
@.str.15 = [24 x i8] c"Arg per (deg) %12.8f\0A\00"
@.str.16 = [24 x i8] c"Asc node (deg) %12.8f\0A\00"
@.str.17 = [24 x i8] c"Mean anom (deg) %12.8f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [300 x i8]
%4 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (...) @err_exit()
br label %11
11: ; preds = %7, %2
%12 = icmp slt i32 %0, 3
br i1 %12, label %13, label %17
13: ; preds = %11
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 (...) @err_exit()
br label %17
17: ; preds = %13, %11
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32 @atol(i8* %19)
br label %21
21: ; preds = %17, %25
%22 = phi i64 [ 0, %17 ], [ %28, %25 ]
%23 = call i64 @fgets(i8* %4, i32 300, i32* %5)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = call i32 @atol(i8* %4)
%27 = icmp eq i32 %20, %26
%28 = add nuw nsw i64 %22, 1
br i1 %27, label %37, label %21
29: ; preds = %21
%30 = call i32 @fclose(i32* %5)
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %18
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 (...) @err_exit()
br label %39
37: ; preds = %25
%38 = call i32 @fclose(i32* %5)
br label %39
39: ; preds = %37, %29
%40 = phi i64 [ %22, %37 ], [ -1, %29 ]
%41 = getelementptr inbounds i8*, i8** %1, i64 2
%42 = load i8*, i8** %41
%43 = call i32 @atol(i8* %42)
%44 = add i32 %43, -2524616
%45 = icmp ult i32 %44, -146121
br i1 %45, label %46, label %52
46: ; preds = %39
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %42)
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 2378495, i32 2524615)
%51 = call i32 (...) @err_exit()
br label %52
52: ; preds = %39, %46
%53 = sext i32 %43 to i64
%54 = add nsw i64 %53, -2378475
%55 = add nsw i64 %53, 20
%56 = srem i64 %54, 40
%57 = sub nsw i64 %55, %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i64 %57)
%59 = sdiv i64 %54, 40
%60 = mul nsw i64 %59, 300
%61 = add nsw i64 %60, %40
%62 = mul nsw i64 %61, 6
%63 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%64 = icmp eq i32* %63, null
br i1 %64, label %65, label %69
65: ; preds = %52
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
%68 = call i32 (...) @err_exit()
br label %69
69: ; preds = %65, %52
br label %70
70: ; preds = %69, %73
%71 = phi i64 [ %74, %73 ], [ %62, %69 ]
%72 = icmp eq i64 %71, 0
br i1 %72, label %77, label %73
73: ; preds = %70
%74 = add nsw i64 %71, -1
%75 = call i64 @fgets(i8* %4, i32 300, i32* %63)
%76 = icmp eq i64 %75, 0
br i1 %76, label %126, label %70
77: ; preds = %70
%78 = call i64 @fgets(i8* %4, i32 300, i32* %63)
%79 = icmp eq i64 %78, 0
br i1 %79, label %126, label %80
80: ; preds = %77
%81 = call i32 @atof(i8* %4)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i8* %4)
%83 = call i64 @fgets(i8* %4, i32 300, i32* %63)
%84 = icmp eq i64 %83, 0
br i1 %84, label %126, label %85
85: ; preds = %80
%86 = sitofp i32 %81 to double
%87 = call i32 @atof(i8* %4)
%88 = sitofp i32 %87 to double
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* %4)
%90 = fsub double 1.000000e+00, %88
%91 = fmul double %90, %86
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), double %91)
%93 = call i64 @fgets(i8* %4, i32 300, i32* %63)
%94 = icmp eq i64 %93, 0
br i1 %94, label %126, label %95
95: ; preds = %85
%96 = call i32 @atof(i8* %4)
%97 = sitofp i32 %96 to double
%98 = fmul double %97, 1.800000e+02
%99 = fdiv double %98, 0x400921FB54442D18
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), double %99)
%101 = call i64 @fgets(i8* %4, i32 300, i32* %63)
%102 = icmp eq i64 %101, 0
br i1 %102, label %126, label %103
103: ; preds = %95
%104 = call i32 @atof(i8* %4)
%105 = sitofp i32 %104 to double
%106 = fmul double %105, 1.800000e+02
%107 = fdiv double %106, 0x400921FB54442D18
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), double %107)
%109 = call i64 @fgets(i8* %4, i32 300, i32* %63)
%110 = icmp eq i64 %109, 0
br i1 %110, label %126, label %111
111: ; preds = %103
%112 = call i32 @atof(i8* %4)
%113 = sitofp i32 %112 to double
%114 = fmul double %113, 1.800000e+02
%115 = fdiv double %114, 0x400921FB54442D18
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), double %115)
%117 = call i64 @fgets(i8* %4, i32 300, i32* %63)
%118 = icmp eq i64 %117, 0
br i1 %118, label %126, label %119
119: ; preds = %111
%120 = call i32 @atof(i8* %4)
%121 = sitofp i32 %120 to double
%122 = fmul double %121, 1.800000e+02
%123 = fdiv double %122, 0x400921FB54442D18
%124 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), double %123)
%125 = call i32 @fclose(i32* %63)
br label %126
126: ; preds = %73, %111, %103, %95, %85, %80, %77, %119
%127 = phi i32 [ 0, %119 ], [ -1, %77 ], [ -1, %80 ], [ -1, %85 ], [ -1, %95 ], [ -1, %103 ], [ -1, %111 ], [ -1, %73 ]
ret i32 %127
}