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

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

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.42 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [91 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

declare i32 @s2n_stuffer_write_uint8(ptr noundef, i8 noundef zeroext) #2

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

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

11:                                               ; preds = %3
  %12 = load ptr, ptr %5, 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.42, 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) #5
  %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) #5
  %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 %4, align 4
  br label %260

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 = getelementptr inbounds %struct.s2n_ecc_evp_params, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = icmp ne ptr %50, null
  br i1 %51, label %83, label %52

52:                                               ; preds = %47
  br label %53

53:                                               ; preds = %52
  br label %54

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

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

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

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

81:                                               ; preds = %75
  store i32 -1, ptr %4, align 4
  br label %260

82:                                               ; No predecessors!
  br label %83

83:                                               ; preds = %82, %47
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.s2n_ecc_evp_params, ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !16
  %89 = icmp ne ptr %88, null
  br i1 %89, label %121, label %90

90:                                               ; preds = %85
  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.44, ptr %94, align 8, !tbaa !9
  %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 !9
  %98 = getelementptr inbounds i8, ptr %97, i64 21
  %99 = call ptr @strrchr(ptr noundef %98, i32 noundef 47) #5
  %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 !9
  %105 = getelementptr inbounds i8, ptr %104, i64 21
  %106 = call ptr @strrchr(ptr noundef %105, i32 noundef 47) #5
  %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 !9
  %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 !11
  %117 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %117, align 4, !tbaa !12
  %118 = call i32 @s2n_calculate_stacktrace()
  br label %119

119:                                              ; preds = %113
  store i32 -1, ptr %4, align 4
  br label %260

120:                                              ; No predecessors!
  br label %121

121:                                              ; preds = %120, %85
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = icmp ne ptr %124, null
  br i1 %125, label %157, label %126

126:                                              ; preds = %123
  br label %127

127:                                              ; preds = %126
  br label %128

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

137:                                              ; preds = %128
  %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) #5
  %143 = getelementptr inbounds i8, ptr %142, i64 1
  br label %149

144:                                              ; preds = %128
  %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
  br label %149

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

155:                                              ; preds = %149
  store i32 -1, ptr %4, align 4
  br label %260

156:                                              ; No predecessors!
  br label %157

157:                                              ; preds = %156, %123
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = icmp ne ptr %160, null
  br i1 %161, label %193, label %162

162:                                              ; preds = %159
  br label %163

163:                                              ; preds = %162
  br label %164

164:                                              ; preds = %163
  %165 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %166 = getelementptr inbounds %struct.s2n_debug_info, ptr %165, i32 0, i32 0
  store ptr @.str.46, ptr %166, align 8, !tbaa !9
  %167 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %168 = getelementptr inbounds %struct.s2n_debug_info, ptr %167, i32 0, i32 0
  %169 = load ptr, ptr %168, align 8, !tbaa !9
  %170 = getelementptr inbounds i8, ptr %169, i64 21
  %171 = call ptr @strrchr(ptr noundef %170, i32 noundef 47) #5
  %172 = icmp ne ptr %171, null
  br i1 %172, label %173, label %180

173:                                              ; preds = %164
  %174 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %175 = getelementptr inbounds %struct.s2n_debug_info, ptr %174, i32 0, i32 0
  %176 = load ptr, ptr %175, align 8, !tbaa !9
  %177 = getelementptr inbounds i8, ptr %176, i64 21
  %178 = call ptr @strrchr(ptr noundef %177, i32 noundef 47) #5
  %179 = getelementptr inbounds i8, ptr %178, i64 1
  br label %185

180:                                              ; preds = %164
  %181 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %182 = getelementptr inbounds %struct.s2n_debug_info, ptr %181, i32 0, i32 0
  %183 = load ptr, ptr %182, align 8, !tbaa !9
  %184 = getelementptr inbounds i8, ptr %183, i64 21
  br label %185

185:                                              ; preds = %180, %173
  %186 = phi ptr [ %179, %173 ], [ %184, %180 ]
  %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 1
  store ptr %186, ptr %188, align 8, !tbaa !11
  %189 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %189, align 4, !tbaa !12
  %190 = call i32 @s2n_calculate_stacktrace()
  br label %191

191:                                              ; preds = %185
  store i32 -1, ptr %4, align 4
  br label %260

192:                                              ; No predecessors!
  br label %193

193:                                              ; preds = %192, %159
  br label %194

194:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #6
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.s2n_ecc_evp_params, ptr %195, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !14
  %198 = getelementptr inbounds %struct.s2n_ecc_named_curve, ptr %197, i32 0, i32 3
  %199 = load i8, ptr %198, align 8, !tbaa !17
  store i8 %199, ptr %8, align 1, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.s2n_stuffer, ptr %200, i32 0, i32 2
  %202 = load i32, ptr %201, align 4, !tbaa !21
  store i32 %202, ptr %9, align 4, !tbaa !12
  br label %203

203:                                              ; preds = %194
  %204 = load ptr, ptr %6, align 8, !tbaa !5
  %205 = call i32 @s2n_stuffer_write_uint8(ptr noundef %204, i8 noundef zeroext 3)
  %206 = icmp sgt i32 %205, -1
  br i1 %206, label %208, label %207

207:                                              ; preds = %203
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %259

208:                                              ; preds = %203
  br label %209

209:                                              ; preds = %208
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  %212 = load ptr, ptr %6, align 8, !tbaa !5
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.s2n_ecc_evp_params, ptr %213, i32 0, i32 0
  %215 = load ptr, ptr %214, align 8, !tbaa !14
  %216 = getelementptr inbounds %struct.s2n_ecc_named_curve, ptr %215, i32 0, i32 0
  %217 = load i16, ptr %216, align 8, !tbaa !24
  %218 = call i32 @s2n_stuffer_write_uint16(ptr noundef %212, i16 noundef zeroext %217)
  %219 = icmp sgt i32 %218, -1
  br i1 %219, label %221, label %220

220:                                              ; preds = %211
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %259

221:                                              ; preds = %211
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223
  %225 = load ptr, ptr %6, align 8, !tbaa !5
  %226 = load i8, ptr %8, align 1, !tbaa !20
  %227 = call i32 @s2n_stuffer_write_uint8(ptr noundef %225, i8 noundef zeroext %226)
  %228 = icmp sgt i32 %227, -1
  br i1 %228, label %230, label %229

229:                                              ; preds = %224
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %259

230:                                              ; preds = %224
  br label %231

231:                                              ; preds = %230
  br label %232

232:                                              ; preds = %231
  br label %233

233:                                              ; preds = %232
  %234 = load ptr, ptr %5, align 8, !tbaa !5
  %235 = load ptr, ptr %6, align 8, !tbaa !5
  %236 = call i32 @s2n_ecc_evp_write_params_point(ptr noundef %234, ptr noundef %235)
  %237 = icmp sgt i32 %236, -1
  br i1 %237, label %239, label %238

238:                                              ; preds = %233
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %259

239:                                              ; preds = %233
  br label %240

240:                                              ; preds = %239
  br label %241

241:                                              ; preds = %240
  %242 = load i8, ptr %8, align 1, !tbaa !20
  %243 = zext i8 %242 to i32
  %244 = add nsw i32 %243, 4
  %245 = load ptr, ptr %7, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.s2n_blob, ptr %245, i32 0, i32 1
  store i32 %244, ptr %246, align 8, !tbaa !25
  %247 = load ptr, ptr %6, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.s2n_stuffer, ptr %247, i32 0, i32 0
  %249 = getelementptr inbounds %struct.s2n_blob, ptr %248, i32 0, i32 0
  %250 = load ptr, ptr %249, align 8, !tbaa !26
  %251 = load i32, ptr %9, align 4, !tbaa !12
  %252 = zext i32 %251 to i64
  %253 = getelementptr inbounds i8, ptr %250, i64 %252
  %254 = load ptr, ptr %7, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.s2n_blob, ptr %254, i32 0, i32 0
  store ptr %253, ptr %255, align 8, !tbaa !27
  %256 = load ptr, ptr %7, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.s2n_blob, ptr %256, i32 0, i32 1
  %258 = load i32, ptr %257, align 8, !tbaa !25
  store i32 %258, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %259

259:                                              ; preds = %241, %238, %229, %220, %207
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #6
  br label %260

260:                                              ; preds = %259, %191, %155, %119, %81, %43
  %261 = load i32, ptr %4, align 4
  ret i32 %261
}

declare i32 @s2n_stuffer_write_uint16(ptr noundef, i16 noundef zeroext) #2

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

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

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

@_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.42 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [91 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

declare i32 @s2n_stuffer_write_uint8(ptr noundef, i8 noundef zeroext) local_unnamed_addr #2

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

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

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

12:                                               ; preds = %3
  %13 = load ptr, ptr %0, align 8, !tbaa !13
  %.not30 = icmp eq ptr %13, null
  br i1 %.not30, label %14, label %22

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

22:                                               ; preds = %12
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %.not32 = icmp eq ptr %24, null
  br i1 %.not32, label %25, label %33

25:                                               ; preds = %22
  %26 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.44, ptr %26, align 8, !tbaa !5
  %27 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.44, i64 21), i32 noundef 47) #4
  %.not33 = icmp eq ptr %27, null
  %28 = getelementptr inbounds i8, ptr %27, i64 1
  %29 = select i1 %.not33, ptr getelementptr inbounds (i8, ptr @.str.44, 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 402653193, ptr %31, align 4, !tbaa !11
  %32 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %76

33:                                               ; preds = %22
  %.not34 = icmp eq ptr %1, null
  br i1 %.not34, label %34, label %42

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

42:                                               ; preds = %33
  %.not36 = icmp eq ptr %2, null
  br i1 %.not36, label %43, label %51

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

51:                                               ; preds = %42
  %52 = getelementptr inbounds i8, ptr %13, i64 16
  %53 = load i8, ptr %52, align 8, !tbaa !16
  %54 = getelementptr inbounds i8, ptr %1, i64 28
  %55 = load i32, ptr %54, align 4, !tbaa !19
  %56 = tail call i32 @s2n_stuffer_write_uint8(ptr noundef nonnull %1, i8 noundef zeroext 3) #5
  %57 = icmp sgt i32 %56, -1
  br i1 %57, label %58, label %76

58:                                               ; preds = %51
  %59 = load ptr, ptr %0, align 8, !tbaa !13
  %60 = load i16, ptr %59, align 8, !tbaa !22
  %61 = tail call i32 @s2n_stuffer_write_uint16(ptr noundef nonnull %1, i16 noundef zeroext %60) #5
  %62 = icmp sgt i32 %61, -1
  br i1 %62, label %63, label %76

63:                                               ; preds = %58
  %64 = tail call i32 @s2n_stuffer_write_uint8(ptr noundef nonnull %1, i8 noundef zeroext %53) #5
  %65 = icmp sgt i32 %64, -1
  br i1 %65, label %66, label %76

66:                                               ; preds = %63
  %67 = tail call i32 @s2n_ecc_evp_write_params_point(ptr noundef nonnull %0, ptr noundef nonnull %1)
  %68 = icmp sgt i32 %67, -1
  br i1 %68, label %69, label %76

69:                                               ; preds = %66
  %70 = zext i8 %53 to i32
  %71 = add nuw nsw i32 %70, 4
  %72 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 %71, ptr %72, align 8, !tbaa !23
  %73 = load ptr, ptr %1, align 8, !tbaa !24
  %74 = zext i32 %55 to i64
  %75 = getelementptr inbounds i8, ptr %73, i64 %74
  store ptr %75, ptr %2, align 8, !tbaa !25
  br label %76

76:                                               ; preds = %69, %51, %58, %63, %66, %43, %34, %25, %14, %4
  %.1 = phi i32 [ -1, %43 ], [ -1, %34 ], [ -1, %25 ], [ -1, %14 ], [ -1, %4 ], [ %71, %69 ], [ -1, %51 ], [ -1, %58 ], [ -1, %63 ], [ -1, %66 ]
  ret i32 %.1
}

declare i32 @s2n_stuffer_write_uint16(ptr noundef, i16 noundef zeroext) 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 = { 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 = { nounwind willreturn memory(read) }
attributes #5 = { 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_ecc_evp_params", !7, i64 0, !7, i64 8}
!15 = !{!14, !7, i64 8}
!16 = !{!17, !8, i64 16}
!17 = !{!"s2n_ecc_named_curve", !18, i64 0, !12, i64 4, !7, i64 8, !8, i64 16, !7, i64 24}
!18 = !{!"short", !8, i64 0}
!19 = !{!20, !12, i64 28}
!20 = !{!"s2n_stuffer", !21, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!21 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!22 = !{!17, !18, i64 0}
!23 = !{!21, !12, i64 8}
!24 = !{!20, !7, i64 0}
!25 = !{!21, !7, i64 0}


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