; LLVM IR from openanolis/openssl :: test (algorithmid_test)

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

@bio_err = external global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [33 x i8], align 1
@pubkey_filename = external hidden global ptr, align 8
@eecert_filename = external hidden global ptr, align 8
@cacert_filename = external hidden global ptr, align 8
@.str.21 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @setup_tests() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %18, %0
  %9 = call i32 @opt_next()
  store i32 %9, ptr %2, align 4, !tbaa !5
  %10 = icmp ne i32 %9, 0
  br i1 %10, label %11, label %19

11:                                               ; preds = %8
  %12 = load i32, ptr %2, align 4, !tbaa !5
  switch i32 %12, label %16 [
    i32 1, label %13
    i32 2, label %14
    i32 500, label %15
    i32 501, label %15
    i32 502, label %15
    i32 503, label %15
    i32 504, label %15
    i32 505, label %15
    i32 -1, label %17
  ]

13:                                               ; preds = %11
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %18

14:                                               ; preds = %11
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %18

15:                                               ; preds = %11, %11, %11, %11, %11, %11
  br label %18

16:                                               ; preds = %11
  br label %17

17:                                               ; preds = %16, %11
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %90

18:                                               ; preds = %15, %14, %13
  br label %8, !llvm.loop !9

19:                                               ; preds = %8
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = add nsw i32 %20, %21
  store i32 %22, ptr %6, align 4, !tbaa !5
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = icmp slt i32 %23, 1
  br i1 %24, label %25, label %28

25:                                               ; preds = %19
  %26 = load ptr, ptr @bio_err, align 8, !tbaa !11
  %27 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %26, ptr noundef @.str.19)
  br label %35

28:                                               ; preds = %19
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 1
  br i1 %30, label %31, label %34

31:                                               ; preds = %28
  %32 = load ptr, ptr @bio_err, align 8, !tbaa !11
  %33 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %32, ptr noundef @.str.20)
  br label %34

34:                                               ; preds = %31, %28
  br label %35

35:                                               ; preds = %34, %25
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = icmp ne i32 %36, 1
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %90

39:                                               ; preds = %35
  %40 = call i64 @test_get_argument_count()
  %41 = trunc i64 %40 to i32
  store i32 %41, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %49

44:                                               ; preds = %39
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %49

47:                                               ; preds = %44
  %48 = call ptr @test_get_argument(i64 noundef 0)
  store ptr %48, ptr @pubkey_filename, align 8, !tbaa !11
  br label %59

49:                                               ; preds = %44, %39
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %58

52:                                               ; preds = %49
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = icmp eq i32 %53, 2
  br i1 %54, label %55, label %58

55:                                               ; preds = %52
  %56 = call ptr @test_get_argument(i64 noundef 0)
  store ptr %56, ptr @eecert_filename, align 8, !tbaa !11
  %57 = call ptr @test_get_argument(i64 noundef 1)
  store ptr %57, ptr @cacert_filename, align 8, !tbaa !11
  br label %58

58:                                               ; preds = %55, %52, %49
  br label %59

59:                                               ; preds = %58, %47
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %68

62:                                               ; preds = %59
  %63 = load ptr, ptr @pubkey_filename, align 8, !tbaa !11
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %68

65:                                               ; preds = %62
  %66 = load ptr, ptr @bio_err, align 8, !tbaa !11
  %67 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %66, ptr noundef @.str.21)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %90

68:                                               ; preds = %62, %59
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %80

71:                                               ; preds = %68
  %72 = load ptr, ptr @eecert_filename, align 8, !tbaa !11
  %73 = icmp eq ptr %72, null
  br i1 %73, label %77, label %74

74:                                               ; preds = %71
  %75 = load ptr, ptr @cacert_filename, align 8, !tbaa !11
  %76 = icmp eq ptr %75, null
  br i1 %76, label %77, label %80

77:                                               ; preds = %74, %71
  %78 = load ptr, ptr @bio_err, align 8, !tbaa !11
  %79 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %78, ptr noundef @.str.22)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %90

80:                                               ; preds = %74, %68
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %85

84:                                               ; preds = %81
  call void @add_test(ptr noundef @.str.23, ptr noundef @test_x509_files)
  br label %85

85:                                               ; preds = %84, %81
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %85
  call void @add_test(ptr noundef @.str.24, ptr noundef @test_spki_file)
  br label %89

89:                                               ; preds = %88, %85
  store i32 1, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %90

90:                                               ; preds = %89, %77, %65, %38, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  %91 = load i32, ptr %1, align 4
  ret i32 %91
}

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

declare i32 @opt_next() #2

declare i32 @BIO_printf(ptr noundef, ptr noundef, ...) #2

declare i64 @test_get_argument_count() #2

declare ptr @test_get_argument(i64 noundef) #2

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

; Function Attrs: nounwind uwtable
declare hidden i32 @test_x509_files() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_spki_file() #0

; 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"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"

@bio_err = external local_unnamed_addr global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [33 x i8], align 1
@pubkey_filename = external hidden local_unnamed_addr global ptr, align 8
@eecert_filename = external hidden local_unnamed_addr global ptr, align 8
@cacert_filename = external hidden local_unnamed_addr global ptr, align 8
@.str.21 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @setup_tests() local_unnamed_addr #0 {
  br label %1

1:                                                ; preds = %.backedge, %0
  %.022 = phi i32 [ 0, %0 ], [ %.022.be, %.backedge ]
  %.0 = phi i32 [ 0, %0 ], [ %.0.be, %.backedge ]
  %2 = tail call i32 @opt_next() #2
  switch i32 %2, label %.loopexit [
    i32 0, label %5
    i32 1, label %3
    i32 2, label %4
    i32 500, label %.backedge
    i32 501, label %.backedge
    i32 502, label %.backedge
    i32 503, label %.backedge
    i32 504, label %.backedge
    i32 505, label %.backedge
  ]

.backedge:                                        ; preds = %1, %1, %1, %1, %1, %1, %4, %3
  %.022.be = phi i32 [ %.022, %4 ], [ 1, %3 ], [ %.022, %1 ], [ %.022, %1 ], [ %.022, %1 ], [ %.022, %1 ], [ %.022, %1 ], [ %.022, %1 ]
  %.0.be = phi i32 [ 1, %4 ], [ %.0, %3 ], [ %.0, %1 ], [ %.0, %1 ], [ %.0, %1 ], [ %.0, %1 ], [ %.0, %1 ], [ %.0, %1 ]
  br label %1, !llvm.loop !5

3:                                                ; preds = %1
  br label %.backedge

4:                                                ; preds = %1
  br label %.backedge

5:                                                ; preds = %1
  %6 = add nuw nsw i32 %.0, %.022
  switch i32 %6, label %10 [
    i32 0, label %7
    i32 1, label %13
  ]

7:                                                ; preds = %5
  %8 = load ptr, ptr @bio_err, align 8, !tbaa !7
  %9 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %8, ptr noundef nonnull @.str.19) #2
  br label %.loopexit

10:                                               ; preds = %5
  %11 = load ptr, ptr @bio_err, align 8, !tbaa !7
  %12 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %11, ptr noundef nonnull @.str.20) #2
  br label %.loopexit

13:                                               ; preds = %5
  %14 = tail call i64 @test_get_argument_count() #2
  %15 = trunc i64 %14 to i32
  %16 = icmp ne i32 %.0, 0
  %17 = icmp eq i32 %15, 1
  %or.cond = select i1 %16, i1 %17, i1 false
  br i1 %or.cond, label %.sink.split, label %18

18:                                               ; preds = %13
  %19 = icmp ne i32 %.022, 0
  %20 = icmp eq i32 %15, 2
  %or.cond3 = select i1 %19, i1 %20, i1 false
  br i1 %or.cond3, label %21, label %24

21:                                               ; preds = %18
  %22 = tail call ptr @test_get_argument(i64 noundef 0) #2
  store ptr %22, ptr @eecert_filename, align 8, !tbaa !7
  br label %.sink.split

.sink.split:                                      ; preds = %13, %21
  %.sink36 = phi i64 [ 1, %21 ], [ 0, %13 ]
  %cacert_filename.sink = phi ptr [ @cacert_filename, %21 ], [ @pubkey_filename, %13 ]
  %23 = tail call ptr @test_get_argument(i64 noundef %.sink36) #2
  store ptr %23, ptr %cacert_filename.sink, align 8, !tbaa !7
  br label %24

24:                                               ; preds = %.sink.split, %18
  %25 = load ptr, ptr @pubkey_filename, align 8
  %26 = icmp eq ptr %25, null
  %or.cond5 = select i1 %16, i1 %26, i1 false
  br i1 %or.cond5, label %27, label %30

27:                                               ; preds = %24
  %28 = load ptr, ptr @bio_err, align 8, !tbaa !7
  %29 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %28, ptr noundef nonnull @.str.21) #2
  br label %.loopexit

30:                                               ; preds = %24
  %.not29 = icmp eq i32 %.022, 0
  br i1 %.not29, label %.critedge, label %31

31:                                               ; preds = %30
  %32 = load ptr, ptr @eecert_filename, align 8, !tbaa !7
  %33 = icmp eq ptr %32, null
  %34 = load ptr, ptr @cacert_filename, align 8
  %35 = icmp eq ptr %34, null
  %or.cond7 = select i1 %33, i1 true, i1 %35
  br i1 %or.cond7, label %36, label %39

36:                                               ; preds = %31
  %37 = load ptr, ptr @bio_err, align 8, !tbaa !7
  %38 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %37, ptr noundef nonnull @.str.22) #2
  br label %.loopexit

39:                                               ; preds = %31
  tail call void @add_test(ptr noundef nonnull @.str.23, ptr noundef nonnull @test_x509_files) #2
  br label %.critedge

.critedge:                                        ; preds = %30, %39
  br i1 %16, label %40, label %.loopexit

40:                                               ; preds = %.critedge
  tail call void @add_test(ptr noundef nonnull @.str.24, ptr noundef nonnull @test_spki_file) #2
  br label %.loopexit

.loopexit:                                        ; preds = %1, %7, %10, %.critedge, %40, %36, %27
  %.024 = phi i32 [ 0, %27 ], [ 0, %36 ], [ 1, %40 ], [ 1, %.critedge ], [ 0, %10 ], [ 0, %7 ], [ 0, %1 ]
  ret i32 %.024
}

declare i32 @opt_next() local_unnamed_addr #1

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

declare i64 @test_get_argument_count() local_unnamed_addr #1

declare ptr @test_get_argument(i64 noundef) local_unnamed_addr #1

declare void @add_test(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @test_x509_files() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_spki_file() #0

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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass