; LLVM IR from rcliftonharvey/dspfilters4juce :: DSPFilters4JUCEDemo/JuceLibraryCode/juce_cryptography.ll (ZN4juce8BlowFishaSERKS0_)

; 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.juce::BlowFish" = type { [18 x i32], [4 x %"class.juce::HeapBlock"] }
%"class.juce::HeapBlock" = type { ptr }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPvEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 8 dereferenceable(104) ptr @_ZN4juce8BlowFishaSERKS0_(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef nonnull align 8 dereferenceable(104) %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %"class.juce::BlowFish", ptr %6, i32 0, i32 0
  %8 = getelementptr inbounds [18 x i32], ptr %7, i64 0, i64 0
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.juce::BlowFish", ptr %9, i32 0, i32 0
  %11 = getelementptr inbounds [18 x i32], ptr %10, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %11, i64 72, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 4, ptr %5, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %17, %2
  %13 = load i32, ptr %5, align 4, !tbaa !9
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %5, align 4, !tbaa !9
  %15 = icmp sge i32 %14, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %29

17:                                               ; preds = %12
  %18 = getelementptr inbounds %"class.juce::BlowFish", ptr %6, i32 0, i32 1
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [4 x %"class.juce::HeapBlock"], ptr %18, i64 0, i64 %20
  %22 = call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPvEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #4
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.juce::BlowFish", ptr %23, i32 0, i32 1
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [4 x %"class.juce::HeapBlock"], ptr %24, i64 0, i64 %26
  %28 = call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPKvEv(ptr noundef nonnull align 8 dereferenceable(8) %27) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %22, ptr align 1 %28, i64 1024, i1 false)
  br label %12, !llvm.loop !11

29:                                               ; preds = %16
  ret ptr %6
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPKvEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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 nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPvEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 8 dereferenceable(104) ptr @_ZN4juce8BlowFishaSERKS0_(ptr noundef nonnull returned align 8 dereferenceable(104) %0, ptr noundef nonnull align 8 dereferenceable(104) %1) local_unnamed_addr #2 align 2 {
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(72) %1, i64 72, i1 false)
  %3 = getelementptr inbounds i8, ptr %0, i64 72
  %4 = getelementptr inbounds i8, ptr %1, i64 72
  %5 = getelementptr inbounds i8, ptr %0, i64 96
  %6 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPvEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %7 = getelementptr inbounds i8, ptr %1, i64 96
  %8 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPKvEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #3
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1024) %6, ptr noundef nonnull align 1 dereferenceable(1024) %8, i64 1024, i1 false)
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  %10 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPvEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  %11 = getelementptr inbounds i8, ptr %1, i64 88
  %12 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPKvEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1024) %10, ptr noundef nonnull align 1 dereferenceable(1024) %12, i64 1024, i1 false)
  %13 = getelementptr inbounds i8, ptr %0, i64 80
  %14 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPvEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #3
  %15 = getelementptr inbounds i8, ptr %1, i64 80
  %16 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPKvEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #3
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1024) %14, ptr noundef nonnull align 1 dereferenceable(1024) %16, i64 1024, i1 false)
  %17 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPvEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %18 = tail call noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPKvEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1024) %17, ptr noundef nonnull align 1 dereferenceable(1024) %18, i64 1024, i1 false)
  ret ptr %0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce9HeapBlockIjLb0EEcvPKvEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { 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 #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)"}


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