; LLVM IR from gost-engine/engine :: test_ciphers (warn_all_untested)

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

@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1

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

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

declare i32 @ENGINE_free(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @warn_if_untested(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @warn_all_untested() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = call i32 @engine_is_available(ptr noundef @.str.1)
  %8 = icmp ne i32 %7, 0
  br i1 %8, label %9, label %50

9:                                                ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %10 = call ptr @ENGINE_by_id(ptr noundef @.str.1)
  store ptr %10, ptr %1, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %14, label %12

12:                                               ; preds = %9
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %13)
  call void @OPENSSL_die(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 541) #5
  unreachable

14:                                               ; preds = %9
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = call i32 @ENGINE_init(ptr noundef %15)
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %20, label %18

18:                                               ; preds = %14
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %19)
  call void @OPENSSL_die(ptr noundef @.str.4, ptr noundef @.str.3, i32 noundef 542) #5
  unreachable

20:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = call ptr @ENGINE_get_ciphers(ptr noundef %21)
  store ptr %22, ptr %2, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %26, label %24

24:                                               ; preds = %20
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %25)
  call void @OPENSSL_die(ptr noundef @.str.5, ptr noundef @.str.3, i32 noundef 545) #5
  unreachable

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = load ptr, ptr %1, align 8, !tbaa !5
  %29 = call i32 %27(ptr noundef %28, ptr noundef null, ptr noundef %3, i32 noundef 0)
  store i32 %29, ptr %4, align 4, !tbaa !9
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %42, %26
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %34, label %45

34:                                               ; preds = %30
  %35 = load ptr, ptr %1, align 8, !tbaa !5
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr %36, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = call ptr @ENGINE_get_cipher(ptr noundef %35, i32 noundef %40)
  call void @warn_if_untested(ptr noundef %41, ptr noundef null)
  br label %42

42:                                               ; preds = %34
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %5, align 4, !tbaa !9
  br label %30, !llvm.loop !11

45:                                               ; preds = %30
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  %47 = call i32 @ENGINE_finish(ptr noundef %46)
  %48 = load ptr, ptr %1, align 8, !tbaa !5
  %49 = call i32 @ENGINE_free(ptr noundef %48)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  br label %50

50:                                               ; preds = %45, %0
  %51 = call i32 @OSSL_PROVIDER_available(ptr noundef null, ptr noundef @.str.6)
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %62

53:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %54 = call ptr @OSSL_PROVIDER_load(ptr noundef null, ptr noundef @.str.6)
  store ptr %54, ptr %6, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %58, label %56

56:                                               ; preds = %53
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %57)
  call void @OPENSSL_die(ptr noundef @.str.7, ptr noundef @.str.3, i32 noundef 557) #5
  unreachable

58:                                               ; preds = %53
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  call void @EVP_CIPHER_do_all_provided(ptr noundef null, ptr noundef @warn_if_untested, ptr noundef %59)
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = call i32 @OSSL_PROVIDER_unload(ptr noundef %60)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %62

62:                                               ; preds = %58, %50
  ret void
}

declare ptr @ENGINE_by_id(ptr noundef) #2

declare void @ERR_print_errors_fp(ptr noundef) #2

; Function Attrs: noreturn
declare void @OPENSSL_die(ptr noundef, ptr noundef, i32 noundef) #3

declare i32 @ENGINE_init(ptr noundef) #2

declare ptr @ENGINE_get_ciphers(ptr noundef) #2

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

declare i32 @ENGINE_finish(ptr noundef) #2

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

declare ptr @OSSL_PROVIDER_load(ptr noundef, ptr noundef) #2

declare void @EVP_CIPHER_do_all_provided(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @OSSL_PROVIDER_unload(ptr noundef) #2

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

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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.1 = external hidden unnamed_addr constant [5 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1

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

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

declare i32 @ENGINE_free(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @warn_if_untested(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @warn_all_untested() local_unnamed_addr #0 {
  %1 = alloca ptr, align 8
  %2 = tail call i32 @engine_is_available(ptr noundef nonnull @.str.1)
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %24, label %3

3:                                                ; preds = %0
  %4 = tail call ptr @ENGINE_by_id(ptr noundef nonnull @.str.1) #4
  %.not15 = icmp eq ptr %4, null
  br i1 %.not15, label %5, label %7

5:                                                ; preds = %3
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  tail call void @ERR_print_errors_fp(ptr noundef %6) #4
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 541) #5
  unreachable

7:                                                ; preds = %3
  %8 = tail call i32 @ENGINE_init(ptr noundef nonnull %4) #4
  %.not16 = icmp eq i32 %8, 0
  br i1 %.not16, label %9, label %11

9:                                                ; preds = %7
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  tail call void @ERR_print_errors_fp(ptr noundef %10) #4
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.3, i32 noundef 542) #5
  unreachable

11:                                               ; preds = %7
  %12 = tail call ptr @ENGINE_get_ciphers(ptr noundef nonnull %4) #4
  %.not17 = icmp eq ptr %12, null
  br i1 %.not17, label %13, label %15

13:                                               ; preds = %11
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  tail call void @ERR_print_errors_fp(ptr noundef %14) #4
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.3, i32 noundef 545) #5
  unreachable

15:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %16 = call i32 %12(ptr noundef nonnull %4, ptr noundef null, ptr noundef nonnull %1, i32 noundef 0) #4
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %15
  %wide.trip.count = zext nneg i32 %16 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %19 = getelementptr inbounds i32, ptr %18, i64 %indvars.iv
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = call ptr @ENGINE_get_cipher(ptr noundef nonnull %4, i32 noundef %20) #4
  call void @warn_if_untested(ptr noundef %21, ptr noundef null)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %15
  %22 = call i32 @ENGINE_finish(ptr noundef nonnull %4) #4
  %23 = call i32 @ENGINE_free(ptr noundef nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  br label %24

24:                                               ; preds = %._crit_edge, %0
  %25 = call i32 @OSSL_PROVIDER_available(ptr noundef null, ptr noundef nonnull @.str.6) #4
  %.not18 = icmp eq i32 %25, 0
  br i1 %.not18, label %32, label %26

26:                                               ; preds = %24
  %27 = call ptr @OSSL_PROVIDER_load(ptr noundef null, ptr noundef nonnull @.str.6) #4
  %.not19 = icmp eq ptr %27, null
  br i1 %.not19, label %28, label %30

28:                                               ; preds = %26
  %29 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %29) #4
  call void @OPENSSL_die(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.3, i32 noundef 557) #5
  unreachable

30:                                               ; preds = %26
  call void @EVP_CIPHER_do_all_provided(ptr noundef null, ptr noundef nonnull @warn_if_untested, ptr noundef nonnull %27) #4
  %31 = call i32 @OSSL_PROVIDER_unload(ptr noundef nonnull %27) #4
  br label %32

32:                                               ; preds = %30, %24
  ret void
}

declare ptr @ENGINE_by_id(ptr noundef) local_unnamed_addr #2

declare void @ERR_print_errors_fp(ptr noundef) local_unnamed_addr #2

; Function Attrs: noreturn
declare void @OPENSSL_die(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @ENGINE_init(ptr noundef) local_unnamed_addr #2

declare ptr @ENGINE_get_ciphers(ptr noundef) local_unnamed_addr #2

declare ptr @ENGINE_get_cipher(ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @ENGINE_finish(ptr noundef) local_unnamed_addr #2

declare i32 @OSSL_PROVIDER_available(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @OSSL_PROVIDER_load(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @EVP_CIPHER_do_all_provided(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @OSSL_PROVIDER_unload(ptr noundef) local_unnamed_addr #2

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 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 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass