; LLVM IR from Trusted-eSign/trusted-crypto :: deps/wrapper/src/pki (chain)

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

%class.Handle.0 = type { ptr }
%class.LoggerFunction = type { %class.Handle.1, ptr }
%class.Handle.1 = type { ptr }
%class.Handle.4 = type { ptr }

@logger = external global ptr, align 8
@_ZTI6HandleI9ExceptionE = external dso_local constant { ptr, ptr }, align 8
@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE = external hidden unnamed_addr constant [10 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1

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

declare void @_ZN14LoggerFunctionC1EP6LoggerPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) unnamed_addr #1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6HandleI11CertificateEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI11CertificateEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE(ptr dead_on_unwind noalias writable sret(%class.Handle.0) align 8 %0, ptr noundef nonnull align 1 dereferenceable(1) %1, ptr noundef %2, ptr noundef %3) #4 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %class.LoggerFunction, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %class.Handle.0, align 8
  %16 = alloca %class.Handle.0, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %class.Handle.4, align 8
  %19 = alloca %class.Handle.4, align 8
  %20 = alloca i1, align 1
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #9
  %22 = load ptr, ptr @logger, align 8, !tbaa !5
  call void @_ZN14LoggerFunctionC1EP6LoggerPKc(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef %22, ptr noundef @__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %23 = invoke noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %24 unwind label %32

24:                                               ; preds = %4
  %25 = invoke noundef i32 @_ZN21CertificateCollection6lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
          to label %26 unwind label %32

26:                                               ; preds = %24
  store i32 %25, ptr %11, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %59, %26
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %36, label %31

31:                                               ; preds = %27
  store i32 2, ptr %14, align 4
  br label %62

32:                                               ; preds = %46, %44, %38, %36, %24, %4
  %33 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %12, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %13, align 4
  br label %64

36:                                               ; preds = %27
  %37 = invoke noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %38 unwind label %32

38:                                               ; preds = %36
  %39 = load i32, ptr %10, align 4, !tbaa !9
  invoke void @_ZN21CertificateCollection5itemsEi(ptr dead_on_unwind writable sret(%class.Handle.0) align 8 %15, ptr noundef nonnull align 8 dereferenceable(16) %37, i32 noundef %39)
          to label %40 unwind label %32

40:                                               ; preds = %38
  invoke void @_ZN6HandleI11CertificateEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %41 unwind label %49

41:                                               ; preds = %40
  %42 = invoke noundef zeroext i1 @_ZN5Chain11checkIssuedE6HandleI11CertificateES2_(ptr noundef nonnull align 1 dereferenceable(1) %21, ptr noundef %15, ptr noundef %16)
          to label %43 unwind label %53

43:                                               ; preds = %41
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #9
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #9
  br i1 %42, label %44, label %58

44:                                               ; preds = %43
  %45 = invoke noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %46 unwind label %32

46:                                               ; preds = %44
  %47 = load i32, ptr %10, align 4, !tbaa !9
  invoke void @_ZN21CertificateCollection5itemsEi(ptr dead_on_unwind writable sret(%class.Handle.0) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %45, i32 noundef %47)
          to label %48 unwind label %32

48:                                               ; preds = %46
  store i32 1, ptr %14, align 4
  br label %62

49:                                               ; preds = %40
  %50 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %12, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %13, align 4
  br label %57

53:                                               ; preds = %41
  %54 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %12, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %13, align 4
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #9
  br label %57

57:                                               ; preds = %53, %49
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #9
  br label %64

58:                                               ; preds = %43
  br label %59

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

62:                                               ; preds = %48, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  %63 = load i32, ptr %14, align 4
  switch i32 %63, label %121 [
    i32 2, label %65
  ]

64:                                               ; preds = %57, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %71

65:                                               ; preds = %62
  invoke void @_ZN6HandleI11CertificateEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %66 unwind label %67

66:                                               ; preds = %65
  store i32 1, ptr %14, align 4
  br label %121

67:                                               ; preds = %65
  %68 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %12, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %13, align 4
  br label %71

71:                                               ; preds = %67, %64
  %72 = load i32, ptr %13, align 4
  %73 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTI6HandleI9ExceptionE) #9
  %74 = icmp eq i32 %72, %73
  br i1 %74, label %75, label %122

75:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %76 = load ptr, ptr %12, align 8
  %77 = call ptr @__cxa_begin_catch(ptr %76) #9
  store ptr %77, ptr %17, align 8
  %78 = load ptr, ptr @logger, align 8, !tbaa !5
  invoke void (ptr, ptr, ptr, ...) @_ZN6Logger5errorEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24) %78, ptr noundef @__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE, ptr noundef @.str.18)
          to label %79 unwind label %88

79:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %80 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 176) #10
          to label %81 unwind label %92

81:                                               ; preds = %79
  store i1 true, ptr %20, align 1
  %82 = load ptr, ptr %17, align 8, !tbaa !5
  invoke void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %82)
          to label %83 unwind label %96

83:                                               ; preds = %81
  invoke void (ptr, i1, ptr, i32, i32, ptr, ptr, ptr, ptr, ...) @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176) %80, i1 noundef zeroext false, ptr noundef @.str.1, i32 noundef 114, i32 noundef 0, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE, ptr noundef %19, ptr noundef @.str.18)
          to label %84 unwind label %100

84:                                               ; preds = %83
  store i1 false, ptr %20, align 1
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef %80)
          to label %85 unwind label %100

85:                                               ; preds = %84
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %19) #9
  %86 = call ptr @__cxa_allocate_exception(i64 8) #9
  invoke void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %86, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %87 unwind label %108

87:                                               ; preds = %85
  invoke void @__cxa_throw(ptr %86, ptr @_ZTI6HandleI9ExceptionE, ptr @_ZN6HandleI9ExceptionED2Ev) #11
          to label %131 unwind label %112

88:                                               ; preds = %75
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %12, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %13, align 4
  br label %118

92:                                               ; preds = %79
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %12, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %13, align 4
  br label %117

96:                                               ; preds = %81
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %12, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %13, align 4
  br label %104

100:                                              ; preds = %84, %83
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %12, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %13, align 4
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %19) #9
  br label %104

104:                                              ; preds = %100, %96
  %105 = load i1, ptr %20, align 1
  br i1 %105, label %106, label %107

106:                                              ; preds = %104
  call void @_ZdlPvm(ptr noundef %80, i64 noundef 176) #12
  br label %107

107:                                              ; preds = %106, %104
  br label %117

108:                                              ; preds = %85
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %12, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %13, align 4
  call void @__cxa_free_exception(ptr %86) #9
  br label %116

112:                                              ; preds = %87
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %12, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %13, align 4
  br label %116

116:                                              ; preds = %112, %108
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %18) #9
  br label %117

117:                                              ; preds = %116, %107, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %118

118:                                              ; preds = %117, %88
  invoke void @__cxa_end_catch()
          to label %119 unwind label %128

119:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %122

120:                                              ; No predecessors!
  unreachable

121:                                              ; preds = %66, %62
  call void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #9
  ret void

122:                                              ; preds = %119, %71
  call void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #9
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %12, align 8
  %125 = load i32, ptr %13, align 4
  %126 = insertvalue { ptr, i32 } poison, ptr %124, 0
  %127 = insertvalue { ptr, i32 } %126, i32 %125, 1
  resume { ptr, i32 } %127

128:                                              ; preds = %118
  %129 = landingpad { ptr, i32 }
          catch ptr null
  %130 = extractvalue { ptr, i32 } %129, 0
  call void @__clang_call_terminate(ptr %130) #13
  unreachable

131:                                              ; preds = %87
  unreachable
}

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

declare void @_ZN6Logger5errorEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, ...) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #4 align 2

declare void @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176), i1 noundef zeroext, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ...) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #6

declare ptr @__cxa_begin_catch(ptr)

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #7

; Function Attrs: nounwind
declare void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #8

declare noundef i32 @_ZN21CertificateCollection6lengthEv(ptr noundef nonnull align 8 dereferenceable(16)) #1

declare void @_ZN21CertificateCollection5itemsEi(ptr dead_on_unwind writable sret(%class.Handle.0) align 8, ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5Chain11checkIssuedE6HandleI11CertificateES2_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, ptr noundef) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { nobuiltin allocsize(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 = { nobuiltin 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 = { 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 #5 = { 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 #6 = { nounwind memory(none) }
attributes #7 = { noinline noreturn nounwind uwtable "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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { noreturn }
attributes #12 = { builtin nounwind }
attributes #13 = { noreturn 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%class.Handle.0 = type { ptr }
%class.LoggerFunction = type { %class.Handle.1, ptr }
%class.Handle.1 = type { ptr }
%class.Handle.4 = type { ptr }

@logger = external local_unnamed_addr global ptr, align 8
@_ZTI6HandleI9ExceptionE = external dso_local constant { ptr, ptr }, align 8
@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE = external hidden unnamed_addr constant [10 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1

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

declare void @_ZN14LoggerFunctionC1EP6LoggerPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) unnamed_addr #1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6HandleI11CertificateEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI11CertificateEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE(ptr dead_on_unwind noalias writable sret(%class.Handle.0) align 8 %0, ptr noundef nonnull align 1 dereferenceable(1) %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.LoggerFunction, align 8
  %6 = alloca %class.Handle.0, align 8
  %7 = alloca %class.Handle.0, align 8
  %8 = alloca %class.Handle.4, align 8
  %9 = alloca %class.Handle.4, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #9
  %10 = load ptr, ptr @logger, align 8, !tbaa !5
  call void @_ZN14LoggerFunctionC1EP6LoggerPKc(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef %10, ptr noundef nonnull @__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE)
  %11 = invoke noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %12 unwind label %.loopexit.split-lp

12:                                               ; preds = %4
  %13 = invoke noundef i32 @_ZN21CertificateCollection6lengthEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %12
  %.not30 = icmp sgt i32 %13, 0
  br i1 %.not30, label %.lr.ph, label %.critedge

.loopexit:                                        ; preds = %.lr.ph, %15
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  br label %28

.loopexit.split-lp:                               ; preds = %4, %12, %19, %21
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  br label %28

.lr.ph:                                           ; preds = %.preheader, %24
  %.01231 = phi i32 [ %25, %24 ], [ 0, %.preheader ]
  %14 = invoke noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %15 unwind label %.loopexit

15:                                               ; preds = %.lr.ph
  invoke void @_ZN21CertificateCollection5itemsEi(ptr dead_on_unwind nonnull writable sret(%class.Handle.0) align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %14, i32 noundef %.01231)
          to label %16 unwind label %.loopexit

16:                                               ; preds = %15
  call void @_ZN6HandleI11CertificateEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %17 = invoke noundef zeroext i1 @_ZN5Chain11checkIssuedE6HandleI11CertificateES2_(ptr noundef nonnull align 1 dereferenceable(1) %1, ptr noundef nonnull %6, ptr noundef nonnull %7)
          to label %18 unwind label %22

18:                                               ; preds = %16
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #9
  br i1 %17, label %19, label %24

19:                                               ; preds = %18
  %20 = invoke noundef ptr @_ZNK6HandleI21CertificateCollectionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %21 unwind label %.loopexit.split-lp

21:                                               ; preds = %19
  invoke void @_ZN21CertificateCollection5itemsEi(ptr dead_on_unwind writable sret(%class.Handle.0) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %20, i32 noundef %.01231)
          to label %52 unwind label %.loopexit.split-lp

22:                                               ; preds = %16
  %23 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  call void @_ZN6HandleI11CertificateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #9
  br label %28

24:                                               ; preds = %18
  %25 = add nuw nsw i32 %.01231, 1
  %exitcond.not = icmp eq i32 %25, %13
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !9

.critedge:                                        ; preds = %24, %.preheader
  invoke void @_ZN6HandleI11CertificateEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef null)
          to label %52 unwind label %26

26:                                               ; preds = %.critedge
  %27 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTI6HandleI9ExceptionE
  br label %28

28:                                               ; preds = %.loopexit, %.loopexit.split-lp, %22, %26
  %.pn21 = phi { ptr, i32 } [ %27, %26 ], [ %23, %22 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  %.1 = extractvalue { ptr, i32 } %.pn21, 1
  %29 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTI6HandleI9ExceptionE) #9
  %30 = icmp eq i32 %.1, %29
  br i1 %30, label %31, label %53

31:                                               ; preds = %28
  %.116 = extractvalue { ptr, i32 } %.pn21, 0
  %32 = call ptr @__cxa_begin_catch(ptr %.116) #9
  %33 = load ptr, ptr @logger, align 8, !tbaa !5
  invoke void (ptr, ptr, ptr, ...) @_ZN6Logger5errorEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull @__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE, ptr noundef nonnull @.str.18)
          to label %34 unwind label %40

34:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %35 = invoke noalias noundef nonnull dereferenceable(176) ptr @_Znwm(i64 noundef 176) #10
          to label %36 unwind label %42

36:                                               ; preds = %34
  call void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %32)
  invoke void (ptr, i1, ptr, i32, i32, ptr, ptr, ptr, ptr, ...) @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176) %35, i1 noundef zeroext false, ptr noundef nonnull @.str.1, i32 noundef 114, i32 noundef 0, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN5Chain9getIssuedE6HandleI21CertificateCollectionES0_I11CertificateE, ptr noundef nonnull %9, ptr noundef nonnull @.str.18)
          to label %37 unwind label %46

37:                                               ; preds = %36
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull %35)
          to label %38 unwind label %44

38:                                               ; preds = %37
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  %39 = call ptr @__cxa_allocate_exception(i64 8) #9
  call void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef nonnull align 8 dereferenceable(8) %8)
  invoke void @__cxa_throw(ptr nonnull %39, ptr nonnull @_ZTI6HandleI9ExceptionE, ptr nonnull @_ZN6HandleI9ExceptionED2Ev) #11
          to label %57 unwind label %48

40:                                               ; preds = %31
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %51

42:                                               ; preds = %34
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %50

44:                                               ; preds = %37
  %45 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  br label %50

46:                                               ; preds = %36
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  call void @_ZdlPvm(ptr noundef nonnull %35, i64 noundef 176) #12
  br label %50

48:                                               ; preds = %38
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  br label %50

50:                                               ; preds = %44, %46, %48, %42
  %.pn23 = phi { ptr, i32 } [ %49, %48 ], [ %47, %46 ], [ %45, %44 ], [ %43, %42 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  br label %51

51:                                               ; preds = %50, %40
  %.pn23.pn = phi { ptr, i32 } [ %.pn23, %50 ], [ %41, %40 ]
  invoke void @__cxa_end_catch()
          to label %53 unwind label %54

52:                                               ; preds = %21, %.critedge
  call void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #9
  ret void

53:                                               ; preds = %51, %28
  %.merged = phi { ptr, i32 } [ %.pn21, %28 ], [ %.pn23.pn, %51 ]
  call void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #9
  resume { ptr, i32 } %.merged

54:                                               ; preds = %51
  %55 = landingpad { ptr, i32 }
          catch ptr null
  %56 = extractvalue { ptr, i32 } %55, 0
  call void @__clang_call_terminate(ptr %56) #13
  unreachable

57:                                               ; preds = %38
  unreachable
}

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

declare void @_ZN6Logger5errorEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #4 align 2

declare void @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176), i1 noundef zeroext, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ...) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #6

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #8

declare noundef i32 @_ZN21CertificateCollection6lengthEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare void @_ZN21CertificateCollection5itemsEi(ptr dead_on_unwind writable sret(%class.Handle.0) align 8, ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5Chain11checkIssuedE6HandleI11CertificateES2_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, ptr noundef) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { nobuiltin allocsize(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 = { nobuiltin 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 = { 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 #5 = { 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 #6 = { nofree nosync nounwind memory(none) }
attributes #7 = { noinline noreturn nounwind uwtable "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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { noreturn }
attributes #12 = { builtin nounwind }
attributes #13 = { noreturn 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass