; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode (juce_gui_extra)

; 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::CodeDocument::Position" = type <{ ptr, i32, i32, i32, i8, [3 x i8] }>

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(21), ptr noundef nonnull align 8 dereferenceable(21)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce12CodeDocument8Position6moveByEi(ptr noundef nonnull align 8 dereferenceable(21), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4juce12CodeDocument8Position7movedByEi(ptr dead_on_unwind noalias writable sret(%"class.juce::CodeDocument::Position") align 8, ptr noundef nonnull align 8 dereferenceable(21), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce12CodeDocument8Position14getIndexInLineEv(ptr noundef nonnull align 8 dereferenceable(21)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i32 @_ZNK4juce12CodeDocument8Position12getCharacterEv(ptr noundef nonnull align 8 dereferenceable(21)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4juce12CodeDocument19findTokenContainingERKNS0_8PositionERS1_S4_(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(21) %1, ptr noundef nonnull align 8 dereferenceable(21) %2, ptr noundef nonnull align 8 dereferenceable(21) %3) #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"class.juce::CodeDocument::Position", align 8
  %10 = alloca i1, align 1
  %11 = alloca i1, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = invoke noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(21) %14, ptr noundef nonnull align 8 dereferenceable(21) %13)
          to label %16 unwind label %50

16:                                               ; preds = %4
  br label %17

17:                                               ; preds = %23, %16
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = call noundef signext i32 @_ZNK4juce12CodeDocument8Position12getCharacterEv(ptr noundef nonnull align 8 dereferenceable(21) %18)
  %20 = call noundef zeroext i1 @_ZN4juce19CodeDocumentHelpersL16isTokenCharacterEw(i32 noundef signext %19) #4
  br i1 %20, label %21, label %24

21:                                               ; preds = %17
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN4juce12CodeDocument8Position6moveByEi(ptr noundef nonnull align 8 dereferenceable(21) %22, i32 noundef 1)
          to label %23 unwind label %50

23:                                               ; preds = %21
  br label %17, !llvm.loop !9

24:                                               ; preds = %17
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = invoke noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(21) %26, ptr noundef nonnull align 8 dereferenceable(21) %25)
          to label %28 unwind label %50

28:                                               ; preds = %24
  br label %29

29:                                               ; preds = %48, %28
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = call noundef i32 @_ZNK4juce12CodeDocument8Position14getIndexInLineEv(ptr noundef nonnull align 8 dereferenceable(21) %30) #4
  %32 = icmp sgt i32 %31, 0
  store i1 false, ptr %10, align 1
  store i1 false, ptr %11, align 1
  br i1 %32, label %33, label %38

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #4
  store i1 true, ptr %10, align 1
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZNK4juce12CodeDocument8Position7movedByEi(ptr dead_on_unwind writable sret(%"class.juce::CodeDocument::Position") align 8 %9, ptr noundef nonnull align 8 dereferenceable(21) %34, i32 noundef -1)
          to label %35 unwind label %50

35:                                               ; preds = %33
  store i1 true, ptr %11, align 1
  %36 = call noundef signext i32 @_ZNK4juce12CodeDocument8Position12getCharacterEv(ptr noundef nonnull align 8 dereferenceable(21) %9)
  %37 = call noundef zeroext i1 @_ZN4juce19CodeDocumentHelpersL16isTokenCharacterEw(i32 noundef signext %36) #4
  br label %38

38:                                               ; preds = %35, %29
  %39 = phi i1 [ false, %29 ], [ %37, %35 ]
  %40 = load i1, ptr %11, align 1
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  call void @_ZN4juce12CodeDocument8PositionD1Ev(ptr noundef nonnull align 8 dereferenceable(21) %9) #4
  br label %42

42:                                               ; preds = %41, %38
  %43 = load i1, ptr %10, align 1
  br i1 %43, label %44, label %45

44:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #4
  br label %45

45:                                               ; preds = %44, %42
  br i1 %39, label %46, label %49

46:                                               ; preds = %45
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZN4juce12CodeDocument8Position6moveByEi(ptr noundef nonnull align 8 dereferenceable(21) %47, i32 noundef -1)
          to label %48 unwind label %50

48:                                               ; preds = %46
  br label %29, !llvm.loop !11

49:                                               ; preds = %45
  ret void

50:                                               ; preds = %46, %33, %24, %21, %4
  %51 = landingpad { ptr, i32 }
          catch ptr null
  %52 = extractvalue { ptr, i32 } %51, 0
  call void @__clang_call_terminate(ptr %52) #5
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN4juce19CodeDocumentHelpersL16isTokenCharacterEw(i32 noundef signext) #3

declare void @_ZN4juce12CodeDocument8PositionD1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noinline noreturn nounwind uwtable "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 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 }
attributes #5 = { noreturn 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; 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.juce::CodeDocument::Position" = type <{ ptr, i32, i32, i32, i8, [3 x i8] }>

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(21), ptr noundef nonnull align 8 dereferenceable(21)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce12CodeDocument8Position6moveByEi(ptr noundef nonnull align 8 dereferenceable(21), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4juce12CodeDocument8Position7movedByEi(ptr dead_on_unwind noalias writable sret(%"class.juce::CodeDocument::Position") align 8, ptr noundef nonnull align 8 dereferenceable(21), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce12CodeDocument8Position14getIndexInLineEv(ptr noundef nonnull align 8 dereferenceable(21)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i32 @_ZNK4juce12CodeDocument8Position12getCharacterEv(ptr noundef nonnull align 8 dereferenceable(21)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4juce12CodeDocument19findTokenContainingERKNS0_8PositionERS1_S4_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(21) %1, ptr noundef nonnull align 8 dereferenceable(21) %2, ptr noundef nonnull align 8 dereferenceable(21) %3) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.juce::CodeDocument::Position", align 8
  %6 = invoke noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(21) %3, ptr noundef nonnull align 8 dereferenceable(21) %1)
          to label %.preheader13 unwind label %.loopexit.split-lp.loopexit.split-lp

.preheader13:                                     ; preds = %4, %9
  %7 = tail call noundef signext i32 @_ZNK4juce12CodeDocument8Position12getCharacterEv(ptr noundef nonnull align 8 dereferenceable(21) %3)
  %8 = tail call noundef zeroext i1 @_ZN4juce19CodeDocumentHelpersL16isTokenCharacterEw(i32 noundef signext %7) #4
  br i1 %8, label %9, label %10

9:                                                ; preds = %.preheader13
  invoke void @_ZN4juce12CodeDocument8Position6moveByEi(ptr noundef nonnull align 8 dereferenceable(21) %3, i32 noundef 1)
          to label %.preheader13 unwind label %.loopexit.split-lp.loopexit, !llvm.loop !5

10:                                               ; preds = %.preheader13
  %11 = invoke noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(21) %2, ptr noundef nonnull align 8 dereferenceable(21) %3)
          to label %.preheader unwind label %.loopexit.split-lp.loopexit.split-lp

.preheader:                                       ; preds = %10, %17
  %12 = call noundef i32 @_ZNK4juce12CodeDocument8Position14getIndexInLineEv(ptr noundef nonnull align 8 dereferenceable(21) %2) #4
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %14, label %.critedge.thread

14:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  invoke void @_ZNK4juce12CodeDocument8Position7movedByEi(ptr dead_on_unwind nonnull writable sret(%"class.juce::CodeDocument::Position") align 8 %5, ptr noundef nonnull align 8 dereferenceable(21) %2, i32 noundef -1)
          to label %.critedge unwind label %.loopexit

.critedge:                                        ; preds = %14
  %15 = call noundef signext i32 @_ZNK4juce12CodeDocument8Position12getCharacterEv(ptr noundef nonnull align 8 dereferenceable(21) %5)
  %16 = call noundef zeroext i1 @_ZN4juce19CodeDocumentHelpersL16isTokenCharacterEw(i32 noundef signext %15) #4
  call void @_ZN4juce12CodeDocument8PositionD1Ev(ptr noundef nonnull align 8 dereferenceable(21) %5) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  br i1 %16, label %17, label %.critedge.thread

17:                                               ; preds = %.critedge
  invoke void @_ZN4juce12CodeDocument8Position6moveByEi(ptr noundef nonnull align 8 dereferenceable(21) %2, i32 noundef -1)
          to label %.preheader unwind label %.loopexit, !llvm.loop !7

.critedge.thread:                                 ; preds = %.preheader, %.critedge
  ret void

.loopexit:                                        ; preds = %14, %17
  %lpad.loopexit = landingpad { ptr, i32 }
          catch ptr null
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit:                      ; preds = %9
  %lpad.loopexit14 = landingpad { ptr, i32 }
          catch ptr null
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp:             ; preds = %10, %4
  %lpad.loopexit.split-lp15 = landingpad { ptr, i32 }
          catch ptr null
  br label %.loopexit.split-lp

.loopexit.split-lp:                               ; preds = %.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit14, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp15, %.loopexit.split-lp.loopexit.split-lp ]
  %18 = extractvalue { ptr, i32 } %lpad.phi, 0
  call void @__clang_call_terminate(ptr %18) #5
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN4juce19CodeDocumentHelpersL16isTokenCharacterEw(i32 noundef signext) local_unnamed_addr #3

declare void @_ZN4juce12CodeDocument8PositionD1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noinline noreturn nounwind uwtable "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 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 }
attributes #5 = { noreturn 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass