; LLVM IR from aws/s2n-tls :: tests/testlib (s2n_connection_test_utils)

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

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

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

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_set_all_mutually_supported_groups(ptr noundef %0) #4 {
  %2 = alloca %struct.s2n_result, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %44, label %12

12:                                               ; preds = %9
  br label %13

13:                                               ; preds = %12
  br label %14

14:                                               ; preds = %13
  %15 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %16 = getelementptr inbounds %struct.s2n_debug_info, ptr %15, i32 0, i32 0
  store ptr @.str.14, ptr %16, align 8, !tbaa !9
  %17 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %18 = getelementptr inbounds %struct.s2n_debug_info, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %19, i64 21
  %21 = call ptr @strrchr(ptr noundef %20, i32 noundef 47) #5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %30

23:                                               ; preds = %14
  %24 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %25 = getelementptr inbounds %struct.s2n_debug_info, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds i8, ptr %26, i64 21
  %28 = call ptr @strrchr(ptr noundef %27, i32 noundef 47) #5
  %29 = getelementptr inbounds i8, ptr %28, i64 1
  br label %35

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

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

41:                                               ; preds = %35
  %42 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %42, align 4, !tbaa !14
  br label %195

43:                                               ; No predecessors!
  br label %44

44:                                               ; preds = %43, %9
  br label %45

45:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = call i32 @s2n_connection_get_ecc_preferences(ptr noundef %47, ptr noundef %4)
  %49 = icmp sgt i32 %48, -1
  br i1 %49, label %52, label %50

50:                                               ; preds = %46
  %51 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %51, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %194

52:                                               ; preds = %46
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  br label %55

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

58:                                               ; preds = %55
  br label %59

59:                                               ; preds = %58
  br label %60

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

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

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

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

87:                                               ; preds = %81
  br label %88

88:                                               ; preds = %87
  %89 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %89, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %194

90:                                               ; No predecessors!
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91, %55
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !16
  br label %95

95:                                               ; preds = %115, %94
  %96 = load i64, ptr %6, align 8, !tbaa !16
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.s2n_ecc_preferences, ptr %97, i32 0, i32 0
  %99 = load i8, ptr %98, align 8, !tbaa !18
  %100 = zext i8 %99 to i64
  %101 = icmp ult i64 %96, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %95
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %118

103:                                              ; preds = %95
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.s2n_ecc_preferences, ptr %104, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !20
  %107 = load i64, ptr %6, align 8, !tbaa !16
  %108 = getelementptr inbounds ptr, ptr %106, i64 %107
  %109 = load ptr, ptr %108, align 8, !tbaa !5
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.s2n_connection, ptr %110, i32 0, i32 31
  %112 = getelementptr inbounds %struct.s2n_kex_parameters, ptr %111, i32 0, i32 2
  %113 = load i64, ptr %6, align 8, !tbaa !16
  %114 = getelementptr inbounds [4 x ptr], ptr %112, i64 0, i64 %113
  store ptr %109, ptr %114, align 8, !tbaa !5
  br label %115

115:                                              ; preds = %103
  %116 = load i64, ptr %6, align 8, !tbaa !16
  %117 = add i64 %116, 1
  store i64 %117, ptr %6, align 8, !tbaa !16
  br label %95, !llvm.loop !21

118:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = call i32 @s2n_connection_get_kem_preferences(ptr noundef %120, ptr noundef %7)
  %122 = icmp sgt i32 %121, -1
  br i1 %122, label %125, label %123

123:                                              ; preds = %119
  %124 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %124, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %193

125:                                              ; preds = %119
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = icmp ne ptr %129, null
  br i1 %130, label %165, label %131

131:                                              ; preds = %128
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  %134 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %135 = getelementptr inbounds %struct.s2n_debug_info, ptr %134, i32 0, i32 0
  store ptr @.str.16, ptr %135, align 8, !tbaa !9
  %136 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %137 = getelementptr inbounds %struct.s2n_debug_info, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %137, align 8, !tbaa !9
  %139 = getelementptr inbounds i8, ptr %138, i64 21
  %140 = call ptr @strrchr(ptr noundef %139, i32 noundef 47) #5
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %149

142:                                              ; preds = %133
  %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) #5
  %148 = getelementptr inbounds i8, ptr %147, i64 1
  br label %154

149:                                              ; preds = %133
  %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
  br label %154

154:                                              ; preds = %149, %142
  %155 = phi ptr [ %148, %142 ], [ %153, %149 ]
  %156 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %157 = getelementptr inbounds %struct.s2n_debug_info, ptr %156, i32 0, i32 1
  store ptr %155, ptr %157, align 8, !tbaa !11
  %158 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %158, align 4, !tbaa !12
  %159 = call i32 @s2n_calculate_stacktrace()
  br label %160

160:                                              ; preds = %154
  br label %161

161:                                              ; preds = %160
  %162 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %162, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %193

163:                                              ; No predecessors!
  br label %164

164:                                              ; preds = %163
  br label %165

165:                                              ; preds = %164, %128
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %168

168:                                              ; preds = %188, %167
  %169 = load i64, ptr %8, align 8, !tbaa !16
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %170, i32 0, i32 2
  %172 = load i8, ptr %171, align 8, !tbaa !23
  %173 = zext i8 %172 to i64
  %174 = icmp ult i64 %169, %173
  br i1 %174, label %176, label %175

175:                                              ; preds = %168
  store i32 27, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %191

176:                                              ; preds = %168
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %177, i32 0, i32 3
  %179 = load ptr, ptr %178, align 8, !tbaa !25
  %180 = load i64, ptr %8, align 8, !tbaa !16
  %181 = getelementptr inbounds ptr, ptr %179, i64 %180
  %182 = load ptr, ptr %181, align 8, !tbaa !5
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.s2n_connection, ptr %183, i32 0, i32 31
  %185 = getelementptr inbounds %struct.s2n_kex_parameters, ptr %184, i32 0, i32 6
  %186 = load i64, ptr %8, align 8, !tbaa !16
  %187 = getelementptr inbounds [8 x ptr], ptr %185, i64 0, i64 %186
  store ptr %182, ptr %187, align 8, !tbaa !5
  br label %188

188:                                              ; preds = %176
  %189 = load i64, ptr %8, align 8, !tbaa !16
  %190 = add i64 %189, 1
  store i64 %190, ptr %8, align 8, !tbaa !16
  br label %168, !llvm.loop !26

191:                                              ; preds = %175
  %192 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 0, ptr %192, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %193

193:                                              ; preds = %191, %161, %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %194

194:                                              ; preds = %193, %88, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %195

195:                                              ; preds = %194, %41
  %196 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  %197 = load i32, ptr %196, align 4
  ret i32 %197
}

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

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

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


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

%struct.s2n_debug_info = type { ptr, ptr }

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

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_set_all_mutually_supported_groups(ptr noundef %0) local_unnamed_addr #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %12

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

12:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  store ptr null, ptr %2, align 8, !tbaa !13
  %13 = call i32 @s2n_connection_get_ecc_preferences(ptr noundef nonnull %0, ptr noundef nonnull %2) #6
  %14 = icmp sgt i32 %13, -1
  br i1 %14, label %15, label %100

15:                                               ; preds = %12
  %16 = load ptr, ptr %2, align 8, !tbaa !13
  %.not18 = icmp eq ptr %16, null
  br i1 %.not18, label %22, label %.preheader22

.preheader22:                                     ; preds = %15
  %17 = load i8, ptr %16, align 8, !tbaa !14
  %18 = zext i8 %17 to i64
  %.not26 = icmp eq i8 %17, 0
  br i1 %.not26, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader22
  %19 = getelementptr inbounds i8, ptr %16, i64 8
  %20 = getelementptr inbounds i8, ptr %0, i64 672
  %xtraiter = and i64 %18, 3
  %21 = icmp ult i8 %17, 4
  br i1 %21, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %18, 252
  br label %37

22:                                               ; preds = %15
  %23 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.15, ptr %23, align 8, !tbaa !5
  %24 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.15, i64 21), i32 noundef 47) #5
  %.not19 = icmp eq ptr %24, null
  %25 = getelementptr inbounds i8, ptr %24, i64 1
  %26 = select i1 %.not19, ptr getelementptr inbounds (i8, ptr @.str.15, i64 21), ptr %25
  %27 = getelementptr inbounds i8, ptr %23, i64 8
  store ptr %26, ptr %27, align 8, !tbaa !10
  %28 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %28, align 4, !tbaa !11
  %29 = call i32 @s2n_calculate_stacktrace() #6
  br label %100

._crit_edge.loopexit.unr-lcssa:                   ; preds = %37, %.lr.ph
  %.01223.unr = phi i64 [ 0, %.lr.ph ], [ %57, %37 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %.01223.epil = phi i64 [ %34, %.epil.preheader ], [ %.01223.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %30 = load ptr, ptr %19, align 8, !tbaa !16
  %31 = getelementptr inbounds ptr, ptr %30, i64 %.01223.epil
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = getelementptr inbounds [4 x ptr], ptr %20, i64 0, i64 %.01223.epil
  store ptr %32, ptr %33, align 8, !tbaa !13
  %34 = add nuw nsw i64 %.01223.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !17

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %.preheader22
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  store ptr null, ptr %3, align 8, !tbaa !13
  %35 = call i32 @s2n_connection_get_kem_preferences(ptr noundef nonnull %0, ptr noundef nonnull %3) #6
  %36 = icmp sgt i32 %35, -1
  br i1 %36, label %58, label %.loopexit

37:                                               ; preds = %37, %.lr.ph.new
  %.01223 = phi i64 [ 0, %.lr.ph.new ], [ %57, %37 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %37 ]
  %38 = load ptr, ptr %19, align 8, !tbaa !16
  %39 = getelementptr inbounds ptr, ptr %38, i64 %.01223
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  %41 = getelementptr inbounds [4 x ptr], ptr %20, i64 0, i64 %.01223
  store ptr %40, ptr %41, align 8, !tbaa !13
  %42 = or disjoint i64 %.01223, 1
  %43 = load ptr, ptr %19, align 8, !tbaa !16
  %44 = getelementptr inbounds ptr, ptr %43, i64 %42
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = getelementptr inbounds [4 x ptr], ptr %20, i64 0, i64 %42
  store ptr %45, ptr %46, align 8, !tbaa !13
  %47 = or disjoint i64 %.01223, 2
  %48 = load ptr, ptr %19, align 8, !tbaa !16
  %49 = getelementptr inbounds ptr, ptr %48, i64 %47
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %51 = getelementptr inbounds [4 x ptr], ptr %20, i64 0, i64 %47
  store ptr %50, ptr %51, align 8, !tbaa !13
  %52 = or disjoint i64 %.01223, 3
  %53 = load ptr, ptr %19, align 8, !tbaa !16
  %54 = getelementptr inbounds ptr, ptr %53, i64 %52
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = getelementptr inbounds [4 x ptr], ptr %20, i64 0, i64 %52
  store ptr %55, ptr %56, align 8, !tbaa !13
  %57 = add nuw nsw i64 %.01223, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %37, !llvm.loop !19

58:                                               ; preds = %._crit_edge
  %59 = load ptr, ptr %3, align 8, !tbaa !13
  %.not20 = icmp eq ptr %59, null
  br i1 %.not20, label %66, label %.preheader

.preheader:                                       ; preds = %58
  %60 = getelementptr inbounds i8, ptr %59, i64 16
  %61 = load i8, ptr %60, align 8, !tbaa !21
  %62 = zext i8 %61 to i64
  %.not27 = icmp eq i8 %61, 0
  br i1 %.not27, label %.loopexit, label %.lr.ph25

.lr.ph25:                                         ; preds = %.preheader
  %63 = getelementptr inbounds i8, ptr %59, i64 24
  %64 = getelementptr inbounds i8, ptr %0, i64 944
  %xtraiter30 = and i64 %62, 3
  %65 = icmp ult i8 %61, 4
  br i1 %65, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph25.new

.lr.ph25.new:                                     ; preds = %.lr.ph25
  %unroll_iter33 = and i64 %62, 252
  br label %74

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

74:                                               ; preds = %74, %.lr.ph25.new
  %.024 = phi i64 [ 0, %.lr.ph25.new ], [ %94, %74 ]
  %niter34 = phi i64 [ 0, %.lr.ph25.new ], [ %niter34.next.3, %74 ]
  %75 = load ptr, ptr %63, align 8, !tbaa !23
  %76 = getelementptr inbounds ptr, ptr %75, i64 %.024
  %77 = load ptr, ptr %76, align 8, !tbaa !13
  %78 = getelementptr inbounds [8 x ptr], ptr %64, i64 0, i64 %.024
  store ptr %77, ptr %78, align 8, !tbaa !13
  %79 = or disjoint i64 %.024, 1
  %80 = load ptr, ptr %63, align 8, !tbaa !23
  %81 = getelementptr inbounds ptr, ptr %80, i64 %79
  %82 = load ptr, ptr %81, align 8, !tbaa !13
  %83 = getelementptr inbounds [8 x ptr], ptr %64, i64 0, i64 %79
  store ptr %82, ptr %83, align 8, !tbaa !13
  %84 = or disjoint i64 %.024, 2
  %85 = load ptr, ptr %63, align 8, !tbaa !23
  %86 = getelementptr inbounds ptr, ptr %85, i64 %84
  %87 = load ptr, ptr %86, align 8, !tbaa !13
  %88 = getelementptr inbounds [8 x ptr], ptr %64, i64 0, i64 %84
  store ptr %87, ptr %88, align 8, !tbaa !13
  %89 = or disjoint i64 %.024, 3
  %90 = load ptr, ptr %63, align 8, !tbaa !23
  %91 = getelementptr inbounds ptr, ptr %90, i64 %89
  %92 = load ptr, ptr %91, align 8, !tbaa !13
  %93 = getelementptr inbounds [8 x ptr], ptr %64, i64 0, i64 %89
  store ptr %92, ptr %93, align 8, !tbaa !13
  %94 = add nuw nsw i64 %.024, 4
  %niter34.next.3 = add i64 %niter34, 4
  %niter34.ncmp.3 = icmp eq i64 %niter34.next.3, %unroll_iter33
  br i1 %niter34.ncmp.3, label %.loopexit.loopexit.unr-lcssa, label %74, !llvm.loop !24

.loopexit.loopexit.unr-lcssa:                     ; preds = %74, %.lr.ph25
  %.024.unr = phi i64 [ 0, %.lr.ph25 ], [ %94, %74 ]
  %lcmp.mod32.not = icmp eq i64 %xtraiter30, 0
  br i1 %lcmp.mod32.not, label %.loopexit, label %.epil.preheader29

.epil.preheader29:                                ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader29
  %.024.epil = phi i64 [ %99, %.epil.preheader29 ], [ %.024.unr, %.loopexit.loopexit.unr-lcssa ]
  %epil.iter31 = phi i64 [ %epil.iter31.next, %.epil.preheader29 ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  %95 = load ptr, ptr %63, align 8, !tbaa !23
  %96 = getelementptr inbounds ptr, ptr %95, i64 %.024.epil
  %97 = load ptr, ptr %96, align 8, !tbaa !13
  %98 = getelementptr inbounds [8 x ptr], ptr %64, i64 0, i64 %.024.epil
  store ptr %97, ptr %98, align 8, !tbaa !13
  %99 = add nuw nsw i64 %.024.epil, 1
  %epil.iter31.next = add i64 %epil.iter31, 1
  %epil.iter31.cmp.not = icmp eq i64 %epil.iter31.next, %xtraiter30
  br i1 %epil.iter31.cmp.not, label %.loopexit, label %.epil.preheader29, !llvm.loop !25

.loopexit:                                        ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader29, %.preheader, %._crit_edge, %66
  %.sroa.0.0 = phi i32 [ -1, %66 ], [ -1, %._crit_edge ], [ 0, %.preheader ], [ 0, %.epil.preheader29 ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %100

100:                                              ; preds = %12, %.loopexit, %22
  %.sroa.0.1 = phi i32 [ %.sroa.0.0, %.loopexit ], [ -1, %22 ], [ -1, %12 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %101

101:                                              ; preds = %100, %4
  %.sroa.0.2 = phi i32 [ %.sroa.0.1, %100 ], [ -1, %4 ]
  ret i32 %.sroa.0.2
}

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

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

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


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