; LLVM IR from specinfo-ua/UAPKI :: library/uapki/src (crl-item)

; 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.UapkiNS::Crl::RevokedCertItem" = type { i64, i32, 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: mustprogress uwtable
declare dso_local noundef ptr @_ZN7UapkiNS3Crl14findNearBeforeERKSt6vectorIPKNS0_15RevokedCertItemESaIS4_EEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIPKN7UapkiNS3Crl15RevokedCertItemESaIS4_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7UapkiNS3Crl15findRevokedCertERKSt6vectorIPKNS0_15RevokedCertItemESaIS4_EEmRNS_10CertStatusERS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 8 dereferenceable(24) %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  store i8 0, ptr %9, align 1, !tbaa !11
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call noundef zeroext i1 @_ZNKSt6vectorIPKN7UapkiNS3Crl15RevokedCertItemESaIS4_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  br i1 %12, label %13, label %15

13:                                               ; preds = %4
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %14, align 4, !tbaa !13
  br label %52

15:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load i64, ptr %6, align 8, !tbaa !9
  %18 = call noundef ptr @_ZN7UapkiNS3Crl14findNearBeforeERKSt6vectorIPKNS0_15RevokedCertItemESaIS4_EEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %17)
  store ptr %18, ptr %10, align 8, !tbaa !5
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %49

21:                                               ; preds = %15
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.UapkiNS::Crl::RevokedCertItem", ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !15
  switch i32 %24, label %31 [
    i32 8, label %25
    i32 -1, label %27
    i32 0, label %29
  ]

25:                                               ; preds = %21
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %26, align 4, !tbaa !13
  br label %48

27:                                               ; preds = %21
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 -1, ptr %28, align 4, !tbaa !13
  br label %48

29:                                               ; preds = %21
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 2, ptr %30, align 4, !tbaa !13
  br label %48

31:                                               ; preds = %21
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 1, ptr %32, align 4, !tbaa !13
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.UapkiNS::Crl::RevokedCertItem", ptr %33, i32 0, i32 0
  %35 = load i64, ptr %34, align 8, !tbaa !18
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.UapkiNS::Crl::RevokedCertItem", ptr %36, i32 0, i32 0
  store i64 %35, ptr %37, align 8, !tbaa !18
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.UapkiNS::Crl::RevokedCertItem", ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.UapkiNS::Crl::RevokedCertItem", ptr %41, i32 0, i32 1
  store i32 %40, ptr %42, align 8, !tbaa !15
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.UapkiNS::Crl::RevokedCertItem", ptr %43, i32 0, i32 2
  %45 = load i64, ptr %44, align 8, !tbaa !19
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.UapkiNS::Crl::RevokedCertItem", ptr %46, i32 0, i32 2
  store i64 %45, ptr %47, align 8, !tbaa !19
  br label %48

48:                                               ; preds = %31, %29, %27, %25
  store i8 1, ptr %9, align 1, !tbaa !11
  br label %51

49:                                               ; preds = %15
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %50, align 4, !tbaa !13
  br label %51

51:                                               ; preds = %49, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %52

52:                                               ; preds = %51, %13
  %53 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %54 = trunc i8 %53 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  ret i1 %54
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTSN7UapkiNS10CertStatusE", !7, i64 0}
!15 = !{!16, !17, i64 8}
!16 = !{!"_ZTSN7UapkiNS3Crl15RevokedCertItemE", !10, i64 0, !17, i64 8, !10, i64 16}
!17 = !{!"_ZTSN7UapkiNS9CrlReasonE", !7, i64 0}
!18 = !{!16, !10, i64 0}
!19 = !{!16, !10, i64 16}
!20 = !{i8 0, i8 2}
!21 = !{}


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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7UapkiNS3Crl14findNearBeforeERKSt6vectorIPKNS0_15RevokedCertItemESaIS4_EEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIPKN7UapkiNS3Crl15RevokedCertItemESaIS4_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7UapkiNS3Crl15findRevokedCertERKSt6vectorIPKNS0_15RevokedCertItemESaIS4_EEmRNS_10CertStatusERS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %2, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(24) %3) local_unnamed_addr #0 {
  %5 = tail call noundef zeroext i1 @_ZNKSt6vectorIPKN7UapkiNS3Crl15RevokedCertItemESaIS4_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  br i1 %5, label %6, label %7

6:                                                ; preds = %4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %22

7:                                                ; preds = %4
  %8 = tail call noundef ptr @_ZN7UapkiNS3Crl14findNearBeforeERKSt6vectorIPKNS0_15RevokedCertItemESaIS4_EEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1)
  %.not.not = icmp eq ptr %8, null
  br i1 %.not.not, label %21, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %8, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !9
  switch i32 %11, label %15 [
    i32 8, label %12
    i32 -1, label %13
    i32 0, label %14
  ]

12:                                               ; preds = %9
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %22

13:                                               ; preds = %9
  store i32 -1, ptr %2, align 4, !tbaa !5
  br label %22

14:                                               ; preds = %9
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %22

15:                                               ; preds = %9
  store i32 1, ptr %2, align 4, !tbaa !5
  %16 = load i64, ptr %8, align 8, !tbaa !13
  store i64 %16, ptr %3, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %11, ptr %17, align 8, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %8, i64 16
  %19 = load i64, ptr %18, align 8, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %3, i64 16
  store i64 %19, ptr %20, align 8, !tbaa !14
  br label %22

21:                                               ; preds = %7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %21, %15, %14, %13, %12, %6
  %.1 = phi i1 [ false, %6 ], [ true, %12 ], [ true, %13 ], [ true, %14 ], [ true, %15 ], [ false, %21 ]
  ret i1 %.1
}

attributes #0 = { 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 #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 = { 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 = !{!"_ZTSN7UapkiNS10CertStatusE", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 8}
!10 = !{!"_ZTSN7UapkiNS3Crl15RevokedCertItemE", !11, i64 0, !12, i64 8, !11, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!"_ZTSN7UapkiNS9CrlReasonE", !7, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!10, !11, i64 16}


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