; LLVM IR from openanolis/openssl :: crypto/crmf (crmf_lib)

; 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.ossl_crmf_encryptedvalue_st = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.X509_algor_st = type { ptr, ptr }
%struct.asn1_string_st = type { i32, i32, ptr, i64 }

@.str = external hidden unnamed_addr constant [75 x i8], align 1
@__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert = external hidden unnamed_addr constant [38 x i8], align 1

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

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

declare void @ERR_new() #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) #1

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %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 i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca [50 x i8], align 16
  %23 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  store i64 0, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  store i32 0, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  store ptr null, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 50, ptr %22) #3
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %44, label %26

26:                                               ; preds = %4
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %27, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = icmp eq ptr %29, null
  br i1 %30, label %44, label %31

31:                                               ; preds = %26
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %32, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = icmp eq ptr %34, null
  br i1 %35, label %44, label %36

36:                                               ; preds = %31
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %37, i32 0, i32 5
  %39 = load ptr, ptr %38, align 8, !tbaa !16
  %40 = icmp eq ptr %39, null
  br i1 %40, label %44, label %41

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

44:                                               ; preds = %41, %36, %31, %26, %4
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 642, ptr noundef @__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 56, i32 noundef 109, ptr noundef null)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %23, align 4
  br label %193

45:                                               ; preds = %41
  %46 = getelementptr inbounds [50 x i8], ptr %22, i64 0, i64 0
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !13
  %50 = getelementptr inbounds %struct.X509_algor_st, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  %52 = call i32 @OBJ_obj2txt(ptr noundef %46, i32 noundef 50, ptr noundef %51, i32 noundef 0)
  %53 = call i32 @ERR_set_mark()
  %54 = getelementptr inbounds [50 x i8], ptr %22, i64 0, i64 0
  %55 = call ptr @EVP_CIPHER_fetch(ptr noundef null, ptr noundef %54, ptr noundef null)
  store ptr %55, ptr %14, align 8, !tbaa !5
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = icmp eq ptr %56, null
  br i1 %57, label %58, label %61

58:                                               ; preds = %45
  %59 = getelementptr inbounds [50 x i8], ptr %22, i64 0, i64 0
  %60 = call ptr @EVP_get_cipherbyname(ptr noundef %59)
  store ptr %60, ptr %14, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %58, %45
  %62 = load ptr, ptr %14, align 8, !tbaa !5
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %66

64:                                               ; preds = %61
  %65 = call i32 @ERR_clear_last_mark()
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 657, ptr noundef @__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 56, i32 noundef 114, ptr noundef null)
  br label %184

66:                                               ; preds = %61
  %67 = call i32 @ERR_pop_to_mark()
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  %69 = call i32 @EVP_CIPHER_get_key_length(ptr noundef %68)
  store i32 %69, ptr %15, align 4, !tbaa !11
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = call ptr @EVP_PKEY_CTX_new_from_pkey(ptr noundef %70, ptr noundef %71, ptr noundef %72)
  store ptr %73, ptr %21, align 8, !tbaa !5
  %74 = load ptr, ptr %21, align 8, !tbaa !5
  %75 = icmp eq ptr %74, null
  br i1 %75, label %97, label %76

76:                                               ; preds = %66
  %77 = load ptr, ptr %21, align 8, !tbaa !5
  %78 = call i32 @EVP_PKEY_decrypt_init(ptr noundef %77)
  %79 = icmp sle i32 %78, 0
  br i1 %79, label %97, label %80

80:                                               ; preds = %76
  %81 = load ptr, ptr %21, align 8, !tbaa !5
  %82 = load i32, ptr %15, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %84, i32 0, i32 2
  %86 = load ptr, ptr %85, align 8, !tbaa !15
  %87 = getelementptr inbounds %struct.asn1_string_st, ptr %86, i32 0, i32 2
  %88 = load ptr, ptr %87, align 8, !tbaa !19
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !15
  %92 = getelementptr inbounds %struct.asn1_string_st, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %92, align 8, !tbaa !21
  %94 = sext i32 %93 to i64
  %95 = call i32 @evp_pkey_decrypt_alloc(ptr noundef %81, ptr noundef %12, ptr noundef %13, i64 noundef %83, ptr noundef %88, i64 noundef %94)
  %96 = icmp sle i32 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %80, %76, %66
  br label %184

98:                                               ; preds = %80
  %99 = load ptr, ptr %14, align 8, !tbaa !5
  %100 = call i32 @EVP_CIPHER_get_iv_length(ptr noundef %99)
  %101 = sext i32 %100 to i64
  %102 = call ptr @CRYPTO_malloc(i64 noundef %101, ptr noundef @.str, i32 noundef 671)
  store ptr %102, ptr %16, align 8, !tbaa !5
  %103 = icmp eq ptr %102, null
  br i1 %103, label %104, label %105

104:                                              ; preds = %98
  br label %184

105:                                              ; preds = %98
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %106, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !13
  %109 = getelementptr inbounds %struct.X509_algor_st, ptr %108, i32 0, i32 1
  %110 = load ptr, ptr %109, align 8, !tbaa !22
  %111 = load ptr, ptr %16, align 8, !tbaa !5
  %112 = load ptr, ptr %14, align 8, !tbaa !5
  %113 = call i32 @EVP_CIPHER_get_iv_length(ptr noundef %112)
  %114 = call i32 @ASN1_TYPE_get_octetstring(ptr noundef %110, ptr noundef %111, i32 noundef %113)
  %115 = load ptr, ptr %14, align 8, !tbaa !5
  %116 = call i32 @EVP_CIPHER_get_iv_length(ptr noundef %115)
  %117 = icmp ne i32 %114, %116
  br i1 %117, label %118, label %119

118:                                              ; preds = %105
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 676, ptr noundef @__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 56, i32 noundef 101, ptr noundef null)
  br label %184

119:                                              ; preds = %105
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %120, i32 0, i32 5
  %122 = load ptr, ptr %121, align 8, !tbaa !16
  %123 = getelementptr inbounds %struct.asn1_string_st, ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 8, !tbaa !21
  %125 = load ptr, ptr %14, align 8, !tbaa !5
  %126 = call i32 @EVP_CIPHER_get_block_size(ptr noundef %125)
  %127 = add nsw i32 %124, %126
  %128 = sext i32 %127 to i64
  %129 = call ptr @CRYPTO_malloc(i64 noundef %128, ptr noundef @.str, i32 noundef 685)
  store ptr %129, ptr %17, align 8, !tbaa !5
  store ptr %129, ptr %18, align 8, !tbaa !5
  %130 = icmp eq ptr %129, null
  br i1 %130, label %134, label %131

131:                                              ; preds = %119
  %132 = call ptr @EVP_CIPHER_CTX_new()
  store ptr %132, ptr %11, align 8, !tbaa !5
  %133 = icmp eq ptr %132, null
  br i1 %133, label %134, label %135

134:                                              ; preds = %131, %119
  br label %184

135:                                              ; preds = %131
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = call i32 @EVP_CIPHER_CTX_set_padding(ptr noundef %136, i32 noundef 0)
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = load ptr, ptr %14, align 8, !tbaa !5
  %140 = load ptr, ptr %12, align 8, !tbaa !5
  %141 = load ptr, ptr %16, align 8, !tbaa !5
  %142 = call i32 @EVP_DecryptInit(ptr noundef %138, ptr noundef %139, ptr noundef %140, ptr noundef %141)
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %144, label %167

144:                                              ; preds = %135
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = load ptr, ptr %17, align 8, !tbaa !5
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %147, i32 0, i32 5
  %149 = load ptr, ptr %148, align 8, !tbaa !16
  %150 = getelementptr inbounds %struct.asn1_string_st, ptr %149, i32 0, i32 2
  %151 = load ptr, ptr %150, align 8, !tbaa !19
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.ossl_crmf_encryptedvalue_st, ptr %152, i32 0, i32 5
  %154 = load ptr, ptr %153, align 8, !tbaa !16
  %155 = getelementptr inbounds %struct.asn1_string_st, ptr %154, i32 0, i32 0
  %156 = load i32, ptr %155, align 8, !tbaa !21
  %157 = call i32 @EVP_DecryptUpdate(ptr noundef %145, ptr noundef %146, ptr noundef %20, ptr noundef %151, i32 noundef %156)
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %167

159:                                              ; preds = %144
  %160 = load ptr, ptr %11, align 8, !tbaa !5
  %161 = load ptr, ptr %17, align 8, !tbaa !5
  %162 = load i32, ptr %20, align 4, !tbaa !11
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds i8, ptr %161, i64 %163
  %165 = call i32 @EVP_DecryptFinal(ptr noundef %160, ptr noundef %164, ptr noundef %19)
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %168, label %167

167:                                              ; preds = %159, %144, %135
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 695, ptr noundef @__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 56, i32 noundef 105, ptr noundef null)
  br label %184

168:                                              ; preds = %159
  %169 = load i32, ptr %19, align 4, !tbaa !11
  %170 = load i32, ptr %20, align 4, !tbaa !11
  %171 = add nsw i32 %170, %169
  store i32 %171, ptr %20, align 4, !tbaa !11
  %172 = load ptr, ptr %7, align 8, !tbaa !5
  %173 = load ptr, ptr %8, align 8, !tbaa !5
  %174 = call ptr @X509_new_ex(ptr noundef %172, ptr noundef %173)
  store ptr %174, ptr %10, align 8, !tbaa !5
  %175 = icmp eq ptr %174, null
  br i1 %175, label %176, label %177

176:                                              ; preds = %168
  br label %184

177:                                              ; preds = %168
  %178 = load i32, ptr %20, align 4, !tbaa !11
  %179 = sext i32 %178 to i64
  %180 = call ptr @d2i_X509(ptr noundef %10, ptr noundef %18, i64 noundef %179)
  %181 = icmp eq ptr %180, null
  br i1 %181, label %182, label %183

182:                                              ; preds = %177
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 704, ptr noundef @__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 56, i32 noundef 104, ptr noundef null)
  br label %183

183:                                              ; preds = %182, %177
  br label %184

184:                                              ; preds = %183, %176, %167, %134, %118, %104, %97, %64
  %185 = load ptr, ptr %21, align 8, !tbaa !5
  call void @EVP_PKEY_CTX_free(ptr noundef %185)
  %186 = load ptr, ptr %17, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %186, ptr noundef @.str, i32 noundef 707)
  %187 = load ptr, ptr %11, align 8, !tbaa !5
  call void @EVP_CIPHER_CTX_free(ptr noundef %187)
  %188 = load ptr, ptr %14, align 8, !tbaa !5
  call void @EVP_CIPHER_free(ptr noundef %188)
  %189 = load ptr, ptr %12, align 8, !tbaa !5
  %190 = load i64, ptr %13, align 8, !tbaa !9
  call void @CRYPTO_clear_free(ptr noundef %189, i64 noundef %190, ptr noundef @.str, i32 noundef 710)
  %191 = load ptr, ptr %16, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %191, ptr noundef @.str, i32 noundef 711)
  %192 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %192, ptr %5, align 8
  store i32 1, ptr %23, align 4
  br label %193

193:                                              ; preds = %184, %44
  call void @llvm.lifetime.end.p0(i64 50, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %194 = load ptr, ptr %5, align 8
  ret ptr %194
}

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

declare i32 @ERR_set_mark() #1

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

declare ptr @EVP_get_cipherbyname(ptr noundef) #1

declare i32 @ERR_clear_last_mark() #1

declare i32 @ERR_pop_to_mark() #1

declare i32 @EVP_CIPHER_get_key_length(ptr noundef) #1

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

declare i32 @EVP_PKEY_decrypt_init(ptr noundef) #1

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

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

declare i32 @EVP_CIPHER_get_iv_length(ptr noundef) #1

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

declare i32 @EVP_CIPHER_get_block_size(ptr noundef) #1

declare ptr @EVP_CIPHER_CTX_new() #1

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

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

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

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

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

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

declare void @EVP_PKEY_CTX_free(ptr noundef) #1

declare void @CRYPTO_free(ptr noundef, ptr noundef, i32 noundef) #1

declare void @EVP_CIPHER_CTX_free(ptr noundef) #1

declare void @EVP_CIPHER_free(ptr noundef) #1

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

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 }

!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 8}
!14 = !{!"ossl_crmf_encryptedvalue_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!14, !6, i64 16}
!16 = !{!14, !6, i64 40}
!17 = !{!18, !6, i64 0}
!18 = !{!"X509_algor_st", !6, i64 0, !6, i64 8}
!19 = !{!20, !6, i64 8}
!20 = !{!"asn1_string_st", !12, i64 0, !12, i64 4, !6, i64 8, !10, i64 16}
!21 = !{!20, !12, i64 0}
!22 = !{!18, !6, 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 [75 x i8], align 1
@__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert = external hidden unnamed_addr constant [38 x i8], align 1

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

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

declare void @ERR_new() local_unnamed_addr #1

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

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(ptr noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [50 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #3
  store i32 0, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %11) #3
  %12 = icmp eq ptr %0, null
  br i1 %12, label %26, label %13

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = icmp eq ptr %15, null
  br i1 %16, label %26, label %17

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = icmp eq ptr %19, null
  br i1 %20, label %26, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 40
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %24 = icmp eq ptr %23, null
  %25 = icmp eq ptr %3, null
  %or.cond = or i1 %25, %24
  br i1 %or.cond, label %26, label %27

26:                                               ; preds = %21, %17, %13, %4
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 642, ptr noundef nonnull @__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 56, i32 noundef 109, ptr noundef null) #3
  br label %107

27:                                               ; preds = %21
  %28 = load ptr, ptr %15, align 8, !tbaa !17
  %29 = call i32 @OBJ_obj2txt(ptr noundef nonnull %11, i32 noundef 50, ptr noundef %28, i32 noundef 0) #3
  %30 = call i32 @ERR_set_mark() #3
  %31 = call ptr @EVP_CIPHER_fetch(ptr noundef null, ptr noundef nonnull %11, ptr noundef null) #3
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %.thread

33:                                               ; preds = %27
  %34 = call ptr @EVP_get_cipherbyname(ptr noundef nonnull %11) #3
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %.thread

36:                                               ; preds = %33
  %37 = call i32 @ERR_clear_last_mark() #3
  br label %.sink.split

.thread:                                          ; preds = %27, %33
  %.04564 = phi ptr [ %34, %33 ], [ %31, %27 ]
  %38 = call i32 @ERR_pop_to_mark() #3
  %39 = call i32 @EVP_CIPHER_get_key_length(ptr noundef nonnull %.04564) #3
  %40 = call ptr @EVP_PKEY_CTX_new_from_pkey(ptr noundef %1, ptr noundef nonnull %3, ptr noundef %2) #3
  %41 = icmp eq ptr %40, null
  br i1 %41, label %103, label %42

42:                                               ; preds = %.thread
  %43 = call i32 @EVP_PKEY_decrypt_init(ptr noundef nonnull %40) #3
  %44 = icmp slt i32 %43, 1
  br i1 %44, label %103, label %45

45:                                               ; preds = %42
  %46 = sext i32 %39 to i64
  %47 = load ptr, ptr %18, align 8, !tbaa !15
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = load i32, ptr %47, align 8, !tbaa !21
  %51 = sext i32 %50 to i64
  %52 = call i32 @evp_pkey_decrypt_alloc(ptr noundef nonnull %40, ptr noundef nonnull %6, ptr noundef nonnull %7, i64 noundef %46, ptr noundef %49, i64 noundef %51) #3
  %53 = icmp slt i32 %52, 1
  br i1 %53, label %103, label %54

54:                                               ; preds = %45
  %55 = call i32 @EVP_CIPHER_get_iv_length(ptr noundef nonnull %.04564) #3
  %56 = sext i32 %55 to i64
  %57 = call ptr @CRYPTO_malloc(i64 noundef %56, ptr noundef nonnull @.str, i32 noundef 671) #3
  %58 = icmp eq ptr %57, null
  br i1 %58, label %103, label %59

59:                                               ; preds = %54
  %60 = load ptr, ptr %14, align 8, !tbaa !13
  %61 = getelementptr inbounds i8, ptr %60, i64 8
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  %63 = call i32 @EVP_CIPHER_get_iv_length(ptr noundef nonnull %.04564) #3
  %64 = call i32 @ASN1_TYPE_get_octetstring(ptr noundef %62, ptr noundef nonnull %57, i32 noundef %63) #3
  %65 = call i32 @EVP_CIPHER_get_iv_length(ptr noundef nonnull %.04564) #3
  %.not = icmp eq i32 %64, %65
  br i1 %.not, label %66, label %.sink.split

66:                                               ; preds = %59
  %67 = load ptr, ptr %22, align 8, !tbaa !16
  %68 = load i32, ptr %67, align 8, !tbaa !21
  %69 = call i32 @EVP_CIPHER_get_block_size(ptr noundef nonnull %.04564) #3
  %70 = add nsw i32 %69, %68
  %71 = sext i32 %70 to i64
  %72 = call ptr @CRYPTO_malloc(i64 noundef %71, ptr noundef nonnull @.str, i32 noundef 685) #3
  store ptr %72, ptr %8, align 8, !tbaa !5
  %73 = icmp eq ptr %72, null
  br i1 %73, label %103, label %74

74:                                               ; preds = %66
  %75 = call ptr @EVP_CIPHER_CTX_new() #3
  %76 = icmp eq ptr %75, null
  br i1 %76, label %103, label %77

77:                                               ; preds = %74
  %78 = call i32 @EVP_CIPHER_CTX_set_padding(ptr noundef nonnull %75, i32 noundef 0) #3
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = call i32 @EVP_DecryptInit(ptr noundef nonnull %75, ptr noundef nonnull %.04564, ptr noundef %79, ptr noundef nonnull %57) #3
  %.not59 = icmp eq i32 %80, 0
  br i1 %.not59, label %.sink.split, label %81

81:                                               ; preds = %77
  %82 = load ptr, ptr %22, align 8, !tbaa !16
  %83 = getelementptr inbounds i8, ptr %82, i64 8
  %84 = load ptr, ptr %83, align 8, !tbaa !19
  %85 = load i32, ptr %82, align 8, !tbaa !21
  %86 = call i32 @EVP_DecryptUpdate(ptr noundef nonnull %75, ptr noundef nonnull %72, ptr noundef nonnull %10, ptr noundef %84, i32 noundef %85) #3
  %.not60 = icmp eq i32 %86, 0
  br i1 %.not60, label %.sink.split, label %87

87:                                               ; preds = %81
  %88 = load i32, ptr %10, align 4, !tbaa !11
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i8, ptr %72, i64 %89
  %91 = call i32 @EVP_DecryptFinal(ptr noundef nonnull %75, ptr noundef nonnull %90, ptr noundef nonnull %9) #3
  %.not61 = icmp eq i32 %91, 0
  br i1 %.not61, label %.sink.split, label %92

92:                                               ; preds = %87
  %93 = load i32, ptr %9, align 4, !tbaa !11
  %94 = load i32, ptr %10, align 4, !tbaa !11
  %95 = add nsw i32 %94, %93
  store i32 %95, ptr %10, align 4, !tbaa !11
  %96 = call ptr @X509_new_ex(ptr noundef %1, ptr noundef %2) #3
  store ptr %96, ptr %5, align 8, !tbaa !5
  %97 = icmp eq ptr %96, null
  br i1 %97, label %103, label %98

98:                                               ; preds = %92
  %99 = load i32, ptr %10, align 4, !tbaa !11
  %100 = sext i32 %99 to i64
  %101 = call ptr @d2i_X509(ptr noundef nonnull %5, ptr noundef nonnull %8, i64 noundef %100) #3
  %102 = icmp eq ptr %101, null
  br i1 %102, label %.sink.split, label %103

.sink.split:                                      ; preds = %98, %77, %81, %87, %59, %36
  %.sink65 = phi i32 [ 657, %36 ], [ 676, %59 ], [ 695, %87 ], [ 695, %81 ], [ 695, %77 ], [ 704, %98 ]
  %.sink = phi i32 [ 114, %36 ], [ 101, %59 ], [ 105, %87 ], [ 105, %81 ], [ 105, %77 ], [ 104, %98 ]
  %.04563.ph = phi ptr [ null, %36 ], [ %.04564, %59 ], [ %.04564, %87 ], [ %.04564, %81 ], [ %.04564, %77 ], [ %.04564, %98 ]
  %.046.ph = phi ptr [ null, %36 ], [ null, %59 ], [ %75, %87 ], [ %75, %81 ], [ %75, %77 ], [ %75, %98 ]
  %.044.ph = phi ptr [ null, %36 ], [ %57, %59 ], [ %57, %87 ], [ %57, %81 ], [ %57, %77 ], [ %57, %98 ]
  %.043.ph = phi ptr [ null, %36 ], [ null, %59 ], [ %72, %87 ], [ %72, %81 ], [ %72, %77 ], [ %72, %98 ]
  %.0.ph = phi ptr [ null, %36 ], [ %40, %59 ], [ %40, %87 ], [ %40, %81 ], [ %40, %77 ], [ %40, %98 ]
  call void @ERR_new() #3
  call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef %.sink65, ptr noundef nonnull @__func__.OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert) #3
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 56, i32 noundef %.sink, ptr noundef null) #3
  br label %103

103:                                              ; preds = %.sink.split, %98, %92, %66, %74, %54, %.thread, %42, %45
  %.04563 = phi ptr [ %.04564, %.thread ], [ %.04564, %42 ], [ %.04564, %45 ], [ %.04564, %54 ], [ %.04564, %66 ], [ %.04564, %74 ], [ %.04564, %92 ], [ %.04564, %98 ], [ %.04563.ph, %.sink.split ]
  %.046 = phi ptr [ null, %.thread ], [ null, %42 ], [ null, %45 ], [ null, %54 ], [ null, %66 ], [ null, %74 ], [ %75, %92 ], [ %75, %98 ], [ %.046.ph, %.sink.split ]
  %.044 = phi ptr [ null, %.thread ], [ null, %42 ], [ null, %45 ], [ null, %54 ], [ %57, %66 ], [ %57, %74 ], [ %57, %92 ], [ %57, %98 ], [ %.044.ph, %.sink.split ]
  %.043 = phi ptr [ null, %.thread ], [ null, %42 ], [ null, %45 ], [ null, %54 ], [ null, %66 ], [ %72, %74 ], [ %72, %92 ], [ %72, %98 ], [ %.043.ph, %.sink.split ]
  %.0 = phi ptr [ null, %.thread ], [ %40, %42 ], [ %40, %45 ], [ %40, %54 ], [ %40, %66 ], [ %40, %74 ], [ %40, %92 ], [ %40, %98 ], [ %.0.ph, %.sink.split ]
  call void @EVP_PKEY_CTX_free(ptr noundef %.0) #3
  call void @CRYPTO_free(ptr noundef %.043, ptr noundef nonnull @.str, i32 noundef 707) #3
  call void @EVP_CIPHER_CTX_free(ptr noundef %.046) #3
  call void @EVP_CIPHER_free(ptr noundef %.04563) #3
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = load i64, ptr %7, align 8, !tbaa !9
  call void @CRYPTO_clear_free(ptr noundef %104, i64 noundef %105, ptr noundef nonnull @.str, i32 noundef 710) #3
  call void @CRYPTO_free(ptr noundef %.044, ptr noundef nonnull @.str, i32 noundef 711) #3
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %103, %26
  %.047 = phi ptr [ null, %26 ], [ %106, %103 ]
  call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret ptr %.047
}

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

declare i32 @ERR_set_mark() local_unnamed_addr #1

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

declare ptr @EVP_get_cipherbyname(ptr noundef) local_unnamed_addr #1

declare i32 @ERR_clear_last_mark() local_unnamed_addr #1

declare i32 @ERR_pop_to_mark() local_unnamed_addr #1

declare i32 @EVP_CIPHER_get_key_length(ptr noundef) local_unnamed_addr #1

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

declare i32 @EVP_PKEY_decrypt_init(ptr noundef) local_unnamed_addr #1

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

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

declare i32 @EVP_CIPHER_get_iv_length(ptr noundef) local_unnamed_addr #1

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

declare i32 @EVP_CIPHER_get_block_size(ptr noundef) local_unnamed_addr #1

declare ptr @EVP_CIPHER_CTX_new() local_unnamed_addr #1

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

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

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

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

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

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

declare void @EVP_PKEY_CTX_free(ptr noundef) local_unnamed_addr #1

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

declare void @EVP_CIPHER_CTX_free(ptr noundef) local_unnamed_addr #1

declare void @EVP_CIPHER_free(ptr noundef) local_unnamed_addr #1

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

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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"ossl_crmf_encryptedvalue_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!14, !6, i64 16}
!16 = !{!14, !6, i64 40}
!17 = !{!18, !6, i64 0}
!18 = !{!"X509_algor_st", !6, i64 0, !6, i64 8}
!19 = !{!20, !6, i64 8}
!20 = !{!"asn1_string_st", !12, i64 0, !12, i64 4, !6, i64 8, !10, i64 16}
!21 = !{!20, !12, i64 0}
!22 = !{!18, !6, i64 8}


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