; LLVM IR from china-hai/yd_crypto :: src/hash (yd_sha224)

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @yd_sha224(ptr noundef %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca [64 x i8], align 16
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca [64 x i32], align 16
  %13 = alloca [8 x i32], align 16
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 256, ptr %12) #2
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #2
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = icmp ugt i32 %15, 536870911
  br i1 %16, label %17, label %18

17:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %80

18:                                               ; preds = %3
  %19 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %19, ptr %11, align 4, !tbaa !9
  %20 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 0
  store i32 -1056596264, ptr %20, align 16, !tbaa !9
  %21 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 1
  store i32 914150663, ptr %21, align 4, !tbaa !9
  %22 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 2
  store i32 812702999, ptr %22, align 8, !tbaa !9
  %23 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 3
  store i32 -150054599, ptr %23, align 4, !tbaa !9
  %24 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 4
  store i32 -4191439, ptr %24, align 16, !tbaa !9
  %25 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 5
  store i32 1750603025, ptr %25, align 4, !tbaa !9
  %26 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 6
  store i32 1694076839, ptr %26, align 8, !tbaa !9
  %27 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 7
  store i32 -1090891868, ptr %27, align 4, !tbaa !9
  store i8 1, ptr %8, align 1, !tbaa !11
  br label %28

28:                                               ; preds = %46, %18
  %29 = load i8, ptr %8, align 1, !tbaa !11
  %30 = zext i8 %29 to i32
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %51

32:                                               ; preds = %28
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = load i32, ptr %11, align 4, !tbaa !9
  %35 = sub i32 %33, %34
  store i32 %35, ptr %10, align 4, !tbaa !9
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds i8, ptr %36, i64 %38
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = getelementptr inbounds [64 x i8], ptr %9, i64 0, i64 0
  %42 = call zeroext i1 @padding_bits(ptr noundef %39, i32 noundef %40, ptr noundef %11, ptr noundef %41)
  %43 = zext i1 %42 to i32
  %44 = icmp eq i32 1, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %32
  store i8 0, ptr %8, align 1, !tbaa !11
  br label %46

46:                                               ; preds = %45, %32
  %47 = getelementptr inbounds [64 x i8], ptr %9, i64 0, i64 0
  %48 = getelementptr inbounds [64 x i32], ptr %12, i64 0, i64 0
  call void @prepare_wt(ptr noundef %47, ptr noundef %48)
  %49 = getelementptr inbounds [64 x i32], ptr %12, i64 0, i64 0
  %50 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 0
  call void @compute_hash_value(ptr noundef %49, ptr noundef %50)
  br label %28, !llvm.loop !12

51:                                               ; preds = %28
  %52 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 0
  %53 = load i32, ptr %52, align 16, !tbaa !9
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds i32, ptr %54, i64 0
  store i32 %53, ptr %55, align 4, !tbaa !9
  %56 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 1
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds i32, ptr %58, i64 1
  store i32 %57, ptr %59, align 4, !tbaa !9
  %60 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 2
  %61 = load i32, ptr %60, align 8, !tbaa !9
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds i32, ptr %62, i64 2
  store i32 %61, ptr %63, align 4, !tbaa !9
  %64 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 3
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds i32, ptr %66, i64 3
  store i32 %65, ptr %67, align 4, !tbaa !9
  %68 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 4
  %69 = load i32, ptr %68, align 16, !tbaa !9
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds i32, ptr %70, i64 4
  store i32 %69, ptr %71, align 4, !tbaa !9
  %72 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 5
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds i32, ptr %74, i64 5
  store i32 %73, ptr %75, align 4, !tbaa !9
  %76 = getelementptr inbounds [8 x i32], ptr %13, i64 0, i64 6
  %77 = load i32, ptr %76, align 8, !tbaa !9
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = getelementptr inbounds i32, ptr %78, i64 6
  store i32 %77, ptr %79, align 4, !tbaa !9
  store i1 true, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %80

80:                                               ; preds = %51, %17
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 256, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  %81 = load i1, ptr %4, align 1
  ret i1 %81
}

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @compute_hash_value(ptr noundef, ptr noundef) #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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
define dso_local noundef zeroext i1 @yd_sha224(ptr noundef %0, i32 noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = alloca [64 x i8], align 16
  %5 = alloca i32, align 4
  %6 = alloca [64 x i32], align 16
  %7 = alloca [8 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #2
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %6) #2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #2
  %8 = icmp ult i32 %1, 536870912
  br i1 %8, label %.critedge, label %22

.critedge:                                        ; preds = %3
  store i32 %1, ptr %5, align 4, !tbaa !5
  store <4 x i32> <i32 -1056596264, i32 914150663, i32 812702999, i32 -150054599>, ptr %7, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %7, i64 16
  %10 = getelementptr inbounds i8, ptr %7, i64 24
  store <4 x i32> <i32 -4191439, i32 1750603025, i32 1694076839, i32 -1090891868>, ptr %9, align 16, !tbaa !5
  br label %select.unfold

select.unfold:                                    ; preds = %.critedge, %select.unfold
  %11 = load i32, ptr %5, align 4, !tbaa !5
  %12 = sub i32 %1, %11
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds i8, ptr %0, i64 %13
  %15 = call zeroext i1 @padding_bits(ptr noundef %14, i32 noundef %1, ptr noundef nonnull %5, ptr noundef nonnull %4)
  call void @prepare_wt(ptr noundef nonnull %4, ptr noundef nonnull %6)
  call void @compute_hash_value(ptr noundef nonnull %6, ptr noundef nonnull %7)
  br i1 %15, label %16, label %select.unfold

16:                                               ; preds = %select.unfold
  %17 = load <4 x i32>, ptr %7, align 16, !tbaa !5
  store <4 x i32> %17, ptr %2, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %2, i64 16
  %19 = load <2 x i32>, ptr %9, align 16, !tbaa !5
  store <2 x i32> %19, ptr %18, align 4, !tbaa !5
  %20 = load i32, ptr %10, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %2, i64 24
  store i32 %20, ptr %21, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %3, %16
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #2
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #2
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #2
  ret i1 %8
}

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @padding_bits(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @prepare_wt(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @compute_hash_value(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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