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

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

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

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

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

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

14:                                               ; preds = %11
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %17 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %18 = getelementptr inbounds %struct.s2n_debug_info, ptr %17, i32 0, i32 0
  store ptr @.str, 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) #8
  %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) #8
  %31 = getelementptr inbounds i8, ptr %30, i64 1
  br label %37

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

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

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

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 = call i32 @s2n_blob_validate(ptr noundef %48)
  %50 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 %49, ptr %50, align 4
  %51 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  %52 = load i32, ptr %51, align 4
  %53 = call zeroext i1 @s2n_result_is_ok(i32 %52)
  %54 = xor i1 %53, true
  %55 = xor i1 %54, true
  %56 = zext i1 %55 to i32
  %57 = sext i32 %56 to i64
  %58 = call i64 @llvm.expect.i64(i64 %57, i64 1)
  %59 = icmp ne i64 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %47
  %61 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 0, ptr %61, align 4, !tbaa !14
  br label %64

62:                                               ; preds = %47
  %63 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %63, align 4, !tbaa !14
  br label %64

64:                                               ; preds = %62, %60
  %65 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  %66 = load i32, ptr %65, align 4
  %67 = call zeroext i1 @s2n_result_is_ok(i32 %66)
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 -1, ptr %3, align 4
  br label %243

69:                                               ; preds = %64
  br label %70

70:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.s2n_blob, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !16
  store ptr %73, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.s2n_blob, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.s2n_blob, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 8, !tbaa !18
  %79 = zext i32 %78 to i64
  %80 = call ptr @d2i_DHparams(ptr noundef null, ptr noundef %75, i64 noundef %79)
  %81 = getelementptr inbounds %struct.s2n_dh_params, ptr %8, i32 0, i32 0
  store ptr %80, ptr %81, align 8, !tbaa !19
  br label %82

82:                                               ; preds = %70
  %83 = call i32 @s2n_check_p_g_dh_params(ptr noundef %8)
  %84 = icmp sgt i32 %83, -1
  br i1 %84, label %86, label %85

85:                                               ; preds = %82
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %241

86:                                               ; preds = %82
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.s2n_blob, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !16
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %185

93:                                               ; preds = %88
  br label %94

94:                                               ; preds = %93
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.s2n_blob, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !16
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = icmp uge ptr %97, %98
  br i1 %99, label %133, label %100

100:                                              ; preds = %94
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  %103 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %104 = getelementptr inbounds %struct.s2n_debug_info, ptr %103, i32 0, i32 0
  store ptr @.str.1, ptr %104, align 8, !tbaa !9
  %105 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %106 = getelementptr inbounds %struct.s2n_debug_info, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !9
  %108 = getelementptr inbounds i8, ptr %107, i64 21
  %109 = call ptr @strrchr(ptr noundef %108, i32 noundef 47) #8
  %110 = icmp ne ptr %109, null
  br i1 %110, label %111, label %118

111:                                              ; preds = %102
  %112 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %113 = getelementptr inbounds %struct.s2n_debug_info, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8, !tbaa !9
  %115 = getelementptr inbounds i8, ptr %114, i64 21
  %116 = call ptr @strrchr(ptr noundef %115, i32 noundef 47) #8
  %117 = getelementptr inbounds i8, ptr %116, i64 1
  br label %123

118:                                              ; preds = %102
  %119 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %120 = getelementptr inbounds %struct.s2n_debug_info, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !9
  %122 = getelementptr inbounds i8, ptr %121, i64 21
  br label %123

123:                                              ; preds = %118, %111
  %124 = phi ptr [ %117, %111 ], [ %122, %118 ]
  %125 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %126 = getelementptr inbounds %struct.s2n_debug_info, ptr %125, i32 0, i32 1
  store ptr %124, ptr %126, align 8, !tbaa !11
  %127 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %127, align 4, !tbaa !12
  %128 = call i32 @s2n_calculate_stacktrace()
  br label %129

129:                                              ; preds = %123
  br label %130

130:                                              ; preds = %129
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %241

131:                                              ; No predecessors!
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132, %94
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.s2n_blob, ptr %137, i32 0, i32 0
  %139 = load ptr, ptr %138, align 8, !tbaa !16
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = ptrtoint ptr %139 to i64
  %142 = ptrtoint ptr %140 to i64
  %143 = sub i64 %141, %142
  %144 = trunc i64 %143 to i32
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.s2n_blob, ptr %145, i32 0, i32 1
  %147 = load i32, ptr %146, align 8, !tbaa !18
  %148 = icmp eq i32 %144, %147
  br i1 %148, label %182, label %149

149:                                              ; preds = %136
  br label %150

150:                                              ; preds = %149
  br label %151

151:                                              ; preds = %150
  %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
  store ptr @.str.2, ptr %153, align 8, !tbaa !9
  %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 !9
  %157 = getelementptr inbounds i8, ptr %156, i64 21
  %158 = call ptr @strrchr(ptr noundef %157, i32 noundef 47) #8
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %167

160:                                              ; preds = %151
  %161 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %162 = getelementptr inbounds %struct.s2n_debug_info, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !9
  %164 = getelementptr inbounds i8, ptr %163, i64 21
  %165 = call ptr @strrchr(ptr noundef %164, i32 noundef 47) #8
  %166 = getelementptr inbounds i8, ptr %165, i64 1
  br label %172

167:                                              ; preds = %151
  %168 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %169 = getelementptr inbounds %struct.s2n_debug_info, ptr %168, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !9
  %171 = getelementptr inbounds i8, ptr %170, i64 21
  br label %172

172:                                              ; preds = %167, %160
  %173 = phi ptr [ %166, %160 ], [ %171, %167 ]
  %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 1
  store ptr %173, ptr %175, align 8, !tbaa !11
  %176 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762061, ptr %176, align 4, !tbaa !12
  %177 = call i32 @s2n_calculate_stacktrace()
  br label %178

178:                                              ; preds = %172
  br label %179

179:                                              ; preds = %178
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %241

180:                                              ; No predecessors!
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181, %136
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184, %88
  %186 = load ptr, ptr %9, align 8, !tbaa !5
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.s2n_blob, ptr %187, i32 0, i32 0
  store ptr %186, ptr %188, align 8, !tbaa !16
  br label %189

189:                                              ; preds = %185
  %190 = getelementptr inbounds %struct.s2n_dh_params, ptr %8, i32 0, i32 0
  %191 = load ptr, ptr %190, align 8, !tbaa !19
  %192 = call i32 @DH_size(ptr noundef %191)
  %193 = icmp sge i32 %192, 256
  br i1 %193, label %227, label %194

194:                                              ; preds = %189
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  %197 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %198 = getelementptr inbounds %struct.s2n_debug_info, ptr %197, i32 0, i32 0
  store ptr @.str.3, ptr %198, align 8, !tbaa !9
  %199 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %200 = getelementptr inbounds %struct.s2n_debug_info, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !9
  %202 = getelementptr inbounds i8, ptr %201, i64 21
  %203 = call ptr @strrchr(ptr noundef %202, i32 noundef 47) #8
  %204 = icmp ne ptr %203, null
  br i1 %204, label %205, label %212

205:                                              ; preds = %196
  %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 0
  %208 = load ptr, ptr %207, align 8, !tbaa !9
  %209 = getelementptr inbounds i8, ptr %208, i64 21
  %210 = call ptr @strrchr(ptr noundef %209, i32 noundef 47) #8
  %211 = getelementptr inbounds i8, ptr %210, i64 1
  br label %217

212:                                              ; preds = %196
  %213 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %214 = getelementptr inbounds %struct.s2n_debug_info, ptr %213, i32 0, i32 0
  %215 = load ptr, ptr %214, align 8, !tbaa !9
  %216 = getelementptr inbounds i8, ptr %215, i64 21
  br label %217

217:                                              ; preds = %212, %205
  %218 = phi ptr [ %211, %205 ], [ %216, %212 ]
  %219 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %220 = getelementptr inbounds %struct.s2n_debug_info, ptr %219, i32 0, i32 1
  store ptr %218, ptr %220, align 8, !tbaa !11
  %221 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762059, ptr %221, align 4, !tbaa !12
  %222 = call i32 @s2n_calculate_stacktrace()
  br label %223

223:                                              ; preds = %217
  br label %224

224:                                              ; preds = %223
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %241

225:                                              ; No predecessors!
  br label %226

226:                                              ; preds = %225
  br label %227

227:                                              ; preds = %226, %189
  br label %228

228:                                              ; preds = %227
  br label %229

229:                                              ; preds = %228
  br label %230

230:                                              ; preds = %229
  %231 = call i32 @s2n_dh_params_check(ptr noundef %8)
  %232 = icmp sgt i32 %231, -1
  br i1 %232, label %234, label %233

233:                                              ; preds = %230
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %241

234:                                              ; preds = %230
  br label %235

235:                                              ; preds = %234
  br label %236

236:                                              ; preds = %235
  %237 = getelementptr inbounds %struct.s2n_dh_params, ptr %8, i32 0, i32 0
  %238 = load ptr, ptr %237, align 8, !tbaa !19
  %239 = load ptr, ptr %4, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.s2n_dh_params, ptr %239, i32 0, i32 0
  store ptr %238, ptr %240, align 8, !tbaa !19
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 8, i1 false)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %241

241:                                              ; preds = %236, %233, %224, %179, %130, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  %242 = call i32 @s2n_dh_params_free(ptr noundef %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  br label %243

243:                                              ; preds = %241, %68, %43
  %244 = load i32, ptr %3, align 4
  ret i32 %244
}

; 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #4

declare i32 @s2n_blob_validate(ptr noundef) #3

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_dh_params_free(ptr noundef) #0

declare ptr @d2i_DHparams(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @DH_size(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_dh_params_check(ptr noundef) #0

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

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 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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, !6, i64 0}
!17 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!18 = !{!17, !13, i64 8}
!19 = !{!20, !6, i64 0}
!20 = !{!"s2n_dh_params", !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 }
%struct.s2n_dh_params = type { ptr }

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_pkcs3_to_dh_params(ptr noundef writeonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.s2n_dh_params, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %12

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

12:                                               ; preds = %2
  %13 = tail call i32 @s2n_blob_validate(ptr noundef %1) #7
  %14 = tail call zeroext i1 @s2n_result_is_ok(i32 %13)
  %not. = xor i1 %14, true
  %. = sext i1 %not. to i32
  %15 = tail call zeroext i1 @s2n_result_is_ok(i32 %.)
  br i1 %15, label %16, label %69

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %17 = load ptr, ptr %1, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %1, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !15
  %20 = zext i32 %19 to i64
  %21 = tail call ptr @d2i_DHparams(ptr noundef null, ptr noundef nonnull %1, i64 noundef %20) #7
  store ptr %21, ptr %3, align 8, !tbaa !16
  %22 = call i32 @s2n_check_p_g_dh_params(ptr noundef nonnull %3)
  %23 = icmp sgt i32 %22, -1
  br i1 %23, label %24, label %67

24:                                               ; preds = %16
  %25 = load ptr, ptr %1, align 8, !tbaa !13
  %.not23 = icmp eq ptr %25, null
  br i1 %.not23, label %50, label %26

26:                                               ; preds = %24
  %.not24 = icmp ult ptr %25, %17
  br i1 %.not24, label %27, label %35

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

35:                                               ; preds = %26
  %36 = ptrtoint ptr %25 to i64
  %37 = ptrtoint ptr %17 to i64
  %38 = sub i64 %36, %37
  %39 = trunc i64 %38 to i32
  %40 = load i32, ptr %18, align 8, !tbaa !15
  %41 = icmp eq i32 %40, %39
  br i1 %41, label %50, label %42

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

50:                                               ; preds = %35, %24
  store ptr %17, ptr %1, align 8, !tbaa !13
  %51 = load ptr, ptr %3, align 8, !tbaa !16
  %52 = call i32 @DH_size(ptr noundef %51) #7
  %53 = icmp sgt i32 %52, 255
  br i1 %53, label %62, label %54

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

62:                                               ; preds = %50
  %63 = call i32 @s2n_dh_params_check(ptr noundef nonnull %3)
  %64 = icmp sgt i32 %63, -1
  br i1 %64, label %65, label %67

65:                                               ; preds = %62
  %66 = load ptr, ptr %3, align 8, !tbaa !16
  store ptr %66, ptr %0, align 8, !tbaa !16
  store i64 0, ptr %3, align 8
  br label %67

67:                                               ; preds = %62, %16, %65, %54, %42, %27
  %.0 = phi i32 [ 0, %65 ], [ -1, %54 ], [ -1, %42 ], [ -1, %27 ], [ -1, %16 ], [ -1, %62 ]
  %68 = call i32 @s2n_dh_params_free(ptr noundef nonnull %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %69

69:                                               ; preds = %12, %67, %4
  %.1 = phi i32 [ %.0, %67 ], [ -1, %4 ], [ -1, %12 ]
  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: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #4

declare i32 @s2n_blob_validate(ptr noundef) 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) #5

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

declare ptr @d2i_DHparams(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare i32 @DH_size(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_dh_params_check(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) #5

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 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!15 = !{!14, !12, i64 8}
!16 = !{!17, !7, i64 0}
!17 = !{!"s2n_dh_params", !7, i64 0}


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