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

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

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.44 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [84 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

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

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

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

9:                                                ; preds = %2
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %43, label %12

12:                                               ; preds = %9
  br label %13

13:                                               ; preds = %12
  br label %14

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

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

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

35:                                               ; preds = %30, %23
  %36 = phi ptr [ %29, %23 ], [ %34, %30 ]
  %37 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %38 = getelementptr inbounds %struct.s2n_debug_info, ptr %37, i32 0, i32 1
  store ptr %36, ptr %38, align 8, !tbaa !11
  %39 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %39, align 4, !tbaa !12
  %40 = call i32 @s2n_calculate_stacktrace()
  br label %41

41:                                               ; preds = %35
  store i32 -1, ptr %3, align 4
  br label %213

42:                                               ; No predecessors!
  br label %43

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

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %79, label %48

48:                                               ; preds = %45
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  %51 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %52 = getelementptr inbounds %struct.s2n_debug_info, ptr %51, i32 0, i32 0
  store ptr @.str.45, ptr %52, align 8, !tbaa !9
  %53 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %54 = getelementptr inbounds %struct.s2n_debug_info, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %55, i64 21
  %57 = call ptr @strrchr(ptr noundef %56, i32 noundef 47) #5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %66

59:                                               ; preds = %50
  %60 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %61 = getelementptr inbounds %struct.s2n_debug_info, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds i8, ptr %62, i64 21
  %64 = call ptr @strrchr(ptr noundef %63, i32 noundef 47) #5
  %65 = getelementptr inbounds i8, ptr %64, i64 1
  br label %71

66:                                               ; preds = %50
  %67 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %68 = getelementptr inbounds %struct.s2n_debug_info, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = getelementptr inbounds i8, ptr %69, i64 21
  br label %71

71:                                               ; preds = %66, %59
  %72 = phi ptr [ %65, %59 ], [ %70, %66 ]
  %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 1
  store ptr %72, ptr %74, align 8, !tbaa !11
  %75 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %75, align 4, !tbaa !12
  %76 = call i32 @s2n_calculate_stacktrace()
  br label %77

77:                                               ; preds = %71
  store i32 -1, ptr %3, align 4
  br label %213

78:                                               ; No predecessors!
  br label %79

79:                                               ; preds = %78, %45
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.s2n_kem_params, ptr %82, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8, !tbaa !14
  %85 = icmp ne ptr %84, null
  br i1 %85, label %117, label %86

86:                                               ; preds = %81
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  %89 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %90 = getelementptr inbounds %struct.s2n_debug_info, ptr %89, i32 0, i32 0
  store ptr @.str.46, ptr %90, align 8, !tbaa !9
  %91 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %92 = getelementptr inbounds %struct.s2n_debug_info, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !9
  %94 = getelementptr inbounds i8, ptr %93, i64 21
  %95 = call ptr @strrchr(ptr noundef %94, i32 noundef 47) #5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %104

97:                                               ; preds = %88
  %98 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %99 = getelementptr inbounds %struct.s2n_debug_info, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !9
  %101 = getelementptr inbounds i8, ptr %100, i64 21
  %102 = call ptr @strrchr(ptr noundef %101, i32 noundef 47) #5
  %103 = getelementptr inbounds i8, ptr %102, i64 1
  br label %109

104:                                              ; preds = %88
  %105 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %106 = getelementptr inbounds %struct.s2n_debug_info, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !9
  %108 = getelementptr inbounds i8, ptr %107, i64 21
  br label %109

109:                                              ; preds = %104, %97
  %110 = phi ptr [ %103, %97 ], [ %108, %104 ]
  %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 1
  store ptr %110, ptr %112, align 8, !tbaa !11
  %113 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %113, align 4, !tbaa !12
  %114 = call i32 @s2n_calculate_stacktrace()
  br label %115

115:                                              ; preds = %109
  store i32 -1, ptr %3, align 4
  br label %213

116:                                              ; No predecessors!
  br label %117

117:                                              ; preds = %116, %81
  br label %118

118:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.s2n_kem_params, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !14
  store ptr %121, ptr %6, align 8, !tbaa !5
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.s2n_kem_params, ptr %122, i32 0, i32 4
  %124 = load i8, ptr %123, align 8, !tbaa !18, !range !19, !noundef !20
  %125 = trunc i8 %124 to i1
  br i1 %125, label %126, label %182

126:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #6
  store i16 0, ptr %7, align 2, !tbaa !21
  br label %127

127:                                              ; preds = %126
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = call i32 @s2n_stuffer_read_uint16(ptr noundef %128, ptr noundef %7)
  %130 = icmp sgt i32 %129, -1
  br i1 %130, label %132, label %131

131:                                              ; preds = %127
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %179

132:                                              ; preds = %127
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  %136 = load i16, ptr %7, align 2, !tbaa !21
  %137 = zext i16 %136 to i32
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.s2n_kem, ptr %138, i32 0, i32 3
  %140 = load i16, ptr %139, align 2, !tbaa !23
  %141 = zext i16 %140 to i32
  %142 = icmp eq i32 %137, %141
  br i1 %142, label %176, label %143

143:                                              ; preds = %135
  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.47, ptr %147, align 8, !tbaa !9
  %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 !9
  %151 = getelementptr inbounds i8, ptr %150, i64 21
  %152 = call ptr @strrchr(ptr noundef %151, i32 noundef 47) #5
  %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 !9
  %158 = getelementptr inbounds i8, ptr %157, i64 21
  %159 = call ptr @strrchr(ptr noundef %158, i32 noundef 47) #5
  %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 !9
  %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 !11
  %170 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %170, align 4, !tbaa !12
  %171 = call i32 @s2n_calculate_stacktrace()
  br label %172

172:                                              ; preds = %166
  br label %173

173:                                              ; preds = %172
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %179

174:                                              ; No predecessors!
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175, %135
  br label %177

177:                                              ; preds = %176
  br label %178

178:                                              ; preds = %177
  store i32 0, ptr %8, align 4
  br label %179

179:                                              ; preds = %178, %173, %131
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #6
  %180 = load i32, ptr %8, align 4
  switch i32 %180, label %212 [
    i32 0, label %181
  ]

181:                                              ; preds = %179
  br label %182

182:                                              ; preds = %181, %118
  br label %183

183:                                              ; preds = %182
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.s2n_kem_params, ptr %184, i32 0, i32 1
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.s2n_kem, ptr %186, i32 0, i32 3
  %188 = load i16, ptr %187, align 2, !tbaa !23
  %189 = zext i16 %188 to i32
  %190 = call i32 @s2n_alloc(ptr noundef %185, i32 noundef %189)
  %191 = icmp sgt i32 %190, -1
  br i1 %191, label %193, label %192

192:                                              ; preds = %183
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %212

193:                                              ; preds = %183
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  %197 = load ptr, ptr %4, align 8, !tbaa !5
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.s2n_kem_params, ptr %198, i32 0, i32 1
  %200 = getelementptr inbounds %struct.s2n_blob, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !25
  %202 = load ptr, ptr %6, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.s2n_kem, ptr %202, i32 0, i32 3
  %204 = load i16, ptr %203, align 2, !tbaa !23
  %205 = zext i16 %204 to i32
  %206 = call i32 @s2n_stuffer_read_bytes(ptr noundef %197, ptr noundef %201, i32 noundef %205)
  %207 = icmp sgt i32 %206, -1
  br i1 %207, label %209, label %208

208:                                              ; preds = %196
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %212

209:                                              ; preds = %196
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %212

212:                                              ; preds = %211, %208, %192, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %213

213:                                              ; preds = %212, %115, %77, %41
  %214 = load i32, ptr %3, align 4
  ret i32 %214
}

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

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

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

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


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

%struct.s2n_debug_info = type { ptr, ptr }

@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.44 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [84 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

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

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

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

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

12:                                               ; preds = %2
  %.not22 = icmp eq ptr %1, null
  br i1 %.not22, label %13, label %21

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

21:                                               ; preds = %12
  %22 = load ptr, ptr %1, align 8, !tbaa !13
  %.not24 = icmp eq ptr %22, null
  br i1 %.not24, label %23, label %31

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

31:                                               ; preds = %21
  %32 = getelementptr inbounds i8, ptr %1, i64 80
  %33 = load i8, ptr %32, align 8, !tbaa !17, !range !18, !noundef !19
  %34 = trunc nuw i8 %33 to i1
  br i1 %34, label %35, label %._crit_edge

._crit_edge:                                      ; preds = %31
  %.phi.trans.insert = getelementptr inbounds i8, ptr %22, i64 14
  %.pre = load i16, ptr %.phi.trans.insert, align 2, !tbaa !20
  br label %52

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #6
  store i16 0, ptr %3, align 2, !tbaa !23
  %36 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %0, ptr noundef nonnull %3) #6
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %.critedge

38:                                               ; preds = %35
  %39 = load i16, ptr %3, align 2, !tbaa !23
  %40 = getelementptr inbounds i8, ptr %22, i64 14
  %41 = load i16, ptr %40, align 2, !tbaa !20
  %42 = icmp eq i16 %39, %41
  br i1 %42, label %51, label %43

43:                                               ; preds = %38
  %44 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.47, ptr %44, align 8, !tbaa !5
  %45 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.47, i64 21), i32 noundef 47) #5
  %.not26 = icmp eq ptr %45, null
  %46 = getelementptr inbounds i8, ptr %45, i64 1
  %47 = select i1 %.not26, ptr getelementptr inbounds (i8, ptr @.str.47, i64 21), ptr %46
  %48 = getelementptr inbounds i8, ptr %44, i64 8
  store ptr %47, ptr %48, align 8, !tbaa !10
  %49 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %49, align 4, !tbaa !11
  %50 = call i32 @s2n_calculate_stacktrace() #6
  br label %.critedge

51:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #6
  br label %52

52:                                               ; preds = %._crit_edge, %51
  %53 = phi i16 [ %.pre, %._crit_edge ], [ %39, %51 ]
  %54 = getelementptr inbounds i8, ptr %1, i64 8
  %55 = zext i16 %53 to i32
  %56 = call i32 @s2n_alloc(ptr noundef nonnull %54, i32 noundef %55) #6
  %57 = icmp sgt i32 %56, -1
  br i1 %57, label %58, label %64

58:                                               ; preds = %52
  %59 = getelementptr inbounds i8, ptr %22, i64 14
  %60 = load ptr, ptr %54, align 8, !tbaa !24
  %61 = load i16, ptr %59, align 2, !tbaa !20
  %62 = zext i16 %61 to i32
  %63 = call i32 @s2n_stuffer_read_bytes(ptr noundef nonnull %0, ptr noundef %60, i32 noundef %62) #6
  %.lobit = ashr i32 %63, 31
  br label %64

.critedge:                                        ; preds = %35, %43
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #6
  br label %64

64:                                               ; preds = %.critedge, %52, %58, %23, %13, %4
  %.2 = phi i32 [ -1, %23 ], [ -1, %13 ], [ -1, %4 ], [ -1, %.critedge ], [ -1, %52 ], [ %.lobit, %58 ]
  ret i32 %.2
}

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

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

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

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


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