; LLVM IR from aws/s2n-tls :: crypto (s2n_certificate)

; 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.s2n_debug_info = type { ptr, ptr }
%struct.s2n_result = type { i32 }
%struct.s2n_cert_chain_and_key = type { ptr, ptr, %struct.s2n_blob, %struct.s2n_blob, ptr, ptr, ptr }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.GENERAL_NAME_st = type { i32, %union.anon }
%union.anon = type { ptr }
%struct.asn1_string_st = type { i32, i32, ptr, i64 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.11 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strrchr(ptr noundef, i32 noundef) #1

declare i32 @s2n_calculate_stacktrace() #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #3

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #5

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_cert_chain_and_key_load_sans(ptr noundef %0, ptr noundef %1) #6 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %struct.s2n_result, align 4
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %2
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.s2n_cert_chain_and_key, ptr %18, i32 0, i32 4
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = icmp ne ptr %20, null
  br i1 %21, label %53, label %22

22:                                               ; preds = %17
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  %25 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %26 = getelementptr inbounds %struct.s2n_debug_info, ptr %25, i32 0, i32 0
  store ptr @.str.11, ptr %26, align 8, !tbaa !13
  %27 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %28 = getelementptr inbounds %struct.s2n_debug_info, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = getelementptr inbounds i8, ptr %29, i64 21
  %31 = call ptr @strrchr(ptr noundef %30, i32 noundef 47) #7
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %40

33:                                               ; preds = %24
  %34 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %35 = getelementptr inbounds %struct.s2n_debug_info, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !13
  %37 = getelementptr inbounds i8, ptr %36, i64 21
  %38 = call ptr @strrchr(ptr noundef %37, i32 noundef 47) #7
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  br label %45

40:                                               ; preds = %24
  %41 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %42 = getelementptr inbounds %struct.s2n_debug_info, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !13
  %44 = getelementptr inbounds i8, ptr %43, i64 21
  br label %45

45:                                               ; preds = %40, %33
  %46 = phi ptr [ %39, %33 ], [ %44, %40 ]
  %47 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %48 = getelementptr inbounds %struct.s2n_debug_info, ptr %47, i32 0, i32 1
  store ptr %46, ptr %48, align 8, !tbaa !15
  %49 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %49, align 4, !tbaa !16
  %50 = call i32 @s2n_calculate_stacktrace()
  br label %51

51:                                               ; preds = %45
  store i32 -1, ptr %3, align 4
  br label %281

52:                                               ; No predecessors!
  br label %53

53:                                               ; preds = %52, %17
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %89, label %58

58:                                               ; preds = %55
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %62 = getelementptr inbounds %struct.s2n_debug_info, ptr %61, i32 0, i32 0
  store ptr @.str.12, ptr %62, align 8, !tbaa !13
  %63 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %64 = getelementptr inbounds %struct.s2n_debug_info, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !13
  %66 = getelementptr inbounds i8, ptr %65, i64 21
  %67 = call ptr @strrchr(ptr noundef %66, i32 noundef 47) #7
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %76

69:                                               ; preds = %60
  %70 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %71 = getelementptr inbounds %struct.s2n_debug_info, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !13
  %73 = getelementptr inbounds i8, ptr %72, i64 21
  %74 = call ptr @strrchr(ptr noundef %73, i32 noundef 47) #7
  %75 = getelementptr inbounds i8, ptr %74, i64 1
  br label %81

76:                                               ; preds = %60
  %77 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %78 = getelementptr inbounds %struct.s2n_debug_info, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !13
  %80 = getelementptr inbounds i8, ptr %79, i64 21
  br label %81

81:                                               ; preds = %76, %69
  %82 = phi ptr [ %75, %69 ], [ %80, %76 ]
  %83 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %84 = getelementptr inbounds %struct.s2n_debug_info, ptr %83, i32 0, i32 1
  store ptr %82, ptr %84, align 8, !tbaa !15
  %85 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %85, align 4, !tbaa !16
  %86 = call i32 @s2n_calculate_stacktrace()
  br label %87

87:                                               ; preds = %81
  store i32 -1, ptr %3, align 4
  br label %281

88:                                               ; No predecessors!
  br label %89

89:                                               ; preds = %88, %55
  br label %90

90:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = call ptr @X509_get_ext_d2i(ptr noundef %91, i32 noundef 85, ptr noundef null, ptr noundef null)
  store ptr %92, ptr %6, align 8, !tbaa !5
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = icmp eq ptr %93, null
  br i1 %94, label %95, label %96

95:                                               ; preds = %90
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %280

96:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = call ptr @ossl_check_const_GENERAL_NAME_sk_type(ptr noundef %97)
  %99 = call i32 @OPENSSL_sk_num(ptr noundef %98)
  store i32 %99, ptr %8, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !16
  br label %100

100:                                              ; preds = %273, %96
  %101 = load i32, ptr %9, align 4, !tbaa !16
  %102 = load i32, ptr %8, align 4, !tbaa !16
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 14, ptr %7, align 4
  br label %276

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = call ptr @ossl_check_const_GENERAL_NAME_sk_type(ptr noundef %106)
  %108 = load i32, ptr %9, align 4, !tbaa !16
  %109 = call ptr @OPENSSL_sk_value(ptr noundef %107, i32 noundef %108)
  store ptr %109, ptr %10, align 8, !tbaa !5
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = icmp ne ptr %110, null
  br i1 %111, label %113, label %112

112:                                              ; preds = %105
  store i32 16, ptr %7, align 4
  br label %270

113:                                              ; preds = %105
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.GENERAL_NAME_st, ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !17
  %117 = icmp eq i32 %116, 2
  br i1 %117, label %118, label %269

118:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.GENERAL_NAME_st, ptr %119, i32 0, i32 1
  %121 = load ptr, ptr %120, align 8, !tbaa !19
  %122 = getelementptr inbounds %struct.asn1_string_st, ptr %121, i32 0, i32 2
  %123 = load ptr, ptr %122, align 8, !tbaa !20
  store ptr %123, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %124 = load ptr, ptr %10, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.GENERAL_NAME_st, ptr %124, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !19
  %127 = getelementptr inbounds %struct.asn1_string_st, ptr %126, i32 0, i32 0
  %128 = load i32, ptr %127, align 8, !tbaa !23
  %129 = sext i32 %128 to i64
  store i64 %129, ptr %12, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store ptr null, ptr %13, align 8, !tbaa !5
  br label %130

130:                                              ; preds = %118
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.s2n_cert_chain_and_key, ptr %131, i32 0, i32 4
  %133 = load ptr, ptr %132, align 8, !tbaa !9
  %134 = call i32 @s2n_array_pushback(ptr noundef %133, ptr noundef %13)
  %135 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 %134, ptr %135, align 4
  %136 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  %137 = load i32, ptr %136, align 4
  %138 = call zeroext i1 @s2n_result_is_ok(i32 %137)
  br i1 %138, label %140, label %139

139:                                              ; preds = %130
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %266

140:                                              ; preds = %130
  br label %141

141:                                              ; preds = %140
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %13, align 8, !tbaa !5
  %144 = icmp ne ptr %143, null
  br i1 %144, label %178, label %145

145:                                              ; preds = %142
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  %148 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %149 = getelementptr inbounds %struct.s2n_debug_info, ptr %148, i32 0, i32 0
  store ptr @.str.13, ptr %149, align 8, !tbaa !13
  %150 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %151 = getelementptr inbounds %struct.s2n_debug_info, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !13
  %153 = getelementptr inbounds i8, ptr %152, i64 21
  %154 = call ptr @strrchr(ptr noundef %153, i32 noundef 47) #7
  %155 = icmp ne ptr %154, null
  br i1 %155, label %156, label %163

156:                                              ; preds = %147
  %157 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %158 = getelementptr inbounds %struct.s2n_debug_info, ptr %157, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !13
  %160 = getelementptr inbounds i8, ptr %159, i64 21
  %161 = call ptr @strrchr(ptr noundef %160, i32 noundef 47) #7
  %162 = getelementptr inbounds i8, ptr %161, i64 1
  br label %168

163:                                              ; preds = %147
  %164 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %165 = getelementptr inbounds %struct.s2n_debug_info, ptr %164, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !13
  %167 = getelementptr inbounds i8, ptr %166, i64 21
  br label %168

168:                                              ; preds = %163, %156
  %169 = phi ptr [ %162, %156 ], [ %167, %163 ]
  %170 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %171 = getelementptr inbounds %struct.s2n_debug_info, ptr %170, i32 0, i32 1
  store ptr %169, ptr %171, align 8, !tbaa !15
  %172 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653241, ptr %172, align 4, !tbaa !16
  %173 = call i32 @s2n_calculate_stacktrace()
  br label %174

174:                                              ; preds = %168
  br label %175

175:                                              ; preds = %174
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %266

176:                                              ; No predecessors!
  br label %177

177:                                              ; preds = %176
  br label %178

178:                                              ; preds = %177, %142
  %179 = load ptr, ptr %13, align 8, !tbaa !5
  %180 = load i64, ptr %12, align 8, !tbaa !24
  %181 = trunc i64 %180 to i32
  %182 = call i32 @s2n_alloc(ptr noundef %179, i32 noundef %181)
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %188

184:                                              ; preds = %178
  br label %185

185:                                              ; preds = %184
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %266

186:                                              ; No predecessors!
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187, %178
  br label %189

189:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %190 = load i64, ptr %12, align 8, !tbaa !24
  store i64 %190, ptr %15, align 8, !tbaa !24
  %191 = load i64, ptr %15, align 8, !tbaa !24
  %192 = icmp ne i64 %191, 0
  %193 = xor i1 %192, true
  %194 = xor i1 %193, true
  %195 = zext i1 %194 to i32
  %196 = sext i32 %195 to i64
  %197 = call i64 @llvm.expect.i64(i64 %196, i64 1)
  %198 = icmp ne i64 %197, 0
  br i1 %198, label %199, label %248

199:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %200 = load ptr, ptr %13, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.s2n_blob, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !25
  %203 = load ptr, ptr %11, align 8, !tbaa !5
  %204 = load i64, ptr %15, align 8, !tbaa !24
  %205 = call ptr @s2n_ensure_memmove_trace(ptr noundef %202, ptr noundef %203, i64 noundef %204)
  store ptr %205, ptr %16, align 8, !tbaa !5
  br label %206

206:                                              ; preds = %199
  %207 = load ptr, ptr %16, align 8, !tbaa !5
  %208 = icmp ne ptr %207, null
  br i1 %208, label %242, label %209

209:                                              ; preds = %206
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  %212 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %213 = getelementptr inbounds %struct.s2n_debug_info, ptr %212, i32 0, i32 0
  store ptr @.str.14, ptr %213, align 8, !tbaa !13
  %214 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %215 = getelementptr inbounds %struct.s2n_debug_info, ptr %214, i32 0, i32 0
  %216 = load ptr, ptr %215, align 8, !tbaa !13
  %217 = getelementptr inbounds i8, ptr %216, i64 21
  %218 = call ptr @strrchr(ptr noundef %217, i32 noundef 47) #7
  %219 = icmp ne ptr %218, null
  br i1 %219, label %220, label %227

220:                                              ; preds = %211
  %221 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %222 = getelementptr inbounds %struct.s2n_debug_info, ptr %221, i32 0, i32 0
  %223 = load ptr, ptr %222, align 8, !tbaa !13
  %224 = getelementptr inbounds i8, ptr %223, i64 21
  %225 = call ptr @strrchr(ptr noundef %224, i32 noundef 47) #7
  %226 = getelementptr inbounds i8, ptr %225, i64 1
  br label %232

227:                                              ; preds = %211
  %228 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %229 = getelementptr inbounds %struct.s2n_debug_info, ptr %228, i32 0, i32 0
  %230 = load ptr, ptr %229, align 8, !tbaa !13
  %231 = getelementptr inbounds i8, ptr %230, i64 21
  br label %232

232:                                              ; preds = %227, %220
  %233 = phi ptr [ %226, %220 ], [ %231, %227 ]
  %234 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %235 = getelementptr inbounds %struct.s2n_debug_info, ptr %234, i32 0, i32 1
  store ptr %233, ptr %235, align 8, !tbaa !15
  %236 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %236, align 4, !tbaa !16
  %237 = call i32 @s2n_calculate_stacktrace()
  br label %238

238:                                              ; preds = %232
  br label %239

239:                                              ; preds = %238
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %245

240:                                              ; No predecessors!
  br label %241

241:                                              ; preds = %240
  br label %242

242:                                              ; preds = %241, %206
  br label %243

243:                                              ; preds = %242
  br label %244

244:                                              ; preds = %243
  store i32 0, ptr %7, align 4
  br label %245

245:                                              ; preds = %244, %239
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  %246 = load i32, ptr %7, align 4
  switch i32 %246, label %249 [
    i32 0, label %247
  ]

247:                                              ; preds = %245
  br label %248

248:                                              ; preds = %247, %189
  store i32 0, ptr %7, align 4
  br label %249

249:                                              ; preds = %248, %245
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  %250 = load i32, ptr %7, align 4
  switch i32 %250, label %266 [
    i32 0, label %251
  ]

251:                                              ; preds = %249
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252
  %254 = load i64, ptr %12, align 8, !tbaa !24
  %255 = trunc i64 %254 to i32
  %256 = load ptr, ptr %13, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.s2n_blob, ptr %256, i32 0, i32 1
  store i32 %255, ptr %257, align 8, !tbaa !26
  br label %258

258:                                              ; preds = %253
  %259 = load ptr, ptr %13, align 8, !tbaa !5
  %260 = call i32 @s2n_blob_char_to_lower(ptr noundef %259)
  %261 = icmp sgt i32 %260, -1
  br i1 %261, label %263, label %262

262:                                              ; preds = %258
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %266

263:                                              ; preds = %258
  br label %264

264:                                              ; preds = %263
  br label %265

265:                                              ; preds = %264
  store i32 0, ptr %7, align 4
  br label %266

266:                                              ; preds = %265, %262, %249, %185, %175, %139
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %267 = load i32, ptr %7, align 4
  switch i32 %267, label %270 [
    i32 0, label %268
  ]

268:                                              ; preds = %266
  br label %269

269:                                              ; preds = %268, %113
  store i32 0, ptr %7, align 4
  br label %270

270:                                              ; preds = %269, %266, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %271 = load i32, ptr %7, align 4
  switch i32 %271, label %276 [
    i32 0, label %272
    i32 16, label %273
  ]

272:                                              ; preds = %270
  br label %273

273:                                              ; preds = %272, %270
  %274 = load i32, ptr %9, align 4, !tbaa !16
  %275 = add nsw i32 %274, 1
  store i32 %275, ptr %9, align 4, !tbaa !16
  br label %100, !llvm.loop !27

276:                                              ; preds = %270, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  %277 = load i32, ptr %7, align 4
  switch i32 %277, label %279 [
    i32 14, label %278
  ]

278:                                              ; preds = %276
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %279

279:                                              ; preds = %278, %276
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %280

280:                                              ; preds = %279, %95
  call void @GENERAL_NAMES_free_pointer(ptr noundef %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  br label %281

281:                                              ; preds = %280, %87, %51
  %282 = load i32, ptr %3, align 4
  ret i32 %282
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @GENERAL_NAMES_free_pointer(ptr noundef) #3

declare i32 @OPENSSL_sk_num(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ossl_check_const_GENERAL_NAME_sk_type(ptr noundef) #3

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

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

declare i32 @s2n_blob_char_to_lower(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #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 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { 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 #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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, !6, i64 64}
!10 = !{!"s2n_cert_chain_and_key", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 40, !6, i64 64, !6, i64 72, !6, i64 80}
!11 = !{!"s2n_blob", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !12, i64 0}
!18 = !{!"GENERAL_NAME_st", !12, i64 0, !7, i64 8}
!19 = !{!7, !7, i64 0}
!20 = !{!21, !6, i64 8}
!21 = !{!"asn1_string_st", !12, i64 0, !12, i64 4, !6, i64 8, !22, i64 16}
!22 = !{!"long", !7, i64 0}
!23 = !{!21, !12, i64 0}
!24 = !{!22, !22, i64 0}
!25 = !{!11, !6, i64 0}
!26 = !{!11, !12, i64 8}
!27 = distinct !{!27, !28}
!28 = !{!"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"

%struct.s2n_debug_info = type { ptr, ptr }

@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.11 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #3

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

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

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

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_cert_chain_and_key_load_sans(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #5 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %7, label %15

7:                                                ; preds = %2
  %8 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.11, ptr %8, align 8, !tbaa !12
  %9 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.11, i64 21), i32 noundef 47) #6
  %.not42 = icmp eq ptr %9, null
  %10 = getelementptr inbounds i8, ptr %9, i64 1
  %11 = select i1 %.not42, ptr getelementptr inbounds (i8, ptr @.str.11, i64 21), ptr %10
  %12 = getelementptr inbounds i8, ptr %8, i64 8
  store ptr %11, ptr %12, align 8, !tbaa !14
  %13 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %13, align 4, !tbaa !15
  %14 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %68

15:                                               ; preds = %2
  %.not43 = icmp eq ptr %1, null
  br i1 %.not43, label %16, label %24

16:                                               ; preds = %15
  %17 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.12, ptr %17, align 8, !tbaa !12
  %18 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.12, i64 21), i32 noundef 47) #6
  %.not44 = icmp eq ptr %18, null
  %19 = getelementptr inbounds i8, ptr %18, i64 1
  %20 = select i1 %.not44, ptr getelementptr inbounds (i8, ptr @.str.12, i64 21), ptr %19
  %21 = getelementptr inbounds i8, ptr %17, i64 8
  store ptr %20, ptr %21, align 8, !tbaa !14
  %22 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %22, align 4, !tbaa !15
  %23 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %68

24:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %25 = tail call ptr @X509_get_ext_d2i(ptr noundef nonnull %1, i32 noundef 85, ptr noundef null, ptr noundef null) #7
  store ptr %25, ptr %3, align 8, !tbaa !16
  %26 = icmp eq ptr %25, null
  br i1 %26, label %67, label %27

27:                                               ; preds = %24
  %28 = tail call ptr @ossl_check_const_GENERAL_NAME_sk_type(ptr noundef nonnull %25)
  %29 = tail call i32 @OPENSSL_sk_num(ptr noundef %28) #7
  %.not5264 = icmp sgt i32 %29, 0
  br i1 %.not5264, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %27, %65
  %.not5266 = phi i1 [ %.not52, %65 ], [ true, %27 ]
  %.03265 = phi i32 [ %66, %65 ], [ 0, %27 ]
  %30 = call ptr @ossl_check_const_GENERAL_NAME_sk_type(ptr noundef nonnull %25)
  %31 = call ptr @OPENSSL_sk_value(ptr noundef %30, i32 noundef %.03265) #7
  %.not45 = icmp eq ptr %31, null
  br i1 %.not45, label %65, label %32

32:                                               ; preds = %.lr.ph
  %33 = load i32, ptr %31, align 8, !tbaa !17
  %34 = icmp eq i32 %33, 2
  br i1 %34, label %35, label %65

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %31, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !19
  %38 = getelementptr inbounds i8, ptr %37, i64 8
  %39 = load ptr, ptr %38, align 8, !tbaa !20
  %40 = load i32, ptr %37, align 8, !tbaa !23
  %41 = sext i32 %40 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  store ptr null, ptr %4, align 8, !tbaa !16
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = call i32 @s2n_array_pushback(ptr noundef %42, ptr noundef nonnull %4) #7
  %44 = call zeroext i1 @s2n_result_is_ok(i32 %43)
  br i1 %44, label %45, label %.loopexit58

45:                                               ; preds = %35
  %46 = load ptr, ptr %4, align 8, !tbaa !16
  %.not46 = icmp eq ptr %46, null
  br i1 %.not46, label %.loopexit58.sink.split, label %47

47:                                               ; preds = %45
  %48 = call i32 @s2n_alloc(ptr noundef nonnull %46, i32 noundef %40) #7
  %.not48 = icmp eq i32 %48, 0
  br i1 %.not48, label %49, label %.loopexit58

49:                                               ; preds = %47
  %.not49 = icmp eq i32 %40, 0
  br i1 %.not49, label %.critedge54, label %50, !prof !24

50:                                               ; preds = %49
  %51 = load ptr, ptr %4, align 8, !tbaa !16
  %52 = load ptr, ptr %51, align 8, !tbaa !25
  %53 = call ptr @s2n_ensure_memmove_trace(ptr noundef %52, ptr noundef %39, i64 noundef %41) #7
  %.not50.not = icmp eq ptr %53, null
  br i1 %.not50.not, label %.loopexit58.sink.split, label %.critedge54

.critedge54:                                      ; preds = %50, %49
  %54 = load ptr, ptr %4, align 8, !tbaa !16
  %55 = getelementptr inbounds i8, ptr %54, i64 8
  store i32 %40, ptr %55, align 8, !tbaa !26
  %56 = call i32 @s2n_blob_char_to_lower(ptr noundef %54) #7
  %57 = icmp sgt i32 %56, -1
  br i1 %57, label %.critedge56, label %.loopexit58

.critedge56:                                      ; preds = %.critedge54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %65

.loopexit58.sink.split:                           ; preds = %50, %45
  %.str.13.sink = phi ptr [ @.str.13, %45 ], [ @.str.14, %50 ]
  %.sink83 = phi ptr [ getelementptr inbounds (i8, ptr @.str.13, i64 21), %45 ], [ getelementptr inbounds (i8, ptr @.str.14, i64 21), %50 ]
  %.sink = phi i32 [ 402653241, %45 ], [ 402653193, %50 ]
  %58 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.13.sink, ptr %58, align 8, !tbaa !12
  %59 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink83, i32 noundef 47) #6
  %.not47 = icmp eq ptr %59, null
  %60 = getelementptr inbounds i8, ptr %59, i64 1
  %61 = select i1 %.not47, ptr %.sink83, ptr %60
  %62 = getelementptr inbounds i8, ptr %58, i64 8
  store ptr %61, ptr %62, align 8, !tbaa !14
  %63 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %63, align 4, !tbaa !15
  %64 = call i32 @s2n_calculate_stacktrace() #7
  br label %.loopexit58

.loopexit58:                                      ; preds = %35, %47, %.critedge54, %.loopexit58.sink.split
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %.loopexit

65:                                               ; preds = %.lr.ph, %.critedge56, %32
  %66 = add nuw nsw i32 %.03265, 1
  %.not52 = icmp slt i32 %66, %29
  %exitcond.not = icmp eq i32 %66, %29
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !27

.loopexit:                                        ; preds = %65, %27, %.loopexit58
  %.not5262 = phi i1 [ %.not5266, %.loopexit58 ], [ false, %27 ], [ %.not52, %65 ]
  %spec.select = sext i1 %.not5262 to i32
  br label %67

67:                                               ; preds = %24, %.loopexit
  %.9 = phi i32 [ %spec.select, %.loopexit ], [ 0, %24 ]
  call void @GENERAL_NAMES_free_pointer(ptr noundef nonnull %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %68

68:                                               ; preds = %67, %16, %7
  %.10 = phi i32 [ %.9, %67 ], [ -1, %16 ], [ -1, %7 ]
  ret i32 %.10
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @GENERAL_NAMES_free_pointer(ptr noundef) local_unnamed_addr #3

declare i32 @OPENSSL_sk_num(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ossl_check_const_GENERAL_NAME_sk_type(ptr noundef) local_unnamed_addr #3

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

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

declare i32 @s2n_blob_char_to_lower(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #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 = { inlinehint 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nounwind willreturn memory(read) }
attributes #7 = { 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, !7, i64 64}
!6 = !{!"s2n_cert_chain_and_key", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 40, !7, i64 64, !7, i64 72, !7, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"s2n_blob", !7, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!14 = !{!13, !7, i64 8}
!15 = !{!11, !11, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !11, i64 0}
!18 = !{!"GENERAL_NAME_st", !11, i64 0, !8, i64 8}
!19 = !{!8, !8, i64 0}
!20 = !{!21, !7, i64 8}
!21 = !{!"asn1_string_st", !11, i64 0, !11, i64 4, !7, i64 8, !22, i64 16}
!22 = !{!"long", !8, i64 0}
!23 = !{!21, !11, i64 0}
!24 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!25 = !{!10, !7, i64 0}
!26 = !{!10, !11, i64 8}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass