; LLVM IR from openssl/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 [80 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 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
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = icmp slt i32 %30, 2048
  br i1 %31, label %32, label %33

32:                                               ; preds = %6
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 89, 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 %29, align 4
  br label %183

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

37:                                               ; preds = %33
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 94, 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 %29, align 4
  br label %183

38:                                               ; preds = %33
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BN_CTX_start(ptr noundef %39)
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = call ptr @BN_CTX_get(ptr noundef %40)
  store ptr %41, ptr %18, align 8, !tbaa !5
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = call ptr @BN_CTX_get(ptr noundef %42)
  store ptr %43, ptr %16, align 8, !tbaa !5
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = call ptr @BN_CTX_get(ptr noundef %44)
  store ptr %45, ptr %17, align 8, !tbaa !5
  %46 = load ptr, ptr %18, align 8, !tbaa !5
  %47 = icmp eq ptr %46, null
  br i1 %47, label %54, label %48

48:                                               ; preds = %38
  %49 = load ptr, ptr %16, align 8, !tbaa !5
  %50 = icmp eq ptr %49, null
  br i1 %50, label %54, label %51

51:                                               ; preds = %48
  %52 = load ptr, ptr %17, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %51, %48, %38
  br label %163

55:                                               ; preds = %51
  %56 = load ptr, ptr %16, align 8, !tbaa !5
  call void @BN_set_flags(ptr noundef %56, i32 noundef 4)
  %57 = load ptr, ptr %17, align 8, !tbaa !5
  call void @BN_set_flags(ptr noundef %57, i32 noundef 4)
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.rsa_st, ptr %58, i32 0, i32 8
  %60 = load ptr, ptr %59, align 8, !tbaa !11
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %66

62:                                               ; preds = %55
  %63 = call ptr @BN_secure_new()
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.rsa_st, ptr %64, i32 0, i32 8
  store ptr %63, ptr %65, align 8, !tbaa !11
  br label %66

66:                                               ; preds = %62, %55
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.rsa_st, ptr %67, i32 0, i32 9
  %69 = load ptr, ptr %68, align 8, !tbaa !17
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %75

71:                                               ; preds = %66
  %72 = call ptr @BN_secure_new()
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.rsa_st, ptr %73, i32 0, i32 9
  store ptr %72, ptr %74, align 8, !tbaa !17
  br label %75

75:                                               ; preds = %71, %66
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.rsa_st, ptr %76, i32 0, i32 8
  %78 = load ptr, ptr %77, align 8, !tbaa !11
  %79 = icmp eq ptr %78, null
  br i1 %79, label %85, label %80

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

85:                                               ; preds = %80, %75
  br label %163

86:                                               ; preds = %80
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.rsa_st, ptr %87, i32 0, i32 8
  %89 = load ptr, ptr %88, align 8, !tbaa !11
  call void @BN_set_flags(ptr noundef %89, i32 noundef 4)
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.rsa_st, ptr %90, i32 0, i32 9
  %92 = load ptr, ptr %91, align 8, !tbaa !17
  call void @BN_set_flags(ptr noundef %92, i32 noundef 4)
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.rsa_st, ptr %93, i32 0, i32 8
  %95 = load ptr, ptr %94, align 8, !tbaa !11
  %96 = load ptr, ptr %16, align 8, !tbaa !5
  %97 = load ptr, ptr %19, align 8, !tbaa !5
  %98 = load ptr, ptr %20, align 8, !tbaa !5
  %99 = load ptr, ptr %23, align 8, !tbaa !5
  %100 = load ptr, ptr %24, align 8, !tbaa !5
  %101 = load ptr, ptr %25, align 8, !tbaa !5
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  %105 = load ptr, ptr %13, align 8, !tbaa !5
  %106 = call i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef %95, ptr noundef %96, ptr noundef %97, ptr noundef %98, ptr noundef %99, ptr noundef %100, ptr noundef %101, i32 noundef %102, ptr noundef %103, ptr noundef %104, ptr noundef %105)
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %109, label %108

108:                                              ; preds = %86
  br label %163

109:                                              ; preds = %86
  br label %110

110:                                              ; preds = %156, %139, %109
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.rsa_st, ptr %111, i32 0, i32 9
  %113 = load ptr, ptr %112, align 8, !tbaa !17
  %114 = load ptr, ptr %17, align 8, !tbaa !5
  %115 = load ptr, ptr %21, align 8, !tbaa !5
  %116 = load ptr, ptr %22, align 8, !tbaa !5
  %117 = load ptr, ptr %26, align 8, !tbaa !5
  %118 = load ptr, ptr %27, align 8, !tbaa !5
  %119 = load ptr, ptr %28, align 8, !tbaa !5
  %120 = load i32, ptr %10, align 4, !tbaa !9
  %121 = load ptr, ptr %11, align 8, !tbaa !5
  %122 = load ptr, ptr %12, align 8, !tbaa !5
  %123 = load ptr, ptr %13, align 8, !tbaa !5
  %124 = call i32 @ossl_bn_rsa_fips186_4_gen_prob_primes(ptr noundef %113, ptr noundef %114, ptr noundef %115, ptr noundef %116, ptr noundef %117, ptr noundef %118, ptr noundef %119, i32 noundef %120, ptr noundef %121, ptr noundef %122, ptr noundef %123)
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %127, label %126

126:                                              ; preds = %110
  br label %163

127:                                              ; preds = %110
  %128 = load ptr, ptr %18, align 8, !tbaa !5
  %129 = load ptr, ptr %16, align 8, !tbaa !5
  %130 = load ptr, ptr %17, align 8, !tbaa !5
  %131 = load i32, ptr %10, align 4, !tbaa !9
  %132 = call i32 @ossl_rsa_check_pminusq_diff(ptr noundef %128, ptr noundef %129, ptr noundef %130, i32 noundef %131)
  store i32 %132, ptr %15, align 4, !tbaa !9
  %133 = load i32, ptr %15, align 4, !tbaa !9
  %134 = icmp slt i32 %133, 0
  br i1 %134, label %135, label %136

135:                                              ; preds = %127
  br label %163

136:                                              ; preds = %127
  %137 = load i32, ptr %15, align 4, !tbaa !9
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %139, label %140

139:                                              ; preds = %136
  br label %110

140:                                              ; preds = %136
  %141 = load ptr, ptr %18, align 8, !tbaa !5
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.rsa_st, ptr %142, i32 0, i32 8
  %144 = load ptr, ptr %143, align 8, !tbaa !11
  %145 = load ptr, ptr %8, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.rsa_st, ptr %145, i32 0, i32 9
  %147 = load ptr, ptr %146, align 8, !tbaa !17
  %148 = load i32, ptr %10, align 4, !tbaa !9
  %149 = call i32 @ossl_rsa_check_pminusq_diff(ptr noundef %141, ptr noundef %144, ptr noundef %147, i32 noundef %148)
  store i32 %149, ptr %15, align 4, !tbaa !9
  %150 = load i32, ptr %15, align 4, !tbaa !9
  %151 = icmp slt i32 %150, 0
  br i1 %151, label %152, label %153

152:                                              ; preds = %140
  br label %163

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

156:                                              ; preds = %153
  br label %110

157:                                              ; preds = %153
  br label %158

158:                                              ; preds = %157
  %159 = load ptr, ptr %8, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.rsa_st, ptr %159, i32 0, i32 25
  %161 = load i32, ptr %160, align 8, !tbaa !18
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %160, align 8, !tbaa !18
  store i32 1, ptr %14, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %158, %152, %135, %126, %108, %85, %54
  %164 = load ptr, ptr %16, align 8, !tbaa !5
  call void @BN_clear(ptr noundef %164)
  %165 = load ptr, ptr %17, align 8, !tbaa !5
  call void @BN_clear(ptr noundef %165)
  %166 = load ptr, ptr %18, align 8, !tbaa !5
  call void @BN_clear(ptr noundef %166)
  %167 = load i32, ptr %14, align 4, !tbaa !9
  %168 = icmp ne i32 %167, 1
  br i1 %168, label %169, label %180

169:                                              ; preds = %163
  %170 = load ptr, ptr %8, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.rsa_st, ptr %170, i32 0, i32 8
  %172 = load ptr, ptr %171, align 8, !tbaa !11
  call void @BN_clear_free(ptr noundef %172)
  %173 = load ptr, ptr %8, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.rsa_st, ptr %173, i32 0, i32 8
  store ptr null, ptr %174, align 8, !tbaa !11
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.rsa_st, ptr %175, i32 0, i32 9
  %177 = load ptr, ptr %176, align 8, !tbaa !17
  call void @BN_clear_free(ptr noundef %177)
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.rsa_st, ptr %178, i32 0, i32 9
  store ptr null, ptr %179, align 8, !tbaa !17
  br label %180

180:                                              ; preds = %169, %163
  %181 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BN_CTX_end(ptr noundef %181)
  %182 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %182, ptr %7, align 4
  store i32 1, ptr %29, align 4
  br label %183

183:                                              ; preds = %180, %37, %32
  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
  %184 = load i32, ptr %7, align 4
  ret i32 %184
}

; 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_clear_free(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 [80 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 89, 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 %64

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 94, 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 %64

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 %.thread

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 %.loopexit, label %.thread81

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

.thread81:                                        ; preds = %30, %.thread
  %35 = phi ptr [ %26, %.thread ], [ %.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
  %.not75 = icmp eq i32 %38, 0
  br i1 %.not75, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.thread81
  %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
  %.not7678 = icmp eq i32 %40, 0
  br i1 %.not7678, label %.loopexit, 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
  %.not76 = icmp eq i32 %46, 0
  br i1 %.not76, 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, %30, %.thread, %.preheader, %.thread81, %12, %54
  %.not77 = phi i1 [ false, %12 ], [ false, %30 ], [ true, %54 ], [ false, %.thread81 ], [ false, %.preheader ], [ false, %.thread ], [ false, %47 ], [ false, %.lr.ph ], [ false, %.backedge ]
  %.067 = phi i32 [ 0, %12 ], [ 0, %30 ], [ 1, %54 ], [ 0, %.thread81 ], [ 0, %.preheader ], [ 0, %.thread ], [ 0, %47 ], [ 0, %.lr.ph ], [ 0, %.backedge ]
  tail call void @BN_clear(ptr noundef %14) #2
  tail call void @BN_clear(ptr noundef %15) #2
  tail call void @BN_clear(ptr noundef %13) #2
  br i1 %.not77, label %63, label %58

58:                                               ; preds = %.loopexit
  %59 = getelementptr inbounds i8, ptr %0, i64 64
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  tail call void @BN_clear_free(ptr noundef %60) #2
  store ptr null, ptr %59, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %0, i64 72
  %62 = load ptr, ptr %61, align 8, !tbaa !15
  tail call void @BN_clear_free(ptr noundef %62) #2
  store ptr null, ptr %61, align 8, !tbaa !15
  br label %63

63:                                               ; preds = %58, %.loopexit
  tail call void @BN_CTX_end(ptr noundef %4) #2
  br label %64

64:                                               ; preds = %63, %11, %8
  %.0 = phi i32 [ 0, %8 ], [ %.067, %63 ], [ 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_clear_free(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