; LLVM IR from NOAA-PMEL/Ferret :: external_functions/date_and_time (date_decode)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@__const.date_decode_.months = external hidden unnamed_addr constant [13 x [4 x i8]], align 16
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local float @date_decode_(ptr noundef %0) #0 {
  %2 = alloca float, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca [4 x i8], align 1
  %9 = alloca [2 x i8], align 1
  %10 = alloca [13 x [4 x i8]], align 16
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 52, ptr %10) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %10, ptr align 16 @__const.date_decode_.months, i64 52, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store double 6.939610e+05, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds [2 x i8], ptr %9, i64 0, i64 0
  %15 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %13, ptr noundef @.str, ptr noundef %5, ptr noundef %4, ptr noundef %6, ptr noundef %14) #6
  %16 = icmp eq i32 %15, 3
  br i1 %16, label %17, label %18

17:                                               ; preds = %1
  store i32 1, ptr %7, align 4, !tbaa !11
  br label %66

18:                                               ; preds = %1
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds [2 x i8], ptr %9, i64 0, i64 0
  %21 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %19, ptr noundef @.str.1, ptr noundef %6, ptr noundef %5, ptr noundef %4, ptr noundef %20) #6
  %22 = icmp eq i32 %21, 3
  br i1 %22, label %23, label %24

23:                                               ; preds = %18
  store i32 1, ptr %7, align 4, !tbaa !11
  br label %65

24:                                               ; preds = %18
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 0
  %27 = getelementptr inbounds [2 x i8], ptr %9, i64 0, i64 0
  %28 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %25, ptr noundef @.str.2, ptr noundef %4, ptr noundef %26, ptr noundef %6, ptr noundef %27) #6
  %29 = icmp eq i32 %28, 3
  br i1 %29, label %30, label %63

30:                                               ; preds = %24
  %31 = load i32, ptr %6, align 4, !tbaa !11
  %32 = icmp slt i32 %31, 30
  br i1 %32, label %33, label %36

33:                                               ; preds = %30
  %34 = load i32, ptr %6, align 4, !tbaa !11
  %35 = add nsw i32 %34, 2000
  store i32 %35, ptr %6, align 4, !tbaa !11
  br label %43

36:                                               ; preds = %30
  %37 = load i32, ptr %6, align 4, !tbaa !11
  %38 = icmp slt i32 %37, 100
  br i1 %38, label %39, label %42

39:                                               ; preds = %36
  %40 = load i32, ptr %6, align 4, !tbaa !11
  %41 = add nsw i32 %40, 1900
  store i32 %41, ptr %6, align 4, !tbaa !11
  br label %42

42:                                               ; preds = %39, %36
  br label %43

43:                                               ; preds = %42, %33
  store i32 0, ptr %7, align 4, !tbaa !11
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %44

44:                                               ; preds = %59, %43
  %45 = load i32, ptr %5, align 4, !tbaa !11
  %46 = icmp slt i32 %45, 12
  br i1 %46, label %47, label %62

47:                                               ; preds = %44
  %48 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 0
  %49 = load i32, ptr %5, align 4, !tbaa !11
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [13 x [4 x i8]], ptr %10, i64 0, i64 %50
  %52 = getelementptr inbounds [4 x i8], ptr %51, i64 0, i64 0
  %53 = call i32 @strcasecmp(ptr noundef %48, ptr noundef %52) #7
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %58

55:                                               ; preds = %47
  %56 = load i32, ptr %5, align 4, !tbaa !11
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %5, align 4, !tbaa !11
  store i32 1, ptr %7, align 4, !tbaa !11
  br label %62

58:                                               ; preds = %47
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %5, align 4, !tbaa !11
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %5, align 4, !tbaa !11
  br label %44, !llvm.loop !13

62:                                               ; preds = %55, %44
  br label %64

63:                                               ; preds = %24
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %64

64:                                               ; preds = %63, %62
  br label %65

65:                                               ; preds = %64, %23
  br label %66

66:                                               ; preds = %65, %17
  %67 = load i32, ptr %7, align 4, !tbaa !11
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %71

69:                                               ; preds = %66
  %70 = call float @days_from_day0_(ptr noundef %11, ptr noundef %6, ptr noundef %5, ptr noundef %4)
  store float %70, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %72

71:                                               ; preds = %66
  store float 0xC6FED09BE0000000, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %72

72:                                               ; preds = %71, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 52, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %73 = load float, ptr %2, align 4
  ret float %73
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcasecmp(ptr noundef, ptr noundef) #4

declare float @days_from_day0_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@__const.date_decode_.months = external hidden unnamed_addr constant [13 x [4 x i8]], align 16
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local float @date_decode_(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [4 x i8], align 1
  %6 = alloca [2 x i8], align 1
  %7 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store double 6.939610e+05, ptr %7, align 8, !tbaa !5
  %8 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %3, ptr noundef nonnull %2, ptr noundef nonnull %4, ptr noundef nonnull %6) #5
  %9 = icmp eq i32 %8, 3
  br i1 %9, label %.critedge, label %10

10:                                               ; preds = %1
  %11 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %2, ptr noundef nonnull %6) #5
  %12 = icmp eq i32 %11, 3
  br i1 %12, label %.critedge, label %13

13:                                               ; preds = %10
  %14 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef nonnull %2, ptr noundef nonnull %5, ptr noundef nonnull %4, ptr noundef nonnull %6) #5
  %15 = icmp eq i32 %14, 3
  br i1 %15, label %16, label %.loopexit

16:                                               ; preds = %13
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 30
  br i1 %18, label %19, label %21

19:                                               ; preds = %16
  %20 = add nsw i32 %17, 2000
  store i32 %20, ptr %4, align 4, !tbaa !9
  br label %25

21:                                               ; preds = %16
  %22 = icmp ult i32 %17, 100
  br i1 %22, label %23, label %25

23:                                               ; preds = %21
  %24 = add nuw nsw i32 %17, 1900
  store i32 %24, ptr %4, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %21, %23, %19
  store i32 0, ptr %3, align 4, !tbaa !9
  %26 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull @__const.date_decode_.months) #6
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %59, %56, %53, %50, %47, %44, %41, %38, %35, %32, %29, %25
  %storemerge8.lcssa.wide = phi i32 [ 1, %25 ], [ 2, %29 ], [ 3, %32 ], [ 4, %35 ], [ 5, %38 ], [ 6, %41 ], [ 7, %44 ], [ 8, %47 ], [ 9, %50 ], [ 10, %53 ], [ 11, %56 ], [ 12, %59 ]
  store i32 %storemerge8.lcssa.wide, ptr %3, align 4, !tbaa !9
  br label %.critedge

29:                                               ; preds = %25
  store i32 1, ptr %3, align 4, !tbaa !9
  %30 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 4)) #6
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %28, label %32

32:                                               ; preds = %29
  store i32 2, ptr %3, align 4, !tbaa !9
  %33 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 8)) #6
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %28, label %35

35:                                               ; preds = %32
  store i32 3, ptr %3, align 4, !tbaa !9
  %36 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 12)) #6
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %28, label %38

38:                                               ; preds = %35
  store i32 4, ptr %3, align 4, !tbaa !9
  %39 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 16)) #6
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %28, label %41

41:                                               ; preds = %38
  store i32 5, ptr %3, align 4, !tbaa !9
  %42 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 20)) #6
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %28, label %44

44:                                               ; preds = %41
  store i32 6, ptr %3, align 4, !tbaa !9
  %45 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 24)) #6
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %28, label %47

47:                                               ; preds = %44
  store i32 7, ptr %3, align 4, !tbaa !9
  %48 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 28)) #6
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %28, label %50

50:                                               ; preds = %47
  store i32 8, ptr %3, align 4, !tbaa !9
  %51 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 32)) #6
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %28, label %53

53:                                               ; preds = %50
  store i32 9, ptr %3, align 4, !tbaa !9
  %54 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 36)) #6
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %28, label %56

56:                                               ; preds = %53
  store i32 10, ptr %3, align 4, !tbaa !9
  %57 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 40)) #6
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %28, label %59

59:                                               ; preds = %56
  store i32 11, ptr %3, align 4, !tbaa !9
  %60 = call i32 @strcasecmp(ptr noundef nonnull %5, ptr noundef nonnull getelementptr inbounds (i8, ptr @__const.date_decode_.months, i64 44)) #6
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %28, label %.loopexit

.critedge:                                        ; preds = %10, %1, %28
  %62 = call float @days_from_day0_(ptr noundef nonnull %7, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef nonnull %2) #5
  br label %.loopexit

.loopexit:                                        ; preds = %59, %13, %.critedge
  %.04 = phi float [ %62, %.critedge ], [ 0xC6FED09BE0000000, %13 ], [ 0xC6FED09BE0000000, %59 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  ret float %.04
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare i32 @strcasecmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

declare float @days_from_day0_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass