; LLVM IR from aws/s2n-tls :: crypto (s2n_pkey_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_result = type { i32 }
%struct.s2n_pkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.s2n_hash_state = type { ptr, i32, i8, i64, %union.anon }
%union.anon = type { %struct.s2n_hash_evp_digest }
%struct.s2n_hash_evp_digest = type { %struct.s2n_evp_digest, %struct.s2n_evp_digest }
%struct.s2n_evp_digest = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [92 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 [92 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [92 x i8], align 1

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

13:                                               ; preds = %4
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %47, label %16

16:                                               ; preds = %13
  br label %17

17:                                               ; preds = %16
  br label %18

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

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

34:                                               ; preds = %18
  %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 0
  %37 = load ptr, ptr %36, align 8, !tbaa !11
  %38 = getelementptr inbounds i8, ptr %37, i64 21
  br label %39

39:                                               ; preds = %34, %27
  %40 = phi ptr [ %33, %27 ], [ %38, %34 ]
  %41 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %42 = getelementptr inbounds %struct.s2n_debug_info, ptr %41, i32 0, i32 1
  store ptr %40, ptr %42, align 8, !tbaa !13
  %43 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %43, align 4, !tbaa !9
  %44 = call i32 @s2n_calculate_stacktrace()
  br label %45

45:                                               ; preds = %39
  store i32 -1, ptr %5, align 4
  br label %301

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46, %13
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %83, label %52

52:                                               ; preds = %49
  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.1, ptr %56, align 8, !tbaa !11
  %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 !11
  %60 = getelementptr inbounds i8, ptr %59, i64 21
  %61 = call ptr @strrchr(ptr noundef %60, i32 noundef 47) #6
  %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 !11
  %67 = getelementptr inbounds i8, ptr %66, i64 21
  %68 = call ptr @strrchr(ptr noundef %67, i32 noundef 47) #6
  %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 !11
  %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 !13
  %79 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %79, align 4, !tbaa !9
  %80 = call i32 @s2n_calculate_stacktrace()
  br label %81

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

82:                                               ; No predecessors!
  br label %83

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

84:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.s2n_pkey, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !14
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.s2n_hash_state, ptr %88, i32 0, i32 1
  %90 = load i32, ptr %89, align 8, !tbaa !16
  %91 = call ptr @s2n_evp_pkey_ctx_new(ptr noundef %87, i32 noundef %90)
  store ptr %91, ptr %10, align 8, !tbaa !5
  br label %92

92:                                               ; preds = %84
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %128, label %95

95:                                               ; preds = %92
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  %98 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %99 = getelementptr inbounds %struct.s2n_debug_info, ptr %98, i32 0, i32 0
  store ptr @.str.2, ptr %99, align 8, !tbaa !11
  %100 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %101 = getelementptr inbounds %struct.s2n_debug_info, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !11
  %103 = getelementptr inbounds i8, ptr %102, i64 21
  %104 = call ptr @strrchr(ptr noundef %103, i32 noundef 47) #6
  %105 = icmp ne ptr %104, null
  br i1 %105, label %106, label %113

106:                                              ; preds = %97
  %107 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %108 = getelementptr inbounds %struct.s2n_debug_info, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !11
  %110 = getelementptr inbounds i8, ptr %109, i64 21
  %111 = call ptr @strrchr(ptr noundef %110, i32 noundef 47) #6
  %112 = getelementptr inbounds i8, ptr %111, i64 1
  br label %118

113:                                              ; preds = %97
  %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 0
  %116 = load ptr, ptr %115, align 8, !tbaa !11
  %117 = getelementptr inbounds i8, ptr %116, i64 21
  br label %118

118:                                              ; preds = %113, %106
  %119 = phi ptr [ %112, %106 ], [ %117, %113 ]
  %120 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %121 = getelementptr inbounds %struct.s2n_debug_info, ptr %120, i32 0, i32 1
  store ptr %119, ptr %121, align 8, !tbaa !13
  %122 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %122, align 4, !tbaa !9
  %123 = call i32 @s2n_calculate_stacktrace()
  br label %124

124:                                              ; preds = %118
  br label %125

125:                                              ; preds = %124
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

126:                                              ; No predecessors!
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127, %92
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  %133 = call i32 @EVP_PKEY_sign_init(ptr noundef %132)
  %134 = icmp eq i32 %133, 1
  br i1 %134, label %168, label %135

135:                                              ; preds = %131
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  %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
  store ptr @.str.3, ptr %139, align 8, !tbaa !11
  %140 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %141 = getelementptr inbounds %struct.s2n_debug_info, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !11
  %143 = getelementptr inbounds i8, ptr %142, i64 21
  %144 = call ptr @strrchr(ptr noundef %143, i32 noundef 47) #6
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %153

146:                                              ; preds = %137
  %147 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %148 = getelementptr inbounds %struct.s2n_debug_info, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !11
  %150 = getelementptr inbounds i8, ptr %149, i64 21
  %151 = call ptr @strrchr(ptr noundef %150, i32 noundef 47) #6
  %152 = getelementptr inbounds i8, ptr %151, i64 1
  br label %158

153:                                              ; preds = %137
  %154 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %155 = getelementptr inbounds %struct.s2n_debug_info, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !11
  %157 = getelementptr inbounds i8, ptr %156, i64 21
  br label %158

158:                                              ; preds = %153, %146
  %159 = phi ptr [ %152, %146 ], [ %157, %153 ]
  %160 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %161 = getelementptr inbounds %struct.s2n_debug_info, ptr %160, i32 0, i32 1
  store ptr %159, ptr %161, align 8, !tbaa !13
  %162 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653263, ptr %162, align 4, !tbaa !9
  %163 = call i32 @s2n_calculate_stacktrace()
  br label %164

164:                                              ; preds = %158
  br label %165

165:                                              ; preds = %164
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

166:                                              ; No predecessors!
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167, %131
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  %173 = load ptr, ptr %8, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.s2n_hash_state, ptr %173, i32 0, i32 1
  %175 = load i32, ptr %174, align 8, !tbaa !16
  %176 = call ptr @s2n_hash_alg_to_evp_md(i32 noundef %175)
  %177 = ptrtoint ptr %176 to i64
  %178 = inttoptr i64 %177 to ptr
  %179 = call i32 @EVP_PKEY_CTX_set_signature_md(ptr noundef %172, ptr noundef %178)
  %180 = icmp eq i32 %179, 1
  br i1 %180, label %214, label %181

181:                                              ; preds = %171
  br label %182

182:                                              ; preds = %181
  br label %183

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

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

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

204:                                              ; preds = %199, %192
  %205 = phi ptr [ %198, %192 ], [ %203, %199 ]
  %206 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %207 = getelementptr inbounds %struct.s2n_debug_info, ptr %206, i32 0, i32 1
  store ptr %205, ptr %207, align 8, !tbaa !13
  %208 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653263, ptr %208, align 4, !tbaa !9
  %209 = call i32 @s2n_calculate_stacktrace()
  br label %210

210:                                              ; preds = %204
  br label %211

211:                                              ; preds = %210
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

212:                                              ; No predecessors!
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213, %171
  br label %215

215:                                              ; preds = %214
  br label %216

216:                                              ; preds = %215
  %217 = load i32, ptr %7, align 4, !tbaa !9
  %218 = icmp eq i32 %217, 224
  br i1 %218, label %222, label %219

219:                                              ; preds = %216
  %220 = load i32, ptr %7, align 4, !tbaa !9
  %221 = icmp eq i32 %220, 225
  br i1 %221, label %222, label %274

222:                                              ; preds = %219, %216
  br label %223

223:                                              ; preds = %222
  %224 = load ptr, ptr %10, align 8, !tbaa !5
  %225 = call i32 @EVP_PKEY_CTX_set_rsa_padding(ptr noundef %224, i32 noundef 6)
  %226 = icmp eq i32 %225, 1
  br i1 %226, label %260, label %227

227:                                              ; preds = %223
  br label %228

228:                                              ; preds = %227
  br label %229

229:                                              ; preds = %228
  %230 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %231 = getelementptr inbounds %struct.s2n_debug_info, ptr %230, i32 0, i32 0
  store ptr @.str.5, ptr %231, align 8, !tbaa !11
  %232 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %233 = getelementptr inbounds %struct.s2n_debug_info, ptr %232, i32 0, i32 0
  %234 = load ptr, ptr %233, align 8, !tbaa !11
  %235 = getelementptr inbounds i8, ptr %234, i64 21
  %236 = call ptr @strrchr(ptr noundef %235, i32 noundef 47) #6
  %237 = icmp ne ptr %236, null
  br i1 %237, label %238, label %245

238:                                              ; preds = %229
  %239 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %240 = getelementptr inbounds %struct.s2n_debug_info, ptr %239, i32 0, i32 0
  %241 = load ptr, ptr %240, align 8, !tbaa !11
  %242 = getelementptr inbounds i8, ptr %241, i64 21
  %243 = call ptr @strrchr(ptr noundef %242, i32 noundef 47) #6
  %244 = getelementptr inbounds i8, ptr %243, i64 1
  br label %250

245:                                              ; preds = %229
  %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 0
  %248 = load ptr, ptr %247, align 8, !tbaa !11
  %249 = getelementptr inbounds i8, ptr %248, i64 21
  br label %250

250:                                              ; preds = %245, %238
  %251 = phi ptr [ %244, %238 ], [ %249, %245 ]
  %252 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %253 = getelementptr inbounds %struct.s2n_debug_info, ptr %252, i32 0, i32 1
  store ptr %251, ptr %253, align 8, !tbaa !13
  %254 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653263, ptr %254, align 4, !tbaa !9
  %255 = call i32 @s2n_calculate_stacktrace()
  br label %256

256:                                              ; preds = %250
  br label %257

257:                                              ; preds = %256
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

258:                                              ; No predecessors!
  br label %259

259:                                              ; preds = %258
  br label %260

260:                                              ; preds = %259, %223
  br label %261

261:                                              ; preds = %260
  br label %262

262:                                              ; preds = %261
  br label %263

263:                                              ; preds = %262
  %264 = load ptr, ptr %10, align 8, !tbaa !5
  %265 = call i32 @s2n_evp_pkey_set_rsa_pss_saltlen(ptr noundef %264)
  %266 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  store i32 %265, ptr %266, align 4
  %267 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  %268 = load i32, ptr %267, align 4
  %269 = call zeroext i1 @s2n_result_is_ok(i32 %268)
  br i1 %269, label %271, label %270

270:                                              ; preds = %263
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

271:                                              ; preds = %263
  br label %272

272:                                              ; preds = %271
  br label %273

273:                                              ; preds = %272
  br label %274

274:                                              ; preds = %273, %219
  %275 = call zeroext i1 @s2n_libcrypto_is_awslc_fips()
  br i1 %275, label %276, label %288

276:                                              ; preds = %274
  br label %277

277:                                              ; preds = %276
  %278 = load ptr, ptr %10, align 8, !tbaa !5
  %279 = load i32, ptr %7, align 4, !tbaa !9
  %280 = load ptr, ptr %8, align 8, !tbaa !5
  %281 = load ptr, ptr %9, align 8, !tbaa !5
  %282 = call i32 @s2n_pkey_evp_digest_and_sign(ptr noundef %278, i32 noundef %279, ptr noundef %280, ptr noundef %281)
  %283 = icmp sgt i32 %282, -1
  br i1 %283, label %285, label %284

284:                                              ; preds = %277
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

285:                                              ; preds = %277
  br label %286

286:                                              ; preds = %285
  br label %287

287:                                              ; preds = %286
  br label %299

288:                                              ; preds = %274
  br label %289

289:                                              ; preds = %288
  %290 = load ptr, ptr %10, align 8, !tbaa !5
  %291 = load ptr, ptr %8, align 8, !tbaa !5
  %292 = load ptr, ptr %9, align 8, !tbaa !5
  %293 = call i32 @s2n_pkey_evp_digest_then_sign(ptr noundef %290, ptr noundef %291, ptr noundef %292)
  %294 = icmp sgt i32 %293, -1
  br i1 %294, label %296, label %295

295:                                              ; preds = %289
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

296:                                              ; preds = %289
  br label %297

297:                                              ; preds = %296
  br label %298

298:                                              ; preds = %297
  br label %299

299:                                              ; preds = %298, %287
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %300

300:                                              ; preds = %299, %295, %284, %270, %257, %211, %165, %125
  call void @EVP_PKEY_CTX_free_pointer(ptr noundef %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %301

301:                                              ; preds = %300, %81, %45
  %302 = load i32, ptr %5, align 4
  ret i32 %302
}

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

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

declare i32 @s2n_calculate_stacktrace() #3

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

; Function Attrs: nounwind uwtable
declare hidden ptr @s2n_evp_pkey_ctx_new(ptr noundef, i32 noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @EVP_PKEY_CTX_free_pointer(ptr noundef) #5

declare i32 @EVP_PKEY_sign_init(ptr noundef) #3

declare i32 @EVP_PKEY_CTX_set_signature_md(ptr noundef, ptr noundef) #3

declare ptr @s2n_hash_alg_to_evp_md(i32 noundef) #3

declare i32 @EVP_PKEY_CTX_set_rsa_padding(ptr noundef, i32 noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_evp_pkey_set_rsa_pss_saltlen(ptr noundef) #0

declare zeroext i1 @s2n_libcrypto_is_awslc_fips() #3

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_pkey_evp_digest_and_sign(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_pkey_evp_digest_then_sign(ptr noundef, ptr noundef, ptr noundef) #0

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !6, i64 0}
!15 = !{!"s2n_pkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!16 = !{!17, !10, i64 8}
!17 = !{!"s2n_hash_state", !6, i64 0, !10, i64 8, !7, i64 12, !18, i64 16, !7, i64 24}
!18 = !{!"long", !7, 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 [92 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 [92 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [92 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_pkey_evp_sign(ptr noundef readonly %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca ptr, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %14

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

14:                                               ; preds = %4
  %.not23 = icmp eq ptr %2, null
  br i1 %.not23, label %15, label %23

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

23:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %24 = load ptr, ptr %0, align 8, !tbaa !13
  %25 = getelementptr inbounds i8, ptr %2, i64 8
  %26 = load i32, ptr %25, align 8, !tbaa !15
  %27 = tail call ptr @s2n_evp_pkey_ctx_new(ptr noundef %24, i32 noundef %26)
  store ptr %27, ptr %5, align 8, !tbaa !18
  %.not25 = icmp eq ptr %27, null
  br i1 %.not25, label %28, label %36

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

36:                                               ; preds = %23
  %37 = tail call i32 @EVP_PKEY_sign_init(ptr noundef nonnull %27) #7
  %38 = icmp eq i32 %37, 1
  br i1 %38, label %47, label %39

39:                                               ; preds = %36
  %40 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.3, ptr %40, align 8, !tbaa !5
  %41 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.3, i64 21), i32 noundef 47) #6
  %.not27 = icmp eq ptr %41, null
  %42 = getelementptr inbounds i8, ptr %41, i64 1
  %43 = select i1 %.not27, ptr getelementptr inbounds (i8, ptr @.str.3, i64 21), ptr %42
  %44 = getelementptr inbounds i8, ptr %40, i64 8
  store ptr %43, ptr %44, align 8, !tbaa !10
  %45 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653263, ptr %45, align 4, !tbaa !11
  %46 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %85

47:                                               ; preds = %36
  %48 = load i32, ptr %25, align 8, !tbaa !15
  %49 = tail call ptr @s2n_hash_alg_to_evp_md(i32 noundef %48) #7
  %50 = tail call i32 @EVP_PKEY_CTX_set_signature_md(ptr noundef nonnull %27, ptr noundef %49) #7
  %51 = icmp eq i32 %50, 1
  br i1 %51, label %60, label %52

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

60:                                               ; preds = %47
  %61 = and i32 %1, -2
  %or.cond = icmp eq i32 %61, 224
  br i1 %or.cond, label %62, label %76

62:                                               ; preds = %60
  %63 = tail call i32 @EVP_PKEY_CTX_set_rsa_padding(ptr noundef nonnull %27, i32 noundef 6) #7
  %64 = icmp eq i32 %63, 1
  br i1 %64, label %73, label %65

65:                                               ; preds = %62
  %66 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.5, ptr %66, align 8, !tbaa !5
  %67 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.5, i64 21), i32 noundef 47) #6
  %.not29 = icmp eq ptr %67, null
  %68 = getelementptr inbounds i8, ptr %67, i64 1
  %69 = select i1 %.not29, ptr getelementptr inbounds (i8, ptr @.str.5, i64 21), ptr %68
  %70 = getelementptr inbounds i8, ptr %66, i64 8
  store ptr %69, ptr %70, align 8, !tbaa !10
  %71 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653263, ptr %71, align 4, !tbaa !11
  %72 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %85

73:                                               ; preds = %62
  %74 = tail call i32 @s2n_evp_pkey_set_rsa_pss_saltlen(ptr noundef nonnull %27)
  %75 = tail call zeroext i1 @s2n_result_is_ok(i32 %74)
  br i1 %75, label %76, label %85

76:                                               ; preds = %73, %60
  %77 = tail call zeroext i1 @s2n_libcrypto_is_awslc_fips() #7
  br i1 %77, label %78, label %81

78:                                               ; preds = %76
  %79 = tail call i32 @s2n_pkey_evp_digest_and_sign(ptr noundef nonnull %27, i32 noundef %1, ptr noundef nonnull %2, ptr noundef %3)
  %80 = icmp sgt i32 %79, -1
  br i1 %80, label %84, label %85

81:                                               ; preds = %76
  %82 = tail call i32 @s2n_pkey_evp_digest_then_sign(ptr noundef nonnull %27, ptr noundef nonnull %2, ptr noundef %3)
  %83 = icmp sgt i32 %82, -1
  br i1 %83, label %84, label %85

84:                                               ; preds = %81, %78
  br label %85

85:                                               ; preds = %81, %78, %73, %84, %65, %52, %39, %28
  %.0 = phi i32 [ 0, %84 ], [ -1, %65 ], [ -1, %52 ], [ -1, %39 ], [ -1, %28 ], [ -1, %73 ], [ -1, %78 ], [ -1, %81 ]
  call void @EVP_PKEY_CTX_free_pointer(ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %86

86:                                               ; preds = %85, %15, %6
  %.1 = phi i32 [ %.0, %85 ], [ -1, %15 ], [ -1, %6 ]
  ret i32 %.1
}

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden ptr @s2n_evp_pkey_ctx_new(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @EVP_PKEY_CTX_free_pointer(ptr noundef) local_unnamed_addr #5

declare i32 @EVP_PKEY_sign_init(ptr noundef) local_unnamed_addr #3

declare i32 @EVP_PKEY_CTX_set_signature_md(ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @s2n_hash_alg_to_evp_md(i32 noundef) local_unnamed_addr #3

declare i32 @EVP_PKEY_CTX_set_rsa_padding(ptr noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_evp_pkey_set_rsa_pss_saltlen(ptr noundef) local_unnamed_addr #0

declare zeroext i1 @s2n_libcrypto_is_awslc_fips() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_pkey_evp_digest_and_sign(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_pkey_evp_digest_then_sign(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"s2n_pkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!15 = !{!16, !12, i64 8}
!16 = !{!"s2n_hash_state", !7, i64 0, !12, i64 8, !8, i64 12, !17, i64 16, !8, i64 24}
!17 = !{!"long", !8, i64 0}
!18 = !{!7, !7, i64 0}


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