; LLVM IR from openanolis/openssl :: providers/common (provider_util)

; 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.ossl_param_st = type { ptr, i32, ptr, i64, i64 }

@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

declare ptr @OSSL_PARAM_locate_const(ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @ossl_prov_set_macctx(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_prov_macctx_load_from_params(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  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 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  store ptr null, ptr %15, align 8, !tbaa !5
  %18 = load ptr, ptr %10, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %34

20:                                               ; preds = %6
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = call ptr @OSSL_PARAM_locate_const(ptr noundef %21, ptr noundef @.str.5)
  store ptr %22, ptr %14, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %34

24:                                               ; preds = %20
  %25 = load ptr, ptr %14, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ossl_param_st, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 8, !tbaa !9
  %28 = icmp ne i32 %27, 4
  br i1 %28, label %29, label %30

29:                                               ; preds = %24
  store i32 0, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %95

30:                                               ; preds = %24
  %31 = load ptr, ptr %14, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ossl_param_st, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  store ptr %33, ptr %10, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %30, %20, %6
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = call ptr @OSSL_PARAM_locate_const(ptr noundef %35, ptr noundef @.str.3)
  store ptr %36, ptr %14, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %48

38:                                               ; preds = %34
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ossl_param_st, ptr %39, i32 0, i32 1
  %41 = load i32, ptr %40, align 8, !tbaa !9
  %42 = icmp ne i32 %41, 4
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  store i32 0, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %95

44:                                               ; preds = %38
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ossl_param_st, ptr %45, i32 0, i32 2
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  store ptr %47, ptr %15, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %44, %34
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %76

51:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %52 = load ptr, ptr %13, align 8, !tbaa !5
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = load ptr, ptr %15, align 8, !tbaa !5
  %55 = call ptr @EVP_MAC_fetch(ptr noundef %52, ptr noundef %53, ptr noundef %54)
  store ptr %55, ptr %17, align 8, !tbaa !5
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  call void @EVP_MAC_CTX_free(ptr noundef %57)
  %58 = load ptr, ptr %17, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %51
  br label %64

61:                                               ; preds = %51
  %62 = load ptr, ptr %17, align 8, !tbaa !5
  %63 = call ptr @EVP_MAC_CTX_new(ptr noundef %62)
  br label %64

64:                                               ; preds = %61, %60
  %65 = phi ptr [ null, %60 ], [ %63, %61 ]
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %65, ptr %66, align 8, !tbaa !5
  %67 = load ptr, ptr %17, align 8, !tbaa !5
  call void @EVP_MAC_free(ptr noundef %67)
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %72

71:                                               ; preds = %64
  store i32 0, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %73

72:                                               ; preds = %64
  store i32 0, ptr %16, align 4
  br label %73

73:                                               ; preds = %72, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  %74 = load i32, ptr %16, align 4
  switch i32 %74, label %95 [
    i32 0, label %75
  ]

75:                                               ; preds = %73
  br label %76

76:                                               ; preds = %75, %48
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = icmp eq ptr %78, null
  br i1 %79, label %80, label %81

80:                                               ; preds = %76
  store i32 1, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %95

81:                                               ; preds = %76
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = load ptr, ptr %15, align 8, !tbaa !5
  %88 = call i32 @ossl_prov_set_macctx(ptr noundef %83, ptr noundef %84, ptr noundef %85, ptr noundef %86, ptr noundef null, ptr noundef %87, ptr noundef null, i64 noundef 0)
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %91

90:                                               ; preds = %81
  store i32 1, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %95

91:                                               ; preds = %81
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  call void @EVP_MAC_CTX_free(ptr noundef %93)
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr null, ptr %94, align 8, !tbaa !5
  store i32 0, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %95

95:                                               ; preds = %91, %90, %80, %73, %43, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %96 = load i32, ptr %7, align 4
  ret i32 %96
}

declare ptr @EVP_MAC_fetch(ptr noundef, ptr noundef, ptr noundef) #1

declare void @EVP_MAC_CTX_free(ptr noundef) #1

declare ptr @EVP_MAC_CTX_new(ptr noundef) #1

declare void @EVP_MAC_free(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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, !11, i64 8}
!10 = !{!"ossl_param_st", !6, i64 0, !11, i64 8, !6, i64 16, !12, i64 24, !12, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !6, i64 16}


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

declare ptr @OSSL_PARAM_locate_const(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @ossl_prov_set_macctx(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_prov_macctx_load_from_params(ptr nocapture noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #1 {
  %7 = icmp eq ptr %2, null
  br i1 %7, label %8, label %16

8:                                                ; preds = %6
  %9 = tail call ptr @OSSL_PARAM_locate_const(ptr noundef %1, ptr noundef nonnull @.str.5) #2
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %16, label %10

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %9, i64 8
  %12 = load i32, ptr %11, align 8, !tbaa !5
  %.not34 = icmp eq i32 %12, 4
  br i1 %.not34, label %13, label %40

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %9, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  br label %16

16:                                               ; preds = %13, %8, %6
  %.028 = phi ptr [ %15, %13 ], [ null, %8 ], [ %2, %6 ]
  %17 = tail call ptr @OSSL_PARAM_locate_const(ptr noundef %1, ptr noundef nonnull @.str.3) #2
  %.not35 = icmp eq ptr %17, null
  br i1 %.not35, label %24, label %18

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %17, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !5
  %.not36 = icmp eq i32 %20, 4
  br i1 %.not36, label %21, label %40

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %17, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  br label %24

24:                                               ; preds = %21, %16
  %.027 = phi ptr [ %23, %21 ], [ null, %16 ]
  %.not37 = icmp eq ptr %.028, null
  br i1 %.not37, label %34, label %25

25:                                               ; preds = %24
  %26 = tail call ptr @EVP_MAC_fetch(ptr noundef %5, ptr noundef nonnull %.028, ptr noundef %.027) #2
  %27 = load ptr, ptr %0, align 8, !tbaa !13
  tail call void @EVP_MAC_CTX_free(ptr noundef %27) #2
  %28 = icmp eq ptr %26, null
  br i1 %28, label %31, label %29

29:                                               ; preds = %25
  %30 = tail call ptr @EVP_MAC_CTX_new(ptr noundef nonnull %26) #2
  br label %31

31:                                               ; preds = %25, %29
  %32 = phi ptr [ %30, %29 ], [ null, %25 ]
  store ptr %32, ptr %0, align 8, !tbaa !13
  tail call void @EVP_MAC_free(ptr noundef %26) #2
  %33 = load ptr, ptr %0, align 8, !tbaa !13
  %.not38 = icmp eq ptr %33, null
  br i1 %.not38, label %40, label %.thread

34:                                               ; preds = %24
  %.pr = load ptr, ptr %0, align 8, !tbaa !13
  %35 = icmp eq ptr %.pr, null
  br i1 %35, label %40, label %.thread

.thread:                                          ; preds = %31, %34
  %36 = phi ptr [ %.pr, %34 ], [ %33, %31 ]
  %37 = tail call i32 @ossl_prov_set_macctx(ptr noundef nonnull %36, ptr noundef %1, ptr noundef %3, ptr noundef %4, ptr noundef null, ptr noundef %.027, ptr noundef null, i64 noundef 0)
  %.not39 = icmp eq i32 %37, 0
  br i1 %.not39, label %38, label %40

38:                                               ; preds = %.thread
  %39 = load ptr, ptr %0, align 8, !tbaa !13
  tail call void @EVP_MAC_CTX_free(ptr noundef %39) #2
  store ptr null, ptr %0, align 8, !tbaa !13
  br label %40

40:                                               ; preds = %.thread, %34, %18, %10, %31, %38
  %.1 = phi i32 [ 0, %38 ], [ 0, %31 ], [ 0, %10 ], [ 0, %18 ], [ 1, %34 ], [ 1, %.thread ]
  ret i32 %.1
}

declare ptr @EVP_MAC_fetch(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @EVP_MAC_CTX_free(ptr noundef) local_unnamed_addr #0

declare ptr @EVP_MAC_CTX_new(ptr noundef) local_unnamed_addr #0

declare void @EVP_MAC_free(ptr noundef) local_unnamed_addr #0

attributes #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 = { 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 #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 8}
!6 = !{!"ossl_param_st", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 24, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !7, i64 16}
!13 = !{!7, !7, i64 0}


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