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

; 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.SM4_KEY = type { [32 x i32] }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@__FUNCTION__.sm2_private_key_info_decrypt_from_der = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(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

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

declare void @gmssl_secure_clear(ptr noundef, i64 noundef) #2

declare i32 @asn1_check(i32 noundef) #2

declare i32 @asn1_length_is_zero(i64 noundef) #2

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @sm2_private_key_info_decrypt_from_der(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #3 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  %23 = alloca [16 x i8], align 16
  %24 = alloca %struct.SM4_KEY, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i64, align 8
  %27 = alloca [256 x i8], align 16
  %28 = alloca ptr, align 8
  %29 = alloca i64, align 8
  %30 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 -1, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.start.p0(i64 256, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %31 = getelementptr inbounds [256 x i8], ptr %27, i64 0, i64 0
  store ptr %31, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %53

34:                                               ; preds = %6
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %53

37:                                               ; preds = %34
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %53

40:                                               ; preds = %37
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %53

43:                                               ; preds = %40
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %53

46:                                               ; preds = %43
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %53

50:                                               ; preds = %46
  %51 = load ptr, ptr %13, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %59, label %53

53:                                               ; preds = %50, %46, %43, %40, %37, %34, %6
  br label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 609, ptr noundef @__FUNCTION__.sm2_private_key_info_decrypt_from_der) #5
  br label %57

57:                                               ; preds = %54
  br label %58

58:                                               ; preds = %57
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %30, align 4
  br label %154

59:                                               ; preds = %50
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = call i32 @pkcs8_enced_private_key_info_from_der(ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18, ptr noundef %19, ptr noundef %20, ptr noundef %21, ptr noundef %22, ptr noundef %25, ptr noundef %26, ptr noundef %60, ptr noundef %61)
  %63 = icmp ne i32 %62, 1
  br i1 %63, label %102, label %64

64:                                               ; preds = %59
  %65 = load i32, ptr %18, align 4, !tbaa !9
  %66 = icmp eq i32 %65, -1
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = load i32, ptr %18, align 4, !tbaa !9
  %69 = icmp eq i32 %68, 16
  br label %70

70:                                               ; preds = %67, %64
  %71 = phi i1 [ true, %64 ], [ %69, %67 ]
  %72 = zext i1 %71 to i32
  %73 = call i32 @asn1_check(i32 noundef %72)
  %74 = icmp ne i32 %73, 1
  br i1 %74, label %102, label %75

75:                                               ; preds = %70
  %76 = load i32, ptr %19, align 4, !tbaa !9
  %77 = icmp eq i32 %76, -1
  br i1 %77, label %81, label %78

78:                                               ; preds = %75
  %79 = load i32, ptr %19, align 4, !tbaa !9
  %80 = icmp eq i32 %79, 15
  br label %81

81:                                               ; preds = %78, %75
  %82 = phi i1 [ true, %75 ], [ %80, %78 ]
  %83 = zext i1 %82 to i32
  %84 = call i32 @asn1_check(i32 noundef %83)
  %85 = icmp ne i32 %84, 1
  br i1 %85, label %102, label %86

86:                                               ; preds = %81
  %87 = load i32, ptr %20, align 4, !tbaa !9
  %88 = icmp eq i32 %87, 98
  %89 = zext i1 %88 to i32
  %90 = call i32 @asn1_check(i32 noundef %89)
  %91 = icmp ne i32 %90, 1
  br i1 %91, label %102, label %92

92:                                               ; preds = %86
  %93 = load i64, ptr %22, align 8, !tbaa !11
  %94 = icmp eq i64 %93, 16
  %95 = zext i1 %94 to i32
  %96 = call i32 @asn1_check(i32 noundef %95)
  %97 = icmp ne i32 %96, 1
  br i1 %97, label %102, label %98

98:                                               ; preds = %92
  %99 = load i64, ptr %26, align 8, !tbaa !11
  %100 = call i32 @asn1_length_le(i64 noundef %99, i64 noundef 256)
  %101 = icmp ne i32 %100, 1
  br i1 %101, label %102, label %108

102:                                              ; preds = %98, %92, %86, %81, %70, %59
  br label %103

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

106:                                              ; preds = %103
  br label %107

107:                                              ; preds = %106
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %30, align 4
  br label %154

108:                                              ; preds = %98
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = call i64 @strlen(ptr noundef %110) #6
  %112 = load ptr, ptr %15, align 8, !tbaa !5
  %113 = load i64, ptr %16, align 8, !tbaa !11
  %114 = load i32, ptr %17, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [16 x i8], ptr %23, i64 0, i64 0
  %117 = call i32 @sm3_pbkdf2(ptr noundef %109, i64 noundef %111, ptr noundef %112, i64 noundef %113, i64 noundef %115, i64 noundef 16, ptr noundef %116)
  %118 = icmp ne i32 %117, 1
  br i1 %118, label %119, label %125

119:                                              ; preds = %108
  br label %120

120:                                              ; preds = %119
  %121 = load ptr, ptr @stderr, align 8, !tbaa !5
  %122 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %121, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 623, ptr noundef @__FUNCTION__.sm2_private_key_info_decrypt_from_der) #5
  br label %123

123:                                              ; preds = %120
  br label %124

124:                                              ; preds = %123
  br label %150

125:                                              ; preds = %108
  %126 = getelementptr inbounds [16 x i8], ptr %23, i64 0, i64 0
  call void @sm4_set_decrypt_key(ptr noundef %24, ptr noundef %126)
  %127 = load ptr, ptr %21, align 8, !tbaa !5
  %128 = load ptr, ptr %25, align 8, !tbaa !5
  %129 = load i64, ptr %26, align 8, !tbaa !11
  %130 = getelementptr inbounds [256 x i8], ptr %27, i64 0, i64 0
  %131 = call i32 @sm4_cbc_padding_decrypt(ptr noundef %24, ptr noundef %127, ptr noundef %128, i64 noundef %129, ptr noundef %130, ptr noundef %29)
  %132 = icmp ne i32 %131, 1
  br i1 %132, label %143, label %133

133:                                              ; preds = %125
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  %135 = load ptr, ptr %9, align 8, !tbaa !5
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = call i32 @sm2_private_key_info_from_der(ptr noundef %134, ptr noundef %135, ptr noundef %136, ptr noundef %28, ptr noundef %29)
  %138 = icmp ne i32 %137, 1
  br i1 %138, label %143, label %139

139:                                              ; preds = %133
  %140 = load i64, ptr %29, align 8, !tbaa !11
  %141 = call i32 @asn1_length_is_zero(i64 noundef %140)
  %142 = icmp ne i32 %141, 1
  br i1 %142, label %143, label %149

143:                                              ; preds = %139, %133, %125
  br label %144

144:                                              ; preds = %143
  %145 = load ptr, ptr @stderr, align 8, !tbaa !5
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 631, ptr noundef @__FUNCTION__.sm2_private_key_info_decrypt_from_der) #5
  br label %147

147:                                              ; preds = %144
  br label %148

148:                                              ; preds = %147
  br label %150

149:                                              ; preds = %139
  store i32 1, ptr %14, align 4, !tbaa !9
  br label %150

150:                                              ; preds = %149, %148, %124
  call void @gmssl_secure_clear(ptr noundef %24, i64 noundef 128)
  %151 = getelementptr inbounds [16 x i8], ptr %23, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %151, i64 noundef 16)
  %152 = getelementptr inbounds [256 x i8], ptr %27, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %152, i64 noundef 256)
  %153 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %153, ptr %7, align 4
  store i32 1, ptr %30, align 4
  br label %154

154:                                              ; preds = %150, %107, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %155 = load i32, ptr %7, align 4
  ret i32 %155
}

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}


; 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.SM4_KEY = type { [32 x i32] }

@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 [61 x i8], align 1
@__FUNCTION__.sm2_private_key_info_decrypt_from_der = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) 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

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

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

declare i32 @asn1_check(i32 noundef) local_unnamed_addr #2

declare i32 @asn1_length_is_zero(i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @sm2_private_key_info_decrypt_from_der(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #3 {
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca [16 x i8], align 16
  %16 = alloca %struct.SM4_KEY, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca [256 x i8], align 16
  %20 = alloca ptr, align 8
  %21 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #5
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #5
  store ptr %19, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %21) #5
  %22 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %23 = insertelement <4 x ptr> %22, ptr %1, i64 1
  %24 = insertelement <4 x ptr> %23, ptr %2, i64 2
  %25 = insertelement <4 x ptr> %24, ptr %3, i64 3
  %26 = icmp ne ptr %4, null
  %27 = icmp eq <4 x ptr> %25, zeroinitializer
  %28 = bitcast <4 x i1> %27 to i4
  %29 = icmp eq i4 %28, 0
  %op.rdx = and i1 %29, %26
  br i1 %op.rdx, label %30, label %34

30:                                               ; preds = %6
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  %33 = icmp ne ptr %5, null
  %or.cond9 = and i1 %33, %32
  br i1 %or.cond9, label %37, label %34

34:                                               ; preds = %6, %30
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 609, ptr noundef nonnull @__FUNCTION__.sm2_private_key_info_decrypt_from_der) #6
  br label %89

37:                                               ; preds = %30
  %38 = call i32 @pkcs8_enced_private_key_info_from_der(ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %13, ptr noundef nonnull %14, ptr noundef nonnull %17, ptr noundef nonnull %18, ptr noundef nonnull %4, ptr noundef nonnull %5) #5
  %.not = icmp eq i32 %38, 1
  br i1 %.not, label %39, label %66

39:                                               ; preds = %37
  %40 = load i32, ptr %10, align 4
  %41 = icmp eq i32 %40, -1
  %42 = icmp eq i32 %40, 16
  %43 = or i1 %41, %42
  %44 = zext i1 %43 to i32
  %45 = call i32 @asn1_check(i32 noundef %44) #5
  %.not30 = icmp eq i32 %45, 1
  br i1 %.not30, label %46, label %66

46:                                               ; preds = %39
  %47 = load i32, ptr %11, align 4
  %48 = icmp eq i32 %47, -1
  %49 = icmp eq i32 %47, 15
  %50 = or i1 %48, %49
  %51 = zext i1 %50 to i32
  %52 = call i32 @asn1_check(i32 noundef %51) #5
  %.not31 = icmp eq i32 %52, 1
  br i1 %.not31, label %53, label %66

53:                                               ; preds = %46
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = icmp eq i32 %54, 98
  %56 = zext i1 %55 to i32
  %57 = call i32 @asn1_check(i32 noundef %56) #5
  %.not32 = icmp eq i32 %57, 1
  br i1 %.not32, label %58, label %66

58:                                               ; preds = %53
  %59 = load i64, ptr %14, align 8, !tbaa !11
  %60 = icmp eq i64 %59, 16
  %61 = zext i1 %60 to i32
  %62 = call i32 @asn1_check(i32 noundef %61) #5
  %.not33 = icmp eq i32 %62, 1
  br i1 %.not33, label %63, label %66

63:                                               ; preds = %58
  %64 = load i64, ptr %18, align 8, !tbaa !11
  %65 = call i32 @asn1_length_le(i64 noundef %64, i64 noundef 256) #5
  %.not34 = icmp eq i32 %65, 1
  br i1 %.not34, label %69, label %66

66:                                               ; preds = %37, %39, %46, %53, %58, %63
  %67 = load ptr, ptr @stderr, align 8, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 619, ptr noundef nonnull @__FUNCTION__.sm2_private_key_info_decrypt_from_der) #6
  br label %89

69:                                               ; preds = %63
  %70 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %3) #7
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = load i64, ptr %8, align 8, !tbaa !11
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = call i32 @sm3_pbkdf2(ptr noundef nonnull %3, i64 noundef %70, ptr noundef %71, i64 noundef %72, i64 noundef %74, i64 noundef 16, ptr noundef nonnull %15) #5
  %.not35 = icmp eq i32 %75, 1
  br i1 %.not35, label %76, label %.sink.split

76:                                               ; preds = %69
  call void @sm4_set_decrypt_key(ptr noundef nonnull %16, ptr noundef nonnull %15) #5
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = load ptr, ptr %17, align 8, !tbaa !5
  %79 = load i64, ptr %18, align 8, !tbaa !11
  %80 = call i32 @sm4_cbc_padding_decrypt(ptr noundef nonnull %16, ptr noundef %77, ptr noundef %78, i64 noundef %79, ptr noundef nonnull %19, ptr noundef nonnull %21) #5
  %.not36 = icmp eq i32 %80, 1
  br i1 %.not36, label %81, label %.sink.split

81:                                               ; preds = %76
  %82 = call i32 @sm2_private_key_info_from_der(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %20, ptr noundef nonnull %21)
  %.not37 = icmp eq i32 %82, 1
  br i1 %.not37, label %83, label %.sink.split

83:                                               ; preds = %81
  %84 = load i64, ptr %21, align 8, !tbaa !11
  %85 = call i32 @asn1_length_is_zero(i64 noundef %84) #5
  %.not38 = icmp eq i32 %85, 1
  br i1 %.not38, label %88, label %.sink.split

.sink.split:                                      ; preds = %83, %81, %76, %69
  %.sink39 = phi i32 [ 623, %69 ], [ 631, %76 ], [ 631, %81 ], [ 631, %83 ]
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef %.sink39, ptr noundef nonnull @__FUNCTION__.sm2_private_key_info_decrypt_from_der) #6
  br label %88

88:                                               ; preds = %.sink.split, %83
  %.0 = phi i32 [ 1, %83 ], [ -1, %.sink.split ]
  call void @gmssl_secure_clear(ptr noundef nonnull %16, i64 noundef 128) #5
  call void @gmssl_secure_clear(ptr noundef nonnull %15, i64 noundef 16) #5
  call void @gmssl_secure_clear(ptr noundef nonnull %19, i64 noundef 256) #5
  br label %89

89:                                               ; preds = %88, %66, %34
  %.024 = phi i32 [ -1, %66 ], [ %.0, %88 ], [ -1, %34 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %16) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  ret i32 %.024
}

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

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

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

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

attributes #0 = { 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 #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #5 = { nounwind }
attributes #6 = { cold nounwind }
attributes #7 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass