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

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char const *);
int /*<<< orphan*/ output_begin_table(int /*<<< orphan*/);
int /*<<< orphan*/ output_end_table(int /*<<< orphan*/);
int /*<<< orphan*/ output_table_line(int /*<<< orphan*/, long, double);
int parse_linebuf(char *, long *, double *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void parse_file(FILE *f, const char *filename) {
  char linebuf[0x100];
  int linenum = 0;
  output_begin_table(stdout);
  while (fgets(linebuf, sizeof(linebuf), f) != NULL) {
    long mjd;
    double delta;
    int ok;
    linenum++;
    ok = parse_linebuf(linebuf, &mjd, &delta);
    if (!ok) {
      fprintf(stderr, "Error on line %d in file %s", linenum, filename);
      break;
    }
    if (((double)((int)delta)) != delta) {
      continue;
    }
    output_table_line(stdout, mjd, delta);
  }
  output_end_table(stdout);
}


x86 assembly (clang, -O0):
<parse_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x114(%rbp)
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1030 <output_begin_table@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1256 <parse_file+0xf6>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
lea    -0x120(%rbp),%rsi
lea    -0x128(%rbp),%rdx
call   1060 <parse_linebuf@plt>
mov    %eax,-0x12c(%rbp)
cmpl   $0x0,-0x12c(%rbp)
jne    120a <parse_file+0xaa>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
mov    -0x114(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe00(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1256 <parse_file+0xf6>
cvttsd2si -0x128(%rbp),%eax
ff
cvtsi2sd %eax,%xmm0
ucomisd -0x128(%rbp),%xmm0
ff
jne    122f <parse_file+0xcf>
jp     122f <parse_file+0xcf>
jmp    1234 <parse_file+0xd4>
jmp    118b <parse_file+0x2b>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
mov    -0x120(%rbp),%rsi
movsd  -0x128(%rbp),%xmm0
ff
call   1080 <output_table_line@plt>
jmp    118b <parse_file+0x2b>
mov    0x2d7b(%rip),%rax
mov    (%rax),%edi
call   1070 <output_end_table@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,%r15
mov    0x2e58(%rip),%r14
mov    (%r14),%edi
call   1030 <output_begin_table@plt>
lea    0x20(%rsp),%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     122b <parse_file+0xcb>
mov    $0x1,%ebp
lea    0x20(%rsp),%rbx
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
jmp    11d8 <parse_file+0x78>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
je     122b <parse_file+0xcb>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1060 <parse_linebuf@plt>
test   %eax,%eax
je     120f <parse_file+0xaf>
movsd  0x10(%rsp),%xmm0
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c0 <parse_file+0x60>
jp     11c0 <parse_file+0x60>
mov    (%r14),%edi
mov    0x18(%rsp),%rsi
call   1080 <output_table_line@plt>
jmp    11c0 <parse_file+0x60>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
lea    0xde1(%rip),%rsi
mov    %ebp,%edx
mov    0x8(%rsp),%rcx
call   1050 <fprintf@plt>
mov    (%r14),%edi
call   1070 <output_end_table@plt>
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [28 x i8] c"Error on line %d in file %s\00"
define void @parse_file(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i32
%7 = alloca i64
%8 = alloca double
%9 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %6
%10 = load i32, i32* @stdout
%11 = call i32 @output_begin_table(i32 %10)
br label %12
12: ; preds = %36, %35, %2
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%14 = load i32*, i32** %3
%15 = call i32* @fgets(i8* %13, i32 256, i32* %14)
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %41
17: ; preds = %12
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%21 = call i32 @parse_linebuf(i8* %20, i64* %7, double* %8)
store i32 %21, i32* %9
%22 = load i32, i32* %9
%23 = icmp ne i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %17
%25 = load i32, i32* @stderr
%26 = load i32, i32* %6
%27 = load i8*, i8** %4
%28 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %26, i8* %27)
br label %41
29: ; preds = %17
%30 = load double, double* %8
%31 = fptosi double %30 to i32
%32 = sitofp i32 %31 to double
%33 = load double, double* %8
%34 = fcmp une double %32, %33
br i1 %34, label %35, label %36
35: ; preds = %29
br label %12
36: ; preds = %29
%37 = load i32, i32* @stdout
%38 = load i64, i64* %7
%39 = load double, double* %8
%40 = call i32 @output_table_line(i32 %37, i64 %38, double %39)
br label %12
41: ; preds = %24, %12
%42 = load i32, i32* @stdout
%43 = call i32 @output_end_table(i32 %42)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [28 x i8] c"Error on line %d in file %s\00"
define void @parse_file(i32* nocapture %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = alloca i64
%5 = alloca double
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @stdout
%8 = tail call i32 @output_begin_table(i32 %7)
%9 = call i32* @fgets(i8* %6, i32 256, i32* %0)
%10 = icmp eq i32* %9, null
br i1 %10, label %34, label %11
11: ; preds = %2
%12 = bitcast i64* %4 to i8*
%13 = bitcast double* %5 to i8*
br label %14
14: ; preds = %11, %31
%15 = phi i32 [ 0, %11 ], [ %16, %31 ]
%16 = add nuw nsw i32 %15, 1
%17 = call i32 @parse_linebuf(i8* %6, i64* %4, double* %5)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %1)
br label %34
22: ; preds = %14
%23 = load double, double* %5
%24 = fptosi double %23 to i32
%25 = sitofp i32 %24 to double
%26 = fcmp une double %23, %25
br i1 %26, label %31, label %27
27: ; preds = %22
%28 = load i32, i32* @stdout
%29 = load i64, i64* %4
%30 = call i32 @output_table_line(i32 %28, i64 %29, double %23)
br label %31
31: ; preds = %22, %27
%32 = call i32* @fgets(i8* %6, i32 256, i32* %0)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %14
34: ; preds = %31, %2, %19
%35 = load i32, i32* @stdout
%36 = call i32 @output_end_table(i32 %35)
ret void
}