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

; 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 }

@.str = external hidden unnamed_addr constant [109 x i8], align 1
@_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 [109 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [109 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_client_server_name_parse(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca %struct.s2n_result, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i16, align 2
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i16, align 2
  %10 = 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 2, ptr %6) #5
  store i16 0, ptr %6, align 2, !tbaa !9
  br label %11

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

15:                                               ; preds = %11
  %16 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %16, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %235

17:                                               ; preds = %11
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  %21 = load i16, ptr %6, align 2, !tbaa !9
  %22 = zext i16 %21 to i32
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.s2n_stuffer, ptr %23, i32 0, i32 2
  %25 = load i32, ptr %24, align 4, !tbaa !14
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.s2n_stuffer, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 8, !tbaa !17
  %29 = sub i32 %25, %28
  %30 = icmp ule i32 %22, %29
  br i1 %30, label %65, label %31

31:                                               ; preds = %20
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  %34 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %35 = getelementptr inbounds %struct.s2n_debug_info, ptr %34, i32 0, i32 0
  store ptr @.str, ptr %35, align 8, !tbaa !18
  %36 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %37 = getelementptr inbounds %struct.s2n_debug_info, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds i8, ptr %38, i64 21
  %40 = call ptr @strrchr(ptr noundef %39, i32 noundef 47) #6
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %49

42:                                               ; preds = %33
  %43 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %44 = getelementptr inbounds %struct.s2n_debug_info, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !18
  %46 = getelementptr inbounds i8, ptr %45, i64 21
  %47 = call ptr @strrchr(ptr noundef %46, i32 noundef 47) #6
  %48 = getelementptr inbounds i8, ptr %47, i64 1
  br label %54

49:                                               ; preds = %33
  %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 0
  %52 = load ptr, ptr %51, align 8, !tbaa !18
  %53 = getelementptr inbounds i8, ptr %52, i64 21
  br label %54

54:                                               ; preds = %49, %42
  %55 = phi ptr [ %48, %42 ], [ %53, %49 ]
  %56 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %57 = getelementptr inbounds %struct.s2n_debug_info, ptr %56, i32 0, i32 1
  store ptr %55, ptr %57, align 8, !tbaa !20
  %58 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %58, align 4, !tbaa !21
  %59 = call i32 @s2n_calculate_stacktrace()
  br label %60

60:                                               ; preds = %54
  br label %61

61:                                               ; preds = %60
  %62 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %62, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %235

63:                                               ; No predecessors!
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64, %20
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  store i8 0, ptr %8, align 1, !tbaa !22
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = call i32 @s2n_stuffer_read_uint8(ptr noundef %69, ptr noundef %8)
  %71 = icmp sgt i32 %70, -1
  br i1 %71, label %74, label %72

72:                                               ; preds = %68
  %73 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %73, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %234

74:                                               ; preds = %68
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  %78 = load i8, ptr %8, align 1, !tbaa !22
  %79 = zext i8 %78 to i32
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %115, label %81

81:                                               ; preds = %77
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %85 = getelementptr inbounds %struct.s2n_debug_info, ptr %84, i32 0, i32 0
  store ptr @.str.1, ptr %85, align 8, !tbaa !18
  %86 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %87 = getelementptr inbounds %struct.s2n_debug_info, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !18
  %89 = getelementptr inbounds i8, ptr %88, i64 21
  %90 = call ptr @strrchr(ptr noundef %89, i32 noundef 47) #6
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %99

92:                                               ; preds = %83
  %93 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %94 = getelementptr inbounds %struct.s2n_debug_info, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !18
  %96 = getelementptr inbounds i8, ptr %95, i64 21
  %97 = call ptr @strrchr(ptr noundef %96, i32 noundef 47) #6
  %98 = getelementptr inbounds i8, ptr %97, i64 1
  br label %104

99:                                               ; preds = %83
  %100 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %101 = getelementptr inbounds %struct.s2n_debug_info, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !18
  %103 = getelementptr inbounds i8, ptr %102, i64 21
  br label %104

104:                                              ; preds = %99, %92
  %105 = phi ptr [ %98, %92 ], [ %103, %99 ]
  %106 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %107 = getelementptr inbounds %struct.s2n_debug_info, ptr %106, i32 0, i32 1
  store ptr %105, ptr %107, align 8, !tbaa !20
  %108 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %108, align 4, !tbaa !21
  %109 = call i32 @s2n_calculate_stacktrace()
  br label %110

110:                                              ; preds = %104
  br label %111

111:                                              ; preds = %110
  %112 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %112, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %234

113:                                              ; No predecessors!
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114, %77
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #5
  store i16 0, ptr %9, align 2, !tbaa !9
  br label %118

118:                                              ; preds = %117
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = call i32 @s2n_stuffer_read_uint16(ptr noundef %119, ptr noundef %9)
  %121 = icmp sgt i32 %120, -1
  br i1 %121, label %124, label %122

122:                                              ; preds = %118
  %123 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %123, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %233

124:                                              ; preds = %118
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126
  %128 = load i16, ptr %9, align 2, !tbaa !9
  %129 = zext i16 %128 to i32
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.s2n_stuffer, ptr %130, i32 0, i32 2
  %132 = load i32, ptr %131, align 4, !tbaa !14
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.s2n_stuffer, ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 8, !tbaa !17
  %136 = sub i32 %132, %135
  %137 = icmp ule i32 %129, %136
  br i1 %137, label %172, label %138

138:                                              ; preds = %127
  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.2, ptr %142, align 8, !tbaa !18
  %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 !18
  %146 = getelementptr inbounds i8, ptr %145, i64 21
  %147 = call ptr @strrchr(ptr noundef %146, i32 noundef 47) #6
  %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 !18
  %153 = getelementptr inbounds i8, ptr %152, i64 21
  %154 = call ptr @strrchr(ptr noundef %153, i32 noundef 47) #6
  %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 !18
  %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 !20
  %165 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %165, align 4, !tbaa !21
  %166 = call i32 @s2n_calculate_stacktrace()
  br label %167

167:                                              ; preds = %161
  br label %168

168:                                              ; preds = %167
  %169 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %169, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %233

170:                                              ; No predecessors!
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171, %127
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = load i16, ptr %9, align 2, !tbaa !9
  %177 = zext i16 %176 to i32
  %178 = call ptr @s2n_stuffer_raw_read(ptr noundef %175, i32 noundef %177)
  store ptr %178, ptr %10, align 8, !tbaa !5
  br label %179

179:                                              ; preds = %174
  %180 = load ptr, ptr %10, align 8, !tbaa !5
  %181 = icmp ne ptr %180, null
  br i1 %181, label %216, label %182

182:                                              ; preds = %179
  br label %183

183:                                              ; preds = %182
  br label %184

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

193:                                              ; preds = %184
  %194 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %195 = getelementptr inbounds %struct.s2n_debug_info, ptr %194, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !18
  %197 = getelementptr inbounds i8, ptr %196, i64 21
  %198 = call ptr @strrchr(ptr noundef %197, i32 noundef 47) #6
  %199 = getelementptr inbounds i8, ptr %198, i64 1
  br label %205

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

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

211:                                              ; preds = %205
  br label %212

212:                                              ; preds = %211
  %213 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %213, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %232

214:                                              ; No predecessors!
  br label %215

215:                                              ; preds = %214
  br label %216

216:                                              ; preds = %215, %179
  br label %217

217:                                              ; preds = %216
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  %220 = load ptr, ptr %5, align 8, !tbaa !5
  %221 = load ptr, ptr %10, align 8, !tbaa !5
  %222 = load i16, ptr %9, align 2, !tbaa !9
  %223 = zext i16 %222 to i32
  %224 = call i32 @s2n_blob_init(ptr noundef %220, ptr noundef %221, i32 noundef %223)
  %225 = icmp sgt i32 %224, -1
  br i1 %225, label %228, label %226

226:                                              ; preds = %219
  %227 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %227, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %232

228:                                              ; preds = %219
  br label %229

229:                                              ; preds = %228
  br label %230

230:                                              ; preds = %229
  %231 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 0, ptr %231, align 4, !tbaa !11
  store i32 1, ptr %7, align 4
  br label %232

232:                                              ; preds = %230, %226, %212
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %233

233:                                              ; preds = %232, %168, %122
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #5
  br label %234

234:                                              ; preds = %233, %111, %72
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  br label %235

235:                                              ; preds = %234, %61, %15
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #5
  %236 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  %237 = load i32, ptr %236, align 4
  ret i32 %237
}

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

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

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

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 28}
!15 = !{!"s2n_stuffer", !16, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!16 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!17 = !{!15, !13, i64 24}
!18 = !{!19, !6, i64 0}
!19 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!20 = !{!19, !6, i64 8}
!21 = !{!13, !13, i64 0}
!22 = !{!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 }

@.str = external hidden unnamed_addr constant [109 x i8], align 1
@_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 [109 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [109 x i8], align 1

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

8:                                                ; preds = %2
  %9 = load i16, ptr %3, align 2, !tbaa !5
  %10 = zext i16 %9 to i32
  %11 = getelementptr inbounds i8, ptr %0, i64 28
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load i32, ptr %13, align 8, !tbaa !14
  %15 = sub i32 %12, %14
  %.not = icmp ult i32 %15, %10
  br i1 %.not, label %16, label %24

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

24:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  store i8 0, ptr %4, align 1, !tbaa !19
  %25 = call i32 @s2n_stuffer_read_uint8(ptr noundef nonnull %0, ptr noundef nonnull %4) #5
  %26 = icmp sgt i32 %25, -1
  br i1 %26, label %27, label %70

27:                                               ; preds = %24
  %28 = load i8, ptr %4, align 1, !tbaa !19
  %29 = icmp eq i8 %28, 0
  br i1 %29, label %38, label %30

30:                                               ; preds = %27
  %31 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.1, ptr %31, align 8, !tbaa !15
  %32 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.1, i64 21), i32 noundef 47) #6
  %.not17 = icmp eq ptr %32, null
  %33 = getelementptr inbounds i8, ptr %32, i64 1
  %34 = select i1 %.not17, ptr getelementptr inbounds (i8, ptr @.str.1, i64 21), ptr %33
  %35 = getelementptr inbounds i8, ptr %31, i64 8
  store ptr %34, ptr %35, align 8, !tbaa !17
  %36 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %36, align 4, !tbaa !18
  %37 = call i32 @s2n_calculate_stacktrace() #5
  br label %70

38:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #5
  store i16 0, ptr %5, align 2, !tbaa !5
  %39 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %0, ptr noundef nonnull %5) #5
  %40 = icmp sgt i32 %39, -1
  br i1 %40, label %41, label %69

41:                                               ; preds = %38
  %42 = load i16, ptr %5, align 2, !tbaa !5
  %43 = zext i16 %42 to i32
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = load i32, ptr %13, align 8, !tbaa !14
  %46 = sub i32 %44, %45
  %.not18 = icmp ult i32 %46, %43
  br i1 %.not18, label %47, label %55

47:                                               ; preds = %41
  %48 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.2, ptr %48, align 8, !tbaa !15
  %49 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.2, i64 21), i32 noundef 47) #6
  %.not19 = icmp eq ptr %49, null
  %50 = getelementptr inbounds i8, ptr %49, i64 1
  %51 = select i1 %.not19, ptr getelementptr inbounds (i8, ptr @.str.2, i64 21), ptr %50
  %52 = getelementptr inbounds i8, ptr %48, i64 8
  store ptr %51, ptr %52, align 8, !tbaa !17
  %53 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %53, align 4, !tbaa !18
  %54 = call i32 @s2n_calculate_stacktrace() #5
  br label %69

55:                                               ; preds = %41
  %56 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %0, i32 noundef %43) #5
  %.not20 = icmp eq ptr %56, null
  br i1 %.not20, label %57, label %65

57:                                               ; preds = %55
  %58 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.3, ptr %58, align 8, !tbaa !15
  %59 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.3, i64 21), i32 noundef 47) #6
  %.not21 = icmp eq ptr %59, null
  %60 = getelementptr inbounds i8, ptr %59, i64 1
  %61 = select i1 %.not21, ptr getelementptr inbounds (i8, ptr @.str.3, i64 21), ptr %60
  %62 = getelementptr inbounds i8, ptr %58, i64 8
  store ptr %61, ptr %62, align 8, !tbaa !17
  %63 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %63, align 4, !tbaa !18
  %64 = call i32 @s2n_calculate_stacktrace() #5
  br label %69

65:                                               ; preds = %55
  %66 = load i16, ptr %5, align 2, !tbaa !5
  %67 = zext i16 %66 to i32
  %68 = call i32 @s2n_blob_init(ptr noundef %1, ptr noundef nonnull %56, i32 noundef %67) #5
  %.lobit = ashr i32 %68, 31
  br label %69

69:                                               ; preds = %57, %65, %38, %47
  %.sroa.0.1 = phi i32 [ -1, %47 ], [ -1, %38 ], [ -1, %57 ], [ %.lobit, %65 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #5
  br label %70

70:                                               ; preds = %24, %69, %30
  %.sroa.0.2 = phi i32 [ %.sroa.0.1, %69 ], [ -1, %30 ], [ -1, %24 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  br label %71

71:                                               ; preds = %2, %70, %16
  %.sroa.0.3 = phi i32 [ %.sroa.0.2, %70 ], [ -1, %16 ], [ -1, %2 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #5
  ret i32 %.sroa.0.3
}

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

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

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

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

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !13, i64 28}
!10 = !{!"s2n_stuffer", !11, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!11 = !{!"s2n_blob", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !13, i64 24}
!15 = !{!16, !12, i64 0}
!16 = !{!"s2n_debug_info", !12, i64 0, !12, i64 8}
!17 = !{!16, !12, i64 8}
!18 = !{!13, !13, i64 0}
!19 = !{!7, !7, i64 0}


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