; LLVM IR from intel/intel-ipsec-mb :: test/imb-provider (prov_sw_sha2)

; 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.prov_sha2_st = type { [8 x i64], i64, i64, i64, i64, i64, %union.anon, i32, i32, i32, ptr, ptr, [64 x i8], ptr, ptr }
%union.anon = type { [99999999 x i8] }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @mb_prov_SHA2_init(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp eq ptr null, %4
  br i1 %5, label %6, label %9

6:                                                ; preds = %1
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef @.str) #2
  store i32 0, ptr %2, align 4
  br label %42

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.prov_sha2_st, ptr %10, i32 0, i32 9
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = icmp eq i32 %12, 675
  br i1 %13, label %14, label %17

14:                                               ; preds = %9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.prov_sha2_st, ptr %15, i32 0, i32 8
  store i32 28, ptr %16, align 4, !tbaa !14
  store i32 1, ptr %2, align 4
  br label %42

17:                                               ; preds = %9
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.prov_sha2_st, ptr %18, i32 0, i32 9
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %21 = icmp eq i32 %20, 672
  br i1 %21, label %22, label %25

22:                                               ; preds = %17
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.prov_sha2_st, ptr %23, i32 0, i32 8
  store i32 32, ptr %24, align 4, !tbaa !14
  store i32 1, ptr %2, align 4
  br label %42

25:                                               ; preds = %17
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.prov_sha2_st, ptr %26, i32 0, i32 9
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp eq i32 %28, 673
  br i1 %29, label %30, label %33

30:                                               ; preds = %25
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.prov_sha2_st, ptr %31, i32 0, i32 8
  store i32 48, ptr %32, align 4, !tbaa !14
  store i32 1, ptr %2, align 4
  br label %42

33:                                               ; preds = %25
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.prov_sha2_st, ptr %34, i32 0, i32 9
  %36 = load i32, ptr %35, align 8, !tbaa !9
  %37 = icmp eq i32 %36, 674
  br i1 %37, label %38, label %41

38:                                               ; preds = %33
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.prov_sha2_st, ptr %39, i32 0, i32 8
  store i32 64, ptr %40, align 4, !tbaa !14
  store i32 1, ptr %2, align 4
  br label %42

41:                                               ; preds = %33
  store i32 0, ptr %2, align 4
  br label %42

42:                                               ; preds = %41, %38, %30, %22, %14, %6
  %43 = load i32, ptr %2, align 4
  ret i32 %43
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #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 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !13, i64 100000112}
!10 = !{!"prov_sha2_st", !7, i64 0, !11, i64 64, !11, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !7, i64 104, !13, i64 100000104, !13, i64 100000108, !13, i64 100000112, !6, i64 100000120, !6, i64 100000128, !7, i64 100000136, !6, i64 100000200, !6, i64 100000208}
!11 = !{!"long long", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !13, i64 100000108}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 0, 2) i32 @mb_prov_SHA2_init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %3, label %6

3:                                                ; preds = %1
  %4 = load ptr, ptr @stderr, align 8, !tbaa !5
  %5 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str) #2
  br label %17

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 100000112
  %8 = load i32, ptr %7, align 8, !tbaa !9
  switch i32 %8, label %17 [
    i32 675, label %9
    i32 672, label %11
    i32 673, label %13
    i32 674, label %15
  ]

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 100000108
  store i32 28, ptr %10, align 4, !tbaa !14
  br label %17

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %0, i64 100000108
  store i32 32, ptr %12, align 4, !tbaa !14
  br label %17

13:                                               ; preds = %6
  %14 = getelementptr inbounds i8, ptr %0, i64 100000108
  store i32 48, ptr %14, align 4, !tbaa !14
  br label %17

15:                                               ; preds = %6
  %16 = getelementptr inbounds i8, ptr %0, i64 100000108
  store i32 64, ptr %16, align 4, !tbaa !14
  br label %17

17:                                               ; preds = %6, %15, %13, %11, %9, %3
  %.0 = phi i32 [ 0, %3 ], [ 1, %9 ], [ 1, %11 ], [ 1, %13 ], [ 1, %15 ], [ 0, %6 ]
  ret i32 %.0
}

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

attributes #0 = { nofree 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 = { 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 #2 = { cold 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, !13, i64 100000112}
!10 = !{!"prov_sha2_st", !7, i64 0, !11, i64 64, !11, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !7, i64 104, !13, i64 100000104, !13, i64 100000108, !13, i64 100000112, !6, i64 100000120, !6, i64 100000128, !7, i64 100000136, !6, i64 100000200, !6, i64 100000208}
!11 = !{!"long long", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !13, i64 100000108}


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