; LLVM IR from thekyria/elabtsaot2 :: auxiliary/sha1/sha1.ll (ZN9elabtsaot4SHA16ResultEPj)

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

%"class.elabtsaot::SHA1" = type <{ ptr, [5 x i32], i32, i32, [64 x i8], i32, i8, i8, [6 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9elabtsaot4SHA16ResultEPj(ptr noundef nonnull align 8 dereferenceable(106) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %9 = getelementptr inbounds %"class.elabtsaot::SHA1", ptr %8, i32 0, i32 7
  %10 = load i8, ptr %9, align 1, !tbaa !9, !range !13, !noundef !14
  %11 = trunc i8 %10 to i1
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %37

13:                                               ; preds = %2
  %14 = getelementptr inbounds %"class.elabtsaot::SHA1", ptr %8, i32 0, i32 6
  %15 = load i8, ptr %14, align 8, !tbaa !15, !range !13, !noundef !14
  %16 = trunc i8 %15 to i1
  br i1 %16, label %19, label %17

17:                                               ; preds = %13
  call void @_ZN9elabtsaot4SHA110PadMessageEv(ptr noundef nonnull align 8 dereferenceable(106) %8)
  %18 = getelementptr inbounds %"class.elabtsaot::SHA1", ptr %8, i32 0, i32 6
  store i8 1, ptr %18, align 8, !tbaa !15
  br label %19

19:                                               ; preds = %17, %13
  store i32 0, ptr %6, align 4, !tbaa !16
  br label %20

20:                                               ; preds = %33, %19
  %21 = load i32, ptr %6, align 4, !tbaa !16
  %22 = icmp slt i32 %21, 5
  br i1 %22, label %23, label %36

23:                                               ; preds = %20
  %24 = getelementptr inbounds %"class.elabtsaot::SHA1", ptr %8, i32 0, i32 1
  %25 = load i32, ptr %6, align 4, !tbaa !16
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [5 x i32], ptr %24, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load i32, ptr %6, align 4, !tbaa !16
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %29, i64 %31
  store i32 %28, ptr %32, align 4, !tbaa !16
  br label %33

33:                                               ; preds = %23
  %34 = load i32, ptr %6, align 4, !tbaa !16
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %6, align 4, !tbaa !16
  br label %20, !llvm.loop !17

36:                                               ; preds = %20
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %37

37:                                               ; preds = %36, %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %38 = load i1, ptr %3, align 1
  ret i1 %38
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9elabtsaot4SHA110PadMessageEv(ptr noundef nonnull align 8 dereferenceable(106)) #0 align 2

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

attributes #0 = { mustprogress 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++ TBAA"}
!9 = !{!10, !12, i64 105}
!10 = !{!"_ZTSN9elabtsaot4SHA1E", !7, i64 8, !11, i64 28, !11, i64 32, !7, i64 36, !11, i64 100, !12, i64 104, !12, i64 105}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!10, !12, i64 104}
!16 = !{!11, !11, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9elabtsaot4SHA16ResultEPj(ptr noundef nonnull align 8 dereferenceable(106) %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 105
  %4 = load i8, ptr %3, align 1, !tbaa !5, !range !11, !noundef !12
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %.loopexit, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 104
  %8 = load i8, ptr %7, align 8, !tbaa !13, !range !11, !noundef !12
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %.loopexit.loopexit, label %10

10:                                               ; preds = %6
  tail call void @_ZN9elabtsaot4SHA110PadMessageEv(ptr noundef nonnull align 8 dereferenceable(106) %0)
  store i8 1, ptr %7, align 8, !tbaa !13
  br label %.loopexit.loopexit

.loopexit.loopexit:                               ; preds = %10, %6
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load i32, ptr %11, align 8, !tbaa !14
  store i32 %12, ptr %1, align 4, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load i32, ptr %13, align 4, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %1, i64 4
  store i32 %14, ptr %15, align 4, !tbaa !14
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = load i32, ptr %16, align 8, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 %17, ptr %18, align 4, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %0, i64 20
  %20 = load i32, ptr %19, align 4, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %1, i64 12
  store i32 %20, ptr %21, align 4, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  %23 = load i32, ptr %22, align 8, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 %23, ptr %24, align 4, !tbaa !14
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %2
  %.06 = xor i1 %5, true
  ret i1 %.06
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9elabtsaot4SHA110PadMessageEv(ptr noundef nonnull align 8 dereferenceable(106)) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress 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, !10, i64 105}
!6 = !{!"_ZTSN9elabtsaot4SHA1E", !7, i64 8, !9, i64 28, !9, i64 32, !7, i64 36, !9, i64 100, !10, i64 104, !10, i64 105}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!6, !10, i64 104}
!14 = !{!9, !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass