; LLVM IR from Sonryle/JoePhys :: testbed/src/WindowManager.ll (ZN13WindowManagerC2Ev)

; 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"

%struct.Settings = type <{ i32, i32, i32, i32, i8, [3 x i8], float, float, i8, [3 x i8], %struct.vec2, i8, i8, i8, i8, i8, [3 x i8], float, float, float, float, i32, i32, i32, float, i8, [3 x i8] }>
%struct.vec2 = type { float, float }
%struct.WindowManager = type <{ %struct.vec2, i32, i32, ptr, ptr, ptr, i8, i8, i8, i8, [4 x i8] }>

@settings = external global %struct.Settings, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13WindowManagerC2Ev(ptr noundef nonnull align 8 dereferenceable(44) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %struct.WindowManager, ptr %3, i32 0, i32 0
  call void @_ZN4vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %5 = getelementptr inbounds %struct.WindowManager, ptr %3, i32 0, i32 3
  store ptr null, ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %struct.WindowManager, ptr %3, i32 0, i32 4
  store ptr null, ptr %6, align 8, !tbaa !15
  %7 = getelementptr inbounds %struct.WindowManager, ptr %3, i32 0, i32 5
  store ptr null, ptr %7, align 8, !tbaa !16
  %8 = getelementptr inbounds %struct.WindowManager, ptr %3, i32 0, i32 0
  call void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8) %8, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %9 = load i32, ptr getelementptr inbounds (%struct.Settings, ptr @settings, i32 0, i32 1), align 4, !tbaa !17
  %10 = getelementptr inbounds %struct.WindowManager, ptr %3, i32 0, i32 2
  store i32 %9, ptr %10, align 4, !tbaa !19
  %11 = load i32, ptr @settings, align 4, !tbaa !20
  %12 = getelementptr inbounds %struct.WindowManager, ptr %3, i32 0, i32 1
  store i32 %11, ptr %12, align 8, !tbaa !21
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) #1 align 2

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" }
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" }

!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, !6, i64 16}
!10 = !{!"_ZTS13WindowManager", !11, i64 0, !13, i64 8, !13, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !14, i64 41, !14, i64 42, !14, i64 43}
!11 = !{!"_ZTS4vec2", !12, i64 0, !12, i64 4}
!12 = !{!"float", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!10, !6, i64 24}
!16 = !{!10, !6, i64 32}
!17 = !{!18, !13, i64 4}
!18 = !{!"_ZTS8Settings", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !14, i64 16, !12, i64 20, !12, i64 24, !14, i64 28, !11, i64 32, !14, i64 40, !14, i64 41, !14, i64 42, !14, i64 43, !14, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !12, i64 76, !14, i64 80}
!19 = !{!10, !13, i64 12}
!20 = !{!18, !13, i64 0}
!21 = !{!10, !13, 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"

%struct.Settings = type <{ i32, i32, i32, i32, i8, [3 x i8], float, float, i8, [3 x i8], %struct.vec2, i8, i8, i8, i8, i8, [3 x i8], float, float, float, float, i32, i32, i32, float, i8, [3 x i8] }>
%struct.vec2 = type { float, float }

@settings = external local_unnamed_addr global %struct.Settings, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN13WindowManagerC2Ev(ptr noundef nonnull align 8 dereferenceable(44) %0) unnamed_addr #0 align 2 {
  tail call void @_ZN4vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, i8 0, i64 24, i1 false)
  tail call void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8) %0, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load <2 x i32>, ptr @settings, align 4, !tbaa !5
  store <2 x i32> %4, ptr %3, align 8, !tbaa !5
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) local_unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass