#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ feof(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, int);
int sscanf(char *, char *, double *, double *, double *, double *, double *,
           double *, double *, double *, double *, double *);
int /*<<< orphan*/ stderr;
int readxyztable(FILE *ephemfile, double tbl[][10]) {
  int n_rows;
  int n_args;
  char line[400];
  char *p;
  for (n_rows = 0; n_rows < 400;) {
    p = fgets(line, 400, ephemfile);
    if (p == NULL) {
      if (feof(ephemfile) == 0) {
        (void)fprintf(stderr,
                      "\nFATAL error reading ephemeris file , I/O error "
                      "reading ephem table.\nInvalid ephemeris file format.");
        return (-1);
      }
      return (n_rows);
    }
    n_args =
        sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", &tbl[n_rows][0],
               &tbl[n_rows][1], &tbl[n_rows][2], &tbl[n_rows][3],
               &tbl[n_rows][4], &tbl[n_rows][5], &tbl[n_rows][6],
               &tbl[n_rows][7], &tbl[n_rows][8], &tbl[n_rows][9]);
    ++n_rows;
    if (n_args != 10) {
      (void)fprintf(stderr,
                    "\nFATAL error reading ephemeris file: readxyztable found "
                    "%d args in row %d!\nInvalid ephemeris file format.\n",
                    n_args, n_rows);
      return (-1);
    }
  }
  (void)printf("\nEphemeris WARNING , readxyztable found more than %d rows!\n",
               n_rows);
  (void)fprintf(stderr,
                "\nEphemeris WARNING , readxyztable found more than %d rows!\n",
                n_rows);
  return (n_rows);
}


x86 assembly (clang, -O0):
<readxyztable>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1f8,%rsp
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x190,-0x34(%rbp)
jge    1315 <readxyztable+0x1c5>
lea    -0x1d0(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x190,%esi
call   1040 <fgets@plt>
mov    %rax,-0x1d8(%rbp)
cmpq   $0x0,-0x1d8(%rbp)
jne    11e7 <readxyztable+0x97>
mov    -0x28(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%rax
jne    11dc <readxyztable+0x8c>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x1c(%rbp)
jmp    1344 <readxyztable+0x1f4>
mov    -0x34(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1344 <readxyztable+0x1f4>
lea    -0x1d0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rdx
mov    -0x30(%rbp),%rcx
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rcx
add    $0x8,%rcx
mov    -0x30(%rbp),%r8
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%r8
add    $0x10,%r8
mov    -0x30(%rbp),%r9
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%r9
add    $0x18,%r9
mov    -0x30(%rbp),%r15
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%r15
add    $0x20,%r15
mov    -0x30(%rbp),%r14
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%r14
add    $0x28,%r14
mov    -0x30(%rbp),%rbx
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rbx
add    $0x30,%rbx
mov    -0x30(%rbp),%r11
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%r11
add    $0x38,%r11
mov    -0x30(%rbp),%r10
movslq -0x34(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%r10
add    $0x40,%r10
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rsi
imul   $0x50,%rsi,%rsi
add    %rsi,%rax
add    $0x48,%rax
lea    0xdb5(%rip),%rsi
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1070 <sscanf@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0xa,-0x38(%rbp)
je     1310 <readxyztable+0x1c0>
mov    0x2cf2(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
mov    -0x34(%rbp),%ecx
lea    0xd8f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x1c(%rbp)
jmp    1344 <readxyztable+0x1f4>
jmp    116f <readxyztable+0x1f>
mov    -0x34(%rbp),%esi
lea    0xdd8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%edx
lea    0xdc0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<readxyztable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
xor    %ebp,%ebp
xor    %r13d,%r13d
xchg   %ax,%ax
cmp    $0x7d00,%rbp
je     121e <readxyztable+0xce>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x190,%esi
mov    0x8(%rsp),%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1252 <readxyztable+0x102>
lea    (%rbx,%rbp,1),%rdx
lea    (%rbx,%rbp,1),%rcx
add    $0x8,%rcx
lea    0x10(%rbx,%rbp,1),%r8
lea    0x18(%rbx,%rbp,1),%r9
lea    0x20(%rbx,%rbp,1),%r10
lea    0x28(%rbx,%rbp,1),%r11
lea    0x30(%rbx,%rbp,1),%rax
lea    0x38(%rbx,%rbp,1),%r12
lea    0x40(%rbx,%rbp,1),%r15
mov    %r14,%rdi
lea    0x48(%rbx,%rbp,1),%r14
lea    0xe89(%rip),%rsi
push   %r14
push   %r15
push   %r12
push   %rax
push   %r11
push   %r10
call   1070 <sscanf@plt>
add    $0x30,%rsp
add    $0x1,%r13d
add    $0x50,%rbp
cmp    $0xa,%eax
je     1170 <readxyztable+0x20>
mov    0x2dd9(%rip),%rcx
mov    (%rcx),%edi
lea    0xe7c(%rip),%rsi
mov    %eax,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1278 <readxyztable+0x128>
lea    0xed2(%rip),%rbx
mov    $0x190,%r13d
mov    %rbx,%rdi
mov    $0x190,%esi
call   1030 <printf@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
mov    $0x190,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    127e <readxyztable+0x12e>
mov    0x8(%rsp),%rdi
call   1060 <feof@plt>
test   %rax,%rax
jne    127e <readxyztable+0x12e>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0xffffffff,%r13d
mov    %r13d,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [100 x i8] c"\0AFATAL error reading ephemeris file , I/O error reading ephem table.\0AInvalid ephemeris file format.\00"
@.str.1 = [40 x i8] c"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf\00"
@.str.2 = [107 x i8] c"\0AFATAL error reading ephemeris file: readxyztable found %d args in row %d!\0AInvalid ephemeris file format.\0A\00"
@.str.3 = [60 x i8] c"\0AEphemeris WARNING , readxyztable found more than %d rows!\0A\00"
define i32 @readxyztable(i32* %0, [10 x double]* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [10 x double]*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [400 x i8]
%9 = alloca i8*
store i32* %0, i32** %4
store [10 x double]* %1, [10 x double]** %5
store i32 0, i32* %6
br label %10
10: ; preds = %90, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 400
br i1 %12, label %13, label %91
13: ; preds = %10
%14 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%15 = load i32*, i32** %4
%16 = call i8* @fgets(i8* %14, i32 400, i32* %15)
store i8* %16, i8** %9
%17 = load i8*, i8** %9
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %28
19: ; preds = %13
%20 = load i32*, i32** %4
%21 = call i64 @feof(i32* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %98
26: ; preds = %19
%27 = load i32, i32* %6
store i32 %27, i32* %3
br label %98
28: ; preds = %13
%29 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%30 = load [10 x double]*, [10 x double]** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x double], [10 x double]* %30, i64 %32
%34 = getelementptr inbounds [10 x double], [10 x double]* %33, i64 0, i64 0
%35 = load [10 x double]*, [10 x double]** %5
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [10 x double], [10 x double]* %35, i64 %37
%39 = getelementptr inbounds [10 x double], [10 x double]* %38, i64 0, i64 1
%40 = load [10 x double]*, [10 x double]** %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10 x double], [10 x double]* %40, i64 %42
%44 = getelementptr inbounds [10 x double], [10 x double]* %43, i64 0, i64 2
%45 = load [10 x double]*, [10 x double]** %5
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [10 x double], [10 x double]* %45, i64 %47
%49 = getelementptr inbounds [10 x double], [10 x double]* %48, i64 0, i64 3
%50 = load [10 x double]*, [10 x double]** %5
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [10 x double], [10 x double]* %50, i64 %52
%54 = getelementptr inbounds [10 x double], [10 x double]* %53, i64 0, i64 4
%55 = load [10 x double]*, [10 x double]** %5
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [10 x double], [10 x double]* %55, i64 %57
%59 = getelementptr inbounds [10 x double], [10 x double]* %58, i64 0, i64 5
%60 = load [10 x double]*, [10 x double]** %5
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [10 x double], [10 x double]* %60, i64 %62
%64 = getelementptr inbounds [10 x double], [10 x double]* %63, i64 0, i64 6
%65 = load [10 x double]*, [10 x double]** %5
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [10 x double], [10 x double]* %65, i64 %67
%69 = getelementptr inbounds [10 x double], [10 x double]* %68, i64 0, i64 7
%70 = load [10 x double]*, [10 x double]** %5
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10 x double], [10 x double]* %70, i64 %72
%74 = getelementptr inbounds [10 x double], [10 x double]* %73, i64 0, i64 8
%75 = load [10 x double]*, [10 x double]** %5
%76 = load i32, i32* %6
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [10 x double], [10 x double]* %75, i64 %77
%79 = getelementptr inbounds [10 x double], [10 x double]* %78, i64 0, i64 9
%80 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), double* %34, double* %39, double* %44, double* %49, double* %54, double* %59, double* %64, double* %69, double* %74, double* %79)
store i32 %80, i32* %7
%81 = load i32, i32* %6
%82 = add nsw i32 %81, 1
store i32 %82, i32* %6
%83 = load i32, i32* %7
%84 = icmp ne i32 %83, 10
br i1 %84, label %85, label %90
85: ; preds = %28
%86 = load i32, i32* @stderr
%87 = load i32, i32* %7
%88 = load i32, i32* %6
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str.2, i64 0, i64 0), i32 %87, i32 %88)
store i32 -1, i32* %3
br label %98
90: ; preds = %28
br label %10
91: ; preds = %10
%92 = load i32, i32* %6
%93 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i32 %92)
%94 = load i32, i32* @stderr
%95 = load i32, i32* %6
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i32 %95)
%97 = load i32, i32* %6
store i32 %97, i32* %3
br label %98
98: ; preds = %91, %85, %26, %23
%99 = load i32, i32* %3
ret i32 %99
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [100 x i8] c"\0AFATAL error reading ephemeris file , I/O error reading ephem table.\0AInvalid ephemeris file format.\00"
@.str.1 = [40 x i8] c"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf\00"
@.str.2 = [107 x i8] c"\0AFATAL error reading ephemeris file: readxyztable found %d args in row %d!\0AInvalid ephemeris file format.\0A\00"
@.str.3 = [60 x i8] c"\0AEphemeris WARNING , readxyztable found more than %d rows!\0A\00"
define i32 @readxyztable(i32* nocapture %0, [10 x double]* %1) {
%3 = alloca [400 x i8]
%4 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %18, %2
%6 = phi i64 [ %30, %18 ], [ 0, %2 ]
%7 = icmp eq i64 %6, 400
br i1 %7, label %36, label %8
8: ; preds = %5
%9 = call i8* @fgets(i8* %4, i32 400, i32* %0)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = trunc i64 %6 to i32
%13 = call i64 @feof(i32* %0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %40
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
br label %40
18: ; preds = %8
%19 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 0
%20 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 1
%21 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 2
%22 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 3
%23 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 4
%24 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 5
%25 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 6
%26 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 7
%27 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 8
%28 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 %6, i64 9
%29 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), double* %19, double* %20, double* %21, double* %22, double* %23, double* %24, double* %25, double* %26, double* %27, double* %28)
%30 = add nuw nsw i64 %6, 1
%31 = icmp eq i32 %29, 10
br i1 %31, label %5, label %32
32: ; preds = %18
%33 = trunc i64 %30 to i32
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %33)
br label %40
36: ; preds = %5
%37 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i32 400)
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i32 400)
br label %40
40: ; preds = %11, %36, %32, %15
%41 = phi i32 [ -1, %15 ], [ -1, %32 ], [ 400, %36 ], [ %12, %11 ]
ret i32 %41
}