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

; 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_pkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.s2n_x509_validator = type { ptr, ptr, i8, i8, i16, ptr, i32, ptr, %struct.s2n_cert_validation_info, i8 }
%struct.s2n_cert_validation_info = type { i8, [3 x i8] }
%struct.s2n_connection = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, [22 x i8], [22 x i8], [22 x i8], i32, i32, %struct.s2n_timer, i64, i64, [32 x i8], i8, i8, i8, i8, i8, i8, i8, ptr, ptr, %struct.s2n_secrets, ptr, ptr, %struct.s2n_kex_parameters, %struct.s2n_handshake_parameters, %struct.s2n_psk_parameters, ptr, i8, i32, [5 x i8], %struct.s2n_stuffer, %struct.s2n_stuffer, %struct.s2n_stuffer, %struct.s2n_stuffer, i32, i64, [2 x i8], %struct.s2n_stuffer, i8, i8, i8, i8, %struct.s2n_atomic_flag, %struct.s2n_atomic_flag, %struct.s2n_handshake, i16, i32, i16, i64, i8, i64, i64, i64, %struct.s2n_atomic_flag, %struct.s2n_atomic_flag, [256 x i8], [256 x i8], i32, %struct.s2n_blob, i32, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_client_hello, %struct.s2n_x509_validator, ptr, ptr, i8, i32, %struct.s2n_blob, i32, %struct.s2n_ticket_fields, [138 x i8], %struct.s2n_stuffer, %struct.s2n_blob, %struct.s2n_blob, i8, i8, i8, i16, i16, i32, i32, %struct.s2n_blob, i32, %struct.s2n_post_handshake, %struct.s2n_atomic_flag, i8, i8 }
%struct.s2n_timer = type { i64 }
%struct.s2n_secrets = type { %union.anon, i32 }
%union.anon = type { %struct.s2n_tls13_secrets }
%struct.s2n_tls13_secrets = type { [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], i32 }
%struct.s2n_kex_parameters = type { %struct.s2n_dh_params, %struct.s2n_ecc_evp_params, [4 x ptr], %struct.s2n_ecc_evp_params, %struct.s2n_kem_group_params, %struct.s2n_kem_group_params, [8 x ptr], %struct.s2n_kem_params, %struct.s2n_blob, %struct.s2n_blob }
%struct.s2n_dh_params = type { ptr }
%struct.s2n_ecc_evp_params = type { ptr, ptr }
%struct.s2n_kem_group_params = type { ptr, %struct.s2n_kem_params, %struct.s2n_ecc_evp_params }
%struct.s2n_kem_params = type { ptr, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, i8 }
%struct.s2n_handshake_parameters = type { %struct.s2n_pkey, %struct.s2n_pkey, %struct.s2n_blob, i32, %struct.s2n_sig_scheme_list, ptr, ptr, ptr, [4 x ptr], [4 x ptr], i8, i8, [32 x i8], [32 x i8] }
%struct.s2n_sig_scheme_list = type { [128 x i16], i8 }
%struct.s2n_psk_parameters = type { i32, %struct.s2n_array, i16, i16, ptr, i32 }
%struct.s2n_array = type { %struct.s2n_blob, i32, i32 }
%struct.s2n_handshake = type { %struct.s2n_stuffer, ptr, [8 x i8], [48 x i8], [48 x i8], i8, i32, i32, i32, i32, %struct.s2n_offered_early_data, i8, i32 }
%struct.s2n_offered_early_data = type { ptr }
%struct.s2n_client_hello = type { %struct.s2n_blob, %struct.s2n_parsed_extensions_list, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, i8, i8, i8 }
%struct.s2n_parsed_extensions_list = type { [21 x %struct.s2n_parsed_extension], %struct.s2n_blob, i16 }
%struct.s2n_parsed_extension = type { %struct.s2n_blob, i16, i16, i8 }
%struct.s2n_ticket_fields = type { %struct.s2n_blob, i32 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_post_handshake = type { %struct.s2n_stuffer, [4 x i8] }
%struct.s2n_atomic_flag = type { i32 }
%struct.s2n_config = type { i32, ptr, ptr, %struct.certs_by_type, %struct.s2n_blob, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i64, ptr, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, %struct.s2n_x509_trust_store, i16, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, i32, i32, ptr, ptr, i32, %struct.s2n_blob }
%struct.certs_by_type = type { [4 x ptr] }
%struct.s2n_x509_trust_store = type { ptr, i8 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.20 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.23 = 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

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

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

; 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) #5

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

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

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

21:                                               ; preds = %6
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %56, label %24

24:                                               ; preds = %21
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %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
  store ptr @.str.20, ptr %28, align 8, !tbaa !11
  %29 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %30 = getelementptr inbounds %struct.s2n_debug_info, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds i8, ptr %31, i64 21
  %33 = call ptr @strrchr(ptr noundef %32, i32 noundef 47) #8
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %42

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

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

47:                                               ; preds = %42, %35
  %48 = phi ptr [ %41, %35 ], [ %46, %42 ]
  %49 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %50 = getelementptr inbounds %struct.s2n_debug_info, ptr %49, i32 0, i32 1
  store ptr %48, ptr %50, align 8, !tbaa !13
  %51 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %51, align 4, !tbaa !9
  %52 = call i32 @s2n_calculate_stacktrace()
  br label %53

53:                                               ; preds = %47
  %54 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %54, align 4, !tbaa !14
  br label %265

55:                                               ; No predecessors!
  br label %56

56:                                               ; preds = %55, %21
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.s2n_x509_validator, ptr %58, i32 0, i32 9
  %60 = load i8, ptr %59, align 4, !tbaa !16, !range !21, !noundef !22
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %74

62:                                               ; preds = %57
  br label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = call i32 @s2n_x509_validator_handle_cert_validation_callback_result(ptr noundef %64)
  %66 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 %65, ptr %66, align 4
  %67 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  %68 = load i32, ptr %67, align 4
  %69 = call zeroext i1 @s2n_result_is_ok(i32 %68)
  br i1 %69, label %72, label %70

70:                                               ; preds = %63
  %71 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %71, align 4, !tbaa !14
  br label %265

72:                                               ; preds = %63
  br label %73

73:                                               ; preds = %72
  br label %160

74:                                               ; preds = %57
  br label %75

75:                                               ; preds = %74
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = call i32 @s2n_x509_validator_validate_cert_chain_pre_cb(ptr noundef %76, ptr noundef %77, ptr noundef %78, i32 noundef %79)
  %81 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  store i32 %80, ptr %81, align 4
  %82 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  %83 = load i32, ptr %82, align 4
  %84 = call zeroext i1 @s2n_result_is_ok(i32 %83)
  br i1 %84, label %87, label %85

85:                                               ; preds = %75
  %86 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %86, align 4, !tbaa !14
  br label %265

87:                                               ; preds = %75
  br label %88

88:                                               ; preds = %87
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.s2n_connection, ptr %89, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !23
  %92 = getelementptr inbounds %struct.s2n_config, ptr %91, i32 0, i32 32
  %93 = load ptr, ptr %92, align 8, !tbaa !46
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %159

95:                                               ; preds = %88
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.s2n_connection, ptr %97, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8, !tbaa !23
  %100 = getelementptr inbounds %struct.s2n_config, ptr %99, i32 0, i32 32
  %101 = load ptr, ptr %100, align 8, !tbaa !46
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.s2n_x509_validator, ptr %103, i32 0, i32 8
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.s2n_connection, ptr %105, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !23
  %108 = getelementptr inbounds %struct.s2n_config, ptr %107, i32 0, i32 33
  %109 = load ptr, ptr %108, align 8, !tbaa !50
  %110 = call i32 %101(ptr noundef %102, ptr noundef %104, ptr noundef %109)
  %111 = icmp eq i32 %110, 0
  br i1 %111, label %144, label %112

112:                                              ; preds = %96
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  %115 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %116 = getelementptr inbounds %struct.s2n_debug_info, ptr %115, i32 0, i32 0
  store ptr @.str.21, ptr %116, align 8, !tbaa !11
  %117 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %118 = getelementptr inbounds %struct.s2n_debug_info, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !11
  %120 = getelementptr inbounds i8, ptr %119, i64 21
  %121 = call ptr @strrchr(ptr noundef %120, i32 noundef 47) #8
  %122 = icmp ne ptr %121, null
  br i1 %122, label %123, label %130

123:                                              ; preds = %114
  %124 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %125 = getelementptr inbounds %struct.s2n_debug_info, ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8, !tbaa !11
  %127 = getelementptr inbounds i8, ptr %126, i64 21
  %128 = call ptr @strrchr(ptr noundef %127, i32 noundef 47) #8
  %129 = getelementptr inbounds i8, ptr %128, i64 1
  br label %135

130:                                              ; preds = %114
  %131 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %132 = getelementptr inbounds %struct.s2n_debug_info, ptr %131, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8, !tbaa !11
  %134 = getelementptr inbounds i8, ptr %133, i64 21
  br label %135

135:                                              ; preds = %130, %123
  %136 = phi ptr [ %129, %123 ], [ %134, %130 ]
  %137 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %138 = getelementptr inbounds %struct.s2n_debug_info, ptr %137, i32 0, i32 1
  store ptr %136, ptr %138, align 8, !tbaa !13
  %139 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544386, ptr %139, align 4, !tbaa !9
  %140 = call i32 @s2n_calculate_stacktrace()
  br label %141

141:                                              ; preds = %135
  %142 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %142, align 4, !tbaa !14
  br label %265

143:                                              ; No predecessors!
  br label %144

144:                                              ; preds = %143, %96
  br label %145

145:                                              ; preds = %144
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.s2n_x509_validator, ptr %146, i32 0, i32 9
  store i8 1, ptr %147, align 4, !tbaa !16
  br label %148

148:                                              ; preds = %145
  %149 = load ptr, ptr %8, align 8, !tbaa !5
  %150 = call i32 @s2n_x509_validator_handle_cert_validation_callback_result(ptr noundef %149)
  %151 = getelementptr inbounds %struct.s2n_result, ptr %16, i32 0, i32 0
  store i32 %150, ptr %151, align 4
  %152 = getelementptr inbounds %struct.s2n_result, ptr %16, i32 0, i32 0
  %153 = load i32, ptr %152, align 4
  %154 = call zeroext i1 @s2n_result_is_ok(i32 %153)
  br i1 %154, label %157, label %155

155:                                              ; preds = %148
  %156 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %156, align 4, !tbaa !14
  br label %265

157:                                              ; preds = %148
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158, %88
  br label %160

160:                                              ; preds = %159, %73
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr %8, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.s2n_x509_validator, ptr %162, i32 0, i32 5
  %164 = load ptr, ptr %163, align 8, !tbaa !51
  %165 = call ptr @ossl_check_const_X509_sk_type(ptr noundef %164)
  %166 = call i32 @OPENSSL_sk_num(ptr noundef %165)
  %167 = icmp sgt i32 %166, 0
  br i1 %167, label %200, label %168

168:                                              ; preds = %161
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  %171 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %172 = getelementptr inbounds %struct.s2n_debug_info, ptr %171, i32 0, i32 0
  store ptr @.str.22, ptr %172, align 8, !tbaa !11
  %173 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %174 = getelementptr inbounds %struct.s2n_debug_info, ptr %173, i32 0, i32 0
  %175 = load ptr, ptr %174, align 8, !tbaa !11
  %176 = getelementptr inbounds i8, ptr %175, i64 21
  %177 = call ptr @strrchr(ptr noundef %176, i32 noundef 47) #8
  %178 = icmp ne ptr %177, null
  br i1 %178, label %179, label %186

179:                                              ; preds = %170
  %180 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %181 = getelementptr inbounds %struct.s2n_debug_info, ptr %180, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8, !tbaa !11
  %183 = getelementptr inbounds i8, ptr %182, i64 21
  %184 = call ptr @strrchr(ptr noundef %183, i32 noundef 47) #8
  %185 = getelementptr inbounds i8, ptr %184, i64 1
  br label %191

186:                                              ; preds = %170
  %187 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %188 = getelementptr inbounds %struct.s2n_debug_info, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !11
  %190 = getelementptr inbounds i8, ptr %189, i64 21
  br label %191

191:                                              ; preds = %186, %179
  %192 = phi ptr [ %185, %179 ], [ %190, %186 ]
  %193 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %194 = getelementptr inbounds %struct.s2n_debug_info, ptr %193, i32 0, i32 1
  store ptr %192, ptr %194, align 8, !tbaa !13
  %195 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %195, align 4, !tbaa !9
  %196 = call i32 @s2n_calculate_stacktrace()
  br label %197

197:                                              ; preds = %191
  %198 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %198, align 4, !tbaa !14
  br label %265

199:                                              ; No predecessors!
  br label %200

200:                                              ; preds = %199, %161
  br label %201

201:                                              ; preds = %200
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %202 = load ptr, ptr %8, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.s2n_x509_validator, ptr %202, i32 0, i32 5
  %204 = load ptr, ptr %203, align 8, !tbaa !51
  %205 = call ptr @ossl_check_const_X509_sk_type(ptr noundef %204)
  %206 = call ptr @OPENSSL_sk_value(ptr noundef %205, i32 noundef 0)
  store ptr %206, ptr %17, align 8, !tbaa !5
  br label %207

207:                                              ; preds = %201
  %208 = load ptr, ptr %17, align 8, !tbaa !5
  %209 = icmp ne ptr %208, null
  br i1 %209, label %244, label %210

210:                                              ; preds = %207
  br label %211

211:                                              ; preds = %210
  br label %212

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

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

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

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

239:                                              ; preds = %233
  br label %240

240:                                              ; preds = %239
  %241 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %241, align 4, !tbaa !14
  store i32 1, ptr %18, align 4
  br label %264

242:                                              ; No predecessors!
  br label %243

243:                                              ; preds = %242
  br label %244

244:                                              ; preds = %243, %207
  br label %245

245:                                              ; preds = %244
  br label %246

246:                                              ; preds = %245
  call void @llvm.lifetime.start.p0(i64 48, ptr %19) #9
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 48, i1 false)
  br label %247

247:                                              ; preds = %246
  %248 = load ptr, ptr %17, align 8, !tbaa !5
  %249 = load ptr, ptr %12, align 8, !tbaa !5
  %250 = call i32 @s2n_pkey_from_x509(ptr noundef %248, ptr noundef %19, ptr noundef %249)
  %251 = getelementptr inbounds %struct.s2n_result, ptr %20, i32 0, i32 0
  store i32 %250, ptr %251, align 4
  %252 = getelementptr inbounds %struct.s2n_result, ptr %20, i32 0, i32 0
  %253 = load i32, ptr %252, align 4
  %254 = call zeroext i1 @s2n_result_is_ok(i32 %253)
  br i1 %254, label %257, label %255

255:                                              ; preds = %247
  %256 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 -1, ptr %256, align 4, !tbaa !14
  store i32 1, ptr %18, align 4
  br label %262

257:                                              ; preds = %247
  br label %258

258:                                              ; preds = %257
  br label %259

259:                                              ; preds = %258
  %260 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %260, ptr align 8 %19, i64 48, i1 false), !tbaa.struct !52
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 48, i1 false)
  %261 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 0, ptr %261, align 4, !tbaa !14
  store i32 1, ptr %18, align 4
  br label %262

262:                                              ; preds = %259, %255
  %263 = call i32 @s2n_pkey_free(ptr noundef %19)
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #9
  br label %264

264:                                              ; preds = %262, %240
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %265

265:                                              ; preds = %264, %197, %155, %141, %85, %70, %53
  %266 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  %267 = load i32, ptr %266, align 4
  ret i32 %267
}

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_x509_validator_handle_cert_validation_callback_result(ptr noundef) #7

declare i32 @OPENSSL_sk_num(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ossl_check_const_X509_sk_type(ptr noundef) #6

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

declare i32 @s2n_pkey_free(ptr noundef) #2

declare i32 @s2n_pkey_from_x509(ptr noundef, ptr noundef, 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !10, i64 0}
!15 = !{!"", !10, i64 0}
!16 = !{!17, !20, i64 52}
!17 = !{!"s2n_x509_validator", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !18, i64 18, !6, i64 24, !10, i64 32, !6, i64 40, !19, i64 48, !20, i64 52}
!18 = !{!"short", !7, i64 0}
!19 = !{!"s2n_cert_validation_info", !10, i64 0, !10, i64 0}
!20 = !{!"_Bool", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!24, !6, i64 8}
!24 = !{!"s2n_connection", !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80, !7, i64 102, !7, i64 124, !10, i64 148, !10, i64 152, !25, i64 160, !26, i64 168, !26, i64 176, !7, i64 184, !7, i64 216, !7, i64 217, !7, i64 218, !7, i64 219, !7, i64 220, !7, i64 221, !7, i64 222, !6, i64 224, !6, i64 232, !27, i64 240, !6, i64 632, !6, i64 640, !28, i64 648, !34, i64 1144, !37, i64 1688, !6, i64 1752, !7, i64 1760, !10, i64 1764, !7, i64 1768, !39, i64 1776, !39, i64 1816, !39, i64 1856, !39, i64 1896, !10, i64 1936, !26, i64 1944, !7, i64 1952, !39, i64 1960, !7, i64 2000, !7, i64 2001, !7, i64 2002, !20, i64 2003, !15, i64 2004, !15, i64 2008, !40, i64 2016, !18, i64 2208, !10, i64 2212, !18, i64 2216, !26, i64 2224, !7, i64 2232, !26, i64 2240, !26, i64 2248, !26, i64 2256, !15, i64 2264, !15, i64 2268, !7, i64 2272, !7, i64 2528, !10, i64 2784, !33, i64 2792, !10, i64 2816, !33, i64 2824, !33, i64 2848, !33, i64 2872, !42, i64 2896, !17, i64 3704, !6, i64 3760, !6, i64 3768, !7, i64 3776, !10, i64 3780, !33, i64 3784, !10, i64 3808, !44, i64 3816, !7, i64 3848, !39, i64 3992, !33, i64 4032, !33, i64 4056, !20, i64 4080, !20, i64 4081, !20, i64 4082, !18, i64 4084, !18, i64 4086, !10, i64 4088, !10, i64 4092, !33, i64 4096, !10, i64 4120, !45, i64 4128, !15, i64 4176, !7, i64 4180, !7, i64 4181}
!25 = !{!"s2n_timer", !26, i64 0}
!26 = !{!"long", !7, i64 0}
!27 = !{!"s2n_secrets", !7, i64 0, !10, i64 388}
!28 = !{!"s2n_kex_parameters", !29, i64 0, !30, i64 8, !7, i64 24, !30, i64 56, !31, i64 72, !31, i64 184, !7, i64 296, !32, i64 360, !33, i64 448, !33, i64 472}
!29 = !{!"s2n_dh_params", !6, i64 0}
!30 = !{!"s2n_ecc_evp_params", !6, i64 0, !6, i64 8}
!31 = !{!"s2n_kem_group_params", !6, i64 0, !32, i64 8, !30, i64 96}
!32 = !{!"s2n_kem_params", !6, i64 0, !33, i64 8, !33, i64 32, !33, i64 56, !20, i64 80}
!33 = !{!"s2n_blob", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!34 = !{!"s2n_handshake_parameters", !35, i64 0, !35, i64 48, !33, i64 96, !10, i64 120, !36, i64 124, !6, i64 384, !6, i64 392, !6, i64 400, !7, i64 408, !7, i64 440, !7, i64 472, !7, i64 473, !7, i64 474, !7, i64 506}
!35 = !{!"s2n_pkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!36 = !{!"s2n_sig_scheme_list", !7, i64 0, !7, i64 256}
!37 = !{!"s2n_psk_parameters", !10, i64 0, !38, i64 8, !18, i64 40, !18, i64 42, !6, i64 48, !10, i64 56}
!38 = !{!"s2n_array", !33, i64 0, !10, i64 24, !10, i64 28}
!39 = !{!"s2n_stuffer", !33, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 36, !10, i64 36}
!40 = !{!"s2n_handshake", !39, i64 0, !6, i64 40, !7, i64 48, !7, i64 56, !7, i64 104, !7, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !41, i64 176, !10, i64 184, !10, i64 184, !10, i64 184, !10, i64 184, !10, i64 188}
!41 = !{!"s2n_offered_early_data", !6, i64 0}
!42 = !{!"s2n_client_hello", !33, i64 0, !43, i64 24, !33, i64 728, !33, i64 752, !33, i64 776, !7, i64 800, !7, i64 801, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802}
!43 = !{!"", !7, i64 0, !33, i64 672, !18, i64 696}
!44 = !{!"s2n_ticket_fields", !33, i64 0, !10, i64 24}
!45 = !{!"s2n_post_handshake", !39, i64 0, !7, i64 40}
!46 = !{!47, !6, i64 272}
!47 = !{!"s2n_config", !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !6, i64 8, !6, i64 16, !48, i64 24, !33, i64 56, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !10, i64 128, !10, i64 132, !6, i64 136, !26, i64 144, !6, i64 152, !26, i64 160, !26, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !7, i64 228, !10, i64 232, !10, i64 236, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !49, i64 304, !18, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !10, i64 392, !10, i64 396, !10, i64 400, !6, i64 408, !10, i64 416, !10, i64 420, !6, i64 424, !6, i64 432, !10, i64 440, !33, i64 448}
!48 = !{!"certs_by_type", !7, i64 0}
!49 = !{!"s2n_x509_trust_store", !6, i64 0, !10, i64 8}
!50 = !{!47, !6, i64 280}
!51 = !{!17, !6, i64 24}
!52 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5, i64 32, i64 8, !5, i64 40, i64 8, !5}


; 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 }
%struct.s2n_pkey = type { ptr, ptr, ptr, ptr, 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.20 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.23 = 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

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

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

; 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) #5

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_x509_validator_validate_cert_chain(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr nocapture noundef writeonly %5) local_unnamed_addr #7 {
  %7 = alloca %struct.s2n_pkey, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %8, label %16

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

16:                                               ; preds = %6
  %17 = getelementptr inbounds i8, ptr %0, i64 52
  %18 = load i8, ptr %17, align 4, !tbaa !13, !range !18, !noundef !19
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %20, label %23

20:                                               ; preds = %16
  %21 = tail call i32 @s2n_x509_validator_handle_cert_validation_callback_result(ptr noundef nonnull %0)
  %22 = tail call zeroext i1 @s2n_result_is_ok(i32 %21)
  br i1 %22, label %48, label %80

23:                                               ; preds = %16
  %24 = tail call i32 @s2n_x509_validator_validate_cert_chain_pre_cb(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, i32 noundef %3)
  %25 = tail call zeroext i1 @s2n_result_is_ok(i32 %24)
  br i1 %25, label %26, label %80

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %1, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %28, i64 272
  %30 = load ptr, ptr %29, align 8, !tbaa !44
  %.not30 = icmp eq ptr %30, null
  br i1 %.not30, label %48, label %31

31:                                               ; preds = %26
  %32 = getelementptr inbounds i8, ptr %0, i64 48
  %33 = getelementptr inbounds i8, ptr %28, i64 280
  %34 = load ptr, ptr %33, align 8, !tbaa !48
  %35 = tail call i32 %30(ptr noundef nonnull %1, ptr noundef nonnull %32, ptr noundef %34) #9
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %45, label %37

37:                                               ; preds = %31
  %38 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.21, ptr %38, align 8, !tbaa !5
  %39 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.21, i64 21), i32 noundef 47) #8
  %.not31 = icmp eq ptr %39, null
  %40 = getelementptr inbounds i8, ptr %39, i64 1
  %41 = select i1 %.not31, ptr getelementptr inbounds (i8, ptr @.str.21, i64 21), ptr %40
  %42 = getelementptr inbounds i8, ptr %38, i64 8
  store ptr %41, ptr %42, align 8, !tbaa !10
  %43 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544386, ptr %43, align 4, !tbaa !11
  %44 = tail call i32 @s2n_calculate_stacktrace() #9
  br label %80

45:                                               ; preds = %31
  store i8 1, ptr %17, align 4, !tbaa !13
  %46 = tail call i32 @s2n_x509_validator_handle_cert_validation_callback_result(ptr noundef nonnull %0)
  %47 = tail call zeroext i1 @s2n_result_is_ok(i32 %46)
  br i1 %47, label %48, label %80

48:                                               ; preds = %20, %45, %26
  %49 = getelementptr inbounds i8, ptr %0, i64 24
  %50 = load ptr, ptr %49, align 8, !tbaa !49
  %51 = tail call ptr @ossl_check_const_X509_sk_type(ptr noundef %50)
  %52 = tail call i32 @OPENSSL_sk_num(ptr noundef %51) #9
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %62, label %54

54:                                               ; preds = %48
  %55 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.22, ptr %55, align 8, !tbaa !5
  %56 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.22, i64 21), i32 noundef 47) #8
  %.not32 = icmp eq ptr %56, null
  %57 = getelementptr inbounds i8, ptr %56, i64 1
  %58 = select i1 %.not32, ptr getelementptr inbounds (i8, ptr @.str.22, i64 21), ptr %57
  %59 = getelementptr inbounds i8, ptr %55, i64 8
  store ptr %58, ptr %59, align 8, !tbaa !10
  %60 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %60, align 4, !tbaa !11
  %61 = tail call i32 @s2n_calculate_stacktrace() #9
  br label %80

62:                                               ; preds = %48
  %63 = load ptr, ptr %49, align 8, !tbaa !49
  %64 = tail call ptr @ossl_check_const_X509_sk_type(ptr noundef %63)
  %65 = tail call ptr @OPENSSL_sk_value(ptr noundef %64, i32 noundef 0) #9
  %.not33 = icmp eq ptr %65, null
  br i1 %.not33, label %66, label %74

66:                                               ; preds = %62
  %67 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.23, ptr %67, align 8, !tbaa !5
  %68 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.23, i64 21), i32 noundef 47) #8
  %.not34 = icmp eq ptr %68, null
  %69 = getelementptr inbounds i8, ptr %68, i64 1
  %70 = select i1 %.not34, ptr getelementptr inbounds (i8, ptr @.str.23, i64 21), ptr %69
  %71 = getelementptr inbounds i8, ptr %67, i64 8
  store ptr %70, ptr %71, align 8, !tbaa !10
  %72 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %72, align 4, !tbaa !11
  %73 = tail call i32 @s2n_calculate_stacktrace() #9
  br label %80

74:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %7, i8 0, i64 48, i1 false)
  %75 = call i32 @s2n_pkey_from_x509(ptr noundef nonnull %65, ptr noundef nonnull %7, ptr noundef %4) #9
  %76 = call zeroext i1 @s2n_result_is_ok(i32 %75)
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(48) %7, i64 48, i1 false), !tbaa.struct !50
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %7, i8 0, i64 48, i1 false)
  br label %78

78:                                               ; preds = %74, %77
  %.sroa.022.0 = phi i32 [ 0, %77 ], [ -1, %74 ]
  %79 = call i32 @s2n_pkey_free(ptr noundef nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #9
  br label %80

80:                                               ; preds = %66, %78, %45, %23, %20, %54, %37, %8
  %.sroa.022.2 = phi i32 [ -1, %54 ], [ -1, %37 ], [ -1, %8 ], [ -1, %20 ], [ -1, %23 ], [ -1, %45 ], [ %.sroa.022.0, %78 ], [ -1, %66 ]
  ret i32 %.sroa.022.2
}

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_x509_validator_handle_cert_validation_callback_result(ptr noundef) local_unnamed_addr #7

declare i32 @OPENSSL_sk_num(ptr noundef) local_unnamed_addr #2

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

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

declare i32 @s2n_pkey_free(ptr noundef) local_unnamed_addr #2

declare i32 @s2n_pkey_from_x509(ptr noundef, ptr noundef, 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !17, i64 52}
!14 = !{!"s2n_x509_validator", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 17, !15, i64 18, !7, i64 24, !12, i64 32, !7, i64 40, !16, i64 48, !17, i64 52}
!15 = !{!"short", !8, i64 0}
!16 = !{!"s2n_cert_validation_info", !12, i64 0, !12, i64 0}
!17 = !{!"_Bool", !8, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !7, i64 8}
!21 = !{!"s2n_connection", !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !8, i64 80, !8, i64 102, !8, i64 124, !12, i64 148, !12, i64 152, !22, i64 160, !23, i64 168, !23, i64 176, !8, i64 184, !8, i64 216, !8, i64 217, !8, i64 218, !8, i64 219, !8, i64 220, !8, i64 221, !8, i64 222, !7, i64 224, !7, i64 232, !24, i64 240, !7, i64 632, !7, i64 640, !25, i64 648, !31, i64 1144, !34, i64 1688, !7, i64 1752, !8, i64 1760, !12, i64 1764, !8, i64 1768, !36, i64 1776, !36, i64 1816, !36, i64 1856, !36, i64 1896, !12, i64 1936, !23, i64 1944, !8, i64 1952, !36, i64 1960, !8, i64 2000, !8, i64 2001, !8, i64 2002, !17, i64 2003, !37, i64 2004, !37, i64 2008, !38, i64 2016, !15, i64 2208, !12, i64 2212, !15, i64 2216, !23, i64 2224, !8, i64 2232, !23, i64 2240, !23, i64 2248, !23, i64 2256, !37, i64 2264, !37, i64 2268, !8, i64 2272, !8, i64 2528, !12, i64 2784, !30, i64 2792, !12, i64 2816, !30, i64 2824, !30, i64 2848, !30, i64 2872, !40, i64 2896, !14, i64 3704, !7, i64 3760, !7, i64 3768, !8, i64 3776, !12, i64 3780, !30, i64 3784, !12, i64 3808, !42, i64 3816, !8, i64 3848, !36, i64 3992, !30, i64 4032, !30, i64 4056, !17, i64 4080, !17, i64 4081, !17, i64 4082, !15, i64 4084, !15, i64 4086, !12, i64 4088, !12, i64 4092, !30, i64 4096, !12, i64 4120, !43, i64 4128, !37, i64 4176, !8, i64 4180, !8, i64 4181}
!22 = !{!"s2n_timer", !23, i64 0}
!23 = !{!"long", !8, i64 0}
!24 = !{!"s2n_secrets", !8, i64 0, !12, i64 388}
!25 = !{!"s2n_kex_parameters", !26, i64 0, !27, i64 8, !8, i64 24, !27, i64 56, !28, i64 72, !28, i64 184, !8, i64 296, !29, i64 360, !30, i64 448, !30, i64 472}
!26 = !{!"s2n_dh_params", !7, i64 0}
!27 = !{!"s2n_ecc_evp_params", !7, i64 0, !7, i64 8}
!28 = !{!"s2n_kem_group_params", !7, i64 0, !29, i64 8, !27, i64 96}
!29 = !{!"s2n_kem_params", !7, i64 0, !30, i64 8, !30, i64 32, !30, i64 56, !17, i64 80}
!30 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!31 = !{!"s2n_handshake_parameters", !32, i64 0, !32, i64 48, !30, i64 96, !12, i64 120, !33, i64 124, !7, i64 384, !7, i64 392, !7, i64 400, !8, i64 408, !8, i64 440, !8, i64 472, !8, i64 473, !8, i64 474, !8, i64 506}
!32 = !{!"s2n_pkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!33 = !{!"s2n_sig_scheme_list", !8, i64 0, !8, i64 256}
!34 = !{!"s2n_psk_parameters", !12, i64 0, !35, i64 8, !15, i64 40, !15, i64 42, !7, i64 48, !12, i64 56}
!35 = !{!"s2n_array", !30, i64 0, !12, i64 24, !12, i64 28}
!36 = !{!"s2n_stuffer", !30, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!37 = !{!"", !12, i64 0}
!38 = !{!"s2n_handshake", !36, i64 0, !7, i64 40, !8, i64 48, !8, i64 56, !8, i64 104, !8, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !39, i64 176, !12, i64 184, !12, i64 184, !12, i64 184, !12, i64 184, !12, i64 188}
!39 = !{!"s2n_offered_early_data", !7, i64 0}
!40 = !{!"s2n_client_hello", !30, i64 0, !41, i64 24, !30, i64 728, !30, i64 752, !30, i64 776, !8, i64 800, !8, i64 801, !12, i64 802, !12, i64 802, !12, i64 802, !12, i64 802, !12, i64 802, !12, i64 802, !12, i64 802}
!41 = !{!"", !8, i64 0, !30, i64 672, !15, i64 696}
!42 = !{!"s2n_ticket_fields", !30, i64 0, !12, i64 24}
!43 = !{!"s2n_post_handshake", !36, i64 0, !8, i64 40}
!44 = !{!45, !7, i64 272}
!45 = !{!"s2n_config", !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !7, i64 8, !7, i64 16, !46, i64 24, !30, i64 56, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !12, i64 128, !12, i64 132, !7, i64 136, !23, i64 144, !7, i64 152, !23, i64 160, !23, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !12, i64 224, !8, i64 228, !12, i64 232, !12, i64 236, !7, i64 240, !7, i64 248, !7, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !8, i64 296, !8, i64 297, !47, i64 304, !15, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !12, i64 392, !12, i64 396, !12, i64 400, !7, i64 408, !12, i64 416, !12, i64 420, !7, i64 424, !7, i64 432, !12, i64 440, !30, i64 448}
!46 = !{!"certs_by_type", !8, i64 0}
!47 = !{!"s2n_x509_trust_store", !7, i64 0, !12, i64 8}
!48 = !{!45, !7, i64 280}
!49 = !{!14, !7, i64 24}
!50 = !{i64 0, i64 8, !51, i64 8, i64 8, !51, i64 16, i64 8, !51, i64 24, i64 8, !51, i64 32, i64 8, !51, i64 40, i64 8, !51}
!51 = !{!7, !7, i64 0}


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