#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 */
int add_time(int *, int *, int *, int *, int *, int *, unsigned int, int);
int code_table_1_2(unsigned char **);
int code_table_4_0(unsigned char **);
int code_table_4_4(unsigned char **);
int forecast_time_in_units(unsigned char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ get_time(unsigned char *, int *, int *, int *, int *, int *,
                            int *);
int stat_proc_verf_time(unsigned char **, int *, int *, int *, int *, int *,
                        int *);
int /*<<< orphan*/ stderr;
int sub_dt(int *, int *, int *, int *, int *, int *, unsigned int, int);
int verftime(unsigned char **sec, int *year, int *month, int *day, int *hour,
             int *minute, int *second) {
  int units, i, j;
  int dtime;
  static int error_count = 0;
  static int warning_count = 0;
  i = code_table_4_0(sec);
  j = stat_proc_verf_time(sec, year, month, day, hour, minute, second);
  if (j == 0)
    return 0;
  get_time(sec[1] + 12, year, month, day, hour, minute, second);
  if (code_table_4_4(sec) == -1)
    return 0;
  i = code_table_1_2(sec);
  if (i == 2) {
    if (warning_count == 0) {
      fprintf(stderr, "Warning: rt == vt (CodeTable 1.2)\n");
      warning_count++;
    }
    return 0;
  }
  if (i == 3) {
    return 0;
  }
  if (i != 0 && i != 1) {
    if (error_count == 0) {
      fprintf(stderr,
              "verifying time: Table 1.2=%d not supported "
              " using RT=analysis/start of forecast\n",
              i);
      error_count++;
    }
  }
  units = code_table_4_4(sec);
  dtime = forecast_time_in_units(sec);
  if (dtime >= 0)
    return add_time(year, month, day, hour, minute, second, (unsigned int)dtime,
                    units);
  return sub_dt(year, month, day, hour, minute, second,
                (unsigned int)(unsigned int)-dtime, units);
}


x86 assembly (clang, -O0):
<verftime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <code_table_4_0@plt>
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   10b0 <stat_proc_verf_time@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    11fe <verftime+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    138b <verftime+0x1fb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0xc,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <get_time@plt>
mov    -0x10(%rbp),%rdi
call   1090 <code_table_4_4@plt>
cmp    $0xffffffff,%eax
jne    1249 <verftime+0xb9>
movl   $0x0,-0x4(%rbp)
jmp    138b <verftime+0x1fb>
mov    -0x10(%rbp),%rdi
call   1070 <code_table_1_2@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x2,-0x40(%rbp)
jne    129e <verftime+0x10e>
cmpl   $0x0,0x2e0a(%rip)
jne    1292 <verftime+0x102>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
lea    0xd84(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2de7(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2dde(%rip)
movl   $0x0,-0x4(%rbp)
jmp    138b <verftime+0x1fb>
cmpl   $0x3,-0x40(%rbp)
jne    12b4 <verftime+0x124>
movl   $0x0,-0x4(%rbp)
jmp    138b <verftime+0x1fb>
cmpl   $0x0,-0x40(%rbp)
je     1303 <verftime+0x173>
cmpl   $0x1,-0x40(%rbp)
je     1303 <verftime+0x173>
cmpl   $0x0,0x2d9d(%rip)
jne    12fe <verftime+0x16e>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
lea    0xd3b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d77(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2d6e(%rip)
jmp    1303 <verftime+0x173>
mov    -0x10(%rbp),%rdi
call   1090 <code_table_4_4@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <forecast_time_in_units@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jl     1359 <verftime+0x1c9>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    0x10(%rbp),%r9
mov    -0x48(%rbp),%r10d
mov    -0x3c(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <add_time@plt>
mov    %eax,-0x4(%rbp)
jmp    138b <verftime+0x1fb>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    0x10(%rbp),%r9
xor    %r10d,%r10d
sub    -0x48(%rbp),%r10d
mov    -0x3c(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1060 <sub_dt@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verftime>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r12
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%r15
call   1080 <code_table_4_0@plt>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %r12,%r8
mov    %r14,%r9
push   0x48(%rsp)
call   10b0 <stat_proc_verf_time@plt>
add    $0x10,%rsp
test   %eax,%eax
je     1247 <verftime+0xb7>
mov    0x8(%r15),%rdi
add    $0xc,%rdi
sub    $0x8,%rsp
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %r12,%r8
mov    %r14,%r9
push   0x48(%rsp)
call   1040 <get_time@plt>
add    $0x10,%rsp
mov    %r15,%rdi
call   1090 <code_table_4_4@plt>
cmp    $0xffffffff,%eax
je     1247 <verftime+0xb7>
mov    %r15,%rdi
call   1070 <code_table_1_2@plt>
cmp    $0x3,%eax
je     1247 <verftime+0xb7>
cmp    $0x2,%eax
jne    1258 <verftime+0xc8>
cmpl   $0x0,0x2e49(%rip)
jne    1247 <verftime+0xb7>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xdc7(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
addl   $0x1,0x2e29(%rip)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
jb     1283 <verftime+0xf3>
cmpl   $0x0,0x2e0b(%rip)
jne    1283 <verftime+0xf3>
mov    0x2d76(%rip),%rcx
mov    (%rcx),%edi
lea    0xdb0(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
addl   $0x1,0x2de9(%rip)
mov    %r15,%rdi
call   1090 <code_table_4_4@plt>
mov    %rax,(%rsp)
mov    %r15,%rdi
call   10a0 <forecast_time_in_units@plt>
test   %eax,%eax
js     12ba <verftime+0x12a>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r14,%r8
mov    0x40(%rsp),%r9
push   (%rsp)
push   %rax
call   1030 <add_time@plt>
jmp    12d9 <verftime+0x149>
neg    %eax
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r14,%r8
mov    0x40(%rsp),%r9
push   (%rsp)
push   %rax
call   1060 <sub_dt@plt>
add    $0x18,%rsp
jmp    124d <verftime+0xbd>

LLVM IR (-O0):
@verftime.error_count = internal global i32 0
@verftime.warning_count = internal global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"Warning: rt == vt (CodeTable 1.2)\0A\00"
@.str.1 = [81 x i8] c"verifying time: Table 1.2=%d not supported using RT=analysis/start of forecast\0A\00"
define i32 @verftime(i8** %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i8** %0, i8*** %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store i32* %3, i32** %12
store i32* %4, i32** %13
store i32* %5, i32** %14
store i32* %6, i32** %15
%20 = load i8**, i8*** %9
%21 = call i32 @code_table_4_0(i8** %20)
store i32 %21, i32* %17
%22 = load i8**, i8*** %9
%23 = load i32*, i32** %10
%24 = load i32*, i32** %11
%25 = load i32*, i32** %12
%26 = load i32*, i32** %13
%27 = load i32*, i32** %14
%28 = load i32*, i32** %15
%29 = call i32 @stat_proc_verf_time(i8** %22, i32* %23, i32* %24, i32* %25, i32* %26, i32* %27, i32* %28)
store i32 %29, i32* %18
%30 = load i32, i32* %18
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %7
store i32 0, i32* %8
br label %111
33: ; preds = %7
%34 = load i8**, i8*** %9
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = getelementptr inbounds i8, i8* %36, i64 12
%38 = load i32*, i32** %10
%39 = load i32*, i32** %11
%40 = load i32*, i32** %12
%41 = load i32*, i32** %13
%42 = load i32*, i32** %14
%43 = load i32*, i32** %15
%44 = call i32 @get_time(i8* %37, i32* %38, i32* %39, i32* %40, i32* %41, i32* %42, i32* %43)
%45 = load i8**, i8*** %9
%46 = call i32 @code_table_4_4(i8** %45)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %49
48: ; preds = %33
store i32 0, i32* %8
br label %111
49: ; preds = %33
%50 = load i8**, i8*** %9
%51 = call i32 @code_table_1_2(i8** %50)
store i32 %51, i32* %17
%52 = load i32, i32* %17
%53 = icmp eq i32 %52, 2
br i1 %53, label %54, label %63
54: ; preds = %49
%55 = load i32, i32* @verftime.warning_count
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%60 = load i32, i32* @verftime.warning_count
%61 = add nsw i32 %60, 1
store i32 %61, i32* @verftime.warning_count
br label %62
62: ; preds = %57, %54
store i32 0, i32* %8
br label %111
63: ; preds = %49
%64 = load i32, i32* %17
%65 = icmp eq i32 %64, 3
br i1 %65, label %66, label %67
66: ; preds = %63
store i32 0, i32* %8
br label %111
67: ; preds = %63
%68 = load i32, i32* %17
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %83
70: ; preds = %67
%71 = load i32, i32* %17
%72 = icmp ne i32 %71, 1
br i1 %72, label %73, label %83
73: ; preds = %70
%74 = load i32, i32* @verftime.error_count
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load i32, i32* @stderr
%78 = load i32, i32* %17
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0), i32 %78)
%80 = load i32, i32* @verftime.error_count
%81 = add nsw i32 %80, 1
store i32 %81, i32* @verftime.error_count
br label %82
82: ; preds = %76, %73
br label %83
83: ; preds = %82, %70, %67
%84 = load i8**, i8*** %9
%85 = call i32 @code_table_4_4(i8** %84)
store i32 %85, i32* %16
%86 = load i8**, i8*** %9
%87 = call i32 @forecast_time_in_units(i8** %86)
store i32 %87, i32* %19
%88 = load i32, i32* %19
%89 = icmp sge i32 %88, 0
br i1 %89, label %90, label %100
90: ; preds = %83
%91 = load i32*, i32** %10
%92 = load i32*, i32** %11
%93 = load i32*, i32** %12
%94 = load i32*, i32** %13
%95 = load i32*, i32** %14
%96 = load i32*, i32** %15
%97 = load i32, i32* %19
%98 = load i32, i32* %16
%99 = call i32 @add_time(i32* %91, i32* %92, i32* %93, i32* %94, i32* %95, i32* %96, i32 %97, i32 %98)
store i32 %99, i32* %8
br label %111
100: ; preds = %83
%101 = load i32*, i32** %10
%102 = load i32*, i32** %11
%103 = load i32*, i32** %12
%104 = load i32*, i32** %13
%105 = load i32*, i32** %14
%106 = load i32*, i32** %15
%107 = load i32, i32* %19
%108 = sub nsw i32 0, %107
%109 = load i32, i32* %16
%110 = call i32 @sub_dt(i32* %101, i32* %102, i32* %103, i32* %104, i32* %105, i32* %106, i32 %108, i32 %109)
store i32 %110, i32* %8
br label %111
111: ; preds = %100, %90, %66, %62, %48, %32
%112 = load i32, i32* %8
ret i32 %112
}

LLVM IR (-O2):
@verftime.error_count = internal unnamed_addr global i32 0
@verftime.warning_count = internal unnamed_addr global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"Warning: rt == vt (CodeTable 1.2)\0A\00"
@.str.1 = [81 x i8] c"verifying time: Table 1.2=%d not supported using RT=analysis/start of forecast\0A\00"
define i32 @verftime(i8** %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = tail call i32 @code_table_4_0(i8** %0)
%9 = tail call i32 @stat_proc_verf_time(i8** %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %47, label %11
11: ; preds = %7
%12 = getelementptr inbounds i8*, i8** %0, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 12
%15 = tail call i32 @get_time(i8* %14, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%16 = tail call i32 @code_table_4_4(i8** %0)
%17 = icmp eq i32 %16, -1
br i1 %17, label %47, label %18
18: ; preds = %11
%19 = tail call i32 @code_table_1_2(i8** %0)
switch i32 %19, label %28 [
i32 2, label %20
i32 3, label %47
]
20: ; preds = %18
%21 = load i32, i32* @verftime.warning_count
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %47
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%26 = load i32, i32* @verftime.warning_count
%27 = add nsw i32 %26, 1
store i32 %27, i32* @verftime.warning_count
br label %47
28: ; preds = %18
%29 = icmp ugt i32 %19, 1
%30 = load i32, i32* @verftime.error_count
%31 = icmp eq i32 %30, 0
%32 = select i1 %29, i1 %31, i1 false
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%36 = load i32, i32* @verftime.error_count
%37 = add nsw i32 %36, 1
store i32 %37, i32* @verftime.error_count
br label %38
38: ; preds = %33, %28
%39 = tail call i32 @code_table_4_4(i8** %0)
%40 = tail call i32 @forecast_time_in_units(i8** %0)
%41 = icmp sgt i32 %40, -1
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = tail call i32 @add_time(i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32 %40, i32 %39)
br label %47
44: ; preds = %38
%45 = sub nsw i32 0, %40
%46 = tail call i32 @sub_dt(i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32 %45, i32 %39)
br label %47
47: ; preds = %18, %20, %23, %11, %7, %44, %42
%48 = phi i32 [ %43, %42 ], [ %46, %44 ], [ 0, %7 ], [ 0, %11 ], [ 0, %23 ], [ 0, %20 ], [ 0, %18 ]
ret i32 %48
}