#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 code_table_4_4(unsigned char **);
int /*<<< orphan*/ *code_table_4_4_location(unsigned char **);
int forecast_time_in_units(unsigned char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ ftime2_tr(unsigned char **, char *, unsigned char *, int,
                             int, int /*<<< orphan*/, int, int *);
scalar_t__ is_missing(unsigned char *, int);
int /*<<< orphan*/ print_ftime2(int, int, int /*<<< orphan*/,
                                int /*<<< orphan*/, int, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
unsigned char *stat_proc_verf_time_location(unsigned char **);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
int uint4(unsigned char *);
int ftime2(unsigned char **sec, char *inv_out, int mode) {
  int fcst_time, fcst_unit;
  unsigned char *verf_time;
  int prt_missing;
  if (mode == 99)
    fprintf(stdout, "ProdDefTemplateNo=%d\n",
            (((int)((sec[4][7] << 8) + (sec[4][8])))));
  if (code_table_4_4_location(sec) == NULL) {
    sprintf(inv_out, "anl");
    return 0;
  }
  if ((fcst_unit = code_table_4_4(sec)) < 0)
    return -1;
  fcst_time = forecast_time_in_units(sec);
  verf_time = stat_proc_verf_time_location(sec);
  if (verf_time == NULL) {
    if (fcst_time == 0) {
      sprintf(inv_out, "anl");
    } else {
      print_ftime2(fcst_unit, fcst_time, 0, 0, 1, inv_out);
      inv_out += strlen(inv_out);
      sprintf(inv_out, " fcst");
      inv_out += strlen(inv_out);
    }
    return 0;
  }
  prt_missing = 0;
  ftime2_tr(sec, inv_out, verf_time, fcst_time, fcst_unit, 0, mode,
            &prt_missing);
  if (prt_missing) {
    inv_out += strlen(inv_out);
    if (is_missing(verf_time + 8, 4))
      sprintf(inv_out, ",missing=-1");
    else {
      sprintf(inv_out, ",missing=%u", uint4(verf_time + 8));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<ftime2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x63,-0x1c(%rbp)
jne    11ff <ftime2+0x4f>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movzbl 0x7(%rax),%edx
shl    $0x8,%edx
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movzbl 0x8(%rax),%eax
add    %eax,%edx
lea    0xe06(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <code_table_4_4_location@plt>
cmp    $0x0,%rax
jne    1230 <ftime2+0x80>
mov    -0x18(%rbp),%rdi
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13bd <ftime2+0x20d>
mov    -0x10(%rbp),%rdi
call   1090 <code_table_4_4@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    1251 <ftime2+0xa1>
movl   $0xffffffff,-0x4(%rbp)
jmp    13bd <ftime2+0x20d>
mov    -0x10(%rbp),%rdi
call   10a0 <forecast_time_in_units@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <stat_proc_verf_time_location@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12ff <ftime2+0x14f>
cmpl   $0x0,-0x20(%rbp)
jne    1296 <ftime2+0xe6>
mov    -0x18(%rbp),%rdi
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
jmp    12f3 <ftime2+0x143>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%r9
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %ecx,%edx
call   10d0 <print_ftime2@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xd47(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    13bd <ftime2+0x20d>
movl   $0x0,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x1c(%rbp),%r10d
xor    %r9d,%r9d
lea    -0x34(%rbp),%rax
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1070 <ftime2_tr@plt>
cmpl   $0x0,-0x34(%rbp)
je     13b6 <ftime2+0x206>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x8,%rdi
mov    $0x4,%esi
call   1030 <is_missing@plt>
cmp    $0x0,%rax
je     1388 <ftime2+0x1d8>
mov    -0x18(%rbp),%rdi
lea    0xca4(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
jmp    13b1 <ftime2+0x201>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x8,%rdi
call   1040 <uint4@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%edx
lea    0xc82(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
jmp    13b6 <ftime2+0x206>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftime2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r13d
mov    %rsi,%r15
mov    %rdi,%rbx
cmp    $0x63,%edx
jne    11eb <ftime2+0x3b>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    0x20(%rbx),%rax
movzwl 0x7(%rax),%edx
shl    $0x10,%edx
bswap  %edx
lea    0xe1a(%rip),%rsi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   10c0 <code_table_4_4_location@plt>
test   %rax,%rax
je     12e8 <ftime2+0x138>
mov    %rbx,%rdi
call   1090 <code_table_4_4@plt>
test   %eax,%eax
js     129c <ftime2+0xec>
mov    %eax,%ebp
mov    %rbx,%rdi
call   10a0 <forecast_time_in_units@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1080 <stat_proc_verf_time_location@plt>
test   %rax,%rax
je     12a4 <ftime2+0xf4>
mov    %rax,%r12
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rax
mov    %r14d,%ecx
xor    %r14d,%r14d
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %ebp,%r8d
xor    %r9d,%r9d
push   %rax
push   %r13
call   1070 <ftime2_tr@plt>
add    $0x10,%rsp
cmpl   $0x0,0x4(%rsp)
je     12f2 <ftime2+0x142>
mov    %r15,%rdi
call   1050 <strlen@plt>
movslq %eax,%rbx
add    %r15,%rbx
add    $0x8,%r12
mov    %r12,%rdi
mov    $0x4,%esi
call   1030 <is_missing@plt>
test   %rax,%rax
je     1304 <ftime2+0x154>
movabs $0x676e697373696d2c,%rax
69 6e 67
mov    %rax,(%rbx)
movl   $0x312d3d,0x8(%rbx)
jmp    12f2 <ftime2+0x142>
mov    $0xffffffff,%r14d
jmp    12f2 <ftime2+0x142>
test   %r14d,%r14d
je     12e8 <ftime2+0x138>
mov    %r14d,%esi
xor    %r14d,%r14d
mov    %ebp,%edi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    %r15,%r9
call   10d0 <print_ftime2@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
cltq
lea    (%r15,%rax,1),%rdi
movl   $0x73636620,(%r15,%rax,1)
73
movw   $0x74,0x4(%r15,%rax,1)
call   1050 <strlen@plt>
jmp    12f2 <ftime2+0x142>
movl   $0x6c6e61,(%r15)
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   1040 <uint4@plt>
lea    0xd15(%rip),%rsi
xor    %r14d,%r14d
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   10b0 <sprintf@plt>
jmp    12f2 <ftime2+0x142>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [22 x i8] c"ProdDefTemplateNo=%d\0A\00"
@.str.1 = [4 x i8] c"anl\00"
@.str.2 = [6 x i8] c" fcst\00"
@.str.3 = [12 x i8] c",missing=-1\00"
@.str.4 = [12 x i8] c",missing=%u\00"
define i32 @ftime2(i8** %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store i8** %0, i8*** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 99
br i1 %13, label %14, label %31
14: ; preds = %3
%15 = load i32, i32* @stdout
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 4
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i64 7
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = shl i32 %21, 8
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 4
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i64 8
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = add nsw i32 %22, %28
%30 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %14, %3
%32 = load i8**, i8*** %5
%33 = call i32* @code_table_4_4_location(i8** %32)
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i8*, i8** %6
%37 = call i32 (i8*, i8*, ...) @sprintf(i8* %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %105
38: ; preds = %31
%39 = load i8**, i8*** %5
%40 = call i32 @code_table_4_4(i8** %39)
store i32 %40, i32* %9
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 -1, i32* %4
br label %105
43: ; preds = %38
%44 = load i8**, i8*** %5
%45 = call i32 @forecast_time_in_units(i8** %44)
store i32 %45, i32* %8
%46 = load i8**, i8*** %5
%47 = call i8* @stat_proc_verf_time_location(i8** %46)
store i8* %47, i8** %10
%48 = load i8*, i8** %10
%49 = icmp eq i8* %48, null
br i1 %49, label %50, label %74
50: ; preds = %43
%51 = load i32, i32* %8
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i8*, i8** %6
%55 = call i32 (i8*, i8*, ...) @sprintf(i8* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %73
56: ; preds = %50
%57 = load i32, i32* %9
%58 = load i32, i32* %8
%59 = load i8*, i8** %6
%60 = call i32 @print_ftime2(i32 %57, i32 %58, i32 0, i32 0, i32 1, i8* %59)
%61 = load i8*, i8** %6
%62 = call i32 @strlen(i8* %61)
%63 = load i8*, i8** %6
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds i8, i8* %63, i64 %64
store i8* %65, i8** %6
%66 = load i8*, i8** %6
%67 = call i32 (i8*, i8*, ...) @sprintf(i8* %66, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%68 = load i8*, i8** %6
%69 = call i32 @strlen(i8* %68)
%70 = load i8*, i8** %6
%71 = sext i32 %69 to i64
%72 = getelementptr inbounds i8, i8* %70, i64 %71
store i8* %72, i8** %6
br label %73
73: ; preds = %56, %53
store i32 0, i32* %4
br label %105
74: ; preds = %43
store i32 0, i32* %11
%75 = load i8**, i8*** %5
%76 = load i8*, i8** %6
%77 = load i8*, i8** %10
%78 = load i32, i32* %8
%79 = load i32, i32* %9
%80 = load i32, i32* %7
%81 = call i32 @ftime2_tr(i8** %75, i8* %76, i8* %77, i32 %78, i32 %79, i32 0, i32 %80, i32* %11)
%82 = load i32, i32* %11
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %104
84: ; preds = %74
%85 = load i8*, i8** %6
%86 = call i32 @strlen(i8* %85)
%87 = load i8*, i8** %6
%88 = sext i32 %86 to i64
%89 = getelementptr inbounds i8, i8* %87, i64 %88
store i8* %89, i8** %6
%90 = load i8*, i8** %10
%91 = getelementptr inbounds i8, i8* %90, i64 8
%92 = call i64 @is_missing(i8* %91, i32 4)
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %84
%95 = load i8*, i8** %6
%96 = call i32 (i8*, i8*, ...) @sprintf(i8* %95, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %103
97: ; preds = %84
%98 = load i8*, i8** %6
%99 = load i8*, i8** %10
%100 = getelementptr inbounds i8, i8* %99, i64 8
%101 = call i32 @uint4(i8* %100)
%102 = call i32 (i8*, i8*, ...) @sprintf(i8* %98, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %101)
br label %103
103: ; preds = %97, %94
br label %104
104: ; preds = %103, %74
store i32 0, i32* %4
br label %105
105: ; preds = %104, %73, %42, %35
%106 = load i32, i32* %4
ret i32 %106
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [22 x i8] c"ProdDefTemplateNo=%d\0A\00"
@.str.2 = [6 x i8] c" fcst\00"
@.str.3 = [12 x i8] c",missing=-1\00"
@.str.4 = [12 x i8] c",missing=%u\00"
define i32 @ftime2(i8** %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = icmp eq i32 %2, 99
br i1 %6, label %7, label %20
7: ; preds = %3
%8 = load i32, i32* @stdout
%9 = getelementptr inbounds i8*, i8** %0, i64 4
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8, i8* %10, i64 7
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 8
%15 = getelementptr inbounds i8, i8* %10, i64 8
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
%19 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %7, %3
%21 = tail call i32* @code_table_4_4_location(i8** %0)
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = bitcast i8* %1 to i32*
store i32 7106145, i32* %24
br label %57
25: ; preds = %20
%26 = tail call i32 @code_table_4_4(i8** %0)
%27 = icmp slt i32 %26, 0
br i1 %27, label %57, label %28
28: ; preds = %25
%29 = tail call i32 @forecast_time_in_units(i8** %0)
%30 = tail call i8* @stat_proc_verf_time_location(i8** %0)
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %42
32: ; preds = %28
%33 = icmp eq i32 %29, 0
br i1 %33, label %34, label %36
34: ; preds = %32
%35 = bitcast i8* %1 to i32*
store i32 7106145, i32* %35
br label %57
36: ; preds = %32
%37 = tail call i32 @print_ftime2(i32 %26, i32 %29, i32 0, i32 0, i32 1, i8* %1)
%38 = tail call i32 @strlen(i8* %1)
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %1, i64 %39
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %40, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 6, i1 false)
%41 = tail call i32 @strlen(i8* %40)
br label %57
42: ; preds = %28
store i32 0, i32* %4
%43 = call i32 @ftime2_tr(i8** %0, i8* %1, i8* %30, i32 %29, i32 %26, i32 0, i32 %2, i32* %4)
%44 = load i32, i32* %4
%45 = icmp eq i32 %44, 0
br i1 %45, label %57, label %46
46: ; preds = %42
%47 = call i32 @strlen(i8* %1)
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %1, i64 %48
%50 = getelementptr inbounds i8, i8* %30, i64 8
%51 = call i64 @is_missing(i8* %50, i32 4)
%52 = icmp eq i64 %51, 0
br i1 %52, label %54, label %53
53: ; preds = %46
br label %57
54: ; preds = %46
%55 = call i32 @uint4(i8* %50)
%56 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %49, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %42, %54, %53, %34, %36, %25, %23
%58 = phi i32 [ 0, %23 ], [ -1, %25 ], [ 0, %36 ], [ 0, %34 ], [ 0, %53 ], [ 0, %54 ], [ 0, %42 ]
ret i32 %58
}