; LLVM IR from specinfo-ua/UAPKI :: library/common/pkix (time-util)

; 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"

%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr }

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 align 2

declare i64 @asn_tm2msec(ptr noundef, i32 noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN8TimeUtil12stimeToMtimeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERm(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.tm, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  %9 = icmp ne i64 %8, 14
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  store i32 4101, ptr %3, align 4
  br label %47

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 56, ptr %6) #4
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %12, i64 noundef 0) #4
  %14 = call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef %13)
  %15 = mul nsw i32 %14, 100
  %16 = getelementptr inbounds %struct.tm, ptr %6, i32 0, i32 5
  store i32 %15, ptr %16, align 4, !tbaa !9
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %17, i64 noundef 2) #4
  %19 = call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef %18)
  %20 = sub nsw i32 %19, 1900
  %21 = getelementptr inbounds %struct.tm, ptr %6, i32 0, i32 5
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = add nsw i32 %22, %20
  store i32 %23, ptr %21, align 4, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %24, i64 noundef 4) #4
  %26 = call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef %25)
  %27 = sub nsw i32 %26, 1
  %28 = getelementptr inbounds %struct.tm, ptr %6, i32 0, i32 4
  store i32 %27, ptr %28, align 8, !tbaa !13
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %29, i64 noundef 6) #4
  %31 = call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef %30)
  %32 = getelementptr inbounds %struct.tm, ptr %6, i32 0, i32 3
  store i32 %31, ptr %32, align 4, !tbaa !14
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %33, i64 noundef 8) #4
  %35 = call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef %34)
  %36 = getelementptr inbounds %struct.tm, ptr %6, i32 0, i32 2
  store i32 %35, ptr %36, align 8, !tbaa !15
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %37, i64 noundef 10) #4
  %39 = call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef %38)
  %40 = getelementptr inbounds %struct.tm, ptr %6, i32 0, i32 1
  store i32 %39, ptr %40, align 4, !tbaa !16
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %41, i64 noundef 12) #4
  %43 = call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef %42)
  %44 = getelementptr inbounds %struct.tm, ptr %6, i32 0, i32 0
  store i32 %43, ptr %44, align 8, !tbaa !17
  %45 = call i64 @asn_tm2msec(ptr noundef %6, i32 noundef 0)
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %45, ptr %46, align 8, !tbaa !18
  store i32 0, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 56, ptr %6) #4
  br label %47

47:                                               ; preds = %11, %10
  %48 = load i32, ptr %3, align 4
  ret i32 %48
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { "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 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 #4 = { nounwind }

!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++ TBAA"}
!9 = !{!10, !11, i64 20}
!10 = !{!"_ZTS2tm", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !12, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !11, i64 16}
!14 = !{!10, !11, i64 12}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !11, i64 4}
!17 = !{!10, !11, i64 0}
!18 = !{!12, !12, i64 0}


; 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"

%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr }

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 align 2

declare i64 @asn_tm2msec(ptr noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 4102) i32 @_ZN8TimeUtil12stimeToMtimeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERm(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %1) local_unnamed_addr #3 {
  %3 = alloca %struct.tm, align 8
  %4 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %.not = icmp eq i64 %4, 14
  br i1 %.not, label %5, label %30

5:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #4
  %6 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0) #4
  %7 = tail call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef nonnull %6)
  %8 = mul nsw i32 %7, 100
  %9 = getelementptr inbounds i8, ptr %3, i64 20
  %10 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 2) #4
  %11 = tail call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef nonnull %10)
  %12 = add nsw i32 %11, -1900
  %13 = add nsw i32 %12, %8
  store i32 %13, ptr %9, align 4, !tbaa !5
  %14 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 4) #4
  %15 = tail call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef nonnull %14)
  %16 = add nsw i32 %15, -1
  %17 = getelementptr inbounds i8, ptr %3, i64 16
  store i32 %16, ptr %17, align 8, !tbaa !12
  %18 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 6) #4
  %19 = tail call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef nonnull %18)
  %20 = getelementptr inbounds i8, ptr %3, i64 12
  store i32 %19, ptr %20, align 4, !tbaa !13
  %21 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 8) #4
  %22 = tail call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef nonnull %21)
  %23 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %22, ptr %23, align 8, !tbaa !14
  %24 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 10) #4
  %25 = tail call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef nonnull %24)
  %26 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %25, ptr %26, align 4, !tbaa !15
  %27 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 12) #4
  %28 = tail call noundef i32 @_ZL17two_digits_to_intPKc(ptr noundef nonnull %27)
  store i32 %28, ptr %3, align 8, !tbaa !16
  %29 = call i64 @asn_tm2msec(ptr noundef nonnull %3, i32 noundef 0)
  store i64 %29, ptr %1, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #4
  br label %30

30:                                               ; preds = %2, %5
  %.0 = phi i32 [ 0, %5 ], [ 4101, %2 ]
  ret i32 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { "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 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 #4 = { nounwind }

!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, !7, i64 20}
!6 = !{!"_ZTS2tm", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !10, i64 40, !11, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !7, i64 12}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !7, i64 4}
!16 = !{!6, !7, i64 0}
!17 = !{!10, !10, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass