; 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_blob = type { ptr, i32, i32, i8 }
%struct.s2n_result = type { i32 }
%struct.s2n_kem_params = type { ptr, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, 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.53 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.58 = 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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_kem_recv_ciphertext(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
  %9 = alloca %struct.s2n_blob, align 8
  %10 = alloca %struct.s2n_result, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %45, label %14

14:                                               ; preds = %11
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %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
  store ptr @.str.53, ptr %18, align 8, !tbaa !9
  %19 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %20 = getelementptr inbounds %struct.s2n_debug_info, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %21, i64 21
  %23 = call ptr @strrchr(ptr noundef %22, i32 noundef 47) #6
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %32

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

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

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

43:                                               ; preds = %37
  store i32 -1, ptr %3, align 4
  br label %294

44:                                               ; No predecessors!
  br label %45

45:                                               ; preds = %44, %11
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %81, label %50

50:                                               ; preds = %47
  br label %51

51:                                               ; preds = %50
  br label %52

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

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

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

73:                                               ; preds = %68, %61
  %74 = phi ptr [ %67, %61 ], [ %72, %68 ]
  %75 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %76 = getelementptr inbounds %struct.s2n_debug_info, ptr %75, i32 0, i32 1
  store ptr %74, ptr %76, align 8, !tbaa !11
  %77 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %77, align 4, !tbaa !12
  %78 = call i32 @s2n_calculate_stacktrace()
  br label %79

79:                                               ; preds = %73
  store i32 -1, ptr %3, align 4
  br label %294

80:                                               ; No predecessors!
  br label %81

81:                                               ; preds = %80, %47
  br label %82

82:                                               ; preds = %81
  br label %83

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

88:                                               ; preds = %83
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  %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
  store ptr @.str.55, ptr %92, align 8, !tbaa !9
  %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 !9
  %96 = getelementptr inbounds i8, ptr %95, i64 21
  %97 = call ptr @strrchr(ptr noundef %96, i32 noundef 47) #6
  %98 = icmp ne ptr %97, null
  br i1 %98, label %99, label %106

99:                                               ; preds = %90
  %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 !9
  %103 = getelementptr inbounds i8, ptr %102, i64 21
  %104 = call ptr @strrchr(ptr noundef %103, i32 noundef 47) #6
  %105 = getelementptr inbounds i8, ptr %104, i64 1
  br label %111

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

111:                                              ; preds = %106, %99
  %112 = phi ptr [ %105, %99 ], [ %110, %106 ]
  %113 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %114 = getelementptr inbounds %struct.s2n_debug_info, ptr %113, i32 0, i32 1
  store ptr %112, ptr %114, align 8, !tbaa !11
  %115 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %115, align 4, !tbaa !12
  %116 = call i32 @s2n_calculate_stacktrace()
  br label %117

117:                                              ; preds = %111
  store i32 -1, ptr %3, align 4
  br label %294

118:                                              ; No predecessors!
  br label %119

119:                                              ; preds = %118, %83
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.s2n_kem_params, ptr %122, i32 0, i32 2
  %124 = getelementptr inbounds %struct.s2n_blob, ptr %123, i32 0, i32 0
  %125 = load ptr, ptr %124, align 8, !tbaa !18
  %126 = icmp ne ptr %125, null
  br i1 %126, label %158, label %127

127:                                              ; preds = %121
  br label %128

128:                                              ; preds = %127
  br label %129

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

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

145:                                              ; preds = %129
  %146 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %147 = getelementptr inbounds %struct.s2n_debug_info, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !9
  %149 = getelementptr inbounds i8, ptr %148, i64 21
  br label %150

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

156:                                              ; preds = %150
  store i32 -1, ptr %3, align 4
  br label %294

157:                                              ; No predecessors!
  br label %158

158:                                              ; preds = %157, %121
  br label %159

159:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.s2n_kem_params, ptr %160, i32 0, i32 0
  %162 = load ptr, ptr %161, align 8, !tbaa !14
  store ptr %162, ptr %6, align 8, !tbaa !5
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.s2n_kem_params, ptr %163, i32 0, i32 4
  %165 = load i8, ptr %164, align 8, !tbaa !19, !range !20, !noundef !21
  %166 = trunc i8 %165 to i1
  br i1 %166, label %167, label %223

167:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #7
  store i16 0, ptr %7, align 2, !tbaa !22
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = call i32 @s2n_stuffer_read_uint16(ptr noundef %169, ptr noundef %7)
  %171 = icmp sgt i32 %170, -1
  br i1 %171, label %173, label %172

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

173:                                              ; preds = %168
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175
  %177 = load i16, ptr %7, align 2, !tbaa !22
  %178 = zext i16 %177 to i32
  %179 = load ptr, ptr %6, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.s2n_kem, ptr %179, i32 0, i32 6
  %181 = load i16, ptr %180, align 4, !tbaa !24
  %182 = zext i16 %181 to i32
  %183 = icmp eq i32 %178, %182
  br i1 %183, label %217, label %184

184:                                              ; preds = %176
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  %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
  store ptr @.str.57, ptr %188, align 8, !tbaa !9
  %189 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %190 = getelementptr inbounds %struct.s2n_debug_info, ptr %189, i32 0, i32 0
  %191 = load ptr, ptr %190, align 8, !tbaa !9
  %192 = getelementptr inbounds i8, ptr %191, i64 21
  %193 = call ptr @strrchr(ptr noundef %192, i32 noundef 47) #6
  %194 = icmp ne ptr %193, null
  br i1 %194, label %195, label %202

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

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

207:                                              ; preds = %202, %195
  %208 = phi ptr [ %201, %195 ], [ %206, %202 ]
  %209 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %210 = getelementptr inbounds %struct.s2n_debug_info, ptr %209, i32 0, i32 1
  store ptr %208, ptr %210, align 8, !tbaa !11
  %211 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %211, align 4, !tbaa !12
  %212 = call i32 @s2n_calculate_stacktrace()
  br label %213

213:                                              ; preds = %207
  br label %214

214:                                              ; preds = %213
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %220

215:                                              ; No predecessors!
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216, %176
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  store i32 0, ptr %8, align 4
  br label %220

220:                                              ; preds = %219, %214, %172
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #7
  %221 = load i32, ptr %8, align 4
  switch i32 %221, label %293 [
    i32 0, label %222
  ]

222:                                              ; preds = %220
  br label %223

223:                                              ; preds = %222, %159
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #7
  %224 = getelementptr inbounds %struct.s2n_blob, ptr %9, i32 0, i32 0
  %225 = load ptr, ptr %4, align 8, !tbaa !5
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.s2n_kem, ptr %226, i32 0, i32 6
  %228 = load i16, ptr %227, align 4, !tbaa !24
  %229 = zext i16 %228 to i32
  %230 = call ptr @s2n_stuffer_raw_read(ptr noundef %225, i32 noundef %229)
  store ptr %230, ptr %224, align 8, !tbaa !26
  %231 = getelementptr inbounds %struct.s2n_blob, ptr %9, i32 0, i32 1
  %232 = load ptr, ptr %6, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.s2n_kem, ptr %232, i32 0, i32 6
  %234 = load i16, ptr %233, align 4, !tbaa !24
  %235 = zext i16 %234 to i32
  store i32 %235, ptr %231, align 8, !tbaa !27
  %236 = getelementptr inbounds %struct.s2n_blob, ptr %9, i32 0, i32 2
  store i32 0, ptr %236, align 4, !tbaa !28
  %237 = getelementptr inbounds %struct.s2n_blob, ptr %9, i32 0, i32 3
  %238 = load i8, ptr %237, align 8
  %239 = and i8 %238, -2
  %240 = or i8 %239, 0
  store i8 %240, ptr %237, align 8
  br label %241

241:                                              ; preds = %223
  %242 = getelementptr inbounds %struct.s2n_blob, ptr %9, i32 0, i32 0
  %243 = load ptr, ptr %242, align 8, !tbaa !26
  %244 = icmp ne ptr %243, null
  br i1 %244, label %278, label %245

245:                                              ; preds = %241
  br label %246

246:                                              ; preds = %245
  br label %247

247:                                              ; preds = %246
  %248 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %249 = getelementptr inbounds %struct.s2n_debug_info, ptr %248, i32 0, i32 0
  store ptr @.str.58, ptr %249, align 8, !tbaa !9
  %250 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %251 = getelementptr inbounds %struct.s2n_debug_info, ptr %250, i32 0, i32 0
  %252 = load ptr, ptr %251, align 8, !tbaa !9
  %253 = getelementptr inbounds i8, ptr %252, i64 21
  %254 = call ptr @strrchr(ptr noundef %253, i32 noundef 47) #6
  %255 = icmp ne ptr %254, null
  br i1 %255, label %256, label %263

256:                                              ; preds = %247
  %257 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %258 = getelementptr inbounds %struct.s2n_debug_info, ptr %257, i32 0, i32 0
  %259 = load ptr, ptr %258, align 8, !tbaa !9
  %260 = getelementptr inbounds i8, ptr %259, i64 21
  %261 = call ptr @strrchr(ptr noundef %260, i32 noundef 47) #6
  %262 = getelementptr inbounds i8, ptr %261, i64 1
  br label %268

263:                                              ; preds = %247
  %264 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %265 = getelementptr inbounds %struct.s2n_debug_info, ptr %264, i32 0, i32 0
  %266 = load ptr, ptr %265, align 8, !tbaa !9
  %267 = getelementptr inbounds i8, ptr %266, i64 21
  br label %268

268:                                              ; preds = %263, %256
  %269 = phi ptr [ %262, %256 ], [ %267, %263 ]
  %270 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %271 = getelementptr inbounds %struct.s2n_debug_info, ptr %270, i32 0, i32 1
  store ptr %269, ptr %271, align 8, !tbaa !11
  %272 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %272, align 4, !tbaa !12
  %273 = call i32 @s2n_calculate_stacktrace()
  br label %274

274:                                              ; preds = %268
  br label %275

275:                                              ; preds = %274
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %292

276:                                              ; No predecessors!
  br label %277

277:                                              ; preds = %276
  br label %278

278:                                              ; preds = %277, %241
  br label %279

279:                                              ; preds = %278
  br label %280

280:                                              ; preds = %279
  br label %281

281:                                              ; preds = %280
  %282 = load ptr, ptr %5, align 8, !tbaa !5
  %283 = call i32 @s2n_kem_decapsulate(ptr noundef %282, ptr noundef %9)
  %284 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  store i32 %283, ptr %284, align 4
  %285 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  %286 = load i32, ptr %285, align 4
  %287 = call zeroext i1 @s2n_result_is_ok(i32 %286)
  br i1 %287, label %289, label %288

288:                                              ; preds = %281
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %292

289:                                              ; preds = %281
  br label %290

290:                                              ; preds = %289
  br label %291

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

292:                                              ; preds = %291, %288, %275
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #7
  br label %293

293:                                              ; preds = %292, %220
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %294

294:                                              ; preds = %293, %156, %117, %79, %43
  %295 = load i32, ptr %3, align 4
  ret i32 %295
}

declare ptr @s2n_stuffer_raw_read(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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind 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, !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, !6, i64 32}
!19 = !{!15, !17, i64 80}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!23, !23, i64 0}
!23 = !{!"short", !7, i64 0}
!24 = !{!25, !23, i64 20}
!25 = !{!"s2n_kem", !6, i64 0, !13, i64 8, !23, i64 12, !23, i64 14, !23, i64 16, !23, i64 18, !23, i64 20, !6, i64 24, !6, i64 32, !6, i64 40}
!26 = !{!16, !6, i64 0}
!27 = !{!16, !13, i64 8}
!28 = !{!16, !13, i64 12}


; 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_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.53 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.58 = 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

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

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

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

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

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

13:                                               ; preds = %2
  %.not23 = icmp eq ptr %1, null
  br i1 %.not23, label %14, label %22

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

22:                                               ; preds = %13
  %23 = load ptr, ptr %1, align 8, !tbaa !13
  %.not25 = icmp eq ptr %23, null
  br i1 %.not25, label %24, label %32

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

32:                                               ; preds = %22
  %33 = getelementptr inbounds i8, ptr %1, i64 32
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %.not27 = icmp eq ptr %34, null
  br i1 %.not27, label %35, label %43

35:                                               ; preds = %32
  %36 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.56, ptr %36, align 8, !tbaa !5
  %37 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.56, i64 21), i32 noundef 47) #6
  %.not28 = icmp eq ptr %37, null
  %38 = getelementptr inbounds i8, ptr %37, i64 1
  %39 = select i1 %.not28, ptr getelementptr inbounds (i8, ptr @.str.56, i64 21), ptr %38
  %40 = getelementptr inbounds i8, ptr %36, i64 8
  store ptr %39, ptr %40, align 8, !tbaa !10
  %41 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %41, align 4, !tbaa !11
  %42 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %86

43:                                               ; preds = %32
  %44 = getelementptr inbounds i8, ptr %1, i64 80
  %45 = load i8, ptr %44, align 8, !tbaa !18, !range !19, !noundef !20
  %46 = trunc nuw i8 %45 to i1
  br i1 %46, label %47, label %._crit_edge

._crit_edge:                                      ; preds = %43
  %.phi.trans.insert = getelementptr inbounds i8, ptr %23, i64 20
  %.pre = load i16, ptr %.phi.trans.insert, align 4, !tbaa !21
  br label %64

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #7
  store i16 0, ptr %3, align 2, !tbaa !24
  %48 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %0, ptr noundef nonnull %3) #7
  %49 = icmp sgt i32 %48, -1
  br i1 %49, label %50, label %.critedge

50:                                               ; preds = %47
  %51 = load i16, ptr %3, align 2, !tbaa !24
  %52 = getelementptr inbounds i8, ptr %23, i64 20
  %53 = load i16, ptr %52, align 4, !tbaa !21
  %54 = icmp eq i16 %51, %53
  br i1 %54, label %63, label %55

55:                                               ; preds = %50
  %56 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.57, ptr %56, align 8, !tbaa !5
  %57 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.57, i64 21), i32 noundef 47) #6
  %.not29 = icmp eq ptr %57, null
  %58 = getelementptr inbounds i8, ptr %57, i64 1
  %59 = select i1 %.not29, ptr getelementptr inbounds (i8, ptr @.str.57, i64 21), ptr %58
  %60 = getelementptr inbounds i8, ptr %56, i64 8
  store ptr %59, ptr %60, align 8, !tbaa !10
  %61 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %61, align 4, !tbaa !11
  %62 = call i32 @s2n_calculate_stacktrace() #7
  br label %.critedge

63:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #7
  br label %64

64:                                               ; preds = %._crit_edge, %63
  %65 = phi i16 [ %.pre, %._crit_edge ], [ %51, %63 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  %66 = getelementptr inbounds i8, ptr %23, i64 20
  %67 = zext i16 %65 to i32
  %68 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %0, i32 noundef %67) #7
  store ptr %68, ptr %4, align 8, !tbaa !25
  %69 = getelementptr inbounds i8, ptr %4, i64 8
  %70 = load i16, ptr %66, align 4, !tbaa !21
  %71 = zext i16 %70 to i32
  store i32 %71, ptr %69, align 8, !tbaa !26
  %72 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 0, ptr %72, align 4, !tbaa !27
  %73 = getelementptr inbounds i8, ptr %4, i64 16
  store i8 0, ptr %73, align 8
  %.not30 = icmp eq ptr %68, null
  br i1 %.not30, label %74, label %82

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

82:                                               ; preds = %64
  %83 = call i32 @s2n_kem_decapsulate(ptr noundef nonnull %1, ptr noundef nonnull %4)
  %84 = call zeroext i1 @s2n_result_is_ok(i32 %83)
  %not. = xor i1 %84, true
  %. = sext i1 %not. to i32
  br label %85

85:                                               ; preds = %82, %74
  %.1 = phi i32 [ -1, %74 ], [ %., %82 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  br label %86

.critedge:                                        ; preds = %47, %55
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #7
  br label %86

86:                                               ; preds = %85, %.critedge, %35, %24, %14, %5
  %.3 = phi i32 [ -1, %35 ], [ -1, %24 ], [ -1, %14 ], [ -1, %5 ], [ %.1, %85 ], [ -1, %.critedge ]
  ret i32 %.3
}

declare ptr @s2n_stuffer_raw_read(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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind 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, !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, !7, i64 32}
!18 = !{!14, !16, i64 80}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!22, !23, i64 20}
!22 = !{!"s2n_kem", !7, i64 0, !12, i64 8, !23, i64 12, !23, i64 14, !23, i64 16, !23, i64 18, !23, i64 20, !7, i64 24, !7, i64 32, !7, i64 40}
!23 = !{!"short", !8, i64 0}
!24 = !{!23, !23, i64 0}
!25 = !{!15, !7, i64 0}
!26 = !{!15, !12, i64 8}
!27 = !{!15, !12, i64 12}


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