; LLVM IR from aws/s2n-tls :: tests/unit (s2n_self_talk_npn_test)

; 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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_result = type { i32 }
%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 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.101 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.102 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.106 = external hidden unnamed_addr constant [94 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(none)
declare i64 @llvm.expect.i64(i64, i64) #4

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

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

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

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

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

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

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

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

17:                                               ; preds = %4
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %51, label %20

20:                                               ; preds = %17
  br label %21

21:                                               ; preds = %20
  br label %22

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

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

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

43:                                               ; preds = %38, %31
  %44 = phi ptr [ %37, %31 ], [ %42, %38 ]
  %45 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %46 = getelementptr inbounds %struct.s2n_debug_info, ptr %45, i32 0, i32 1
  store ptr %44, ptr %46, align 8, !tbaa !13
  %47 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %47, align 4, !tbaa !14
  %48 = call i32 @s2n_calculate_stacktrace()
  br label %49

49:                                               ; preds = %43
  store i32 -1, ptr %5, align 4
  br label %308

50:                                               ; No predecessors!
  br label %51

51:                                               ; preds = %50, %17
  br label %52

52:                                               ; preds = %51
  br label %53

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

56:                                               ; preds = %53
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  %59 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %60 = getelementptr inbounds %struct.s2n_debug_info, ptr %59, i32 0, i32 0
  store ptr @.str.102, ptr %60, align 8, !tbaa !11
  %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
  %63 = load ptr, ptr %62, align 8, !tbaa !11
  %64 = getelementptr inbounds i8, ptr %63, i64 21
  %65 = call ptr @strrchr(ptr noundef %64, i32 noundef 47) #8
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %74

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

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

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

85:                                               ; preds = %79
  store i32 -1, ptr %5, align 4
  br label %308

86:                                               ; No predecessors!
  br label %87

87:                                               ; preds = %86, %53
  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 %123, 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.103, ptr %96, align 8, !tbaa !11
  %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 !11
  %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 !11
  %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 !11
  %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 !13
  %119 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %119, align 4, !tbaa !14
  %120 = call i32 @s2n_calculate_stacktrace()
  br label %121

121:                                              ; preds = %115
  store i32 -1, ptr %5, align 4
  br label %308

122:                                              ; No predecessors!
  br label %123

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

124:                                              ; preds = %123
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  store i16 0, ptr %125, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  store ptr null, ptr %10, align 8, !tbaa !5
  br label %126

126:                                              ; preds = %124
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.s2n_client_hello, ptr %127, i32 0, i32 1
  %129 = call i32 @s2n_client_hello_get_parsed_extension(i32 noundef 0, ptr noundef %128, ptr noundef %10)
  %130 = icmp sgt i32 %129, -1
  br i1 %130, label %132, label %131

131:                                              ; preds = %126
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %307

132:                                              ; preds = %126
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = icmp ne ptr %136, null
  br i1 %137, label %171, label %138

138:                                              ; preds = %135
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %142 = getelementptr inbounds %struct.s2n_debug_info, ptr %141, i32 0, i32 0
  store ptr @.str.104, ptr %142, align 8, !tbaa !11
  %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 !11
  %146 = getelementptr inbounds i8, ptr %145, i64 21
  %147 = call ptr @strrchr(ptr noundef %146, i32 noundef 47) #8
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %156

149:                                              ; preds = %140
  %150 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %151 = getelementptr inbounds %struct.s2n_debug_info, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !11
  %153 = getelementptr inbounds i8, ptr %152, i64 21
  %154 = call ptr @strrchr(ptr noundef %153, i32 noundef 47) #8
  %155 = getelementptr inbounds i8, ptr %154, i64 1
  br label %161

156:                                              ; preds = %140
  %157 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %158 = getelementptr inbounds %struct.s2n_debug_info, ptr %157, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !11
  %160 = getelementptr inbounds i8, ptr %159, i64 21
  br label %161

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

167:                                              ; preds = %161
  br label %168

168:                                              ; preds = %167
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %307

169:                                              ; No predecessors!
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170, %135
  br label %172

172:                                              ; preds = %171
  br label %173

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

174:                                              ; preds = %173
  %175 = load ptr, ptr %10, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.s2n_parsed_extension, ptr %175, i32 0, i32 0
  %177 = call i32 @s2n_stuffer_init_written(ptr noundef %12, ptr noundef %176)
  %178 = icmp sgt i32 %177, -1
  br i1 %178, label %180, label %179

179:                                              ; preds = %174
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %306

180:                                              ; preds = %174
  br label %181

181:                                              ; preds = %180
  br label %182

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

183:                                              ; preds = %182
  %184 = call i32 @s2n_client_server_name_parse(ptr noundef %12, ptr noundef %13)
  %185 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 %184, ptr %185, align 4
  %186 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  %187 = load i32, ptr %186, align 4
  %188 = call zeroext i1 @s2n_result_is_ok(i32 %187)
  br i1 %188, label %190, label %189

189:                                              ; preds = %183
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %305

190:                                              ; preds = %183
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  %194 = getelementptr inbounds %struct.s2n_blob, ptr %13, i32 0, i32 1
  %195 = load i32, ptr %194, align 8, !tbaa !16
  %196 = load i16, ptr %8, align 2, !tbaa !9
  %197 = zext i16 %196 to i32
  %198 = icmp ule i32 %195, %197
  br i1 %198, label %232, label %199

199:                                              ; preds = %193
  br label %200

200:                                              ; preds = %199
  br label %201

201:                                              ; preds = %200
  %202 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %203 = getelementptr inbounds %struct.s2n_debug_info, ptr %202, i32 0, i32 0
  store ptr @.str.105, ptr %203, align 8, !tbaa !11
  %204 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %205 = getelementptr inbounds %struct.s2n_debug_info, ptr %204, i32 0, i32 0
  %206 = load ptr, ptr %205, align 8, !tbaa !11
  %207 = getelementptr inbounds i8, ptr %206, i64 21
  %208 = call ptr @strrchr(ptr noundef %207, i32 noundef 47) #8
  %209 = icmp ne ptr %208, null
  br i1 %209, label %210, label %217

210:                                              ; preds = %201
  %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 0
  %213 = load ptr, ptr %212, align 8, !tbaa !11
  %214 = getelementptr inbounds i8, ptr %213, i64 21
  %215 = call ptr @strrchr(ptr noundef %214, i32 noundef 47) #8
  %216 = getelementptr inbounds i8, ptr %215, i64 1
  br label %222

217:                                              ; preds = %201
  %218 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %219 = getelementptr inbounds %struct.s2n_debug_info, ptr %218, i32 0, i32 0
  %220 = load ptr, ptr %219, align 8, !tbaa !11
  %221 = getelementptr inbounds i8, ptr %220, i64 21
  br label %222

222:                                              ; preds = %217, %210
  %223 = phi ptr [ %216, %210 ], [ %221, %217 ]
  %224 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %225 = getelementptr inbounds %struct.s2n_debug_info, ptr %224, i32 0, i32 1
  store ptr %223, ptr %225, align 8, !tbaa !13
  %226 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %226, align 4, !tbaa !14
  %227 = call i32 @s2n_calculate_stacktrace()
  br label %228

228:                                              ; preds = %222
  br label %229

229:                                              ; preds = %228
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %305

230:                                              ; No predecessors!
  br label %231

231:                                              ; preds = %230
  br label %232

232:                                              ; preds = %231, %193
  br label %233

233:                                              ; preds = %232
  br label %234

234:                                              ; preds = %233
  br label %235

235:                                              ; preds = %234
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  %236 = getelementptr inbounds %struct.s2n_blob, ptr %13, i32 0, i32 1
  %237 = load i32, ptr %236, align 8, !tbaa !16
  store i32 %237, ptr %15, align 4, !tbaa !14
  %238 = load i32, ptr %15, align 4, !tbaa !14
  %239 = icmp ne i32 %238, 0
  %240 = xor i1 %239, true
  %241 = xor i1 %240, true
  %242 = zext i1 %241 to i32
  %243 = sext i32 %242 to i64
  %244 = call i64 @llvm.expect.i64(i64 %243, i64 1)
  %245 = icmp ne i64 %244, 0
  br i1 %245, label %246, label %295

246:                                              ; preds = %235
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %247 = load ptr, ptr %7, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.s2n_blob, ptr %13, i32 0, i32 0
  %249 = load ptr, ptr %248, align 8, !tbaa !18
  %250 = load i32, ptr %15, align 4, !tbaa !14
  %251 = zext i32 %250 to i64
  %252 = call ptr @s2n_ensure_memmove_trace(ptr noundef %247, ptr noundef %249, i64 noundef %251)
  store ptr %252, ptr %16, align 8, !tbaa !5
  br label %253

253:                                              ; preds = %246
  %254 = load ptr, ptr %16, align 8, !tbaa !5
  %255 = icmp ne ptr %254, null
  br i1 %255, label %289, label %256

256:                                              ; preds = %253
  br label %257

257:                                              ; preds = %256
  br label %258

258:                                              ; preds = %257
  %259 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %260 = getelementptr inbounds %struct.s2n_debug_info, ptr %259, i32 0, i32 0
  store ptr @.str.106, ptr %260, align 8, !tbaa !11
  %261 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %262 = getelementptr inbounds %struct.s2n_debug_info, ptr %261, i32 0, i32 0
  %263 = load ptr, ptr %262, align 8, !tbaa !11
  %264 = getelementptr inbounds i8, ptr %263, i64 21
  %265 = call ptr @strrchr(ptr noundef %264, i32 noundef 47) #8
  %266 = icmp ne ptr %265, null
  br i1 %266, label %267, label %274

267:                                              ; preds = %258
  %268 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %269 = getelementptr inbounds %struct.s2n_debug_info, ptr %268, i32 0, i32 0
  %270 = load ptr, ptr %269, align 8, !tbaa !11
  %271 = getelementptr inbounds i8, ptr %270, i64 21
  %272 = call ptr @strrchr(ptr noundef %271, i32 noundef 47) #8
  %273 = getelementptr inbounds i8, ptr %272, i64 1
  br label %279

274:                                              ; preds = %258
  %275 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %276 = getelementptr inbounds %struct.s2n_debug_info, ptr %275, i32 0, i32 0
  %277 = load ptr, ptr %276, align 8, !tbaa !11
  %278 = getelementptr inbounds i8, ptr %277, i64 21
  br label %279

279:                                              ; preds = %274, %267
  %280 = phi ptr [ %273, %267 ], [ %278, %274 ]
  %281 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %282 = getelementptr inbounds %struct.s2n_debug_info, ptr %281, i32 0, i32 1
  store ptr %280, ptr %282, align 8, !tbaa !13
  %283 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %283, align 4, !tbaa !14
  %284 = call i32 @s2n_calculate_stacktrace()
  br label %285

285:                                              ; preds = %279
  br label %286

286:                                              ; preds = %285
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %292

287:                                              ; No predecessors!
  br label %288

288:                                              ; preds = %287
  br label %289

289:                                              ; preds = %288, %253
  br label %290

290:                                              ; preds = %289
  br label %291

291:                                              ; preds = %290
  store i32 0, ptr %11, align 4
  br label %292

292:                                              ; preds = %291, %286
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  %293 = load i32, ptr %11, align 4
  switch i32 %293, label %296 [
    i32 0, label %294
  ]

294:                                              ; preds = %292
  br label %295

295:                                              ; preds = %294, %235
  store i32 0, ptr %11, align 4
  br label %296

296:                                              ; preds = %295, %292
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  %297 = load i32, ptr %11, align 4
  switch i32 %297, label %305 [
    i32 0, label %298
  ]

298:                                              ; preds = %296
  br label %299

299:                                              ; preds = %298
  br label %300

300:                                              ; preds = %299
  %301 = getelementptr inbounds %struct.s2n_blob, ptr %13, i32 0, i32 1
  %302 = load i32, ptr %301, align 8, !tbaa !16
  %303 = trunc i32 %302 to i16
  %304 = load ptr, ptr %9, align 8, !tbaa !5
  store i16 %303, ptr %304, align 2, !tbaa !9
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %305

305:                                              ; preds = %300, %296, %229, %189
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #9
  br label %306

306:                                              ; preds = %305, %179
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #9
  br label %307

307:                                              ; preds = %306, %168, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %308

308:                                              ; preds = %307, %121, %85, %49
  %309 = load i32, ptr %5, align 4
  ret i32 %309
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !15, i64 8}
!17 = !{!"s2n_blob", !6, i64 0, !15, i64 8, !15, i64 12, !15, i64 16}
!18 = !{!17, !6, 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.101 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.102 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.106 = external hidden unnamed_addr constant [94 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

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

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

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

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

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

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

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

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

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

16:                                               ; preds = %4
  %.not26 = icmp eq ptr %0, null
  br i1 %.not26, label %17, label %25

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

25:                                               ; preds = %16
  %.not28 = icmp eq ptr %1, null
  br i1 %.not28, label %26, label %34

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

34:                                               ; preds = %25
  store i16 0, ptr %3, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store ptr null, ptr %5, align 8, !tbaa !15
  %35 = getelementptr inbounds i8, ptr %0, i64 24
  %36 = call i32 @s2n_client_hello_get_parsed_extension(i32 noundef 0, ptr noundef nonnull %35, ptr noundef nonnull %5)
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %83

38:                                               ; preds = %34
  %39 = load ptr, ptr %5, align 8, !tbaa !15
  %.not30 = icmp eq ptr %39, null
  br i1 %.not30, label %40, label %48

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

48:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %6, i8 0, i64 40, i1 false)
  %49 = call i32 @s2n_stuffer_init_written(ptr noundef nonnull %6, ptr noundef nonnull %39) #8
  %50 = icmp sgt i32 %49, -1
  br i1 %50, label %51, label %82

51:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  %52 = call i32 @s2n_client_server_name_parse(ptr noundef nonnull %6, ptr noundef nonnull %7) #8
  %53 = call zeroext i1 @s2n_result_is_ok(i32 %52)
  br i1 %53, label %54, label %81

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %7, i64 8
  %56 = load i32, ptr %55, align 8, !tbaa !16
  %57 = zext i16 %2 to i32
  %.not32 = icmp ugt i32 %56, %57
  br i1 %.not32, label %58, label %66

58:                                               ; preds = %54
  %59 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.105, ptr %59, align 8, !tbaa !5
  %60 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.105, i64 21), i32 noundef 47) #7
  %.not33 = icmp eq ptr %60, null
  %61 = getelementptr inbounds i8, ptr %60, i64 1
  %62 = select i1 %.not33, ptr getelementptr inbounds (i8, ptr @.str.105, i64 21), ptr %61
  %63 = getelementptr inbounds i8, ptr %59, i64 8
  store ptr %62, ptr %63, align 8, !tbaa !10
  %64 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %64, align 4, !tbaa !11
  %65 = call i32 @s2n_calculate_stacktrace() #8
  br label %81

66:                                               ; preds = %54
  %.not34 = icmp eq i32 %56, 0
  br i1 %.not34, label %.critedge38, label %67, !prof !18

67:                                               ; preds = %66
  %68 = load ptr, ptr %7, align 8, !tbaa !19
  %69 = zext nneg i32 %56 to i64
  %70 = call ptr @s2n_ensure_memmove_trace(ptr noundef nonnull %1, ptr noundef %68, i64 noundef %69) #8
  %.not35.not = icmp eq ptr %70, null
  br i1 %.not35.not, label %72, label %..critedge38_crit_edge

..critedge38_crit_edge:                           ; preds = %67
  %.pre = load i32, ptr %55, align 8, !tbaa !16
  %71 = trunc i32 %.pre to i16
  br label %.critedge38

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

.critedge38:                                      ; preds = %..critedge38_crit_edge, %66
  %80 = phi i16 [ %71, %..critedge38_crit_edge ], [ 0, %66 ]
  store i16 %80, ptr %3, align 2, !tbaa !13
  br label %81

81:                                               ; preds = %72, %51, %.critedge38, %58
  %.3 = phi i32 [ 0, %.critedge38 ], [ -1, %58 ], [ -1, %51 ], [ -1, %72 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #8
  br label %82

82:                                               ; preds = %48, %81
  %.4 = phi i32 [ %.3, %81 ], [ -1, %48 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #8
  br label %83

83:                                               ; preds = %34, %82, %40
  %.5 = phi i32 [ %.4, %82 ], [ -1, %40 ], [ -1, %34 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %84

84:                                               ; preds = %83, %26, %17, %8
  %.6 = phi i32 [ %.5, %83 ], [ -1, %26 ], [ -1, %17 ], [ -1, %8 ]
  ret i32 %.6
}

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


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