; LLVM IR from TheAlgorithms/C-Plus-Plus :: hashing (sha256)

; 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.std::array" = type { [64 x i32] }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef, i64 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7hashing6sha25629create_message_schedule_arrayERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 4 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %1, ptr %4, align 8, !tbaa !5
  store i64 %2, ptr %5, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 256, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %10

10:                                               ; preds = %54, %3
  %11 = load i64, ptr %6, align 8, !tbaa !9
  %12 = icmp ult i64 %11, 16
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %57

14:                                               ; preds = %10
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load i64, ptr %5, align 8, !tbaa !9
  %17 = load i64, ptr %6, align 8, !tbaa !9
  %18 = mul i64 %17, 4
  %19 = add i64 %16, %18
  %20 = call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %15, i64 noundef %19)
  %21 = zext i8 %20 to i32
  %22 = shl i32 %21, 24
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load i64, ptr %5, align 8, !tbaa !9
  %25 = load i64, ptr %6, align 8, !tbaa !9
  %26 = mul i64 %25, 4
  %27 = add i64 %24, %26
  %28 = add i64 %27, 1
  %29 = call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %23, i64 noundef %28)
  %30 = zext i8 %29 to i32
  %31 = shl i32 %30, 16
  %32 = or i32 %22, %31
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = load i64, ptr %5, align 8, !tbaa !9
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = mul i64 %35, 4
  %37 = add i64 %34, %36
  %38 = add i64 %37, 2
  %39 = call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %33, i64 noundef %38)
  %40 = zext i8 %39 to i32
  %41 = shl i32 %40, 8
  %42 = or i32 %32, %41
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load i64, ptr %5, align 8, !tbaa !9
  %45 = load i64, ptr %6, align 8, !tbaa !9
  %46 = mul i64 %45, 4
  %47 = add i64 %44, %46
  %48 = add i64 %47, 3
  %49 = call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %43, i64 noundef %48)
  %50 = zext i8 %49 to i32
  %51 = or i32 %42, %50
  %52 = load i64, ptr %6, align 8, !tbaa !9
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %52) #4
  store i32 %51, ptr %53, align 4, !tbaa !11
  br label %54

54:                                               ; preds = %14
  %55 = load i64, ptr %6, align 8, !tbaa !9
  %56 = add i64 %55, 1
  store i64 %56, ptr %6, align 8, !tbaa !9
  br label %10, !llvm.loop !13

57:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 16, ptr %7, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %112, %57
  %59 = load i64, ptr %7, align 8, !tbaa !9
  %60 = icmp ult i64 %59, 64
  br i1 %60, label %62, label %61

61:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %115

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %63 = load i64, ptr %7, align 8, !tbaa !9
  %64 = sub i64 %63, 15
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %64) #4
  %66 = load i32, ptr %65, align 4, !tbaa !11
  %67 = call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %66, i64 noundef 7)
  %68 = load i64, ptr %7, align 8, !tbaa !9
  %69 = sub i64 %68, 15
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %69) #4
  %71 = load i32, ptr %70, align 4, !tbaa !11
  %72 = call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %71, i64 noundef 18)
  %73 = xor i32 %67, %72
  %74 = load i64, ptr %7, align 8, !tbaa !9
  %75 = sub i64 %74, 15
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %75) #4
  %77 = load i32, ptr %76, align 4, !tbaa !11
  %78 = lshr i32 %77, 3
  %79 = xor i32 %73, %78
  store i32 %79, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %80 = load i64, ptr %7, align 8, !tbaa !9
  %81 = sub i64 %80, 2
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %81) #4
  %83 = load i32, ptr %82, align 4, !tbaa !11
  %84 = call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %83, i64 noundef 17)
  %85 = load i64, ptr %7, align 8, !tbaa !9
  %86 = sub i64 %85, 2
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %86) #4
  %88 = load i32, ptr %87, align 4, !tbaa !11
  %89 = call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %88, i64 noundef 19)
  %90 = xor i32 %84, %89
  %91 = load i64, ptr %7, align 8, !tbaa !9
  %92 = sub i64 %91, 2
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %92) #4
  %94 = load i32, ptr %93, align 4, !tbaa !11
  %95 = lshr i32 %94, 10
  %96 = xor i32 %90, %95
  store i32 %96, ptr %9, align 4, !tbaa !11
  %97 = load i64, ptr %7, align 8, !tbaa !9
  %98 = sub i64 %97, 16
  %99 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %98) #4
  %100 = load i32, ptr %99, align 4, !tbaa !11
  %101 = load i32, ptr %8, align 4, !tbaa !11
  %102 = add i32 %100, %101
  %103 = load i64, ptr %7, align 8, !tbaa !9
  %104 = sub i64 %103, 7
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %104) #4
  %106 = load i32, ptr %105, align 4, !tbaa !11
  %107 = add i32 %102, %106
  %108 = load i32, ptr %9, align 4, !tbaa !11
  %109 = add i32 %107, %108
  %110 = load i64, ptr %7, align 8, !tbaa !9
  %111 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %110) #4
  store i32 %109, ptr %111, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %112

112:                                              ; preds = %62
  %113 = load i64, ptr %7, align 8, !tbaa !9
  %114 = add i64 %113, 1
  store i64 %114, ptr %7, align 8, !tbaa !9
  br label %58, !llvm.loop !15

115:                                              ; preds = %61
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256), i64 noundef) #0 align 2

attributes #0 = { mustprogress 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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

%"struct.std::array" = type { [64 x i32] }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7hashing6sha25629create_message_schedule_arrayERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 4 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2) local_unnamed_addr #1 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(256) %0, i8 0, i64 256, i1 false)
  br label %4

4:                                                ; preds = %3, %4
  %.028 = phi i64 [ 0, %3 ], [ %25, %4 ]
  %5 = shl nuw nsw i64 %.028, 2
  %6 = add i64 %5, %2
  %7 = tail call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %6)
  %8 = zext i8 %7 to i32
  %9 = shl nuw i32 %8, 24
  %10 = add i64 %6, 1
  %11 = tail call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %10)
  %12 = zext i8 %11 to i32
  %13 = shl nuw nsw i32 %12, 16
  %14 = or disjoint i32 %13, %9
  %15 = add i64 %6, 2
  %16 = tail call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %15)
  %17 = zext i8 %16 to i32
  %18 = shl nuw nsw i32 %17, 8
  %19 = or disjoint i32 %14, %18
  %20 = add i64 %6, 3
  %21 = tail call noundef signext i8 @_ZN7hashing6sha2568get_charERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %20)
  %22 = zext i8 %21 to i32
  %23 = or disjoint i32 %19, %22
  %24 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %.028) #3
  store i32 %23, ptr %24, align 4, !tbaa !5
  %25 = add nuw nsw i64 %.028, 1
  %exitcond.not = icmp eq i64 %25, 16
  br i1 %exitcond.not, label %.preheader, label %4, !llvm.loop !9

26:                                               ; preds = %.preheader
  ret void

.preheader:                                       ; preds = %4, %.preheader
  %.02729 = phi i64 [ %61, %.preheader ], [ 16, %4 ]
  %27 = add nsw i64 %.02729, -15
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %27) #3
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = tail call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %29, i64 noundef 7)
  %31 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %27) #3
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = tail call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %32, i64 noundef 18)
  %34 = xor i32 %33, %30
  %35 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %27) #3
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = lshr i32 %36, 3
  %38 = xor i32 %34, %37
  %39 = add nsw i64 %.02729, -2
  %40 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %39) #3
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = tail call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %41, i64 noundef 17)
  %43 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %39) #3
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = tail call noundef i32 @_ZN7hashing6sha25612right_rotateEjm(i32 noundef %44, i64 noundef 19)
  %46 = xor i32 %45, %42
  %47 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %39) #3
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = lshr i32 %48, 10
  %50 = xor i32 %46, %49
  %51 = add nsw i64 %.02729, -16
  %52 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %51) #3
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = add i32 %53, %38
  %55 = add nsw i64 %.02729, -7
  %56 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %55) #3
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add i32 %54, %50
  %59 = add i32 %58, %57
  %60 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256) %0, i64 noundef %.02729) #3
  store i32 %59, ptr %60, align 4, !tbaa !5
  %61 = add nuw nsw i64 %.02729, 1
  %exitcond30.not = icmp eq i64 %61, 64
  br i1 %exitcond30.not, label %26, label %.preheader, !llvm.loop !11
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm64EEixEm(ptr noundef nonnull align 4 dereferenceable(256), i64 noundef) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass