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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.s2n_debug_info = type { ptr, ptr }
%struct.s2n_result = type { i32 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }

@.str = external hidden unnamed_addr constant [96 x i8], align 1
@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.1 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [96 x i8], align 1

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

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

declare i32 @s2n_stuffer_validate(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_stuffer_read_expected_str(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s2n_result, align 4
  %7 = alloca %struct.s2n_result, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %struct.s2n_result, align 4
  %12 = 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 %13

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call i32 @s2n_stuffer_validate(ptr noundef %14)
  %16 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 %15, ptr %16, align 4
  %17 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  %18 = load i32, ptr %17, align 4
  %19 = call zeroext i1 @s2n_result_is_ok(i32 %18)
  %20 = xor i1 %19, true
  %21 = xor i1 %20, true
  %22 = zext i1 %21 to i32
  %23 = sext i32 %22 to i64
  %24 = call i64 @llvm.expect.i64(i64 %23, i64 1)
  %25 = icmp ne i64 %24, 0
  br i1 %25, label %26, label %28

26:                                               ; preds = %13
  %27 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %30

28:                                               ; preds = %13
  %29 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %29, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %28, %26
  %31 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  %32 = load i32, ptr %31, align 4
  %33 = call zeroext i1 @s2n_result_is_ok(i32 %32)
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 -1, ptr %3, align 4
  br label %250

35:                                               ; preds = %30
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %71, label %40

40:                                               ; preds = %37
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %44 = getelementptr inbounds %struct.s2n_debug_info, ptr %43, i32 0, i32 0
  store ptr @.str, ptr %44, align 8, !tbaa !12
  %45 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %46 = getelementptr inbounds %struct.s2n_debug_info, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !12
  %48 = getelementptr inbounds i8, ptr %47, i64 21
  %49 = call ptr @strrchr(ptr noundef %48, i32 noundef 47) #7
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %58

51:                                               ; preds = %42
  %52 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %53 = getelementptr inbounds %struct.s2n_debug_info, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !12
  %55 = getelementptr inbounds i8, ptr %54, i64 21
  %56 = call ptr @strrchr(ptr noundef %55, i32 noundef 47) #7
  %57 = getelementptr inbounds i8, ptr %56, i64 1
  br label %63

58:                                               ; preds = %42
  %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 !12
  %62 = getelementptr inbounds i8, ptr %61, i64 21
  br label %63

63:                                               ; preds = %58, %51
  %64 = phi ptr [ %57, %51 ], [ %62, %58 ]
  %65 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %66 = getelementptr inbounds %struct.s2n_debug_info, ptr %65, i32 0, i32 1
  store ptr %64, ptr %66, align 8, !tbaa !14
  %67 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %67, align 4, !tbaa !15
  %68 = call i32 @s2n_calculate_stacktrace()
  br label %69

69:                                               ; preds = %63
  store i32 -1, ptr %3, align 4
  br label %250

70:                                               ; No predecessors!
  br label %71

71:                                               ; preds = %70, %37
  br label %72

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = call i64 @strlen(ptr noundef %73) #7
  store i64 %74, ptr %8, align 8, !tbaa !16
  %75 = load i64, ptr %8, align 8, !tbaa !16
  %76 = icmp eq i64 %75, 0
  br i1 %76, label %77, label %78

77:                                               ; preds = %72
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %249

78:                                               ; preds = %72
  br label %79

79:                                               ; preds = %78
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.s2n_stuffer, ptr %80, i32 0, i32 2
  %82 = load i32, ptr %81, align 4, !tbaa !18
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.s2n_stuffer, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 8, !tbaa !21
  %86 = sub i32 %82, %85
  %87 = zext i32 %86 to i64
  %88 = load i64, ptr %8, align 8, !tbaa !16
  %89 = icmp uge i64 %87, %88
  br i1 %89, label %123, label %90

90:                                               ; preds = %79
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  %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
  store ptr @.str.1, ptr %94, align 8, !tbaa !12
  %95 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %96 = getelementptr inbounds %struct.s2n_debug_info, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !12
  %98 = getelementptr inbounds i8, ptr %97, i64 21
  %99 = call ptr @strrchr(ptr noundef %98, i32 noundef 47) #7
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %108

101:                                              ; preds = %92
  %102 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %103 = getelementptr inbounds %struct.s2n_debug_info, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !12
  %105 = getelementptr inbounds i8, ptr %104, i64 21
  %106 = call ptr @strrchr(ptr noundef %105, i32 noundef 47) #7
  %107 = getelementptr inbounds i8, ptr %106, i64 1
  br label %113

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

113:                                              ; preds = %108, %101
  %114 = phi ptr [ %107, %101 ], [ %112, %108 ]
  %115 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %116 = getelementptr inbounds %struct.s2n_debug_info, ptr %115, i32 0, i32 1
  store ptr %114, ptr %116, align 8, !tbaa !14
  %117 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653201, ptr %117, align 4, !tbaa !15
  %118 = call i32 @s2n_calculate_stacktrace()
  br label %119

119:                                              ; preds = %113
  br label %120

120:                                              ; preds = %119
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %249

121:                                              ; No predecessors!
  br label %122

122:                                              ; preds = %121
  br label %123

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

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.s2n_stuffer, ptr %126, i32 0, i32 0
  %128 = getelementptr inbounds %struct.s2n_blob, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !22
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.s2n_stuffer, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 8, !tbaa !21
  %133 = zext i32 %132 to i64
  %134 = getelementptr inbounds i8, ptr %129, i64 %133
  store ptr %134, ptr %10, align 8, !tbaa !5
  br label %135

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

138:                                              ; preds = %135
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %142 = getelementptr inbounds %struct.s2n_debug_info, ptr %141, i32 0, i32 0
  store ptr @.str.2, ptr %142, align 8, !tbaa !12
  %143 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %144 = getelementptr inbounds %struct.s2n_debug_info, ptr %143, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8, !tbaa !12
  %146 = getelementptr inbounds i8, ptr %145, i64 21
  %147 = call ptr @strrchr(ptr noundef %146, i32 noundef 47) #7
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %156

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

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

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

167:                                              ; preds = %161
  br label %168

168:                                              ; preds = %167
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %248

169:                                              ; No predecessors!
  br label %170

170:                                              ; preds = %169
  br label %171

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

172:                                              ; preds = %171
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  %175 = load ptr, ptr %10, align 8, !tbaa !5
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = load i64, ptr %8, align 8, !tbaa !16
  %178 = call i32 @memcmp(ptr noundef %175, ptr noundef %176, i64 noundef %177) #7
  %179 = icmp ne i32 %178, 0
  br i1 %179, label %180, label %213

180:                                              ; preds = %174
  br label %181

181:                                              ; preds = %180
  br label %182

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

191:                                              ; preds = %182
  %192 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %193 = getelementptr inbounds %struct.s2n_debug_info, ptr %192, i32 0, i32 0
  %194 = load ptr, ptr %193, align 8, !tbaa !12
  %195 = getelementptr inbounds i8, ptr %194, i64 21
  %196 = call ptr @strrchr(ptr noundef %195, i32 noundef 47) #7
  %197 = getelementptr inbounds i8, ptr %196, i64 1
  br label %203

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

203:                                              ; preds = %198, %191
  %204 = phi ptr [ %197, %191 ], [ %202, %198 ]
  %205 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %206 = getelementptr inbounds %struct.s2n_debug_info, ptr %205, i32 0, i32 1
  store ptr %204, ptr %206, align 8, !tbaa !14
  %207 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653203, ptr %207, align 4, !tbaa !15
  %208 = call i32 @s2n_calculate_stacktrace()
  br label %209

209:                                              ; preds = %203
  br label %210

210:                                              ; preds = %209
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %248

211:                                              ; No predecessors!
  br label %212

212:                                              ; preds = %211
  br label %213

213:                                              ; preds = %212, %174
  br label %214

214:                                              ; preds = %213
  br label %215

215:                                              ; preds = %214
  %216 = load i64, ptr %8, align 8, !tbaa !16
  %217 = load ptr, ptr %4, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.s2n_stuffer, ptr %217, i32 0, i32 1
  %219 = load i32, ptr %218, align 8, !tbaa !21
  %220 = zext i32 %219 to i64
  %221 = add i64 %220, %216
  %222 = trunc i64 %221 to i32
  store i32 %222, ptr %218, align 8, !tbaa !21
  br label %223

223:                                              ; preds = %215
  %224 = load ptr, ptr %4, align 8, !tbaa !5
  %225 = call i32 @s2n_stuffer_validate(ptr noundef %224)
  %226 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  store i32 %225, ptr %226, align 4
  %227 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  %228 = load i32, ptr %227, align 4
  %229 = call zeroext i1 @s2n_result_is_ok(i32 %228)
  %230 = xor i1 %229, true
  %231 = xor i1 %230, true
  %232 = zext i1 %231 to i32
  %233 = sext i32 %232 to i64
  %234 = call i64 @llvm.expect.i64(i64 %233, i64 1)
  %235 = icmp ne i64 %234, 0
  br i1 %235, label %236, label %238

236:                                              ; preds = %223
  %237 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  store i32 0, ptr %237, align 4, !tbaa !9
  br label %240

238:                                              ; preds = %223
  %239 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  store i32 -1, ptr %239, align 4, !tbaa !9
  br label %240

240:                                              ; preds = %238, %236
  %241 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  %242 = load i32, ptr %241, align 4
  %243 = call zeroext i1 @s2n_result_is_ok(i32 %242)
  br i1 %243, label %245, label %244

244:                                              ; preds = %240
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %248

245:                                              ; preds = %240
  br label %246

246:                                              ; preds = %245
  br label %247

247:                                              ; preds = %246
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %248

248:                                              ; preds = %247, %244, %210, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %249

249:                                              ; preds = %248, %120, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %250

250:                                              ; preds = %249, %69, %34
  %251 = load i32, ptr %3, align 4
  ret i32 %251
}

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

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

declare i32 @s2n_calculate_stacktrace() #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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(none) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!14 = !{!13, !6, i64 8}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!19, !11, i64 28}
!19 = !{!"s2n_stuffer", !20, i64 0, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 36, !11, i64 36}
!20 = !{!"s2n_blob", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!21 = !{!19, !11, i64 24}
!22 = !{!19, !6, i64 0}


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

%struct.s2n_debug_info = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [96 x i8], align 1
@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.1 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [96 x i8], align 1

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

declare i32 @s2n_stuffer_validate(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_stuffer_read_expected_str(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #2 {
  %3 = tail call i32 @s2n_stuffer_validate(ptr noundef %0) #6
  %4 = tail call zeroext i1 @s2n_result_is_ok(i32 %3)
  %not. = xor i1 %4, true
  %. = sext i1 %not. to i32
  %5 = tail call zeroext i1 @s2n_result_is_ok(i32 %.)
  br i1 %5, label %6, label %60

6:                                                ; preds = %2
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %7, label %15

7:                                                ; preds = %6
  %8 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str, ptr %8, align 8, !tbaa !5
  %9 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str, i64 21), i32 noundef 47) #7
  %.not26 = icmp eq ptr %9, null
  %10 = getelementptr inbounds i8, ptr %9, i64 1
  %11 = select i1 %.not26, ptr getelementptr inbounds (i8, ptr @.str, 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() #6
  br label %60

15:                                               ; preds = %6
  %16 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #7
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %60, label %18

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 28
  %20 = load i32, ptr %19, align 4, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %0, i64 24
  %22 = load i32, ptr %21, align 8, !tbaa !16
  %23 = sub i32 %20, %22
  %24 = zext i32 %23 to i64
  %.not27 = icmp ugt i64 %16, %24
  br i1 %.not27, label %25, label %33

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

33:                                               ; preds = %18
  %34 = load ptr, ptr %0, align 8, !tbaa !17
  %.not29 = icmp eq ptr %34, null
  br i1 %.not29, label %35, label %43

35:                                               ; preds = %33
  %36 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.2, ptr %36, align 8, !tbaa !5
  %37 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.2, i64 21), i32 noundef 47) #7
  %.not30 = icmp eq ptr %37, null
  %38 = getelementptr inbounds i8, ptr %37, i64 1
  %39 = select i1 %.not30, ptr getelementptr inbounds (i8, ptr @.str.2, 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() #6
  br label %60

43:                                               ; preds = %33
  %44 = zext i32 %22 to i64
  %45 = getelementptr inbounds i8, ptr %34, i64 %44
  %bcmp = tail call i32 @bcmp(ptr nonnull %45, ptr nonnull %1, i64 %16)
  %.not31 = icmp eq i32 %bcmp, 0
  br i1 %.not31, label %54, label %46

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

54:                                               ; preds = %43
  %55 = trunc i64 %16 to i32
  %56 = add i32 %22, %55
  store i32 %56, ptr %21, align 8, !tbaa !16
  %57 = tail call i32 @s2n_stuffer_validate(ptr noundef nonnull %0) #6
  %58 = tail call zeroext i1 @s2n_result_is_ok(i32 %57)
  %not.34 = xor i1 %58, true
  %.33 = sext i1 %not.34 to i32
  %59 = tail call zeroext i1 @s2n_result_is_ok(i32 %.33)
  %not.35 = xor i1 %59, true
  %spec.select = sext i1 %not.35 to i32
  br label %60

60:                                               ; preds = %54, %25, %15, %46, %35, %2, %7
  %.2 = phi i32 [ -1, %7 ], [ -1, %2 ], [ -1, %25 ], [ 0, %15 ], [ -1, %46 ], [ -1, %35 ], [ %spec.select, %54 ]
  ret i32 %.2
}

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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 28}
!14 = !{!"s2n_stuffer", !15, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!15 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!16 = !{!14, !12, i64 24}
!17 = !{!14, !7, i64 0}


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