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

; 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] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3ghc10filesystem15directory_entryC2ERKNS0_4pathERSt10error_code(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8
  %8 = getelementptr inbounds %"class.ghc::filesystem::directory_entry", ptr %7, i32 0, i32 0
  %9 = load ptr, ptr %5, 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) #2
  %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) #2
  %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
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN3ghc10filesystem15directory_entry7refreshERSt10error_code(ptr noundef nonnull align 8 dereferenceable(72) %7, ptr noundef nonnull align 8 dereferenceable(16) %15) #2
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3ghc10filesystem15directory_entry7refreshERSt10error_code(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

declare void @_ZN3ghc10filesystem4pathC1ERKS1_(ptr, ptr)

declare void @_ZN3ghc10filesystem11file_statusC1Ev(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 = { 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 = { 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"

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3ghc10filesystem15directory_entry7refreshERSt10error_code(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

declare void @_ZN3ghc10filesystem4pathC1ERKS1_(ptr, ptr) local_unnamed_addr

declare void @_ZN3ghc10filesystem11file_statusC1Ev(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) #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" }
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, !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,TailCallElimPass