; LLVM IR from specinfo-ua/UAPKI :: library/cm-pkcs12/src/storage (pkcs12-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.MacData = type { %struct.DigestInfo, %struct.OCTET_STRING, ptr, %struct.asn_struct_ctx_s }
%struct.DigestInfo = 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 [33 x i8], align 1

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

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

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

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

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

declare i32 @pbkdf1(ptr noundef, ptr noundef, i8 noundef zeroext, i64 noundef, i64 noundef, i32 noundef, ptr noundef) #2

declare void @ba_free(ptr noundef) #2

declare void @asn_free(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

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

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

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

18:                                               ; preds = %5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %23, label %21

21:                                               ; preds = %18
  store i32 2, ptr %11, align 4, !tbaa !11
  %22 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 317, i32 noundef %22, ptr noundef null)
  br label %202

23:                                               ; preds = %18
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  br label %26

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

29:                                               ; preds = %26
  store i32 2, ptr %11, align 4, !tbaa !11
  %30 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 318, i32 noundef %30, ptr noundef null)
  br label %202

31:                                               ; preds = %26
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  %35 = load i64, ptr %8, align 8, !tbaa !9
  %36 = icmp ne i64 %35, 0
  br i1 %36, label %39, label %37

37:                                               ; preds = %34
  store i32 2, ptr %11, align 4, !tbaa !11
  %38 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 319, i32 noundef %38, ptr noundef null)
  br label %202

39:                                               ; preds = %34
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %47, label %45

45:                                               ; preds = %42
  store i32 2, ptr %11, align 4, !tbaa !11
  %46 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 320, i32 noundef %46, ptr noundef null)
  br label %202

47:                                               ; preds = %42
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %55, label %53

53:                                               ; preds = %50
  store i32 2, ptr %11, align 4, !tbaa !11
  %54 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 321, i32 noundef %54, ptr noundef null)
  br label %202

55:                                               ; preds = %50
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = call i32 @hash_from_oid(ptr noundef %58)
  store i32 %59, ptr %12, align 4, !tbaa !11
  %60 = load i32, ptr %12, align 4, !tbaa !11
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %67

62:                                               ; preds = %57
  br label %63

63:                                               ; preds = %62
  store i32 1047, ptr %11, align 4, !tbaa !11
  %64 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 325, i32 noundef %64, ptr noundef null)
  br label %202

65:                                               ; No predecessors!
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66, %57
  br label %68

68:                                               ; preds = %67
  %69 = call ptr @ba_alloc_by_len(i64 noundef 20)
  store ptr %69, ptr %13, align 8, !tbaa !5
  %70 = icmp eq ptr null, %69
  br i1 %70, label %71, label %73

71:                                               ; preds = %68
  store i32 2, ptr %11, align 4, !tbaa !11
  %72 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 328, i32 noundef %72)
  br label %202

73:                                               ; preds = %68
  br label %74

74:                                               ; preds = %73
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = call i32 @drbg_random(ptr noundef %77)
  store i32 %78, ptr %11, align 4, !tbaa !11
  %79 = load i32, ptr %11, align 4, !tbaa !11
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %83

81:                                               ; preds = %76
  %82 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 329, i32 noundef %82)
  br label %202

83:                                               ; preds = %76
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = load i64, ptr %8, align 8, !tbaa !9
  %90 = load i32, ptr %12, align 4, !tbaa !11
  %91 = call i32 @pbkdf1(ptr noundef %87, ptr noundef %88, i8 noundef zeroext 3, i64 noundef %89, i64 noundef 0, i32 noundef %90, ptr noundef %14)
  store i32 %91, ptr %11, align 4, !tbaa !11
  %92 = load i32, ptr %11, align 4, !tbaa !11
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %96

94:                                               ; preds = %86
  %95 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 332, i32 noundef %95)
  br label %202

96:                                               ; preds = %86
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %12, align 4, !tbaa !11
  %101 = load ptr, ptr %14, align 8, !tbaa !5
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = call i32 @pkcs12_calc_hmac(i32 noundef %100, ptr noundef %101, ptr noundef %102, ptr noundef %15)
  store i32 %103, ptr %11, align 4, !tbaa !11
  %104 = load i32, ptr %11, align 4, !tbaa !11
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %108

106:                                              ; preds = %99
  %107 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 333, i32 noundef %107)
  br label %202

108:                                              ; preds = %99
  br label %109

109:                                              ; preds = %108
  br label %110

110:                                              ; preds = %109
  %111 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 184) #5
  store ptr %111, ptr %16, align 8, !tbaa !5
  %112 = load ptr, ptr %16, align 8, !tbaa !5
  %113 = icmp eq ptr %112, null
  br i1 %113, label %114, label %116

114:                                              ; preds = %110
  store i32 1, ptr %11, align 4, !tbaa !11
  %115 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 336, i32 noundef %115, ptr noundef null)
  br label %202

116:                                              ; preds = %110
  %117 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 16) #5
  %118 = load ptr, ptr %16, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.MacData, ptr %118, i32 0, i32 2
  store ptr %117, ptr %119, align 8, !tbaa !13
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.MacData, ptr %120, i32 0, i32 2
  %122 = load ptr, ptr %121, align 8, !tbaa !13
  %123 = icmp eq ptr %122, null
  br i1 %123, label %124, label %126

124:                                              ; preds = %116
  store i32 1, ptr %11, align 4, !tbaa !11
  %125 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 337, i32 noundef %125, ptr noundef null)
  br label %202

126:                                              ; preds = %116
  %127 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 4) #5
  store ptr %127, ptr %17, align 8, !tbaa !5
  %128 = load ptr, ptr %17, align 8, !tbaa !5
  %129 = icmp eq ptr %128, null
  br i1 %129, label %130, label %132

130:                                              ; preds = %126
  store i32 1, ptr %11, align 4, !tbaa !11
  %131 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 338, i32 noundef %131, ptr noundef null)
  br label %202

132:                                              ; preds = %126
  br label %133

133:                                              ; preds = %132
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = load ptr, ptr %16, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.MacData, ptr %135, i32 0, i32 0
  %137 = getelementptr inbounds %struct.DigestInfo, ptr %136, i32 0, i32 0
  %138 = getelementptr inbounds %struct.AlgorithmIdentifier, ptr %137, i32 0, i32 0
  %139 = call i32 @asn_set_oid_from_text(ptr noundef %134, ptr noundef %138)
  store i32 %139, ptr %11, align 4, !tbaa !11
  %140 = load i32, ptr %11, align 4, !tbaa !11
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %144

142:                                              ; preds = %133
  %143 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 339, i32 noundef %143)
  br label %202

144:                                              ; preds = %133
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  %148 = call ptr @get_NULL_desc()
  %149 = load ptr, ptr %17, align 8, !tbaa !5
  %150 = load ptr, ptr %16, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.MacData, ptr %150, i32 0, i32 0
  %152 = getelementptr inbounds %struct.DigestInfo, ptr %151, i32 0, i32 0
  %153 = getelementptr inbounds %struct.AlgorithmIdentifier, ptr %152, i32 0, i32 1
  %154 = call i32 @asn_create_any(ptr noundef %148, ptr noundef %149, ptr noundef %153)
  store i32 %154, ptr %11, align 4, !tbaa !11
  %155 = load i32, ptr %11, align 4, !tbaa !11
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %159

157:                                              ; preds = %147
  %158 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 340, i32 noundef %158)
  br label %202

159:                                              ; preds = %147
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = load ptr, ptr %15, align 8, !tbaa !5
  %164 = load ptr, ptr %16, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.MacData, ptr %164, i32 0, i32 0
  %166 = getelementptr inbounds %struct.DigestInfo, ptr %165, i32 0, i32 1
  %167 = call i32 @asn_ba2OCTSTRING(ptr noundef %163, ptr noundef %166)
  store i32 %167, ptr %11, align 4, !tbaa !11
  %168 = load i32, ptr %11, align 4, !tbaa !11
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %172

170:                                              ; preds = %162
  %171 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 341, i32 noundef %171)
  br label %202

172:                                              ; preds = %162
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174
  %176 = load ptr, ptr %13, align 8, !tbaa !5
  %177 = load ptr, ptr %16, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.MacData, ptr %177, i32 0, i32 1
  %179 = call i32 @asn_ba2OCTSTRING(ptr noundef %176, ptr noundef %178)
  store i32 %179, ptr %11, align 4, !tbaa !11
  %180 = load i32, ptr %11, align 4, !tbaa !11
  %181 = icmp ne i32 %180, 0
  br i1 %181, label %182, label %184

182:                                              ; preds = %175
  %183 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 342, i32 noundef %183)
  br label %202

184:                                              ; preds = %175
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  %188 = load ptr, ptr %16, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.MacData, ptr %188, i32 0, i32 2
  %190 = load ptr, ptr %189, align 8, !tbaa !13
  %191 = load i64, ptr %8, align 8, !tbaa !9
  %192 = call i32 @asn_ulong2INTEGER(ptr noundef %190, i64 noundef %191)
  store i32 %192, ptr %11, align 4, !tbaa !11
  %193 = load i32, ptr %11, align 4, !tbaa !11
  %194 = icmp ne i32 %193, 0
  br i1 %194, label %195, label %197

195:                                              ; preds = %187
  %196 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 343, i32 noundef %196)
  br label %202

197:                                              ; preds = %187
  br label %198

198:                                              ; preds = %197
  br label %199

199:                                              ; preds = %198
  %200 = load ptr, ptr %16, align 8, !tbaa !5
  %201 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %200, ptr %201, align 8, !tbaa !5
  store ptr null, ptr %16, align 8, !tbaa !5
  br label %202

202:                                              ; preds = %199, %195, %182, %170, %157, %142, %130, %124, %114, %106, %94, %81, %71, %63, %53, %45, %37, %29, %21
  %203 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ba_free(ptr noundef %203)
  %204 = load ptr, ptr %14, align 8, !tbaa !5
  call void @ba_free(ptr noundef %204)
  %205 = load ptr, ptr %15, align 8, !tbaa !5
  call void @ba_free(ptr noundef %205)
  %206 = call ptr @get_MacData_desc()
  %207 = load ptr, ptr %16, align 8, !tbaa !5
  call void @asn_free(ptr noundef %206, ptr noundef %207)
  %208 = call ptr @get_NULL_desc()
  %209 = load ptr, ptr %17, align 8, !tbaa !5
  call void @asn_free(ptr noundef %208, ptr noundef %209)
  %210 = load i32, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret i32 %210
}

declare i32 @hash_from_oid(ptr noundef) #2

declare ptr @ba_alloc_by_len(i64 noundef) #2

declare i32 @drbg_random(ptr noundef) #2

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

declare ptr @get_NULL_desc() #2

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

declare ptr @get_MacData_desc() #2

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 allocsize(0,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 #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 152}
!14 = !{!"MacData", !15, i64 0, !20, i64 112, !6, i64 152, !18, i64 160}
!15 = !{!"DigestInfo", !16, i64 0, !20, i64 48, !18, i64 88}
!16 = !{!"AlgorithmIdentifier", !17, i64 0, !6, i64 16, !18, i64 24}
!17 = !{!"ASN__PRIMITIVE_TYPE_s", !6, i64 0, !12, i64 8}
!18 = !{!"asn_struct_ctx_s", !19, i64 0, !19, i64 2, !12, i64 4, !6, i64 8, !10, i64 16}
!19 = !{!"short", !7, i64 0}
!20 = !{!"OCTET_STRING", !6, i64 0, !12, i64 8, !18, i64 16}


; 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 [33 x i8], align 1

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

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

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

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

declare i32 @pbkdf1(ptr noundef, ptr noundef, i8 noundef zeroext, i64 noundef, i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @ba_free(ptr noundef) local_unnamed_addr #2

declare void @asn_free(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3

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

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

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

8:                                                ; preds = %5
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 317, i32 noundef 2, ptr noundef null) #4
  br label %70

9:                                                ; preds = %5
  %.not81 = icmp eq ptr %1, null
  br i1 %.not81, label %10, label %11

10:                                               ; preds = %9
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 318, i32 noundef 2, ptr noundef null) #4
  br label %70

11:                                               ; preds = %9
  %.not82 = icmp eq i64 %2, 0
  br i1 %.not82, label %12, label %13

12:                                               ; preds = %11
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 319, i32 noundef 2, ptr noundef null) #4
  br label %70

13:                                               ; preds = %11
  %.not83 = icmp eq ptr %3, null
  br i1 %.not83, label %14, label %15

14:                                               ; preds = %13
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 320, i32 noundef 2, ptr noundef null) #4
  br label %70

15:                                               ; preds = %13
  %.not84 = icmp eq ptr %4, null
  br i1 %.not84, label %16, label %17

16:                                               ; preds = %15
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 321, i32 noundef 2, ptr noundef null) #4
  br label %70

17:                                               ; preds = %15
  %18 = tail call i32 @hash_from_oid(ptr noundef nonnull %1) #4
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 325, i32 noundef 1047, ptr noundef null) #4
  br label %70

21:                                               ; preds = %17
  %22 = tail call ptr @ba_alloc_by_len(i64 noundef 20) #4
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 328, i32 noundef 2) #4
  br label %70

25:                                               ; preds = %21
  %26 = tail call i32 @drbg_random(ptr noundef nonnull %22) #4
  %.not85 = icmp eq i32 %26, 0
  br i1 %.not85, label %28, label %27

27:                                               ; preds = %25
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 329, i32 noundef %26) #4
  br label %70

28:                                               ; preds = %25
  %29 = call i32 @pbkdf1(ptr noundef nonnull %0, ptr noundef nonnull %22, i8 noundef zeroext 3, i64 noundef %2, i64 noundef 0, i32 noundef %18, ptr noundef nonnull %6) #4
  %.not86 = icmp eq i32 %29, 0
  br i1 %.not86, label %31, label %30

30:                                               ; preds = %28
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 332, i32 noundef %29) #4
  br label %70

31:                                               ; preds = %28
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call i32 @pkcs12_calc_hmac(i32 noundef %18, ptr noundef %32, ptr noundef nonnull %3, ptr noundef nonnull %7)
  %.not87 = icmp eq i32 %33, 0
  br i1 %.not87, label %35, label %34

34:                                               ; preds = %31
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 333, i32 noundef %33) #4
  br label %70

35:                                               ; preds = %31
  %36 = call noalias dereferenceable_or_null(184) ptr @calloc(i64 noundef 1, i64 noundef 184) #5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 336, i32 noundef 1, ptr noundef null) #4
  br label %70

39:                                               ; preds = %35
  %40 = call noalias dereferenceable_or_null(16) ptr @calloc(i64 noundef 1, i64 noundef 16) #5
  %41 = getelementptr inbounds i8, ptr %36, i64 152
  store ptr %40, ptr %41, align 8, !tbaa !9
  %42 = icmp eq ptr %40, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %39
  call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 337, i32 noundef 1, ptr noundef null) #4
  br label %70

44:                                               ; preds = %39
  %45 = call noalias dereferenceable_or_null(4) ptr @calloc(i64 noundef 1, i64 noundef 4) #5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 338, i32 noundef 1, ptr noundef null) #4
  br label %70

48:                                               ; preds = %44
  %49 = call i32 @asn_set_oid_from_text(ptr noundef nonnull %1, ptr noundef nonnull %36) #4
  %.not88 = icmp eq i32 %49, 0
  br i1 %.not88, label %51, label %50

50:                                               ; preds = %48
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 339, i32 noundef %49) #4
  br label %70

51:                                               ; preds = %48
  %52 = call ptr @get_NULL_desc() #4
  %53 = getelementptr inbounds i8, ptr %36, i64 16
  %54 = call i32 @asn_create_any(ptr noundef %52, ptr noundef nonnull %45, ptr noundef nonnull %53) #4
  %.not89 = icmp eq i32 %54, 0
  br i1 %.not89, label %56, label %55

55:                                               ; preds = %51
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 340, i32 noundef %54) #4
  br label %70

56:                                               ; preds = %51
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %36, i64 48
  %59 = call i32 @asn_ba2OCTSTRING(ptr noundef %57, ptr noundef nonnull %58) #4
  %.not90 = icmp eq i32 %59, 0
  br i1 %.not90, label %61, label %60

60:                                               ; preds = %56
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 341, i32 noundef %59) #4
  br label %70

61:                                               ; preds = %56
  %62 = getelementptr inbounds i8, ptr %36, i64 112
  %63 = call i32 @asn_ba2OCTSTRING(ptr noundef nonnull %22, ptr noundef nonnull %62) #4
  %.not91 = icmp eq i32 %63, 0
  br i1 %.not91, label %65, label %64

64:                                               ; preds = %61
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 342, i32 noundef %63) #4
  br label %70

65:                                               ; preds = %61
  %66 = load ptr, ptr %41, align 8, !tbaa !9
  %67 = call i32 @asn_ulong2INTEGER(ptr noundef %66, i64 noundef %2) #4
  %.not92 = icmp eq i32 %67, 0
  br i1 %.not92, label %69, label %68

68:                                               ; preds = %65
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 343, i32 noundef %67) #4
  br label %70

69:                                               ; preds = %65
  store ptr %36, ptr %4, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %69, %68, %64, %60, %55, %50, %47, %43, %38, %34, %30, %27, %24, %20, %16, %14, %12, %10, %8
  %.060 = phi i32 [ 1047, %20 ], [ 2, %24 ], [ %26, %27 ], [ %29, %30 ], [ %33, %34 ], [ 1, %38 ], [ 1, %43 ], [ 1, %47 ], [ %49, %50 ], [ %54, %55 ], [ %59, %60 ], [ %63, %64 ], [ %67, %68 ], [ 0, %69 ], [ 2, %16 ], [ 2, %14 ], [ 2, %12 ], [ 2, %10 ], [ 2, %8 ]
  %.059 = phi ptr [ null, %20 ], [ null, %24 ], [ %22, %27 ], [ %22, %30 ], [ %22, %34 ], [ %22, %38 ], [ %22, %43 ], [ %22, %47 ], [ %22, %50 ], [ %22, %55 ], [ %22, %60 ], [ %22, %64 ], [ %22, %68 ], [ %22, %69 ], [ null, %16 ], [ null, %14 ], [ null, %12 ], [ null, %10 ], [ null, %8 ]
  %.058 = phi ptr [ null, %20 ], [ null, %24 ], [ null, %27 ], [ null, %30 ], [ null, %34 ], [ null, %38 ], [ %36, %43 ], [ %36, %47 ], [ %36, %50 ], [ %36, %55 ], [ %36, %60 ], [ %36, %64 ], [ %36, %68 ], [ null, %69 ], [ null, %16 ], [ null, %14 ], [ null, %12 ], [ null, %10 ], [ null, %8 ]
  %.0 = phi ptr [ null, %20 ], [ null, %24 ], [ null, %27 ], [ null, %30 ], [ null, %34 ], [ null, %38 ], [ null, %43 ], [ null, %47 ], [ %45, %50 ], [ %45, %55 ], [ %45, %60 ], [ %45, %64 ], [ %45, %68 ], [ %45, %69 ], [ null, %16 ], [ null, %14 ], [ null, %12 ], [ null, %10 ], [ null, %8 ]
  call void @ba_free(ptr noundef %.059) #4
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ba_free(ptr noundef %71) #4
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  call void @ba_free(ptr noundef %72) #4
  %73 = call ptr @get_MacData_desc() #4
  call void @asn_free(ptr noundef %73, ptr noundef %.058) #4
  %74 = call ptr @get_NULL_desc() #4
  call void @asn_free(ptr noundef %74, ptr noundef %.0) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret i32 %.060
}

declare i32 @hash_from_oid(ptr noundef) local_unnamed_addr #2

declare ptr @ba_alloc_by_len(i64 noundef) local_unnamed_addr #2

declare i32 @drbg_random(ptr noundef) local_unnamed_addr #2

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

declare ptr @get_NULL_desc() local_unnamed_addr #2

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

declare ptr @get_MacData_desc() local_unnamed_addr #2

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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }

!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 152}
!10 = !{!"MacData", !11, i64 0, !18, i64 112, !6, i64 152, !15, i64 160}
!11 = !{!"DigestInfo", !12, i64 0, !18, i64 48, !15, i64 88}
!12 = !{!"AlgorithmIdentifier", !13, i64 0, !6, i64 16, !15, i64 24}
!13 = !{!"ASN__PRIMITIVE_TYPE_s", !6, i64 0, !14, i64 8}
!14 = !{!"int", !7, i64 0}
!15 = !{!"asn_struct_ctx_s", !16, i64 0, !16, i64 2, !14, i64 4, !6, i64 8, !17, i64 16}
!16 = !{!"short", !7, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"OCTET_STRING", !6, i64 0, !14, i64 8, !15, i64 16}


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