; LLVM IR from tryingfly/nabo :: nabo_core/src/robot/cpg.ll (ZN3Cpg8cpgClass7setZeroEv)

; 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.Cpg::cpgClass" = type { i8, i8, double, double, [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x i8], i8, [2 x i8], double, double, [2 x double], [2 x double], %struct.anon }
%struct.anon = type { double, [2 x double], [2 x double] }

; 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 @_ZN3Cpg8cpgClass7setZeroEv(ptr noundef nonnull align 8 dereferenceable(248) %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
  %5 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 0
  store i8 1, ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 1
  store i8 0, ptr %6, align 1, !tbaa !14
  %7 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 3
  %8 = load double, ptr %7, align 8, !tbaa !15
  %9 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 2
  store double %8, ptr %9, align 8, !tbaa !16
  %10 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 14
  %11 = getelementptr inbounds [2 x i8], ptr %10, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 1 %11, i8 1, i64 2, i1 false)
  %12 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 7
  %13 = getelementptr inbounds [2 x double], ptr %12, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 16, i1 false)
  %14 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 4
  %15 = getelementptr inbounds [2 x double], ptr %14, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 8 %15, i8 0, i64 16, i1 false)
  %16 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 12
  %17 = getelementptr inbounds [2 x i8], ptr %16, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 8 %17, i8 0, i64 2, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !17
  br label %18

18:                                               ; preds = %36, %1
  %19 = load i32, ptr %3, align 4, !tbaa !17
  %20 = icmp ne i32 %19, 2
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %39

22:                                               ; preds = %18
  %23 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 6
  %24 = load i32, ptr %3, align 4, !tbaa !17
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [2 x double], ptr %23, i64 0, i64 %25
  store double 1.000000e+00, ptr %26, align 8, !tbaa !19
  %27 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 11
  %28 = load i32, ptr %3, align 4, !tbaa !17
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2 x double], ptr %27, i64 0, i64 %29
  %31 = load double, ptr %30, align 8, !tbaa !19
  %32 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %4, i32 0, i32 9
  %33 = load i32, ptr %3, align 4, !tbaa !17
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [2 x double], ptr %32, i64 0, i64 %34
  store double %31, ptr %35, align 8, !tbaa !19
  br label %36

36:                                               ; preds = %22
  %37 = load i32, ptr %3, align 4, !tbaa !17
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %3, align 4, !tbaa !17
  br label %18, !llvm.loop !20

39:                                               ; preds = %21
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3Cpg8cpgClassE", !11, i64 0, !11, i64 1, !12, i64 8, !12, i64 16, !7, i64 24, !7, i64 40, !7, i64 56, !7, i64 72, !7, i64 88, !7, i64 104, !7, i64 120, !7, i64 136, !7, i64 152, !11, i64 154, !7, i64 155, !12, i64 160, !12, i64 168, !7, i64 176, !7, i64 192, !13, i64 208}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTSN3Cpg8cpgClassUt_E", !12, i64 0, !7, i64 8, !7, i64 24}
!14 = !{!10, !11, i64 1}
!15 = !{!10, !12, i64 16}
!16 = !{!10, !12, i64 8}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!12, !12, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN3Cpg8cpgClass7setZeroEv(ptr nocapture noundef nonnull align 8 dereferenceable(248) %0) local_unnamed_addr #0 align 2 {
  store i8 1, ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 1
  store i8 0, ptr %2, align 1, !tbaa !12
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load double, ptr %3, align 8, !tbaa !13
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  store double %4, ptr %5, align 8, !tbaa !14
  %6 = getelementptr inbounds i8, ptr %0, i64 155
  store i16 257, ptr %6, align 1
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, i8 0, i64 16, i1 false)
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  %9 = getelementptr inbounds i8, ptr %0, i64 152
  store i16 0, ptr %9, align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 56
  %11 = getelementptr inbounds i8, ptr %0, i64 136
  %12 = getelementptr inbounds i8, ptr %0, i64 104
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %10, align 8, !tbaa !15
  %13 = load <2 x double>, ptr %11, align 8, !tbaa !15
  store <2 x double> %13, ptr %12, align 8, !tbaa !15
  ret void
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 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, !7, i64 0}
!6 = !{!"_ZTSN3Cpg8cpgClassE", !7, i64 0, !7, i64 1, !10, i64 8, !10, i64 16, !8, i64 24, !8, i64 40, !8, i64 56, !8, i64 72, !8, i64 88, !8, i64 104, !8, i64 120, !8, i64 136, !8, i64 152, !7, i64 154, !8, i64 155, !10, i64 160, !10, i64 168, !8, i64 176, !8, i64 192, !11, i64 208}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTSN3Cpg8cpgClassUt_E", !10, i64 0, !8, i64 8, !8, i64 24}
!12 = !{!6, !7, i64 1}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 8}
!15 = !{!10, !10, i64 0}


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