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

; 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_blob = type { ptr, i32, i32, i8 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, 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_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_post_handshake = type { %struct.s2n_stuffer, [4 x i8] }
%struct.s2n_atomic_flag = type { i32 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.14 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [101 x i8], align 1

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

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

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

declare i32 @s2n_calculate_stacktrace() #3

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

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

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

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

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

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

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %50, label %18

18:                                               ; preds = %15
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  %21 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %22 = getelementptr inbounds %struct.s2n_debug_info, ptr %21, i32 0, i32 0
  store ptr @.str.14, ptr %22, align 8, !tbaa !9
  %23 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %24 = getelementptr inbounds %struct.s2n_debug_info, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i64 21
  %27 = call ptr @strrchr(ptr noundef %26, i32 noundef 47) #8
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %36

29:                                               ; preds = %20
  %30 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %31 = getelementptr inbounds %struct.s2n_debug_info, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %32, i64 21
  %34 = call ptr @strrchr(ptr noundef %33, i32 noundef 47) #8
  %35 = getelementptr inbounds i8, ptr %34, i64 1
  br label %41

36:                                               ; preds = %20
  %37 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %38 = getelementptr inbounds %struct.s2n_debug_info, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i64 21
  br label %41

41:                                               ; preds = %36, %29
  %42 = phi ptr [ %35, %29 ], [ %40, %36 ]
  %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 1
  store ptr %42, ptr %44, align 8, !tbaa !11
  %45 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %45, align 4, !tbaa !12
  %46 = call i32 @s2n_calculate_stacktrace()
  br label %47

47:                                               ; preds = %41
  %48 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %48, align 4, !tbaa !14
  br label %352

49:                                               ; No predecessors!
  br label %50

50:                                               ; preds = %49, %15
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %87, label %55

55:                                               ; preds = %52
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %59 = getelementptr inbounds %struct.s2n_debug_info, ptr %58, i32 0, i32 0
  store ptr @.str.15, ptr %59, align 8, !tbaa !9
  %60 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %61 = getelementptr inbounds %struct.s2n_debug_info, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds i8, ptr %62, i64 21
  %64 = call ptr @strrchr(ptr noundef %63, i32 noundef 47) #8
  %65 = icmp ne ptr %64, null
  br i1 %65, label %66, label %73

66:                                               ; preds = %57
  %67 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %68 = getelementptr inbounds %struct.s2n_debug_info, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = getelementptr inbounds i8, ptr %69, i64 21
  %71 = call ptr @strrchr(ptr noundef %70, i32 noundef 47) #8
  %72 = getelementptr inbounds i8, ptr %71, i64 1
  br label %78

73:                                               ; preds = %57
  %74 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %75 = getelementptr inbounds %struct.s2n_debug_info, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds i8, ptr %76, i64 21
  br label %78

78:                                               ; preds = %73, %66
  %79 = phi ptr [ %72, %66 ], [ %77, %73 ]
  %80 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %81 = getelementptr inbounds %struct.s2n_debug_info, ptr %80, i32 0, i32 1
  store ptr %79, ptr %81, align 8, !tbaa !11
  %82 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %82, align 4, !tbaa !12
  %83 = call i32 @s2n_calculate_stacktrace()
  br label %84

84:                                               ; preds = %78
  %85 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %85, align 4, !tbaa !14
  br label %352

86:                                               ; No predecessors!
  br label %87

87:                                               ; preds = %86, %52
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %124, label %92

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  %95 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %96 = getelementptr inbounds %struct.s2n_debug_info, ptr %95, i32 0, i32 0
  store ptr @.str.16, ptr %96, align 8, !tbaa !9
  %97 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %98 = getelementptr inbounds %struct.s2n_debug_info, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8, !tbaa !9
  %100 = getelementptr inbounds i8, ptr %99, i64 21
  %101 = call ptr @strrchr(ptr noundef %100, i32 noundef 47) #8
  %102 = icmp ne ptr %101, null
  br i1 %102, label %103, label %110

103:                                              ; preds = %94
  %104 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %105 = getelementptr inbounds %struct.s2n_debug_info, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !9
  %107 = getelementptr inbounds i8, ptr %106, i64 21
  %108 = call ptr @strrchr(ptr noundef %107, i32 noundef 47) #8
  %109 = getelementptr inbounds i8, ptr %108, i64 1
  br label %115

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

115:                                              ; preds = %110, %103
  %116 = phi ptr [ %109, %103 ], [ %114, %110 ]
  %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 1
  store ptr %116, ptr %118, align 8, !tbaa !11
  %119 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %119, align 4, !tbaa !12
  %120 = call i32 @s2n_calculate_stacktrace()
  br label %121

121:                                              ; preds = %115
  %122 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %122, align 4, !tbaa !14
  br label %352

123:                                              ; No predecessors!
  br label %124

124:                                              ; preds = %123, %89
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %349, %125
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.s2n_stuffer, ptr %127, i32 0, i32 2
  %129 = load i32, ptr %128, align 4, !tbaa !16
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.s2n_stuffer, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 8, !tbaa !19
  %133 = sub i32 %129, %132
  %134 = icmp ugt i32 %133, 0
  br i1 %134, label %135, label %350

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

136:                                              ; preds = %135
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = call i32 @s2n_protocol_preferences_read(ptr noundef %137, ptr noundef %8)
  %139 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  store i32 %138, ptr %139, align 4
  %140 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  %141 = load i32, ptr %140, align 4
  %142 = call zeroext i1 @s2n_result_is_ok(i32 %141)
  br i1 %142, label %177, label %143

143:                                              ; preds = %136
  br label %144

144:                                              ; preds = %143
  br label %145

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

154:                                              ; preds = %145
  %155 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %156 = getelementptr inbounds %struct.s2n_debug_info, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !9
  %158 = getelementptr inbounds i8, ptr %157, i64 21
  %159 = call ptr @strrchr(ptr noundef %158, i32 noundef 47) #8
  %160 = getelementptr inbounds i8, ptr %159, i64 1
  br label %166

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

166:                                              ; preds = %161, %154
  %167 = phi ptr [ %160, %154 ], [ %165, %161 ]
  %168 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %169 = getelementptr inbounds %struct.s2n_debug_info, ptr %168, i32 0, i32 1
  store ptr %167, ptr %169, align 8, !tbaa !11
  %170 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %170, align 4, !tbaa !12
  %171 = call i32 @s2n_calculate_stacktrace()
  br label %172

172:                                              ; preds = %166
  br label %173

173:                                              ; preds = %172
  %174 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %174, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %347

175:                                              ; No predecessors!
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176, %136
  br label %178

178:                                              ; preds = %177
  br label %179

179:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #9
  store i8 0, ptr %11, align 1, !tbaa !20
  br label %180

180:                                              ; preds = %179
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = call i32 @s2n_protocol_preferences_contain(ptr noundef %181, ptr noundef %8, ptr noundef %11)
  %183 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  store i32 %182, ptr %183, align 4
  %184 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  %185 = load i32, ptr %184, align 4
  %186 = call zeroext i1 @s2n_result_is_ok(i32 %185)
  br i1 %186, label %221, label %187

187:                                              ; preds = %180
  br label %188

188:                                              ; preds = %187
  br label %189

189:                                              ; preds = %188
  %190 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %191 = getelementptr inbounds %struct.s2n_debug_info, ptr %190, i32 0, i32 0
  store ptr @.str.18, ptr %191, align 8, !tbaa !9
  %192 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %193 = getelementptr inbounds %struct.s2n_debug_info, ptr %192, i32 0, i32 0
  %194 = load ptr, ptr %193, align 8, !tbaa !9
  %195 = getelementptr inbounds i8, ptr %194, i64 21
  %196 = call ptr @strrchr(ptr noundef %195, i32 noundef 47) #8
  %197 = icmp ne ptr %196, null
  br i1 %197, label %198, label %205

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

205:                                              ; preds = %189
  %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 0
  %208 = load ptr, ptr %207, align 8, !tbaa !9
  %209 = getelementptr inbounds i8, ptr %208, i64 21
  br label %210

210:                                              ; preds = %205, %198
  %211 = phi ptr [ %204, %198 ], [ %209, %205 ]
  %212 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %213 = getelementptr inbounds %struct.s2n_debug_info, ptr %212, i32 0, i32 1
  store ptr %211, ptr %213, align 8, !tbaa !11
  %214 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %214, align 4, !tbaa !12
  %215 = call i32 @s2n_calculate_stacktrace()
  br label %216

216:                                              ; preds = %210
  br label %217

217:                                              ; preds = %216
  %218 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %218, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %346

219:                                              ; No predecessors!
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220, %180
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  %224 = load i8, ptr %11, align 1, !tbaa !20, !range !22, !noundef !23
  %225 = trunc i8 %224 to i1
  br i1 %225, label %226, label %345

226:                                              ; preds = %223
  br label %227

227:                                              ; preds = %226
  %228 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 1
  %229 = load i32, ptr %228, align 8, !tbaa !24
  %230 = zext i32 %229 to i64
  %231 = icmp ult i64 %230, 256
  br i1 %231, label %266, label %232

232:                                              ; preds = %227
  br label %233

233:                                              ; preds = %232
  br label %234

234:                                              ; preds = %233
  %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 0
  store ptr @.str.19, ptr %236, align 8, !tbaa !9
  %237 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %238 = getelementptr inbounds %struct.s2n_debug_info, ptr %237, i32 0, i32 0
  %239 = load ptr, ptr %238, align 8, !tbaa !9
  %240 = getelementptr inbounds i8, ptr %239, i64 21
  %241 = call ptr @strrchr(ptr noundef %240, i32 noundef 47) #8
  %242 = icmp ne ptr %241, null
  br i1 %242, label %243, label %250

243:                                              ; preds = %234
  %244 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %245 = getelementptr inbounds %struct.s2n_debug_info, ptr %244, i32 0, i32 0
  %246 = load ptr, ptr %245, align 8, !tbaa !9
  %247 = getelementptr inbounds i8, ptr %246, i64 21
  %248 = call ptr @strrchr(ptr noundef %247, i32 noundef 47) #8
  %249 = getelementptr inbounds i8, ptr %248, i64 1
  br label %255

250:                                              ; preds = %234
  %251 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %252 = getelementptr inbounds %struct.s2n_debug_info, ptr %251, i32 0, i32 0
  %253 = load ptr, ptr %252, align 8, !tbaa !9
  %254 = getelementptr inbounds i8, ptr %253, i64 21
  br label %255

255:                                              ; preds = %250, %243
  %256 = phi ptr [ %249, %243 ], [ %254, %250 ]
  %257 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %258 = getelementptr inbounds %struct.s2n_debug_info, ptr %257, i32 0, i32 1
  store ptr %256, ptr %258, align 8, !tbaa !11
  %259 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %259, align 4, !tbaa !12
  %260 = call i32 @s2n_calculate_stacktrace()
  br label %261

261:                                              ; preds = %255
  br label %262

262:                                              ; preds = %261
  %263 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %263, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %346

264:                                              ; No predecessors!
  br label %265

265:                                              ; preds = %264
  br label %266

266:                                              ; preds = %265, %227
  br label %267

267:                                              ; preds = %266
  br label %268

268:                                              ; preds = %267
  br label %269

269:                                              ; preds = %268
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  %270 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 1
  %271 = load i32, ptr %270, align 8, !tbaa !24
  store i32 %271, ptr %13, align 4, !tbaa !12
  %272 = load i32, ptr %13, align 4, !tbaa !12
  %273 = icmp ne i32 %272, 0
  %274 = xor i1 %273, true
  %275 = xor i1 %274, true
  %276 = zext i1 %275 to i32
  %277 = sext i32 %276 to i64
  %278 = call i64 @llvm.expect.i64(i64 %277, i64 1)
  %279 = icmp ne i64 %278, 0
  br i1 %279, label %280, label %332

280:                                              ; preds = %269
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %281 = load ptr, ptr %5, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct.s2n_connection, ptr %281, i32 0, i32 64
  %283 = getelementptr inbounds [256 x i8], ptr %282, i64 0, i64 0
  %284 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 0
  %285 = load ptr, ptr %284, align 8, !tbaa !25
  %286 = load i32, ptr %13, align 4, !tbaa !12
  %287 = zext i32 %286 to i64
  %288 = call ptr @s2n_ensure_memmove_trace(ptr noundef %283, ptr noundef %285, i64 noundef %287)
  store ptr %288, ptr %14, align 8, !tbaa !5
  br label %289

289:                                              ; preds = %280
  %290 = load ptr, ptr %14, align 8, !tbaa !5
  %291 = icmp ne ptr %290, null
  br i1 %291, label %326, label %292

292:                                              ; preds = %289
  br label %293

293:                                              ; preds = %292
  br label %294

294:                                              ; preds = %293
  %295 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %296 = getelementptr inbounds %struct.s2n_debug_info, ptr %295, i32 0, i32 0
  store ptr @.str.20, ptr %296, align 8, !tbaa !9
  %297 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %298 = getelementptr inbounds %struct.s2n_debug_info, ptr %297, i32 0, i32 0
  %299 = load ptr, ptr %298, align 8, !tbaa !9
  %300 = getelementptr inbounds i8, ptr %299, i64 21
  %301 = call ptr @strrchr(ptr noundef %300, i32 noundef 47) #8
  %302 = icmp ne ptr %301, null
  br i1 %302, label %303, label %310

303:                                              ; preds = %294
  %304 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %305 = getelementptr inbounds %struct.s2n_debug_info, ptr %304, i32 0, i32 0
  %306 = load ptr, ptr %305, align 8, !tbaa !9
  %307 = getelementptr inbounds i8, ptr %306, i64 21
  %308 = call ptr @strrchr(ptr noundef %307, i32 noundef 47) #8
  %309 = getelementptr inbounds i8, ptr %308, i64 1
  br label %315

310:                                              ; preds = %294
  %311 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %312 = getelementptr inbounds %struct.s2n_debug_info, ptr %311, i32 0, i32 0
  %313 = load ptr, ptr %312, align 8, !tbaa !9
  %314 = getelementptr inbounds i8, ptr %313, i64 21
  br label %315

315:                                              ; preds = %310, %303
  %316 = phi ptr [ %309, %303 ], [ %314, %310 ]
  %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 1
  store ptr %316, ptr %318, align 8, !tbaa !11
  %319 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %319, align 4, !tbaa !12
  %320 = call i32 @s2n_calculate_stacktrace()
  br label %321

321:                                              ; preds = %315
  br label %322

322:                                              ; preds = %321
  %323 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %323, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %329

324:                                              ; No predecessors!
  br label %325

325:                                              ; preds = %324
  br label %326

326:                                              ; preds = %325, %289
  br label %327

327:                                              ; preds = %326
  br label %328

328:                                              ; preds = %327
  store i32 0, ptr %10, align 4
  br label %329

329:                                              ; preds = %328, %322
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  %330 = load i32, ptr %10, align 4
  switch i32 %330, label %333 [
    i32 0, label %331
  ]

331:                                              ; preds = %329
  br label %332

332:                                              ; preds = %331, %269
  store i32 0, ptr %10, align 4
  br label %333

333:                                              ; preds = %332, %329
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  %334 = load i32, ptr %10, align 4
  switch i32 %334, label %346 [
    i32 0, label %335
  ]

335:                                              ; preds = %333
  br label %336

336:                                              ; preds = %335
  br label %337

337:                                              ; preds = %336
  %338 = load ptr, ptr %5, align 8, !tbaa !5
  %339 = getelementptr inbounds %struct.s2n_connection, ptr %338, i32 0, i32 64
  %340 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 1
  %341 = load i32, ptr %340, align 8, !tbaa !24
  %342 = zext i32 %341 to i64
  %343 = getelementptr inbounds [256 x i8], ptr %339, i64 0, i64 %342
  store i8 0, ptr %343, align 1, !tbaa !26
  %344 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %344, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %346

345:                                              ; preds = %223
  store i32 0, ptr %10, align 4
  br label %346

346:                                              ; preds = %345, %337, %333, %262, %217
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #9
  br label %347

347:                                              ; preds = %346, %173
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #9
  %348 = load i32, ptr %10, align 4
  switch i32 %348, label %355 [
    i32 0, label %349
    i32 1, label %352
  ]

349:                                              ; preds = %347
  br label %126, !llvm.loop !27

350:                                              ; preds = %126
  %351 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %351, align 4, !tbaa !14
  br label %352

352:                                              ; preds = %350, %347, %121, %84, %47
  %353 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %354 = load i32, ptr %353, align 4
  ret i32 %354

355:                                              ; preds = %347
  unreachable
}

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind willreturn memory(none) }
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, !13, i64 0}
!15 = !{!"", !13, i64 0}
!16 = !{!17, !13, i64 28}
!17 = !{!"s2n_stuffer", !18, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!18 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!19 = !{!17, !13, i64 24}
!20 = !{!21, !21, i64 0}
!21 = !{!"_Bool", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!18, !13, i64 8}
!25 = !{!18, !6, i64 0}
!26 = !{!7, !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.s2n_debug_info = type { ptr, ptr }
%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.14 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [101 x i8], align 1

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

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #3

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, 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
define dso_local noundef i32 @s2n_select_server_preference_protocol(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct.s2n_blob, align 8
  %5 = alloca i8, align 1
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %14

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

14:                                               ; preds = %3
  %.not28 = icmp eq ptr %1, null
  br i1 %.not28, label %15, label %23

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

23:                                               ; preds = %14
  %.not30 = icmp eq ptr %2, null
  br i1 %.not30, label %28, label %.preheader

.preheader:                                       ; preds = %23
  %24 = getelementptr inbounds i8, ptr %1, i64 28
  %25 = getelementptr inbounds i8, ptr %1, i64 24
  %26 = load i32, ptr %24, align 4, !tbaa !13
  %27 = load i32, ptr %25, align 8, !tbaa !16
  %.not3252 = icmp eq i32 %26, %27
  br i1 %.not3252, label %.loopexit, label %.lr.ph

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

.lr.ph:                                           ; preds = %.preheader, %89
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, i8 0, i64 24, i1 false)
  %36 = call i32 @s2n_protocol_preferences_read(ptr noundef nonnull %1, ptr noundef nonnull %4)
  %37 = call zeroext i1 @s2n_result_is_ok(i32 %36)
  br i1 %37, label %45, label %.thread44

.thread44:                                        ; preds = %.lr.ph
  %38 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.17, ptr %38, align 8, !tbaa !5
  %39 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.17, i64 21), i32 noundef 47) #7
  %.not33 = icmp eq ptr %39, null
  %40 = getelementptr inbounds i8, ptr %39, i64 1
  %41 = select i1 %.not33, ptr getelementptr inbounds (i8, ptr @.str.17, i64 21), ptr %40
  %42 = getelementptr inbounds i8, ptr %38, i64 8
  store ptr %41, ptr %42, align 8, !tbaa !10
  %43 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %43, align 4, !tbaa !11
  %44 = call i32 @s2n_calculate_stacktrace() #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  br label %.loopexit

45:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #8
  store i8 0, ptr %5, align 1, !tbaa !17
  %46 = call i32 @s2n_protocol_preferences_contain(ptr noundef nonnull %2, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %47 = call zeroext i1 @s2n_result_is_ok(i32 %46)
  br i1 %47, label %56, label %48

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

56:                                               ; preds = %45
  %57 = load i8, ptr %5, align 1, !tbaa !17, !range !19, !noundef !20
  %58 = trunc nuw i8 %57 to i1
  br i1 %58, label %59, label %89

59:                                               ; preds = %56
  %60 = getelementptr inbounds i8, ptr %4, i64 8
  %61 = load i32, ptr %60, align 8, !tbaa !21
  %62 = zext i32 %61 to i64
  %63 = icmp ult i32 %61, 256
  br i1 %63, label %72, label %64

64:                                               ; preds = %59
  %65 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.19, ptr %65, align 8, !tbaa !5
  %66 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.19, i64 21), i32 noundef 47) #7
  %.not35 = icmp eq ptr %66, null
  %67 = getelementptr inbounds i8, ptr %66, i64 1
  %68 = select i1 %.not35, ptr getelementptr inbounds (i8, ptr @.str.19, i64 21), ptr %67
  %69 = getelementptr inbounds i8, ptr %65, i64 8
  store ptr %68, ptr %69, align 8, !tbaa !10
  %70 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %70, align 4, !tbaa !11
  %71 = call i32 @s2n_calculate_stacktrace() #8
  br label %.thread48

72:                                               ; preds = %59
  %.not36 = icmp eq i32 %61, 0
  br i1 %.not36, label %.thread, label %73, !prof !22

73:                                               ; preds = %72
  %74 = getelementptr inbounds i8, ptr %0, i64 2528
  %75 = load ptr, ptr %4, align 8, !tbaa !23
  %76 = call ptr @s2n_ensure_memmove_trace(ptr noundef nonnull %74, ptr noundef %75, i64 noundef %62) #8
  %.not37.not = icmp eq ptr %76, null
  br i1 %.not37.not, label %78, label %..thread_crit_edge

..thread_crit_edge:                               ; preds = %73
  %.pre = load i32, ptr %60, align 8, !tbaa !21
  %77 = zext i32 %.pre to i64
  br label %.thread

78:                                               ; preds = %73
  %79 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.20, ptr %79, align 8, !tbaa !5
  %80 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.20, i64 21), i32 noundef 47) #7
  %.not38 = icmp eq ptr %80, null
  %81 = getelementptr inbounds i8, ptr %80, i64 1
  %82 = select i1 %.not38, ptr getelementptr inbounds (i8, ptr @.str.20, i64 21), ptr %81
  %83 = getelementptr inbounds i8, ptr %79, i64 8
  store ptr %82, ptr %83, align 8, !tbaa !10
  %84 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %84, align 4, !tbaa !11
  %85 = call i32 @s2n_calculate_stacktrace() #8
  br label %.thread48

.thread:                                          ; preds = %..thread_crit_edge, %72
  %86 = phi i64 [ %77, %..thread_crit_edge ], [ 0, %72 ]
  %87 = getelementptr inbounds i8, ptr %0, i64 2528
  %88 = getelementptr inbounds [256 x i8], ptr %87, i64 0, i64 %86
  store i8 0, ptr %88, align 1, !tbaa !24
  br label %.thread48

.thread48:                                        ; preds = %.thread, %78, %64, %48
  %.sroa.016.4.ph = phi i32 [ -1, %48 ], [ -1, %64 ], [ -1, %78 ], [ 0, %.thread ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  br label %.loopexit

89:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  %90 = load i32, ptr %24, align 4, !tbaa !13
  %91 = load i32, ptr %25, align 8, !tbaa !16
  %.not32 = icmp eq i32 %90, %91
  br i1 %.not32, label %.loopexit, label %.lr.ph

.loopexit:                                        ; preds = %89, %.preheader, %.thread48, %.thread44, %28, %15, %6
  %.sroa.016.6 = phi i32 [ -1, %28 ], [ -1, %15 ], [ -1, %6 ], [ -1, %.thread44 ], [ %.sroa.016.4.ph, %.thread48 ], [ 0, %.preheader ], [ 0, %89 ]
  ret i32 %.sroa.016.6
}

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !12, i64 28}
!14 = !{!"s2n_stuffer", !15, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!15 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!16 = !{!14, !12, i64 24}
!17 = !{!18, !18, i64 0}
!18 = !{!"_Bool", !8, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!15, !12, i64 8}
!22 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!23 = !{!15, !7, i64 0}
!24 = !{!8, !8, i64 0}


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