; LLVM IR from openssl/openssl :: crypto/sm2 (sm2_crypt)

; 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.SM2_Ciphertext_st = type { ptr, ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@__func__.ossl_sm2_encrypt = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @i2d_SM2_Ciphertext(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 @ERR_new() #2

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i64 @ec_field_size(ptr noundef) #0

declare ptr @EC_KEY_get0_group(ptr noundef) #2

declare i32 @EVP_MD_get_size(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_sm2_encrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca %struct.SM2_Ciphertext_st, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca i64, align 8
  %33 = alloca i32, align 4
  %34 = alloca ptr, align 8
  %35 = alloca ptr, align 8
  %36 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i64 %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  store ptr null, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  store ptr null, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  store ptr null, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %37 = call ptr @EVP_MD_CTX_new()
  store ptr %37, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = call ptr @EC_KEY_get0_group(ptr noundef %38)
  store ptr %39, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %40 = load ptr, ptr %24, align 8, !tbaa !5
  %41 = call ptr @EC_GROUP_get0_order(ptr noundef %40)
  store ptr %41, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = call ptr @EC_KEY_get0_public_key(ptr noundef %42)
  store ptr %43, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  store ptr null, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  store ptr null, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #4
  store ptr null, ptr %29, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #4
  store ptr null, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #4
  store ptr null, ptr %31, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #4
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = call i32 @EVP_MD_get_size(ptr noundef %44)
  store i32 %45, ptr %33, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #4
  store ptr null, ptr %34, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #4
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = call ptr @ossl_ec_key_get_libctx(ptr noundef %46)
  store ptr %47, ptr %35, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #4
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = call ptr @ossl_ec_key_get0_propq(ptr noundef %48)
  store ptr %49, ptr %36, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 3
  store ptr null, ptr %50, align 8, !tbaa !13
  %51 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 2
  store ptr null, ptr %51, align 8, !tbaa !15
  %52 = load ptr, ptr %22, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %57, label %54

54:                                               ; preds = %6
  %55 = load i32, ptr %33, align 4, !tbaa !11
  %56 = icmp sle i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %54, %6
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 141, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null)
  br label %299

58:                                               ; preds = %54
  %59 = load ptr, ptr %24, align 8, !tbaa !5
  %60 = call i64 @ec_field_size(ptr noundef %59)
  store i64 %60, ptr %32, align 8, !tbaa !9
  %61 = load i64, ptr %32, align 8, !tbaa !9
  %62 = icmp eq i64 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %58
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 147, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null)
  br label %299

64:                                               ; preds = %58
  %65 = load ptr, ptr %24, align 8, !tbaa !5
  %66 = call ptr @EC_POINT_new(ptr noundef %65)
  store ptr %66, ptr %27, align 8, !tbaa !5
  %67 = load ptr, ptr %24, align 8, !tbaa !5
  %68 = call ptr @EC_POINT_new(ptr noundef %67)
  store ptr %68, ptr %28, align 8, !tbaa !5
  %69 = load ptr, ptr %27, align 8, !tbaa !5
  %70 = icmp eq ptr %69, null
  br i1 %70, label %74, label %71

71:                                               ; preds = %64
  %72 = load ptr, ptr %28, align 8, !tbaa !5
  %73 = icmp eq ptr %72, null
  br i1 %73, label %74, label %75

74:                                               ; preds = %71, %64
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 154, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524304, ptr noundef null)
  br label %299

75:                                               ; preds = %71
  %76 = load ptr, ptr %35, align 8, !tbaa !5
  %77 = call ptr @BN_CTX_new_ex(ptr noundef %76)
  store ptr %77, ptr %16, align 8, !tbaa !5
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = icmp eq ptr %78, null
  br i1 %79, label %80, label %81

80:                                               ; preds = %75
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 159, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524291, ptr noundef null)
  br label %299

81:                                               ; preds = %75
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  call void @BN_CTX_start(ptr noundef %82)
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = call ptr @BN_CTX_get(ptr noundef %83)
  store ptr %84, ptr %17, align 8, !tbaa !5
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = call ptr @BN_CTX_get(ptr noundef %85)
  store ptr %86, ptr %18, align 8, !tbaa !5
  %87 = load ptr, ptr %16, align 8, !tbaa !5
  %88 = call ptr @BN_CTX_get(ptr noundef %87)
  store ptr %88, ptr %20, align 8, !tbaa !5
  %89 = load ptr, ptr %16, align 8, !tbaa !5
  %90 = call ptr @BN_CTX_get(ptr noundef %89)
  store ptr %90, ptr %19, align 8, !tbaa !5
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  %92 = call ptr @BN_CTX_get(ptr noundef %91)
  store ptr %92, ptr %21, align 8, !tbaa !5
  %93 = load ptr, ptr %21, align 8, !tbaa !5
  %94 = icmp eq ptr %93, null
  br i1 %94, label %95, label %96

95:                                               ; preds = %81
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 171, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524291, ptr noundef null)
  br label %299

96:                                               ; preds = %81
  %97 = load i64, ptr %32, align 8, !tbaa !9
  %98 = mul i64 2, %97
  %99 = call ptr @CRYPTO_zalloc(i64 noundef %98, ptr noundef @.str.1, i32 noundef 175)
  store ptr %99, ptr %30, align 8, !tbaa !5
  %100 = load i32, ptr %33, align 4, !tbaa !11
  %101 = sext i32 %100 to i64
  %102 = call ptr @CRYPTO_zalloc(i64 noundef %101, ptr noundef @.str.1, i32 noundef 176)
  store ptr %102, ptr %31, align 8, !tbaa !5
  %103 = load ptr, ptr %30, align 8, !tbaa !5
  %104 = icmp eq ptr %103, null
  br i1 %104, label %108, label %105

105:                                              ; preds = %96
  %106 = load ptr, ptr %31, align 8, !tbaa !5
  %107 = icmp eq ptr %106, null
  br i1 %107, label %108, label %109

108:                                              ; preds = %105, %96
  br label %299

109:                                              ; preds = %105
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = load i64, ptr %111, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 1 %110, i8 0, i64 %112, i1 false)
  %113 = load i64, ptr %10, align 8, !tbaa !9
  %114 = call ptr @CRYPTO_zalloc(i64 noundef %113, ptr noundef @.str.1, i32 noundef 183)
  store ptr %114, ptr %29, align 8, !tbaa !5
  %115 = load ptr, ptr %29, align 8, !tbaa !5
  %116 = icmp eq ptr %115, null
  br i1 %116, label %117, label %118

117:                                              ; preds = %109
  br label %299

118:                                              ; preds = %109
  br label %119

119:                                              ; preds = %192, %118
  %120 = load ptr, ptr %17, align 8, !tbaa !5
  %121 = load ptr, ptr %25, align 8, !tbaa !5
  %122 = load ptr, ptr %16, align 8, !tbaa !5
  %123 = call i32 @BN_priv_rand_range_ex(ptr noundef %120, ptr noundef %121, i32 noundef 0, ptr noundef %122)
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %126, label %125

125:                                              ; preds = %119
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 189, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null)
  br label %299

126:                                              ; preds = %119
  %127 = load ptr, ptr %24, align 8, !tbaa !5
  %128 = load ptr, ptr %27, align 8, !tbaa !5
  %129 = load ptr, ptr %17, align 8, !tbaa !5
  %130 = load ptr, ptr %16, align 8, !tbaa !5
  %131 = call i32 @EC_POINT_mul(ptr noundef %127, ptr noundef %128, ptr noundef %129, ptr noundef null, ptr noundef null, ptr noundef %130)
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %157

133:                                              ; preds = %126
  %134 = load ptr, ptr %24, align 8, !tbaa !5
  %135 = load ptr, ptr %27, align 8, !tbaa !5
  %136 = load ptr, ptr %18, align 8, !tbaa !5
  %137 = load ptr, ptr %19, align 8, !tbaa !5
  %138 = load ptr, ptr %16, align 8, !tbaa !5
  %139 = call i32 @EC_POINT_get_affine_coordinates(ptr noundef %134, ptr noundef %135, ptr noundef %136, ptr noundef %137, ptr noundef %138)
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %157

141:                                              ; preds = %133
  %142 = load ptr, ptr %24, align 8, !tbaa !5
  %143 = load ptr, ptr %28, align 8, !tbaa !5
  %144 = load ptr, ptr %26, align 8, !tbaa !5
  %145 = load ptr, ptr %17, align 8, !tbaa !5
  %146 = load ptr, ptr %16, align 8, !tbaa !5
  %147 = call i32 @EC_POINT_mul(ptr noundef %142, ptr noundef %143, ptr noundef null, ptr noundef %144, ptr noundef %145, ptr noundef %146)
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %149, label %157

149:                                              ; preds = %141
  %150 = load ptr, ptr %24, align 8, !tbaa !5
  %151 = load ptr, ptr %28, align 8, !tbaa !5
  %152 = load ptr, ptr %20, align 8, !tbaa !5
  %153 = load ptr, ptr %21, align 8, !tbaa !5
  %154 = load ptr, ptr %16, align 8, !tbaa !5
  %155 = call i32 @EC_POINT_get_affine_coordinates(ptr noundef %150, ptr noundef %151, ptr noundef %152, ptr noundef %153, ptr noundef %154)
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %158, label %157

157:                                              ; preds = %149, %141, %133, %126
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 197, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524304, ptr noundef null)
  br label %299

158:                                              ; preds = %149
  %159 = load ptr, ptr %20, align 8, !tbaa !5
  %160 = load ptr, ptr %30, align 8, !tbaa !5
  %161 = load i64, ptr %32, align 8, !tbaa !9
  %162 = trunc i64 %161 to i32
  %163 = call i32 @BN_bn2binpad(ptr noundef %159, ptr noundef %160, i32 noundef %162)
  %164 = icmp slt i32 %163, 0
  br i1 %164, label %174, label %165

165:                                              ; preds = %158
  %166 = load ptr, ptr %21, align 8, !tbaa !5
  %167 = load ptr, ptr %30, align 8, !tbaa !5
  %168 = load i64, ptr %32, align 8, !tbaa !9
  %169 = getelementptr inbounds i8, ptr %167, i64 %168
  %170 = load i64, ptr %32, align 8, !tbaa !9
  %171 = trunc i64 %170 to i32
  %172 = call i32 @BN_bn2binpad(ptr noundef %166, ptr noundef %169, i32 noundef %171)
  %173 = icmp slt i32 %172, 0
  br i1 %173, label %174, label %175

174:                                              ; preds = %165, %158
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 203, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null)
  br label %299

175:                                              ; preds = %165
  %176 = load ptr, ptr %29, align 8, !tbaa !5
  %177 = load i64, ptr %10, align 8, !tbaa !9
  %178 = load ptr, ptr %30, align 8, !tbaa !5
  %179 = load i64, ptr %32, align 8, !tbaa !9
  %180 = mul i64 2, %179
  %181 = load ptr, ptr %8, align 8, !tbaa !5
  %182 = load ptr, ptr %35, align 8, !tbaa !5
  %183 = load ptr, ptr %36, align 8, !tbaa !5
  %184 = call i32 @ossl_ecdh_kdf_X9_63(ptr noundef %176, i64 noundef %177, ptr noundef %178, i64 noundef %180, ptr noundef null, i64 noundef 0, ptr noundef %181, ptr noundef %182, ptr noundef %183)
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %187, label %186

186:                                              ; preds = %175
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 210, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524294, ptr noundef null)
  br label %299

187:                                              ; preds = %175
  %188 = load ptr, ptr %29, align 8, !tbaa !5
  %189 = load i64, ptr %10, align 8, !tbaa !9
  %190 = call i32 @is_all_zeros(ptr noundef %188, i64 noundef %189)
  %191 = icmp ne i32 %190, 0
  br i1 %191, label %192, label %196

192:                                              ; preds = %187
  %193 = load ptr, ptr %30, align 8, !tbaa !5
  %194 = load i64, ptr %32, align 8, !tbaa !9
  %195 = mul i64 2, %194
  call void @llvm.memset.p0.i64(ptr align 1 %193, i8 0, i64 %195, i1 false)
  br label %119

196:                                              ; preds = %187
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %197

197:                                              ; preds = %214, %196
  %198 = load i64, ptr %15, align 8, !tbaa !9
  %199 = load i64, ptr %10, align 8, !tbaa !9
  %200 = icmp ne i64 %198, %199
  br i1 %200, label %201, label %217

201:                                              ; preds = %197
  %202 = load ptr, ptr %9, align 8, !tbaa !5
  %203 = load i64, ptr %15, align 8, !tbaa !9
  %204 = getelementptr inbounds i8, ptr %202, i64 %203
  %205 = load i8, ptr %204, align 1, !tbaa !16
  %206 = zext i8 %205 to i32
  %207 = load ptr, ptr %29, align 8, !tbaa !5
  %208 = load i64, ptr %15, align 8, !tbaa !9
  %209 = getelementptr inbounds i8, ptr %207, i64 %208
  %210 = load i8, ptr %209, align 1, !tbaa !16
  %211 = zext i8 %210 to i32
  %212 = xor i32 %211, %206
  %213 = trunc i32 %212 to i8
  store i8 %213, ptr %209, align 1, !tbaa !16
  br label %214

214:                                              ; preds = %201
  %215 = load i64, ptr %15, align 8, !tbaa !9
  %216 = add i64 %215, 1
  store i64 %216, ptr %15, align 8, !tbaa !9
  br label %197, !llvm.loop !17

217:                                              ; preds = %197
  %218 = load ptr, ptr %35, align 8, !tbaa !5
  %219 = load ptr, ptr %8, align 8, !tbaa !5
  %220 = call ptr @EVP_MD_get0_name(ptr noundef %219)
  %221 = load ptr, ptr %36, align 8, !tbaa !5
  %222 = call ptr @EVP_MD_fetch(ptr noundef %218, ptr noundef %220, ptr noundef %221)
  store ptr %222, ptr %34, align 8, !tbaa !5
  %223 = load ptr, ptr %34, align 8, !tbaa !5
  %224 = icmp eq ptr %223, null
  br i1 %224, label %225, label %226

225:                                              ; preds = %217
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 224, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null)
  br label %299

226:                                              ; preds = %217
  %227 = load ptr, ptr %22, align 8, !tbaa !5
  %228 = load ptr, ptr %34, align 8, !tbaa !5
  %229 = call i32 @EVP_DigestInit(ptr noundef %227, ptr noundef %228)
  %230 = icmp eq i32 %229, 0
  br i1 %230, label %256, label %231

231:                                              ; preds = %226
  %232 = load ptr, ptr %22, align 8, !tbaa !5
  %233 = load ptr, ptr %30, align 8, !tbaa !5
  %234 = load i64, ptr %32, align 8, !tbaa !9
  %235 = call i32 @EVP_DigestUpdate(ptr noundef %232, ptr noundef %233, i64 noundef %234)
  %236 = icmp eq i32 %235, 0
  br i1 %236, label %256, label %237

237:                                              ; preds = %231
  %238 = load ptr, ptr %22, align 8, !tbaa !5
  %239 = load ptr, ptr %9, align 8, !tbaa !5
  %240 = load i64, ptr %10, align 8, !tbaa !9
  %241 = call i32 @EVP_DigestUpdate(ptr noundef %238, ptr noundef %239, i64 noundef %240)
  %242 = icmp eq i32 %241, 0
  br i1 %242, label %256, label %243

243:                                              ; preds = %237
  %244 = load ptr, ptr %22, align 8, !tbaa !5
  %245 = load ptr, ptr %30, align 8, !tbaa !5
  %246 = load i64, ptr %32, align 8, !tbaa !9
  %247 = getelementptr inbounds i8, ptr %245, i64 %246
  %248 = load i64, ptr %32, align 8, !tbaa !9
  %249 = call i32 @EVP_DigestUpdate(ptr noundef %244, ptr noundef %247, i64 noundef %248)
  %250 = icmp eq i32 %249, 0
  br i1 %250, label %256, label %251

251:                                              ; preds = %243
  %252 = load ptr, ptr %22, align 8, !tbaa !5
  %253 = load ptr, ptr %31, align 8, !tbaa !5
  %254 = call i32 @EVP_DigestFinal(ptr noundef %252, ptr noundef %253, ptr noundef null)
  %255 = icmp eq i32 %254, 0
  br i1 %255, label %256, label %257

256:                                              ; preds = %251, %243, %237, %231, %226
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 232, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524294, ptr noundef null)
  br label %299

257:                                              ; preds = %251
  %258 = load ptr, ptr %18, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 0
  store ptr %258, ptr %259, align 8, !tbaa !19
  %260 = load ptr, ptr %19, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 1
  store ptr %260, ptr %261, align 8, !tbaa !20
  %262 = call ptr @ASN1_OCTET_STRING_new()
  %263 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 2
  store ptr %262, ptr %263, align 8, !tbaa !15
  %264 = call ptr @ASN1_OCTET_STRING_new()
  %265 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 3
  store ptr %264, ptr %265, align 8, !tbaa !13
  %266 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 2
  %267 = load ptr, ptr %266, align 8, !tbaa !15
  %268 = icmp eq ptr %267, null
  br i1 %268, label %273, label %269

269:                                              ; preds = %257
  %270 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 3
  %271 = load ptr, ptr %270, align 8, !tbaa !13
  %272 = icmp eq ptr %271, null
  br i1 %272, label %273, label %274

273:                                              ; preds = %269, %257
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 242, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524301, ptr noundef null)
  br label %299

274:                                              ; preds = %269
  %275 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 2
  %276 = load ptr, ptr %275, align 8, !tbaa !15
  %277 = load ptr, ptr %31, align 8, !tbaa !5
  %278 = load i32, ptr %33, align 4, !tbaa !11
  %279 = call i32 @ASN1_OCTET_STRING_set(ptr noundef %276, ptr noundef %277, i32 noundef %278)
  %280 = icmp ne i32 %279, 0
  br i1 %280, label %281, label %289

281:                                              ; preds = %274
  %282 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 3
  %283 = load ptr, ptr %282, align 8, !tbaa !13
  %284 = load ptr, ptr %29, align 8, !tbaa !5
  %285 = load i64, ptr %10, align 8, !tbaa !9
  %286 = trunc i64 %285 to i32
  %287 = call i32 @ASN1_OCTET_STRING_set(ptr noundef %283, ptr noundef %284, i32 noundef %286)
  %288 = icmp ne i32 %287, 0
  br i1 %288, label %290, label %289

289:                                              ; preds = %281, %274
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 247, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null)
  br label %299

290:                                              ; preds = %281
  %291 = call i32 @i2d_SM2_Ciphertext(ptr noundef %23, ptr noundef %11)
  store i32 %291, ptr %14, align 4, !tbaa !11
  %292 = load i32, ptr %14, align 4, !tbaa !11
  %293 = icmp slt i32 %292, 0
  br i1 %293, label %294, label %295

294:                                              ; preds = %290
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str.1, i32 noundef 254, ptr noundef @__func__.ossl_sm2_encrypt)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null)
  br label %299

295:                                              ; preds = %290
  %296 = load i32, ptr %14, align 4, !tbaa !11
  %297 = sext i32 %296 to i64
  %298 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 %297, ptr %298, align 8, !tbaa !9
  store i32 1, ptr %13, align 4, !tbaa !11
  br label %299

299:                                              ; preds = %295, %294, %289, %273, %256, %225, %186, %174, %157, %125, %117, %108, %95, %80, %74, %63, %57
  %300 = load ptr, ptr %34, align 8, !tbaa !5
  call void @EVP_MD_free(ptr noundef %300)
  %301 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 3
  %302 = load ptr, ptr %301, align 8, !tbaa !13
  call void @ASN1_OCTET_STRING_free(ptr noundef %302)
  %303 = getelementptr inbounds %struct.SM2_Ciphertext_st, ptr %23, i32 0, i32 2
  %304 = load ptr, ptr %303, align 8, !tbaa !15
  call void @ASN1_OCTET_STRING_free(ptr noundef %304)
  %305 = load ptr, ptr %29, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %305, ptr noundef @.str.1, i32 noundef 265)
  %306 = load ptr, ptr %30, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %306, ptr noundef @.str.1, i32 noundef 266)
  %307 = load ptr, ptr %31, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %307, ptr noundef @.str.1, i32 noundef 267)
  %308 = load ptr, ptr %22, align 8, !tbaa !5
  call void @EVP_MD_CTX_free(ptr noundef %308)
  %309 = load ptr, ptr %16, align 8, !tbaa !5
  call void @BN_CTX_free(ptr noundef %309)
  %310 = load ptr, ptr %27, align 8, !tbaa !5
  call void @EC_POINT_free(ptr noundef %310)
  %311 = load ptr, ptr %28, align 8, !tbaa !5
  call void @EC_POINT_free(ptr noundef %311)
  %312 = load i32, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  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 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  ret i32 %312
}

declare ptr @EVP_MD_CTX_new() #2

declare ptr @EC_GROUP_get0_order(ptr noundef) #2

declare ptr @EC_KEY_get0_public_key(ptr noundef) #2

declare ptr @ossl_ec_key_get_libctx(ptr noundef) #2

declare ptr @ossl_ec_key_get0_propq(ptr noundef) #2

declare ptr @EC_POINT_new(ptr noundef) #2

declare ptr @BN_CTX_new_ex(ptr noundef) #2

declare void @BN_CTX_start(ptr noundef) #2

declare ptr @BN_CTX_get(ptr noundef) #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

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

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

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

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

declare ptr @EVP_MD_fetch(ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @EVP_MD_get0_name(ptr noundef) #2

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

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

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

declare ptr @ASN1_OCTET_STRING_new() #2

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

declare void @EVP_MD_free(ptr noundef) #2

declare void @ASN1_OCTET_STRING_free(ptr noundef) #2

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

declare void @EVP_MD_CTX_free(ptr noundef) #2

declare void @BN_CTX_free(ptr noundef) #2

declare void @EC_POINT_free(ptr noundef) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 24}
!14 = !{!"SM2_Ciphertext_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!14, !6, i64 16}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!14, !6, i64 0}
!20 = !{!14, !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"

%struct.SM2_Ciphertext_st = type { ptr, ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@__func__.ossl_sm2_encrypt = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @i2d_SM2_Ciphertext(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 @ERR_new() local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i64 @ec_field_size(ptr noundef) local_unnamed_addr #0

declare ptr @EC_KEY_get0_group(ptr noundef) local_unnamed_addr #2

declare i32 @EVP_MD_get_size(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_sm2_encrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, ptr nocapture noundef %5) local_unnamed_addr #0 {
  %7 = alloca ptr, align 8
  %8 = alloca %struct.SM2_Ciphertext_st, align 8
  store ptr %4, ptr %7, align 8, !tbaa !5
  %9 = tail call ptr @EVP_MD_CTX_new() #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #4
  %10 = tail call ptr @EC_KEY_get0_group(ptr noundef %0) #4
  %11 = tail call ptr @EC_GROUP_get0_order(ptr noundef %10) #4
  %12 = tail call ptr @EC_KEY_get0_public_key(ptr noundef %0) #4
  %13 = tail call i32 @EVP_MD_get_size(ptr noundef %1) #4
  %14 = tail call ptr @ossl_ec_key_get_libctx(ptr noundef %0) #4
  %15 = tail call ptr @ossl_ec_key_get0_propq(ptr noundef %0) #4
  %16 = getelementptr inbounds i8, ptr %8, i64 24
  %17 = getelementptr inbounds i8, ptr %8, i64 16
  %18 = icmp eq ptr %9, null
  %19 = icmp slt i32 %13, 1
  %or.cond = select i1 %18, i1 true, i1 %19
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %17, i8 0, i64 16, i1 false)
  br i1 %or.cond, label %20, label %21

20:                                               ; preds = %6
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 141, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null) #4
  br label %162

21:                                               ; preds = %6
  %22 = tail call i64 @ec_field_size(ptr noundef %10)
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 147, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null) #4
  br label %162

25:                                               ; preds = %21
  %26 = tail call ptr @EC_POINT_new(ptr noundef %10) #4
  %27 = tail call ptr @EC_POINT_new(ptr noundef %10) #4
  %28 = icmp eq ptr %26, null
  %29 = icmp eq ptr %27, null
  %or.cond3 = select i1 %28, i1 true, i1 %29
  br i1 %or.cond3, label %30, label %31

30:                                               ; preds = %25
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 154, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524304, ptr noundef null) #4
  br label %162

31:                                               ; preds = %25
  %32 = tail call ptr @BN_CTX_new_ex(ptr noundef %14) #4
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 159, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524291, ptr noundef null) #4
  br label %162

35:                                               ; preds = %31
  tail call void @BN_CTX_start(ptr noundef nonnull %32) #4
  %36 = tail call ptr @BN_CTX_get(ptr noundef nonnull %32) #4
  %37 = tail call ptr @BN_CTX_get(ptr noundef nonnull %32) #4
  %38 = tail call ptr @BN_CTX_get(ptr noundef nonnull %32) #4
  %39 = tail call ptr @BN_CTX_get(ptr noundef nonnull %32) #4
  %40 = tail call ptr @BN_CTX_get(ptr noundef nonnull %32) #4
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %43

42:                                               ; preds = %35
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 171, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524291, ptr noundef null) #4
  br label %162

43:                                               ; preds = %35
  %44 = shl i64 %22, 1
  %45 = tail call ptr @CRYPTO_zalloc(i64 noundef %44, ptr noundef nonnull @.str.1, i32 noundef 175) #4
  %46 = zext nneg i32 %13 to i64
  %47 = tail call ptr @CRYPTO_zalloc(i64 noundef %46, ptr noundef nonnull @.str.1, i32 noundef 176) #4
  %48 = icmp eq ptr %45, null
  %49 = icmp eq ptr %47, null
  %or.cond5 = select i1 %48, i1 true, i1 %49
  br i1 %or.cond5, label %162, label %50

50:                                               ; preds = %43
  %51 = load i64, ptr %5, align 8, !tbaa !9
  tail call void @llvm.memset.p0.i64(ptr align 1 %4, i8 0, i64 %51, i1 false)
  %52 = tail call ptr @CRYPTO_zalloc(i64 noundef %3, ptr noundef nonnull @.str.1, i32 noundef 183) #4
  %53 = icmp eq ptr %52, null
  br i1 %53, label %162, label %.preheader152

.preheader152:                                    ; preds = %50
  %54 = tail call i32 @BN_priv_rand_range_ex(ptr noundef %36, ptr noundef %11, i32 noundef 0, ptr noundef nonnull %32) #4
  %.not154 = icmp eq i32 %54, 0
  br i1 %.not154, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader152
  %55 = trunc i64 %22 to i32
  %56 = getelementptr inbounds i8, ptr %45, i64 %22
  br label %57

._crit_edge:                                      ; preds = %97, %.preheader152
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 189, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null) #4
  br label %162

57:                                               ; preds = %.lr.ph, %97
  %58 = tail call i32 @EC_POINT_mul(ptr noundef %10, ptr noundef %26, ptr noundef %36, ptr noundef null, ptr noundef null, ptr noundef %32) #4
  %.not143 = icmp eq i32 %58, 0
  br i1 %.not143, label %65, label %59

59:                                               ; preds = %57
  %60 = tail call i32 @EC_POINT_get_affine_coordinates(ptr noundef %10, ptr noundef %26, ptr noundef %37, ptr noundef %39, ptr noundef %32) #4
  %.not144 = icmp eq i32 %60, 0
  br i1 %.not144, label %65, label %61

61:                                               ; preds = %59
  %62 = tail call i32 @EC_POINT_mul(ptr noundef %10, ptr noundef %27, ptr noundef null, ptr noundef %12, ptr noundef %36, ptr noundef %32) #4
  %.not145 = icmp eq i32 %62, 0
  br i1 %.not145, label %65, label %63

63:                                               ; preds = %61
  %64 = tail call i32 @EC_POINT_get_affine_coordinates(ptr noundef %10, ptr noundef %27, ptr noundef %38, ptr noundef nonnull %40, ptr noundef %32) #4
  %.not146 = icmp eq i32 %64, 0
  br i1 %.not146, label %65, label %66

65:                                               ; preds = %63, %61, %59, %57
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 197, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524304, ptr noundef null) #4
  br label %162

66:                                               ; preds = %63
  %67 = tail call i32 @BN_bn2binpad(ptr noundef %38, ptr noundef %45, i32 noundef %55) #4
  %68 = icmp slt i32 %67, 0
  br i1 %68, label %72, label %69

69:                                               ; preds = %66
  %70 = tail call i32 @BN_bn2binpad(ptr noundef nonnull %40, ptr noundef nonnull %56, i32 noundef %55) #4
  %71 = icmp slt i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %69, %66
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 203, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null) #4
  br label %162

73:                                               ; preds = %69
  %74 = tail call i32 @ossl_ecdh_kdf_X9_63(ptr noundef nonnull %52, i64 noundef %3, ptr noundef %45, i64 noundef %44, ptr noundef null, i64 noundef 0, ptr noundef %1, ptr noundef %14, ptr noundef %15) #4
  %.not147 = icmp eq i32 %74, 0
  br i1 %.not147, label %75, label %76

75:                                               ; preds = %73
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 210, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524294, ptr noundef null) #4
  br label %162

76:                                               ; preds = %73
  %77 = tail call i32 @is_all_zeros(ptr noundef nonnull %52, i64 noundef %3)
  %.not148 = icmp eq i32 %77, 0
  br i1 %.not148, label %.preheader, label %97

.preheader:                                       ; preds = %76
  %.not149155 = icmp eq i64 %3, 0
  br i1 %.not149155, label %._crit_edge158, label %iter.check

iter.check:                                       ; preds = %.preheader
  %min.iters.check = icmp ult i64 %3, 8
  br i1 %min.iters.check, label %.lr.ph157.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %iter.check
  %scevgep = getelementptr i8, ptr %52, i64 %3
  %scevgep159 = getelementptr i8, ptr %2, i64 %3
  %bound0 = icmp ult ptr %52, %scevgep159
  %bound1 = icmp ugt ptr %scevgep, %2
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph157.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %vector.memcheck
  %min.iters.check160 = icmp ult i64 %3, 32
  br i1 %min.iters.check160, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %3, -32
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %78 = getelementptr inbounds i8, ptr %2, i64 %index
  %79 = getelementptr inbounds i8, ptr %78, i64 16
  %wide.load = load <16 x i8>, ptr %78, align 1, !tbaa !11, !alias.scope !12
  %wide.load161 = load <16 x i8>, ptr %79, align 1, !tbaa !11, !alias.scope !12
  %80 = getelementptr inbounds i8, ptr %52, i64 %index
  %81 = getelementptr inbounds i8, ptr %80, i64 16
  %wide.load162 = load <16 x i8>, ptr %80, align 1, !tbaa !11, !alias.scope !15, !noalias !12
  %wide.load163 = load <16 x i8>, ptr %81, align 1, !tbaa !11, !alias.scope !15, !noalias !12
  %82 = xor <16 x i8> %wide.load162, %wide.load
  %83 = xor <16 x i8> %wide.load163, %wide.load161
  store <16 x i8> %82, ptr %80, align 1, !tbaa !11, !alias.scope !15, !noalias !12
  store <16 x i8> %83, ptr %81, align 1, !tbaa !11, !alias.scope !15, !noalias !12
  %index.next = add nuw i64 %index, 32
  %84 = icmp eq i64 %index.next, %n.vec
  br i1 %84, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %3
  br i1 %cmp.n, label %._crit_edge158, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %n.vec.remaining = and i64 %3, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check, label %.lr.ph157.preheader, label %vec.epilog.ph

.lr.ph157.preheader:                              ; preds = %vec.epilog.middle.block, %vector.memcheck, %iter.check, %vec.epilog.iter.check
  %.0120156.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec165, %vec.epilog.middle.block ]
  %xtraiter = and i64 %3, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph157.prol.loopexit, label %.lr.ph157.prol

.lr.ph157.prol:                                   ; preds = %.lr.ph157.preheader, %.lr.ph157.prol
  %.0120156.prol = phi i64 [ %90, %.lr.ph157.prol ], [ %.0120156.ph, %.lr.ph157.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph157.prol ], [ 0, %.lr.ph157.preheader ]
  %85 = getelementptr inbounds i8, ptr %2, i64 %.0120156.prol
  %86 = load i8, ptr %85, align 1, !tbaa !11
  %87 = getelementptr inbounds i8, ptr %52, i64 %.0120156.prol
  %88 = load i8, ptr %87, align 1, !tbaa !11
  %89 = xor i8 %88, %86
  store i8 %89, ptr %87, align 1, !tbaa !11
  %90 = add nuw i64 %.0120156.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph157.prol.loopexit, label %.lr.ph157.prol, !llvm.loop !21

.lr.ph157.prol.loopexit:                          ; preds = %.lr.ph157.prol, %.lr.ph157.preheader
  %.0120156.unr = phi i64 [ %.0120156.ph, %.lr.ph157.preheader ], [ %90, %.lr.ph157.prol ]
  %91 = sub i64 %.0120156.ph, %3
  %92 = icmp ugt i64 %91, -4
  br i1 %92, label %._crit_edge158, label %.lr.ph157

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec165 = and i64 %3, -8
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index166 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next169, %vec.epilog.vector.body ]
  %93 = getelementptr inbounds i8, ptr %2, i64 %index166
  %wide.load167 = load <8 x i8>, ptr %93, align 1, !tbaa !11, !alias.scope !23
  %94 = getelementptr inbounds i8, ptr %52, i64 %index166
  %wide.load168 = load <8 x i8>, ptr %94, align 1, !tbaa !11, !alias.scope !26, !noalias !23
  %95 = xor <8 x i8> %wide.load168, %wide.load167
  store <8 x i8> %95, ptr %94, align 1, !tbaa !11, !alias.scope !26, !noalias !23
  %index.next169 = add nuw i64 %index166, 8
  %96 = icmp eq i64 %index.next169, %n.vec165
  br i1 %96, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !28

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n170 = icmp eq i64 %n.vec165, %3
  br i1 %cmp.n170, label %._crit_edge158, label %.lr.ph157.preheader

97:                                               ; preds = %76
  tail call void @llvm.memset.p0.i64(ptr align 1 %45, i8 0, i64 %44, i1 false)
  %98 = tail call i32 @BN_priv_rand_range_ex(ptr noundef %36, ptr noundef %11, i32 noundef 0, ptr noundef %32) #4
  %.not = icmp eq i32 %98, 0
  br i1 %.not, label %._crit_edge, label %57

.lr.ph157:                                        ; preds = %.lr.ph157.prol.loopexit, %.lr.ph157
  %.0120156 = phi i64 [ %122, %.lr.ph157 ], [ %.0120156.unr, %.lr.ph157.prol.loopexit ]
  %99 = getelementptr inbounds i8, ptr %2, i64 %.0120156
  %100 = load i8, ptr %99, align 1, !tbaa !11
  %101 = getelementptr inbounds i8, ptr %52, i64 %.0120156
  %102 = load i8, ptr %101, align 1, !tbaa !11
  %103 = xor i8 %102, %100
  store i8 %103, ptr %101, align 1, !tbaa !11
  %104 = add nuw i64 %.0120156, 1
  %105 = getelementptr inbounds i8, ptr %2, i64 %104
  %106 = load i8, ptr %105, align 1, !tbaa !11
  %107 = getelementptr inbounds i8, ptr %52, i64 %104
  %108 = load i8, ptr %107, align 1, !tbaa !11
  %109 = xor i8 %108, %106
  store i8 %109, ptr %107, align 1, !tbaa !11
  %110 = add nuw i64 %.0120156, 2
  %111 = getelementptr inbounds i8, ptr %2, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !11
  %113 = getelementptr inbounds i8, ptr %52, i64 %110
  %114 = load i8, ptr %113, align 1, !tbaa !11
  %115 = xor i8 %114, %112
  store i8 %115, ptr %113, align 1, !tbaa !11
  %116 = add nuw i64 %.0120156, 3
  %117 = getelementptr inbounds i8, ptr %2, i64 %116
  %118 = load i8, ptr %117, align 1, !tbaa !11
  %119 = getelementptr inbounds i8, ptr %52, i64 %116
  %120 = load i8, ptr %119, align 1, !tbaa !11
  %121 = xor i8 %120, %118
  store i8 %121, ptr %119, align 1, !tbaa !11
  %122 = add nuw i64 %.0120156, 4
  %.not149.3 = icmp eq i64 %122, %3
  br i1 %.not149.3, label %._crit_edge158, label %.lr.ph157, !llvm.loop !29

._crit_edge158:                                   ; preds = %.lr.ph157.prol.loopexit, %.lr.ph157, %middle.block, %vec.epilog.middle.block, %.preheader
  %123 = tail call ptr @EVP_MD_get0_name(ptr noundef %1) #4
  %124 = tail call ptr @EVP_MD_fetch(ptr noundef %14, ptr noundef %123, ptr noundef %15) #4
  %125 = icmp eq ptr %124, null
  br i1 %125, label %126, label %127

126:                                              ; preds = %._crit_edge158
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 224, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null) #4
  br label %162

127:                                              ; preds = %._crit_edge158
  %128 = tail call i32 @EVP_DigestInit(ptr noundef %9, ptr noundef nonnull %124) #4
  %129 = icmp eq i32 %128, 0
  br i1 %129, label %142, label %130

130:                                              ; preds = %127
  %131 = tail call i32 @EVP_DigestUpdate(ptr noundef %9, ptr noundef %45, i64 noundef %22) #4
  %132 = icmp eq i32 %131, 0
  br i1 %132, label %142, label %133

133:                                              ; preds = %130
  %134 = tail call i32 @EVP_DigestUpdate(ptr noundef %9, ptr noundef %2, i64 noundef %3) #4
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %142, label %136

136:                                              ; preds = %133
  %137 = tail call i32 @EVP_DigestUpdate(ptr noundef %9, ptr noundef nonnull %56, i64 noundef %22) #4
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %142, label %139

139:                                              ; preds = %136
  %140 = tail call i32 @EVP_DigestFinal(ptr noundef %9, ptr noundef %47, ptr noundef null) #4
  %141 = icmp eq i32 %140, 0
  br i1 %141, label %142, label %143

142:                                              ; preds = %139, %136, %133, %130, %127
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 232, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524294, ptr noundef null) #4
  br label %162

143:                                              ; preds = %139
  store ptr %37, ptr %8, align 8, !tbaa !30
  %144 = getelementptr inbounds i8, ptr %8, i64 8
  store ptr %39, ptr %144, align 8, !tbaa !32
  %145 = tail call ptr @ASN1_OCTET_STRING_new() #4
  store ptr %145, ptr %17, align 8, !tbaa !33
  %146 = tail call ptr @ASN1_OCTET_STRING_new() #4
  store ptr %146, ptr %16, align 8, !tbaa !34
  %147 = icmp eq ptr %145, null
  %148 = icmp eq ptr %146, null
  %or.cond8 = select i1 %147, i1 true, i1 %148
  br i1 %or.cond8, label %149, label %150

149:                                              ; preds = %143
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 242, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 524301, ptr noundef null) #4
  br label %162

150:                                              ; preds = %143
  %151 = tail call i32 @ASN1_OCTET_STRING_set(ptr noundef nonnull %145, ptr noundef %47, i32 noundef %13) #4
  %.not150 = icmp eq i32 %151, 0
  br i1 %.not150, label %155, label %152

152:                                              ; preds = %150
  %153 = trunc i64 %3 to i32
  %154 = tail call i32 @ASN1_OCTET_STRING_set(ptr noundef nonnull %146, ptr noundef nonnull %52, i32 noundef %153) #4
  %.not151 = icmp eq i32 %154, 0
  br i1 %.not151, label %155, label %156

155:                                              ; preds = %152, %150
  tail call void @ERR_new() #4
  tail call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 247, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null) #4
  br label %162

156:                                              ; preds = %152
  %157 = call i32 @i2d_SM2_Ciphertext(ptr noundef nonnull %8, ptr noundef nonnull %7)
  %158 = icmp slt i32 %157, 0
  br i1 %158, label %159, label %160

159:                                              ; preds = %156
  call void @ERR_new() #4
  call void @ERR_set_debug(ptr noundef nonnull @.str.1, i32 noundef 254, ptr noundef nonnull @__func__.ossl_sm2_encrypt) #4
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 53, i32 noundef 786691, ptr noundef null) #4
  br label %162

160:                                              ; preds = %156
  %161 = zext nneg i32 %157 to i64
  store i64 %161, ptr %5, align 8, !tbaa !9
  br label %162

162:                                              ; preds = %50, %43, %160, %159, %155, %149, %142, %126, %75, %72, %65, %._crit_edge, %42, %34, %30, %24, %20
  %.0127 = phi ptr [ null, %20 ], [ null, %24 ], [ %26, %30 ], [ %26, %34 ], [ %26, %42 ], [ %26, %43 ], [ %26, %50 ], [ %26, %72 ], [ %26, %126 ], [ %26, %142 ], [ %26, %149 ], [ %26, %159 ], [ %26, %160 ], [ %26, %155 ], [ %26, %75 ], [ %26, %65 ], [ %26, %._crit_edge ]
  %.0126 = phi ptr [ null, %20 ], [ null, %24 ], [ %27, %30 ], [ %27, %34 ], [ %27, %42 ], [ %27, %43 ], [ %27, %50 ], [ %27, %72 ], [ %27, %126 ], [ %27, %142 ], [ %27, %149 ], [ %27, %159 ], [ %27, %160 ], [ %27, %155 ], [ %27, %75 ], [ %27, %65 ], [ %27, %._crit_edge ]
  %.0125 = phi ptr [ null, %20 ], [ null, %24 ], [ null, %30 ], [ null, %34 ], [ null, %42 ], [ null, %43 ], [ null, %50 ], [ %52, %72 ], [ %52, %126 ], [ %52, %142 ], [ %52, %149 ], [ %52, %159 ], [ %52, %160 ], [ %52, %155 ], [ %52, %75 ], [ %52, %65 ], [ %52, %._crit_edge ]
  %.0124 = phi ptr [ null, %20 ], [ null, %24 ], [ null, %30 ], [ null, %34 ], [ null, %42 ], [ %45, %43 ], [ %45, %50 ], [ %45, %72 ], [ %45, %126 ], [ %45, %142 ], [ %45, %149 ], [ %45, %159 ], [ %45, %160 ], [ %45, %155 ], [ %45, %75 ], [ %45, %65 ], [ %45, %._crit_edge ]
  %.0123 = phi ptr [ null, %20 ], [ null, %24 ], [ null, %30 ], [ null, %34 ], [ null, %42 ], [ %47, %43 ], [ %47, %50 ], [ %47, %72 ], [ %47, %126 ], [ %47, %142 ], [ %47, %149 ], [ %47, %159 ], [ %47, %160 ], [ %47, %155 ], [ %47, %75 ], [ %47, %65 ], [ %47, %._crit_edge ]
  %.0122 = phi ptr [ null, %20 ], [ null, %24 ], [ null, %30 ], [ null, %34 ], [ %32, %42 ], [ %32, %43 ], [ %32, %50 ], [ %32, %72 ], [ %32, %126 ], [ %32, %142 ], [ %32, %149 ], [ %32, %159 ], [ %32, %160 ], [ %32, %155 ], [ %32, %75 ], [ %32, %65 ], [ %32, %._crit_edge ]
  %.0121 = phi ptr [ null, %20 ], [ null, %24 ], [ null, %30 ], [ null, %34 ], [ null, %42 ], [ null, %43 ], [ null, %50 ], [ null, %72 ], [ null, %126 ], [ %124, %142 ], [ %124, %149 ], [ %124, %159 ], [ %124, %160 ], [ %124, %155 ], [ null, %75 ], [ null, %65 ], [ null, %._crit_edge ]
  %.0 = phi i32 [ 0, %20 ], [ 0, %24 ], [ 0, %30 ], [ 0, %34 ], [ 0, %42 ], [ 0, %43 ], [ 0, %50 ], [ 0, %72 ], [ 0, %126 ], [ 0, %142 ], [ 0, %149 ], [ 0, %159 ], [ 1, %160 ], [ 0, %155 ], [ 0, %75 ], [ 0, %65 ], [ 0, %._crit_edge ]
  call void @EVP_MD_free(ptr noundef %.0121) #4
  %163 = load ptr, ptr %16, align 8, !tbaa !34
  call void @ASN1_OCTET_STRING_free(ptr noundef %163) #4
  %164 = load ptr, ptr %17, align 8, !tbaa !33
  call void @ASN1_OCTET_STRING_free(ptr noundef %164) #4
  call void @CRYPTO_free(ptr noundef %.0125, ptr noundef nonnull @.str.1, i32 noundef 265) #4
  call void @CRYPTO_free(ptr noundef %.0124, ptr noundef nonnull @.str.1, i32 noundef 266) #4
  call void @CRYPTO_free(ptr noundef %.0123, ptr noundef nonnull @.str.1, i32 noundef 267) #4
  call void @EVP_MD_CTX_free(ptr noundef %9) #4
  call void @BN_CTX_free(ptr noundef %.0122) #4
  call void @EC_POINT_free(ptr noundef %.0127) #4
  call void @EC_POINT_free(ptr noundef %.0126) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  ret i32 %.0
}

declare ptr @EVP_MD_CTX_new() local_unnamed_addr #2

declare ptr @EC_GROUP_get0_order(ptr noundef) local_unnamed_addr #2

declare ptr @EC_KEY_get0_public_key(ptr noundef) local_unnamed_addr #2

declare ptr @ossl_ec_key_get_libctx(ptr noundef) local_unnamed_addr #2

declare ptr @ossl_ec_key_get0_propq(ptr noundef) local_unnamed_addr #2

declare ptr @EC_POINT_new(ptr noundef) local_unnamed_addr #2

declare ptr @BN_CTX_new_ex(ptr noundef) local_unnamed_addr #2

declare void @BN_CTX_start(ptr noundef) local_unnamed_addr #2

declare ptr @BN_CTX_get(ptr noundef) local_unnamed_addr #2

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

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

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

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

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

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

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

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

declare ptr @EVP_MD_fetch(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @EVP_MD_get0_name(ptr noundef) local_unnamed_addr #2

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

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

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

declare ptr @ASN1_OCTET_STRING_new() local_unnamed_addr #2

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

declare void @EVP_MD_free(ptr noundef) local_unnamed_addr #2

declare void @ASN1_OCTET_STRING_free(ptr noundef) local_unnamed_addr #2

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

declare void @EVP_MD_CTX_free(ptr noundef) local_unnamed_addr #2

declare void @BN_CTX_free(ptr noundef) local_unnamed_addr #2

declare void @EC_POINT_free(ptr noundef) 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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 = !{!7, !7, i64 0}
!12 = !{!13}
!13 = distinct !{!13, !14}
!14 = distinct !{!14, !"LVerDomain"}
!15 = !{!16}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !18, !19, !20}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
!23 = !{!24}
!24 = distinct !{!24, !25}
!25 = distinct !{!25, !"LVerDomain"}
!26 = !{!27}
!27 = distinct !{!27, !25}
!28 = distinct !{!28, !18, !19, !20}
!29 = distinct !{!29, !18, !19}
!30 = !{!31, !6, i64 0}
!31 = !{!"SM2_Ciphertext_st", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!32 = !{!31, !6, i64 8}
!33 = !{!31, !6, i64 16}
!34 = !{!31, !6, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass