; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/fluidbrickgridsavestate.ll (ZN23FluidBrickGridSaveStateC2Ev)

; 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.FluidBrickGridSaveState = type <{ %"class.std::basic_ifstream", i32, i32, i32, [4 x i8], double, %class.AABB, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8] }>
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%"class.vmath::vec3" = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN23FluidBrickGridSaveStateC2Ev(ptr noundef nonnull align 8 dereferenceable(625) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 0
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(256) %6)
  %7 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 1
  store i32 0, ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 2
  store i32 0, ptr %8, align 4, !tbaa !26
  %9 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 3
  store i32 0, ptr %9, align 8, !tbaa !27
  %10 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 5
  store double 0.000000e+00, ptr %10, align 8, !tbaa !28
  %11 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 6
  invoke void @_ZN4AABBC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %11)
          to label %12 unwind label %24

12:                                               ; preds = %1
  %13 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 7
  store i32 0, ptr %13, align 8, !tbaa !29
  %14 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 8
  store i32 0, ptr %14, align 4, !tbaa !30
  %15 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 9
  store i32 0, ptr %15, align 8, !tbaa !31
  %16 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 10
  store i32 0, ptr %16, align 4, !tbaa !32
  %17 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 11
  store i32 0, ptr %17, align 8, !tbaa !33
  %18 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 12
  store i32 0, ptr %18, align 4, !tbaa !34
  %19 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 13
  store i32 0, ptr %19, align 8, !tbaa !35
  %20 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 14
  store i32 0, ptr %20, align 4, !tbaa !36
  %21 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 15
  store i32 0, ptr %21, align 8, !tbaa !37
  %22 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 16
  store i32 0, ptr %22, align 4, !tbaa !38
  %23 = getelementptr inbounds %class.FluidBrickGridSaveState, ptr %5, i32 0, i32 17
  store i8 0, ptr %23, align 8, !tbaa !39
  ret void

24:                                               ; preds = %1
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %3, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %4, align 4
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %6) #3
  br label %28

28:                                               ; preds = %24
  %29 = load ptr, ptr %3, align 8
  %30 = load i32, ptr %4, align 4
  %31 = insertvalue { ptr, i32 } poison, ptr %29, 0
  %32 = insertvalue { ptr, i32 } %31, i32 %30, 1
  resume { ptr, i32 } %32
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #0 align 2

declare void @_ZN4AABBC1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #2 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 = { "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 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 #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, !21, i64 520}
!10 = !{!"_ZTS23FluidBrickGridSaveState", !11, i64 0, !21, i64 520, !21, i64 524, !21, i64 528, !22, i64 536, !23, i64 544, !21, i64 584, !21, i64 588, !21, i64 592, !21, i64 596, !21, i64 600, !21, i64 604, !21, i64 608, !21, i64 612, !21, i64 616, !21, i64 620, !18, i64 624}
!11 = !{!"_ZTSSt14basic_ifstreamIcSt11char_traitsIcEE", !12, i64 0, !14, i64 16}
!12 = !{!"_ZTSSi", !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !15, i64 0, !7, i64 64, !17, i64 104, !19, i64 120, !20, i64 124, !20, i64 132, !20, i64 140, !6, i64 152, !13, i64 160, !18, i64 168, !18, i64 169, !18, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !18, i64 192, !6, i64 200, !6, i64 208, !13, i64 216, !6, i64 224, !6, i64 232}
!15 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !16, i64 56}
!16 = !{!"_ZTSSt6locale", !6, i64 0}
!17 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !18, i64 8}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!20 = !{!"_ZTS11__mbstate_t", !21, i64 0, !7, i64 4}
!21 = !{!"int", !7, i64 0}
!22 = !{!"double", !7, i64 0}
!23 = !{!"_ZTS4AABB", !24, i64 0, !22, i64 16, !22, i64 24, !22, i64 32}
!24 = !{!"_ZTSN5vmath4vec3E", !25, i64 0, !25, i64 4, !25, i64 8}
!25 = !{!"float", !7, i64 0}
!26 = !{!10, !21, i64 524}
!27 = !{!10, !21, i64 528}
!28 = !{!10, !22, i64 536}
!29 = !{!10, !21, i64 584}
!30 = !{!10, !21, i64 588}
!31 = !{!10, !21, i64 592}
!32 = !{!10, !21, i64 596}
!33 = !{!10, !21, i64 600}
!34 = !{!10, !21, i64 604}
!35 = !{!10, !21, i64 608}
!36 = !{!10, !21, i64 612}
!37 = !{!10, !21, i64 616}
!38 = !{!10, !21, i64 620}
!39 = !{!10, !18, i64 624}


; 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
define dso_local void @_ZN23FluidBrickGridSaveStateC2Ev(ptr noundef nonnull align 8 dereferenceable(625) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 520
  store i32 0, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 524
  store i32 0, ptr %3, align 4, !tbaa !25
  %4 = getelementptr inbounds i8, ptr %0, i64 528
  store i32 0, ptr %4, align 8, !tbaa !26
  %5 = getelementptr inbounds i8, ptr %0, i64 536
  store double 0.000000e+00, ptr %5, align 8, !tbaa !27
  %6 = getelementptr inbounds i8, ptr %0, i64 544
  invoke void @_ZN4AABBC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %6)
          to label %7 unwind label %9

7:                                                ; preds = %1
  %8 = getelementptr inbounds i8, ptr %0, i64 584
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(41) %8, i8 0, i64 41, i1 false)
  ret void

9:                                                ; preds = %1
  %10 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %0) #4
  resume { ptr, i32 } %10
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #0 align 2

declare void @_ZN4AABBC1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #2 align 2

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

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 = { "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 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !20, i64 520}
!6 = !{!"_ZTS23FluidBrickGridSaveState", !7, i64 0, !20, i64 520, !20, i64 524, !20, i64 528, !21, i64 536, !22, i64 544, !20, i64 584, !20, i64 588, !20, i64 592, !20, i64 596, !20, i64 600, !20, i64 604, !20, i64 608, !20, i64 612, !20, i64 616, !20, i64 620, !17, i64 624}
!7 = !{!"_ZTSSt14basic_ifstreamIcSt11char_traitsIcEE", !8, i64 0, !12, i64 16}
!8 = !{!"_ZTSSi", !9, i64 8}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !13, i64 0, !10, i64 64, !16, i64 104, !18, i64 120, !19, i64 124, !19, i64 132, !19, i64 140, !14, i64 152, !9, i64 160, !17, i64 168, !17, i64 169, !17, i64 170, !10, i64 171, !14, i64 176, !14, i64 184, !17, i64 192, !14, i64 200, !14, i64 208, !9, i64 216, !14, i64 224, !14, i64 232}
!13 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !15, i64 56}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!"_ZTSSt6locale", !14, i64 0}
!16 = !{!"_ZTSSt12__basic_fileIcE", !14, i64 0, !17, i64 8}
!17 = !{!"bool", !10, i64 0}
!18 = !{!"_ZTSSt13_Ios_Openmode", !10, i64 0}
!19 = !{!"_ZTS11__mbstate_t", !20, i64 0, !10, i64 4}
!20 = !{!"int", !10, i64 0}
!21 = !{!"double", !10, i64 0}
!22 = !{!"_ZTS4AABB", !23, i64 0, !21, i64 16, !21, i64 24, !21, i64 32}
!23 = !{!"_ZTSN5vmath4vec3E", !24, i64 0, !24, i64 4, !24, i64 8}
!24 = !{!"float", !10, i64 0}
!25 = !{!6, !20, i64 524}
!26 = !{!6, !20, i64 528}
!27 = !{!6, !21, i64 536}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass