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

; 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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, 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.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [95 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

declare i32 @s2n_connection_get_protocol_preferences(ptr noundef, ptr noundef) #1

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

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

declare i32 @s2n_calculate_stacktrace() #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_server_npn_recv(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.s2n_result, align 4
  %9 = alloca %struct.s2n_stuffer, align 8
  %10 = alloca %struct.s2n_blob, align 8
  %11 = alloca %struct.s2n_result, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  store ptr null, ptr %6, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call i32 @s2n_connection_get_protocol_preferences(ptr noundef %15, ptr noundef %6)
  %17 = icmp sgt i32 %16, -1
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %246

19:                                               ; preds = %14
  br label %20

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20
  br label %22

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

25:                                               ; preds = %22
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  %28 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %29 = getelementptr inbounds %struct.s2n_debug_info, ptr %28, i32 0, i32 0
  store ptr @.str.1, ptr %29, align 8, !tbaa !9
  %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) #9
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %43

36:                                               ; preds = %27
  %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
  %41 = call ptr @strrchr(ptr noundef %40, i32 noundef 47) #9
  %42 = getelementptr inbounds i8, ptr %41, i64 1
  br label %48

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

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

54:                                               ; preds = %48
  br label %55

55:                                               ; preds = %54
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %246

56:                                               ; No predecessors!
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57, %22
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.s2n_blob, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !14
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %60
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %246

66:                                               ; preds = %60
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.s2n_stuffer, ptr %67, i32 0, i32 2
  %69 = load i32, ptr %68, align 4, !tbaa !16
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.s2n_stuffer, ptr %70, i32 0, i32 1
  %72 = load i32, ptr %71, align 8, !tbaa !18
  %73 = sub i32 %69, %72
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %89

75:                                               ; preds = %66
  br label %76

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

85:                                               ; preds = %76
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %246

86:                                               ; preds = %76
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88, %66
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = call ptr @s2n_get_application_protocol(ptr noundef %90)
  %92 = icmp eq ptr %91, null
  br i1 %92, label %93, label %241

93:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 40, ptr %9) #8
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 40, i1 false)
  br label %94

94:                                               ; preds = %93
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = call i32 @s2n_stuffer_init(ptr noundef %9, ptr noundef %95)
  %97 = icmp sgt i32 %96, -1
  br i1 %97, label %99, label %98

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

99:                                               ; preds = %94
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.s2n_blob, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 8, !tbaa !14
  %106 = call i32 @s2n_stuffer_skip_write(ptr noundef %9, i32 noundef %105)
  %107 = icmp sgt i32 %106, -1
  br i1 %107, label %109, label %108

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

109:                                              ; preds = %102
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #8
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 24, i1 false)
  br label %112

112:                                              ; preds = %111
  %113 = call i32 @s2n_protocol_preferences_read(ptr noundef %9, ptr noundef %10)
  %114 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  store i32 %113, ptr %114, align 4
  %115 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  %116 = load i32, ptr %115, align 4
  %117 = call zeroext i1 @s2n_result_is_ok(i32 %116)
  br i1 %117, label %119, label %118

118:                                              ; preds = %112
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %237

119:                                              ; preds = %112
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121
  %123 = getelementptr inbounds %struct.s2n_blob, ptr %10, i32 0, i32 1
  %124 = load i32, ptr %123, align 8, !tbaa !14
  %125 = zext i32 %124 to i64
  %126 = icmp ult i64 %125, 256
  br i1 %126, label %160, label %127

127:                                              ; preds = %122
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  %130 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %131 = getelementptr inbounds %struct.s2n_debug_info, ptr %130, i32 0, i32 0
  store ptr @.str.2, ptr %131, align 8, !tbaa !9
  %132 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %133 = getelementptr inbounds %struct.s2n_debug_info, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !9
  %135 = getelementptr inbounds i8, ptr %134, i64 21
  %136 = call ptr @strrchr(ptr noundef %135, i32 noundef 47) #9
  %137 = icmp ne ptr %136, null
  br i1 %137, label %138, label %145

138:                                              ; preds = %129
  %139 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %140 = getelementptr inbounds %struct.s2n_debug_info, ptr %139, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !9
  %142 = getelementptr inbounds i8, ptr %141, i64 21
  %143 = call ptr @strrchr(ptr noundef %142, i32 noundef 47) #9
  %144 = getelementptr inbounds i8, ptr %143, i64 1
  br label %150

145:                                              ; preds = %129
  %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
  %148 = load ptr, ptr %147, align 8, !tbaa !9
  %149 = getelementptr inbounds i8, ptr %148, i64 21
  br label %150

150:                                              ; preds = %145, %138
  %151 = phi ptr [ %144, %138 ], [ %149, %145 ]
  %152 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %153 = getelementptr inbounds %struct.s2n_debug_info, ptr %152, i32 0, i32 1
  store ptr %151, ptr %153, align 8, !tbaa !11
  %154 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %154, align 4, !tbaa !12
  %155 = call i32 @s2n_calculate_stacktrace()
  br label %156

156:                                              ; preds = %150
  br label %157

157:                                              ; preds = %156
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %237

158:                                              ; No predecessors!
  br label %159

159:                                              ; preds = %158
  br label %160

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

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %164 = getelementptr inbounds %struct.s2n_blob, ptr %10, i32 0, i32 1
  %165 = load i32, ptr %164, align 8, !tbaa !14
  store i32 %165, ptr %12, align 4, !tbaa !12
  %166 = load i32, ptr %12, align 4, !tbaa !12
  %167 = icmp ne i32 %166, 0
  %168 = xor i1 %167, true
  %169 = xor i1 %168, true
  %170 = zext i1 %169 to i32
  %171 = sext i32 %170 to i64
  %172 = call i64 @llvm.expect.i64(i64 %171, i64 1)
  %173 = icmp ne i64 %172, 0
  br i1 %173, label %174, label %225

174:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.s2n_connection, ptr %175, i32 0, i32 64
  %177 = getelementptr inbounds [256 x i8], ptr %176, i64 0, i64 0
  %178 = getelementptr inbounds %struct.s2n_blob, ptr %10, i32 0, i32 0
  %179 = load ptr, ptr %178, align 8, !tbaa !19
  %180 = load i32, ptr %12, align 4, !tbaa !12
  %181 = zext i32 %180 to i64
  %182 = call ptr @s2n_ensure_memmove_trace(ptr noundef %177, ptr noundef %179, i64 noundef %181)
  store ptr %182, ptr %13, align 8, !tbaa !5
  br label %183

183:                                              ; preds = %174
  %184 = load ptr, ptr %13, align 8, !tbaa !5
  %185 = icmp ne ptr %184, null
  br i1 %185, label %219, label %186

186:                                              ; preds = %183
  br label %187

187:                                              ; preds = %186
  br label %188

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

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

204:                                              ; preds = %188
  %205 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %206 = getelementptr inbounds %struct.s2n_debug_info, ptr %205, i32 0, i32 0
  %207 = load ptr, ptr %206, align 8, !tbaa !9
  %208 = getelementptr inbounds i8, ptr %207, i64 21
  br label %209

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

215:                                              ; preds = %209
  br label %216

216:                                              ; preds = %215
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %222

217:                                              ; No predecessors!
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218, %183
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220
  store i32 0, ptr %7, align 4
  br label %222

222:                                              ; preds = %221, %216
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  %223 = load i32, ptr %7, align 4
  switch i32 %223, label %226 [
    i32 0, label %224
  ]

224:                                              ; preds = %222
  br label %225

225:                                              ; preds = %224, %163
  store i32 0, ptr %7, align 4
  br label %226

226:                                              ; preds = %225, %222
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  %227 = load i32, ptr %7, align 4
  switch i32 %227, label %237 [
    i32 0, label %228
  ]

228:                                              ; preds = %226
  br label %229

229:                                              ; preds = %228
  br label %230

230:                                              ; preds = %229
  %231 = load ptr, ptr %4, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.s2n_connection, ptr %231, i32 0, i32 64
  %233 = getelementptr inbounds %struct.s2n_blob, ptr %10, i32 0, i32 1
  %234 = load i32, ptr %233, align 8, !tbaa !14
  %235 = zext i32 %234 to i64
  %236 = getelementptr inbounds [256 x i8], ptr %232, i64 0, i64 %235
  store i8 0, ptr %236, align 1, !tbaa !20
  store i32 0, ptr %7, align 4
  br label %237

237:                                              ; preds = %230, %226, %157, %118
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #8
  br label %238

238:                                              ; preds = %237, %108, %98
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #8
  %239 = load i32, ptr %7, align 4
  switch i32 %239, label %246 [
    i32 0, label %240
  ]

240:                                              ; preds = %238
  br label %241

241:                                              ; preds = %240, %89
  %242 = load ptr, ptr %4, align 8, !tbaa !5
  %243 = load i32, ptr %242, align 8
  %244 = and i32 %243, -131073
  %245 = or i32 %244, 131072
  store i32 %245, ptr %242, align 8
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %246

246:                                              ; preds = %241, %238, %85, %65, %55, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %247 = load i32, ptr %3, align 4
  ret i32 %247
}

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

declare i32 @s2n_select_server_preference_protocol(ptr noundef, ptr noundef, ptr noundef) #1

declare ptr @s2n_get_application_protocol(ptr noundef) #1

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

declare i32 @s2n_stuffer_init(ptr noundef, ptr noundef) #1

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) #1

declare i32 @s2n_protocol_preferences_read(ptr noundef, ptr noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }

!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 8}
!15 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!16 = !{!17, !13, i64 28}
!17 = !{!"s2n_stuffer", !15, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!18 = !{!17, !13, i64 24}
!19 = !{!15, !6, i64 0}
!20 = !{!7, !7, i64 0}


; 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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%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.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [95 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

declare i32 @s2n_connection_get_protocol_preferences(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_server_npn_recv(ptr noundef %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca ptr, align 8
  %4 = alloca %struct.s2n_stuffer, align 8
  %5 = alloca %struct.s2n_blob, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store ptr null, ptr %3, align 8, !tbaa !5
  %6 = call i32 @s2n_connection_get_protocol_preferences(ptr noundef %0, ptr noundef nonnull %3) #7
  %7 = icmp sgt i32 %6, -1
  br i1 %7, label %8, label %71

8:                                                ; preds = %2
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %10, label %18

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

18:                                               ; preds = %8
  %19 = getelementptr inbounds i8, ptr %9, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !14
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %71, label %22

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %1, i64 28
  %24 = load i32, ptr %23, align 4, !tbaa !16
  %25 = getelementptr inbounds i8, ptr %1, i64 24
  %26 = load i32, ptr %25, align 8, !tbaa !18
  %.not27 = icmp eq i32 %24, %26
  br i1 %.not27, label %30, label %27

27:                                               ; preds = %22
  %28 = call i32 @s2n_select_server_preference_protocol(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull %9) #7
  %29 = call zeroext i1 @s2n_result_is_ok(i32 %28)
  br i1 %29, label %30, label %71

30:                                               ; preds = %27, %22
  %31 = call ptr @s2n_get_application_protocol(ptr noundef %0) #7
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %68

33:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %4, i8 0, i64 40, i1 false)
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = call i32 @s2n_stuffer_init(ptr noundef nonnull %4, ptr noundef %34) #7
  %36 = icmp sgt i32 %35, -1
  br i1 %36, label %37, label %.critedge35

37:                                               ; preds = %33
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 8
  %40 = load i32, ptr %39, align 8, !tbaa !14
  %41 = call i32 @s2n_stuffer_skip_write(ptr noundef nonnull %4, i32 noundef %40) #7
  %42 = icmp sgt i32 %41, -1
  br i1 %42, label %43, label %.critedge35

43:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, i8 0, i64 24, i1 false)
  %44 = call i32 @s2n_protocol_preferences_read(ptr noundef nonnull %4, ptr noundef nonnull %5) #7
  %45 = call zeroext i1 @s2n_result_is_ok(i32 %44)
  br i1 %45, label %46, label %67

46:                                               ; preds = %43
  %47 = getelementptr inbounds i8, ptr %5, i64 8
  %48 = load i32, ptr %47, align 8, !tbaa !14
  %49 = zext i32 %48 to i64
  %50 = icmp ult i32 %48, 256
  br i1 %50, label %51, label %.sink.split

51:                                               ; preds = %46
  %.not29 = icmp eq i32 %48, 0
  br i1 %.not29, label %.critedge33, label %52, !prof !19

52:                                               ; preds = %51
  %53 = getelementptr inbounds i8, ptr %0, i64 2528
  %54 = load ptr, ptr %5, align 8, !tbaa !20
  %55 = call ptr @s2n_ensure_memmove_trace(ptr noundef nonnull %53, ptr noundef %54, i64 noundef %49) #7
  %.not30.not = icmp eq ptr %55, null
  br i1 %.not30.not, label %.sink.split, label %..critedge33_crit_edge

..critedge33_crit_edge:                           ; preds = %52
  %.pre = load i32, ptr %47, align 8, !tbaa !14
  %56 = zext i32 %.pre to i64
  br label %.critedge33

.critedge33:                                      ; preds = %..critedge33_crit_edge, %51
  %57 = phi i64 [ %56, %..critedge33_crit_edge ], [ 0, %51 ]
  %58 = getelementptr inbounds i8, ptr %0, i64 2528
  %59 = getelementptr inbounds [256 x i8], ptr %58, i64 0, i64 %57
  store i8 0, ptr %59, align 1, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  br label %68

.sink.split:                                      ; preds = %52, %46
  %.str.3.sink = phi ptr [ @.str.2, %46 ], [ @.str.3, %52 ]
  %.sink44 = phi ptr [ getelementptr inbounds (i8, ptr @.str.2, i64 21), %46 ], [ getelementptr inbounds (i8, ptr @.str.3, i64 21), %52 ]
  %.sink = phi i32 [ 402653194, %46 ], [ 402653193, %52 ]
  %60 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.3.sink, ptr %60, align 8, !tbaa !9
  %61 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink44, i32 noundef 47) #8
  %.not31 = icmp eq ptr %61, null
  %62 = getelementptr inbounds i8, ptr %61, i64 1
  %63 = select i1 %.not31, ptr %.sink44, ptr %62
  %64 = getelementptr inbounds i8, ptr %60, i64 8
  store ptr %63, ptr %64, align 8, !tbaa !11
  %65 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %65, align 4, !tbaa !12
  %66 = call i32 @s2n_calculate_stacktrace() #7
  br label %67

67:                                               ; preds = %.sink.split, %43
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  br label %71

68:                                               ; preds = %.critedge33, %30
  %69 = load i32, ptr %0, align 8
  %70 = or i32 %69, 131072
  store i32 %70, ptr %0, align 8
  br label %71

.critedge35:                                      ; preds = %37, %33
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  br label %71

71:                                               ; preds = %67, %.critedge35, %27, %18, %2, %68, %10
  %.5 = phi i32 [ 0, %68 ], [ -1, %67 ], [ -1, %10 ], [ -1, %2 ], [ 0, %18 ], [ -1, %27 ], [ -1, %.critedge35 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  ret i32 %.5
}

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

declare i32 @s2n_select_server_preference_protocol(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @s2n_get_application_protocol(ptr noundef) local_unnamed_addr #1

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

declare i32 @s2n_stuffer_init(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @s2n_protocol_preferences_read(ptr noundef, ptr noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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 8}
!15 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!16 = !{!17, !13, i64 28}
!17 = !{!"s2n_stuffer", !15, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!18 = !{!17, !13, i64 24}
!19 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!20 = !{!15, !6, i64 0}
!21 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass