; LLVM IR from ARMmbed/mbed-crypto :: library (pkcs5)

; 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_asn1_buf = type { i32, i64, ptr }
%struct.mbedtls_md_context_t = type { ptr, ptr, ptr }
%struct.mbedtls_cipher_context_t = type { ptr, i32, i32, ptr, ptr, [16 x i8], i64, [16 x i8], i64, ptr, ptr }
%struct.mbedtls_cipher_info_t = type { i32, i32, i32, ptr, i32, i32, i32, ptr }

@.str = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_pkcs5_pbes2(ptr noundef %0, i32 noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6) #0 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %struct.mbedtls_asn1_buf, align 8
  %22 = alloca %struct.mbedtls_asn1_buf, align 8
  %23 = alloca %struct.mbedtls_asn1_buf, align 8
  %24 = alloca %struct.mbedtls_asn1_buf, align 8
  %25 = alloca %struct.mbedtls_asn1_buf, align 8
  %26 = alloca i32, align 4
  %27 = alloca [32 x i8], align 16
  %28 = alloca [32 x i8], align 16
  %29 = alloca i64, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca %struct.mbedtls_md_context_t, align 8
  %33 = alloca i32, align 4
  %34 = alloca %struct.mbedtls_cipher_context_t, align 8
  %35 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store ptr %2, ptr %11, align 8, !tbaa !5
  store i64 %3, ptr %12, align 8, !tbaa !11
  store ptr %4, ptr %13, align 8, !tbaa !5
  store i64 %5, ptr %14, align 8, !tbaa !11
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %25) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 4, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %28) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  store i64 0, ptr %29, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %32) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr %34) #5
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  store ptr %38, ptr %19, align 8, !tbaa !5
  %39 = load ptr, ptr %19, align 8, !tbaa !5
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %40, i32 0, i32 1
  %42 = load i64, ptr %41, align 8, !tbaa !15
  %43 = getelementptr inbounds i8, ptr %39, i64 %42
  store ptr %43, ptr %20, align 8, !tbaa !5
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !16
  %47 = icmp ne i32 %46, 48
  br i1 %47, label %48, label %49

48:                                               ; preds = %7
  store i32 -12130, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

49:                                               ; preds = %7
  %50 = load ptr, ptr %20, align 8, !tbaa !5
  %51 = call i32 @mbedtls_asn1_get_alg(ptr noundef %19, ptr noundef %50, ptr noundef %21, ptr noundef %23)
  store i32 %51, ptr %16, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %56

53:                                               ; preds = %49
  %54 = load i32, ptr %16, align 4, !tbaa !9
  %55 = add nsw i32 -12032, %54
  store i32 %55, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

56:                                               ; preds = %49
  %57 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %21, i32 0, i32 1
  %58 = load i64, ptr %57, align 8, !tbaa !15
  %59 = icmp ne i64 9, %58
  br i1 %59, label %67, label %60

60:                                               ; preds = %56
  %61 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %21, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !13
  %63 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %21, i32 0, i32 1
  %64 = load i64, ptr %63, align 8, !tbaa !15
  %65 = call i32 @memcmp(ptr noundef @.str, ptr noundef %62, i64 noundef %64) #6
  %66 = icmp ne i32 %65, 0
  br label %67

67:                                               ; preds = %60, %56
  %68 = phi i1 [ true, %56 ], [ %66, %60 ]
  %69 = zext i1 %68 to i32
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %67
  store i32 -11904, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

72:                                               ; preds = %67
  %73 = call i32 @pkcs5_parse_pbkdf2_params(ptr noundef %23, ptr noundef %25, ptr noundef %17, ptr noundef %18, ptr noundef %26)
  store i32 %73, ptr %16, align 4, !tbaa !9
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %72
  %76 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %76, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

77:                                               ; preds = %72
  %78 = load i32, ptr %26, align 4, !tbaa !9
  %79 = call ptr @mbedtls_md_info_from_type(i32 noundef %78)
  store ptr %79, ptr %30, align 8, !tbaa !5
  %80 = load ptr, ptr %30, align 8, !tbaa !5
  %81 = icmp eq ptr %80, null
  br i1 %81, label %82, label %83

82:                                               ; preds = %77
  store i32 -11904, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

83:                                               ; preds = %77
  %84 = load ptr, ptr %20, align 8, !tbaa !5
  %85 = call i32 @mbedtls_asn1_get_alg(ptr noundef %19, ptr noundef %84, ptr noundef %22, ptr noundef %24)
  store i32 %85, ptr %16, align 4, !tbaa !9
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %90

87:                                               ; preds = %83
  %88 = load i32, ptr %16, align 4, !tbaa !9
  %89 = add nsw i32 -12032, %88
  store i32 %89, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

90:                                               ; preds = %83
  %91 = call i32 @mbedtls_oid_get_cipher_alg(ptr noundef %22, ptr noundef %33)
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %94

93:                                               ; preds = %90
  store i32 -11904, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

94:                                               ; preds = %90
  %95 = load i32, ptr %33, align 4, !tbaa !9
  %96 = call ptr @mbedtls_cipher_info_from_type(i32 noundef %95)
  store ptr %96, ptr %31, align 8, !tbaa !5
  %97 = load ptr, ptr %31, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %99, label %100

99:                                               ; preds = %94
  store i32 -11904, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

100:                                              ; preds = %94
  %101 = load ptr, ptr %31, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.mbedtls_cipher_info_t, ptr %101, i32 0, i32 2
  %103 = load i32, ptr %102, align 8, !tbaa !17
  %104 = udiv i32 %103, 8
  store i32 %104, ptr %18, align 4, !tbaa !9
  %105 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %24, i32 0, i32 0
  %106 = load i32, ptr %105, align 8, !tbaa !16
  %107 = icmp ne i32 %106, 4
  br i1 %107, label %116, label %108

108:                                              ; preds = %100
  %109 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %24, i32 0, i32 1
  %110 = load i64, ptr %109, align 8, !tbaa !15
  %111 = load ptr, ptr %31, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.mbedtls_cipher_info_t, ptr %111, i32 0, i32 4
  %113 = load i32, ptr %112, align 8, !tbaa !19
  %114 = zext i32 %113 to i64
  %115 = icmp ne i64 %110, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %108, %100
  store i32 -12032, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

117:                                              ; preds = %108
  call void @mbedtls_md_init(ptr noundef %32)
  call void @mbedtls_cipher_init(ptr noundef %34)
  %118 = getelementptr inbounds [32 x i8], ptr %28, i64 0, i64 0
  %119 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %24, i32 0, i32 2
  %120 = load ptr, ptr %119, align 8, !tbaa !13
  %121 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %24, i32 0, i32 1
  %122 = load i64, ptr %121, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %118, ptr align 1 %120, i64 %122, i1 false)
  %123 = load ptr, ptr %30, align 8, !tbaa !5
  %124 = call i32 @mbedtls_md_setup(ptr noundef %32, ptr noundef %123, i32 noundef 1)
  store i32 %124, ptr %16, align 4, !tbaa !9
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %127

126:                                              ; preds = %117
  br label %164

127:                                              ; preds = %117
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = load i64, ptr %12, align 8, !tbaa !11
  %130 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %25, i32 0, i32 2
  %131 = load ptr, ptr %130, align 8, !tbaa !13
  %132 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %25, i32 0, i32 1
  %133 = load i64, ptr %132, align 8, !tbaa !15
  %134 = load i32, ptr %17, align 4, !tbaa !9
  %135 = load i32, ptr %18, align 4, !tbaa !9
  %136 = getelementptr inbounds [32 x i8], ptr %27, i64 0, i64 0
  %137 = call i32 @mbedtls_pkcs5_pbkdf2_hmac(ptr noundef %32, ptr noundef %128, i64 noundef %129, ptr noundef %131, i64 noundef %133, i32 noundef %134, i32 noundef %135, ptr noundef %136)
  store i32 %137, ptr %16, align 4, !tbaa !9
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %139, label %140

139:                                              ; preds = %127
  br label %164

140:                                              ; preds = %127
  %141 = load ptr, ptr %31, align 8, !tbaa !5
  %142 = call i32 @mbedtls_cipher_setup(ptr noundef %34, ptr noundef %141)
  store i32 %142, ptr %16, align 4, !tbaa !9
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %144, label %145

144:                                              ; preds = %140
  br label %164

145:                                              ; preds = %140
  %146 = getelementptr inbounds [32 x i8], ptr %27, i64 0, i64 0
  %147 = load i32, ptr %18, align 4, !tbaa !9
  %148 = mul nsw i32 8, %147
  %149 = load i32, ptr %10, align 4, !tbaa !9
  %150 = call i32 @mbedtls_cipher_setkey(ptr noundef %34, ptr noundef %146, i32 noundef %148, i32 noundef %149)
  store i32 %150, ptr %16, align 4, !tbaa !9
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %152, label %153

152:                                              ; preds = %145
  br label %164

153:                                              ; preds = %145
  %154 = getelementptr inbounds [32 x i8], ptr %28, i64 0, i64 0
  %155 = getelementptr inbounds %struct.mbedtls_asn1_buf, ptr %24, i32 0, i32 1
  %156 = load i64, ptr %155, align 8, !tbaa !15
  %157 = load ptr, ptr %13, align 8, !tbaa !5
  %158 = load i64, ptr %14, align 8, !tbaa !11
  %159 = load ptr, ptr %15, align 8, !tbaa !5
  %160 = call i32 @mbedtls_cipher_crypt(ptr noundef %34, ptr noundef %154, i64 noundef %156, ptr noundef %157, i64 noundef %158, ptr noundef %159, ptr noundef %29)
  store i32 %160, ptr %16, align 4, !tbaa !9
  %161 = icmp ne i32 %160, 0
  br i1 %161, label %162, label %163

162:                                              ; preds = %153
  store i32 -11776, ptr %16, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %162, %153
  br label %164

164:                                              ; preds = %163, %152, %144, %139, %126
  call void @mbedtls_md_free(ptr noundef %32)
  call void @mbedtls_cipher_free(ptr noundef %34)
  %165 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %165, ptr %8, align 4
  store i32 1, ptr %35, align 4
  br label %166

166:                                              ; preds = %164, %116, %99, %93, %87, %82, %75, %71, %53, %48
  call void @llvm.lifetime.end.p0(i64 96, ptr %34) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %167 = load i32, ptr %8, align 4
  ret i32 %167
}

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

declare i32 @mbedtls_asn1_get_alg(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @pkcs5_parse_pbkdf2_params(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare ptr @mbedtls_md_info_from_type(i32 noundef) #2

declare i32 @mbedtls_oid_get_cipher_alg(ptr noundef, ptr noundef) #2

declare ptr @mbedtls_cipher_info_from_type(i32 noundef) #2

declare void @mbedtls_md_init(ptr noundef) #2

declare void @mbedtls_cipher_init(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare i32 @mbedtls_md_setup(ptr noundef, ptr noundef, i32 noundef) #2

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

declare i32 @mbedtls_cipher_setup(ptr noundef, ptr noundef) #2

declare i32 @mbedtls_cipher_setkey(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

declare i32 @mbedtls_cipher_crypt(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

declare void @mbedtls_md_free(ptr noundef) #2

declare void @mbedtls_cipher_free(ptr noundef) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 willreturn memory(read) "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"mbedtls_asn1_buf", !10, i64 0, !12, i64 8, !6, i64 16}
!15 = !{!14, !12, i64 8}
!16 = !{!14, !10, i64 0}
!17 = !{!18, !10, i64 8}
!18 = !{!"mbedtls_cipher_info_t", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40}
!19 = !{!18, !10, i64 24}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.mbedtls_asn1_buf = type { i32, i64, ptr }
%struct.mbedtls_md_context_t = type { ptr, ptr, ptr }
%struct.mbedtls_cipher_context_t = type { ptr, i32, i32, ptr, ptr, [16 x i8], i64, [16 x i8], i64, ptr, ptr }

@.str = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_pkcs5_pbes2(ptr nocapture noundef readonly %0, i32 noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %struct.mbedtls_asn1_buf, align 8
  %12 = alloca %struct.mbedtls_asn1_buf, align 8
  %13 = alloca %struct.mbedtls_asn1_buf, align 8
  %14 = alloca %struct.mbedtls_asn1_buf, align 8
  %15 = alloca %struct.mbedtls_asn1_buf, align 8
  %16 = alloca i32, align 4
  %17 = alloca [32 x i8], align 16
  %18 = alloca [32 x i8], align 16
  %19 = alloca i64, align 8
  %20 = alloca %struct.mbedtls_md_context_t, align 8
  %21 = alloca i32, align 4
  %22 = alloca %struct.mbedtls_cipher_context_t, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #5
  store i32 4, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %17) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #5
  store i64 0, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %22) #5
  %23 = getelementptr inbounds i8, ptr %0, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  store ptr %24, ptr %10, align 8, !tbaa !14
  %25 = getelementptr inbounds i8, ptr %0, i64 8
  %26 = load i64, ptr %25, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %24, i64 %26
  %28 = load i32, ptr %0, align 8, !tbaa !16
  %.not = icmp eq i32 %28, 48
  br i1 %.not, label %29, label %.critedge

29:                                               ; preds = %7
  %30 = call i32 @mbedtls_asn1_get_alg(ptr noundef nonnull %10, ptr noundef %27, ptr noundef nonnull %11, ptr noundef nonnull %13) #5
  %.not32 = icmp eq i32 %30, 0
  br i1 %.not32, label %33, label %31

31:                                               ; preds = %29
  %32 = add nsw i32 %30, -12032
  br label %.critedge

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %11, i64 8
  %35 = load i64, ptr %34, align 8, !tbaa !15
  %.not33 = icmp eq i64 %35, 9
  br i1 %.not33, label %36, label %.critedge

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %11, i64 16
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(9) @.str, ptr noundef nonnull dereferenceable(9) %38, i64 9)
  %.not44 = icmp eq i32 %bcmp, 0
  br i1 %.not44, label %39, label %.critedge

39:                                               ; preds = %36
  %40 = call i32 @pkcs5_parse_pbkdf2_params(ptr noundef nonnull %13, ptr noundef nonnull %15, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %16)
  %.not34 = icmp eq i32 %40, 0
  br i1 %.not34, label %41, label %.critedge

41:                                               ; preds = %39
  %42 = load i32, ptr %16, align 4, !tbaa !5
  %43 = call ptr @mbedtls_md_info_from_type(i32 noundef %42) #5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %.critedge, label %45

45:                                               ; preds = %41
  %46 = call i32 @mbedtls_asn1_get_alg(ptr noundef nonnull %10, ptr noundef %27, ptr noundef nonnull %12, ptr noundef nonnull %14) #5
  %.not35 = icmp eq i32 %46, 0
  br i1 %.not35, label %49, label %47

47:                                               ; preds = %45
  %48 = add nsw i32 %46, -12032
  br label %.critedge

49:                                               ; preds = %45
  %50 = call i32 @mbedtls_oid_get_cipher_alg(ptr noundef nonnull %12, ptr noundef nonnull %21) #5
  %.not36 = icmp eq i32 %50, 0
  br i1 %.not36, label %51, label %.critedge

51:                                               ; preds = %49
  %52 = load i32, ptr %21, align 4, !tbaa !5
  %53 = call ptr @mbedtls_cipher_info_from_type(i32 noundef %52) #5
  %54 = icmp eq ptr %53, null
  br i1 %54, label %.critedge, label %55

55:                                               ; preds = %51
  %56 = getelementptr inbounds i8, ptr %53, i64 8
  %57 = load i32, ptr %56, align 8, !tbaa !17
  %58 = lshr i32 %57, 3
  store i32 %58, ptr %9, align 4, !tbaa !5
  %59 = load i32, ptr %14, align 8, !tbaa !16
  %.not37 = icmp eq i32 %59, 4
  br i1 %.not37, label %60, label %.critedge

60:                                               ; preds = %55
  %61 = getelementptr inbounds i8, ptr %14, i64 8
  %62 = load i64, ptr %61, align 8, !tbaa !15
  %63 = getelementptr inbounds i8, ptr %53, i64 24
  %64 = load i32, ptr %63, align 8, !tbaa !19
  %65 = zext i32 %64 to i64
  %.not38 = icmp eq i64 %62, %65
  br i1 %.not38, label %66, label %.critedge

66:                                               ; preds = %60
  call void @mbedtls_md_init(ptr noundef nonnull %20) #5
  call void @mbedtls_cipher_init(ptr noundef nonnull %22) #5
  %67 = getelementptr inbounds i8, ptr %14, i64 16
  %68 = load ptr, ptr %67, align 8, !tbaa !11
  %69 = load i64, ptr %61, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %18, ptr align 1 %68, i64 %69, i1 false)
  %70 = call i32 @mbedtls_md_setup(ptr noundef nonnull %20, ptr noundef nonnull %43, i32 noundef 1) #5
  %.not39 = icmp eq i32 %70, 0
  br i1 %.not39, label %71, label %88

71:                                               ; preds = %66
  %72 = getelementptr inbounds i8, ptr %15, i64 16
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  %74 = getelementptr inbounds i8, ptr %15, i64 8
  %75 = load i64, ptr %74, align 8, !tbaa !15
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = call i32 @mbedtls_pkcs5_pbkdf2_hmac(ptr noundef nonnull %20, ptr noundef %2, i64 noundef %3, ptr noundef %73, i64 noundef %75, i32 noundef %76, i32 noundef %77, ptr noundef nonnull %17)
  %.not40 = icmp eq i32 %78, 0
  br i1 %.not40, label %79, label %88

79:                                               ; preds = %71
  %80 = call i32 @mbedtls_cipher_setup(ptr noundef nonnull %22, ptr noundef nonnull %53) #5
  %.not41 = icmp eq i32 %80, 0
  br i1 %.not41, label %81, label %88

81:                                               ; preds = %79
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = shl nsw i32 %82, 3
  %84 = call i32 @mbedtls_cipher_setkey(ptr noundef nonnull %22, ptr noundef nonnull %17, i32 noundef %83, i32 noundef %1) #5
  %.not42 = icmp eq i32 %84, 0
  br i1 %.not42, label %85, label %88

85:                                               ; preds = %81
  %86 = load i64, ptr %61, align 8, !tbaa !15
  %87 = call i32 @mbedtls_cipher_crypt(ptr noundef nonnull %22, ptr noundef nonnull %18, i64 noundef %86, ptr noundef %4, i64 noundef %5, ptr noundef %6, ptr noundef nonnull %19) #5
  %.not43 = icmp eq i32 %87, 0
  %spec.store.select = select i1 %.not43, i32 0, i32 -11776
  br label %88

88:                                               ; preds = %81, %79, %71, %66, %85
  %.021 = phi i32 [ %70, %66 ], [ %78, %71 ], [ %80, %79 ], [ %84, %81 ], [ %spec.store.select, %85 ]
  call void @mbedtls_md_free(ptr noundef nonnull %20) #5
  call void @mbedtls_cipher_free(ptr noundef nonnull %22) #5
  br label %.critedge

.critedge:                                        ; preds = %33, %55, %60, %51, %49, %41, %39, %36, %7, %88, %47, %31
  %.0 = phi i32 [ %32, %31 ], [ %48, %47 ], [ %.021, %88 ], [ -12130, %7 ], [ -11904, %36 ], [ %40, %39 ], [ -11904, %41 ], [ -11904, %49 ], [ -11904, %51 ], [ -12032, %60 ], [ -12032, %55 ], [ -11904, %33 ]
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %18) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  ret i32 %.0
}

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

declare i32 @mbedtls_asn1_get_alg(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @pkcs5_parse_pbkdf2_params(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @mbedtls_md_info_from_type(i32 noundef) local_unnamed_addr #2

declare i32 @mbedtls_oid_get_cipher_alg(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @mbedtls_cipher_info_from_type(i32 noundef) local_unnamed_addr #2

declare void @mbedtls_md_init(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_cipher_init(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare i32 @mbedtls_md_setup(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

declare i32 @mbedtls_cipher_setup(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @mbedtls_cipher_setkey(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @mbedtls_cipher_crypt(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @mbedtls_md_free(ptr noundef) local_unnamed_addr #2

declare void @mbedtls_cipher_free(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4

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


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