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

; 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 = type { %struct.SM2_POINT, [32 x i8], i8, [255 x i8] }
%struct.SM2_POINT = type { [32 x i8], [32 x i8] }

@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_ciphertext_from_der = external hidden unnamed_addr constant [24 x i8], align 1

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

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

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

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @sm2_ciphertext_from_der(ptr noundef %0, ptr noundef %1, ptr noundef %2) #4 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = call i32 @asn1_type_from_der(i32 noundef 48, ptr noundef %9, ptr noundef %10, ptr noundef %20, ptr noundef %21)
  store i32 %22, ptr %8, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 1
  br i1 %23, label %24, label %35

24:                                               ; preds = %3
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = icmp slt i32 %25, 0
  br i1 %26, label %27, label %33

27:                                               ; preds = %24
  br label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr @stderr, align 8, !tbaa !5
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 401, ptr noundef @__FUNCTION__.sm2_ciphertext_from_der) #6
  br label %31

31:                                               ; preds = %28
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32, %24
  %34 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %34, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %135

35:                                               ; preds = %3
  %36 = call i32 @asn1_integer_from_der_ex(i32 noundef 2, ptr noundef %11, ptr noundef %15, ptr noundef %9, ptr noundef %10)
  %37 = icmp ne i32 %36, 1
  br i1 %37, label %42, label %38

38:                                               ; preds = %35
  %39 = load i64, ptr %15, align 8, !tbaa !11
  %40 = call i32 @asn1_length_le(i64 noundef %39, i64 noundef 32)
  %41 = icmp ne i32 %40, 1
  br i1 %41, label %42, label %48

42:                                               ; preds = %38, %35
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 406, ptr noundef @__FUNCTION__.sm2_ciphertext_from_der) #6
  br label %46

46:                                               ; preds = %43
  br label %47

47:                                               ; preds = %46
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %135

48:                                               ; preds = %38
  %49 = call i32 @asn1_integer_from_der_ex(i32 noundef 2, ptr noundef %12, ptr noundef %16, ptr noundef %9, ptr noundef %10)
  %50 = icmp ne i32 %49, 1
  br i1 %50, label %55, label %51

51:                                               ; preds = %48
  %52 = load i64, ptr %16, align 8, !tbaa !11
  %53 = call i32 @asn1_length_le(i64 noundef %52, i64 noundef 32)
  %54 = icmp ne i32 %53, 1
  br i1 %54, label %55, label %61

55:                                               ; preds = %51, %48
  br label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 411, ptr noundef @__FUNCTION__.sm2_ciphertext_from_der) #6
  br label %59

59:                                               ; preds = %56
  br label %60

60:                                               ; preds = %59
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %135

61:                                               ; preds = %51
  %62 = call i32 @asn1_type_from_der(i32 noundef 4, ptr noundef %13, ptr noundef %17, ptr noundef %9, ptr noundef %10)
  %63 = icmp ne i32 %62, 1
  br i1 %63, label %70, label %64

64:                                               ; preds = %61
  %65 = load i64, ptr %17, align 8, !tbaa !11
  %66 = icmp eq i64 %65, 32
  %67 = zext i1 %66 to i32
  %68 = call i32 @asn1_check(i32 noundef %67)
  %69 = icmp ne i32 %68, 1
  br i1 %69, label %70, label %76

70:                                               ; preds = %64, %61
  br label %71

71:                                               ; preds = %70
  %72 = load ptr, ptr @stderr, align 8, !tbaa !5
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 416, ptr noundef @__FUNCTION__.sm2_ciphertext_from_der) #6
  br label %74

74:                                               ; preds = %71
  br label %75

75:                                               ; preds = %74
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %135

76:                                               ; preds = %64
  %77 = call i32 @asn1_type_from_der(i32 noundef 4, ptr noundef %14, ptr noundef %18, ptr noundef %9, ptr noundef %10)
  %78 = icmp ne i32 %77, 1
  br i1 %78, label %83, label %79

79:                                               ; preds = %76
  %80 = load i64, ptr %18, align 8, !tbaa !11
  %81 = call i32 @asn1_length_le(i64 noundef %80, i64 noundef 255)
  %82 = icmp ne i32 %81, 1
  br i1 %82, label %83, label %89

83:                                               ; preds = %79, %76
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr @stderr, align 8, !tbaa !5
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 422, ptr noundef @__FUNCTION__.sm2_ciphertext_from_der) #6
  br label %87

87:                                               ; preds = %84
  br label %88

88:                                               ; preds = %87
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %135

89:                                               ; preds = %79
  %90 = load i64, ptr %10, align 8, !tbaa !11
  %91 = call i32 @asn1_length_is_zero(i64 noundef %90)
  %92 = icmp ne i32 %91, 1
  br i1 %92, label %93, label %99

93:                                               ; preds = %89
  br label %94

94:                                               ; preds = %93
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 426, ptr noundef @__FUNCTION__.sm2_ciphertext_from_der) #6
  br label %97

97:                                               ; preds = %94
  br label %98

98:                                               ; preds = %97
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %135

99:                                               ; preds = %89
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 1 %100, i8 0, i64 352, i1 false)
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.SM2_CIPHERTEXT, ptr %101, i32 0, i32 0
  %103 = getelementptr inbounds %struct.SM2_POINT, ptr %102, i32 0, i32 0
  %104 = getelementptr inbounds [32 x i8], ptr %103, i64 0, i64 0
  %105 = getelementptr inbounds i8, ptr %104, i64 32
  %106 = load i64, ptr %15, align 8, !tbaa !11
  %107 = sub i64 0, %106
  %108 = getelementptr inbounds i8, ptr %105, i64 %107
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = load i64, ptr %15, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %108, ptr align 1 %109, i64 %110, i1 false)
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.SM2_CIPHERTEXT, ptr %111, i32 0, i32 0
  %113 = getelementptr inbounds %struct.SM2_POINT, ptr %112, i32 0, i32 1
  %114 = getelementptr inbounds [32 x i8], ptr %113, i64 0, i64 0
  %115 = getelementptr inbounds i8, ptr %114, i64 32
  %116 = load i64, ptr %16, align 8, !tbaa !11
  %117 = sub i64 0, %116
  %118 = getelementptr inbounds i8, ptr %115, i64 %117
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = load i64, ptr %16, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %118, ptr align 1 %119, i64 %120, i1 false)
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.SM2_CIPHERTEXT, ptr %121, i32 0, i32 1
  %123 = getelementptr inbounds [32 x i8], ptr %122, i64 0, i64 0
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = load i64, ptr %17, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %123, ptr align 1 %124, i64 %125, i1 false)
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.SM2_CIPHERTEXT, ptr %126, i32 0, i32 3
  %128 = getelementptr inbounds [255 x i8], ptr %127, i64 0, i64 0
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = load i64, ptr %18, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %128, ptr align 1 %129, i64 %130, i1 false)
  %131 = load i64, ptr %18, align 8, !tbaa !11
  %132 = trunc i64 %131 to i8
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.SM2_CIPHERTEXT, ptr %133, i32 0, i32 2
  store i8 %132, ptr %134, align 1, !tbaa !13
  store i32 1, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %135

135:                                              ; preds = %99, %98, %88, %75, %60, %47, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %136 = load i32, ptr %4, align 4
  ret i32 %136
}

declare i32 @asn1_type_from_der(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

declare i32 @asn1_integer_from_der_ex(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

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

declare i32 @asn1_check(i32 noundef) #5

declare i32 @asn1_length_is_zero(i64 noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { 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 #5 = { "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 #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !7, i64 96}
!14 = !{!"", !15, i64 0, !7, i64 64, !7, i64 96, !7, i64 97}
!15 = !{!"", !7, i64 0, !7, i64 32}


; 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"

@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_ciphertext_from_der = external hidden unnamed_addr constant [24 x i8], align 1

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @sm2_ciphertext_from_der(ptr nocapture noundef writeonly %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #4 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  %14 = call i32 @asn1_type_from_der(i32 noundef 48, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef %1, ptr noundef %2) #6
  %.not = icmp eq i32 %14, 1
  br i1 %.not, label %20, label %15

15:                                               ; preds = %3
  %16 = icmp slt i32 %14, 0
  br i1 %16, label %17, label %78

17:                                               ; preds = %15
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 401, ptr noundef nonnull @__FUNCTION__.sm2_ciphertext_from_der) #7
  br label %78

20:                                               ; preds = %3
  %21 = call i32 @asn1_integer_from_der_ex(i32 noundef 2, ptr noundef nonnull %6, ptr noundef nonnull %10, ptr noundef nonnull %4, ptr noundef nonnull %5) #6
  %.not11 = icmp eq i32 %21, 1
  br i1 %.not11, label %22, label %25

22:                                               ; preds = %20
  %23 = load i64, ptr %10, align 8, !tbaa !9
  %24 = call i32 @asn1_length_le(i64 noundef %23, i64 noundef 32) #6
  %.not12 = icmp eq i32 %24, 1
  br i1 %.not12, label %28, label %25

25:                                               ; preds = %20, %22
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 406, ptr noundef nonnull @__FUNCTION__.sm2_ciphertext_from_der) #7
  br label %78

28:                                               ; preds = %22
  %29 = call i32 @asn1_integer_from_der_ex(i32 noundef 2, ptr noundef nonnull %7, ptr noundef nonnull %11, ptr noundef nonnull %4, ptr noundef nonnull %5) #6
  %.not13 = icmp eq i32 %29, 1
  br i1 %.not13, label %30, label %33

30:                                               ; preds = %28
  %31 = load i64, ptr %11, align 8, !tbaa !9
  %32 = call i32 @asn1_length_le(i64 noundef %31, i64 noundef 32) #6
  %.not14 = icmp eq i32 %32, 1
  br i1 %.not14, label %36, label %33

33:                                               ; preds = %28, %30
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 411, ptr noundef nonnull @__FUNCTION__.sm2_ciphertext_from_der) #7
  br label %78

36:                                               ; preds = %30
  %37 = call i32 @asn1_type_from_der(i32 noundef 4, ptr noundef nonnull %8, ptr noundef nonnull %12, ptr noundef nonnull %4, ptr noundef nonnull %5) #6
  %.not15 = icmp eq i32 %37, 1
  br i1 %.not15, label %38, label %43

38:                                               ; preds = %36
  %39 = load i64, ptr %12, align 8, !tbaa !9
  %40 = icmp eq i64 %39, 32
  %41 = zext i1 %40 to i32
  %42 = call i32 @asn1_check(i32 noundef %41) #6
  %.not16 = icmp eq i32 %42, 1
  br i1 %.not16, label %46, label %43

43:                                               ; preds = %36, %38
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 416, ptr noundef nonnull @__FUNCTION__.sm2_ciphertext_from_der) #7
  br label %78

46:                                               ; preds = %38
  %47 = call i32 @asn1_type_from_der(i32 noundef 4, ptr noundef nonnull %9, ptr noundef nonnull %13, ptr noundef nonnull %4, ptr noundef nonnull %5) #6
  %.not17 = icmp eq i32 %47, 1
  br i1 %.not17, label %48, label %51

48:                                               ; preds = %46
  %49 = load i64, ptr %13, align 8, !tbaa !9
  %50 = call i32 @asn1_length_le(i64 noundef %49, i64 noundef 255) #6
  %.not18 = icmp eq i32 %50, 1
  br i1 %.not18, label %54, label %51

51:                                               ; preds = %46, %48
  %52 = load ptr, ptr @stderr, align 8, !tbaa !5
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 422, ptr noundef nonnull @__FUNCTION__.sm2_ciphertext_from_der) #7
  br label %78

54:                                               ; preds = %48
  %55 = load i64, ptr %5, align 8, !tbaa !9
  %56 = call i32 @asn1_length_is_zero(i64 noundef %55) #6
  %.not19 = icmp eq i32 %56, 1
  br i1 %.not19, label %60, label %57

57:                                               ; preds = %54
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 426, ptr noundef nonnull @__FUNCTION__.sm2_ciphertext_from_der) #7
  br label %78

60:                                               ; preds = %54
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(352) %0, i8 0, i64 352, i1 false)
  %61 = getelementptr inbounds i8, ptr %0, i64 32
  %62 = load i64, ptr %10, align 8, !tbaa !9
  %63 = sub i64 0, %62
  %64 = getelementptr inbounds i8, ptr %61, i64 %63
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %64, ptr align 1 %65, i64 %62, i1 false)
  %66 = getelementptr inbounds i8, ptr %0, i64 64
  %67 = load i64, ptr %11, align 8, !tbaa !9
  %68 = sub i64 0, %67
  %69 = getelementptr inbounds i8, ptr %66, i64 %68
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %69, ptr align 1 %70, i64 %67, i1 false)
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = load i64, ptr %12, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %66, ptr align 1 %71, i64 %72, i1 false)
  %73 = getelementptr inbounds i8, ptr %0, i64 97
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load i64, ptr %13, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %73, ptr align 1 %74, i64 %75, i1 false)
  %76 = trunc i64 %75 to i8
  %77 = getelementptr inbounds i8, ptr %0, i64 96
  store i8 %76, ptr %77, align 1, !tbaa !11
  br label %78

78:                                               ; preds = %15, %17, %60, %57, %51, %43, %33, %25
  %.0 = phi i32 [ -1, %25 ], [ -1, %33 ], [ -1, %43 ], [ -1, %51 ], [ -1, %57 ], [ 1, %60 ], [ %14, %17 ], [ %14, %15 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret i32 %.0
}

declare i32 @asn1_type_from_der(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @asn1_integer_from_der_ex(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

declare i32 @asn1_check(i32 noundef) local_unnamed_addr #5

declare i32 @asn1_length_is_zero(i64 noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { 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 #5 = { "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 #6 = { nounwind }
attributes #7 = { 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 = !{!12, !7, i64 96}
!12 = !{!"", !13, i64 0, !7, i64 64, !7, i64 96, !7, i64 97}
!13 = !{!"", !7, i64 0, !7, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass