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

; 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_blob = type { ptr, i32, i32, i8 }
%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_cert_chain = type { i32, ptr }
%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_pkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%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_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_ticket_fields = type { %struct.s2n_blob, i32 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_post_handshake = type { %struct.s2n_stuffer, [4 x i8] }
%struct.s2n_atomic_flag = type { i32 }
%struct.s2n_cert = type { i32, %struct.s2n_pkey, %struct.s2n_cert_info, %struct.s2n_blob, ptr }
%struct.s2n_cert_info = type { i32, i32, i32, i32, i8 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.142 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [92 x i8], align 1

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

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

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) #0

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

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

declare i32 @s2n_calculate_stacktrace() #2

; 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_connection_get_peer_cert_chain(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 ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.s2n_blob, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca %struct.s2n_result, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %2
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %55, 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.142, ptr %28, align 8, !tbaa !9
  %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 !9
  %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 !9
  %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 !9
  %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 !11
  %51 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %51, align 4, !tbaa !12
  %52 = call i32 @s2n_calculate_stacktrace()
  br label %53

53:                                               ; preds = %47
  store i32 -1, ptr %3, align 4
  br label %582

54:                                               ; No predecessors!
  br label %55

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

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %91, label %60

60:                                               ; preds = %57
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  %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
  store ptr @.str.143, ptr %64, align 8, !tbaa !9
  %65 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %66 = getelementptr inbounds %struct.s2n_debug_info, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !9
  %68 = getelementptr inbounds i8, ptr %67, i64 21
  %69 = call ptr @strrchr(ptr noundef %68, i32 noundef 47) #8
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %78

71:                                               ; preds = %62
  %72 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %73 = getelementptr inbounds %struct.s2n_debug_info, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = getelementptr inbounds i8, ptr %74, i64 21
  %76 = call ptr @strrchr(ptr noundef %75, i32 noundef 47) #8
  %77 = getelementptr inbounds i8, ptr %76, i64 1
  br label %83

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

83:                                               ; preds = %78, %71
  %84 = phi ptr [ %77, %71 ], [ %82, %78 ]
  %85 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %86 = getelementptr inbounds %struct.s2n_debug_info, ptr %85, i32 0, i32 1
  store ptr %84, ptr %86, align 8, !tbaa !11
  %87 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %87, align 4, !tbaa !12
  %88 = call i32 @s2n_calculate_stacktrace()
  br label %89

89:                                               ; preds = %83
  store i32 -1, ptr %3, align 4
  br label %582

90:                                               ; No predecessors!
  br label %91

91:                                               ; preds = %90, %57
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.s2n_cert_chain_and_key, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !14
  %97 = icmp ne ptr %96, null
  br i1 %97, label %129, label %98

98:                                               ; preds = %93
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %102 = getelementptr inbounds %struct.s2n_debug_info, ptr %101, i32 0, i32 0
  store ptr @.str.144, ptr %102, align 8, !tbaa !9
  %103 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %104 = getelementptr inbounds %struct.s2n_debug_info, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !9
  %106 = getelementptr inbounds i8, ptr %105, i64 21
  %107 = call ptr @strrchr(ptr noundef %106, i32 noundef 47) #8
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %116

109:                                              ; preds = %100
  %110 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %111 = getelementptr inbounds %struct.s2n_debug_info, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !9
  %113 = getelementptr inbounds i8, ptr %112, i64 21
  %114 = call ptr @strrchr(ptr noundef %113, i32 noundef 47) #8
  %115 = getelementptr inbounds i8, ptr %114, i64 1
  br label %121

116:                                              ; preds = %100
  %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 !9
  %120 = getelementptr inbounds i8, ptr %119, i64 21
  br label %121

121:                                              ; preds = %116, %109
  %122 = phi ptr [ %115, %109 ], [ %120, %116 ]
  %123 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %124 = getelementptr inbounds %struct.s2n_debug_info, ptr %123, i32 0, i32 1
  store ptr %122, ptr %124, align 8, !tbaa !11
  %125 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %125, align 4, !tbaa !12
  %126 = call i32 @s2n_calculate_stacktrace()
  br label %127

127:                                              ; preds = %121
  store i32 -1, ptr %3, align 4
  br label %582

128:                                              ; No predecessors!
  br label %129

129:                                              ; preds = %128, %93
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.s2n_cert_chain_and_key, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !14
  %135 = getelementptr inbounds %struct.s2n_cert_chain, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !17
  %137 = icmp eq ptr %136, null
  br i1 %137, label %169, label %138

138:                                              ; preds = %131
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %142 = getelementptr inbounds %struct.s2n_debug_info, ptr %141, i32 0, i32 0
  store ptr @.str.145, ptr %142, align 8, !tbaa !9
  %143 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %144 = getelementptr inbounds %struct.s2n_debug_info, ptr %143, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8, !tbaa !9
  %146 = getelementptr inbounds i8, ptr %145, i64 21
  %147 = call ptr @strrchr(ptr noundef %146, i32 noundef 47) #8
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %156

149:                                              ; preds = %140
  %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 !9
  %153 = getelementptr inbounds i8, ptr %152, i64 21
  %154 = call ptr @strrchr(ptr noundef %153, i32 noundef 47) #8
  %155 = getelementptr inbounds i8, ptr %154, i64 1
  br label %161

156:                                              ; preds = %140
  %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 !9
  %160 = getelementptr inbounds i8, ptr %159, i64 21
  br label %161

161:                                              ; preds = %156, %149
  %162 = phi ptr [ %155, %149 ], [ %160, %156 ]
  %163 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %164 = getelementptr inbounds %struct.s2n_debug_info, ptr %163, i32 0, i32 1
  store ptr %162, ptr %164, align 8, !tbaa !11
  %165 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %165, align 4, !tbaa !12
  %166 = call i32 @s2n_calculate_stacktrace()
  br label %167

167:                                              ; preds = %161
  store i32 -1, ptr %3, align 4
  br label %582

168:                                              ; No predecessors!
  br label %169

169:                                              ; preds = %168, %131
  br label %170

170:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.s2n_cert_chain_and_key, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !14
  store ptr %173, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %174 = load ptr, ptr %6, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.s2n_cert_chain, ptr %174, i32 0, i32 1
  store ptr %175, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.s2n_connection, ptr %176, i32 0, i32 72
  store ptr %177, ptr %8, align 8, !tbaa !5
  br label %178

178:                                              ; preds = %170
  %179 = load ptr, ptr %8, align 8, !tbaa !5
  %180 = icmp ne ptr %179, null
  br i1 %180, label %214, label %181

181:                                              ; preds = %178
  br label %182

182:                                              ; preds = %181
  br label %183

183:                                              ; preds = %182
  %184 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %185 = getelementptr inbounds %struct.s2n_debug_info, ptr %184, i32 0, i32 0
  store ptr @.str.146, ptr %185, align 8, !tbaa !9
  %186 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %187 = getelementptr inbounds %struct.s2n_debug_info, ptr %186, i32 0, i32 0
  %188 = load ptr, ptr %187, align 8, !tbaa !9
  %189 = getelementptr inbounds i8, ptr %188, i64 21
  %190 = call ptr @strrchr(ptr noundef %189, i32 noundef 47) #8
  %191 = icmp ne ptr %190, null
  br i1 %191, label %192, label %199

192:                                              ; preds = %183
  %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 0
  %195 = load ptr, ptr %194, align 8, !tbaa !9
  %196 = getelementptr inbounds i8, ptr %195, i64 21
  %197 = call ptr @strrchr(ptr noundef %196, i32 noundef 47) #8
  %198 = getelementptr inbounds i8, ptr %197, i64 1
  br label %204

199:                                              ; preds = %183
  %200 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %201 = getelementptr inbounds %struct.s2n_debug_info, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !9
  %203 = getelementptr inbounds i8, ptr %202, i64 21
  br label %204

204:                                              ; preds = %199, %192
  %205 = phi ptr [ %198, %192 ], [ %203, %199 ]
  %206 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %207 = getelementptr inbounds %struct.s2n_debug_info, ptr %206, i32 0, i32 1
  store ptr %205, ptr %207, align 8, !tbaa !11
  %208 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %208, align 4, !tbaa !12
  %209 = call i32 @s2n_calculate_stacktrace()
  br label %210

210:                                              ; preds = %204
  br label %211

211:                                              ; preds = %210
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %581

212:                                              ; No predecessors!
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213, %178
  br label %215

215:                                              ; preds = %214
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216
  %218 = load ptr, ptr %8, align 8, !tbaa !5
  %219 = call zeroext i1 @s2n_x509_validator_is_cert_chain_validated(ptr noundef %218)
  br i1 %219, label %253, label %220

220:                                              ; preds = %217
  br label %221

221:                                              ; preds = %220
  br label %222

222:                                              ; preds = %221
  %223 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %224 = getelementptr inbounds %struct.s2n_debug_info, ptr %223, i32 0, i32 0
  store ptr @.str.147, ptr %224, align 8, !tbaa !9
  %225 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %226 = getelementptr inbounds %struct.s2n_debug_info, ptr %225, i32 0, i32 0
  %227 = load ptr, ptr %226, align 8, !tbaa !9
  %228 = getelementptr inbounds i8, ptr %227, i64 21
  %229 = call ptr @strrchr(ptr noundef %228, i32 noundef 47) #8
  %230 = icmp ne ptr %229, null
  br i1 %230, label %231, label %238

231:                                              ; preds = %222
  %232 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %233 = getelementptr inbounds %struct.s2n_debug_info, ptr %232, i32 0, i32 0
  %234 = load ptr, ptr %233, align 8, !tbaa !9
  %235 = getelementptr inbounds i8, ptr %234, i64 21
  %236 = call ptr @strrchr(ptr noundef %235, i32 noundef 47) #8
  %237 = getelementptr inbounds i8, ptr %236, i64 1
  br label %243

238:                                              ; preds = %222
  %239 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %240 = getelementptr inbounds %struct.s2n_debug_info, ptr %239, i32 0, i32 0
  %241 = load ptr, ptr %240, align 8, !tbaa !9
  %242 = getelementptr inbounds i8, ptr %241, i64 21
  br label %243

243:                                              ; preds = %238, %231
  %244 = phi ptr [ %237, %231 ], [ %242, %238 ]
  %245 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %246 = getelementptr inbounds %struct.s2n_debug_info, ptr %245, i32 0, i32 1
  store ptr %244, ptr %246, align 8, !tbaa !11
  %247 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762115, ptr %247, align 4, !tbaa !12
  %248 = call i32 @s2n_calculate_stacktrace()
  br label %249

249:                                              ; preds = %243
  br label %250

250:                                              ; preds = %249
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %581

251:                                              ; No predecessors!
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252, %217
  br label %254

254:                                              ; preds = %253
  br label %255

255:                                              ; preds = %254
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %256 = load ptr, ptr %8, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.s2n_x509_validator, ptr %256, i32 0, i32 1
  %258 = load ptr, ptr %257, align 8, !tbaa !19
  %259 = call ptr @X509_STORE_CTX_get1_chain(ptr noundef %258)
  store ptr %259, ptr %10, align 8, !tbaa !5
  br label %260

260:                                              ; preds = %255
  %261 = load ptr, ptr %10, align 8, !tbaa !5
  %262 = icmp ne ptr %261, null
  br i1 %262, label %296, label %263

263:                                              ; preds = %260
  br label %264

264:                                              ; preds = %263
  br label %265

265:                                              ; preds = %264
  %266 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %267 = getelementptr inbounds %struct.s2n_debug_info, ptr %266, i32 0, i32 0
  store ptr @.str.148, ptr %267, align 8, !tbaa !9
  %268 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %269 = getelementptr inbounds %struct.s2n_debug_info, ptr %268, i32 0, i32 0
  %270 = load ptr, ptr %269, align 8, !tbaa !9
  %271 = getelementptr inbounds i8, ptr %270, i64 21
  %272 = call ptr @strrchr(ptr noundef %271, i32 noundef 47) #8
  %273 = icmp ne ptr %272, null
  br i1 %273, label %274, label %281

274:                                              ; preds = %265
  %275 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %276 = getelementptr inbounds %struct.s2n_debug_info, ptr %275, i32 0, i32 0
  %277 = load ptr, ptr %276, align 8, !tbaa !9
  %278 = getelementptr inbounds i8, ptr %277, i64 21
  %279 = call ptr @strrchr(ptr noundef %278, i32 noundef 47) #8
  %280 = getelementptr inbounds i8, ptr %279, i64 1
  br label %286

281:                                              ; preds = %265
  %282 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %283 = getelementptr inbounds %struct.s2n_debug_info, ptr %282, i32 0, i32 0
  %284 = load ptr, ptr %283, align 8, !tbaa !9
  %285 = getelementptr inbounds i8, ptr %284, i64 21
  br label %286

286:                                              ; preds = %281, %274
  %287 = phi ptr [ %280, %274 ], [ %285, %281 ]
  %288 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %289 = getelementptr inbounds %struct.s2n_debug_info, ptr %288, i32 0, i32 1
  store ptr %287, ptr %289, align 8, !tbaa !11
  %290 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %290, align 4, !tbaa !12
  %291 = call i32 @s2n_calculate_stacktrace()
  br label %292

292:                                              ; preds = %286
  br label %293

293:                                              ; preds = %292
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %578

294:                                              ; No predecessors!
  br label %295

295:                                              ; preds = %294
  br label %296

296:                                              ; preds = %295, %260
  br label %297

297:                                              ; preds = %296
  br label %298

298:                                              ; preds = %297
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %299 = load ptr, ptr %10, align 8, !tbaa !5
  %300 = call ptr @ossl_check_const_X509_sk_type(ptr noundef %299)
  %301 = call i32 @OPENSSL_sk_num(ptr noundef %300)
  store i32 %301, ptr %11, align 4, !tbaa !12
  br label %302

302:                                              ; preds = %298
  %303 = load i32, ptr %11, align 4, !tbaa !12
  %304 = icmp sge i32 %303, 0
  br i1 %304, label %338, label %305

305:                                              ; preds = %302
  br label %306

306:                                              ; preds = %305
  br label %307

307:                                              ; preds = %306
  %308 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %309 = getelementptr inbounds %struct.s2n_debug_info, ptr %308, i32 0, i32 0
  store ptr @.str.149, ptr %309, align 8, !tbaa !9
  %310 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %311 = getelementptr inbounds %struct.s2n_debug_info, ptr %310, i32 0, i32 0
  %312 = load ptr, ptr %311, align 8, !tbaa !9
  %313 = getelementptr inbounds i8, ptr %312, i64 21
  %314 = call ptr @strrchr(ptr noundef %313, i32 noundef 47) #8
  %315 = icmp ne ptr %314, null
  br i1 %315, label %316, label %323

316:                                              ; preds = %307
  %317 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %318 = getelementptr inbounds %struct.s2n_debug_info, ptr %317, i32 0, i32 0
  %319 = load ptr, ptr %318, align 8, !tbaa !9
  %320 = getelementptr inbounds i8, ptr %319, i64 21
  %321 = call ptr @strrchr(ptr noundef %320, i32 noundef 47) #8
  %322 = getelementptr inbounds i8, ptr %321, i64 1
  br label %328

323:                                              ; preds = %307
  %324 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %325 = getelementptr inbounds %struct.s2n_debug_info, ptr %324, i32 0, i32 0
  %326 = load ptr, ptr %325, align 8, !tbaa !9
  %327 = getelementptr inbounds i8, ptr %326, i64 21
  br label %328

328:                                              ; preds = %323, %316
  %329 = phi ptr [ %322, %316 ], [ %327, %323 ]
  %330 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %331 = getelementptr inbounds %struct.s2n_debug_info, ptr %330, i32 0, i32 1
  store ptr %329, ptr %331, align 8, !tbaa !11
  %332 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %332, align 4, !tbaa !12
  %333 = call i32 @s2n_calculate_stacktrace()
  br label %334

334:                                              ; preds = %328
  br label %335

335:                                              ; preds = %334
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %577

336:                                              ; No predecessors!
  br label %337

337:                                              ; preds = %336
  br label %338

338:                                              ; preds = %337, %302
  br label %339

339:                                              ; preds = %338
  br label %340

340:                                              ; preds = %339
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  store i64 0, ptr %12, align 8, !tbaa !24
  br label %341

341:                                              ; preds = %571, %340
  %342 = load i64, ptr %12, align 8, !tbaa !24
  %343 = load i32, ptr %11, align 4, !tbaa !12
  %344 = sext i32 %343 to i64
  %345 = icmp ult i64 %342, %344
  br i1 %345, label %347, label %346

346:                                              ; preds = %341
  store i32 50, ptr %9, align 4
  br label %574

347:                                              ; preds = %341
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %348 = load ptr, ptr %10, align 8, !tbaa !5
  %349 = call ptr @ossl_check_const_X509_sk_type(ptr noundef %348)
  %350 = load i64, ptr %12, align 8, !tbaa !24
  %351 = trunc i64 %350 to i32
  %352 = call ptr @OPENSSL_sk_value(ptr noundef %349, i32 noundef %351)
  store ptr %352, ptr %13, align 8, !tbaa !5
  br label %353

353:                                              ; preds = %347
  %354 = load ptr, ptr %13, align 8, !tbaa !5
  %355 = icmp ne ptr %354, null
  br i1 %355, label %389, label %356

356:                                              ; preds = %353
  br label %357

357:                                              ; preds = %356
  br label %358

358:                                              ; preds = %357
  %359 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %360 = getelementptr inbounds %struct.s2n_debug_info, ptr %359, i32 0, i32 0
  store ptr @.str.150, ptr %360, align 8, !tbaa !9
  %361 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %362 = getelementptr inbounds %struct.s2n_debug_info, ptr %361, i32 0, i32 0
  %363 = load ptr, ptr %362, align 8, !tbaa !9
  %364 = getelementptr inbounds i8, ptr %363, i64 21
  %365 = call ptr @strrchr(ptr noundef %364, i32 noundef 47) #8
  %366 = icmp ne ptr %365, null
  br i1 %366, label %367, label %374

367:                                              ; preds = %358
  %368 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %369 = getelementptr inbounds %struct.s2n_debug_info, ptr %368, i32 0, i32 0
  %370 = load ptr, ptr %369, align 8, !tbaa !9
  %371 = getelementptr inbounds i8, ptr %370, i64 21
  %372 = call ptr @strrchr(ptr noundef %371, i32 noundef 47) #8
  %373 = getelementptr inbounds i8, ptr %372, i64 1
  br label %379

374:                                              ; preds = %358
  %375 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %376 = getelementptr inbounds %struct.s2n_debug_info, ptr %375, i32 0, i32 0
  %377 = load ptr, ptr %376, align 8, !tbaa !9
  %378 = getelementptr inbounds i8, ptr %377, i64 21
  br label %379

379:                                              ; preds = %374, %367
  %380 = phi ptr [ %373, %367 ], [ %378, %374 ]
  %381 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %382 = getelementptr inbounds %struct.s2n_debug_info, ptr %381, i32 0, i32 1
  store ptr %380, ptr %382, align 8, !tbaa !11
  %383 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %383, align 4, !tbaa !12
  %384 = call i32 @s2n_calculate_stacktrace()
  br label %385

385:                                              ; preds = %379
  br label %386

386:                                              ; preds = %385
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %568

387:                                              ; No predecessors!
  br label %388

388:                                              ; preds = %387
  br label %389

389:                                              ; preds = %388, %353
  br label %390

390:                                              ; preds = %389
  br label %391

391:                                              ; preds = %390
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  %392 = load ptr, ptr %13, align 8, !tbaa !5
  %393 = call i32 @i2d_X509(ptr noundef %392, ptr noundef %14)
  store i32 %393, ptr %15, align 4, !tbaa !12
  br label %394

394:                                              ; preds = %391
  %395 = load i32, ptr %15, align 4, !tbaa !12
  %396 = icmp sgt i32 %395, 0
  br i1 %396, label %430, label %397

397:                                              ; preds = %394
  br label %398

398:                                              ; preds = %397
  br label %399

399:                                              ; preds = %398
  %400 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %401 = getelementptr inbounds %struct.s2n_debug_info, ptr %400, i32 0, i32 0
  store ptr @.str.151, ptr %401, align 8, !tbaa !9
  %402 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %403 = getelementptr inbounds %struct.s2n_debug_info, ptr %402, i32 0, i32 0
  %404 = load ptr, ptr %403, align 8, !tbaa !9
  %405 = getelementptr inbounds i8, ptr %404, i64 21
  %406 = call ptr @strrchr(ptr noundef %405, i32 noundef 47) #8
  %407 = icmp ne ptr %406, null
  br i1 %407, label %408, label %415

408:                                              ; preds = %399
  %409 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %410 = getelementptr inbounds %struct.s2n_debug_info, ptr %409, i32 0, i32 0
  %411 = load ptr, ptr %410, align 8, !tbaa !9
  %412 = getelementptr inbounds i8, ptr %411, i64 21
  %413 = call ptr @strrchr(ptr noundef %412, i32 noundef 47) #8
  %414 = getelementptr inbounds i8, ptr %413, i64 1
  br label %420

415:                                              ; preds = %399
  %416 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %417 = getelementptr inbounds %struct.s2n_debug_info, ptr %416, i32 0, i32 0
  %418 = load ptr, ptr %417, align 8, !tbaa !9
  %419 = getelementptr inbounds i8, ptr %418, i64 21
  br label %420

420:                                              ; preds = %415, %408
  %421 = phi ptr [ %414, %408 ], [ %419, %415 ]
  %422 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %423 = getelementptr inbounds %struct.s2n_debug_info, ptr %422, i32 0, i32 1
  store ptr %421, ptr %423, align 8, !tbaa !11
  %424 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %424, align 4, !tbaa !12
  %425 = call i32 @s2n_calculate_stacktrace()
  br label %426

426:                                              ; preds = %420
  br label %427

427:                                              ; preds = %426
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %566

428:                                              ; No predecessors!
  br label %429

429:                                              ; preds = %428
  br label %430

430:                                              ; preds = %429, %394
  br label %431

431:                                              ; preds = %430
  br label %432

432:                                              ; preds = %431
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #9
  call void @llvm.memset.p0.i64(ptr align 8 %16, i8 0, i64 24, i1 false)
  br label %433

433:                                              ; preds = %432
  %434 = call i32 @s2n_alloc(ptr noundef %16, i32 noundef 112)
  %435 = icmp sgt i32 %434, -1
  br i1 %435, label %437, label %436

436:                                              ; preds = %433
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %565

437:                                              ; preds = %433
  br label %438

438:                                              ; preds = %437
  br label %439

439:                                              ; preds = %438
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %440 = getelementptr inbounds %struct.s2n_blob, ptr %16, i32 0, i32 0
  %441 = load ptr, ptr %440, align 8, !tbaa !26
  store ptr %441, ptr %17, align 8, !tbaa !5
  br label %442

442:                                              ; preds = %439
  %443 = load ptr, ptr %17, align 8, !tbaa !5
  %444 = icmp ne ptr %443, null
  br i1 %444, label %478, label %445

445:                                              ; preds = %442
  br label %446

446:                                              ; preds = %445
  br label %447

447:                                              ; preds = %446
  %448 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %449 = getelementptr inbounds %struct.s2n_debug_info, ptr %448, i32 0, i32 0
  store ptr @.str.152, ptr %449, align 8, !tbaa !9
  %450 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %451 = getelementptr inbounds %struct.s2n_debug_info, ptr %450, i32 0, i32 0
  %452 = load ptr, ptr %451, align 8, !tbaa !9
  %453 = getelementptr inbounds i8, ptr %452, i64 21
  %454 = call ptr @strrchr(ptr noundef %453, i32 noundef 47) #8
  %455 = icmp ne ptr %454, null
  br i1 %455, label %456, label %463

456:                                              ; preds = %447
  %457 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %458 = getelementptr inbounds %struct.s2n_debug_info, ptr %457, i32 0, i32 0
  %459 = load ptr, ptr %458, align 8, !tbaa !9
  %460 = getelementptr inbounds i8, ptr %459, i64 21
  %461 = call ptr @strrchr(ptr noundef %460, i32 noundef 47) #8
  %462 = getelementptr inbounds i8, ptr %461, i64 1
  br label %468

463:                                              ; preds = %447
  %464 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %465 = getelementptr inbounds %struct.s2n_debug_info, ptr %464, i32 0, i32 0
  %466 = load ptr, ptr %465, align 8, !tbaa !9
  %467 = getelementptr inbounds i8, ptr %466, i64 21
  br label %468

468:                                              ; preds = %463, %456
  %469 = phi ptr [ %462, %456 ], [ %467, %463 ]
  %470 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %471 = getelementptr inbounds %struct.s2n_debug_info, ptr %470, i32 0, i32 1
  store ptr %469, ptr %471, align 8, !tbaa !11
  %472 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %472, align 4, !tbaa !12
  %473 = call i32 @s2n_calculate_stacktrace()
  br label %474

474:                                              ; preds = %468
  br label %475

475:                                              ; preds = %474
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %564

476:                                              ; No predecessors!
  br label %477

477:                                              ; preds = %476
  br label %478

478:                                              ; preds = %477, %442
  br label %479

479:                                              ; preds = %478
  br label %480

480:                                              ; preds = %479
  %481 = load ptr, ptr %17, align 8, !tbaa !5
  %482 = getelementptr inbounds %struct.s2n_cert, ptr %481, i32 0, i32 4
  store ptr null, ptr %482, align 8, !tbaa !27
  %483 = load ptr, ptr %17, align 8, !tbaa !5
  %484 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %483, ptr %484, align 8, !tbaa !5
  %485 = load ptr, ptr %17, align 8, !tbaa !5
  %486 = getelementptr inbounds %struct.s2n_cert, ptr %485, i32 0, i32 4
  store ptr %486, ptr %7, align 8, !tbaa !5
  br label %487

487:                                              ; preds = %480
  %488 = load ptr, ptr %17, align 8, !tbaa !5
  %489 = getelementptr inbounds %struct.s2n_cert, ptr %488, i32 0, i32 3
  %490 = load i32, ptr %15, align 4, !tbaa !12
  %491 = call i32 @s2n_alloc(ptr noundef %489, i32 noundef %490)
  %492 = icmp sgt i32 %491, -1
  br i1 %492, label %494, label %493

493:                                              ; preds = %487
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %564

494:                                              ; preds = %487
  br label %495

495:                                              ; preds = %494
  br label %496

496:                                              ; preds = %495
  br label %497

497:                                              ; preds = %496
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %498 = load i32, ptr %15, align 4, !tbaa !12
  store i32 %498, ptr %18, align 4, !tbaa !12
  %499 = load i32, ptr %18, align 4, !tbaa !12
  %500 = icmp ne i32 %499, 0
  %501 = xor i1 %500, true
  %502 = xor i1 %501, true
  %503 = zext i1 %502 to i32
  %504 = sext i32 %503 to i64
  %505 = call i64 @llvm.expect.i64(i64 %504, i64 1)
  %506 = icmp ne i64 %505, 0
  br i1 %506, label %507, label %558

507:                                              ; preds = %497
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %508 = load ptr, ptr %17, align 8, !tbaa !5
  %509 = getelementptr inbounds %struct.s2n_cert, ptr %508, i32 0, i32 3
  %510 = getelementptr inbounds %struct.s2n_blob, ptr %509, i32 0, i32 0
  %511 = load ptr, ptr %510, align 8, !tbaa !31
  %512 = load ptr, ptr %14, align 8, !tbaa !5
  %513 = load i32, ptr %18, align 4, !tbaa !12
  %514 = sext i32 %513 to i64
  %515 = call ptr @s2n_ensure_memmove_trace(ptr noundef %511, ptr noundef %512, i64 noundef %514)
  store ptr %515, ptr %19, align 8, !tbaa !5
  br label %516

516:                                              ; preds = %507
  %517 = load ptr, ptr %19, align 8, !tbaa !5
  %518 = icmp ne ptr %517, null
  br i1 %518, label %552, label %519

519:                                              ; preds = %516
  br label %520

520:                                              ; preds = %519
  br label %521

521:                                              ; preds = %520
  %522 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %523 = getelementptr inbounds %struct.s2n_debug_info, ptr %522, i32 0, i32 0
  store ptr @.str.153, ptr %523, align 8, !tbaa !9
  %524 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %525 = getelementptr inbounds %struct.s2n_debug_info, ptr %524, i32 0, i32 0
  %526 = load ptr, ptr %525, align 8, !tbaa !9
  %527 = getelementptr inbounds i8, ptr %526, i64 21
  %528 = call ptr @strrchr(ptr noundef %527, i32 noundef 47) #8
  %529 = icmp ne ptr %528, null
  br i1 %529, label %530, label %537

530:                                              ; preds = %521
  %531 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %532 = getelementptr inbounds %struct.s2n_debug_info, ptr %531, i32 0, i32 0
  %533 = load ptr, ptr %532, align 8, !tbaa !9
  %534 = getelementptr inbounds i8, ptr %533, i64 21
  %535 = call ptr @strrchr(ptr noundef %534, i32 noundef 47) #8
  %536 = getelementptr inbounds i8, ptr %535, i64 1
  br label %542

537:                                              ; preds = %521
  %538 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %539 = getelementptr inbounds %struct.s2n_debug_info, ptr %538, i32 0, i32 0
  %540 = load ptr, ptr %539, align 8, !tbaa !9
  %541 = getelementptr inbounds i8, ptr %540, i64 21
  br label %542

542:                                              ; preds = %537, %530
  %543 = phi ptr [ %536, %530 ], [ %541, %537 ]
  %544 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %545 = getelementptr inbounds %struct.s2n_debug_info, ptr %544, i32 0, i32 1
  store ptr %543, ptr %545, align 8, !tbaa !11
  %546 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %546, align 4, !tbaa !12
  %547 = call i32 @s2n_calculate_stacktrace()
  br label %548

548:                                              ; preds = %542
  br label %549

549:                                              ; preds = %548
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %555

550:                                              ; No predecessors!
  br label %551

551:                                              ; preds = %550
  br label %552

552:                                              ; preds = %551, %516
  br label %553

553:                                              ; preds = %552
  br label %554

554:                                              ; preds = %553
  store i32 0, ptr %9, align 4
  br label %555

555:                                              ; preds = %554, %549
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  %556 = load i32, ptr %9, align 4
  switch i32 %556, label %559 [
    i32 0, label %557
  ]

557:                                              ; preds = %555
  br label %558

558:                                              ; preds = %557, %497
  store i32 0, ptr %9, align 4
  br label %559

559:                                              ; preds = %558, %555
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  %560 = load i32, ptr %9, align 4
  switch i32 %560, label %564 [
    i32 0, label %561
  ]

561:                                              ; preds = %559
  br label %562

562:                                              ; preds = %561
  br label %563

563:                                              ; preds = %562
  store i32 0, ptr %9, align 4
  br label %564

564:                                              ; preds = %563, %559, %493, %475
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %565

565:                                              ; preds = %564, %436
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #9
  br label %566

566:                                              ; preds = %565, %427
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  %567 = call i32 @s2n_crypto_free(ptr noundef %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %568

568:                                              ; preds = %566, %386
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  %569 = load i32, ptr %9, align 4
  switch i32 %569, label %574 [
    i32 0, label %570
  ]

570:                                              ; preds = %568
  br label %571

571:                                              ; preds = %570
  %572 = load i64, ptr %12, align 8, !tbaa !24
  %573 = add i64 %572, 1
  store i64 %573, ptr %12, align 8, !tbaa !24
  br label %341, !llvm.loop !32

574:                                              ; preds = %568, %346
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  %575 = load i32, ptr %9, align 4
  switch i32 %575, label %577 [
    i32 50, label %576
  ]

576:                                              ; preds = %574
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 8, i1 false)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %577

577:                                              ; preds = %576, %574, %335
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %578

578:                                              ; preds = %577, %293
  %579 = call i32 @s2n_openssl_x509_stack_pop_free(ptr noundef %10)
  %580 = getelementptr inbounds %struct.s2n_result, ptr %20, i32 0, i32 0
  store i32 %579, ptr %580, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %581

581:                                              ; preds = %578, %250, %211
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @s2n_cert_chain_free_pointer(ptr noundef %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  br label %582

582:                                              ; preds = %581, %167, %127, %89, %53
  %583 = load i32, ptr %3, align 4
  ret i32 %583
}

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

declare zeroext i1 @s2n_x509_validator_is_cert_chain_validated(ptr noundef) #2

declare ptr @X509_STORE_CTX_get1_chain(ptr noundef) #2

declare i32 @s2n_openssl_x509_stack_pop_free(ptr noundef) #2

declare i32 @OPENSSL_sk_num(ptr noundef) #2

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

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

declare i32 @s2n_crypto_free(ptr noundef) #2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 speculatable willreturn memory(none) }
attributes #4 = { 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 #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 = { 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 #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, !6, i64 0}
!10 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"s2n_cert_chain_and_key", !6, i64 0, !6, i64 8, !16, i64 16, !16, i64 40, !6, i64 64, !6, i64 72, !6, i64 80}
!16 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!17 = !{!18, !6, i64 8}
!18 = !{!"s2n_cert_chain", !13, i64 0, !6, i64 8}
!19 = !{!20, !6, i64 8}
!20 = !{!"s2n_x509_validator", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !21, i64 18, !6, i64 24, !13, i64 32, !6, i64 40, !22, i64 48, !23, i64 52}
!21 = !{!"short", !7, i64 0}
!22 = !{!"s2n_cert_validation_info", !13, i64 0, !13, i64 0}
!23 = !{!"_Bool", !7, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"long", !7, i64 0}
!26 = !{!16, !6, i64 0}
!27 = !{!28, !6, i64 104}
!28 = !{!"s2n_cert", !13, i64 0, !29, i64 8, !30, i64 56, !16, i64 80, !6, i64 104}
!29 = !{!"s2n_pkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!30 = !{!"s2n_cert_info", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !23, i64 16}
!31 = !{!28, !6, i64 80}
!32 = distinct !{!32, !33}
!33 = !{!"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 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }

@_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.142 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [92 x i8], align 1

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

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

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) #0

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @s2n_connection_get_peer_cert_chain(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #5 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s2n_blob, align 8
  %.not = icmp eq ptr %0, 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.142, ptr %8, align 8, !tbaa !5
  %9 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.142, i64 21), i32 noundef 47) #7
  %.not69 = icmp eq ptr %9, null
  %10 = getelementptr inbounds i8, ptr %9, i64 1
  %11 = select i1 %.not69, ptr getelementptr inbounds (i8, ptr @.str.142, i64 21), ptr %10
  %12 = getelementptr inbounds i8, ptr %8, i64 8
  store ptr %11, ptr %12, align 8, !tbaa !10
  %13 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %13, align 4, !tbaa !11
  %14 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %132

15:                                               ; preds = %2
  %.not70 = icmp eq ptr %1, null
  br i1 %.not70, 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.143, ptr %17, align 8, !tbaa !5
  %18 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.143, i64 21), i32 noundef 47) #7
  %.not71 = icmp eq ptr %18, null
  %19 = getelementptr inbounds i8, ptr %18, i64 1
  %20 = select i1 %.not71, ptr getelementptr inbounds (i8, ptr @.str.143, i64 21), ptr %19
  %21 = getelementptr inbounds i8, ptr %17, i64 8
  store ptr %20, ptr %21, align 8, !tbaa !10
  %22 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %22, align 4, !tbaa !11
  %23 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %132

24:                                               ; preds = %15
  %25 = load ptr, ptr %1, align 8, !tbaa !13
  %.not72 = icmp eq ptr %25, null
  br i1 %.not72, label %26, label %34

26:                                               ; preds = %24
  %27 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.144, ptr %27, align 8, !tbaa !5
  %28 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.144, i64 21), i32 noundef 47) #7
  %.not73 = icmp eq ptr %28, null
  %29 = getelementptr inbounds i8, ptr %28, i64 1
  %30 = select i1 %.not73, ptr getelementptr inbounds (i8, ptr @.str.144, i64 21), ptr %29
  %31 = getelementptr inbounds i8, ptr %27, i64 8
  store ptr %30, ptr %31, align 8, !tbaa !10
  %32 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %32, align 4, !tbaa !11
  %33 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %132

34:                                               ; preds = %24
  %35 = getelementptr inbounds i8, ptr %25, i64 8
  %36 = load ptr, ptr %35, align 8, !tbaa !16
  %37 = icmp eq ptr %36, null
  br i1 %37, label %46, label %38

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

46:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store ptr %25, ptr %3, align 8, !tbaa !18
  %47 = getelementptr inbounds i8, ptr %0, i64 3704
  %48 = tail call zeroext i1 @s2n_x509_validator_is_cert_chain_validated(ptr noundef nonnull %47) #8
  br i1 %48, label %57, label %49

49:                                               ; preds = %46
  %50 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.147, ptr %50, align 8, !tbaa !5
  %51 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.147, i64 21), i32 noundef 47) #7
  %.not75 = icmp eq ptr %51, null
  %52 = getelementptr inbounds i8, ptr %51, i64 1
  %53 = select i1 %.not75, ptr getelementptr inbounds (i8, ptr @.str.147, i64 21), ptr %52
  %54 = getelementptr inbounds i8, ptr %50, i64 8
  store ptr %53, ptr %54, align 8, !tbaa !10
  %55 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762115, ptr %55, align 4, !tbaa !11
  %56 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %131

57:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %58 = getelementptr inbounds i8, ptr %0, i64 3712
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = tail call ptr @X509_STORE_CTX_get1_chain(ptr noundef %59) #8
  store ptr %60, ptr %4, align 8, !tbaa !18
  %.not76 = icmp eq ptr %60, null
  br i1 %.not76, label %61, label %69

61:                                               ; preds = %57
  %62 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.148, ptr %62, align 8, !tbaa !5
  %63 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.148, i64 21), i32 noundef 47) #7
  %.not77 = icmp eq ptr %63, null
  %64 = getelementptr inbounds i8, ptr %63, i64 1
  %65 = select i1 %.not77, ptr getelementptr inbounds (i8, ptr @.str.148, i64 21), ptr %64
  %66 = getelementptr inbounds i8, ptr %62, i64 8
  store ptr %65, ptr %66, align 8, !tbaa !10
  %67 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %67, align 4, !tbaa !11
  %68 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %129

69:                                               ; preds = %57
  %70 = tail call ptr @ossl_check_const_X509_sk_type(ptr noundef nonnull %60)
  %71 = tail call i32 @OPENSSL_sk_num(ptr noundef %70) #8
  %72 = icmp sgt i32 %71, -1
  br i1 %72, label %.preheader, label %74

.preheader:                                       ; preds = %69
  %73 = zext nneg i32 %71 to i64
  %.not8699.not = icmp eq i32 %71, 0
  br i1 %.not8699.not, label %.critedge, label %.lr.ph

74:                                               ; preds = %69
  %75 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.149, ptr %75, align 8, !tbaa !5
  %76 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.149, i64 21), i32 noundef 47) #7
  %.not78 = icmp eq ptr %76, null
  %77 = getelementptr inbounds i8, ptr %76, i64 1
  %78 = select i1 %.not78, ptr getelementptr inbounds (i8, ptr @.str.149, i64 21), ptr %77
  %79 = getelementptr inbounds i8, ptr %75, i64 8
  store ptr %78, ptr %79, align 8, !tbaa !10
  %80 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %80, align 4, !tbaa !11
  %81 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %129

.lr.ph:                                           ; preds = %.preheader, %126
  %.036101 = phi ptr [ %109, %126 ], [ %35, %.preheader ]
  %.048100 = phi i64 [ %128, %126 ], [ 0, %.preheader ]
  %82 = call ptr @ossl_check_const_X509_sk_type(ptr noundef nonnull %60)
  %83 = trunc nuw nsw i64 %.048100 to i32
  %84 = call ptr @OPENSSL_sk_value(ptr noundef %82, i32 noundef %83) #8
  %.not79 = icmp eq ptr %84, null
  br i1 %.not79, label %.thread, label %92

.thread:                                          ; preds = %.lr.ph
  %85 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.150, ptr %85, align 8, !tbaa !5
  %86 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.150, i64 21), i32 noundef 47) #7
  %.not80 = icmp eq ptr %86, null
  %87 = getelementptr inbounds i8, ptr %86, i64 1
  %88 = select i1 %.not80, ptr getelementptr inbounds (i8, ptr @.str.150, i64 21), ptr %87
  %89 = getelementptr inbounds i8, ptr %85, i64 8
  store ptr %88, ptr %89, align 8, !tbaa !10
  %90 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %90, align 4, !tbaa !11
  %91 = call i32 @s2n_calculate_stacktrace() #8
  br label %129

92:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store ptr null, ptr %5, align 8, !tbaa !18
  %93 = call i32 @i2d_X509(ptr noundef nonnull %84, ptr noundef nonnull %5) #8
  %94 = icmp sgt i32 %93, 0
  br i1 %94, label %103, label %.thread90

.thread90:                                        ; preds = %92
  %95 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.151, ptr %95, align 8, !tbaa !5
  %96 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.151, i64 21), i32 noundef 47) #7
  %.not81 = icmp eq ptr %96, null
  %97 = getelementptr inbounds i8, ptr %96, i64 1
  %98 = select i1 %.not81, ptr getelementptr inbounds (i8, ptr @.str.151, i64 21), ptr %97
  %99 = getelementptr inbounds i8, ptr %95, i64 8
  store ptr %98, ptr %99, align 8, !tbaa !10
  %100 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %100, align 4, !tbaa !11
  %101 = call i32 @s2n_calculate_stacktrace() #8
  %102 = call i32 @s2n_crypto_free(ptr noundef nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %129

103:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  %104 = call i32 @s2n_alloc(ptr noundef nonnull %6, i32 noundef 112) #8
  %105 = icmp sgt i32 %104, -1
  br i1 %105, label %106, label %.thread94

106:                                              ; preds = %103
  %107 = load ptr, ptr %6, align 8, !tbaa !24
  %.not82 = icmp eq ptr %107, null
  br i1 %.not82, label %.thread94.sink.split, label %108

108:                                              ; preds = %106
  %109 = getelementptr inbounds i8, ptr %107, i64 104
  store ptr null, ptr %109, align 8, !tbaa !25
  store ptr %107, ptr %.036101, align 8, !tbaa !18
  %110 = getelementptr inbounds i8, ptr %107, i64 80
  %111 = call i32 @s2n_alloc(ptr noundef nonnull %110, i32 noundef %93) #8
  %112 = icmp sgt i32 %111, -1
  br i1 %112, label %113, label %.thread94

113:                                              ; preds = %108
  %114 = load ptr, ptr %110, align 8, !tbaa !29
  %115 = load ptr, ptr %5, align 8, !tbaa !18
  %116 = zext nneg i32 %93 to i64
  %117 = call ptr @s2n_ensure_memmove_trace(ptr noundef %114, ptr noundef %115, i64 noundef %116) #8
  %.not84.not = icmp eq ptr %117, null
  br i1 %.not84.not, label %.thread94.sink.split, label %126

.thread94.sink.split:                             ; preds = %113, %106
  %.str.152.sink = phi ptr [ @.str.152, %106 ], [ @.str.153, %113 ]
  %.sink107 = phi ptr [ getelementptr inbounds (i8, ptr @.str.152, i64 21), %106 ], [ getelementptr inbounds (i8, ptr @.str.153, i64 21), %113 ]
  %118 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.152.sink, ptr %118, align 8, !tbaa !5
  %119 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink107, i32 noundef 47) #7
  %.not83 = icmp eq ptr %119, null
  %120 = getelementptr inbounds i8, ptr %119, i64 1
  %121 = select i1 %.not83, ptr %.sink107, ptr %120
  %122 = getelementptr inbounds i8, ptr %118, i64 8
  store ptr %121, ptr %122, align 8, !tbaa !10
  %123 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %123, align 4, !tbaa !11
  %124 = call i32 @s2n_calculate_stacktrace() #8
  br label %.thread94

.thread94:                                        ; preds = %103, %108, %.thread94.sink.split
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  %125 = call i32 @s2n_crypto_free(ptr noundef nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %129

126:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  %127 = call i32 @s2n_crypto_free(ptr noundef nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  %128 = add nuw nsw i64 %.048100, 1
  %exitcond.not = icmp eq i64 %128, %73
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !30

.critedge:                                        ; preds = %126, %.preheader
  store i64 0, ptr %3, align 8
  br label %129

129:                                              ; preds = %.thread, %.thread90, %.thread94, %74, %.critedge, %61
  %.10 = phi i32 [ -1, %61 ], [ 0, %.critedge ], [ -1, %74 ], [ -1, %.thread94 ], [ -1, %.thread90 ], [ -1, %.thread ]
  %130 = call i32 @s2n_openssl_x509_stack_pop_free(ptr noundef nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %131

131:                                              ; preds = %129, %49
  %.11 = phi i32 [ %.10, %129 ], [ -1, %49 ]
  call void @s2n_cert_chain_free_pointer(ptr noundef nonnull %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br label %132

132:                                              ; preds = %131, %38, %26, %16, %7
  %.12 = phi i32 [ %.11, %131 ], [ -1, %38 ], [ -1, %26 ], [ -1, %16 ], [ -1, %7 ]
  ret i32 %.12
}

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

declare zeroext i1 @s2n_x509_validator_is_cert_chain_validated(ptr noundef) local_unnamed_addr #2

declare ptr @X509_STORE_CTX_get1_chain(ptr noundef) local_unnamed_addr #2

declare i32 @s2n_openssl_x509_stack_pop_free(ptr noundef) local_unnamed_addr #2

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_crypto_free(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 speculatable willreturn memory(none) }
attributes #4 = { 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 #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 = { 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 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, !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, !7, i64 0}
!14 = !{!"s2n_cert_chain_and_key", !7, i64 0, !7, i64 8, !15, i64 16, !15, i64 40, !7, i64 64, !7, i64 72, !7, i64 80}
!15 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!16 = !{!17, !7, i64 8}
!17 = !{!"s2n_cert_chain", !12, i64 0, !7, i64 8}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !7, i64 8}
!20 = !{!"s2n_x509_validator", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 17, !21, i64 18, !7, i64 24, !12, i64 32, !7, i64 40, !22, i64 48, !23, i64 52}
!21 = !{!"short", !8, i64 0}
!22 = !{!"s2n_cert_validation_info", !12, i64 0, !12, i64 0}
!23 = !{!"_Bool", !8, i64 0}
!24 = !{!15, !7, i64 0}
!25 = !{!26, !7, i64 104}
!26 = !{!"s2n_cert", !12, i64 0, !27, i64 8, !28, i64 56, !15, i64 80, !7, i64 104}
!27 = !{!"s2n_pkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!28 = !{!"s2n_cert_info", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !23, i64 16}
!29 = !{!26, !7, i64 80}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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