; LLVM IR from microsoft/Multiverso :: src/io/io.ll (ZN10multiverso10TextReaderC2ERKNS_3URIEm)

; 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.multiverso::TextReader" = type { ptr, i64, i64, i64, ptr }

@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [68 x i8], align 1
@__PRETTY_FUNCTION__._ZN10multiverso10TextReaderC2ERKNS_3URIEm = external hidden unnamed_addr constant [56 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10multiverso10TextReaderC2ERKNS_3URIEm(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(128) %1, i64 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = call noundef ptr @_ZN10multiverso13StreamFactory9GetStreamERKNS_3URIENS_12FileOpenModeE(ptr noundef nonnull align 8 dereferenceable(128) %8, i32 noundef 1)
  %10 = getelementptr inbounds %"class.multiverso::TextReader", ptr %7, i32 0, i32 4
  store ptr %9, ptr %10, align 8, !tbaa !11
  %11 = load i64, ptr %6, align 8, !tbaa !9
  %12 = getelementptr inbounds %"class.multiverso::TextReader", ptr %7, i32 0, i32 2
  store i64 %11, ptr %12, align 8, !tbaa !13
  %13 = getelementptr inbounds %"class.multiverso::TextReader", ptr %7, i32 0, i32 3
  store i64 0, ptr %13, align 8, !tbaa !14
  %14 = getelementptr inbounds %"class.multiverso::TextReader", ptr %7, i32 0, i32 1
  store i64 0, ptr %14, align 8, !tbaa !15
  %15 = getelementptr inbounds %"class.multiverso::TextReader", ptr %7, i32 0, i32 2
  %16 = load i64, ptr %15, align 8, !tbaa !13
  %17 = call noalias noundef nonnull ptr @_Znam(i64 noundef %16) #3
  %18 = getelementptr inbounds %"class.multiverso::TextReader", ptr %7, i32 0, i32 0
  store ptr %17, ptr %18, align 8, !tbaa !16
  %19 = getelementptr inbounds %"class.multiverso::TextReader", ptr %7, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %3
  br label %25

23:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 30, ptr noundef @__PRETTY_FUNCTION__._ZN10multiverso10TextReaderC2ERKNS_3URIEm) #4
  unreachable

24:                                               ; No predecessors!
  br label %25

25:                                               ; preds = %24, %22
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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 = { nobuiltin allocsize(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 = { noreturn 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 #3 = { builtin allocsize(0) }
attributes #4 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"_ZTSN10multiverso10TextReaderE", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !6, i64 32}
!13 = !{!12, !10, i64 16}
!14 = !{!12, !10, i64 24}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !6, i64 0}


; 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
declare dso_local noundef ptr @_ZN10multiverso13StreamFactory9GetStreamERKNS_3URIENS_12FileOpenModeE(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10multiverso10TextReaderC2ERKNS_3URIEm(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(128) %1, i64 noundef %2) unnamed_addr #0 align 2 {
  %4 = tail call noundef ptr @_ZN10multiverso13StreamFactory9GetStreamERKNS_3URIENS_12FileOpenModeE(ptr noundef nonnull align 8 dereferenceable(128) %1, i32 noundef 1)
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %4, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 %2, ptr %6, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 0, ptr %7, align 8, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 0, ptr %8, align 8, !tbaa !13
  %9 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %2) #2
  store ptr %9, ptr %0, align 8, !tbaa !14
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #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 = { nobuiltin allocsize(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 = { builtin allocsize(0) }

!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 32}
!6 = !{!"_ZTSN10multiverso10TextReaderE", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 24}
!13 = !{!6, !10, i64 8}
!14 = !{!6, !7, i64 0}


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