; LLVM IR from alibaba/euler :: euler/common/hdfs_file_io.ll (ZN5euler10HdfsFileIOD2Ev)

; 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.euler::FileIO" = type { ptr, i8, i64, i64 }
%"class.euler::HdfsFileIO" = type { %"class.euler::FileIO", i8, i8, ptr, i64, i64, ptr, ptr, ptr, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"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.euler::LibHDFS" = type { %"class.std::function", %"class.std::function.8", %"class.std::function.10", %"class.std::function.13", %"class.std::function.16", %"class.std::function.19", %"class.std::function.22", %"class.std::function.24", %"class.std::function.26", %"class.std::function.19", %"class.std::function.19", %"class.std::function.28", %"class.std::function.31", %"class.std::function.33", %"class.std::function.36", %"class.std::function.38", %"class.std::function.41", %"class.std::function.33", %"class.std::function.43", %"class.std::function.46", %"class.euler::Status", ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::function.8" = type { %"class.std::_Function_base", ptr }
%"class.std::function.10" = type { %"class.std::_Function_base", ptr }
%"class.std::function.13" = type { %"class.std::_Function_base", ptr }
%"class.std::function.16" = type { %"class.std::_Function_base", ptr }
%"class.std::function.22" = type { %"class.std::_Function_base", ptr }
%"class.std::function.24" = type { %"class.std::_Function_base", ptr }
%"class.std::function.26" = type { %"class.std::_Function_base", ptr }
%"class.std::function.19" = type { %"class.std::_Function_base", ptr }
%"class.std::function.28" = type { %"class.std::_Function_base", ptr }
%"class.std::function.31" = type { %"class.std::_Function_base", ptr }
%"class.std::function.36" = type { %"class.std::_Function_base", ptr }
%"class.std::function.38" = type { %"class.std::_Function_base", ptr }
%"class.std::function.41" = type { %"class.std::_Function_base", ptr }
%"class.std::function.33" = type { %"class.std::_Function_base", ptr }
%"class.std::function.43" = type { %"class.std::_Function_base", ptr }
%"class.std::function.46" = type { %"class.std::_Function_base", ptr }
%"class.euler::Status" = type { i32, %"class.std::__cxx11::basic_string" }

@_ZTVN5euler10HdfsFileIOE = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5euler10HdfsFileIOD2Ev(ptr noundef nonnull align 8 dereferenceable(184) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 64) ({ [10 x ptr] }, ptr @_ZTVN5euler10HdfsFileIOE, i32 0, i32 0, i32 2), ptr %3, align 8, !tbaa !9
  %4 = getelementptr inbounds %"class.euler::FileIO", ptr %3, i32 0, i32 1
  %5 = load i8, ptr %4, align 8, !tbaa !11, !range !15, !noundef !16
  %6 = trunc i8 %5 to i1
  br i1 %6, label %7, label %28

7:                                                ; preds = %1
  %8 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 2
  %9 = load i8, ptr %8, align 1, !tbaa !17, !range !15, !noundef !16
  %10 = trunc i8 %9 to i1
  br i1 %10, label %28, label %11

11:                                               ; preds = %7
  %12 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 6
  %13 = load ptr, ptr %12, align 8, !tbaa !21
  %14 = getelementptr inbounds %"class.euler::LibHDFS", ptr %13, i32 0, i32 5
  %15 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 7
  %16 = load ptr, ptr %15, align 8, !tbaa !22
  %17 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 8
  %18 = load ptr, ptr %17, align 8, !tbaa !23
  %19 = invoke noundef i32 @_ZNKSt8functionIFiP13hdfs_internalP17hdfsFile_internalEEclES1_S3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef %16, ptr noundef %18)
          to label %20 unwind label %32

20:                                               ; preds = %11
  %21 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !24
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %27

24:                                               ; preds = %20
  %25 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 3
  %26 = load ptr, ptr %25, align 8, !tbaa !24
  call void @free(ptr noundef %26) #4
  br label %27

27:                                               ; preds = %24, %20
  br label %28

28:                                               ; preds = %27, %7, %1
  %29 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 11
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %29) #4
  %30 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 10
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %30) #4
  %31 = getelementptr inbounds %"class.euler::HdfsFileIO", ptr %3, i32 0, i32 9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %31) #4
  call void @_ZN5euler6FileIOD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  ret void

32:                                               ; preds = %11
  %33 = landingpad { ptr, i32 }
          catch ptr null
  %34 = extractvalue { ptr, i32 } %33, 0
  call void @__clang_call_terminate(ptr %34) #5
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNKSt8functionIFiP13hdfs_internalP17hdfsFile_internalEEclES1_S3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef) #2 align 2

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #3

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

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 = { nounwind "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 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 = { noinline noreturn nounwind uwtable "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 #4 = { nounwind }
attributes #5 = { noreturn 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSN5euler6FileIOE", !13, i64 8, !14, i64 16, !14, i64 24}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !13, i64 33}
!18 = !{!"_ZTSN5euler10HdfsFileIOE", !12, i64 0, !13, i64 32, !13, i64 33, !6, i64 40, !14, i64 48, !14, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !19, i64 88, !19, i64 120, !19, i64 152}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !14, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!18, !6, i64 64}
!22 = !{!18, !6, i64 72}
!23 = !{!18, !6, i64 80}
!24 = !{!18, !6, i64 40}


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

@_ZTVN5euler10HdfsFileIOE = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5euler10HdfsFileIOD2Ev(ptr noundef nonnull align 8 dereferenceable(184) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 64) (i8, ptr @_ZTVN5euler10HdfsFileIOE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i8, ptr %2, align 8, !tbaa !8, !range !13, !noundef !14
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %5, label %22

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 33
  %7 = load i8, ptr %6, align 1, !tbaa !15, !range !13, !noundef !14
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %22, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  %11 = load ptr, ptr %10, align 8, !tbaa !20
  %12 = getelementptr inbounds i8, ptr %11, i64 160
  %13 = getelementptr inbounds i8, ptr %0, i64 72
  %14 = load ptr, ptr %13, align 8, !tbaa !21
  %15 = getelementptr inbounds i8, ptr %0, i64 80
  %16 = load ptr, ptr %15, align 8, !tbaa !22
  %17 = invoke noundef i32 @_ZNKSt8functionIFiP13hdfs_internalP17hdfsFile_internalEEclES1_S3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef %14, ptr noundef %16)
          to label %18 unwind label %26

18:                                               ; preds = %9
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  %20 = load ptr, ptr %19, align 8, !tbaa !23
  %.not = icmp eq ptr %20, null
  br i1 %.not, label %22, label %21

21:                                               ; preds = %18
  tail call void @free(ptr noundef nonnull %20) #4
  br label %22

22:                                               ; preds = %18, %21, %5, %1
  %23 = getelementptr inbounds i8, ptr %0, i64 152
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #4
  %24 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #4
  %25 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #4
  tail call void @_ZN5euler6FileIOD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  ret void

26:                                               ; preds = %9
  %27 = landingpad { ptr, i32 }
          catch ptr null
  %28 = extractvalue { ptr, i32 } %27, 0
  tail call void @__clang_call_terminate(ptr %28) #5
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNKSt8functionIFiP13hdfs_internalP17hdfsFile_internalEEclES1_S3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #3

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

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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 = { noinline noreturn nounwind uwtable "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 #4 = { nounwind }
attributes #5 = { noreturn 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN5euler6FileIOE", !10, i64 8, !12, i64 16, !12, i64 24}
!10 = !{!"bool", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"long", !11, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !10, i64 33}
!16 = !{!"_ZTSN5euler10HdfsFileIOE", !9, i64 0, !10, i64 32, !10, i64 33, !17, i64 40, !12, i64 48, !12, i64 56, !17, i64 64, !17, i64 72, !17, i64 80, !18, i64 88, !18, i64 120, !18, i64 152}
!17 = !{!"any pointer", !11, i64 0}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !12, i64 8, !11, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !17, i64 0}
!20 = !{!16, !17, i64 64}
!21 = !{!16, !17, i64 72}
!22 = !{!16, !17, i64 80}
!23 = !{!16, !17, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass