#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sscanf(char *, char *, int *, ...);
void get_next_tle_rev(FILE *fpin, int *this_year, int *this_day, int *this_msec,
                      int *this_rev, double *this_rev_per_day) {
  int max = 256;
  int line_no = 0;
  char tmp1[7];
  char tmp2[7];
  double full_time;
  long msec_per_day = 24 * 60 * 60 * 1000;
  int junk;
  double junkf;
  char line1[256];
  char line2[256];
  if (fgets(line1, max, fpin) == NULL) {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  if (line1[0] != '1') {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  if (fgets(line2, max, fpin) == NULL) {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  if (line2[0] != '2') {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  sscanf(line1, "%1i %s %s %lf", &line_no, tmp1, tmp2, &full_time);
  sscanf(line2, "%1i %i %lf %lf %s %lf %lf %lf %i", &line_no, &junk, &junkf,
         &junkf, tmp1, &junkf, &junkf, this_rev_per_day, this_rev);
  *this_rev /= 10;
  *this_year = (int)full_time / 1000;
  *this_day = (int)(full_time - (*this_year * 1000));
  *this_msec =
      (int)((full_time - (*this_year * 1000) - *this_day) * msec_per_day);
  *this_year = *this_year + 1900;
}


x86 assembly (clang, -O0):
<get_next_tle_rev>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x298,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x100,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movq   $0x5265c00,-0x60(%rbp)
05
lea    -0x170(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    11ad <get_next_tle_rev+0x6d>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movsbl -0x170(%rbp),%eax
cmp    $0x31,%eax
je     11d3 <get_next_tle_rev+0x93>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x270(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    1206 <get_next_tle_rev+0xc6>
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movsbl -0x270(%rbp),%eax
cmp    $0x32,%eax
je     122c <get_next_tle_rev+0xec>
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x170(%rbp),%rdi
lea    -0x47(%rbp),%rcx
lea    -0x4e(%rbp),%r8
lea    0xddb(%rip),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x58(%rbp),%r9
mov    $0x0,%al
call   1050 <sscanf@plt>
lea    -0x270(%rbp),%rdi
lea    -0x47(%rbp),%rbx
mov    -0x38(%rbp),%r10
mov    -0x30(%rbp),%rax
lea    0xdc0(%rip),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x64(%rbp),%rcx
lea    -0x70(%rbp),%r11
mov    %r11,%r8
mov    %r11,%r9
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x278(%rbp)
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x278(%rbp),%rax
mov    %ecx,(%rax)
cvttsd2si -0x58(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3e8,(%rax),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3e8,(%rax),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdq -0x60(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x76c,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x298,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_tle_rev>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x248,%rsp
mov    %r9,%r13
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%rbp
movl   $0x0,0xc(%rsp)
lea    0x140(%rsp),%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12d1 <get_next_tle_rev+0x191>
cmpb   $0x31,0x140(%rsp)
31
jne    12d1 <get_next_tle_rev+0x191>
lea    0x40(%rsp),%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12d1 <get_next_tle_rev+0x191>
mov    %r14,0x10(%rsp)
cmpb   $0x32,0x40(%rsp)
jne    12d1 <get_next_tle_rev+0x191>
lea    0xe3f(%rip),%rsi
lea    0x140(%rsp),%rdi
lea    0xc(%rsp),%r14
lea    0x31(%rsp),%rbp
lea    0x2a(%rsp),%r8
lea    0x18(%rsp),%r9
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <sscanf@plt>
sub    $0x8,%rsp
lea    0x40(%rsp),%r8
lea    0xe14(%rip),%rsi
lea    0x48(%rsp),%rdi
lea    0x2c(%rsp),%rcx
mov    %r14,%rdx
mov    %r8,%r9
mov    $0x0,%eax
push   %r15
push   %r13
push   %r8
push   %r8
push   %rbp
call   1050 <sscanf@plt>
add    $0x30,%rsp
movslq (%r15),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x2,%eax
add    %ecx,%eax
mov    %eax,(%r15)
movsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x6,%eax
add    %ecx,%eax
imul   $0x3e8,%eax,%ecx
cvtsi2sd %ecx,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
cvttsd2si %xmm2,%ecx
mov    %eax,(%r12)
mov    %ecx,(%rbx)
imul   $0x3e8,(%r12),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
cvttpd2dq %xmm2,%xmm2
subsd  %xmm1,%xmm0
cvtdq2pd %xmm2,%xmm1
subsd  %xmm1,%xmm0
mulsd  0xd54(%rip),%xmm0
cvttsd2si %xmm0,%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
addl   $0x76c,(%r12)
add    $0x248,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd5f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"ERROR:bad get from tle file\0A\00"
@.str.1 = [14 x i8] c"%1i %s %s %lf\00"
@.str.2 = [33 x i8] c"%1i %i %lf %lf %s %lf %lf %lf %i\00"
define void @get_next_tle_rev(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, double* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca [7 x i8]
%16 = alloca [7 x i8]
%17 = alloca double
%18 = alloca i64
%19 = alloca i32
%20 = alloca double
%21 = alloca [256 x i8]
%22 = alloca [256 x i8]
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store double* %5, double** %12
store i32 256, i32* %13
store i32 0, i32* %14
store i64 86400000, i64* %18
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %21, i64 0, i64 0
%24 = load i32, i32* %13
%25 = load i32*, i32** %7
%26 = call i32* @fgets(i8* %23, i32 %24, i32* %25)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %6
%29 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %6
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %21, i64 0, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 49
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %31
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %22, i64 0, i64 0
%41 = load i32, i32* %13
%42 = load i32*, i32** %7
%43 = call i32* @fgets(i8* %40, i32 %41, i32* %42)
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %48
45: ; preds = %39
%46 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %39
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %22, i64 0, i64 0
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp ne i32 %51, 50
br i1 %52, label %53, label %56
53: ; preds = %48
%54 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %48
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %21, i64 0, i64 0
%58 = getelementptr inbounds [7 x i8], [7 x i8]* %15, i64 0, i64 0
%59 = getelementptr inbounds [7 x i8], [7 x i8]* %16, i64 0, i64 0
%60 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %57, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32* %14, i8* %58, i8* %59, double* %17)
%61 = getelementptr inbounds [256 x i8], [256 x i8]* %22, i64 0, i64 0
%62 = getelementptr inbounds [7 x i8], [7 x i8]* %15, i64 0, i64 0
%63 = load double*, double** %12
%64 = load i32*, i32** %11
%65 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %61, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32* %14, i32* %19, double* %20, double* %20, i8* %62, double* %20, double* %20, double* %63, i32* %64)
%66 = load i32*, i32** %11
%67 = load i32, i32* %66
%68 = sdiv i32 %67, 10
store i32 %68, i32* %66
%69 = load double, double* %17
%70 = fptosi double %69 to i32
%71 = sdiv i32 %70, 1000
%72 = load i32*, i32** %8
store i32 %71, i32* %72
%73 = load double, double* %17
%74 = load i32*, i32** %8
%75 = load i32, i32* %74
%76 = mul nsw i32 %75, 1000
%77 = sitofp i32 %76 to double
%78 = fsub double %73, %77
%79 = fptosi double %78 to i32
%80 = load i32*, i32** %9
store i32 %79, i32* %80
%81 = load double, double* %17
%82 = load i32*, i32** %8
%83 = load i32, i32* %82
%84 = mul nsw i32 %83, 1000
%85 = sitofp i32 %84 to double
%86 = fsub double %81, %85
%87 = load i32*, i32** %9
%88 = load i32, i32* %87
%89 = sitofp i32 %88 to double
%90 = fsub double %86, %89
%91 = load i64, i64* %18
%92 = sitofp i64 %91 to double
%93 = fmul double %90, %92
%94 = fptosi double %93 to i32
%95 = load i32*, i32** %10
store i32 %94, i32* %95
%96 = load i32*, i32** %8
%97 = load i32, i32* %96
%98 = add nsw i32 %97, 1900
%99 = load i32*, i32** %8
store i32 %98, i32* %99
ret void
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"%1i %s %s %lf\00"
@.str.2 = [33 x i8] c"%1i %i %lf %lf %s %lf %lf %lf %i\00"
@str.5 = [28 x i8] c"ERROR:bad get from tle file\00"
define void @get_next_tle_rev(i32* nocapture %0, i32* nocapture %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* %4, double* %5) {
%7 = alloca i32
%8 = alloca [7 x i8]
%9 = alloca [7 x i8]
%10 = alloca double
%11 = alloca i32
%12 = alloca double
%13 = alloca [256 x i8]
%14 = alloca [256 x i8]
%15 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 0
%18 = bitcast double* %10 to i8*
%19 = bitcast i32* %11 to i8*
%20 = bitcast double* %12 to i8*
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%23 = call i32* @fgets(i8* %21, i32 256, i32* %0)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %28
25: ; preds = %6
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %6
%29 = load i8, i8* %21
%30 = icmp eq i8 %29, 49
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %28
%35 = call i32* @fgets(i8* %22, i32 256, i32* %0)
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %34
%41 = load i8, i8* %22
%42 = icmp eq i8 %41, 50
br i1 %42, label %46, label %43
43: ; preds = %40
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %40
%47 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %21, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32* %7, i8* %16, i8* %17, double* %10)
%48 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* %22, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32* %7, i32* %11, double* %12, double* %12, i8* %16, double* %12, double* %12, double* %5, i32* %4)
%49 = load i32, i32* %4
%50 = sdiv i32 %49, 10
store i32 %50, i32* %4
%51 = load double, double* %10
%52 = fptosi double %51 to i32
%53 = sdiv i32 %52, 1000
store i32 %53, i32* %1
%54 = mul nsw i32 %53, 1000
%55 = sitofp i32 %54 to double
%56 = fsub double %51, %55
%57 = fptosi double %56 to i32
store i32 %57, i32* %2
%58 = load i32, i32* %1
%59 = mul nsw i32 %58, 1000
%60 = sitofp i32 %59 to double
%61 = fsub double %51, %60
%62 = sitofp i32 %57 to double
%63 = fsub double %61, %62
%64 = fmul double %63, 8.640000e+07
%65 = fptosi double %64 to i32
store i32 %65, i32* %3
%66 = load i32, i32* %1
%67 = add nsw i32 %66, 1900
store i32 %67, i32* %1
ret void
}