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

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [62 x i8], align 1
@__FUNCTION__.x509_tbs_crl_from_der = external hidden unnamed_addr constant [22 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 i32 @asn1_int_from_der_ex(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

declare i32 @asn1_length_is_zero(i64 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @x509_tbs_crl_from_der(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11) #3 {
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca i64, align 8
  %29 = alloca i32, align 4
  store ptr %0, ptr %14, align 8, !tbaa !5
  store ptr %1, ptr %15, align 8, !tbaa !5
  store ptr %2, ptr %16, align 8, !tbaa !5
  store ptr %3, ptr %17, align 8, !tbaa !5
  store ptr %4, ptr %18, align 8, !tbaa !5
  store ptr %5, ptr %19, align 8, !tbaa !5
  store ptr %6, ptr %20, align 8, !tbaa !5
  store ptr %7, ptr %21, align 8, !tbaa !5
  store ptr %8, ptr %22, align 8, !tbaa !5
  store ptr %9, ptr %23, align 8, !tbaa !5
  store ptr %10, ptr %24, align 8, !tbaa !5
  store ptr %11, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  %30 = load ptr, ptr %24, align 8, !tbaa !5
  %31 = load ptr, ptr %25, align 8, !tbaa !5
  %32 = call i32 @asn1_type_from_der(i32 noundef 48, ptr noundef %27, ptr noundef %28, ptr noundef %30, ptr noundef %31)
  store i32 %32, ptr %26, align 4, !tbaa !9
  %33 = icmp ne i32 %32, 1
  br i1 %33, label %34, label %45

34:                                               ; preds = %12
  %35 = load i32, ptr %26, align 4, !tbaa !9
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %37, label %43

37:                                               ; preds = %34
  br label %38

38:                                               ; preds = %37
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1294, ptr noundef @__FUNCTION__.x509_tbs_crl_from_der) #4
  br label %41

41:                                               ; preds = %38
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42, %34
  %44 = load i32, ptr %26, align 4, !tbaa !9
  store i32 %44, ptr %13, align 4
  store i32 1, ptr %29, align 4
  br label %129

45:                                               ; preds = %12
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = call i32 @asn1_int_from_der_ex(i32 noundef 2, ptr noundef %46, ptr noundef %27, ptr noundef %28)
  %48 = icmp slt i32 %47, 0
  br i1 %48, label %80, label %49

49:                                               ; preds = %45
  %50 = load ptr, ptr %15, align 8, !tbaa !5
  %51 = call i32 @x509_signature_algor_from_der(ptr noundef %50, ptr noundef %27, ptr noundef %28)
  %52 = icmp ne i32 %51, 1
  br i1 %52, label %80, label %53

53:                                               ; preds = %49
  %54 = load ptr, ptr %16, align 8, !tbaa !5
  %55 = load ptr, ptr %17, align 8, !tbaa !5
  %56 = call i32 @asn1_type_from_der(i32 noundef 48, ptr noundef %54, ptr noundef %55, ptr noundef %27, ptr noundef %28)
  %57 = icmp ne i32 %56, 1
  br i1 %57, label %80, label %58

58:                                               ; preds = %53
  %59 = load ptr, ptr %18, align 8, !tbaa !5
  %60 = call i32 @x509_time_from_der(ptr noundef %59, ptr noundef %27, ptr noundef %28)
  %61 = icmp ne i32 %60, 1
  br i1 %61, label %80, label %62

62:                                               ; preds = %58
  %63 = load ptr, ptr %19, align 8, !tbaa !5
  %64 = call i32 @x509_time_from_der(ptr noundef %63, ptr noundef %27, ptr noundef %28)
  %65 = icmp slt i32 %64, 0
  br i1 %65, label %80, label %66

66:                                               ; preds = %62
  %67 = load ptr, ptr %20, align 8, !tbaa !5
  %68 = load ptr, ptr %21, align 8, !tbaa !5
  %69 = call i32 @asn1_type_from_der(i32 noundef 48, ptr noundef %67, ptr noundef %68, ptr noundef %27, ptr noundef %28)
  %70 = icmp slt i32 %69, 0
  br i1 %70, label %80, label %71

71:                                               ; preds = %66
  %72 = load ptr, ptr %22, align 8, !tbaa !5
  %73 = load ptr, ptr %23, align 8, !tbaa !5
  %74 = call i32 @x509_explicit_exts_from_der(i32 noundef 0, ptr noundef %72, ptr noundef %73, ptr noundef %27, ptr noundef %28)
  %75 = icmp slt i32 %74, 0
  br i1 %75, label %80, label %76

76:                                               ; preds = %71
  %77 = load i64, ptr %28, align 8, !tbaa !11
  %78 = call i32 @asn1_length_is_zero(i64 noundef %77)
  %79 = icmp ne i32 %78, 1
  br i1 %79, label %80, label %86

80:                                               ; preds = %76, %71, %66, %62, %58, %53, %49, %45
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1305, ptr noundef @__FUNCTION__.x509_tbs_crl_from_der) #4
  br label %84

84:                                               ; preds = %81
  br label %85

85:                                               ; preds = %84
  store i32 -1, ptr %13, align 4
  store i32 1, ptr %29, align 4
  br label %129

86:                                               ; preds = %76
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = icmp sge i32 %88, 0
  br i1 %89, label %90, label %100

90:                                               ; preds = %86
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 1
  br i1 %93, label %94, label %100

94:                                               ; preds = %90
  br label %95

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

98:                                               ; preds = %95
  br label %99

99:                                               ; preds = %98
  store i32 -1, ptr %13, align 4
  store i32 1, ptr %29, align 4
  br label %129

100:                                              ; preds = %90, %86
  %101 = load ptr, ptr %20, align 8, !tbaa !5
  %102 = load ptr, ptr %101, align 8, !tbaa !5
  %103 = icmp ne ptr %102, null
  br i1 %103, label %104, label %114

104:                                              ; preds = %100
  %105 = load ptr, ptr %14, align 8, !tbaa !5
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 1
  br i1 %107, label %108, label %114

108:                                              ; preds = %104
  br label %109

109:                                              ; preds = %108
  %110 = load ptr, ptr @stderr, align 8, !tbaa !5
  %111 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %110, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1313, ptr noundef @__FUNCTION__.x509_tbs_crl_from_der) #4
  br label %112

112:                                              ; preds = %109
  br label %113

113:                                              ; preds = %112
  store i32 -1, ptr %13, align 4
  store i32 1, ptr %29, align 4
  br label %129

114:                                              ; preds = %104, %100
  %115 = load ptr, ptr %22, align 8, !tbaa !5
  %116 = load ptr, ptr %115, align 8, !tbaa !5
  %117 = icmp ne ptr %116, null
  br i1 %117, label %118, label %128

118:                                              ; preds = %114
  %119 = load ptr, ptr %14, align 8, !tbaa !5
  %120 = load i32, ptr %119, align 4, !tbaa !9
  %121 = icmp ne i32 %120, 1
  br i1 %121, label %122, label %128

122:                                              ; preds = %118
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr @stderr, align 8, !tbaa !5
  %125 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %124, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1317, ptr noundef @__FUNCTION__.x509_tbs_crl_from_der) #4
  br label %126

126:                                              ; preds = %123
  br label %127

127:                                              ; preds = %126
  store i32 -1, ptr %13, align 4
  store i32 1, ptr %29, align 4
  br label %129

128:                                              ; preds = %118, %114
  store i32 1, ptr %13, align 4
  store i32 1, ptr %29, align 4
  br label %129

129:                                              ; preds = %128, %127, %113, %99, %85, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  %130 = load i32, ptr %13, align 4
  ret i32 %130
}

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

declare i32 @x509_explicit_exts_from_der(i32 noundef, ptr noundef, ptr 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 }

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

@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 [62 x i8], align 1
@__FUNCTION__.x509_tbs_crl_from_der = external hidden unnamed_addr constant [22 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 i32 @asn1_int_from_der_ex(i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @asn1_length_is_zero(i64 noundef) local_unnamed_addr #2

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

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

16:                                               ; preds = %12
  %17 = icmp slt i32 %15, 0
  br i1 %17, label %.thread32.sink.split, label %.thread32

18:                                               ; preds = %12
  %19 = call i32 @asn1_int_from_der_ex(i32 noundef 2, ptr noundef %0, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  %20 = icmp slt i32 %19, 0
  br i1 %20, label %.thread32.sink.split, label %21

21:                                               ; preds = %18
  %22 = call i32 @x509_signature_algor_from_der(ptr noundef %1, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  %.not22 = icmp eq i32 %22, 1
  br i1 %.not22, label %23, label %.thread32.sink.split

23:                                               ; preds = %21
  %24 = call i32 @asn1_type_from_der(i32 noundef 48, ptr noundef %2, ptr noundef %3, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  %.not23 = icmp eq i32 %24, 1
  br i1 %.not23, label %25, label %.thread32.sink.split

25:                                               ; preds = %23
  %26 = call i32 @x509_time_from_der(ptr noundef %4, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  %.not24 = icmp eq i32 %26, 1
  br i1 %.not24, label %27, label %.thread32.sink.split

27:                                               ; preds = %25
  %28 = call i32 @x509_time_from_der(ptr noundef %5, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %.thread32.sink.split, label %30

30:                                               ; preds = %27
  %31 = call i32 @asn1_type_from_der(i32 noundef 48, ptr noundef %6, ptr noundef %7, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  %32 = icmp slt i32 %31, 0
  br i1 %32, label %.thread32.sink.split, label %33

33:                                               ; preds = %30
  %34 = call i32 @x509_explicit_exts_from_der(i32 noundef 0, ptr noundef %8, ptr noundef %9, ptr noundef nonnull %13, ptr noundef nonnull %14) #4
  %35 = icmp slt i32 %34, 0
  br i1 %35, label %.thread32.sink.split, label %36

36:                                               ; preds = %33
  %37 = load i64, ptr %14, align 8, !tbaa !5
  %38 = call i32 @asn1_length_is_zero(i64 noundef %37) #4
  %.not25 = icmp eq i32 %38, 1
  br i1 %.not25, label %39, label %.thread32.sink.split

39:                                               ; preds = %36
  %40 = load i32, ptr %0, align 4, !tbaa !9
  %41 = icmp slt i32 %40, 0
  %.not26 = icmp eq i32 %40, 1
  %or.cond = or i1 %41, %.not26
  br i1 %or.cond, label %42, label %.thread32.sink.split

42:                                               ; preds = %39
  %43 = load ptr, ptr %6, align 8, !tbaa !11
  %.not27 = icmp eq ptr %43, null
  br i1 %.not27, label %45, label %44

44:                                               ; preds = %42
  br i1 %.not26, label %.thread32, label %.thread32.sink.split

45:                                               ; preds = %42
  %46 = load ptr, ptr %8, align 8, !tbaa !11
  %.not29 = icmp eq ptr %46, null
  %brmerge = or i1 %.not26, %.not29
  br i1 %brmerge, label %.thread32, label %.thread32.sink.split

.thread32.sink.split:                             ; preds = %45, %44, %39, %36, %33, %30, %27, %25, %23, %21, %18, %16
  %.sink33 = phi i32 [ 1294, %16 ], [ 1305, %18 ], [ 1305, %21 ], [ 1305, %23 ], [ 1305, %25 ], [ 1305, %27 ], [ 1305, %30 ], [ 1305, %33 ], [ 1305, %36 ], [ 1309, %39 ], [ 1313, %44 ], [ 1317, %45 ]
  %.0.ph = phi i32 [ %15, %16 ], [ -1, %18 ], [ -1, %21 ], [ -1, %23 ], [ -1, %25 ], [ -1, %27 ], [ -1, %30 ], [ -1, %33 ], [ -1, %36 ], [ -1, %39 ], [ -1, %44 ], [ -1, %45 ]
  %47 = load ptr, ptr @stderr, align 8, !tbaa !11
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef %.sink33, ptr noundef nonnull @__FUNCTION__.x509_tbs_crl_from_der) #5
  br label %.thread32

.thread32:                                        ; preds = %.thread32.sink.split, %45, %44, %16
  %.0 = phi i32 [ %15, %16 ], [ 1, %45 ], [ 1, %44 ], [ %.0.ph, %.thread32.sink.split ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #4
  ret i32 %.0
}

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

declare i32 @x509_explicit_exts_from_der(i32 noundef, ptr noundef, ptr 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 = { 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 = !{!"long", !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 = !{!"any pointer", !7, i64 0}


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