; LLVM IR from open-quantum-safe/oqs-provider :: test (oqs_test_groups)

; 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 [87 x i8], align 1
@libctx = external hidden global ptr, align 8
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@modulename = external hidden global ptr, align 8
@configfile = external hidden global ptr, align 8
@certsdir = external hidden global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@cert = external hidden global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@privkey = external hidden global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [25 x i8], align 1

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

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

; 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
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  %9 = call ptr @OSSL_LIB_CTX_new()
  store ptr %9, ptr @libctx, align 8, !tbaa !9
  %10 = icmp ne ptr %9, null
  br i1 %10, label %13, label %11

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

13:                                               ; preds = %2
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = icmp eq i32 %14, 4
  br i1 %15, label %18, label %16

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

18:                                               ; preds = %13
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = getelementptr inbounds ptr, ptr %19, i64 1
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  store ptr %21, ptr @modulename, align 8, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 2
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  store ptr %24, ptr @configfile, align 8, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 3
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  store ptr %27, ptr @certsdir, align 8, !tbaa !9
  %28 = load ptr, ptr @certsdir, align 8, !tbaa !9
  %29 = call ptr @test_mk_file_path(ptr noundef %28, ptr noundef @.str.4)
  store ptr %29, ptr @cert, align 8, !tbaa !9
  %30 = icmp ne ptr %29, null
  br i1 %30, label %33, label %31

31:                                               ; preds = %18
  %32 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @ERR_print_errors_fp(ptr noundef %32)
  call void @OPENSSL_die(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 158) #5
  unreachable

33:                                               ; preds = %18
  %34 = load ptr, ptr @certsdir, align 8, !tbaa !9
  %35 = call ptr @test_mk_file_path(ptr noundef %34, ptr noundef @.str.6)
  store ptr %35, ptr @privkey, align 8, !tbaa !9
  %36 = icmp ne ptr %35, null
  br i1 %36, label %39, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @ERR_print_errors_fp(ptr noundef %38)
  call void @OPENSSL_die(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 159) #5
  unreachable

39:                                               ; preds = %33
  %40 = load ptr, ptr @libctx, align 8, !tbaa !9
  %41 = load ptr, ptr @modulename, align 8, !tbaa !9
  %42 = load ptr, ptr @configfile, align 8, !tbaa !9
  call void @load_oqs_provider(ptr noundef %40, ptr noundef %41, ptr noundef %42)
  %43 = load ptr, ptr @libctx, align 8, !tbaa !9
  %44 = call i32 @OSSL_PROVIDER_available(ptr noundef %43, ptr noundef @.str.8)
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %48, label %46

46:                                               ; preds = %39
  %47 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @ERR_print_errors_fp(ptr noundef %47)
  call void @OPENSSL_die(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 163) #5
  unreachable

48:                                               ; preds = %39
  %49 = load ptr, ptr @libctx, align 8, !tbaa !9
  %50 = call i32 @OSSL_PROVIDER_do_all(ptr noundef %49, ptr noundef @test_provider_groups, ptr noundef %7)
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %54, label %52

52:                                               ; preds = %48
  %53 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @ERR_print_errors_fp(ptr noundef %53)
  call void @OPENSSL_die(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 165) #5
  unreachable

54:                                               ; preds = %48
  %55 = load ptr, ptr @cert, align 8, !tbaa !9
  call void @CRYPTO_free(ptr noundef %55, ptr noundef @.str.1, i32 noundef 167)
  %56 = load ptr, ptr @privkey, align 8, !tbaa !9
  call void @CRYPTO_free(ptr noundef %56, ptr noundef @.str.1, i32 noundef 168)
  %57 = load ptr, ptr @libctx, align 8, !tbaa !9
  call void @OSSL_LIB_CTX_free(ptr noundef %57)
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 0
  %60 = zext i1 %59 to i32
  store i32 %60, ptr %8, align 4, !tbaa !5
  br i1 %59, label %63, label %61

61:                                               ; preds = %54
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %65

63:                                               ; preds = %54
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  br label %65

65:                                               ; preds = %63, %61
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = icmp ne i32 %66, 0
  %68 = xor i1 %67, true
  %69 = zext i1 %68 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  ret i32 %69
}

declare ptr @OSSL_LIB_CTX_new() #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 void @load_oqs_provider(ptr noundef, ptr noundef, ptr noundef) #2

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

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

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

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

declare void @OSSL_LIB_CTX_free(ptr noundef) #2

declare i32 @printf(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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, 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"

@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@libctx = external hidden local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@modulename = external hidden local_unnamed_addr global ptr, align 8
@configfile = external hidden local_unnamed_addr global ptr, align 8
@certsdir = external hidden local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@cert = external hidden local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@privkey = external hidden local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @test_mk_file_path(ptr noundef, 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

; 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
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  %4 = tail call ptr @OSSL_LIB_CTX_new() #5
  store ptr %4, ptr @libctx, align 8, !tbaa !9
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %7

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

7:                                                ; preds = %2
  %8 = icmp eq i32 %0, 4
  br i1 %8, label %11, label %9

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

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %13, ptr @modulename, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %1, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr @configfile, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %1, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %17, ptr @certsdir, align 8, !tbaa !9
  %18 = tail call ptr @test_mk_file_path(ptr noundef %17, ptr noundef nonnull @.str.4)
  store ptr %18, ptr @cert, align 8, !tbaa !9
  %.not4 = icmp eq ptr %18, null
  br i1 %.not4, label %19, label %21

19:                                               ; preds = %11
  %20 = load ptr, ptr @stderr, align 8, !tbaa !9
  tail call void @ERR_print_errors_fp(ptr noundef %20) #5
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 158) #6
  unreachable

21:                                               ; preds = %11
  %22 = load ptr, ptr @certsdir, align 8, !tbaa !9
  %23 = tail call ptr @test_mk_file_path(ptr noundef %22, ptr noundef nonnull @.str.6)
  store ptr %23, ptr @privkey, align 8, !tbaa !9
  %.not5 = icmp eq ptr %23, null
  br i1 %.not5, label %24, label %26

24:                                               ; preds = %21
  %25 = load ptr, ptr @stderr, align 8, !tbaa !9
  tail call void @ERR_print_errors_fp(ptr noundef %25) #5
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 159) #6
  unreachable

26:                                               ; preds = %21
  %27 = load ptr, ptr @libctx, align 8, !tbaa !9
  %28 = load ptr, ptr @modulename, align 8, !tbaa !9
  %29 = load ptr, ptr @configfile, align 8, !tbaa !9
  tail call void @load_oqs_provider(ptr noundef %27, ptr noundef %28, ptr noundef %29) #5
  %30 = load ptr, ptr @libctx, align 8, !tbaa !9
  %31 = tail call i32 @OSSL_PROVIDER_available(ptr noundef %30, ptr noundef nonnull @.str.8) #5
  %.not6 = icmp eq i32 %31, 0
  br i1 %.not6, label %32, label %34

32:                                               ; preds = %26
  %33 = load ptr, ptr @stderr, align 8, !tbaa !9
  tail call void @ERR_print_errors_fp(ptr noundef %33) #5
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 163) #6
  unreachable

34:                                               ; preds = %26
  %35 = load ptr, ptr @libctx, align 8, !tbaa !9
  %36 = call i32 @OSSL_PROVIDER_do_all(ptr noundef %35, ptr noundef nonnull @test_provider_groups, ptr noundef nonnull %3) #5
  %.not7 = icmp eq i32 %36, 0
  br i1 %.not7, label %37, label %39

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @ERR_print_errors_fp(ptr noundef %38) #5
  call void @OPENSSL_die(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 165) #6
  unreachable

39:                                               ; preds = %34
  %40 = load ptr, ptr @cert, align 8, !tbaa !9
  call void @CRYPTO_free(ptr noundef %40, ptr noundef nonnull @.str.1, i32 noundef 167) #5
  %41 = load ptr, ptr @privkey, align 8, !tbaa !9
  call void @CRYPTO_free(ptr noundef %41, ptr noundef nonnull @.str.1, i32 noundef 168) #5
  %42 = load ptr, ptr @libctx, align 8, !tbaa !9
  call void @OSSL_LIB_CTX_free(ptr noundef %42) #5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = icmp ne i32 %43, 0
  %.str.11..str.12 = select i1 %44, ptr @.str.11, ptr @.str.12
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.11..str.12)
  %46 = zext i1 %44 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret i32 %46
}

declare ptr @OSSL_LIB_CTX_new() 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 void @load_oqs_provider(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

declare void @CRYPTO_free(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @OSSL_LIB_CTX_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

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 = { nofree nounwind "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 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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