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

; 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_exts_check = external hidden unnamed_addr constant [16 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 @x509_ext_from_der(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

declare i32 @asn1_length_is_zero(i64 noundef) #3

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @x509_exts_check(ptr noundef %0, i64 noundef %1, i32 noundef %2, ptr noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca [32 x i32], align 16
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca [7 x i32], align 16
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !11
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 128, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 -1, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 -1, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 28, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 -1, ptr %24, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %185, %4
  %26 = load i64, ptr %7, align 8, !tbaa !9
  %27 = icmp ne i64 %26, 0
  br i1 %27, label %28, label %186

28:                                               ; preds = %25
  %29 = getelementptr inbounds [32 x i32], ptr %11, i64 0, i64 0
  %30 = call i32 @x509_ext_from_der(ptr noundef %10, ptr noundef %29, ptr noundef %12, ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %6, ptr noundef %7)
  %31 = icmp ne i32 %30, 1
  br i1 %31, label %32, label %38

32:                                               ; preds = %28
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2846, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %36

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %36
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

38:                                               ; preds = %28
  %39 = load i32, ptr %10, align 4, !tbaa !11
  switch i32 %39, label %175 [
    i32 44, label %40
    i32 45, label %50
    i32 46, label %85
    i32 47, label %185
    i32 48, label %109
    i32 49, label %185
    i32 50, label %119
    i32 51, label %129
    i32 52, label %139
    i32 55, label %157
    i32 53, label %174
    i32 54, label %174
    i32 56, label %174
    i32 57, label %174
    i32 58, label %174
  ]

40:                                               ; preds = %38
  %41 = load i32, ptr %13, align 4, !tbaa !11
  %42 = icmp eq i32 %41, 1
  br i1 %42, label %43, label %49

43:                                               ; preds = %40
  br label %44

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

47:                                               ; preds = %44
  br label %48

48:                                               ; preds = %47
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

49:                                               ; preds = %40
  br label %185

50:                                               ; preds = %38
  %51 = load i32, ptr %13, align 4, !tbaa !11
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %53, label %59

53:                                               ; preds = %50
  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 2865, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %57

57:                                               ; preds = %54
  br label %58

58:                                               ; preds = %57
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

59:                                               ; preds = %50
  %60 = call i32 @asn1_type_from_der(i32 noundef 4, ptr noundef %22, ptr noundef %23, ptr noundef %14, ptr noundef %15)
  %61 = icmp ne i32 %60, 1
  br i1 %61, label %66, label %62

62:                                               ; preds = %59
  %63 = load i64, ptr %15, align 8, !tbaa !9
  %64 = call i32 @asn1_length_is_zero(i64 noundef %63)
  %65 = icmp ne i32 %64, 1
  br i1 %65, label %66, label %72

66:                                               ; preds = %62, %59
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2872, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %70

70:                                               ; preds = %67
  br label %71

71:                                               ; preds = %70
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

72:                                               ; preds = %62
  %73 = load ptr, ptr %22, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %78

75:                                               ; preds = %72
  %76 = load i64, ptr %23, align 8, !tbaa !9
  %77 = icmp ne i64 %76, 0
  br i1 %77, label %84, label %78

78:                                               ; preds = %75, %72
  br label %79

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

82:                                               ; preds = %79
  br label %83

83:                                               ; preds = %82
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

84:                                               ; preds = %75
  br label %185

85:                                               ; preds = %38
  %86 = load i32, ptr %13, align 4, !tbaa !11
  %87 = icmp ne i32 %86, 1
  br i1 %87, label %88, label %94

88:                                               ; preds = %85
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr @stderr, align 8, !tbaa !5
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %90, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2882, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %92

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93, %85
  %95 = call i32 @asn1_bits_from_der_ex(i32 noundef 3, ptr noundef %18, ptr noundef %14, ptr noundef %15)
  %96 = icmp ne i32 %95, 1
  br i1 %96, label %102, label %97

97:                                               ; preds = %94
  %98 = load i32, ptr %18, align 4, !tbaa !11
  %99 = load i32, ptr %8, align 4, !tbaa !11
  %100 = call i32 @x509_key_usage_check(i32 noundef %98, i32 noundef %99)
  %101 = icmp ne i32 %100, 1
  br i1 %101, label %102, label %108

102:                                              ; preds = %97, %94
  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 2887, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %106

106:                                              ; preds = %103
  br label %107

107:                                              ; preds = %106
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

108:                                              ; preds = %97
  br label %185

109:                                              ; preds = %38
  %110 = load i32, ptr %13, align 4, !tbaa !11
  %111 = icmp ne i32 %110, 1
  br i1 %111, label %112, label %118

112:                                              ; preds = %109
  br label %113

113:                                              ; preds = %112
  %114 = load ptr, ptr @stderr, align 8, !tbaa !5
  %115 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2895, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %116

116:                                              ; preds = %113
  br label %117

117:                                              ; preds = %116
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

118:                                              ; preds = %109
  br label %185

119:                                              ; preds = %38
  %120 = load i32, ptr %13, align 4, !tbaa !11
  %121 = icmp eq i32 %120, 1
  br i1 %121, label %122, label %128

122:                                              ; preds = %119
  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 2903, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %126

126:                                              ; preds = %123
  br label %127

127:                                              ; preds = %126
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

128:                                              ; preds = %119
  br label %185

129:                                              ; preds = %38
  %130 = load i32, ptr %13, align 4, !tbaa !11
  %131 = icmp eq i32 %130, 1
  br i1 %131, label %132, label %138

132:                                              ; preds = %129
  br label %133

133:                                              ; preds = %132
  %134 = load ptr, ptr @stderr, align 8, !tbaa !5
  %135 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2909, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %136

136:                                              ; preds = %133
  br label %137

137:                                              ; preds = %136
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

138:                                              ; preds = %129
  br label %185

139:                                              ; preds = %38
  %140 = call i32 @x509_basic_constraints_from_der(ptr noundef %16, ptr noundef %17, ptr noundef %14, ptr noundef %15)
  %141 = icmp ne i32 %140, 1
  br i1 %141, label %148, label %142

142:                                              ; preds = %139
  %143 = load i32, ptr %16, align 4, !tbaa !11
  %144 = load i32, ptr %17, align 4, !tbaa !11
  %145 = load i32, ptr %8, align 4, !tbaa !11
  %146 = call i32 @x509_basic_constraints_check(i32 noundef %143, i32 noundef %144, i32 noundef %145)
  %147 = icmp ne i32 %146, 1
  br i1 %147, label %148, label %154

148:                                              ; preds = %142, %139
  br label %149

149:                                              ; preds = %148
  %150 = load ptr, ptr @stderr, align 8, !tbaa !5
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %150, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2917, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %152

152:                                              ; preds = %149
  br label %153

153:                                              ; preds = %152
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

154:                                              ; preds = %142
  %155 = load i32, ptr %17, align 4, !tbaa !11
  %156 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %155, ptr %156, align 4, !tbaa !11
  br label %185

157:                                              ; preds = %38
  %158 = getelementptr inbounds [7 x i32], ptr %19, i64 0, i64 0
  %159 = call i32 @x509_ext_key_usage_from_der(ptr noundef %158, ptr noundef %20, i64 noundef 7, ptr noundef %14, ptr noundef %15)
  %160 = icmp ne i32 %159, 1
  br i1 %160, label %167, label %161

161:                                              ; preds = %157
  %162 = getelementptr inbounds [7 x i32], ptr %19, i64 0, i64 0
  %163 = load i64, ptr %20, align 8, !tbaa !9
  %164 = load i32, ptr %8, align 4, !tbaa !11
  %165 = call i32 @x509_ext_key_usage_check(ptr noundef %162, i64 noundef %163, i32 noundef %164)
  %166 = icmp ne i32 %165, 1
  br i1 %166, label %167, label %173

167:                                              ; preds = %161, %157
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr @stderr, align 8, !tbaa !5
  %170 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %169, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2927, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %171

171:                                              ; preds = %168
  br label %172

172:                                              ; preds = %171
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

173:                                              ; preds = %161
  br label %185

174:                                              ; preds = %38, %38, %38, %38, %38
  br label %185

175:                                              ; preds = %38
  %176 = load i32, ptr %13, align 4, !tbaa !11
  %177 = icmp eq i32 %176, 1
  br i1 %177, label %178, label %184

178:                                              ; preds = %175
  br label %179

179:                                              ; preds = %178
  %180 = load ptr, ptr @stderr, align 8, !tbaa !5
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %180, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2941, ptr noundef @__FUNCTION__.x509_exts_check) #4
  br label %182

182:                                              ; preds = %179
  br label %183

183:                                              ; preds = %182
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

184:                                              ; preds = %175
  br label %185

185:                                              ; preds = %184, %174, %173, %154, %138, %128, %118, %108, %84, %49, %38, %38
  br label %25, !llvm.loop !13

186:                                              ; preds = %25
  store i32 1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %187

187:                                              ; preds = %186, %183, %172, %153, %137, %127, %117, %107, %83, %71, %58, %48, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 28, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %188 = load i32, ptr %5, align 4
  ret i32 %188
}

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 = { 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"}


; 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_exts_check = external hidden unnamed_addr constant [16 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 @x509_ext_from_der(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr 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 #3

declare i32 @asn1_length_is_zero(i64 noundef) local_unnamed_addr #3

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @x509_exts_check(ptr noundef %0, i64 noundef %1, i32 noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca [32 x i32], align 16
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca [7 x i32], align 16
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #4
  store i32 -1, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #4
  store i32 -1, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #4
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #4
  store i32 -1, ptr %3, align 4, !tbaa !11
  %.not17 = icmp eq i64 %1, 0
  br i1 %.not17, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %4, %73
  %20 = call i32 @x509_ext_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 %5, ptr noundef nonnull %6)
  %.not6 = icmp eq i32 %20, 1
  br i1 %.not6, label %21, label %.loopexit.sink.split

21:                                               ; preds = %.lr.ph
  %22 = load i32, ptr %7, align 4, !tbaa !11
  switch i32 %22, label %70 [
    i32 44, label %23
    i32 45, label %26
    i32 46, label %39
    i32 47, label %73
    i32 48, label %49
    i32 49, label %73
    i32 50, label %51
    i32 51, label %54
    i32 52, label %57
    i32 55, label %65
    i32 53, label %73
    i32 54, label %73
    i32 56, label %73
    i32 57, label %73
    i32 58, label %73
  ]

23:                                               ; preds = %21
  %24 = load i32, ptr %10, align 4, !tbaa !11
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %.loopexit.sink.split, label %73

26:                                               ; preds = %21
  %27 = load i32, ptr %10, align 4, !tbaa !11
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %.loopexit.sink.split, label %29

29:                                               ; preds = %26
  %30 = call i32 @asn1_type_from_der(i32 noundef 4, ptr noundef nonnull %18, ptr noundef nonnull %19, ptr noundef nonnull %11, ptr noundef nonnull %12) #4
  %.not15 = icmp eq i32 %30, 1
  br i1 %.not15, label %31, label %.loopexit.sink.split

31:                                               ; preds = %29
  %32 = load i64, ptr %12, align 8, !tbaa !9
  %33 = call i32 @asn1_length_is_zero(i64 noundef %32) #4
  %.not16 = icmp eq i32 %33, 1
  br i1 %.not16, label %34, label %.loopexit.sink.split

34:                                               ; preds = %31
  %35 = load ptr, ptr %18, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  %37 = load i64, ptr %19, align 8
  %38 = icmp ne i64 %37, 0
  %or.cond = select i1 %36, i1 %38, i1 false
  br i1 %or.cond, label %73, label %.loopexit.sink.split

39:                                               ; preds = %21
  %40 = load i32, ptr %10, align 4, !tbaa !11
  %.not12 = icmp eq i32 %40, 1
  br i1 %.not12, label %44, label %41

41:                                               ; preds = %39
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 2882, ptr noundef nonnull @__FUNCTION__.x509_exts_check) #5
  br label %44

44:                                               ; preds = %41, %39
  %45 = call i32 @asn1_bits_from_der_ex(i32 noundef 3, ptr noundef nonnull %15, ptr noundef nonnull %11, ptr noundef nonnull %12) #4
  %.not13 = icmp eq i32 %45, 1
  br i1 %.not13, label %46, label %.loopexit.sink.split

46:                                               ; preds = %44
  %47 = load i32, ptr %15, align 4, !tbaa !11
  %48 = call i32 @x509_key_usage_check(i32 noundef %47, i32 noundef %2)
  %.not14 = icmp eq i32 %48, 1
  br i1 %.not14, label %73, label %.loopexit.sink.split

49:                                               ; preds = %21
  %50 = load i32, ptr %10, align 4, !tbaa !11
  %.not11 = icmp eq i32 %50, 1
  br i1 %.not11, label %73, label %.loopexit.sink.split

51:                                               ; preds = %21
  %52 = load i32, ptr %10, align 4, !tbaa !11
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %.loopexit.sink.split, label %73

54:                                               ; preds = %21
  %55 = load i32, ptr %10, align 4, !tbaa !11
  %56 = icmp eq i32 %55, 1
  br i1 %56, label %.loopexit.sink.split, label %73

57:                                               ; preds = %21
  %58 = call i32 @x509_basic_constraints_from_der(ptr noundef nonnull %13, ptr noundef nonnull %14, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %.not9 = icmp eq i32 %58, 1
  br i1 %.not9, label %59, label %.loopexit.sink.split

59:                                               ; preds = %57
  %60 = load i32, ptr %13, align 4, !tbaa !11
  %61 = load i32, ptr %14, align 4, !tbaa !11
  %62 = call i32 @x509_basic_constraints_check(i32 noundef %60, i32 noundef %61, i32 noundef %2)
  %.not10 = icmp eq i32 %62, 1
  br i1 %.not10, label %63, label %.loopexit.sink.split

63:                                               ; preds = %59
  %64 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %64, ptr %3, align 4, !tbaa !11
  br label %73

65:                                               ; preds = %21
  %66 = call i32 @x509_ext_key_usage_from_der(ptr noundef nonnull %16, ptr noundef nonnull %17, i64 noundef 7, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %.not7 = icmp eq i32 %66, 1
  br i1 %.not7, label %67, label %.loopexit.sink.split

67:                                               ; preds = %65
  %68 = load i64, ptr %17, align 8, !tbaa !9
  %69 = call i32 @x509_ext_key_usage_check(ptr noundef nonnull %16, i64 noundef %68, i32 noundef %2)
  %.not8 = icmp eq i32 %69, 1
  br i1 %.not8, label %73, label %.loopexit.sink.split

70:                                               ; preds = %21
  %71 = load i32, ptr %10, align 4, !tbaa !11
  %72 = icmp eq i32 %71, 1
  br i1 %72, label %.loopexit.sink.split, label %73

73:                                               ; preds = %70, %21, %21, %21, %21, %21, %67, %54, %51, %49, %46, %34, %23, %63, %21, %21
  %74 = load i64, ptr %6, align 8, !tbaa !9
  %.not = icmp eq i64 %74, 0
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !13

.loopexit.sink.split:                             ; preds = %70, %67, %65, %59, %57, %54, %51, %49, %46, %44, %34, %31, %29, %26, %23, %.lr.ph
  %.sink18 = phi i32 [ 2846, %.lr.ph ], [ 2853, %23 ], [ 2865, %26 ], [ 2872, %29 ], [ 2872, %31 ], [ 2876, %34 ], [ 2887, %44 ], [ 2887, %46 ], [ 2895, %49 ], [ 2903, %51 ], [ 2909, %54 ], [ 2917, %57 ], [ 2917, %59 ], [ 2927, %65 ], [ 2927, %67 ], [ 2941, %70 ]
  %75 = load ptr, ptr @stderr, align 8, !tbaa !5
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef %.sink18, ptr noundef nonnull @__FUNCTION__.x509_exts_check) #5
  br label %.loopexit

.loopexit:                                        ; preds = %73, %.loopexit.sink.split, %4
  %.0 = phi i32 [ 1, %4 ], [ -1, %.loopexit.sink.split ], [ 1, %73 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #4
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  ret i32 %.0
}

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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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