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

; 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

; 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
declare dso_local void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21), i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(21) %0, ptr noundef nonnull align 8 dereferenceable(21) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  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 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = icmp ne ptr %6, %7
  br i1 %8, label %9, label %43

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #2
  %10 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %6, i32 0, i32 4
  %11 = load i8, ptr %10, align 4, !tbaa !9, !range !13, !noundef !14
  %12 = trunc i8 %11 to i1
  %13 = zext i1 %12 to i8
  store i8 %13, ptr %5, align 1, !tbaa !15
  %14 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %6, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = icmp ne ptr %15, %18
  br i1 %19, label %20, label %21

20:                                               ; preds = %9
  call void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21) %6, i1 noundef zeroext false)
  br label %21

21:                                               ; preds = %20, %9
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %6, i32 0, i32 0
  store ptr %24, ptr %25, align 8, !tbaa !16
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !17
  %29 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %6, i32 0, i32 2
  store i32 %28, ptr %29, align 4, !tbaa !17
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %30, i32 0, i32 3
  %32 = load i32, ptr %31, align 8, !tbaa !18
  %33 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %6, i32 0, i32 3
  store i32 %32, ptr %33, align 8, !tbaa !18
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 8, !tbaa !19
  %37 = getelementptr inbounds %"class.juce::CodeDocument::Position", ptr %6, i32 0, i32 1
  store i32 %36, ptr %37, align 8, !tbaa !19
  %38 = load i8, ptr %5, align 1, !tbaa !15, !range !13, !noundef !14
  %39 = trunc i8 %38 to i1
  call void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21) %6, i1 noundef zeroext %39)
  br label %40

40:                                               ; preds = %21
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #2
  br label %43

43:                                               ; preds = %42, %2
  ret ptr %6
}

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 = { 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, !12, i64 20}
!10 = !{!"_ZTSN4juce12CodeDocument8PositionE", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 20}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!12, !12, i64 0}
!16 = !{!10, !6, i64 0}
!17 = !{!10, !11, i64 12}
!18 = !{!10, !11, i64 16}
!19 = !{!10, !11, i64 8}


; 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 uwtable
declare dso_local void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21), i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(21) ptr @_ZN4juce12CodeDocument8PositionaSERKS1_(ptr noundef nonnull returned align 8 dereferenceable(21) %0, ptr noundef nonnull readonly align 8 dereferenceable(21) %1) local_unnamed_addr #0 align 2 {
  %.not = icmp eq ptr %0, %1
  br i1 %.not, label %18, label %3

3:                                                ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 20
  %5 = load i8, ptr %4, align 4, !tbaa !5, !range !12, !noundef !13
  %6 = trunc nuw i8 %5 to i1
  %7 = load ptr, ptr %0, align 8, !tbaa !14
  %8 = load ptr, ptr %1, align 8, !tbaa !14
  %.not8 = icmp eq ptr %7, %8
  br i1 %.not8, label %10, label %9

9:                                                ; preds = %3
  tail call void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21) %0, i1 noundef zeroext false)
  %.pre = load ptr, ptr %1, align 8, !tbaa !14
  br label %10

10:                                               ; preds = %9, %3
  %11 = phi ptr [ %.pre, %9 ], [ %8, %3 ]
  store ptr %11, ptr %0, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %1, i64 16
  %13 = load i32, ptr %12, align 8, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %13, ptr %14, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load <2 x i32>, ptr %15, align 8, !tbaa !16
  store <2 x i32> %17, ptr %16, align 8, !tbaa !16
  tail call void @_ZN4juce12CodeDocument8Position21setPositionMaintainedEb(ptr noundef nonnull align 8 dereferenceable(21) %0, i1 noundef zeroext %6)
  br label %18

18:                                               ; preds = %10, %2
  ret ptr %0
}

attributes #0 = { 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" }

!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, !11, i64 20}
!6 = !{!"_ZTSN4juce12CodeDocument8PositionE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !10, i64 16}
!16 = !{!10, !10, i64 0}


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