; LLVM IR from Trusted-eSign/trusted-crypto :: deps/wrapper/src/pki/pkcs12.ll (ZN6Pkcs125writeE6HandleI3BioE)

; 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.LoggerFunction = type { %class.Handle.0, ptr }
%class.Handle.0 = type { ptr }
%class.Handle.1 = type { ptr }

@logger = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZTI6HandleI9ExceptionE = external dso_local constant { ptr, ptr }, align 8
@__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6HandleI3BioE7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; 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 #2 align 2

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

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 #2 align 2

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

; 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 @_ZNK6HandleI3BioEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

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

declare noundef ptr @_ZN3Bio8internalEv(ptr noundef nonnull align 8 dereferenceable(9)) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Pkcs125writeE6HandleI3BioE(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %class.LoggerFunction, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %class.Handle.1, align 8
  %9 = alloca %class.Handle.1, align 8
  %10 = alloca i1, align 1
  %11 = alloca %class.Handle.1, align 8
  %12 = alloca %class.Handle.1, align 8
  %13 = alloca i1, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  %15 = load ptr, ptr @logger, align 8, !tbaa !5
  call void @_ZN14LoggerFunctionC1EP6LoggerPKc(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef %15, ptr noundef @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE)
  %16 = invoke noundef zeroext i1 @_ZNK6HandleI3BioE7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %17 unwind label %28

17:                                               ; preds = %2
  br i1 %16, label %18, label %58

18:                                               ; preds = %17
  %19 = load ptr, ptr @logger, align 8, !tbaa !5
  invoke void (ptr, ptr, ptr, ...) @_ZN6Logger5errorEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef @.str.5, i32 noundef 1)
          to label %20 unwind label %28

20:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %21 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 176) #8
          to label %22 unwind label %32

22:                                               ; preds = %20
  store i1 true, ptr %10, align 1
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef null)
          to label %23 unwind label %36

23:                                               ; preds = %22
  invoke void (ptr, i1, ptr, i32, i32, ptr, ptr, ptr, ptr, ...) @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176) %21, i1 noundef zeroext false, ptr noundef @.str.1, i32 noundef 29, i32 noundef 0, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef %9, ptr noundef @.str.5, i32 noundef 1)
          to label %24 unwind label %40

24:                                               ; preds = %23
  store i1 false, ptr %10, align 1
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef %21)
          to label %25 unwind label %40

25:                                               ; preds = %24
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %26 = call ptr @__cxa_allocate_exception(i64 8) #7
  invoke void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %27 unwind label %48

27:                                               ; preds = %25
  invoke void @__cxa_throw(ptr %26, ptr @_ZTI6HandleI9ExceptionE, ptr @_ZN6HandleI9ExceptionED2Ev) #9
          to label %116 unwind label %52

28:                                               ; preds = %66, %64, %62, %60, %58, %18, %2
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %6, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %7, align 4
  br label %110

32:                                               ; preds = %20
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %6, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %7, align 4
  br label %57

36:                                               ; preds = %22
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %6, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %7, align 4
  br label %44

40:                                               ; preds = %24, %23
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %6, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %7, align 4
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br label %44

44:                                               ; preds = %40, %36
  %45 = load i1, ptr %10, align 1
  br i1 %45, label %46, label %47

46:                                               ; preds = %44
  call void @_ZdlPvm(ptr noundef %21, i64 noundef 176) #10
  br label %47

47:                                               ; preds = %46, %44
  br label %57

48:                                               ; preds = %25
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %6, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %7, align 4
  call void @__cxa_free_exception(ptr %26) #7
  br label %56

52:                                               ; preds = %27
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %6, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %7, align 4
  br label %56

56:                                               ; preds = %52, %48
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br label %57

57:                                               ; preds = %56, %47, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %110

58:                                               ; preds = %17
  %59 = load ptr, ptr @logger, align 8, !tbaa !5
  invoke void (ptr, i32, ptr, ptr, ...) @_ZN6Logger5writeEN11LoggerLevel12LOGGER_LEVELEPKcS3_z(ptr noundef nonnull align 8 dereferenceable(24) %59, i32 noundef 32, ptr noundef @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef @.str.6)
          to label %60 unwind label %28

60:                                               ; preds = %58
  %61 = invoke noundef ptr @_ZNK6HandleI3BioEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %62 unwind label %28

62:                                               ; preds = %60
  %63 = invoke noundef ptr @_ZN3Bio8internalEv(ptr noundef nonnull align 8 dereferenceable(9) %61)
          to label %64 unwind label %28

64:                                               ; preds = %62
  %65 = invoke noundef ptr @_ZN9SSLObjectI9PKCS12_stE8internalEv(ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %66 unwind label %28

66:                                               ; preds = %64
  %67 = invoke i32 @i2d_PKCS12_bio(ptr noundef %63, ptr noundef %65)
          to label %68 unwind label %28

68:                                               ; preds = %66
  %69 = icmp slt i32 %67, 1
  br i1 %69, label %70, label %109

70:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %71 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 176) #8
          to label %72 unwind label %83

72:                                               ; preds = %70
  store i1 true, ptr %13, align 1
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef null)
          to label %73 unwind label %87

73:                                               ; preds = %72
  invoke void (ptr, i1, ptr, i32, i32, ptr, ptr, ptr, ptr, ...) @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176) %71, i1 noundef zeroext true, ptr noundef @.str.1, i32 noundef 34, i32 noundef 0, ptr noundef @.str.2, ptr noundef @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef %12, ptr noundef @.str.6, i64 noundef 0)
          to label %74 unwind label %91

74:                                               ; preds = %73
  store i1 false, ptr %13, align 1
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef %71)
          to label %75 unwind label %91

75:                                               ; preds = %74
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %76 = load ptr, ptr @logger, align 8, !tbaa !5
  %77 = invoke noundef ptr @_ZNK6HandleI9ExceptionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %78 unwind label %99

78:                                               ; preds = %75
  %79 = call noundef ptr @_ZNK9Exception4whatEv(ptr noundef nonnull align 8 dereferenceable(176) %77) #7
  invoke void (ptr, ptr, ptr, ...) @_ZN6Logger4warnEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24) %76, ptr noundef @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef @.str.7, ptr noundef %79)
          to label %80 unwind label %99

80:                                               ; preds = %78
  %81 = call ptr @__cxa_allocate_exception(i64 8) #7
  invoke void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %81, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %82 unwind label %103

82:                                               ; preds = %80
  invoke void @__cxa_throw(ptr %81, ptr @_ZTI6HandleI9ExceptionE, ptr @_ZN6HandleI9ExceptionED2Ev) #9
          to label %116 unwind label %99

83:                                               ; preds = %70
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %6, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %7, align 4
  br label %108

87:                                               ; preds = %72
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %6, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %7, align 4
  br label %95

91:                                               ; preds = %74, %73
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %6, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %7, align 4
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  br label %95

95:                                               ; preds = %91, %87
  %96 = load i1, ptr %13, align 1
  br i1 %96, label %97, label %98

97:                                               ; preds = %95
  call void @_ZdlPvm(ptr noundef %71, i64 noundef 176) #10
  br label %98

98:                                               ; preds = %97, %95
  br label %108

99:                                               ; preds = %82, %78, %75
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %6, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %7, align 4
  br label %107

103:                                              ; preds = %80
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %6, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %7, align 4
  call void @__cxa_free_exception(ptr %81) #7
  br label %107

107:                                              ; preds = %103, %99
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br label %108

108:                                              ; preds = %107, %98, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %110

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

110:                                              ; preds = %108, %57, %28
  call void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  br label %111

111:                                              ; preds = %110
  %112 = load ptr, ptr %6, align 8
  %113 = load i32, ptr %7, align 4
  %114 = insertvalue { ptr, i32 } poison, ptr %112, 0
  %115 = insertvalue { ptr, i32 } %114, i32 %113, 1
  resume { ptr, i32 } %115

116:                                              ; preds = %82, %27
  unreachable
}

declare i32 @i2d_PKCS12_bio(ptr noundef, ptr noundef) #1

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

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

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

; Function Attrs: nounwind
declare noundef ptr @_ZNK9Exception4whatEv(ptr noundef nonnull align 8 dereferenceable(176)) #6

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 = { 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 = { 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 #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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { noreturn }
attributes #10 = { builtin 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"}


; 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.LoggerFunction = type { %class.Handle.0, ptr }
%class.Handle.0 = type { ptr }
%class.Handle.1 = type { ptr }

@logger = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZTI6HandleI9ExceptionE = external dso_local constant { ptr, ptr }, align 8
@__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6HandleI3BioE7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; 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 #2 align 2

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

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 #2 align 2

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

; 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
declare dso_local noundef ptr @_ZNK6HandleI3BioEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

declare noundef ptr @_ZN3Bio8internalEv(ptr noundef nonnull align 8 dereferenceable(9)) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Pkcs125writeE6HandleI3BioE(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.LoggerFunction, align 8
  %4 = alloca %class.Handle.1, align 8
  %5 = alloca %class.Handle.1, align 8
  %6 = alloca %class.Handle.1, align 8
  %7 = alloca %class.Handle.1, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  %8 = load ptr, ptr @logger, align 8, !tbaa !5
  call void @_ZN14LoggerFunctionC1EP6LoggerPKc(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef %8, ptr noundef nonnull @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE)
  %9 = call noundef zeroext i1 @_ZNK6HandleI3BioE7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  %10 = load ptr, ptr @logger, align 8, !tbaa !5
  br i1 %9, label %11, label %31

11:                                               ; preds = %2
  invoke void (ptr, ptr, ptr, ...) @_ZN6Logger5errorEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef nonnull @.str.5, i32 noundef 1)
          to label %12 unwind label %20

12:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %13 = invoke noalias noundef nonnull dereferenceable(176) ptr @_Znwm(i64 noundef 176) #8
          to label %14 unwind label %22

14:                                               ; preds = %12
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef null)
          to label %15 unwind label %.thread

15:                                               ; preds = %14
  invoke void (ptr, i1, ptr, i32, i32, ptr, ptr, ptr, ptr, ...) @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176) %13, i1 noundef zeroext false, ptr noundef nonnull @.str.1, i32 noundef 29, i32 noundef 0, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef nonnull %5, ptr noundef nonnull @.str.5, i32 noundef 1)
          to label %17 unwind label %.thread24

.thread24:                                        ; preds = %15
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br label %27

17:                                               ; preds = %15
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull %13)
          to label %18 unwind label %25

18:                                               ; preds = %17
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %19 = call ptr @__cxa_allocate_exception(i64 8) #7
  call void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %4)
  invoke void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTI6HandleI9ExceptionE, ptr nonnull @_ZN6HandleI9ExceptionED2Ev) #9
          to label %66 unwind label %28

20:                                               ; preds = %38, %36, %34, %32, %31, %11
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %65

22:                                               ; preds = %12
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %30

.thread:                                          ; preds = %14
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

25:                                               ; preds = %17
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br label %30

27:                                               ; preds = %.thread24, %.thread
  %.pn1623 = phi { ptr, i32 } [ %24, %.thread ], [ %16, %.thread24 ]
  call void @_ZdlPvm(ptr noundef nonnull %13, i64 noundef 176) #10
  br label %30

28:                                               ; preds = %18
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br label %30

30:                                               ; preds = %25, %27, %28, %22
  %.pn18 = phi { ptr, i32 } [ %29, %28 ], [ %.pn1623, %27 ], [ %26, %25 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %65

31:                                               ; preds = %2
  invoke void (ptr, i32, ptr, ptr, ...) @_ZN6Logger5writeEN11LoggerLevel12LOGGER_LEVELEPKcS3_z(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 32, ptr noundef nonnull @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef nonnull @.str.6)
          to label %32 unwind label %20

32:                                               ; preds = %31
  %33 = invoke noundef ptr @_ZNK6HandleI3BioEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %34 unwind label %20

34:                                               ; preds = %32
  %35 = invoke noundef ptr @_ZN3Bio8internalEv(ptr noundef nonnull align 8 dereferenceable(9) %33)
          to label %36 unwind label %20

36:                                               ; preds = %34
  %37 = invoke noundef ptr @_ZN9SSLObjectI9PKCS12_stE8internalEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
          to label %38 unwind label %20

38:                                               ; preds = %36
  %39 = invoke i32 @i2d_PKCS12_bio(ptr noundef %35, ptr noundef %37)
          to label %40 unwind label %20

40:                                               ; preds = %38
  %41 = icmp slt i32 %39, 1
  br i1 %41, label %42, label %64

42:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %43 = invoke noalias noundef nonnull dereferenceable(176) ptr @_Znwm(i64 noundef 176) #8
          to label %44 unwind label %55

44:                                               ; preds = %42
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef null)
          to label %45 unwind label %.thread26

45:                                               ; preds = %44
  invoke void (ptr, i1, ptr, i32, i32, ptr, ptr, ptr, ptr, ...) @_ZN9ExceptionC1EbPKciiS1_S1_6HandleIS_ES1_z(ptr noundef nonnull align 8 dereferenceable(176) %43, i1 noundef zeroext true, ptr noundef nonnull @.str.1, i32 noundef 34, i32 noundef 0, ptr noundef nonnull @.str.2, ptr noundef nonnull @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef nonnull %7, ptr noundef nonnull @.str.6, i64 noundef 0)
          to label %47 unwind label %.thread30

.thread30:                                        ; preds = %45
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br label %60

47:                                               ; preds = %45
  invoke void @_ZN6HandleI9ExceptionEC2EPS0_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull %43)
          to label %48 unwind label %58

48:                                               ; preds = %47
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %49 = load ptr, ptr @logger, align 8, !tbaa !5
  %50 = invoke noundef ptr @_ZNK6HandleI9ExceptionEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %51 unwind label %61

51:                                               ; preds = %48
  %52 = call noundef ptr @_ZNK9Exception4whatEv(ptr noundef nonnull align 8 dereferenceable(176) %50) #7
  invoke void (ptr, ptr, ptr, ...) @_ZN6Logger4warnEPKcS1_z(ptr noundef nonnull align 8 dereferenceable(24) %49, ptr noundef nonnull @__FUNCTION__._ZN6Pkcs125writeE6HandleI3BioE, ptr noundef nonnull @.str.7, ptr noundef %52)
          to label %53 unwind label %61

53:                                               ; preds = %51
  %54 = call ptr @__cxa_allocate_exception(i64 8) #7
  call void @_ZN6HandleI9ExceptionEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef nonnull align 8 dereferenceable(8) %6)
  invoke void @__cxa_throw(ptr nonnull %54, ptr nonnull @_ZTI6HandleI9ExceptionE, ptr nonnull @_ZN6HandleI9ExceptionED2Ev) #9
          to label %66 unwind label %61

55:                                               ; preds = %42
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %63

.thread26:                                        ; preds = %44
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %60

58:                                               ; preds = %47
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br label %63

60:                                               ; preds = %.thread30, %.thread26
  %.pn29 = phi { ptr, i32 } [ %57, %.thread26 ], [ %46, %.thread30 ]
  call void @_ZdlPvm(ptr noundef nonnull %43, i64 noundef 176) #10
  br label %63

61:                                               ; preds = %53, %51, %48
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6HandleI9ExceptionED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  br label %63

63:                                               ; preds = %58, %60, %61, %55
  %.pn14 = phi { ptr, i32 } [ %62, %61 ], [ %.pn29, %60 ], [ %59, %58 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %65

64:                                               ; preds = %40
  call void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  ret void

65:                                               ; preds = %63, %30, %20
  %.pn18.pn = phi { ptr, i32 } [ %.pn18, %30 ], [ %21, %20 ], [ %.pn14, %63 ]
  call void @_ZN14LoggerFunctionD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn18.pn

66:                                               ; preds = %53, %18
  unreachable
}

declare i32 @i2d_PKCS12_bio(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind
declare noundef ptr @_ZNK9Exception4whatEv(ptr noundef nonnull align 8 dereferenceable(176)) local_unnamed_addr #6

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 = { 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 = { 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 #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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { noreturn }
attributes #10 = { builtin 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"}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass