; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/juce_audio_basics.ll (ZN4juce15MidiRPNDetector5resetEv)

; 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::MidiRPNDetector" = type { [16 x %"struct.juce::MidiRPNDetector::ChannelState"] }
%"struct.juce::MidiRPNDetector::ChannelState" = type { i8, i8, i8, i8, 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 nounwind uwtable
define dso_local void @_ZN4juce15MidiRPNDetector5resetEv(ptr noundef nonnull align 1 dereferenceable(80) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %29, %1
  %6 = load i32, ptr %3, align 4, !tbaa !9
  %7 = icmp slt i32 %6, 16
  br i1 %7, label %9, label %8

8:                                                ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  br label %32

9:                                                ; preds = %5
  %10 = getelementptr inbounds %"class.juce::MidiRPNDetector", ptr %4, i32 0, i32 0
  %11 = load i32, ptr %3, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [16 x %"struct.juce::MidiRPNDetector::ChannelState"], ptr %10, i64 0, i64 %12
  %14 = getelementptr inbounds %"struct.juce::MidiRPNDetector::ChannelState", ptr %13, i32 0, i32 0
  store i8 -1, ptr %14, align 1, !tbaa !11
  %15 = getelementptr inbounds %"class.juce::MidiRPNDetector", ptr %4, i32 0, i32 0
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [16 x %"struct.juce::MidiRPNDetector::ChannelState"], ptr %15, i64 0, i64 %17
  %19 = getelementptr inbounds %"struct.juce::MidiRPNDetector::ChannelState", ptr %18, i32 0, i32 1
  store i8 -1, ptr %19, align 1, !tbaa !14
  %20 = getelementptr inbounds %"class.juce::MidiRPNDetector", ptr %4, i32 0, i32 0
  %21 = load i32, ptr %3, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [16 x %"struct.juce::MidiRPNDetector::ChannelState"], ptr %20, i64 0, i64 %22
  call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %23) #2
  %24 = getelementptr inbounds %"class.juce::MidiRPNDetector", ptr %4, i32 0, i32 0
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [16 x %"struct.juce::MidiRPNDetector::ChannelState"], ptr %24, i64 0, i64 %26
  %28 = getelementptr inbounds %"struct.juce::MidiRPNDetector::ChannelState", ptr %27, i32 0, i32 4
  store i8 0, ptr %28, align 1, !tbaa !15
  br label %29

29:                                               ; preds = %9
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %3, align 4, !tbaa !9
  br label %5, !llvm.loop !16

32:                                               ; preds = %8
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !7, i64 0}
!12 = !{!"_ZTSN4juce15MidiRPNDetector12ChannelStateE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !13, i64 4}
!13 = !{!"bool", !7, i64 0}
!14 = !{!12, !7, i64 1}
!15 = !{!12, !13, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"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 nounwind uwtable
define dso_local void @_ZN4juce15MidiRPNDetector5resetEv(ptr noundef nonnull align 1 dereferenceable(80) %0) local_unnamed_addr #0 align 2 {
  store i8 -1, ptr %0, align 1, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 1
  store i8 -1, ptr %2, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %0) #1
  %3 = getelementptr inbounds i8, ptr %0, i64 4
  store i8 0, ptr %3, align 1, !tbaa !11
  %4 = getelementptr inbounds i8, ptr %0, i64 5
  store i8 -1, ptr %4, align 1, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 6
  store i8 -1, ptr %5, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %4) #1
  %6 = getelementptr inbounds i8, ptr %0, i64 9
  store i8 0, ptr %6, align 1, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %0, i64 10
  store i8 -1, ptr %7, align 1, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 11
  store i8 -1, ptr %8, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %7) #1
  %9 = getelementptr inbounds i8, ptr %0, i64 14
  store i8 0, ptr %9, align 1, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %0, i64 15
  store i8 -1, ptr %10, align 1, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  store i8 -1, ptr %11, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %10) #1
  %12 = getelementptr inbounds i8, ptr %0, i64 19
  store i8 0, ptr %12, align 1, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %0, i64 20
  store i8 -1, ptr %13, align 1, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 21
  store i8 -1, ptr %14, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %13) #1
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  store i8 0, ptr %15, align 1, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %0, i64 25
  store i8 -1, ptr %16, align 1, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 26
  store i8 -1, ptr %17, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %16) #1
  %18 = getelementptr inbounds i8, ptr %0, i64 29
  store i8 0, ptr %18, align 1, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %0, i64 30
  store i8 -1, ptr %19, align 1, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 31
  store i8 -1, ptr %20, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %19) #1
  %21 = getelementptr inbounds i8, ptr %0, i64 34
  store i8 0, ptr %21, align 1, !tbaa !11
  %22 = getelementptr inbounds i8, ptr %0, i64 35
  store i8 -1, ptr %22, align 1, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %0, i64 36
  store i8 -1, ptr %23, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %22) #1
  %24 = getelementptr inbounds i8, ptr %0, i64 39
  store i8 0, ptr %24, align 1, !tbaa !11
  %25 = getelementptr inbounds i8, ptr %0, i64 40
  store i8 -1, ptr %25, align 1, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 41
  store i8 -1, ptr %26, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %25) #1
  %27 = getelementptr inbounds i8, ptr %0, i64 44
  store i8 0, ptr %27, align 1, !tbaa !11
  %28 = getelementptr inbounds i8, ptr %0, i64 45
  store i8 -1, ptr %28, align 1, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %0, i64 46
  store i8 -1, ptr %29, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %28) #1
  %30 = getelementptr inbounds i8, ptr %0, i64 49
  store i8 0, ptr %30, align 1, !tbaa !11
  %31 = getelementptr inbounds i8, ptr %0, i64 50
  store i8 -1, ptr %31, align 1, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %0, i64 51
  store i8 -1, ptr %32, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %31) #1
  %33 = getelementptr inbounds i8, ptr %0, i64 54
  store i8 0, ptr %33, align 1, !tbaa !11
  %34 = getelementptr inbounds i8, ptr %0, i64 55
  store i8 -1, ptr %34, align 1, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %0, i64 56
  store i8 -1, ptr %35, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %34) #1
  %36 = getelementptr inbounds i8, ptr %0, i64 59
  store i8 0, ptr %36, align 1, !tbaa !11
  %37 = getelementptr inbounds i8, ptr %0, i64 60
  store i8 -1, ptr %37, align 1, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %0, i64 61
  store i8 -1, ptr %38, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %37) #1
  %39 = getelementptr inbounds i8, ptr %0, i64 64
  store i8 0, ptr %39, align 1, !tbaa !11
  %40 = getelementptr inbounds i8, ptr %0, i64 65
  store i8 -1, ptr %40, align 1, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %0, i64 66
  store i8 -1, ptr %41, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %40) #1
  %42 = getelementptr inbounds i8, ptr %0, i64 69
  store i8 0, ptr %42, align 1, !tbaa !11
  %43 = getelementptr inbounds i8, ptr %0, i64 70
  store i8 -1, ptr %43, align 1, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %0, i64 71
  store i8 -1, ptr %44, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %43) #1
  %45 = getelementptr inbounds i8, ptr %0, i64 74
  store i8 0, ptr %45, align 1, !tbaa !11
  %46 = getelementptr inbounds i8, ptr %0, i64 75
  store i8 -1, ptr %46, align 1, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %0, i64 76
  store i8 -1, ptr %47, align 1, !tbaa !10
  tail call void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5) %46) #1
  %48 = getelementptr inbounds i8, ptr %0, i64 79
  store i8 0, ptr %48, align 1, !tbaa !11
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce15MidiRPNDetector12ChannelState10resetValueEv(ptr noundef nonnull align 1 dereferenceable(5)) 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 = { 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, !7, i64 0}
!6 = !{!"_ZTSN4juce15MidiRPNDetector12ChannelStateE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"bool", !7, i64 0}
!10 = !{!6, !7, i64 1}
!11 = !{!6, !9, i64 4}


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