; LLVM IR from specinfo-ua/UAPKI :: library/cm-pkcs12/src/storage (jks-utils)

; 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.EncryptedPrivateKeyInfo = type { %struct.AlgorithmIdentifier, %struct.OCTET_STRING, %struct.asn_struct_ctx_s }
%struct.AlgorithmIdentifier = type { %struct.ASN__PRIMITIVE_TYPE_s, ptr, %struct.asn_struct_ctx_s }
%struct.ASN__PRIMITIVE_TYPE_s = type { ptr, i32 }
%struct.OCTET_STRING = type { ptr, i32, %struct.asn_struct_ctx_s }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }

@.str = external hidden unnamed_addr constant [30 x i8], align 1
@OID_JKS_KEY_PROTECTOR = external global ptr, align 8

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) #1

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 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 i32 @jks_pass_to_ba(ptr noundef, ptr noundef) #2

declare void @ba_free_private(ptr noundef) #1

declare void @ba_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @jks_decrypt_key(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  store ptr null, ptr %18, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %24, label %22

22:                                               ; preds = %19
  store i32 2, ptr %7, align 4, !tbaa !9
  %23 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 206, i32 noundef %23, ptr noundef null)
  br label %191

24:                                               ; preds = %19
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %32, label %30

30:                                               ; preds = %27
  store i32 2, ptr %7, align 4, !tbaa !9
  %31 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 207, i32 noundef %31, ptr noundef null)
  br label %191

32:                                               ; preds = %27
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %40, label %38

38:                                               ; preds = %35
  store i32 2, ptr %7, align 4, !tbaa !9
  %39 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 208, i32 noundef %39, ptr noundef null)
  br label %191

40:                                               ; preds = %35
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.EncryptedPrivateKeyInfo, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.AlgorithmIdentifier, ptr %45, i32 0, i32 0
  %47 = call i32 @asn_oid_to_text(ptr noundef %46, ptr noundef %14)
  store i32 %47, ptr %7, align 4, !tbaa !9
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %52

50:                                               ; preds = %43
  %51 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 210, i32 noundef %51)
  br label %191

52:                                               ; preds = %43
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr %14, align 8, !tbaa !5
  %56 = load ptr, ptr @OID_JKS_KEY_PROTECTOR, align 8, !tbaa !5
  %57 = call i32 @strcmp(ptr noundef %55, ptr noundef %56) #6
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %64

59:                                               ; preds = %54
  br label %60

60:                                               ; preds = %59
  store i32 1058, ptr %7, align 4, !tbaa !9
  %61 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 212, i32 noundef %61, ptr noundef null)
  br label %191

62:                                               ; No predecessors!
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63, %54
  br label %65

65:                                               ; preds = %64
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.EncryptedPrivateKeyInfo, ptr %66, i32 0, i32 1
  %68 = call i32 @asn_OCTSTRING2ba(ptr noundef %67, ptr noundef %10)
  store i32 %68, ptr %7, align 4, !tbaa !9
  %69 = load i32, ptr %7, align 4, !tbaa !9
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %73

71:                                               ; preds = %65
  %72 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 215, i32 noundef %72)
  br label %191

73:                                               ; preds = %65
  br label %74

74:                                               ; preds = %73
  br label %75

75:                                               ; preds = %74
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = call i64 @ba_get_len(ptr noundef %76)
  %78 = sub i64 %77, 20
  %79 = sub i64 %78, 20
  store i64 %79, ptr %9, align 8, !tbaa !11
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %80

80:                                               ; preds = %75
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = load i64, ptr %8, align 8, !tbaa !11
  %83 = call ptr @ba_copy_with_alloc(ptr noundef %81, i64 noundef %82, i64 noundef 20)
  store ptr %83, ptr %11, align 8, !tbaa !5
  %84 = icmp eq ptr null, %83
  br i1 %84, label %85, label %87

85:                                               ; preds = %80
  store i32 2, ptr %7, align 4, !tbaa !9
  %86 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 219, i32 noundef %86)
  br label %191

87:                                               ; preds = %80
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %8, align 8, !tbaa !11
  %91 = add i64 %90, 20
  store i64 %91, ptr %8, align 8, !tbaa !11
  br label %92

92:                                               ; preds = %89
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = load i64, ptr %8, align 8, !tbaa !11
  %95 = load i64, ptr %9, align 8, !tbaa !11
  %96 = call ptr @ba_copy_with_alloc(ptr noundef %93, i64 noundef %94, i64 noundef %95)
  store ptr %96, ptr %12, align 8, !tbaa !5
  %97 = icmp eq ptr null, %96
  br i1 %97, label %98, label %100

98:                                               ; preds = %92
  store i32 2, ptr %7, align 4, !tbaa !9
  %99 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 222, i32 noundef %99)
  br label %191

100:                                              ; preds = %92
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  %103 = load i64, ptr %9, align 8, !tbaa !11
  %104 = load i64, ptr %8, align 8, !tbaa !11
  %105 = add i64 %104, %103
  store i64 %105, ptr %8, align 8, !tbaa !11
  br label %106

106:                                              ; preds = %102
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load i64, ptr %8, align 8, !tbaa !11
  %109 = call ptr @ba_copy_with_alloc(ptr noundef %107, i64 noundef %108, i64 noundef 20)
  store ptr %109, ptr %17, align 8, !tbaa !5
  %110 = icmp eq ptr null, %109
  br i1 %110, label %111, label %113

111:                                              ; preds = %106
  store i32 2, ptr %7, align 4, !tbaa !9
  %112 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 225, i32 noundef %112)
  br label %191

113:                                              ; preds = %106
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = call i32 @jks_pass_to_ba(ptr noundef %117, ptr noundef %16)
  store i32 %118, ptr %7, align 4, !tbaa !9
  %119 = load i32, ptr %7, align 4, !tbaa !9
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %123

121:                                              ; preds = %116
  %122 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 227, i32 noundef %122)
  br label %191

123:                                              ; preds = %116
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = call ptr @sha1_alloc()
  store ptr %127, ptr %15, align 8, !tbaa !5
  %128 = icmp eq ptr null, %127
  br i1 %128, label %129, label %131

129:                                              ; preds = %126
  store i32 2, ptr %7, align 4, !tbaa !9
  %130 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 228, i32 noundef %130)
  br label %191

131:                                              ; preds = %126
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load ptr, ptr %15, align 8, !tbaa !5
  %136 = load ptr, ptr %12, align 8, !tbaa !5
  %137 = load ptr, ptr %16, align 8, !tbaa !5
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = call i32 @jks_xor_key(ptr noundef %135, ptr noundef %136, ptr noundef %137, ptr noundef %138, ptr noundef %13)
  store i32 %139, ptr %7, align 4, !tbaa !9
  %140 = load i32, ptr %7, align 4, !tbaa !9
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %144

142:                                              ; preds = %134
  %143 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 230, i32 noundef %143)
  br label %191

144:                                              ; preds = %134
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  %148 = load ptr, ptr %15, align 8, !tbaa !5
  %149 = load ptr, ptr %16, align 8, !tbaa !5
  %150 = call i32 @sha1_update(ptr noundef %148, ptr noundef %149)
  store i32 %150, ptr %7, align 4, !tbaa !9
  %151 = load i32, ptr %7, align 4, !tbaa !9
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %153, label %155

153:                                              ; preds = %147
  %154 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 239, i32 noundef %154)
  br label %191

155:                                              ; preds = %147
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  %159 = load ptr, ptr %15, align 8, !tbaa !5
  %160 = load ptr, ptr %13, align 8, !tbaa !5
  %161 = call i32 @sha1_update(ptr noundef %159, ptr noundef %160)
  store i32 %161, ptr %7, align 4, !tbaa !9
  %162 = load i32, ptr %7, align 4, !tbaa !9
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %164, label %166

164:                                              ; preds = %158
  %165 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 240, i32 noundef %165)
  br label %191

166:                                              ; preds = %158
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167
  br label %169

169:                                              ; preds = %168
  %170 = load ptr, ptr %15, align 8, !tbaa !5
  %171 = call i32 @sha1_final(ptr noundef %170, ptr noundef %18)
  store i32 %171, ptr %7, align 4, !tbaa !9
  %172 = load i32, ptr %7, align 4, !tbaa !9
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %176

174:                                              ; preds = %169
  %175 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 242, i32 noundef %175)
  br label %191

176:                                              ; preds = %169
  br label %177

177:                                              ; preds = %176
  br label %178

178:                                              ; preds = %177
  %179 = load ptr, ptr %17, align 8, !tbaa !5
  %180 = load ptr, ptr %18, align 8, !tbaa !5
  %181 = call i32 @ba_cmp(ptr noundef %179, ptr noundef %180)
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %188

183:                                              ; preds = %178
  br label %184

184:                                              ; preds = %183
  store i32 1041, ptr %7, align 4, !tbaa !9
  %185 = load i32, ptr %7, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 245, i32 noundef %185, ptr noundef null)
  br label %191

186:                                              ; No predecessors!
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187, %178
  %189 = load ptr, ptr %13, align 8, !tbaa !5
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %189, ptr %190, align 8, !tbaa !5
  store ptr null, ptr %13, align 8, !tbaa !5
  br label %191

191:                                              ; preds = %188, %184, %174, %164, %153, %142, %129, %121, %111, %98, %85, %71, %60, %50, %38, %30, %22
  %192 = load ptr, ptr %15, align 8, !tbaa !5
  call void @sha1_free(ptr noundef %192)
  %193 = load ptr, ptr %16, align 8, !tbaa !5
  call void @ba_free_private(ptr noundef %193)
  %194 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ba_free_private(ptr noundef %194)
  %195 = load ptr, ptr %10, align 8, !tbaa !5
  call void @ba_free(ptr noundef %195)
  %196 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ba_free(ptr noundef %196)
  %197 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ba_free(ptr noundef %197)
  %198 = load ptr, ptr %17, align 8, !tbaa !5
  call void @ba_free(ptr noundef %198)
  %199 = load ptr, ptr %18, align 8, !tbaa !5
  call void @ba_free(ptr noundef %199)
  %200 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %200) #5
  %201 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret i32 %201
}

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

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

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

declare i64 @ba_get_len(ptr noundef) #1

declare ptr @ba_copy_with_alloc(ptr noundef, i64 noundef, i64 noundef) #1

declare ptr @sha1_alloc() #1

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

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

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

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

declare void @sha1_free(ptr noundef) #1

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

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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind 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 = { 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 #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}


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

@.str = external hidden unnamed_addr constant [30 x i8], align 1
@OID_JKS_KEY_PROTECTOR = external local_unnamed_addr global ptr, align 8

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress 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 i32 @jks_pass_to_ba(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @ba_free_private(ptr noundef) local_unnamed_addr #1

declare void @ba_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @jks_decrypt_key(ptr noundef %0, ptr noundef %1, ptr noundef writeonly %2) local_unnamed_addr #2 {
  %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
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  store ptr null, ptr %8, align 8, !tbaa !5
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %9, label %10

9:                                                ; preds = %3
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 206, i32 noundef 2, ptr noundef null) #5
  br label %73

10:                                               ; preds = %3
  %.not70 = icmp eq ptr %1, null
  br i1 %.not70, label %11, label %12

11:                                               ; preds = %10
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 207, i32 noundef 2, ptr noundef null) #5
  br label %73

12:                                               ; preds = %10
  %.not71 = icmp eq ptr %2, null
  br i1 %.not71, label %13, label %14

13:                                               ; preds = %12
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 208, i32 noundef 2, ptr noundef null) #5
  br label %73

14:                                               ; preds = %12
  %15 = call i32 @asn_oid_to_text(ptr noundef nonnull %0, ptr noundef nonnull %6) #5
  %.not72 = icmp eq i32 %15, 0
  br i1 %.not72, label %17, label %16

16:                                               ; preds = %14
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 210, i32 noundef %15) #5
  br label %73

17:                                               ; preds = %14
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = load ptr, ptr @OID_JKS_KEY_PROTECTOR, align 8, !tbaa !5
  %20 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) %19) #6
  %.not73 = icmp eq i32 %20, 0
  br i1 %.not73, label %22, label %21

21:                                               ; preds = %17
  call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 212, i32 noundef 1058, ptr noundef null) #5
  br label %73

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %0, i64 48
  %24 = call i32 @asn_OCTSTRING2ba(ptr noundef nonnull %23, ptr noundef nonnull %4) #5
  %.not74 = icmp eq i32 %24, 0
  br i1 %.not74, label %26, label %25

25:                                               ; preds = %22
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 215, i32 noundef %24) #5
  br label %73

26:                                               ; preds = %22
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call i64 @ba_get_len(ptr noundef %27) #5
  %29 = add i64 %28, -20
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = call ptr @ba_copy_with_alloc(ptr noundef %30, i64 noundef 0, i64 noundef 20) #5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %26
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 219, i32 noundef 2) #5
  br label %73

34:                                               ; preds = %26
  %35 = add i64 %28, -40
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call ptr @ba_copy_with_alloc(ptr noundef %36, i64 noundef 20, i64 noundef %35) #5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 222, i32 noundef 2) #5
  br label %73

40:                                               ; preds = %34
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = call ptr @ba_copy_with_alloc(ptr noundef %41, i64 noundef %29, i64 noundef 20) #5
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %40
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 225, i32 noundef 2) #5
  br label %73

45:                                               ; preds = %40
  %46 = call i32 @jks_pass_to_ba(ptr noundef nonnull %1, ptr noundef nonnull %7)
  %.not75 = icmp eq i32 %46, 0
  br i1 %.not75, label %48, label %47

47:                                               ; preds = %45
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 227, i32 noundef %46) #5
  br label %73

48:                                               ; preds = %45
  %49 = call ptr @sha1_alloc() #5
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 228, i32 noundef 2) #5
  br label %73

52:                                               ; preds = %48
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = call i32 @jks_xor_key(ptr noundef nonnull %49, ptr noundef nonnull %37, ptr noundef %53, ptr noundef nonnull %31, ptr noundef nonnull %5)
  %.not76 = icmp eq i32 %54, 0
  br i1 %.not76, label %56, label %55

55:                                               ; preds = %52
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 230, i32 noundef %54) #5
  br label %73

56:                                               ; preds = %52
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = call i32 @sha1_update(ptr noundef nonnull %49, ptr noundef %57) #5
  %.not77 = icmp eq i32 %58, 0
  br i1 %.not77, label %60, label %59

59:                                               ; preds = %56
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 239, i32 noundef %58) #5
  br label %73

60:                                               ; preds = %56
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = call i32 @sha1_update(ptr noundef nonnull %49, ptr noundef %61) #5
  %.not78 = icmp eq i32 %62, 0
  br i1 %.not78, label %64, label %63

63:                                               ; preds = %60
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 240, i32 noundef %62) #5
  br label %73

64:                                               ; preds = %60
  %65 = call i32 @sha1_final(ptr noundef nonnull %49, ptr noundef nonnull %8) #5
  %.not79 = icmp eq i32 %65, 0
  br i1 %.not79, label %67, label %66

66:                                               ; preds = %64
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 242, i32 noundef %65) #5
  br label %73

67:                                               ; preds = %64
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = call i32 @ba_cmp(ptr noundef nonnull %42, ptr noundef %68) #5
  %.not80 = icmp eq i32 %69, 0
  br i1 %.not80, label %71, label %70

70:                                               ; preds = %67
  call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 245, i32 noundef 1041, ptr noundef null) #5
  br label %73

71:                                               ; preds = %67
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %72, ptr %2, align 8, !tbaa !5
  store ptr null, ptr %5, align 8, !tbaa !5
  br label %73

73:                                               ; preds = %71, %70, %66, %63, %59, %55, %51, %47, %44, %39, %33, %25, %21, %16, %13, %11, %9
  %.051 = phi i32 [ %15, %16 ], [ 1058, %21 ], [ %24, %25 ], [ 2, %33 ], [ 2, %39 ], [ 2, %44 ], [ %46, %47 ], [ 2, %51 ], [ %54, %55 ], [ %58, %59 ], [ %62, %63 ], [ %65, %66 ], [ 1041, %70 ], [ 0, %71 ], [ 2, %13 ], [ 2, %11 ], [ 2, %9 ]
  %.050 = phi ptr [ null, %16 ], [ null, %21 ], [ null, %25 ], [ null, %33 ], [ %31, %39 ], [ %31, %44 ], [ %31, %47 ], [ %31, %51 ], [ %31, %55 ], [ %31, %59 ], [ %31, %63 ], [ %31, %66 ], [ %31, %70 ], [ %31, %71 ], [ null, %13 ], [ null, %11 ], [ null, %9 ]
  %.049 = phi ptr [ null, %16 ], [ null, %21 ], [ null, %25 ], [ null, %33 ], [ null, %39 ], [ %37, %44 ], [ %37, %47 ], [ %37, %51 ], [ %37, %55 ], [ %37, %59 ], [ %37, %63 ], [ %37, %66 ], [ %37, %70 ], [ %37, %71 ], [ null, %13 ], [ null, %11 ], [ null, %9 ]
  %.048 = phi ptr [ null, %16 ], [ null, %21 ], [ null, %25 ], [ null, %33 ], [ null, %39 ], [ null, %44 ], [ null, %47 ], [ null, %51 ], [ %49, %55 ], [ %49, %59 ], [ %49, %63 ], [ %49, %66 ], [ %49, %70 ], [ %49, %71 ], [ null, %13 ], [ null, %11 ], [ null, %9 ]
  %.0 = phi ptr [ null, %16 ], [ null, %21 ], [ null, %25 ], [ null, %33 ], [ null, %39 ], [ null, %44 ], [ %42, %47 ], [ %42, %51 ], [ %42, %55 ], [ %42, %59 ], [ %42, %63 ], [ %42, %66 ], [ %42, %70 ], [ %42, %71 ], [ null, %13 ], [ null, %11 ], [ null, %9 ]
  call void @sha1_free(ptr noundef %.048) #5
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  call void @ba_free_private(ptr noundef %74) #5
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ba_free_private(ptr noundef %75) #5
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ba_free(ptr noundef %76) #5
  call void @ba_free(ptr noundef %.050) #5
  call void @ba_free(ptr noundef %.049) #5
  call void @ba_free(ptr noundef %.0) #5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ba_free(ptr noundef %77) #5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %78) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  ret i32 %.051
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

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

declare i64 @ba_get_len(ptr noundef) local_unnamed_addr #1

declare ptr @ba_copy_with_alloc(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

declare ptr @sha1_alloc() local_unnamed_addr #1

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

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

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

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

declare void @sha1_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: 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 = { 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 #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"}


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