; LLVM IR from guanzhi/GmSSL :: src (cms)

; 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.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }
%struct.SM2_KEY = type { %struct.SM2_Z256_POINT, [4 x i64] }
%struct.SM2_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.CMS_CERTS_AND_KEY = type { ptr, i64, ptr }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@__const.cms_signed_and_enveloped_data_encipher_to_der.digest_algors = external hidden unnamed_addr constant [1 x i32], align 4
@__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der = external hidden unnamed_addr constant [46 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_content_info_header_to_der(i32 noundef, i64 noundef, ptr noundef, ptr noundef) #2

declare i32 @asn1_header_to_der(i32 noundef, i64 noundef, ptr noundef, ptr noundef) #3

declare i32 @asn1_nonempty_type_to_der(i32 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

declare i32 @asn1_type_to_der(i32 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_enced_content_info_encrypt_to_der(i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

declare i32 @asn1_int_to_der_ex(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @sm3_update(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @x509_cert_get_subject_public_key(ptr noundef, i64 noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_signer_infos_add_signer_info(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #2

declare i32 @asn1_length_le(i64 noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_digest_algors_to_der(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

declare void @sm3_init(ptr noundef) #3

declare i32 @x509_cert_get_issuer_and_serial_number(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_recipient_info_encrypt_to_der(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

declare i32 @asn1_any_from_der(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @cms_signed_and_enveloped_data_encipher_to_der(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, i32 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, i64 noundef %8, i32 noundef %9, ptr noundef %10, i64 noundef %11, ptr noundef %12, i64 noundef %13, ptr noundef %14, i64 noundef %15, ptr noundef %16, i64 noundef %17, ptr noundef %18, ptr noundef %19) #2 {
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca i64, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i64, align 8
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca i64, align 8
  %29 = alloca ptr, align 8
  %30 = alloca i64, align 8
  %31 = alloca i32, align 4
  %32 = alloca ptr, align 8
  %33 = alloca i64, align 8
  %34 = alloca ptr, align 8
  %35 = alloca i64, align 8
  %36 = alloca ptr, align 8
  %37 = alloca i64, align 8
  %38 = alloca ptr, align 8
  %39 = alloca i64, align 8
  %40 = alloca ptr, align 8
  %41 = alloca ptr, align 8
  %42 = alloca [512 x i8], align 16
  %43 = alloca i64, align 8
  %44 = alloca [1 x i32], align 4
  %45 = alloca i64, align 8
  %46 = alloca [256 x i8], align 16
  %47 = alloca i64, align 8
  %48 = alloca [512 x i8], align 16
  %49 = alloca i64, align 8
  %50 = alloca %struct.SM3_CTX, align 8
  %51 = alloca ptr, align 8
  %52 = alloca ptr, align 8
  %53 = alloca i64, align 8
  %54 = alloca i64, align 8
  %55 = alloca ptr, align 8
  %56 = alloca i64, align 8
  %57 = alloca i64, align 8
  %58 = alloca ptr, align 8
  %59 = alloca i64, align 8
  %60 = alloca %struct.SM2_KEY, align 8
  %61 = alloca i32, align 4
  store ptr %0, ptr %22, align 8, !tbaa !5
  store i64 %1, ptr %23, align 8, !tbaa !9
  store ptr %2, ptr %24, align 8, !tbaa !5
  store i64 %3, ptr %25, align 8, !tbaa !9
  store i32 %4, ptr %26, align 4, !tbaa !11
  store ptr %5, ptr %27, align 8, !tbaa !5
  store i64 %6, ptr %28, align 8, !tbaa !9
  store ptr %7, ptr %29, align 8, !tbaa !5
  store i64 %8, ptr %30, align 8, !tbaa !9
  store i32 %9, ptr %31, align 4, !tbaa !11
  store ptr %10, ptr %32, align 8, !tbaa !5
  store i64 %11, ptr %33, align 8, !tbaa !9
  store ptr %12, ptr %34, align 8, !tbaa !5
  store i64 %13, ptr %35, align 8, !tbaa !9
  store ptr %14, ptr %36, align 8, !tbaa !5
  store i64 %15, ptr %37, align 8, !tbaa !9
  store ptr %16, ptr %38, align 8, !tbaa !5
  store i64 %17, ptr %39, align 8, !tbaa !9
  store ptr %18, ptr %40, align 8, !tbaa !5
  store ptr %19, ptr %41, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 512, ptr %42) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %43) #5
  store i64 0, ptr %43, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %44) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %44, ptr align 4 @__const.cms_signed_and_enveloped_data_encipher_to_der.digest_algors, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %45) #5
  store i64 1, ptr %45, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 256, ptr %46) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %47) #5
  store i64 0, ptr %47, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 512, ptr %48) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %49) #5
  store i64 0, ptr %49, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 112, ptr %50) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %51) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %52) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %53) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %54) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %55) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %56) #5
  store i64 0, ptr %56, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %57) #5
  %62 = getelementptr inbounds [512 x i8], ptr %42, i64 0, i64 0
  store ptr %62, ptr %55, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %110, %20
  %64 = load i64, ptr %25, align 8, !tbaa !9
  %65 = icmp ne i64 %64, 0
  br i1 %65, label %66, label %111

66:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %58) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %59) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %60) #5
  %67 = call i32 @asn1_any_from_der(ptr noundef %58, ptr noundef %59, ptr noundef %24, ptr noundef %25)
  %68 = icmp ne i32 %67, 1
  br i1 %68, label %101, label %69

69:                                               ; preds = %66
  %70 = load ptr, ptr %58, align 8, !tbaa !5
  %71 = load i64, ptr %59, align 8, !tbaa !9
  %72 = call i32 @x509_cert_get_issuer_and_serial_number(ptr noundef %70, i64 noundef %71, ptr noundef %51, ptr noundef %53, ptr noundef %52, ptr noundef %54)
  %73 = icmp ne i32 %72, 1
  br i1 %73, label %101, label %74

74:                                               ; preds = %69
  %75 = load ptr, ptr %58, align 8, !tbaa !5
  %76 = load i64, ptr %59, align 8, !tbaa !9
  %77 = call i32 @x509_cert_get_subject_public_key(ptr noundef %75, i64 noundef %76, ptr noundef %60)
  %78 = icmp ne i32 %77, 1
  br i1 %78, label %101, label %79

79:                                               ; preds = %74
  %80 = load ptr, ptr %51, align 8, !tbaa !5
  %81 = load i64, ptr %53, align 8, !tbaa !9
  %82 = load ptr, ptr %52, align 8, !tbaa !5
  %83 = load i64, ptr %54, align 8, !tbaa !9
  %84 = load ptr, ptr %27, align 8, !tbaa !5
  %85 = load i64, ptr %28, align 8, !tbaa !9
  %86 = call i32 @cms_recipient_info_encrypt_to_der(ptr noundef %60, ptr noundef %80, i64 noundef %81, ptr noundef %82, i64 noundef %83, ptr noundef %84, i64 noundef %85, ptr noundef null, ptr noundef %56)
  %87 = icmp ne i32 %86, 1
  br i1 %87, label %101, label %88

88:                                               ; preds = %79
  %89 = load i64, ptr %56, align 8, !tbaa !9
  %90 = call i32 @asn1_length_le(i64 noundef %89, i64 noundef 512)
  %91 = icmp ne i32 %90, 1
  br i1 %91, label %101, label %92

92:                                               ; preds = %88
  %93 = load ptr, ptr %51, align 8, !tbaa !5
  %94 = load i64, ptr %53, align 8, !tbaa !9
  %95 = load ptr, ptr %52, align 8, !tbaa !5
  %96 = load i64, ptr %54, align 8, !tbaa !9
  %97 = load ptr, ptr %27, align 8, !tbaa !5
  %98 = load i64, ptr %28, align 8, !tbaa !9
  %99 = call i32 @cms_recipient_info_encrypt_to_der(ptr noundef %60, ptr noundef %93, i64 noundef %94, ptr noundef %95, i64 noundef %96, ptr noundef %97, i64 noundef %98, ptr noundef %55, ptr noundef %43)
  %100 = icmp ne i32 %99, 1
  br i1 %100, label %101, label %107

101:                                              ; preds = %92, %88, %79, %74, %69, %66
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr @stderr, align 8, !tbaa !5
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1784, ptr noundef @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  br label %105

105:                                              ; preds = %102
  br label %106

106:                                              ; preds = %105
  store i32 -1, ptr %21, align 4
  store i32 1, ptr %61, align 4
  br label %108

107:                                              ; preds = %92
  store i32 0, ptr %61, align 4
  br label %108

108:                                              ; preds = %107, %106
  call void @llvm.lifetime.end.p0(i64 128, ptr %60) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %59) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %58) #5
  %109 = load i32, ptr %61, align 4
  switch i32 %109, label %279 [
    i32 0, label %110
  ]

110:                                              ; preds = %108
  br label %63, !llvm.loop !13

111:                                              ; preds = %63
  %112 = getelementptr inbounds [256 x i8], ptr %46, i64 0, i64 0
  store ptr %112, ptr %55, align 8, !tbaa !5
  %113 = load i32, ptr %31, align 4, !tbaa !11
  %114 = load i64, ptr %33, align 8, !tbaa !9
  %115 = call i32 @cms_content_info_header_to_der(i32 noundef %113, i64 noundef %114, ptr noundef %55, ptr noundef %47)
  %116 = icmp ne i32 %115, 1
  br i1 %116, label %117, label %123

117:                                              ; preds = %111
  br label %118

118:                                              ; preds = %117
  %119 = load ptr, ptr @stderr, align 8, !tbaa !5
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %119, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1792, ptr noundef @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  br label %121

121:                                              ; preds = %118
  br label %122

122:                                              ; preds = %121
  store i32 -1, ptr %21, align 4
  store i32 1, ptr %61, align 4
  br label %279

123:                                              ; preds = %111
  call void @sm3_init(ptr noundef %50)
  %124 = getelementptr inbounds [256 x i8], ptr %46, i64 0, i64 0
  %125 = load i64, ptr %47, align 8, !tbaa !9
  call void @sm3_update(ptr noundef %50, ptr noundef %124, i64 noundef %125)
  %126 = load ptr, ptr %32, align 8, !tbaa !5
  %127 = load i64, ptr %33, align 8, !tbaa !9
  call void @sm3_update(ptr noundef %50, ptr noundef %126, i64 noundef %127)
  store i64 0, ptr %57, align 8, !tbaa !9
  br label %128

128:                                              ; preds = %163, %123
  %129 = load i64, ptr %57, align 8, !tbaa !9
  %130 = load i64, ptr %23, align 8, !tbaa !9
  %131 = icmp ult i64 %129, %130
  br i1 %131, label %132, label %166

132:                                              ; preds = %128
  %133 = load ptr, ptr %22, align 8, !tbaa !5
  %134 = load i64, ptr %57, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct.CMS_CERTS_AND_KEY, ptr %133, i64 %134
  %136 = getelementptr inbounds %struct.CMS_CERTS_AND_KEY, ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !15
  %138 = load ptr, ptr %22, align 8, !tbaa !5
  %139 = load i64, ptr %57, align 8, !tbaa !9
  %140 = getelementptr inbounds %struct.CMS_CERTS_AND_KEY, ptr %138, i64 %139
  %141 = getelementptr inbounds %struct.CMS_CERTS_AND_KEY, ptr %140, i32 0, i32 1
  %142 = load i64, ptr %141, align 8, !tbaa !17
  %143 = call i32 @x509_cert_get_issuer_and_serial_number(ptr noundef %137, i64 noundef %142, ptr noundef %51, ptr noundef %53, ptr noundef %52, ptr noundef %54)
  %144 = icmp ne i32 %143, 1
  br i1 %144, label %156, label %145

145:                                              ; preds = %132
  %146 = getelementptr inbounds [512 x i8], ptr %48, i64 0, i64 0
  %147 = load ptr, ptr %22, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.CMS_CERTS_AND_KEY, ptr %147, i32 0, i32 2
  %149 = load ptr, ptr %148, align 8, !tbaa !18
  %150 = load ptr, ptr %51, align 8, !tbaa !5
  %151 = load i64, ptr %53, align 8, !tbaa !9
  %152 = load ptr, ptr %52, align 8, !tbaa !5
  %153 = load i64, ptr %54, align 8, !tbaa !9
  %154 = call i32 @cms_signer_infos_add_signer_info(ptr noundef %146, ptr noundef %49, i64 noundef 512, ptr noundef %50, ptr noundef %149, ptr noundef %150, i64 noundef %151, ptr noundef %152, i64 noundef %153, ptr noundef null, i64 noundef 0, ptr noundef null, i64 noundef 0)
  %155 = icmp ne i32 %154, 1
  br i1 %155, label %156, label %162

156:                                              ; preds = %145, %132
  br label %157

157:                                              ; preds = %156
  %158 = load ptr, ptr @stderr, align 8, !tbaa !5
  %159 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %158, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1808, ptr noundef @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  br label %160

160:                                              ; preds = %157
  br label %161

161:                                              ; preds = %160
  store i32 -1, ptr %21, align 4
  store i32 1, ptr %61, align 4
  br label %279

162:                                              ; preds = %145
  br label %163

163:                                              ; preds = %162
  %164 = load i64, ptr %57, align 8, !tbaa !9
  %165 = add i64 %164, 1
  store i64 %165, ptr %57, align 8, !tbaa !9
  br label %128, !llvm.loop !19

166:                                              ; preds = %128
  store i64 0, ptr %56, align 8, !tbaa !9
  %167 = call i32 @asn1_int_to_der_ex(i32 noundef 2, i32 noundef 1, ptr noundef null, ptr noundef %56)
  %168 = icmp ne i32 %167, 1
  br i1 %168, label %272, label %169

169:                                              ; preds = %166
  %170 = getelementptr inbounds [512 x i8], ptr %42, i64 0, i64 0
  %171 = load i64, ptr %43, align 8, !tbaa !9
  %172 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef %170, i64 noundef %171, ptr noundef null, ptr noundef %56)
  %173 = icmp ne i32 %172, 1
  br i1 %173, label %272, label %174

174:                                              ; preds = %169
  %175 = getelementptr inbounds [1 x i32], ptr %44, i64 0, i64 0
  %176 = load i64, ptr %45, align 8, !tbaa !9
  %177 = call i32 @cms_digest_algors_to_der(ptr noundef %175, i64 noundef %176, ptr noundef null, ptr noundef %56)
  %178 = icmp ne i32 %177, 1
  br i1 %178, label %272, label %179

179:                                              ; preds = %174
  %180 = load i32, ptr %26, align 4, !tbaa !11
  %181 = load ptr, ptr %27, align 8, !tbaa !5
  %182 = load i64, ptr %28, align 8, !tbaa !9
  %183 = load ptr, ptr %29, align 8, !tbaa !5
  %184 = load i64, ptr %30, align 8, !tbaa !9
  %185 = load i32, ptr %31, align 4, !tbaa !11
  %186 = load ptr, ptr %32, align 8, !tbaa !5
  %187 = load i64, ptr %33, align 8, !tbaa !9
  %188 = load ptr, ptr %36, align 8, !tbaa !5
  %189 = load i64, ptr %37, align 8, !tbaa !9
  %190 = load ptr, ptr %38, align 8, !tbaa !5
  %191 = load i64, ptr %39, align 8, !tbaa !9
  %192 = call i32 @cms_enced_content_info_encrypt_to_der(i32 noundef %180, ptr noundef %181, i64 noundef %182, ptr noundef %183, i64 noundef %184, i32 noundef %185, ptr noundef %186, i64 noundef %187, ptr noundef %188, i64 noundef %189, ptr noundef %190, i64 noundef %191, ptr noundef null, ptr noundef %56)
  %193 = icmp ne i32 %192, 1
  br i1 %193, label %272, label %194

194:                                              ; preds = %179
  %195 = load ptr, ptr %22, align 8, !tbaa !5
  %196 = load i64, ptr %23, align 8, !tbaa !9
  %197 = call i32 @cms_implicit_signers_certs_to_der(i32 noundef 0, ptr noundef %195, i64 noundef %196, ptr noundef null, ptr noundef %56)
  %198 = icmp ne i32 %197, 1
  br i1 %198, label %272, label %199

199:                                              ; preds = %194
  %200 = load ptr, ptr %34, align 8, !tbaa !5
  %201 = load i64, ptr %35, align 8, !tbaa !9
  %202 = call i32 @asn1_type_to_der(i32 noundef 161, ptr noundef %200, i64 noundef %201, ptr noundef null, ptr noundef %56)
  %203 = icmp slt i32 %202, 0
  br i1 %203, label %272, label %204

204:                                              ; preds = %199
  %205 = getelementptr inbounds [512 x i8], ptr %48, i64 0, i64 0
  %206 = load i64, ptr %49, align 8, !tbaa !9
  %207 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef %205, i64 noundef %206, ptr noundef null, ptr noundef %56)
  %208 = icmp ne i32 %207, 1
  br i1 %208, label %272, label %209

209:                                              ; preds = %204
  %210 = load i64, ptr %56, align 8, !tbaa !9
  %211 = load ptr, ptr %40, align 8, !tbaa !5
  %212 = load ptr, ptr %41, align 8, !tbaa !5
  %213 = call i32 @asn1_header_to_der(i32 noundef 48, i64 noundef %210, ptr noundef %211, ptr noundef %212)
  %214 = icmp ne i32 %213, 1
  br i1 %214, label %272, label %215

215:                                              ; preds = %209
  %216 = load ptr, ptr %40, align 8, !tbaa !5
  %217 = load ptr, ptr %41, align 8, !tbaa !5
  %218 = call i32 @asn1_int_to_der_ex(i32 noundef 2, i32 noundef 1, ptr noundef %216, ptr noundef %217)
  %219 = icmp ne i32 %218, 1
  br i1 %219, label %272, label %220

220:                                              ; preds = %215
  %221 = getelementptr inbounds [512 x i8], ptr %42, i64 0, i64 0
  %222 = load i64, ptr %43, align 8, !tbaa !9
  %223 = load ptr, ptr %40, align 8, !tbaa !5
  %224 = load ptr, ptr %41, align 8, !tbaa !5
  %225 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef %221, i64 noundef %222, ptr noundef %223, ptr noundef %224)
  %226 = icmp ne i32 %225, 1
  br i1 %226, label %272, label %227

227:                                              ; preds = %220
  %228 = getelementptr inbounds [1 x i32], ptr %44, i64 0, i64 0
  %229 = load i64, ptr %45, align 8, !tbaa !9
  %230 = load ptr, ptr %40, align 8, !tbaa !5
  %231 = load ptr, ptr %41, align 8, !tbaa !5
  %232 = call i32 @cms_digest_algors_to_der(ptr noundef %228, i64 noundef %229, ptr noundef %230, ptr noundef %231)
  %233 = icmp ne i32 %232, 1
  br i1 %233, label %272, label %234

234:                                              ; preds = %227
  %235 = load i32, ptr %26, align 4, !tbaa !11
  %236 = load ptr, ptr %27, align 8, !tbaa !5
  %237 = load i64, ptr %28, align 8, !tbaa !9
  %238 = load ptr, ptr %29, align 8, !tbaa !5
  %239 = load i64, ptr %30, align 8, !tbaa !9
  %240 = load i32, ptr %31, align 4, !tbaa !11
  %241 = load ptr, ptr %32, align 8, !tbaa !5
  %242 = load i64, ptr %33, align 8, !tbaa !9
  %243 = load ptr, ptr %36, align 8, !tbaa !5
  %244 = load i64, ptr %37, align 8, !tbaa !9
  %245 = load ptr, ptr %38, align 8, !tbaa !5
  %246 = load i64, ptr %39, align 8, !tbaa !9
  %247 = load ptr, ptr %40, align 8, !tbaa !5
  %248 = load ptr, ptr %41, align 8, !tbaa !5
  %249 = call i32 @cms_enced_content_info_encrypt_to_der(i32 noundef %235, ptr noundef %236, i64 noundef %237, ptr noundef %238, i64 noundef %239, i32 noundef %240, ptr noundef %241, i64 noundef %242, ptr noundef %243, i64 noundef %244, ptr noundef %245, i64 noundef %246, ptr noundef %247, ptr noundef %248)
  %250 = icmp ne i32 %249, 1
  br i1 %250, label %272, label %251

251:                                              ; preds = %234
  %252 = load ptr, ptr %22, align 8, !tbaa !5
  %253 = load i64, ptr %23, align 8, !tbaa !9
  %254 = load ptr, ptr %40, align 8, !tbaa !5
  %255 = load ptr, ptr %41, align 8, !tbaa !5
  %256 = call i32 @cms_implicit_signers_certs_to_der(i32 noundef 0, ptr noundef %252, i64 noundef %253, ptr noundef %254, ptr noundef %255)
  %257 = icmp ne i32 %256, 1
  br i1 %257, label %272, label %258

258:                                              ; preds = %251
  %259 = load ptr, ptr %34, align 8, !tbaa !5
  %260 = load i64, ptr %35, align 8, !tbaa !9
  %261 = load ptr, ptr %40, align 8, !tbaa !5
  %262 = load ptr, ptr %41, align 8, !tbaa !5
  %263 = call i32 @asn1_type_to_der(i32 noundef 161, ptr noundef %259, i64 noundef %260, ptr noundef %261, ptr noundef %262)
  %264 = icmp ne i32 %263, 1
  br i1 %264, label %272, label %265

265:                                              ; preds = %258
  %266 = getelementptr inbounds [512 x i8], ptr %48, i64 0, i64 0
  %267 = load i64, ptr %49, align 8, !tbaa !9
  %268 = load ptr, ptr %40, align 8, !tbaa !5
  %269 = load ptr, ptr %41, align 8, !tbaa !5
  %270 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef %266, i64 noundef %267, ptr noundef %268, ptr noundef %269)
  %271 = icmp ne i32 %270, 1
  br i1 %271, label %272, label %278

272:                                              ; preds = %265, %258, %251, %234, %227, %220, %215, %209, %204, %199, %194, %179, %174, %169, %166
  br label %273

273:                                              ; preds = %272
  %274 = load ptr, ptr @stderr, align 8, !tbaa !5
  %275 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %274, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1839, ptr noundef @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  br label %276

276:                                              ; preds = %273
  br label %277

277:                                              ; preds = %276
  store i32 -1, ptr %21, align 4
  store i32 1, ptr %61, align 4
  br label %279

278:                                              ; preds = %265
  store i32 1, ptr %21, align 4
  store i32 1, ptr %61, align 4
  br label %279

279:                                              ; preds = %278, %277, %161, %122, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %57) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %56) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %55) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %54) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %53) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %52) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %51) #5
  call void @llvm.lifetime.end.p0(i64 112, ptr %50) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr %48) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %47) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr %46) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %45) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %43) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr %42) #5
  %280 = load i32, ptr %21, align 4
  ret i32 %280
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 0}
!16 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16}
!17 = !{!16, !10, i64 8}
!18 = !{!16, !6, i64 16}
!19 = distinct !{!19, !14}


; 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.SM3_CTX = type { [8 x i32], i64, [64 x i8], i64 }
%struct.SM2_KEY = type { %struct.SM2_Z256_POINT, [4 x i64] }
%struct.SM2_Z256_POINT = type { [4 x i64], [4 x i64], [4 x i64] }
%struct.CMS_CERTS_AND_KEY = type { ptr, i64, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@__const.cms_signed_and_enveloped_data_encipher_to_der.digest_algors = external hidden unnamed_addr constant [1 x i32], align 4
@__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der = external hidden unnamed_addr constant [46 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_content_info_header_to_der(i32 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @asn1_header_to_der(i32 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @asn1_nonempty_type_to_der(i32 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @asn1_type_to_der(i32 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_enced_content_info_encrypt_to_der(i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @asn1_int_to_der_ex(i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @sm3_update(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare i32 @x509_cert_get_subject_public_key(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_signer_infos_add_signer_info(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @asn1_length_le(i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_digest_algors_to_der(ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @sm3_init(ptr noundef) local_unnamed_addr #3

declare i32 @x509_cert_get_issuer_and_serial_number(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @cms_recipient_info_encrypt_to_der(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @asn1_any_from_der(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @cms_signed_and_enveloped_data_encipher_to_der(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, i32 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, i64 noundef %8, i32 noundef %9, ptr noundef %10, i64 noundef %11, ptr noundef %12, i64 noundef %13, ptr noundef %14, i64 noundef %15, ptr noundef %16, i64 noundef %17, ptr noundef %18, ptr noundef %19) local_unnamed_addr #2 {
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  %23 = alloca [512 x i8], align 16
  %24 = alloca i64, align 8
  %25 = alloca [1 x i32], align 4
  %26 = alloca [256 x i8], align 16
  %27 = alloca i64, align 8
  %28 = alloca [512 x i8], align 16
  %29 = alloca i64, align 8
  %30 = alloca %struct.SM3_CTX, align 8
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  %33 = alloca i64, align 8
  %34 = alloca i64, align 8
  %35 = alloca ptr, align 8
  %36 = alloca i64, align 8
  %37 = alloca ptr, align 8
  %38 = alloca i64, align 8
  %39 = alloca %struct.SM2_KEY, align 8
  store ptr %2, ptr %21, align 8, !tbaa !5
  store i64 %3, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %23) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %24) #4
  store i64 0, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %25) #4
  %40 = load i32, ptr @__const.cms_signed_and_enveloped_data_encipher_to_der.digest_algors, align 4
  store i32 %40, ptr %25, align 4
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %26) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %27) #4
  store i64 0, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %28) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %29) #4
  store i64 0, ptr %29, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 112, ptr nonnull %30) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %31) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %32) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %33) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %34) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %35) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %36) #4
  store i64 0, ptr %36, align 8, !tbaa !9
  store ptr %23, ptr %35, align 8, !tbaa !5
  %.not93 = icmp eq i64 %3, 0
  br i1 %.not93, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %20, %67
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %37) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %38) #4
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %39) #4
  %41 = call i32 @asn1_any_from_der(ptr noundef nonnull %37, ptr noundef nonnull %38, ptr noundef nonnull %21, ptr noundef nonnull %22) #4
  %.not87 = icmp eq i32 %41, 1
  br i1 %.not87, label %42, label %.critedge

42:                                               ; preds = %.lr.ph
  %43 = load ptr, ptr %37, align 8, !tbaa !5
  %44 = load i64, ptr %38, align 8, !tbaa !9
  %45 = call i32 @x509_cert_get_issuer_and_serial_number(ptr noundef %43, i64 noundef %44, ptr noundef nonnull %31, ptr noundef nonnull %33, ptr noundef nonnull %32, ptr noundef nonnull %34) #4
  %.not88 = icmp eq i32 %45, 1
  br i1 %.not88, label %46, label %.critedge

46:                                               ; preds = %42
  %47 = load ptr, ptr %37, align 8, !tbaa !5
  %48 = load i64, ptr %38, align 8, !tbaa !9
  %49 = call i32 @x509_cert_get_subject_public_key(ptr noundef %47, i64 noundef %48, ptr noundef nonnull %39) #4
  %.not89 = icmp eq i32 %49, 1
  br i1 %.not89, label %50, label %.critedge

50:                                               ; preds = %46
  %51 = load ptr, ptr %31, align 8, !tbaa !5
  %52 = load i64, ptr %33, align 8, !tbaa !9
  %53 = load ptr, ptr %32, align 8, !tbaa !5
  %54 = load i64, ptr %34, align 8, !tbaa !9
  %55 = call i32 @cms_recipient_info_encrypt_to_der(ptr noundef nonnull %39, ptr noundef %51, i64 noundef %52, ptr noundef %53, i64 noundef %54, ptr noundef %5, i64 noundef %6, ptr noundef null, ptr noundef nonnull %36)
  %.not90 = icmp eq i32 %55, 1
  br i1 %.not90, label %56, label %.critedge

56:                                               ; preds = %50
  %57 = load i64, ptr %36, align 8, !tbaa !9
  %58 = call i32 @asn1_length_le(i64 noundef %57, i64 noundef 512) #4
  %.not91 = icmp eq i32 %58, 1
  br i1 %.not91, label %59, label %.critedge

59:                                               ; preds = %56
  %60 = load ptr, ptr %31, align 8, !tbaa !5
  %61 = load i64, ptr %33, align 8, !tbaa !9
  %62 = load ptr, ptr %32, align 8, !tbaa !5
  %63 = load i64, ptr %34, align 8, !tbaa !9
  %64 = call i32 @cms_recipient_info_encrypt_to_der(ptr noundef nonnull %39, ptr noundef %60, i64 noundef %61, ptr noundef %62, i64 noundef %63, ptr noundef %5, i64 noundef %6, ptr noundef nonnull %35, ptr noundef nonnull %24)
  %.not92 = icmp eq i32 %64, 1
  br i1 %.not92, label %67, label %.critedge

.critedge:                                        ; preds = %.lr.ph, %42, %46, %50, %56, %59
  %65 = load ptr, ptr @stderr, align 8, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 1784, ptr noundef nonnull @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %39) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %38) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %37) #4
  br label %132

67:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %39) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %38) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %37) #4
  %68 = load i64, ptr %22, align 8, !tbaa !9
  %.not = icmp eq i64 %68, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %67, %20
  store ptr %26, ptr %35, align 8, !tbaa !5
  %69 = call i32 @cms_content_info_header_to_der(i32 noundef %9, i64 noundef %11, ptr noundef nonnull %35, ptr noundef nonnull %27)
  %.not70 = icmp eq i32 %69, 1
  br i1 %.not70, label %73, label %70

70:                                               ; preds = %._crit_edge
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 1792, ptr noundef nonnull @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  br label %132

73:                                               ; preds = %._crit_edge
  call void @sm3_init(ptr noundef nonnull %30) #4
  %74 = load i64, ptr %27, align 8, !tbaa !9
  call void @sm3_update(ptr noundef nonnull %30, ptr noundef nonnull %26, i64 noundef %74) #4
  call void @sm3_update(ptr noundef nonnull %30, ptr noundef %10, i64 noundef %11) #4
  %.not98 = icmp eq i64 %1, 0
  br i1 %.not98, label %._crit_edge97, label %.lr.ph96

.lr.ph96:                                         ; preds = %73
  %75 = getelementptr inbounds i8, ptr %0, i64 16
  br label %78

76:                                               ; preds = %84
  %77 = add nuw i64 %.06794, 1
  %exitcond.not = icmp eq i64 %77, %1
  br i1 %exitcond.not, label %._crit_edge97, label %78, !llvm.loop !13

78:                                               ; preds = %.lr.ph96, %76
  %.06794 = phi i64 [ 0, %.lr.ph96 ], [ %77, %76 ]
  %79 = getelementptr inbounds %struct.CMS_CERTS_AND_KEY, ptr %0, i64 %.06794
  %80 = load ptr, ptr %79, align 8, !tbaa !14
  %81 = getelementptr inbounds i8, ptr %79, i64 8
  %82 = load i64, ptr %81, align 8, !tbaa !16
  %83 = call i32 @x509_cert_get_issuer_and_serial_number(ptr noundef %80, i64 noundef %82, ptr noundef nonnull %31, ptr noundef nonnull %33, ptr noundef nonnull %32, ptr noundef nonnull %34) #4
  %.not85 = icmp eq i32 %83, 1
  br i1 %.not85, label %84, label %91

84:                                               ; preds = %78
  %85 = load ptr, ptr %75, align 8, !tbaa !17
  %86 = load ptr, ptr %31, align 8, !tbaa !5
  %87 = load i64, ptr %33, align 8, !tbaa !9
  %88 = load ptr, ptr %32, align 8, !tbaa !5
  %89 = load i64, ptr %34, align 8, !tbaa !9
  %90 = call i32 @cms_signer_infos_add_signer_info(ptr noundef nonnull %28, ptr noundef nonnull %29, i64 noundef 512, ptr noundef nonnull %30, ptr noundef %85, ptr noundef %86, i64 noundef %87, ptr noundef %88, i64 noundef %89, ptr noundef null, i64 noundef 0, ptr noundef null, i64 noundef 0)
  %.not86 = icmp eq i32 %90, 1
  br i1 %.not86, label %76, label %91

91:                                               ; preds = %78, %84
  %92 = load ptr, ptr @stderr, align 8, !tbaa !5
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 1808, ptr noundef nonnull @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  br label %132

._crit_edge97:                                    ; preds = %76, %73
  store i64 0, ptr %36, align 8, !tbaa !9
  %94 = call i32 @asn1_int_to_der_ex(i32 noundef 2, i32 noundef 1, ptr noundef null, ptr noundef nonnull %36) #4
  %.not71 = icmp eq i32 %94, 1
  br i1 %.not71, label %95, label %129

95:                                               ; preds = %._crit_edge97
  %96 = load i64, ptr %24, align 8, !tbaa !9
  %97 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef nonnull %23, i64 noundef %96, ptr noundef null, ptr noundef nonnull %36) #4
  %.not72 = icmp eq i32 %97, 1
  br i1 %.not72, label %98, label %129

98:                                               ; preds = %95
  %99 = call i32 @cms_digest_algors_to_der(ptr noundef nonnull %25, i64 noundef 1, ptr noundef null, ptr noundef nonnull %36)
  %.not73 = icmp eq i32 %99, 1
  br i1 %.not73, label %100, label %129

100:                                              ; preds = %98
  %101 = call i32 @cms_enced_content_info_encrypt_to_der(i32 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, i64 noundef %8, i32 noundef %9, ptr noundef %10, i64 noundef %11, ptr noundef %14, i64 noundef %15, ptr noundef %16, i64 noundef %17, ptr noundef null, ptr noundef nonnull %36)
  %.not74 = icmp eq i32 %101, 1
  br i1 %.not74, label %102, label %129

102:                                              ; preds = %100
  %103 = call i32 @cms_implicit_signers_certs_to_der(i32 noundef 0, ptr noundef %0, i64 noundef %1, ptr noundef null, ptr noundef nonnull %36)
  %.not75 = icmp eq i32 %103, 1
  br i1 %.not75, label %104, label %129

104:                                              ; preds = %102
  %105 = call i32 @asn1_type_to_der(i32 noundef 161, ptr noundef %12, i64 noundef %13, ptr noundef null, ptr noundef nonnull %36) #4
  %106 = icmp slt i32 %105, 0
  br i1 %106, label %129, label %107

107:                                              ; preds = %104
  %108 = load i64, ptr %29, align 8, !tbaa !9
  %109 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef nonnull %28, i64 noundef %108, ptr noundef null, ptr noundef nonnull %36) #4
  %.not76 = icmp eq i32 %109, 1
  br i1 %.not76, label %110, label %129

110:                                              ; preds = %107
  %111 = load i64, ptr %36, align 8, !tbaa !9
  %112 = call i32 @asn1_header_to_der(i32 noundef 48, i64 noundef %111, ptr noundef %18, ptr noundef %19) #4
  %.not77 = icmp eq i32 %112, 1
  br i1 %.not77, label %113, label %129

113:                                              ; preds = %110
  %114 = call i32 @asn1_int_to_der_ex(i32 noundef 2, i32 noundef 1, ptr noundef %18, ptr noundef %19) #4
  %.not78 = icmp eq i32 %114, 1
  br i1 %.not78, label %115, label %129

115:                                              ; preds = %113
  %116 = load i64, ptr %24, align 8, !tbaa !9
  %117 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef nonnull %23, i64 noundef %116, ptr noundef %18, ptr noundef %19) #4
  %.not79 = icmp eq i32 %117, 1
  br i1 %.not79, label %118, label %129

118:                                              ; preds = %115
  %119 = call i32 @cms_digest_algors_to_der(ptr noundef nonnull %25, i64 noundef 1, ptr noundef %18, ptr noundef %19)
  %.not80 = icmp eq i32 %119, 1
  br i1 %.not80, label %120, label %129

120:                                              ; preds = %118
  %121 = call i32 @cms_enced_content_info_encrypt_to_der(i32 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, i64 noundef %8, i32 noundef %9, ptr noundef %10, i64 noundef %11, ptr noundef %14, i64 noundef %15, ptr noundef %16, i64 noundef %17, ptr noundef %18, ptr noundef %19)
  %.not81 = icmp eq i32 %121, 1
  br i1 %.not81, label %122, label %129

122:                                              ; preds = %120
  %123 = call i32 @cms_implicit_signers_certs_to_der(i32 noundef 0, ptr noundef %0, i64 noundef %1, ptr noundef %18, ptr noundef %19)
  %.not82 = icmp eq i32 %123, 1
  br i1 %.not82, label %124, label %129

124:                                              ; preds = %122
  %125 = call i32 @asn1_type_to_der(i32 noundef 161, ptr noundef %12, i64 noundef %13, ptr noundef %18, ptr noundef %19) #4
  %.not83 = icmp eq i32 %125, 1
  br i1 %.not83, label %126, label %129

126:                                              ; preds = %124
  %127 = load i64, ptr %29, align 8, !tbaa !9
  %128 = call i32 @asn1_nonempty_type_to_der(i32 noundef 49, ptr noundef nonnull %28, i64 noundef %127, ptr noundef %18, ptr noundef %19) #4
  %.not84 = icmp eq i32 %128, 1
  br i1 %.not84, label %132, label %129

129:                                              ; preds = %._crit_edge97, %95, %98, %100, %102, %104, %107, %110, %113, %115, %118, %120, %122, %124, %126
  %130 = load ptr, ptr @stderr, align 8, !tbaa !5
  %131 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 1839, ptr noundef nonnull @__FUNCTION__.cms_signed_and_enveloped_data_encipher_to_der) #5
  br label %132

132:                                              ; preds = %126, %.critedge, %129, %91, %70
  %.2 = phi i32 [ -1, %70 ], [ -1, %91 ], [ -1, %129 ], [ -1, %.critedge ], [ 1, %126 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %36) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %35) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %34) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %33) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %32) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %31) #4
  call void @llvm.lifetime.end.p0(i64 112, ptr nonnull %30) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %29) #4
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %27) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %26) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #4
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %23) #4
  ret i32 %.2
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { cold 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !6, i64 0}
!15 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16}
!16 = !{!15, !10, i64 8}
!17 = !{!15, !6, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass