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

; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%struct.s2n_rand_device = type { ptr, i32, i64, i64, i32, i64 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.9 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [89 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: nounwind uwtable
define dso_local i32 @s2n_rand_device_validate(ptr noundef %0) #3 {
  %2 = alloca %struct.s2n_result, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %struct.stat, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %7

7:                                                ; preds = %1
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %42, label %10

10:                                               ; preds = %7
  br label %11

11:                                               ; preds = %10
  br label %12

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

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

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

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

39:                                               ; preds = %33
  %40 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %40, align 4, !tbaa !14
  br label %308

41:                                               ; No predecessors!
  br label %42

42:                                               ; preds = %41, %7
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.s2n_rand_device, ptr %45, i32 0, i32 1
  %47 = load i32, ptr %46, align 8, !tbaa !16
  %48 = icmp ne i32 %47, -1
  br i1 %48, label %81, label %49

49:                                               ; preds = %44
  br label %50

50:                                               ; preds = %49
  br label %51

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

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

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

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

78:                                               ; preds = %72
  %79 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %79, align 4, !tbaa !14
  br label %308

80:                                               ; No predecessors!
  br label %81

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

82:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 144, ptr %4) #8
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 144, i1 false)
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.s2n_rand_device, ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 8, !tbaa !16
  %87 = call i32 @fstat(i32 noundef %86, ptr noundef %4) #8
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %123, label %89

89:                                               ; preds = %83
  br label %90

90:                                               ; preds = %89
  br label %91

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

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

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

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

118:                                              ; preds = %112
  br label %119

119:                                              ; preds = %118
  %120 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %120, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %307

121:                                              ; No predecessors!
  br label %122

122:                                              ; preds = %121
  br label %123

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

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.s2n_rand_device, ptr %127, i32 0, i32 2
  %129 = load i64, ptr %128, align 8, !tbaa !19
  %130 = getelementptr inbounds %struct.stat, ptr %4, i32 0, i32 0
  %131 = load i64, ptr %130, align 8, !tbaa !20
  %132 = icmp eq i64 %129, %131
  br i1 %132, label %167, label %133

133:                                              ; preds = %126
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  %136 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %137 = getelementptr inbounds %struct.s2n_debug_info, ptr %136, i32 0, i32 0
  store ptr @.str.12, ptr %137, align 8, !tbaa !9
  %138 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %139 = getelementptr inbounds %struct.s2n_debug_info, ptr %138, i32 0, i32 0
  %140 = load ptr, ptr %139, align 8, !tbaa !9
  %141 = getelementptr inbounds i8, ptr %140, i64 21
  %142 = call ptr @strrchr(ptr noundef %141, i32 noundef 47) #7
  %143 = icmp ne ptr %142, null
  br i1 %143, label %144, label %151

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

151:                                              ; preds = %135
  %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 0
  %154 = load ptr, ptr %153, align 8, !tbaa !9
  %155 = getelementptr inbounds i8, ptr %154, i64 21
  br label %156

156:                                              ; preds = %151, %144
  %157 = phi ptr [ %150, %144 ], [ %155, %151 ]
  %158 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %159 = getelementptr inbounds %struct.s2n_debug_info, ptr %158, i32 0, i32 1
  store ptr %157, ptr %159, align 8, !tbaa !11
  %160 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %160, align 4, !tbaa !12
  %161 = call i32 @s2n_calculate_stacktrace()
  br label %162

162:                                              ; preds = %156
  br label %163

163:                                              ; preds = %162
  %164 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %164, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %307

165:                                              ; No predecessors!
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166, %126
  br label %168

168:                                              ; preds = %167
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.s2n_rand_device, ptr %171, i32 0, i32 3
  %173 = load i64, ptr %172, align 8, !tbaa !23
  %174 = getelementptr inbounds %struct.stat, ptr %4, i32 0, i32 1
  %175 = load i64, ptr %174, align 8, !tbaa !24
  %176 = icmp eq i64 %173, %175
  br i1 %176, label %211, label %177

177:                                              ; preds = %170
  br label %178

178:                                              ; preds = %177
  br label %179

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

188:                                              ; preds = %179
  %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) #7
  %194 = getelementptr inbounds i8, ptr %193, i64 1
  br label %200

195:                                              ; preds = %179
  %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
  br label %200

200:                                              ; preds = %195, %188
  %201 = phi ptr [ %194, %188 ], [ %199, %195 ]
  %202 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %203 = getelementptr inbounds %struct.s2n_debug_info, ptr %202, i32 0, i32 1
  store ptr %201, ptr %203, align 8, !tbaa !11
  %204 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %204, align 4, !tbaa !12
  %205 = call i32 @s2n_calculate_stacktrace()
  br label %206

206:                                              ; preds = %200
  br label %207

207:                                              ; preds = %206
  %208 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %208, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %307

209:                                              ; No predecessors!
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210, %170
  br label %212

212:                                              ; preds = %211
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  %215 = load ptr, ptr %3, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.s2n_rand_device, ptr %215, i32 0, i32 5
  %217 = load i64, ptr %216, align 8, !tbaa !25
  %218 = getelementptr inbounds %struct.stat, ptr %4, i32 0, i32 7
  %219 = load i64, ptr %218, align 8, !tbaa !26
  %220 = icmp eq i64 %217, %219
  br i1 %220, label %255, label %221

221:                                              ; preds = %214
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  %224 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %225 = getelementptr inbounds %struct.s2n_debug_info, ptr %224, i32 0, i32 0
  store ptr @.str.14, ptr %225, align 8, !tbaa !9
  %226 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %227 = getelementptr inbounds %struct.s2n_debug_info, ptr %226, i32 0, i32 0
  %228 = load ptr, ptr %227, align 8, !tbaa !9
  %229 = getelementptr inbounds i8, ptr %228, i64 21
  %230 = call ptr @strrchr(ptr noundef %229, i32 noundef 47) #7
  %231 = icmp ne ptr %230, null
  br i1 %231, label %232, label %239

232:                                              ; preds = %223
  %233 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %234 = getelementptr inbounds %struct.s2n_debug_info, ptr %233, i32 0, i32 0
  %235 = load ptr, ptr %234, align 8, !tbaa !9
  %236 = getelementptr inbounds i8, ptr %235, i64 21
  %237 = call ptr @strrchr(ptr noundef %236, i32 noundef 47) #7
  %238 = getelementptr inbounds i8, ptr %237, i64 1
  br label %244

239:                                              ; preds = %223
  %240 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %241 = getelementptr inbounds %struct.s2n_debug_info, ptr %240, i32 0, i32 0
  %242 = load ptr, ptr %241, align 8, !tbaa !9
  %243 = getelementptr inbounds i8, ptr %242, i64 21
  br label %244

244:                                              ; preds = %239, %232
  %245 = phi ptr [ %238, %232 ], [ %243, %239 ]
  %246 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %247 = getelementptr inbounds %struct.s2n_debug_info, ptr %246, i32 0, i32 1
  store ptr %245, ptr %247, align 8, !tbaa !11
  %248 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %248, align 4, !tbaa !12
  %249 = call i32 @s2n_calculate_stacktrace()
  br label %250

250:                                              ; preds = %244
  br label %251

251:                                              ; preds = %250
  %252 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %252, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %307

253:                                              ; No predecessors!
  br label %254

254:                                              ; preds = %253
  br label %255

255:                                              ; preds = %254, %214
  br label %256

256:                                              ; preds = %255
  br label %257

257:                                              ; preds = %256
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 -512, ptr %6, align 4, !tbaa !12
  br label %258

258:                                              ; preds = %257
  %259 = load ptr, ptr %3, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.s2n_rand_device, ptr %259, i32 0, i32 4
  %261 = load i32, ptr %260, align 8, !tbaa !27
  %262 = getelementptr inbounds %struct.stat, ptr %4, i32 0, i32 3
  %263 = load i32, ptr %262, align 8, !tbaa !28
  %264 = xor i32 %261, %263
  %265 = load i32, ptr %6, align 4, !tbaa !12
  %266 = and i32 %264, %265
  %267 = icmp eq i32 %266, 0
  br i1 %267, label %302, label %268

268:                                              ; preds = %258
  br label %269

269:                                              ; preds = %268
  br label %270

270:                                              ; preds = %269
  %271 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %272 = getelementptr inbounds %struct.s2n_debug_info, ptr %271, i32 0, i32 0
  store ptr @.str.15, ptr %272, align 8, !tbaa !9
  %273 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %274 = getelementptr inbounds %struct.s2n_debug_info, ptr %273, i32 0, i32 0
  %275 = load ptr, ptr %274, align 8, !tbaa !9
  %276 = getelementptr inbounds i8, ptr %275, i64 21
  %277 = call ptr @strrchr(ptr noundef %276, i32 noundef 47) #7
  %278 = icmp ne ptr %277, null
  br i1 %278, label %279, label %286

279:                                              ; preds = %270
  %280 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %281 = getelementptr inbounds %struct.s2n_debug_info, ptr %280, i32 0, i32 0
  %282 = load ptr, ptr %281, align 8, !tbaa !9
  %283 = getelementptr inbounds i8, ptr %282, i64 21
  %284 = call ptr @strrchr(ptr noundef %283, i32 noundef 47) #7
  %285 = getelementptr inbounds i8, ptr %284, i64 1
  br label %291

286:                                              ; preds = %270
  %287 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %288 = getelementptr inbounds %struct.s2n_debug_info, ptr %287, i32 0, i32 0
  %289 = load ptr, ptr %288, align 8, !tbaa !9
  %290 = getelementptr inbounds i8, ptr %289, i64 21
  br label %291

291:                                              ; preds = %286, %279
  %292 = phi ptr [ %285, %279 ], [ %290, %286 ]
  %293 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %294 = getelementptr inbounds %struct.s2n_debug_info, ptr %293, i32 0, i32 1
  store ptr %292, ptr %294, align 8, !tbaa !11
  %295 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %295, align 4, !tbaa !12
  %296 = call i32 @s2n_calculate_stacktrace()
  br label %297

297:                                              ; preds = %291
  br label %298

298:                                              ; preds = %297
  %299 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %299, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %306

300:                                              ; No predecessors!
  br label %301

301:                                              ; preds = %300
  br label %302

302:                                              ; preds = %301, %258
  br label %303

303:                                              ; preds = %302
  br label %304

304:                                              ; preds = %303
  %305 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 0, ptr %305, align 4, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %306

306:                                              ; preds = %304, %298
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %307

307:                                              ; preds = %306, %251, %207, %163, %119
  call void @llvm.lifetime.end.p0(i64 144, ptr %4) #8
  br label %308

308:                                              ; preds = %307, %78, %39
  %309 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  %310 = load i32, ptr %309, align 4
  ret i32 %310
}

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

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

; Function Attrs: nounwind
declare i32 @fstat(i32 noundef, ptr noundef) #6

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

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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind "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, !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, !13, i64 0}
!15 = !{!"", !13, i64 0}
!16 = !{!17, !13, i64 8}
!17 = !{!"s2n_rand_device", !6, i64 0, !13, i64 8, !18, i64 16, !18, i64 24, !13, i64 32, !18, i64 40}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !18, i64 16}
!20 = !{!21, !18, i64 0}
!21 = !{!"stat", !18, i64 0, !18, i64 8, !18, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !18, i64 40, !18, i64 48, !18, i64 56, !18, i64 64, !22, i64 72, !22, i64 88, !22, i64 104, !7, i64 120}
!22 = !{!"timespec", !18, i64 0, !18, i64 8}
!23 = !{!17, !18, i64 24}
!24 = !{!21, !18, i64 8}
!25 = !{!17, !18, i64 40}
!26 = !{!21, !18, i64 40}
!27 = !{!17, !13, i64 32}
!28 = !{!21, !13, i64 24}


; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@_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.9 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [89 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: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_rand_device_validate(ptr noundef readonly %0) local_unnamed_addr #3 {
  %2 = alloca %struct.stat, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %3, label %11

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

11:                                               ; preds = %1
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load i32, ptr %12, align 8, !tbaa !13
  %.not15 = icmp eq i32 %13, -1
  br i1 %.not15, label %14, label %22

14:                                               ; preds = %11
  %15 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.10, ptr %15, align 8, !tbaa !5
  %16 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.10, i64 21), i32 noundef 47) #7
  %.not16 = icmp eq ptr %16, null
  %17 = getelementptr inbounds i8, ptr %16, i64 1
  %18 = select i1 %.not16, ptr getelementptr inbounds (i8, ptr @.str.10, 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 402653194, ptr %20, align 4, !tbaa !11
  %21 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %57

22:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %2) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(144) %2, i8 0, i64 144, i1 false)
  %23 = call i32 @fstat(i32 noundef %13, ptr noundef nonnull %2) #8
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %.sink.split

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = load i64, ptr %26, align 8, !tbaa !16
  %28 = load i64, ptr %2, align 8, !tbaa !17
  %29 = icmp eq i64 %27, %28
  br i1 %29, label %30, label %.sink.split

30:                                               ; preds = %25
  %31 = getelementptr inbounds i8, ptr %0, i64 24
  %32 = load i64, ptr %31, align 8, !tbaa !20
  %33 = getelementptr inbounds i8, ptr %2, i64 8
  %34 = load i64, ptr %33, align 8, !tbaa !21
  %35 = icmp eq i64 %32, %34
  br i1 %35, label %36, label %.sink.split

36:                                               ; preds = %30
  %37 = getelementptr inbounds i8, ptr %0, i64 40
  %38 = load i64, ptr %37, align 8, !tbaa !22
  %39 = getelementptr inbounds i8, ptr %2, i64 40
  %40 = load i64, ptr %39, align 8, !tbaa !23
  %41 = icmp eq i64 %38, %40
  br i1 %41, label %42, label %.sink.split

42:                                               ; preds = %36
  %43 = getelementptr inbounds i8, ptr %0, i64 32
  %44 = load i32, ptr %43, align 8, !tbaa !24
  %45 = getelementptr inbounds i8, ptr %2, i64 24
  %46 = load i32, ptr %45, align 8, !tbaa !25
  %47 = xor i32 %46, %44
  %48 = icmp ult i32 %47, 512
  br i1 %48, label %56, label %.sink.split

.sink.split:                                      ; preds = %42, %36, %30, %25, %22
  %.str.15.sink = phi ptr [ @.str.11, %22 ], [ @.str.12, %25 ], [ @.str.13, %30 ], [ @.str.14, %36 ], [ @.str.15, %42 ]
  %.sink30 = phi ptr [ getelementptr inbounds (i8, ptr @.str.11, i64 21), %22 ], [ getelementptr inbounds (i8, ptr @.str.12, i64 21), %25 ], [ getelementptr inbounds (i8, ptr @.str.13, i64 21), %30 ], [ getelementptr inbounds (i8, ptr @.str.14, i64 21), %36 ], [ getelementptr inbounds (i8, ptr @.str.15, i64 21), %42 ]
  %.sink = phi i32 [ 402653198, %22 ], [ 402653194, %25 ], [ 402653194, %30 ], [ 402653194, %36 ], [ 402653194, %42 ]
  %49 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.15.sink, ptr %49, align 8, !tbaa !5
  %50 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink30, i32 noundef 47) #7
  %.not21 = icmp eq ptr %50, null
  %51 = getelementptr inbounds i8, ptr %50, i64 1
  %52 = select i1 %.not21, ptr %.sink30, ptr %51
  %53 = getelementptr inbounds i8, ptr %49, i64 8
  store ptr %52, ptr %53, align 8, !tbaa !10
  %54 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %54, align 4, !tbaa !11
  %55 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %56

56:                                               ; preds = %.sink.split, %42
  %.sroa.0.1 = phi i32 [ 0, %42 ], [ -1, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %2) #8
  br label %57

57:                                               ; preds = %56, %14, %3
  %.sroa.0.2 = phi i32 [ %.sroa.0.1, %56 ], [ -1, %14 ], [ -1, %3 ]
  ret i32 %.sroa.0.2
}

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fstat(i32 noundef, ptr nocapture noundef) local_unnamed_addr #6

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

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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nofree nounwind "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, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"s2n_rand_device", !7, i64 0, !12, i64 8, !15, i64 16, !15, i64 24, !12, i64 32, !15, i64 40}
!15 = !{!"long", !8, i64 0}
!16 = !{!14, !15, i64 16}
!17 = !{!18, !15, i64 0}
!18 = !{!"stat", !15, i64 0, !15, i64 8, !15, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !19, i64 72, !19, i64 88, !19, i64 104, !8, i64 120}
!19 = !{!"timespec", !15, i64 0, !15, i64 8}
!20 = !{!14, !15, i64 24}
!21 = !{!18, !15, i64 8}
!22 = !{!14, !15, i64 40}
!23 = !{!18, !15, i64 40}
!24 = !{!14, !12, i64 32}
!25 = !{!18, !12, i64 24}


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