; LLVM IR from dynexcoin/Dynex :: src/DynexCNCore/Core.ll (ZN7DynexCN4core15slow_hash_paramB5cxx11Ei)

; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7DynexCN4core15slow_hash_paramB5cxx11Ei(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull align 8 dereferenceable(3632) %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca [76 x i8], align 16
  %8 = alloca [32 x i8], align 16
  %9 = alloca i64, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 76, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %11

11:                                               ; preds = %23, %3
  %12 = load i64, ptr %9, align 8, !tbaa !11
  %13 = icmp ult i64 %12, 76
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %26

15:                                               ; preds = %11
  %16 = load i64, ptr %9, align 8, !tbaa !11
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = add i64 %16, %18
  %20 = trunc i64 %19 to i8
  %21 = load i64, ptr %9, align 8, !tbaa !11
  %22 = getelementptr inbounds [76 x i8], ptr %7, i64 0, i64 %21
  store i8 %20, ptr %22, align 1, !tbaa !13
  br label %23

23:                                               ; preds = %15
  %24 = load i64, ptr %9, align 8, !tbaa !11
  %25 = add i64 %24, 1
  store i64 %25, ptr %9, align 8, !tbaa !11
  br label %11, !llvm.loop !14

26:                                               ; preds = %14
  %27 = getelementptr inbounds [76 x i8], ptr %7, i64 0, i64 0
  %28 = getelementptr inbounds [32 x i8], ptr %8, i64 0, i64 0
  call void @cn_slow_hash(ptr noundef %27, i64 noundef 76, ptr noundef %28)
  %29 = getelementptr inbounds [32 x i8], ptr %8, i64 0, i64 0
  call void @_ZN6Common5toHexB5cxx11EPKvm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef %29, i64 noundef 32)
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 76, ptr %7) #3
  ret void
}

declare void @cn_slow_hash(ptr noundef, i64 noundef, ptr noundef) #2

declare void @_ZN6Common5toHexB5cxx11EPKvm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7DynexCN4core15slow_hash_paramB5cxx11Ei(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(3632) %1, i32 noundef %2) local_unnamed_addr #1 align 2 {
iter.check:
  %3 = alloca [76 x i8], align 16
  %4 = alloca [32 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 76, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #3
  %5 = zext i32 %2 to i64
  %broadcast.splatinsert = insertelement <16 x i64> poison, i64 %5, i64 0
  %broadcast.splat = shufflevector <16 x i64> %broadcast.splatinsert, <16 x i64> poison, <16 x i32> zeroinitializer
  %6 = trunc <16 x i64> %broadcast.splat to <16 x i8>
  %7 = add <16 x i8> %6, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>
  store <16 x i8> %7, ptr %3, align 16, !tbaa !5
  %8 = trunc <16 x i64> %broadcast.splat to <16 x i8>
  %9 = add <16 x i8> %8, <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>
  %10 = getelementptr inbounds i8, ptr %3, i64 16
  store <16 x i8> %9, ptr %10, align 16, !tbaa !5
  %11 = trunc <16 x i64> %broadcast.splat to <16 x i8>
  %12 = add <16 x i8> %11, <i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39, i8 40, i8 41, i8 42, i8 43, i8 44, i8 45, i8 46, i8 47>
  %13 = getelementptr inbounds i8, ptr %3, i64 32
  store <16 x i8> %12, ptr %13, align 16, !tbaa !5
  %14 = trunc <16 x i64> %broadcast.splat to <16 x i8>
  %15 = add <16 x i8> %14, <i8 48, i8 49, i8 50, i8 51, i8 52, i8 53, i8 54, i8 55, i8 56, i8 57, i8 58, i8 59, i8 60, i8 61, i8 62, i8 63>
  %16 = getelementptr inbounds i8, ptr %3, i64 48
  store <16 x i8> %15, ptr %16, align 16, !tbaa !5
  %17 = trunc i32 %2 to i8
  %18 = insertelement <8 x i8> poison, i8 %17, i64 0
  %19 = shufflevector <8 x i8> %18, <8 x i8> poison, <8 x i32> zeroinitializer
  %20 = add <8 x i8> %19, <i8 64, i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71>
  %21 = getelementptr inbounds i8, ptr %3, i64 64
  store <8 x i8> %20, ptr %21, align 16, !tbaa !5
  %22 = trunc i32 %2 to i8
  %23 = add i8 %22, 72
  %24 = getelementptr inbounds i8, ptr %3, i64 72
  store i8 %23, ptr %24, align 8, !tbaa !5
  %25 = trunc i32 %2 to i8
  %26 = add i8 %25, 73
  %27 = getelementptr inbounds i8, ptr %3, i64 73
  store i8 %26, ptr %27, align 1, !tbaa !5
  %28 = trunc i32 %2 to i8
  %29 = add i8 %28, 74
  %30 = getelementptr inbounds i8, ptr %3, i64 74
  store i8 %29, ptr %30, align 2, !tbaa !5
  %31 = trunc i32 %2 to i8
  %32 = add i8 %31, 75
  %33 = getelementptr inbounds i8, ptr %3, i64 75
  store i8 %32, ptr %33, align 1, !tbaa !5
  call void @cn_slow_hash(ptr noundef nonnull %3, i64 noundef 76, ptr noundef nonnull %4)
  call void @_ZN6Common5toHexB5cxx11EPKvm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull %4, i64 noundef 32)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 76, ptr nonnull %3) #3
  ret void
}

declare void @cn_slow_hash(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare void @_ZN6Common5toHexB5cxx11EPKvm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef, i64 noundef) local_unnamed_addr #2

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass