; LLVM IR from openanolis/openssl :: crypto/rsa (rsa_sp800_56b_gen)

; 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.rsa_st = type { i32, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.rsa_pss_params_30_st, ptr, ptr, %struct.crypto_ex_data_st, %struct.CRYPTO_REF_COUNT, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.rsa_pss_params_30_st = type { i32, %struct.anon, i32, i32 }
%struct.anon = type { i32, i32 }
%struct.crypto_ex_data_st = type { ptr, ptr }
%struct.CRYPTO_REF_COUNT = type { i32 }

@.str = external hidden unnamed_addr constant [83 x i8], align 1
@__func__.ossl_rsa_fips186_4_gen_prob_primes = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_rsa_fips186_4_gen_prob_primes(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  store ptr null, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  store ptr null, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  store ptr null, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  store ptr null, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  store ptr null, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  store ptr null, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #3
  store ptr null, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #3
  store ptr null, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #3
  store ptr null, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #3
  store ptr null, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #3
  store ptr null, ptr %29, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #3
  store ptr null, ptr %30, align 8, !tbaa !5
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = icmp slt i32 %32, 2048
  br i1 %33, label %34, label %35

34:                                               ; preds = %6
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 92, ptr noundef @__func__.ossl_rsa_fips186_4_gen_prob_primes)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 4, i32 noundef 120, ptr noundef null)
  store i32 0, ptr %7, align 4
  store i32 1, ptr %31, align 4
  br label %195

35:                                               ; preds = %6
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = call i32 @ossl_rsa_check_public_exponent(ptr noundef %36)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 97, ptr noundef @__func__.ossl_rsa_fips186_4_gen_prob_primes)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 4, i32 noundef 178, ptr noundef null)
  store i32 0, ptr %7, align 4
  store i32 1, ptr %31, align 4
  br label %195

40:                                               ; preds = %35
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BN_CTX_start(ptr noundef %41)
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = call ptr @BN_CTX_get(ptr noundef %42)
  store ptr %43, ptr %18, align 8, !tbaa !5
  %44 = load ptr, ptr %23, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %48

46:                                               ; preds = %40
  %47 = load ptr, ptr %23, align 8, !tbaa !5
  br label %51

48:                                               ; preds = %40
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = call ptr @BN_CTX_get(ptr noundef %49)
  br label %51

51:                                               ; preds = %48, %46
  %52 = phi ptr [ %47, %46 ], [ %50, %48 ]
  store ptr %52, ptr %16, align 8, !tbaa !5
  %53 = load ptr, ptr %24, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %57

55:                                               ; preds = %51
  %56 = load ptr, ptr %24, align 8, !tbaa !5
  br label %60

57:                                               ; preds = %51
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = call ptr @BN_CTX_get(ptr noundef %58)
  br label %60

60:                                               ; preds = %57, %55
  %61 = phi ptr [ %56, %55 ], [ %59, %57 ]
  store ptr %61, ptr %17, align 8, !tbaa !5
  %62 = load ptr, ptr %18, align 8, !tbaa !5
  %63 = icmp eq ptr %62, null
  br i1 %63, label %70, label %64

64:                                               ; preds = %60
  %65 = load ptr, ptr %16, align 8, !tbaa !5
  %66 = icmp eq ptr %65, null
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr %17, align 8, !tbaa !5
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %71

70:                                               ; preds = %67, %64, %60
  br label %179

71:                                               ; preds = %67
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  call void @BN_set_flags(ptr noundef %72, i32 noundef 4)
  %73 = load ptr, ptr %17, align 8, !tbaa !5
  call void @BN_set_flags(ptr noundef %73, i32 noundef 4)
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.rsa_st, ptr %74, i32 0, i32 8
  %76 = load ptr, ptr %75, align 8, !tbaa !11
  %77 = icmp eq ptr %76, null
  br i1 %77, label %78, label %82

78:                                               ; preds = %71
  %79 = call ptr @BN_secure_new()
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.rsa_st, ptr %80, i32 0, i32 8
  store ptr %79, ptr %81, align 8, !tbaa !11
  br label %82

82:                                               ; preds = %78, %71
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.rsa_st, ptr %83, i32 0, i32 9
  %85 = load ptr, ptr %84, align 8, !tbaa !17
  %86 = icmp eq ptr %85, null
  br i1 %86, label %87, label %91

87:                                               ; preds = %82
  %88 = call ptr @BN_secure_new()
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.rsa_st, ptr %89, i32 0, i32 9
  store ptr %88, ptr %90, align 8, !tbaa !17
  br label %91

91:                                               ; preds = %87, %82
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.rsa_st, ptr %92, i32 0, i32 8
  %94 = load ptr, ptr %93, align 8, !tbaa !11
  %95 = icmp eq ptr %94, null
  br i1 %95, label %101, label %96

96:                                               ; preds = %91
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.rsa_st, ptr %97, i32 0, i32 9
  %99 = load ptr, ptr %98, align 8, !tbaa !17
  %100 = icmp eq ptr %99, null
  br i1 %100, label %101, label %102

101:                                              ; preds = %96, %91
  br label %179

102:                                              ; preds = %96
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.rsa_st, ptr %103, i32 0, i32 8
  %105 = load ptr, ptr %104, align 8, !tbaa !11
  call void @BN_set_flags(ptr noundef %105, i32 noundef 4)
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.rsa_st, ptr %106, i32 0, i32 9
  %108 = load ptr, ptr %107, align 8, !tbaa !17
  call void @BN_set_flags(ptr noundef %108, i32 noundef 4)
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.rsa_st, ptr %109, i32 0, i32 8
  %111 = load ptr, ptr %110, align 8, !tbaa !11
  %112 = load ptr, ptr %16, align 8, !tbaa !5
  %113 = load ptr, ptr %19, align 8, !tbaa !5
  %114 = load ptr, ptr %20, align 8, !tbaa !5
  %115 = load ptr, ptr %25, align 8, !tbaa !5
  %116 = load ptr, ptr %26, align 8, !tbaa !5
  %117 = load ptr, ptr %27, align 8, !tbaa !5
  %118 = load i32, ptr %10, align 4, !tbaa !9
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = load ptr, ptr %12, align 8, !tbaa !5
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = call i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef %111, ptr noundef %112, ptr noundef %113, ptr noundef %114, ptr noundef %115, ptr noundef %116, ptr noundef %117, i32 noundef %118, ptr noundef %119, ptr noundef %120, ptr noundef %121)
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %125, label %124

124:                                              ; preds = %102
  br label %179

125:                                              ; preds = %102
  br label %126

126:                                              ; preds = %172, %155, %125
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.rsa_st, ptr %127, i32 0, i32 9
  %129 = load ptr, ptr %128, align 8, !tbaa !17
  %130 = load ptr, ptr %17, align 8, !tbaa !5
  %131 = load ptr, ptr %21, align 8, !tbaa !5
  %132 = load ptr, ptr %22, align 8, !tbaa !5
  %133 = load ptr, ptr %28, align 8, !tbaa !5
  %134 = load ptr, ptr %29, align 8, !tbaa !5
  %135 = load ptr, ptr %30, align 8, !tbaa !5
  %136 = load i32, ptr %10, align 4, !tbaa !9
  %137 = load ptr, ptr %11, align 8, !tbaa !5
  %138 = load ptr, ptr %12, align 8, !tbaa !5
  %139 = load ptr, ptr %13, align 8, !tbaa !5
  %140 = call i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef %129, ptr noundef %130, ptr noundef %131, ptr noundef %132, ptr noundef %133, ptr noundef %134, ptr noundef %135, i32 noundef %136, ptr noundef %137, ptr noundef %138, ptr noundef %139)
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %143, label %142

142:                                              ; preds = %126
  br label %179

143:                                              ; preds = %126
  %144 = load ptr, ptr %18, align 8, !tbaa !5
  %145 = load ptr, ptr %16, align 8, !tbaa !5
  %146 = load ptr, ptr %17, align 8, !tbaa !5
  %147 = load i32, ptr %10, align 4, !tbaa !9
  %148 = call i32 @ossl_rsa_check_pminusq_diff(ptr noundef %144, ptr noundef %145, ptr noundef %146, i32 noundef %147)
  store i32 %148, ptr %15, align 4, !tbaa !9
  %149 = load i32, ptr %15, align 4, !tbaa !9
  %150 = icmp slt i32 %149, 0
  br i1 %150, label %151, label %152

151:                                              ; preds = %143
  br label %179

152:                                              ; preds = %143
  %153 = load i32, ptr %15, align 4, !tbaa !9
  %154 = icmp eq i32 %153, 0
  br i1 %154, label %155, label %156

155:                                              ; preds = %152
  br label %126

156:                                              ; preds = %152
  %157 = load ptr, ptr %18, align 8, !tbaa !5
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.rsa_st, ptr %158, i32 0, i32 8
  %160 = load ptr, ptr %159, align 8, !tbaa !11
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.rsa_st, ptr %161, i32 0, i32 9
  %163 = load ptr, ptr %162, align 8, !tbaa !17
  %164 = load i32, ptr %10, align 4, !tbaa !9
  %165 = call i32 @ossl_rsa_check_pminusq_diff(ptr noundef %157, ptr noundef %160, ptr noundef %163, i32 noundef %164)
  store i32 %165, ptr %15, align 4, !tbaa !9
  %166 = load i32, ptr %15, align 4, !tbaa !9
  %167 = icmp slt i32 %166, 0
  br i1 %167, label %168, label %169

168:                                              ; preds = %156
  br label %179

169:                                              ; preds = %156
  %170 = load i32, ptr %15, align 4, !tbaa !9
  %171 = icmp eq i32 %170, 0
  br i1 %171, label %172, label %173

172:                                              ; preds = %169
  br label %126

173:                                              ; preds = %169
  br label %174

174:                                              ; preds = %173
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.rsa_st, ptr %175, i32 0, i32 25
  %177 = load i32, ptr %176, align 8, !tbaa !18
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %176, align 8, !tbaa !18
  store i32 1, ptr %14, align 4, !tbaa !9
  br label %179

179:                                              ; preds = %174, %168, %151, %142, %124, %101, %70
  %180 = load ptr, ptr %16, align 8, !tbaa !5
  %181 = load ptr, ptr %23, align 8, !tbaa !5
  %182 = icmp ne ptr %180, %181
  br i1 %182, label %183, label %185

183:                                              ; preds = %179
  %184 = load ptr, ptr %16, align 8, !tbaa !5
  call void @BN_clear(ptr noundef %184)
  br label %185

185:                                              ; preds = %183, %179
  %186 = load ptr, ptr %17, align 8, !tbaa !5
  %187 = load ptr, ptr %24, align 8, !tbaa !5
  %188 = icmp ne ptr %186, %187
  br i1 %188, label %189, label %191

189:                                              ; preds = %185
  %190 = load ptr, ptr %17, align 8, !tbaa !5
  call void @BN_clear(ptr noundef %190)
  br label %191

191:                                              ; preds = %189, %185
  %192 = load ptr, ptr %18, align 8, !tbaa !5
  call void @BN_clear(ptr noundef %192)
  %193 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BN_CTX_end(ptr noundef %193)
  %194 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %194, ptr %7, align 4
  store i32 1, ptr %31, align 4
  br label %195

195:                                              ; preds = %191, %39, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %196 = load i32, ptr %7, align 4
  ret i32 %196
}

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

declare void @ERR_new() #2

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) #2

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) #2

declare i32 @ossl_rsa_check_public_exponent(ptr noundef) #2

declare void @BN_CTX_start(ptr noundef) #2

declare ptr @BN_CTX_get(ptr noundef) #2

declare void @BN_set_flags(ptr noundef, i32 noundef) #2

declare ptr @BN_secure_new() #2

declare i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @ossl_rsa_check_pminusq_diff(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

declare void @BN_clear(ptr noundef) #2

declare void @BN_CTX_end(ptr noundef) #2

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

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 willreturn memory(argmem: readwrite) }
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 }

!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 64}
!12 = !{!"rsa_st", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !13, i64 104, !6, i64 128, !6, i64 136, !15, i64 144, !16, i64 160, !10, i64 164, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !10, i64 216}
!13 = !{!"rsa_pss_params_30_st", !10, i64 0, !14, i64 4, !10, i64 12, !10, i64 16}
!14 = !{!"", !10, i64 0, !10, i64 4}
!15 = !{!"crypto_ex_data_st", !6, i64 0, !6, i64 8}
!16 = !{!"", !7, i64 0}
!17 = !{!12, !6, i64 72}
!18 = !{!12, !10, i64 216}


; 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"

@.str = external hidden unnamed_addr constant [83 x i8], align 1
@__func__.ossl_rsa_fips186_4_gen_prob_primes = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_rsa_fips186_4_gen_prob_primes(ptr nocapture noundef %0, ptr nocapture noundef readnone %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = icmp slt i32 %2, 2048
  br i1 %7, label %8, label %9

8:                                                ; preds = %6
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 92, ptr noundef nonnull @__func__.ossl_rsa_fips186_4_gen_prob_primes) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 4, i32 noundef 120, ptr noundef null) #2
  br label %61

9:                                                ; preds = %6
  %10 = tail call i32 @ossl_rsa_check_public_exponent(ptr noundef %3) #2
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %11, label %12

11:                                               ; preds = %9
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 97, ptr noundef nonnull @__func__.ossl_rsa_fips186_4_gen_prob_primes) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 4, i32 noundef 178, ptr noundef null) #2
  br label %61

12:                                               ; preds = %9
  tail call void @BN_CTX_start(ptr noundef %4) #2
  %13 = tail call ptr @BN_CTX_get(ptr noundef %4) #2
  %14 = tail call ptr @BN_CTX_get(ptr noundef %4) #2
  %15 = tail call ptr @BN_CTX_get(ptr noundef %4) #2
  %16 = icmp eq ptr %13, null
  %17 = icmp eq ptr %14, null
  %or.cond = select i1 %16, i1 true, i1 %17
  %18 = icmp eq ptr %15, null
  %or.cond3 = select i1 %or.cond, i1 true, i1 %18
  br i1 %or.cond3, label %.loopexit, label %19

19:                                               ; preds = %12
  tail call void @BN_set_flags(ptr noundef nonnull %14, i32 noundef 4) #2
  tail call void @BN_set_flags(ptr noundef nonnull %15, i32 noundef 4) #2
  %20 = getelementptr inbounds i8, ptr %0, i64 64
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %19
  %24 = tail call ptr @BN_secure_new() #2
  store ptr %24, ptr %20, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %23, %19
  %26 = phi ptr [ %24, %23 ], [ %21, %19 ]
  %27 = getelementptr inbounds i8, ptr %0, i64 72
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %.thread89

30:                                               ; preds = %25
  %31 = tail call ptr @BN_secure_new() #2
  store ptr %31, ptr %27, align 8, !tbaa !15
  %.pre = load ptr, ptr %20, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  %33 = icmp eq ptr %.pre, null
  %brmerge = select i1 %33, i1 true, i1 %32
  br i1 %brmerge, label %.thread, label %.thread90

.thread89:                                        ; preds = %25
  %34 = icmp eq ptr %26, null
  br i1 %34, label %.thread, label %.thread90

.thread90:                                        ; preds = %30, %.thread89
  %35 = phi ptr [ %26, %.thread89 ], [ %.pre, %30 ]
  tail call void @BN_set_flags(ptr noundef nonnull %35, i32 noundef 4) #2
  %36 = load ptr, ptr %27, align 8, !tbaa !15
  tail call void @BN_set_flags(ptr noundef %36, i32 noundef 4) #2
  %37 = load ptr, ptr %20, align 8, !tbaa !5
  %38 = tail call i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef %37, ptr noundef nonnull %14, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2
  %.not79 = icmp eq i32 %38, 0
  br i1 %.not79, label %.thread, label %.preheader

.preheader:                                       ; preds = %.thread90
  %39 = load ptr, ptr %27, align 8, !tbaa !15
  %40 = tail call i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef %39, ptr noundef nonnull %15, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2
  %.not8086 = icmp eq i32 %40, 0
  br i1 %.not8086, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.backedge
  %41 = tail call i32 @ossl_rsa_check_pminusq_diff(ptr noundef %13, ptr noundef %14, ptr noundef %15, i32 noundef %2) #2
  %42 = icmp slt i32 %41, 0
  br i1 %42, label %.loopexit, label %43

43:                                               ; preds = %.lr.ph
  %44 = icmp eq i32 %41, 0
  br i1 %44, label %.backedge, label %47

.backedge:                                        ; preds = %43, %52
  %45 = load ptr, ptr %27, align 8, !tbaa !15
  %46 = tail call i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef %45, ptr noundef %15, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2
  %.not80 = icmp eq i32 %46, 0
  br i1 %.not80, label %.loopexit, label %.lr.ph

47:                                               ; preds = %43
  %48 = load ptr, ptr %20, align 8, !tbaa !5
  %49 = load ptr, ptr %27, align 8, !tbaa !15
  %50 = tail call i32 @ossl_rsa_check_pminusq_diff(ptr noundef %13, ptr noundef %48, ptr noundef %49, i32 noundef %2) #2
  %51 = icmp slt i32 %50, 0
  br i1 %51, label %.loopexit, label %52

52:                                               ; preds = %47
  %53 = icmp eq i32 %50, 0
  br i1 %53, label %.backedge, label %54

54:                                               ; preds = %52
  %55 = getelementptr inbounds i8, ptr %0, i64 216
  %56 = load i32, ptr %55, align 8, !tbaa !16
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %55, align 8, !tbaa !16
  br label %.loopexit

.loopexit:                                        ; preds = %.backedge, %.lr.ph, %47, %12, %54
  %.070 = phi i32 [ 0, %12 ], [ 1, %54 ], [ 0, %47 ], [ 0, %.lr.ph ], [ 0, %.backedge ]
  br i1 %17, label %58, label %.thread

.thread:                                          ; preds = %30, %.preheader, %.thread89, %.thread90, %.loopexit
  %.07084 = phi i32 [ %.070, %.loopexit ], [ 0, %.thread90 ], [ 0, %30 ], [ 0, %.thread89 ], [ 0, %.preheader ]
  tail call void @BN_clear(ptr noundef nonnull %14) #2
  br label %58

58:                                               ; preds = %.thread, %.loopexit
  %.07085 = phi i32 [ %.07084, %.thread ], [ %.070, %.loopexit ]
  br i1 %18, label %60, label %59

59:                                               ; preds = %58
  tail call void @BN_clear(ptr noundef nonnull %15) #2
  br label %60

60:                                               ; preds = %59, %58
  tail call void @BN_clear(ptr noundef %13) #2
  tail call void @BN_CTX_end(ptr noundef %4) #2
  br label %61

61:                                               ; preds = %60, %11, %8
  %.0 = phi i32 [ 0, %8 ], [ %.07085, %60 ], [ 0, %11 ]
  ret i32 %.0
}

declare void @ERR_new() local_unnamed_addr #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

declare i32 @ossl_rsa_check_public_exponent(ptr noundef) local_unnamed_addr #1

declare void @BN_CTX_start(ptr noundef) local_unnamed_addr #1

declare ptr @BN_CTX_get(ptr noundef) local_unnamed_addr #1

declare void @BN_set_flags(ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @BN_secure_new() local_unnamed_addr #1

declare i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @ossl_rsa_check_pminusq_diff(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @BN_clear(ptr noundef) local_unnamed_addr #1

declare void @BN_CTX_end(ptr noundef) local_unnamed_addr #1

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!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, !10, i64 64}
!6 = !{!"rsa_st", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !11, i64 104, !10, i64 128, !10, i64 136, !13, i64 144, !14, i64 160, !7, i64 164, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !7, i64 216}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"rsa_pss_params_30_st", !7, i64 0, !12, i64 4, !7, i64 12, !7, i64 16}
!12 = !{!"", !7, i64 0, !7, i64 4}
!13 = !{!"crypto_ex_data_st", !10, i64 0, !10, i64 8}
!14 = !{!"", !8, i64 0}
!15 = !{!6, !10, i64 72}
!16 = !{!6, !7, i64 216}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass