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

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.88 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [93 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

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

14:                                               ; preds = %3
  %15 = load ptr, ptr %6, align 8, !tbaa !9
  %16 = icmp ne ptr %15, null
  br i1 %16, label %49, label %17

17:                                               ; preds = %14
  br label %18

18:                                               ; preds = %17
  br label %19

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

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

35:                                               ; preds = %19
  %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 !11
  %39 = getelementptr inbounds i8, ptr %38, i64 21
  br label %40

40:                                               ; preds = %35, %28
  %41 = phi ptr [ %34, %28 ], [ %39, %35 ]
  %42 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %43 = getelementptr inbounds %struct.s2n_debug_info, ptr %42, i32 0, i32 1
  store ptr %41, ptr %43, align 8, !tbaa !13
  %44 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %44, align 4, !tbaa !14
  %45 = call i32 @s2n_calculate_stacktrace()
  br label %46

46:                                               ; preds = %40
  %47 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %47, align 4, !tbaa !16
  br label %208

48:                                               ; No predecessors!
  br label %49

49:                                               ; preds = %48, %14
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = icmp ne ptr %52, null
  br i1 %53, label %86, label %54

54:                                               ; preds = %51
  br label %55

55:                                               ; preds = %54
  br label %56

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

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

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

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

83:                                               ; preds = %77
  %84 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %84, align 4, !tbaa !16
  br label %208

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85, %51
  br label %87

87:                                               ; preds = %86
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 24, i1 false)
  %89 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 0
  %90 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 1
  %91 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 2
  %92 = getelementptr inbounds %struct.s2n_blob, ptr %8, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %88, ptr align 8 %8, i64 24, i1 false), !tbaa.struct !18
  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 %93

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

97:                                               ; preds = %93
  %98 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %98, align 4, !tbaa !16
  store i32 1, ptr %10, align 4
  br label %207

99:                                               ; preds = %93
  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 !9
  %104 = getelementptr inbounds %struct.s2n_blob, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 8, !tbaa !20
  %106 = call i32 @s2n_stuffer_skip_write(ptr noundef %9, i32 noundef %105)
  %107 = icmp sgt i32 %106, -1
  br i1 %107, label %110, label %108

108:                                              ; preds = %102
  %109 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %109, align 4, !tbaa !16
  store i32 1, ptr %10, align 4
  br label %207

110:                                              ; preds = %102
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %204, %112
  %114 = getelementptr inbounds %struct.s2n_stuffer, ptr %9, i32 0, i32 2
  %115 = load i32, ptr %114, align 4, !tbaa !22
  %116 = getelementptr inbounds %struct.s2n_stuffer, ptr %9, i32 0, i32 1
  %117 = load i32, ptr %116, align 8, !tbaa !24
  %118 = sub i32 %115, %117
  %119 = icmp ugt i32 %118, 0
  br i1 %119, label %120, label %205

120:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #8
  store i16 0, ptr %11, align 2, !tbaa !5
  br label %121

121:                                              ; preds = %120
  %122 = call i32 @s2n_stuffer_read_uint16(ptr noundef %9, ptr noundef %11)
  %123 = icmp sgt i32 %122, -1
  br i1 %123, label %126, label %124

124:                                              ; preds = %121
  %125 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %125, align 4, !tbaa !16
  store i32 1, ptr %10, align 4
  br label %202

126:                                              ; preds = %121
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #8
  store i16 0, ptr %12, align 2, !tbaa !5
  br label %129

129:                                              ; preds = %128
  %130 = call i32 @s2n_stuffer_read_uint16(ptr noundef %9, ptr noundef %12)
  %131 = icmp sgt i32 %130, -1
  br i1 %131, label %134, label %132

132:                                              ; preds = %129
  %133 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %133, align 4, !tbaa !16
  store i32 1, ptr %10, align 4
  br label %201

134:                                              ; preds = %129
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %137 = load i16, ptr %12, align 2, !tbaa !5
  %138 = zext i16 %137 to i32
  %139 = call ptr @s2n_stuffer_raw_read(ptr noundef %9, i32 noundef %138)
  store ptr %139, ptr %13, align 8, !tbaa !9
  br label %140

140:                                              ; preds = %136
  %141 = load ptr, ptr %13, align 8, !tbaa !9
  %142 = icmp ne ptr %141, null
  br i1 %142, label %177, label %143

143:                                              ; preds = %140
  br label %144

144:                                              ; preds = %143
  br label %145

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

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

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

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

172:                                              ; preds = %166
  br label %173

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

175:                                              ; No predecessors!
  br label %176

176:                                              ; preds = %175
  br label %177

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

178:                                              ; preds = %177
  br label %179

179:                                              ; preds = %178
  %180 = load i16, ptr %5, align 2, !tbaa !5
  %181 = zext i16 %180 to i32
  %182 = load i16, ptr %11, align 2, !tbaa !5
  %183 = zext i16 %182 to i32
  %184 = icmp eq i32 %181, %183
  br i1 %184, label %185, label %199

185:                                              ; preds = %179
  br label %186

186:                                              ; preds = %185
  %187 = load ptr, ptr %7, align 8, !tbaa !9
  %188 = load ptr, ptr %13, align 8, !tbaa !9
  %189 = load i16, ptr %12, align 2, !tbaa !5
  %190 = zext i16 %189 to i32
  %191 = call i32 @s2n_blob_init(ptr noundef %187, ptr noundef %188, i32 noundef %190)
  %192 = icmp sgt i32 %191, -1
  br i1 %192, label %195, label %193

193:                                              ; preds = %186
  %194 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %194, align 4, !tbaa !16
  store i32 1, ptr %10, align 4
  br label %200

195:                                              ; preds = %186
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  %198 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %198, align 4, !tbaa !16
  store i32 1, ptr %10, align 4
  br label %200

199:                                              ; preds = %179
  store i32 0, ptr %10, align 4
  br label %200

200:                                              ; preds = %199, %197, %193, %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %201

201:                                              ; preds = %200, %132
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #8
  br label %202

202:                                              ; preds = %201, %124
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #8
  %203 = load i32, ptr %10, align 4
  switch i32 %203, label %207 [
    i32 0, label %204
  ]

204:                                              ; preds = %202
  br label %113, !llvm.loop !25

205:                                              ; preds = %113
  %206 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %206, align 4, !tbaa !16
  store i32 1, ptr %10, align 4
  br label %207

207:                                              ; preds = %205, %202, %108, %97
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #8
  br label %208

208:                                              ; preds = %207, %83, %46
  %209 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %210 = load i32, ptr %209, align 4
  ret i32 %210
}

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 nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"s2n_debug_info", !10, i64 0, !10, i64 8}
!13 = !{!12, !10, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !15, i64 0}
!17 = !{!"", !15, i64 0}
!18 = !{i64 0, i64 8, !9, i64 8, i64 4, !14, i64 12, i64 4, !14, i64 16, i64 1, !19}
!19 = !{!7, !7, i64 0}
!20 = !{!21, !15, i64 8}
!21 = !{!"s2n_blob", !10, i64 0, !15, i64 8, !15, i64 12, !15, i64 16}
!22 = !{!23, !15, i64 28}
!23 = !{!"s2n_stuffer", !21, i64 0, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 36, !15, i64 36}
!24 = !{!23, !15, i64 24}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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

%struct.s2n_debug_info = type { ptr, ptr }
%struct.s2n_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.88 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [93 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

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

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

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

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

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

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

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

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

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

15:                                               ; preds = %3
  %.not16 = icmp eq ptr %2, null
  br i1 %.not16, label %16, label %24

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

24:                                               ; preds = %15
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, i8 0, i64 24, i1 false)
  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)
  %25 = call i32 @s2n_stuffer_init(ptr noundef nonnull %4, ptr noundef nonnull %1) #7
  %26 = icmp sgt i32 %25, -1
  br i1 %26, label %27, label %.loopexit

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %1, i64 8
  %29 = load i32, ptr %28, align 8, !tbaa !13
  %30 = call i32 @s2n_stuffer_skip_write(ptr noundef nonnull %4, i32 noundef %29) #7
  %31 = icmp sgt i32 %30, -1
  br i1 %31, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %27
  %32 = getelementptr inbounds i8, ptr %4, i64 28
  %33 = getelementptr inbounds i8, ptr %4, i64 24
  %34 = load i32, ptr %32, align 4, !tbaa !15
  %35 = load i32, ptr %33, align 8, !tbaa !17
  %.not1829 = icmp eq i32 %34, %35
  br i1 %.not1829, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %60
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #7
  store i16 0, ptr %5, align 2, !tbaa !18
  %36 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %4, ptr noundef nonnull %5) #7
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %.thread

.thread:                                          ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #7
  br label %.loopexit

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

41:                                               ; preds = %38
  %42 = load i16, ptr %6, align 2, !tbaa !18
  %43 = zext i16 %42 to i32
  %44 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %4, i32 noundef %43) #7
  %.not19 = icmp eq ptr %44, null
  br i1 %.not19, label %45, label %53

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

53:                                               ; preds = %41
  %54 = load i16, ptr %5, align 2, !tbaa !18
  %55 = icmp eq i16 %54, %0
  br i1 %55, label %56, label %60

56:                                               ; preds = %53
  %57 = load i16, ptr %6, align 2, !tbaa !18
  %58 = zext i16 %57 to i32
  %59 = call i32 @s2n_blob_init(ptr noundef nonnull %2, ptr noundef nonnull %44, i32 noundef %58) #7
  %.lobit = ashr i32 %59, 31
  br label %.thread24

.thread24:                                        ; preds = %38, %45, %56
  %.sroa.0.2.ph = phi i32 [ %.lobit, %56 ], [ -1, %45 ], [ -1, %38 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #7
  br label %.loopexit

60:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #7
  %61 = load i32, ptr %32, align 4, !tbaa !15
  %62 = load i32, ptr %33, align 8, !tbaa !17
  %.not18 = icmp eq i32 %61, %62
  br i1 %.not18, label %.loopexit, label %.lr.ph, !llvm.loop !20

.loopexit:                                        ; preds = %60, %.preheader, %.thread24, %.thread, %27, %24
  %.sroa.0.4 = phi i32 [ -1, %24 ], [ -1, %27 ], [ -1, %.thread ], [ %.sroa.0.2.ph, %.thread24 ], [ 0, %.preheader ], [ 0, %60 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  br label %63

63:                                               ; preds = %.loopexit, %16, %7
  %.sroa.0.5 = phi i32 [ %.sroa.0.4, %.loopexit ], [ -1, %16 ], [ -1, %7 ]
  ret i32 %.sroa.0.5
}

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 = { 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 willreturn memory(read) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!15 = !{!16, !12, i64 28}
!16 = !{!"s2n_stuffer", !14, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!17 = !{!16, !12, i64 24}
!18 = !{!19, !19, i64 0}
!19 = !{!"short", !8, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass