; LLVM IR from gulrak/filesystem :: test/impl_test.ll (ZN3ghc10filesystem15directory_entryC2ERKNS0_4pathE)

; 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.ghc::filesystem::directory_entry" = type { %"class.ghc::filesystem::path", %"class.ghc::filesystem::file_status", %"class.ghc::filesystem::file_status", i64, i64, i64 }
%"class.ghc::filesystem::path" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.ghc::filesystem::file_status" = type <{ i32, i16, [2 x i8] }>

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3ghc10filesystem15directory_entryC2ERKNS0_4pathE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %"class.ghc::filesystem::directory_entry", ptr %7, i32 0, i32 0
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3ghc10filesystem4pathC1ERKS1_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %9)
  %10 = getelementptr inbounds %"class.ghc::filesystem::directory_entry", ptr %7, i32 0, i32 1
  call void @_ZN3ghc10filesystem11file_statusC1Ev(ptr noundef nonnull align 4 dereferenceable(6) %10) #1
  %11 = getelementptr inbounds %"class.ghc::filesystem::directory_entry", ptr %7, i32 0, i32 2
  call void @_ZN3ghc10filesystem11file_statusC1Ev(ptr noundef nonnull align 4 dereferenceable(6) %11) #1
  %12 = getelementptr inbounds %"class.ghc::filesystem::directory_entry", ptr %7, i32 0, i32 3
  store i64 -1, ptr %12, align 8, !tbaa !9
  %13 = getelementptr inbounds %"class.ghc::filesystem::directory_entry", ptr %7, i32 0, i32 4
  store i64 -1, ptr %13, align 8, !tbaa !18
  %14 = getelementptr inbounds %"class.ghc::filesystem::directory_entry", ptr %7, i32 0, i32 5
  store i64 0, ptr %14, align 8, !tbaa !19
  invoke void @_ZN3ghc10filesystem15directory_entry7refreshEv(ptr noundef nonnull align 8 dereferenceable(72) %7)
          to label %15 unwind label %16

15:                                               ; preds = %2
  ret void

16:                                               ; preds = %2
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %5, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %6, align 4
  call void @_ZN3ghc10filesystem11file_statusD1Ev(ptr noundef nonnull align 4 dereferenceable(6) %11) #1
  call void @_ZN3ghc10filesystem11file_statusD1Ev(ptr noundef nonnull align 4 dereferenceable(6) %10) #1
  call void @_ZN3ghc10filesystem4pathD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #1
  br label %20

20:                                               ; preds = %16
  %21 = load ptr, ptr %5, align 8
  %22 = load i32, ptr %6, align 4
  %23 = insertvalue { ptr, i32 } poison, ptr %21, 0
  %24 = insertvalue { ptr, i32 } %23, i32 %22, 1
  resume { ptr, i32 } %24
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ghc10filesystem15directory_entry7refreshEv(ptr noundef nonnull align 8 dereferenceable(72)) #0 align 2

declare void @_ZN3ghc10filesystem4pathC1ERKS1_(ptr, ptr)

declare void @_ZN3ghc10filesystem4pathD1Ev(ptr)

declare void @_ZN3ghc10filesystem11file_statusC1Ev(ptr)

declare void @_ZN3ghc10filesystem11file_statusD1Ev(ptr)

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 = { 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, !14, i64 48}
!10 = !{!"_ZTSN3ghc10filesystem15directory_entryE", !11, i64 0, !15, i64 32, !15, i64 40, !14, i64 48, !14, i64 56, !14, i64 64}
!11 = !{!"_ZTSN3ghc10filesystem4pathE", !12, i64 0}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN3ghc10filesystem11file_statusE", !16, i64 0, !17, i64 4}
!16 = !{!"_ZTSN3ghc10filesystem9file_typeE", !7, i64 0}
!17 = !{!"_ZTSN3ghc10filesystem5permsE", !7, i64 0}
!18 = !{!10, !14, i64 56}
!19 = !{!10, !14, i64 64}


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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3ghc10filesystem15directory_entryC2ERKNS0_4pathE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN3ghc10filesystem4pathC1ERKS1_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1)
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN3ghc10filesystem11file_statusC1Ev(ptr noundef nonnull align 4 dereferenceable(6) %3) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @_ZN3ghc10filesystem11file_statusC1Ev(ptr noundef nonnull align 4 dereferenceable(6) %4) #2
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 -1, i64 16, i1 false)
  store i64 0, ptr %6, align 8, !tbaa !5
  invoke void @_ZN3ghc10filesystem15directory_entry7refreshEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
          to label %7 unwind label %8

7:                                                ; preds = %2
  ret void

8:                                                ; preds = %2
  %9 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN3ghc10filesystem11file_statusD1Ev(ptr noundef nonnull align 4 dereferenceable(6) %4) #2
  tail call void @_ZN3ghc10filesystem11file_statusD1Ev(ptr noundef nonnull align 4 dereferenceable(6) %3) #2
  tail call void @_ZN3ghc10filesystem4pathD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #2
  resume { ptr, i32 } %9
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3ghc10filesystem15directory_entry7refreshEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #0 align 2

declare void @_ZN3ghc10filesystem4pathC1ERKS1_(ptr, ptr) local_unnamed_addr

declare void @_ZN3ghc10filesystem4pathD1Ev(ptr) local_unnamed_addr

declare void @_ZN3ghc10filesystem11file_statusC1Ev(ptr) local_unnamed_addr

declare void @_ZN3ghc10filesystem11file_statusD1Ev(ptr) local_unnamed_addr

; 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 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) }
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, !13, i64 64}
!6 = !{!"_ZTSN3ghc10filesystem15directory_entryE", !7, i64 0, !14, i64 32, !14, i64 40, !13, i64 48, !13, i64 56, !13, i64 64}
!7 = !{!"_ZTSN3ghc10filesystem4pathE", !8, i64 0}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !9, i64 0, !13, i64 8, !11, i64 16}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"long", !11, i64 0}
!14 = !{!"_ZTSN3ghc10filesystem11file_statusE", !15, i64 0, !16, i64 4}
!15 = !{!"_ZTSN3ghc10filesystem9file_typeE", !11, i64 0}
!16 = !{!"_ZTSN3ghc10filesystem5permsE", !11, i64 0}


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