; LLVM IR from specinfo-ua/UAPKI :: library/uapkif/src/asn1 (asn1-utils)

; 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 }
%struct.OCTET_STRING = type { ptr, i32, %struct.asn_struct_ctx_s }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @asn_check_tm(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @asn_tm2msec(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @asn_UT2time(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.tm, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr %6) #3
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 56, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %13

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  br label %14

13:                                               ; preds = %2
  br label %14

14:                                               ; preds = %13, %11
  %15 = phi ptr [ %12, %11 ], [ %6, %13 ]
  store ptr %15, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %36

18:                                               ; preds = %14
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.OCTET_STRING, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %36

23:                                               ; preds = %18
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.OCTET_STRING, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !15
  %27 = icmp ne i32 %26, 13
  br i1 %27, label %36, label %28

28:                                               ; preds = %23
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.OCTET_STRING, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds i8, ptr %31, i64 12
  %33 = load i8, ptr %32, align 1, !tbaa !16
  %34 = zext i8 %33 to i32
  %35 = icmp ne i32 %34, 90
  br i1 %35, label %36, label %37

36:                                               ; preds = %28, %23, %18, %14
  store i64 0, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %113

37:                                               ; preds = %28
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.tm, ptr %38, i32 0, i32 5
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.OCTET_STRING, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %42, i64 0
  %44 = call zeroext i1 @b2t(ptr noundef %39, ptr noundef %43)
  br i1 %44, label %45, label %85

45:                                               ; preds = %37
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.tm, ptr %46, i32 0, i32 4
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.OCTET_STRING, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds i8, ptr %50, i64 2
  %52 = call zeroext i1 @b2t(ptr noundef %47, ptr noundef %51)
  br i1 %52, label %53, label %85

53:                                               ; preds = %45
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.tm, ptr %54, i32 0, i32 3
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.OCTET_STRING, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds i8, ptr %58, i64 4
  %60 = call zeroext i1 @b2t(ptr noundef %55, ptr noundef %59)
  br i1 %60, label %61, label %85

61:                                               ; preds = %53
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.tm, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.OCTET_STRING, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = getelementptr inbounds i8, ptr %66, i64 6
  %68 = call zeroext i1 @b2t(ptr noundef %63, ptr noundef %67)
  br i1 %68, label %69, label %85

69:                                               ; preds = %61
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.tm, ptr %70, i32 0, i32 1
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.OCTET_STRING, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = getelementptr inbounds i8, ptr %74, i64 8
  %76 = call zeroext i1 @b2t(ptr noundef %71, ptr noundef %75)
  br i1 %76, label %77, label %85

77:                                               ; preds = %69
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.tm, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.OCTET_STRING, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = getelementptr inbounds i8, ptr %82, i64 10
  %84 = call zeroext i1 @b2t(ptr noundef %79, ptr noundef %83)
  br i1 %84, label %86, label %85

85:                                               ; preds = %77, %69, %61, %53, %45, %37
  store i64 0, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %113

86:                                               ; preds = %77
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.tm, ptr %87, i32 0, i32 5
  %89 = load i32, ptr %88, align 4, !tbaa !17
  %90 = icmp slt i32 %89, 50
  %91 = zext i1 %90 to i64
  %92 = select i1 %90, i32 100, i32 0
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.tm, ptr %93, i32 0, i32 5
  %95 = load i32, ptr %94, align 4, !tbaa !17
  %96 = add nsw i32 %95, %92
  store i32 %96, ptr %94, align 4, !tbaa !17
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.tm, ptr %97, i32 0, i32 4
  %99 = load i32, ptr %98, align 8, !tbaa !19
  %100 = sub nsw i32 %99, 1
  store i32 %100, ptr %98, align 8, !tbaa !19
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.tm, ptr %101, i32 0, i32 7
  store i32 0, ptr %102, align 4, !tbaa !20
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.tm, ptr %103, i32 0, i32 6
  store i32 0, ptr %104, align 8, !tbaa !21
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.tm, ptr %105, i32 0, i32 8
  store i32 0, ptr %106, align 8, !tbaa !22
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = call zeroext i1 @asn_check_tm(ptr noundef %107)
  br i1 %108, label %110, label %109

109:                                              ; preds = %86
  store i64 0, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %113

110:                                              ; preds = %86
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = call i64 @asn_tm2msec(ptr noundef %111, i32 noundef 0)
  store i64 %112, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %113

113:                                              ; preds = %110, %109, %85, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 56, ptr %6) #3
  %114 = load i64, ptr %3, align 8
  ret i64 %114
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @b2t(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"OCTET_STRING", !6, i64 0, !11, i64 8, !12, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"asn_struct_ctx_s", !13, i64 0, !13, i64 2, !11, i64 4, !6, i64 8, !14, i64 16}
!13 = !{!"short", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !11, i64 20}
!18 = !{!"tm", !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, !14, i64 40, !6, i64 48}
!19 = !{!18, !11, i64 16}
!20 = !{!18, !11, i64 28}
!21 = !{!18, !11, i64 24}
!22 = !{!18, !11, i64 32}


; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @asn_check_tm(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @asn_tm2msec(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @asn_UT2time(ptr noundef readonly %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca %struct.tm, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #3
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %3, i8 0, i64 56, i1 false)
  %.not = icmp eq ptr %1, null
  %4 = select i1 %.not, ptr %3, ptr %1
  %.not28 = icmp eq ptr %0, null
  br i1 %.not28, label %45, label %5

5:                                                ; preds = %2
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %.not29 = icmp eq ptr %6, null
  br i1 %.not29, label %45, label %7

7:                                                ; preds = %5
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !14
  %.not30 = icmp eq i32 %9, 13
  br i1 %.not30, label %10, label %45

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %6, i64 12
  %12 = load i8, ptr %11, align 1, !tbaa !15
  %.not31 = icmp eq i8 %12, 90
  br i1 %.not31, label %13, label %45

13:                                               ; preds = %10
  %.sroa.sel.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel.v.sroa.sel.v.sroa.sel.v, i64 20
  %14 = call zeroext i1 @b2t(ptr noundef nonnull %.sroa.sel.v.sroa.sel.v.sroa.sel, ptr noundef nonnull %6)
  br i1 %14, label %15, label %45

15:                                               ; preds = %13
  %.sroa.sel35.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel35.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel35.v.sroa.sel.v.sroa.sel.v, i64 16
  %16 = load ptr, ptr %0, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 2
  %18 = call zeroext i1 @b2t(ptr noundef nonnull %.sroa.sel35.v.sroa.sel.v.sroa.sel, ptr noundef nonnull %17)
  br i1 %18, label %19, label %45

19:                                               ; preds = %15
  %.sroa.sel38.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel38.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel38.v.sroa.sel.v.sroa.sel.v, i64 12
  %20 = load ptr, ptr %0, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  %22 = call zeroext i1 @b2t(ptr noundef nonnull %.sroa.sel38.v.sroa.sel.v.sroa.sel, ptr noundef nonnull %21)
  br i1 %22, label %23, label %45

23:                                               ; preds = %19
  %.sroa.sel41.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel41.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel41.v.sroa.sel.v.sroa.sel.v, i64 8
  %24 = load ptr, ptr %0, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 6
  %26 = call zeroext i1 @b2t(ptr noundef nonnull %.sroa.sel41.v.sroa.sel.v.sroa.sel, ptr noundef nonnull %25)
  br i1 %26, label %27, label %45

27:                                               ; preds = %23
  %.sroa.sel44.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel44.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel44.v.sroa.sel.v.sroa.sel.v, i64 4
  %28 = load ptr, ptr %0, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = call zeroext i1 @b2t(ptr noundef nonnull %.sroa.sel44.v.sroa.sel.v.sroa.sel, ptr noundef nonnull %29)
  br i1 %30, label %31, label %45

31:                                               ; preds = %27
  %32 = load ptr, ptr %0, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 10
  %34 = call zeroext i1 @b2t(ptr noundef nonnull %4, ptr noundef nonnull %33)
  br i1 %34, label %35, label %45

35:                                               ; preds = %31
  %36 = load i32, ptr %.sroa.sel.v.sroa.sel.v.sroa.sel, align 4, !tbaa !16
  %37 = icmp slt i32 %36, 50
  %38 = select i1 %37, i32 100, i32 0
  %39 = add nsw i32 %38, %36
  store i32 %39, ptr %.sroa.sel.v.sroa.sel.v.sroa.sel, align 4, !tbaa !16
  %40 = load i32, ptr %.sroa.sel35.v.sroa.sel.v.sroa.sel, align 8, !tbaa !18
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr %.sroa.sel35.v.sroa.sel.v.sroa.sel, align 8, !tbaa !18
  %.sroa.sel47.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel47.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel47.v.sroa.sel.v.sroa.sel.v, i64 28
  store i32 0, ptr %.sroa.sel47.v.sroa.sel.v.sroa.sel, align 4, !tbaa !19
  %.sroa.sel50.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel50.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel50.v.sroa.sel.v.sroa.sel.v, i64 24
  store i32 0, ptr %.sroa.sel50.v.sroa.sel.v.sroa.sel, align 8, !tbaa !20
  %.sroa.sel53.v.sroa.sel.v.sroa.sel.v = select i1 %.not, ptr %3, ptr %1
  %.sroa.sel53.v.sroa.sel.v.sroa.sel = getelementptr inbounds i8, ptr %.sroa.sel53.v.sroa.sel.v.sroa.sel.v, i64 32
  store i32 0, ptr %.sroa.sel53.v.sroa.sel.v.sroa.sel, align 8, !tbaa !21
  %42 = call zeroext i1 @asn_check_tm(ptr noundef nonnull %4)
  br i1 %42, label %43, label %45

43:                                               ; preds = %35
  %44 = call i64 @asn_tm2msec(ptr noundef nonnull %4, i32 noundef 0)
  br label %45

45:                                               ; preds = %35, %13, %15, %19, %23, %27, %31, %2, %5, %7, %10, %43
  %.0 = phi i64 [ %44, %43 ], [ 0, %10 ], [ 0, %7 ], [ 0, %5 ], [ 0, %2 ], [ 0, %31 ], [ 0, %27 ], [ 0, %23 ], [ 0, %19 ], [ 0, %15 ], [ 0, %13 ], [ 0, %35 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #3
  ret i64 %.0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @b2t(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 0}
!6 = !{!"OCTET_STRING", !7, i64 0, !10, i64 8, !11, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"asn_struct_ctx_s", !12, i64 0, !12, i64 2, !10, i64 4, !7, i64 8, !13, i64 16}
!12 = !{!"short", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!6, !10, i64 8}
!15 = !{!8, !8, i64 0}
!16 = !{!17, !10, i64 20}
!17 = !{!"tm", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !13, i64 40, !7, i64 48}
!18 = !{!17, !10, i64 16}
!19 = !{!17, !10, i64 28}
!20 = !{!17, !10, i64 24}
!21 = !{!17, !10, i64 32}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass