; 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.PrivateKeyInfo = type { %struct.ASN__PRIMITIVE_TYPE_s, %struct.AlgorithmIdentifier, %struct.OCTET_STRING, ptr, %struct.asn_struct_ctx_s }
%struct.ASN__PRIMITIVE_TYPE_s = type { ptr, i32 }
%struct.AlgorithmIdentifier = type { %struct.ASN__PRIMITIVE_TYPE_s, ptr, %struct.asn_struct_ctx_s }
%struct.OCTET_STRING = type { ptr, i32, %struct.asn_struct_ctx_s }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }
%struct.Attribute = type { %struct.ASN__PRIMITIVE_TYPE_s, %struct.value, %struct.asn_struct_ctx_s }
%struct.value = type { %struct.anon.1, %struct.asn_struct_ctx_s }
%struct.anon.1 = type { ptr, i32, i32, ptr }
%struct.KepDSTU4145Params = type { %struct.ANY, %struct.OCTET_STRING, %struct.OCTET_STRING, %struct.asn_struct_ctx_s }
%struct.ANY = type { ptr, i32, %struct.asn_struct_ctx_s }
%struct.DSTU4145Params = type { %struct.DSTUEllipticCurve, ptr, %struct.asn_struct_ctx_s }
%struct.DSTUEllipticCurve = type { i32, %union.DSTUEllipticCurve_u, %struct.asn_struct_ctx_s }
%union.DSTUEllipticCurve_u = type { %struct.ECBinary }
%struct.ECBinary = type { ptr, %struct.BinaryField, i64, %struct.OCTET_STRING, %struct.ASN__PRIMITIVE_TYPE_s, %struct.OCTET_STRING, %struct.asn_struct_ctx_s }
%struct.BinaryField = type { %struct.ASN__PRIMITIVE_TYPE_s, ptr, %struct.asn_struct_ctx_s }
%struct.member = type { i32, %union.BinaryField__member_u, %struct.asn_struct_ctx_s }
%union.BinaryField__member_u = type { %struct.Pentanomial }
%struct.Pentanomial = type { %struct.ASN__PRIMITIVE_TYPE_s, %struct.ASN__PRIMITIVE_TYPE_s, %struct.ASN__PRIMITIVE_TYPE_s, %struct.asn_struct_ctx_s }
%struct.BIT_STRING_s = type { ptr, i32, i32, %struct.asn_struct_ctx_s }

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@OID_IIT_KEYSTORE_ATTR_KEP_PRIVKEY = external global ptr, align 8
@OID_IIT_KEYSTORE_ATTR_KEP_SPKI = 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

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

declare ptr @asn_any2type(ptr noundef, ptr noundef) #1

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

declare ptr @get_OCTET_STRING_desc() #1

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

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

declare ptr @asn_decode_ba_with_alloc(ptr noundef, ptr noundef) #1

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

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

declare ptr @asn_copy_with_alloc(ptr noundef, ptr noundef) #1

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

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

19:                                               ; preds = %2
  %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 %6, align 4, !tbaa !9
  %23 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 439, i32 noundef %23, ptr noundef null)
  br label %319

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 %6, align 4, !tbaa !9
  %31 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 440, i32 noundef %31, ptr noundef null)
  br label %319

32:                                               ; preds = %27
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  %36 = call ptr @get_PrivateKeyInfo_desc()
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = call ptr @asn_decode_ba_with_alloc(ptr noundef %36, ptr noundef %37)
  store ptr %38, ptr %7, align 8, !tbaa !5
  %39 = icmp eq ptr null, %38
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  store i32 2, ptr %6, align 4, !tbaa !9
  %41 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 442, i32 noundef %41)
  br label %319

42:                                               ; preds = %35
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.PrivateKeyInfo, ptr %46, i32 0, i32 3
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = load ptr, ptr @OID_IIT_KEYSTORE_ATTR_KEP_PRIVKEY, align 8, !tbaa !5
  %50 = call ptr @pkcs12_attrs_get_attr_by_oid(ptr noundef %48, ptr noundef %49)
  store ptr %50, ptr %13, align 8, !tbaa !5
  %51 = icmp eq ptr null, %50
  br i1 %51, label %52, label %54

52:                                               ; preds = %45
  store i32 2, ptr %6, align 4, !tbaa !9
  %53 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 444, i32 noundef %53)
  br label %319

54:                                               ; preds = %45
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %13, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.Attribute, ptr %58, i32 0, i32 1
  %60 = getelementptr inbounds %struct.value, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %struct.anon.1, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !19
  %63 = getelementptr inbounds ptr, ptr %62, i64 0
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = call ptr @get_BIT_STRING_desc()
  %66 = call ptr @asn_any2type(ptr noundef %64, ptr noundef %65)
  store ptr %66, ptr %12, align 8, !tbaa !5
  %67 = icmp eq ptr null, %66
  br i1 %67, label %68, label %70

68:                                               ; preds = %57
  store i32 2, ptr %6, align 4, !tbaa !9
  %69 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 445, i32 noundef %69)
  br label %319

70:                                               ; preds = %57
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.PrivateKeyInfo, ptr %74, i32 0, i32 3
  %76 = load ptr, ptr %75, align 8, !tbaa !11
  %77 = load ptr, ptr @OID_IIT_KEYSTORE_ATTR_KEP_SPKI, align 8, !tbaa !5
  %78 = call ptr @pkcs12_attrs_get_attr_by_oid(ptr noundef %76, ptr noundef %77)
  store ptr %78, ptr %13, align 8, !tbaa !5
  %79 = icmp eq ptr null, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %73
  store i32 2, ptr %6, align 4, !tbaa !9
  %81 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 447, i32 noundef %81)
  br label %319

82:                                               ; preds = %73
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.Attribute, ptr %86, i32 0, i32 1
  %88 = getelementptr inbounds %struct.value, ptr %87, i32 0, i32 0
  %89 = getelementptr inbounds %struct.anon.1, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !19
  %91 = getelementptr inbounds ptr, ptr %90, i64 0
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  %93 = call ptr @get_KepDSTU4145Params_desc()
  %94 = call ptr @asn_any2type(ptr noundef %92, ptr noundef %93)
  store ptr %94, ptr %9, align 8, !tbaa !5
  %95 = icmp eq ptr null, %94
  br i1 %95, label %96, label %98

96:                                               ; preds = %85
  store i32 2, ptr %6, align 4, !tbaa !9
  %97 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 448, i32 noundef %97)
  br label %319

98:                                               ; preds = %85
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 248) #5
  store ptr %101, ptr %10, align 8, !tbaa !5
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = icmp eq ptr %102, null
  br i1 %103, label %104, label %106

104:                                              ; preds = %100
  store i32 1, ptr %6, align 4, !tbaa !9
  %105 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 450, i32 noundef %105, ptr noundef null)
  br label %319

106:                                              ; preds = %100
  br label %107

107:                                              ; preds = %106
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.KepDSTU4145Params, ptr %108, i32 0, i32 0
  %110 = call ptr @get_DSTUEllipticCurve_desc()
  %111 = call ptr @asn_any2type(ptr noundef %109, ptr noundef %110)
  store ptr %111, ptr %11, align 8, !tbaa !5
  %112 = icmp eq ptr null, %111
  br i1 %112, label %113, label %115

113:                                              ; preds = %107
  store i32 2, ptr %6, align 4, !tbaa !9
  %114 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 451, i32 noundef %114)
  br label %319

115:                                              ; preds = %107
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  %119 = call ptr @get_DSTUEllipticCurve_desc()
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = load ptr, ptr %10, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.DSTU4145Params, ptr %121, i32 0, i32 0
  %123 = call i32 @asn_copy(ptr noundef %119, ptr noundef %120, ptr noundef %122)
  store i32 %123, ptr %6, align 4, !tbaa !9
  %124 = load i32, ptr %6, align 4, !tbaa !9
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %128

126:                                              ; preds = %118
  %127 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 452, i32 noundef %127)
  br label %319

128:                                              ; preds = %118
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  %132 = call ptr @get_OCTET_STRING_desc()
  %133 = load ptr, ptr %9, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.KepDSTU4145Params, ptr %133, i32 0, i32 2
  %135 = call ptr @asn_copy_with_alloc(ptr noundef %132, ptr noundef %134)
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.DSTU4145Params, ptr %136, i32 0, i32 1
  store ptr %135, ptr %137, align 8, !tbaa !23
  %138 = icmp eq ptr null, %135
  br i1 %138, label %139, label %141

139:                                              ; preds = %131
  store i32 2, ptr %6, align 4, !tbaa !9
  %140 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 453, i32 noundef %140)
  br label %319

141:                                              ; preds = %131
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.DSTU4145Params, ptr %144, i32 0, i32 0
  %146 = getelementptr inbounds %struct.DSTUEllipticCurve, ptr %145, i32 0, i32 0
  %147 = load i32, ptr %146, align 8, !tbaa !26
  %148 = icmp eq i32 %147, 1
  br i1 %148, label %149, label %241

149:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.DSTU4145Params, ptr %150, i32 0, i32 0
  %152 = getelementptr inbounds %struct.DSTUEllipticCurve, ptr %151, i32 0, i32 1
  store ptr %152, ptr %14, align 8, !tbaa !5
  %153 = load ptr, ptr %14, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.ECBinary, ptr %153, i32 0, i32 1
  %155 = getelementptr inbounds %struct.BinaryField, ptr %154, i32 0, i32 1
  %156 = load ptr, ptr %155, align 8, !tbaa !27
  %157 = getelementptr inbounds %struct.member, ptr %156, i32 0, i32 0
  %158 = load i32, ptr %157, align 8, !tbaa !30
  %159 = icmp eq i32 %158, 2
  br i1 %159, label %160, label %215

160:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %161 = load ptr, ptr %14, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.ECBinary, ptr %161, i32 0, i32 1
  %163 = getelementptr inbounds %struct.BinaryField, ptr %162, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8, !tbaa !27
  %165 = getelementptr inbounds %struct.member, ptr %164, i32 0, i32 1
  store ptr %165, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  br label %166

166:                                              ; preds = %160
  %167 = load ptr, ptr %15, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.Pentanomial, ptr %167, i32 0, i32 0
  %169 = call i32 @asn_INTEGER2ulong(ptr noundef %168, ptr noundef %16)
  store i32 %169, ptr %6, align 4, !tbaa !9
  %170 = load i32, ptr %6, align 4, !tbaa !9
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %174

172:                                              ; preds = %166
  %173 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 460, i32 noundef %173)
  store i32 4, ptr %18, align 4
  br label %212

174:                                              ; preds = %166
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  %178 = load ptr, ptr %15, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.Pentanomial, ptr %178, i32 0, i32 2
  %180 = call i32 @asn_INTEGER2ulong(ptr noundef %179, ptr noundef %17)
  store i32 %180, ptr %6, align 4, !tbaa !9
  %181 = load i32, ptr %6, align 4, !tbaa !9
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %185

183:                                              ; preds = %177
  %184 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 461, i32 noundef %184)
  store i32 4, ptr %18, align 4
  br label %212

185:                                              ; preds = %177
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  br label %188

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

195:                                              ; preds = %188
  %196 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 462, i32 noundef %196)
  store i32 4, ptr %18, align 4
  br label %212

197:                                              ; preds = %188
  br label %198

198:                                              ; preds = %197
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  %201 = load ptr, ptr %15, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.Pentanomial, ptr %201, i32 0, i32 2
  %203 = load i64, ptr %16, align 8, !tbaa !32
  %204 = call i32 @asn_ulong2INTEGER(ptr noundef %202, i64 noundef %203)
  store i32 %204, ptr %6, align 4, !tbaa !9
  %205 = load i32, ptr %6, align 4, !tbaa !9
  %206 = icmp ne i32 %205, 0
  br i1 %206, label %207, label %209

207:                                              ; preds = %200
  %208 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 463, i32 noundef %208)
  store i32 4, ptr %18, align 4
  br label %212

209:                                              ; preds = %200
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  store i32 0, ptr %18, align 4
  br label %212

212:                                              ; preds = %211, %207, %195, %183, %172
  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
  %213 = load i32, ptr %18, align 4
  switch i32 %213, label %238 [
    i32 0, label %214
  ]

214:                                              ; preds = %212
  br label %215

215:                                              ; preds = %214, %149
  br label %216

216:                                              ; preds = %215
  %217 = load ptr, ptr %14, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.ECBinary, ptr %217, i32 0, i32 3
  %219 = call i32 @os_swap(ptr noundef %218)
  store i32 %219, ptr %6, align 4, !tbaa !9
  %220 = load i32, ptr %6, align 4, !tbaa !9
  %221 = icmp ne i32 %220, 0
  br i1 %221, label %222, label %224

222:                                              ; preds = %216
  %223 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 465, i32 noundef %223)
  store i32 4, ptr %18, align 4
  br label %238

224:                                              ; preds = %216
  br label %225

225:                                              ; preds = %224
  br label %226

226:                                              ; preds = %225
  br label %227

227:                                              ; preds = %226
  %228 = load ptr, ptr %14, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.ECBinary, ptr %228, i32 0, i32 5
  %230 = call i32 @os_swap(ptr noundef %229)
  store i32 %230, ptr %6, align 4, !tbaa !9
  %231 = load i32, ptr %6, align 4, !tbaa !9
  %232 = icmp ne i32 %231, 0
  br i1 %232, label %233, label %235

233:                                              ; preds = %227
  %234 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 466, i32 noundef %234)
  store i32 4, ptr %18, align 4
  br label %238

235:                                              ; preds = %227
  br label %236

236:                                              ; preds = %235
  br label %237

237:                                              ; preds = %236
  store i32 0, ptr %18, align 4
  br label %238

238:                                              ; preds = %237, %233, %222, %212
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %239 = load i32, ptr %18, align 4
  switch i32 %239, label %333 [
    i32 0, label %240
    i32 4, label %319
  ]

240:                                              ; preds = %238
  br label %241

241:                                              ; preds = %240, %143
  %242 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 136) #5
  store ptr %242, ptr %8, align 8, !tbaa !5
  %243 = load ptr, ptr %8, align 8, !tbaa !5
  %244 = icmp eq ptr %243, null
  br i1 %244, label %245, label %247

245:                                              ; preds = %241
  store i32 1, ptr %6, align 4, !tbaa !9
  %246 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 469, i32 noundef %246, ptr noundef null)
  br label %319

247:                                              ; preds = %241
  br label %248

248:                                              ; preds = %247
  %249 = call ptr @get_OBJECT_IDENTIFIER_desc()
  %250 = load ptr, ptr %7, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.PrivateKeyInfo, ptr %250, i32 0, i32 1
  %252 = getelementptr inbounds %struct.AlgorithmIdentifier, ptr %251, i32 0, i32 0
  %253 = load ptr, ptr %8, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.PrivateKeyInfo, ptr %253, i32 0, i32 1
  %255 = getelementptr inbounds %struct.AlgorithmIdentifier, ptr %254, i32 0, i32 0
  %256 = call i32 @asn_copy(ptr noundef %249, ptr noundef %252, ptr noundef %255)
  store i32 %256, ptr %6, align 4, !tbaa !9
  %257 = load i32, ptr %6, align 4, !tbaa !9
  %258 = icmp ne i32 %257, 0
  br i1 %258, label %259, label %261

259:                                              ; preds = %248
  %260 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 470, i32 noundef %260)
  br label %319

261:                                              ; preds = %248
  br label %262

262:                                              ; preds = %261
  br label %263

263:                                              ; preds = %262
  br label %264

264:                                              ; preds = %263
  %265 = call ptr @get_DSTU4145Params_desc()
  %266 = load ptr, ptr %10, align 8, !tbaa !5
  %267 = load ptr, ptr %8, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.PrivateKeyInfo, ptr %267, i32 0, i32 1
  %269 = getelementptr inbounds %struct.AlgorithmIdentifier, ptr %268, i32 0, i32 1
  %270 = call i32 @asn_create_any(ptr noundef %265, ptr noundef %266, ptr noundef %269)
  store i32 %270, ptr %6, align 4, !tbaa !9
  %271 = load i32, ptr %6, align 4, !tbaa !9
  %272 = icmp ne i32 %271, 0
  br i1 %272, label %273, label %275

273:                                              ; preds = %264
  %274 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 471, i32 noundef %274)
  br label %319

275:                                              ; preds = %264
  br label %276

276:                                              ; preds = %275
  br label %277

277:                                              ; preds = %276
  br label %278

278:                                              ; preds = %277
  %279 = load ptr, ptr %8, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.PrivateKeyInfo, ptr %279, i32 0, i32 2
  %281 = load ptr, ptr %12, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct.BIT_STRING_s, ptr %281, i32 0, i32 0
  %283 = load ptr, ptr %282, align 8, !tbaa !33
  %284 = load ptr, ptr %12, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct.BIT_STRING_s, ptr %284, i32 0, i32 1
  %286 = load i32, ptr %285, align 8, !tbaa !35
  %287 = sext i32 %286 to i64
  %288 = call i32 @asn_bytes2OCTSTRING(ptr noundef %280, ptr noundef %283, i64 noundef %287)
  store i32 %288, ptr %6, align 4, !tbaa !9
  %289 = load i32, ptr %6, align 4, !tbaa !9
  %290 = icmp ne i32 %289, 0
  br i1 %290, label %291, label %293

291:                                              ; preds = %278
  %292 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 472, i32 noundef %292)
  br label %319

293:                                              ; preds = %278
  br label %294

294:                                              ; preds = %293
  br label %295

295:                                              ; preds = %294
  br label %296

296:                                              ; preds = %295
  %297 = load ptr, ptr %8, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.PrivateKeyInfo, ptr %297, i32 0, i32 2
  %299 = call i32 @os_swap_bits(ptr noundef %298)
  store i32 %299, ptr %6, align 4, !tbaa !9
  %300 = load i32, ptr %6, align 4, !tbaa !9
  %301 = icmp ne i32 %300, 0
  br i1 %301, label %302, label %304

302:                                              ; preds = %296
  %303 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 473, i32 noundef %303)
  br label %319

304:                                              ; preds = %296
  br label %305

305:                                              ; preds = %304
  br label %306

306:                                              ; preds = %305
  br label %307

307:                                              ; preds = %306
  %308 = call ptr @get_PrivateKeyInfo_desc()
  %309 = load ptr, ptr %8, align 8, !tbaa !5
  %310 = load ptr, ptr %5, align 8, !tbaa !5
  %311 = call i32 @asn_encode_ba(ptr noundef %308, ptr noundef %309, ptr noundef %310)
  store i32 %311, ptr %6, align 4, !tbaa !9
  %312 = load i32, ptr %6, align 4, !tbaa !9
  %313 = icmp ne i32 %312, 0
  br i1 %313, label %314, label %316

314:                                              ; preds = %307
  %315 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 475, i32 noundef %315)
  br label %319

316:                                              ; preds = %307
  br label %317

317:                                              ; preds = %316
  br label %318

318:                                              ; preds = %317
  br label %319

319:                                              ; preds = %318, %314, %302, %291, %273, %259, %245, %238, %139, %126, %113, %104, %96, %80, %68, %52, %40, %30, %22
  %320 = call ptr @get_PrivateKeyInfo_desc()
  %321 = load ptr, ptr %7, align 8, !tbaa !5
  call void @asn_free(ptr noundef %320, ptr noundef %321)
  %322 = call ptr @get_PrivateKeyInfo_desc()
  %323 = load ptr, ptr %8, align 8, !tbaa !5
  call void @asn_free(ptr noundef %322, ptr noundef %323)
  %324 = call ptr @get_KepDSTU4145Params_desc()
  %325 = load ptr, ptr %9, align 8, !tbaa !5
  call void @asn_free(ptr noundef %324, ptr noundef %325)
  %326 = call ptr @get_DSTU4145Params_desc()
  %327 = load ptr, ptr %10, align 8, !tbaa !5
  call void @asn_free(ptr noundef %326, ptr noundef %327)
  %328 = call ptr @get_DSTUEllipticCurve_desc()
  %329 = load ptr, ptr %11, align 8, !tbaa !5
  call void @asn_free(ptr noundef %328, ptr noundef %329)
  %330 = call ptr @get_BIT_STRING_desc()
  %331 = load ptr, ptr %12, align 8, !tbaa !5
  call void @asn_free(ptr noundef %330, ptr noundef %331)
  %332 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %332, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %333

333:                                              ; preds = %319, %238
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %334 = load i32, ptr %3, align 4
  ret i32 %334
}

declare ptr @get_PrivateKeyInfo_desc() #1

; Function Attrs: nounwind uwtable
declare hidden ptr @pkcs12_attrs_get_attr_by_oid(ptr noundef, ptr noundef) #3

declare ptr @get_BIT_STRING_desc() #1

declare ptr @get_KepDSTU4145Params_desc() #1

declare ptr @get_DSTUEllipticCurve_desc() #1

; Function Attrs: nounwind uwtable
declare hidden i32 @os_swap(ptr noundef) #3

declare ptr @get_OBJECT_IDENTIFIER_desc() #1

declare ptr @get_DSTU4145Params_desc() #1

declare i32 @asn_bytes2OCTSTRING(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @os_swap_bits(ptr noundef) #3

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 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 #3 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 104}
!12 = !{!"PrivateKeyInfo", !13, i64 0, !14, i64 16, !18, i64 64, !6, i64 104, !15, i64 112}
!13 = !{!"ASN__PRIMITIVE_TYPE_s", !6, i64 0, !10, i64 8}
!14 = !{!"AlgorithmIdentifier", !13, i64 0, !6, i64 16, !15, i64 24}
!15 = !{!"asn_struct_ctx_s", !16, i64 0, !16, i64 2, !10, i64 4, !6, i64 8, !17, i64 16}
!16 = !{!"short", !7, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"OCTET_STRING", !6, i64 0, !10, i64 8, !15, i64 16}
!19 = !{!20, !6, i64 16}
!20 = !{!"Attribute", !13, i64 0, !21, i64 16, !15, i64 64}
!21 = !{!"value", !22, i64 0, !15, i64 24}
!22 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!23 = !{!24, !6, i64 216}
!24 = !{!"DSTU4145Params", !25, i64 0, !6, i64 216, !15, i64 224}
!25 = !{!"DSTUEllipticCurve", !10, i64 0, !7, i64 8, !15, i64 192}
!26 = !{!24, !10, i64 0}
!27 = !{!28, !6, i64 24}
!28 = !{!"ECBinary", !6, i64 0, !29, i64 8, !17, i64 56, !18, i64 64, !13, i64 104, !18, i64 120, !15, i64 160}
!29 = !{!"BinaryField", !13, i64 0, !6, i64 16, !15, i64 24}
!30 = !{!31, !10, i64 0}
!31 = !{!"member", !10, i64 0, !7, i64 8, !15, i64 80}
!32 = !{!17, !17, i64 0}
!33 = !{!34, !6, i64 0}
!34 = !{!"BIT_STRING_s", !6, i64 0, !10, i64 8, !10, i64 12, !15, i64 16}
!35 = !{!34, !10, i64 8}


; 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
@OID_IIT_KEYSTORE_ATTR_KEP_PRIVKEY = external local_unnamed_addr global ptr, align 8
@OID_IIT_KEYSTORE_ATTR_KEP_SPKI = 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

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

declare ptr @asn_any2type(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare ptr @get_OCTET_STRING_desc() local_unnamed_addr #1

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

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

declare ptr @asn_decode_ba_with_alloc(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

declare ptr @asn_copy_with_alloc(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @pkcs12_iit_read_kep_key(ptr noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %6

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

6:                                                ; preds = %2
  %.not118 = icmp eq ptr %1, null
  br i1 %.not118, label %7, label %8

7:                                                ; preds = %6
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 440, i32 noundef 2, ptr noundef null) #4
  br label %.thread135

8:                                                ; preds = %6
  %9 = tail call ptr @get_PrivateKeyInfo_desc() #4
  %10 = tail call ptr @asn_decode_ba_with_alloc(ptr noundef %9, ptr noundef nonnull %0) #4
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %8
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 442, i32 noundef 2) #4
  br label %.thread135

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %10, i64 104
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = load ptr, ptr @OID_IIT_KEYSTORE_ATTR_KEP_PRIVKEY, align 8, !tbaa !17
  %17 = tail call ptr @pkcs12_attrs_get_attr_by_oid(ptr noundef %15, ptr noundef %16)
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %13
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 444, i32 noundef 2) #4
  br label %.thread135

20:                                               ; preds = %13
  %21 = getelementptr inbounds i8, ptr %17, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  %23 = load ptr, ptr %22, align 8, !tbaa !17
  %24 = tail call ptr @get_BIT_STRING_desc() #4
  %25 = tail call ptr @asn_any2type(ptr noundef %23, ptr noundef %24) #4
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %20
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 445, i32 noundef 2) #4
  br label %.thread135

28:                                               ; preds = %20
  %29 = load ptr, ptr %14, align 8, !tbaa !5
  %30 = load ptr, ptr @OID_IIT_KEYSTORE_ATTR_KEP_SPKI, align 8, !tbaa !17
  %31 = tail call ptr @pkcs12_attrs_get_attr_by_oid(ptr noundef %29, ptr noundef %30)
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %28
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 447, i32 noundef 2) #4
  br label %.thread135

34:                                               ; preds = %28
  %35 = getelementptr inbounds i8, ptr %31, i64 16
  %36 = load ptr, ptr %35, align 8, !tbaa !18
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = tail call ptr @get_KepDSTU4145Params_desc() #4
  %39 = tail call ptr @asn_any2type(ptr noundef %37, ptr noundef %38) #4
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %42

41:                                               ; preds = %34
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 448, i32 noundef 2) #4
  br label %.thread135

42:                                               ; preds = %34
  %43 = tail call noalias dereferenceable_or_null(248) ptr @calloc(i64 noundef 1, i64 noundef 248) #5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %46

45:                                               ; preds = %42
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 450, i32 noundef 1, ptr noundef null) #4
  br label %.thread135

46:                                               ; preds = %42
  %47 = tail call ptr @get_DSTUEllipticCurve_desc() #4
  %48 = tail call ptr @asn_any2type(ptr noundef nonnull %39, ptr noundef %47) #4
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %51

50:                                               ; preds = %46
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 451, i32 noundef 2) #4
  br label %.thread135

51:                                               ; preds = %46
  %52 = tail call ptr @get_DSTUEllipticCurve_desc() #4
  %53 = tail call i32 @asn_copy(ptr noundef %52, ptr noundef nonnull %48, ptr noundef nonnull %43) #4
  %.not119 = icmp eq i32 %53, 0
  br i1 %.not119, label %55, label %54

54:                                               ; preds = %51
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 452, i32 noundef %53) #4
  br label %.thread135

55:                                               ; preds = %51
  %56 = tail call ptr @get_OCTET_STRING_desc() #4
  %57 = getelementptr inbounds i8, ptr %39, i64 80
  %58 = tail call ptr @asn_copy_with_alloc(ptr noundef %56, ptr noundef nonnull %57) #4
  %59 = getelementptr inbounds i8, ptr %43, i64 216
  store ptr %58, ptr %59, align 8, !tbaa !22
  %60 = icmp eq ptr %58, null
  br i1 %60, label %61, label %62

61:                                               ; preds = %55
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 453, i32 noundef 2) #4
  br label %.thread135

62:                                               ; preds = %55
  %63 = load i32, ptr %43, align 8, !tbaa !25
  %64 = icmp eq i32 %63, 1
  br i1 %64, label %65, label %95

65:                                               ; preds = %62
  %66 = getelementptr inbounds i8, ptr %43, i64 32
  %67 = load ptr, ptr %66, align 8, !tbaa !26
  %68 = load i32, ptr %67, align 8, !tbaa !29
  %69 = icmp eq i32 %68, 2
  br i1 %69, label %70, label %87

70:                                               ; preds = %65
  %71 = getelementptr inbounds i8, ptr %67, i64 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %72 = call i32 @asn_INTEGER2ulong(ptr noundef nonnull %71, ptr noundef nonnull %3) #4
  %.not120 = icmp eq i32 %72, 0
  br i1 %.not120, label %74, label %73

73:                                               ; preds = %70
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 460, i32 noundef %72) #4
  br label %.thread

74:                                               ; preds = %70
  %75 = getelementptr inbounds i8, ptr %67, i64 40
  %76 = call i32 @asn_INTEGER2ulong(ptr noundef nonnull %75, ptr noundef nonnull %4) #4
  %.not121 = icmp eq i32 %76, 0
  br i1 %.not121, label %78, label %77

77:                                               ; preds = %74
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 461, i32 noundef %76) #4
  br label %.thread

78:                                               ; preds = %74
  %79 = load i64, ptr %4, align 8, !tbaa !31
  %80 = call i32 @asn_ulong2INTEGER(ptr noundef nonnull %71, i64 noundef %79) #4
  %.not122 = icmp eq i32 %80, 0
  br i1 %.not122, label %82, label %81

81:                                               ; preds = %78
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 462, i32 noundef %80) #4
  br label %.thread

82:                                               ; preds = %78
  %83 = load i64, ptr %3, align 8, !tbaa !31
  %84 = call i32 @asn_ulong2INTEGER(ptr noundef nonnull %75, i64 noundef %83) #4
  %.not123 = icmp eq i32 %84, 0
  br i1 %.not123, label %86, label %85

85:                                               ; preds = %82
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 463, i32 noundef %84) #4
  br label %.thread

.thread:                                          ; preds = %73, %77, %81, %85
  %.079.ph = phi i32 [ %84, %85 ], [ %80, %81 ], [ %76, %77 ], [ %72, %73 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br label %.thread135

86:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br label %87

87:                                               ; preds = %86, %65
  %88 = getelementptr inbounds i8, ptr %43, i64 72
  %89 = call i32 @os_swap(ptr noundef nonnull %88)
  %.not124 = icmp eq i32 %89, 0
  br i1 %.not124, label %91, label %90

90:                                               ; preds = %87
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 465, i32 noundef %89) #4
  br label %.thread135

91:                                               ; preds = %87
  %92 = getelementptr inbounds i8, ptr %43, i64 128
  %93 = call i32 @os_swap(ptr noundef nonnull %92)
  %.not125 = icmp eq i32 %93, 0
  br i1 %.not125, label %95, label %94

94:                                               ; preds = %91
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 466, i32 noundef %93) #4
  br label %.thread135

95:                                               ; preds = %91, %62
  %96 = call noalias dereferenceable_or_null(136) ptr @calloc(i64 noundef 1, i64 noundef 136) #5
  %97 = icmp eq ptr %96, null
  br i1 %97, label %98, label %99

98:                                               ; preds = %95
  call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 469, i32 noundef 1, ptr noundef null) #4
  br label %.thread135

99:                                               ; preds = %95
  %100 = call ptr @get_OBJECT_IDENTIFIER_desc() #4
  %101 = getelementptr inbounds i8, ptr %10, i64 16
  %102 = getelementptr inbounds i8, ptr %96, i64 16
  %103 = call i32 @asn_copy(ptr noundef %100, ptr noundef nonnull %101, ptr noundef nonnull %102) #4
  %.not126 = icmp eq i32 %103, 0
  br i1 %.not126, label %105, label %104

104:                                              ; preds = %99
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 470, i32 noundef %103) #4
  br label %.thread135

105:                                              ; preds = %99
  %106 = call ptr @get_DSTU4145Params_desc() #4
  %107 = getelementptr inbounds i8, ptr %96, i64 32
  %108 = call i32 @asn_create_any(ptr noundef %106, ptr noundef nonnull %43, ptr noundef nonnull %107) #4
  %.not127 = icmp eq i32 %108, 0
  br i1 %.not127, label %110, label %109

109:                                              ; preds = %105
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 471, i32 noundef %108) #4
  br label %.thread135

110:                                              ; preds = %105
  %111 = getelementptr inbounds i8, ptr %96, i64 64
  %112 = load ptr, ptr %25, align 8, !tbaa !32
  %113 = getelementptr inbounds i8, ptr %25, i64 8
  %114 = load i32, ptr %113, align 8, !tbaa !34
  %115 = sext i32 %114 to i64
  %116 = call i32 @asn_bytes2OCTSTRING(ptr noundef nonnull %111, ptr noundef %112, i64 noundef %115) #4
  %.not128 = icmp eq i32 %116, 0
  br i1 %.not128, label %118, label %117

117:                                              ; preds = %110
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 472, i32 noundef %116) #4
  br label %.thread135

118:                                              ; preds = %110
  %119 = call i32 @os_swap_bits(ptr noundef nonnull %111)
  %.not129 = icmp eq i32 %119, 0
  br i1 %.not129, label %121, label %120

120:                                              ; preds = %118
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 473, i32 noundef %119) #4
  br label %.thread135

121:                                              ; preds = %118
  %122 = call ptr @get_PrivateKeyInfo_desc() #4
  %123 = call i32 @asn_encode_ba(ptr noundef %122, ptr noundef nonnull %96, ptr noundef nonnull %1) #4
  %.not130 = icmp eq i32 %123, 0
  br i1 %.not130, label %.thread135, label %124

124:                                              ; preds = %121
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 475, i32 noundef %123) #4
  br label %.thread135

.thread135:                                       ; preds = %.thread, %94, %90, %5, %7, %12, %19, %27, %33, %41, %45, %50, %54, %61, %98, %104, %109, %117, %120, %124, %121
  %.086 = phi ptr [ null, %12 ], [ %10, %19 ], [ %10, %27 ], [ %10, %33 ], [ %10, %41 ], [ %10, %45 ], [ %10, %50 ], [ %10, %54 ], [ %10, %61 ], [ %10, %98 ], [ %10, %104 ], [ %10, %109 ], [ %10, %117 ], [ %10, %120 ], [ %10, %124 ], [ %10, %121 ], [ null, %7 ], [ null, %5 ], [ %10, %90 ], [ %10, %94 ], [ %10, %.thread ]
  %.085 = phi ptr [ null, %12 ], [ null, %19 ], [ null, %27 ], [ null, %33 ], [ null, %41 ], [ null, %45 ], [ null, %50 ], [ null, %54 ], [ null, %61 ], [ null, %98 ], [ %96, %104 ], [ %96, %109 ], [ %96, %117 ], [ %96, %120 ], [ %96, %124 ], [ %96, %121 ], [ null, %7 ], [ null, %5 ], [ null, %90 ], [ null, %94 ], [ null, %.thread ]
  %.084 = phi ptr [ null, %12 ], [ null, %19 ], [ null, %27 ], [ null, %33 ], [ null, %41 ], [ %39, %45 ], [ %39, %50 ], [ %39, %54 ], [ %39, %61 ], [ %39, %98 ], [ %39, %104 ], [ %39, %109 ], [ %39, %117 ], [ %39, %120 ], [ %39, %124 ], [ %39, %121 ], [ null, %7 ], [ null, %5 ], [ %39, %90 ], [ %39, %94 ], [ %39, %.thread ]
  %.083 = phi ptr [ null, %12 ], [ null, %19 ], [ null, %27 ], [ null, %33 ], [ null, %41 ], [ null, %45 ], [ %43, %50 ], [ %43, %54 ], [ %43, %61 ], [ %43, %98 ], [ %43, %104 ], [ %43, %109 ], [ %43, %117 ], [ %43, %120 ], [ %43, %124 ], [ %43, %121 ], [ null, %7 ], [ null, %5 ], [ %43, %90 ], [ %43, %94 ], [ %43, %.thread ]
  %.082 = phi ptr [ null, %12 ], [ null, %19 ], [ null, %27 ], [ null, %33 ], [ null, %41 ], [ null, %45 ], [ null, %50 ], [ %48, %54 ], [ %48, %61 ], [ %48, %98 ], [ %48, %104 ], [ %48, %109 ], [ %48, %117 ], [ %48, %120 ], [ %48, %124 ], [ %48, %121 ], [ null, %7 ], [ null, %5 ], [ %48, %90 ], [ %48, %94 ], [ %48, %.thread ]
  %.081 = phi ptr [ null, %12 ], [ null, %19 ], [ null, %27 ], [ %25, %33 ], [ %25, %41 ], [ %25, %45 ], [ %25, %50 ], [ %25, %54 ], [ %25, %61 ], [ %25, %98 ], [ %25, %104 ], [ %25, %109 ], [ %25, %117 ], [ %25, %120 ], [ %25, %124 ], [ %25, %121 ], [ null, %7 ], [ null, %5 ], [ %25, %90 ], [ %25, %94 ], [ %25, %.thread ]
  %.2 = phi i32 [ 2, %12 ], [ 2, %19 ], [ 2, %27 ], [ 2, %33 ], [ 2, %41 ], [ 1, %45 ], [ 2, %50 ], [ %53, %54 ], [ 2, %61 ], [ 1, %98 ], [ %103, %104 ], [ %108, %109 ], [ %116, %117 ], [ %119, %120 ], [ %123, %124 ], [ 0, %121 ], [ 2, %7 ], [ 2, %5 ], [ %89, %90 ], [ %93, %94 ], [ %.079.ph, %.thread ]
  %125 = call ptr @get_PrivateKeyInfo_desc() #4
  call void @asn_free(ptr noundef %125, ptr noundef %.086) #4
  %126 = call ptr @get_PrivateKeyInfo_desc() #4
  call void @asn_free(ptr noundef %126, ptr noundef %.085) #4
  %127 = call ptr @get_KepDSTU4145Params_desc() #4
  call void @asn_free(ptr noundef %127, ptr noundef %.084) #4
  %128 = call ptr @get_DSTU4145Params_desc() #4
  call void @asn_free(ptr noundef %128, ptr noundef %.083) #4
  %129 = call ptr @get_DSTUEllipticCurve_desc() #4
  call void @asn_free(ptr noundef %129, ptr noundef %.082) #4
  %130 = call ptr @get_BIT_STRING_desc() #4
  call void @asn_free(ptr noundef %130, ptr noundef %.081) #4
  ret i32 %.2
}

declare ptr @get_PrivateKeyInfo_desc() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden ptr @pkcs12_attrs_get_attr_by_oid(ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @get_BIT_STRING_desc() local_unnamed_addr #1

declare ptr @get_KepDSTU4145Params_desc() local_unnamed_addr #1

declare ptr @get_DSTUEllipticCurve_desc() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @os_swap(ptr noundef) local_unnamed_addr #3

declare ptr @get_OBJECT_IDENTIFIER_desc() local_unnamed_addr #1

declare ptr @get_DSTU4145Params_desc() local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @os_swap_bits(ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 #3 = { 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 #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, !8, i64 104}
!6 = !{!"PrivateKeyInfo", !7, i64 0, !12, i64 16, !16, i64 64, !8, i64 104, !13, i64 112}
!7 = !{!"ASN__PRIMITIVE_TYPE_s", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"AlgorithmIdentifier", !7, i64 0, !8, i64 16, !13, i64 24}
!13 = !{!"asn_struct_ctx_s", !14, i64 0, !14, i64 2, !11, i64 4, !8, i64 8, !15, i64 16}
!14 = !{!"short", !9, i64 0}
!15 = !{!"long", !9, i64 0}
!16 = !{!"OCTET_STRING", !8, i64 0, !11, i64 8, !13, i64 16}
!17 = !{!8, !8, i64 0}
!18 = !{!19, !8, i64 16}
!19 = !{!"Attribute", !7, i64 0, !20, i64 16, !13, i64 64}
!20 = !{!"value", !21, i64 0, !13, i64 24}
!21 = !{!"", !8, i64 0, !11, i64 8, !11, i64 12, !8, i64 16}
!22 = !{!23, !8, i64 216}
!23 = !{!"DSTU4145Params", !24, i64 0, !8, i64 216, !13, i64 224}
!24 = !{!"DSTUEllipticCurve", !11, i64 0, !9, i64 8, !13, i64 192}
!25 = !{!23, !11, i64 0}
!26 = !{!27, !8, i64 24}
!27 = !{!"ECBinary", !8, i64 0, !28, i64 8, !15, i64 56, !16, i64 64, !7, i64 104, !16, i64 120, !13, i64 160}
!28 = !{!"BinaryField", !7, i64 0, !8, i64 16, !13, i64 24}
!29 = !{!30, !11, i64 0}
!30 = !{!"member", !11, i64 0, !9, i64 8, !13, i64 80}
!31 = !{!15, !15, i64 0}
!32 = !{!33, !8, i64 0}
!33 = !{!"BIT_STRING_s", !8, i64 0, !11, i64 8, !11, i64 12, !13, i64 16}
!34 = !{!33, !11, i64 8}


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