; LLVM IR from cryptid-org/cryptid-native :: dependencies/sha/src (sha)

; 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.SHA1Context = type { [5 x i32], i32, i32, i16, [64 x i8], i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @SHA1Reset(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 ne ptr %4, null
  br i1 %5, label %7, label %6

6:                                                ; preds = %1
  store i32 1, ptr %2, align 4
  br label %33

7:                                                ; preds = %1
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.SHA1Context, ptr %8, i32 0, i32 2
  store i32 0, ptr %9, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.SHA1Context, ptr %10, i32 0, i32 1
  store i32 0, ptr %11, align 4, !tbaa !13
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.SHA1Context, ptr %12, i32 0, i32 3
  store i16 0, ptr %13, align 4, !tbaa !14
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.SHA1Context, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds [5 x i32], ptr %15, i64 0, i64 0
  store i32 1732584193, ptr %16, align 4, !tbaa !15
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.SHA1Context, ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds [5 x i32], ptr %18, i64 0, i64 1
  store i32 -271733879, ptr %19, align 4, !tbaa !15
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.SHA1Context, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds [5 x i32], ptr %21, i64 0, i64 2
  store i32 -1732584194, ptr %22, align 4, !tbaa !15
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.SHA1Context, ptr %23, i32 0, i32 0
  %25 = getelementptr inbounds [5 x i32], ptr %24, i64 0, i64 3
  store i32 271733878, ptr %25, align 4, !tbaa !15
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.SHA1Context, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds [5 x i32], ptr %27, i64 0, i64 4
  store i32 -1009589776, ptr %28, align 4, !tbaa !15
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.SHA1Context, ptr %29, i32 0, i32 5
  store i32 0, ptr %30, align 4, !tbaa !16
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.SHA1Context, ptr %31, i32 0, i32 6
  store i32 0, ptr %32, align 4, !tbaa !17
  store i32 0, ptr %2, align 4
  br label %33

33:                                               ; preds = %7, %6
  %34 = load i32, ptr %2, align 4
  ret i32 %34
}

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

!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 24}
!10 = !{!"SHA1Context", !7, i64 0, !11, i64 20, !11, i64 24, !12, i64 28, !7, i64 30, !11, i64 96, !11, i64 100}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!10, !11, i64 20}
!14 = !{!10, !12, i64 28}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 96}
!17 = !{!10, !11, i64 100}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local range(i32 0, 2) i32 @SHA1Reset(ptr noundef writeonly %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %9, label %2

2:                                                ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 0, ptr %3, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 0, ptr %4, align 4, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %0, i64 28
  store i16 0, ptr %5, align 4, !tbaa !12
  store <4 x i32> <i32 1732584193, i32 -271733879, i32 -1732584194, i32 271733878>, ptr %0, align 4, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 -1009589776, ptr %6, align 4, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  store i32 0, ptr %7, align 4, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %0, i64 100
  store i32 0, ptr %8, align 4, !tbaa !15
  br label %9

9:                                                ; preds = %1, %2
  %.0 = phi i32 [ 0, %2 ], [ 1, %1 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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" }

!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, !9, i64 24}
!6 = !{!"SHA1Context", !7, i64 0, !9, i64 20, !9, i64 24, !10, i64 28, !7, i64 30, !9, i64 96, !9, i64 100}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!6, !9, i64 20}
!12 = !{!6, !10, i64 28}
!13 = !{!9, !9, i64 0}
!14 = !{!6, !9, i64 96}
!15 = !{!6, !9, i64 100}


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