; LLVM IR from tleonhardt/practical_cryptography_engineering :: mbedtls (x509_crt)

; 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.mbedtls_x509_crt = type { %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_buf, i32, %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_named_data, %struct.mbedtls_asn1_named_data, %struct.mbedtls_x509_time, %struct.mbedtls_x509_time, %struct.mbedtls_pk_context, %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_sequence, i32, i32, i32, i32, %struct.mbedtls_asn1_sequence, i8, %struct.mbedtls_asn1_buf, i32, i32, ptr, ptr }
%struct.mbedtls_asn1_named_data = type { %struct.mbedtls_asn1_buf, %struct.mbedtls_asn1_buf, ptr, i8 }
%struct.mbedtls_x509_time = type { i32, i32, i32, i32, i32, i32 }
%struct.mbedtls_pk_context = type { ptr, ptr }
%struct.mbedtls_asn1_sequence = type { %struct.mbedtls_asn1_buf, ptr }
%struct.mbedtls_asn1_buf = type { i32, i64, ptr }

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; 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 hidden void @mbedtls_zeroize(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @mbedtls_x509_crt_free(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %10, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %1
  store i32 1, ptr %9, align 4
  br label %124

14:                                               ; preds = %1
  br label %15

15:                                               ; preds = %103, %14
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %16, i32 0, i32 11
  call void @mbedtls_pk_free(ptr noundef %17)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %18, i32 0, i32 25
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  call void @free(ptr noundef %20) #4
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %21, i32 0, i32 7
  %23 = getelementptr inbounds %struct.mbedtls_asn1_named_data, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !18
  store ptr %24, ptr %5, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %28, %15
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %35

28:                                               ; preds = %25
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %29, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mbedtls_asn1_named_data, ptr %30, i32 0, i32 2
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  store ptr %32, ptr %5, align 8, !tbaa !5
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mbedtls_zeroize(ptr noundef %33, i64 noundef 64)
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %34) #4
  br label %25, !llvm.loop !20

35:                                               ; preds = %25
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %36, i32 0, i32 8
  %38 = getelementptr inbounds %struct.mbedtls_asn1_named_data, ptr %37, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !22
  store ptr %39, ptr %5, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %43, %35
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %50

43:                                               ; preds = %40
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %44, ptr %6, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mbedtls_asn1_named_data, ptr %45, i32 0, i32 2
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  store ptr %47, ptr %5, align 8, !tbaa !5
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mbedtls_zeroize(ptr noundef %48, i64 noundef 64)
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %49) #4
  br label %40, !llvm.loop !23

50:                                               ; preds = %40
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %51, i32 0, i32 20
  %53 = getelementptr inbounds %struct.mbedtls_asn1_sequence, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  store ptr %54, ptr %7, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %58, %50
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %65

58:                                               ; preds = %55
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %59, ptr %8, align 8, !tbaa !5
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mbedtls_asn1_sequence, ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !25
  store ptr %62, ptr %7, align 8, !tbaa !5
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  call void @mbedtls_zeroize(ptr noundef %63, i64 noundef 32)
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %64) #4
  br label %55, !llvm.loop !26

65:                                               ; preds = %55
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %66, i32 0, i32 15
  %68 = getelementptr inbounds %struct.mbedtls_asn1_sequence, ptr %67, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !27
  store ptr %69, ptr %7, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %73, %65
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %80

73:                                               ; preds = %70
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %74, ptr %8, align 8, !tbaa !5
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.mbedtls_asn1_sequence, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !25
  store ptr %77, ptr %7, align 8, !tbaa !5
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  call void @mbedtls_zeroize(ptr noundef %78, i64 noundef 32)
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %79) #4
  br label %70, !llvm.loop !28

80:                                               ; preds = %70
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !29
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %99

86:                                               ; preds = %80
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %87, i32 0, i32 0
  %89 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %88, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !29
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %91, i32 0, i32 0
  %93 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %92, i32 0, i32 1
  %94 = load i64, ptr %93, align 8, !tbaa !30
  call void @mbedtls_zeroize(ptr noundef %90, i64 noundef %94)
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %95, i32 0, i32 0
  %97 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !29
  call void @free(ptr noundef %98) #4
  br label %99

99:                                               ; preds = %86, %80
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %100, i32 0, i32 26
  %102 = load ptr, ptr %101, align 8, !tbaa !31
  store ptr %102, ptr %3, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %99
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = icmp ne ptr %104, null
  br i1 %105, label %15, label %106, !llvm.loop !32

106:                                              ; preds = %103
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %107, ptr %3, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %120, %106
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %109, ptr %4, align 8, !tbaa !5
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.mbedtls_x509_crt, ptr %110, i32 0, i32 26
  %112 = load ptr, ptr %111, align 8, !tbaa !31
  store ptr %112, ptr %3, align 8, !tbaa !5
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  call void @mbedtls_zeroize(ptr noundef %113, i64 noundef 552)
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = icmp ne ptr %114, %115
  br i1 %116, label %117, label %119

117:                                              ; preds = %108
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  call void @free(ptr noundef %118) #4
  br label %119

119:                                              ; preds = %117, %108
  br label %120

120:                                              ; preds = %119
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = icmp ne ptr %121, null
  br i1 %122, label %108, label %123, !llvm.loop !33

123:                                              ; preds = %120
  store i32 0, ptr %9, align 4
  br label %124

124:                                              ; preds = %123, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  %125 = load i32, ptr %9, align 4
  switch i32 %125, label %127 [
    i32 0, label %126
    i32 1, label %126
  ]

126:                                              ; preds = %124, %124
  ret void

127:                                              ; preds = %124
  unreachable
}

declare void @mbedtls_pk_free(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 536}
!10 = !{!"mbedtls_x509_crt", !11, i64 0, !11, i64 24, !12, i64 48, !11, i64 56, !11, i64 80, !11, i64 104, !11, i64 128, !14, i64 152, !14, i64 216, !15, i64 280, !15, i64 304, !16, i64 328, !11, i64 344, !11, i64 368, !11, i64 392, !17, i64 416, !12, i64 448, !12, i64 452, !12, i64 456, !12, i64 460, !17, i64 464, !7, i64 496, !11, i64 504, !12, i64 528, !12, i64 532, !6, i64 536, !6, i64 544}
!11 = !{!"mbedtls_asn1_buf", !12, i64 0, !13, i64 8, !6, i64 16}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"mbedtls_asn1_named_data", !11, i64 0, !11, i64 24, !6, i64 48, !7, i64 56}
!15 = !{!"mbedtls_x509_time", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!16 = !{!"", !6, i64 0, !6, i64 8}
!17 = !{!"mbedtls_asn1_sequence", !11, i64 0, !6, i64 24}
!18 = !{!10, !6, i64 200}
!19 = !{!14, !6, i64 48}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!10, !6, i64 264}
!23 = distinct !{!23, !21}
!24 = !{!10, !6, i64 488}
!25 = !{!17, !6, i64 24}
!26 = distinct !{!26, !21}
!27 = !{!10, !6, i64 440}
!28 = distinct !{!28, !21}
!29 = !{!10, !6, i64 16}
!30 = !{!10, !13, i64 8}
!31 = !{!10, !6, i64 544}
!32 = distinct !{!32, !21}
!33 = distinct !{!33, !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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @mbedtls_zeroize(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @mbedtls_x509_crt_free(ptr noundef %0) local_unnamed_addr #1 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %.loopexit, label %.preheader57

.preheader57:                                     ; preds = %1, %28
  %.044 = phi ptr [ %30, %28 ], [ %0, %1 ]
  %3 = getelementptr inbounds i8, ptr %.044, i64 328
  tail call void @mbedtls_pk_free(ptr noundef nonnull %3) #3
  %4 = getelementptr inbounds i8, ptr %.044, i64 536
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  tail call void @free(ptr noundef %5) #3
  %6 = getelementptr inbounds i8, ptr %.044, i64 200
  %7 = load ptr, ptr %6, align 8, !tbaa !17
  %.not58 = icmp eq ptr %7, null
  br i1 %.not58, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader57, %.lr.ph
  %.04259 = phi ptr [ %9, %.lr.ph ], [ %7, %.preheader57 ]
  %8 = getelementptr inbounds i8, ptr %.04259, i64 48
  %9 = load ptr, ptr %8, align 8, !tbaa !18
  tail call void @mbedtls_zeroize(ptr noundef nonnull %.04259, i64 noundef 64)
  tail call void @free(ptr noundef nonnull %.04259) #3
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph, %.preheader57
  %10 = getelementptr inbounds i8, ptr %.044, i64 264
  %11 = load ptr, ptr %10, align 8, !tbaa !21
  %.not5060 = icmp eq ptr %11, null
  br i1 %.not5060, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %._crit_edge, %.lr.ph63
  %.14361 = phi ptr [ %13, %.lr.ph63 ], [ %11, %._crit_edge ]
  %12 = getelementptr inbounds i8, ptr %.14361, i64 48
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  tail call void @mbedtls_zeroize(ptr noundef nonnull %.14361, i64 noundef 64)
  tail call void @free(ptr noundef nonnull %.14361) #3
  %.not50 = icmp eq ptr %13, null
  br i1 %.not50, label %._crit_edge64, label %.lr.ph63, !llvm.loop !22

._crit_edge64:                                    ; preds = %.lr.ph63, %._crit_edge
  %14 = getelementptr inbounds i8, ptr %.044, i64 488
  %15 = load ptr, ptr %14, align 8, !tbaa !23
  %.not5165 = icmp eq ptr %15, null
  br i1 %.not5165, label %._crit_edge69, label %.lr.ph68

.lr.ph68:                                         ; preds = %._crit_edge64, %.lr.ph68
  %.066 = phi ptr [ %17, %.lr.ph68 ], [ %15, %._crit_edge64 ]
  %16 = getelementptr inbounds i8, ptr %.066, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !24
  tail call void @mbedtls_zeroize(ptr noundef nonnull %.066, i64 noundef 32)
  tail call void @free(ptr noundef nonnull %.066) #3
  %.not51 = icmp eq ptr %17, null
  br i1 %.not51, label %._crit_edge69, label %.lr.ph68, !llvm.loop !25

._crit_edge69:                                    ; preds = %.lr.ph68, %._crit_edge64
  %18 = getelementptr inbounds i8, ptr %.044, i64 440
  %19 = load ptr, ptr %18, align 8, !tbaa !26
  %.not5270 = icmp eq ptr %19, null
  br i1 %.not5270, label %._crit_edge74, label %.lr.ph73

.lr.ph73:                                         ; preds = %._crit_edge69, %.lr.ph73
  %.171 = phi ptr [ %21, %.lr.ph73 ], [ %19, %._crit_edge69 ]
  %20 = getelementptr inbounds i8, ptr %.171, i64 24
  %21 = load ptr, ptr %20, align 8, !tbaa !24
  tail call void @mbedtls_zeroize(ptr noundef nonnull %.171, i64 noundef 32)
  tail call void @free(ptr noundef nonnull %.171) #3
  %.not52 = icmp eq ptr %21, null
  br i1 %.not52, label %._crit_edge74, label %.lr.ph73, !llvm.loop !27

._crit_edge74:                                    ; preds = %.lr.ph73, %._crit_edge69
  %22 = getelementptr inbounds i8, ptr %.044, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !28
  %.not53 = icmp eq ptr %23, null
  br i1 %.not53, label %28, label %24

24:                                               ; preds = %._crit_edge74
  %25 = getelementptr inbounds i8, ptr %.044, i64 8
  %26 = load i64, ptr %25, align 8, !tbaa !29
  tail call void @mbedtls_zeroize(ptr noundef nonnull %23, i64 noundef %26)
  %27 = load ptr, ptr %22, align 8, !tbaa !28
  tail call void @free(ptr noundef %27) #3
  br label %28

28:                                               ; preds = %24, %._crit_edge74
  %29 = getelementptr inbounds i8, ptr %.044, i64 544
  %30 = load ptr, ptr %29, align 8, !tbaa !30
  %.not54 = icmp eq ptr %30, null
  br i1 %.not54, label %.preheader, label %.preheader57, !llvm.loop !31

.preheader:                                       ; preds = %28, %34
  %.145 = phi ptr [ %32, %34 ], [ %0, %28 ]
  %31 = getelementptr inbounds i8, ptr %.145, i64 544
  %32 = load ptr, ptr %31, align 8, !tbaa !30
  tail call void @mbedtls_zeroize(ptr noundef nonnull %.145, i64 noundef 552)
  %.not55 = icmp eq ptr %.145, %0
  br i1 %.not55, label %34, label %33

33:                                               ; preds = %.preheader
  tail call void @free(ptr noundef nonnull %.145) #3
  br label %34

34:                                               ; preds = %.preheader, %33
  %.not56 = icmp eq ptr %32, null
  br i1 %.not56, label %.loopexit, label %.preheader, !llvm.loop !32

.loopexit:                                        ; preds = %34, %1
  ret void
}

declare void @mbedtls_pk_free(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !12, i64 536}
!6 = !{!"mbedtls_x509_crt", !7, i64 0, !7, i64 24, !8, i64 48, !7, i64 56, !7, i64 80, !7, i64 104, !7, i64 128, !13, i64 152, !13, i64 216, !14, i64 280, !14, i64 304, !15, i64 328, !7, i64 344, !7, i64 368, !7, i64 392, !16, i64 416, !8, i64 448, !8, i64 452, !8, i64 456, !8, i64 460, !16, i64 464, !9, i64 496, !7, i64 504, !8, i64 528, !8, i64 532, !12, i64 536, !12, i64 544}
!7 = !{!"mbedtls_asn1_buf", !8, i64 0, !11, i64 8, !12, i64 16}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"mbedtls_asn1_named_data", !7, i64 0, !7, i64 24, !12, i64 48, !9, i64 56}
!14 = !{!"mbedtls_x509_time", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20}
!15 = !{!"", !12, i64 0, !12, i64 8}
!16 = !{!"mbedtls_asn1_sequence", !7, i64 0, !12, i64 24}
!17 = !{!6, !12, i64 200}
!18 = !{!13, !12, i64 48}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!6, !12, i64 264}
!22 = distinct !{!22, !20}
!23 = !{!6, !12, i64 488}
!24 = !{!16, !12, i64 24}
!25 = distinct !{!25, !20}
!26 = !{!6, !12, i64 440}
!27 = distinct !{!27, !20}
!28 = !{!6, !12, i64 16}
!29 = !{!6, !11, i64 8}
!30 = !{!6, !12, i64 544}
!31 = distinct !{!31, !20}
!32 = distinct !{!32, !20}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass