; LLVM IR from stillwater-sc/universal :: static/appenv/multifile (integers)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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.std::locale" = type { ptr }
%"class.sw::universal::integer" = type { [1 x i8] }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [56 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local i8 @_Z17integerPolynomialRKSt6vectorIiSaIiEERKN2sw9universal7integerILj8EhLNS5_17IntegerNumberTypeE0EEE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 1 dereferenceable(1) %1) #0 {
  %3 = alloca %"class.sw::universal::integer", align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.sw::universal::integer", align 1
  %8 = alloca %"class.sw::universal::integer", align 1
  %9 = alloca %"class.sw::universal::integer", align 1
  %10 = alloca %"class.sw::universal::integer", align 1
  %11 = alloca %"class.sw::universal::integer", align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  %14 = icmp ult i64 %13, 2
  br i1 %14, label %15, label %17

15:                                               ; preds = %2
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str)
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef 0) #5
  br label %47

17:                                               ; preds = %2
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef 0) #5
  %20 = load i32, ptr %19, align 4, !tbaa !9
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 1, ptr %6, align 8, !tbaa !11
  br label %21

21:                                               ; preds = %43, %17
  %22 = load i64, ptr %6, align 8, !tbaa !11
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #5
  %25 = icmp ult i64 %22, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %46

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = load i64, ptr %6, align 8, !tbaa !11
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %29) #5
  %31 = load i32, ptr %30, align 4, !tbaa !9
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %8, i32 noundef %31) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %10, ptr align 1 %32, i64 1, i1 false), !tbaa.struct !13
  %33 = load i64, ptr %6, align 8, !tbaa !11
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Em(ptr noundef nonnull align 1 dereferenceable(1) %11, i64 noundef %33) #5
  %34 = getelementptr inbounds %"class.sw::universal::integer", ptr %10, i32 0, i32 0
  %35 = load i8, ptr %34, align 1
  %36 = getelementptr inbounds %"class.sw::universal::integer", ptr %11, i32 0, i32 0
  %37 = load i8, ptr %36, align 1
  %38 = call i8 @_ZN2sw9universal3powILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEES5_S5_(i8 %35, i8 %37)
  %39 = getelementptr inbounds %"class.sw::universal::integer", ptr %9, i32 0, i32 0
  store i8 %38, ptr %39, align 1
  %40 = call i8 @_ZN2sw9universalmlILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEERKS5_S7_(ptr noundef nonnull align 1 dereferenceable(1) %8, ptr noundef nonnull align 1 dereferenceable(1) %9)
  %41 = getelementptr inbounds %"class.sw::universal::integer", ptr %7, i32 0, i32 0
  store i8 %40, ptr %41, align 1
  %42 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEpLERKS3_(ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef nonnull align 1 dereferenceable(1) %7)
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  br label %43

43:                                               ; preds = %27
  %44 = load i64, ptr %6, align 8, !tbaa !11
  %45 = add i64 %44, 1
  store i64 %45, ptr %6, align 8, !tbaa !11
  br label %21, !llvm.loop !15

46:                                               ; preds = %26
  br label %47

47:                                               ; preds = %46, %15
  %48 = getelementptr inbounds %"class.sw::universal::integer", ptr %3, i32 0, i32 0
  %49 = load i8, ptr %48, align 1
  ret i8 %49
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i8 @_ZN2sw9universalmlILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEERKS5_S7_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local i8 @_ZN2sw9universal3powILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEES5_S5_(i8, i8) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Em(ptr noundef nonnull align 1 dereferenceable(1), i64 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEpLERKS3_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{i64 0, i64 1, !14}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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.std::locale" = type { ptr }
%"class.sw::universal::integer" = type { [1 x i8] }

@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [56 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local i8 @_Z17integerPolynomialRKSt6vectorIiSaIiEERKN2sw9universal7integerILj8EhLNS5_17IntegerNumberTypeE0EEE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr nocapture noundef nonnull readonly align 1 dereferenceable(1) %1) local_unnamed_addr #0 {
  %3 = alloca %"class.sw::universal::integer", align 1
  %4 = alloca %"class.sw::universal::integer", align 1
  %5 = alloca %"class.sw::universal::integer", align 1
  %6 = alloca %"class.sw::universal::integer", align 1
  %7 = alloca %"class.sw::universal::integer", align 1
  %8 = tail call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %9 = icmp ult i64 %8, 2
  br i1 %9, label %10, label %12

10:                                               ; preds = %2
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str)
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef 0) #4
  br label %.loopexit

12:                                               ; preds = %2
  %13 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #4
  %14 = load i32, ptr %13, align 4, !tbaa !5
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef %14) #4
  %15 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %16 = icmp ugt i64 %15, 1
  br i1 %16, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %12, %.lr.ph
  %.08 = phi i64 [ %23, %.lr.ph ], [ 1, %12 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #4
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.08) #4
  %18 = load i32, ptr %17, align 4, !tbaa !5
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %5, i32 noundef %18) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #4
  %.sroa.0.0.copyload = load i8, ptr %1, align 1, !tbaa !9
  call void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Em(ptr noundef nonnull align 1 dereferenceable(1) %7, i64 noundef %.08) #4
  %19 = load i8, ptr %7, align 1
  %20 = call i8 @_ZN2sw9universal3powILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEES5_S5_(i8 %.sroa.0.0.copyload, i8 %19)
  store i8 %20, ptr %6, align 1
  %21 = call i8 @_ZN2sw9universalmlILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEERKS5_S7_(ptr noundef nonnull align 1 dereferenceable(1) %5, ptr noundef nonnull align 1 dereferenceable(1) %6)
  store i8 %21, ptr %4, align 1
  %22 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEpLERKS3_(ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #4
  %23 = add nuw i64 %.08, 1
  %24 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %25 = icmp ult i64 %23, %24
  br i1 %25, label %.lr.ph, label %.loopexit, !llvm.loop !10

.loopexit:                                        ; preds = %.lr.ph, %12, %10
  %26 = load i8, ptr %3, align 1
  ret i8 %26
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Ei(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i8 @_ZN2sw9universalmlILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEERKS5_S7_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local i8 @_ZN2sw9universal3powILj8EhLNS0_17IntegerNumberTypeE0EEENS0_7integerIXT_ET0_XT1_EEES5_S5_(i8, i8) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEC2Em(ptr noundef nonnull align 1 dereferenceable(1), i64 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZN2sw9universal7integerILj8EhLNS0_17IntegerNumberTypeE0EEpLERKS3_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass