; LLVM IR from thepowersgang/mrustc :: src/hir (path)

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

%"struct.HIR::PathParams" = type { %class.ThinVector.0, %class.ThinVector.1, %class.ThinVector.2 }
%class.ThinVector.0 = type { ptr }
%class.ThinVector.1 = type { ptr }
%class.ThinVector.2 = type { ptr }

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK3HIR10PathParams25compare_with_placeholdersERK4SpanRKS0_RKNS_19ResolvePlaceholdersE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #1 align 2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %14 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  %15 = getelementptr inbounds %"struct.HIR::PathParams", ptr %14, i32 0, i32 1
  %16 = call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
  %17 = icmp ugt i64 %16, 0
  br i1 %17, label %23, label %18

18:                                               ; preds = %4
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.HIR::PathParams", ptr %19, i32 0, i32 1
  %21 = call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %20)
  %22 = icmp ugt i64 %21, 0
  br i1 %22, label %23, label %70

23:                                               ; preds = %18, %4
  %24 = getelementptr inbounds %"struct.HIR::PathParams", ptr %14, i32 0, i32 1
  %25 = call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.HIR::PathParams", ptr %26, i32 0, i32 1
  %28 = call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %29 = icmp ne i64 %25, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %23
  store i32 2, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %72

31:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %32

32:                                               ; preds = %64, %31
  %33 = load i32, ptr %12, align 4, !tbaa !11
  %34 = zext i32 %33 to i64
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.HIR::PathParams", ptr %35, i32 0, i32 1
  %37 = call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %36)
  %38 = icmp ult i64 %34, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %32
  store i32 2, ptr %11, align 4
  br label %67

40:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %41 = getelementptr inbounds %"struct.HIR::PathParams", ptr %14, i32 0, i32 1
  %42 = load i32, ptr %12, align 4, !tbaa !11
  %43 = zext i32 %42 to i64
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10ThinVectorIN3HIR7TypeRefEEixEm(ptr noundef nonnull align 8 dereferenceable(8) %41, i64 noundef %43)
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.HIR::PathParams", ptr %46, i32 0, i32 1
  %48 = load i32, ptr %12, align 4, !tbaa !11
  %49 = zext i32 %48 to i64
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10ThinVectorIN3HIR7TypeRefEEixEm(ptr noundef nonnull align 8 dereferenceable(8) %47, i64 noundef %49)
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = call noundef i32 @_ZNK3HIR7TypeRef25compare_with_placeholdersERK4SpanRKS0_RKNS_19ResolvePlaceholdersE(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef nonnull align 8 dereferenceable(8) %51)
  store i32 %52, ptr %13, align 4, !tbaa !9
  %53 = load i32, ptr %13, align 4, !tbaa !9
  %54 = icmp eq i32 %53, 2
  br i1 %54, label %55, label %56

55:                                               ; preds = %40
  store i32 2, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %61

56:                                               ; preds = %40
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 1
  br i1 %58, label %59, label %60

59:                                               ; preds = %56
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %59, %56
  store i32 0, ptr %11, align 4
  br label %61

61:                                               ; preds = %60, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %62 = load i32, ptr %11, align 4
  switch i32 %62, label %67 [
    i32 0, label %63
  ]

63:                                               ; preds = %61
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %12, align 4, !tbaa !11
  %66 = add i32 %65, 1
  store i32 %66, ptr %12, align 4, !tbaa !11
  br label %32, !llvm.loop !13

67:                                               ; preds = %61, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %68 = load i32, ptr %11, align 4
  switch i32 %68, label %72 [
    i32 2, label %69
  ]

69:                                               ; preds = %67
  br label %70

70:                                               ; preds = %69, %18
  %71 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %71, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %72

72:                                               ; preds = %70, %67, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %73 = load i32, ptr %5, align 4
  ret i32 %73
}

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

declare noundef i32 @_ZNK3HIR7TypeRef25compare_with_placeholdersERK4SpanRKS0_RKNS_19ResolvePlaceholdersE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 }

!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 = !{!"_ZTSN3HIR7CompareE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK3HIR10PathParams25compare_with_placeholdersERK4SpanRKS0_RKNS_19ResolvePlaceholdersE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = tail call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %7, label %10

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = tail call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %.not26 = icmp eq i64 %9, 0
  br i1 %.not26, label %.loopexit, label %10

10:                                               ; preds = %7, %4
  %11 = tail call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %12 = getelementptr inbounds i8, ptr %2, i64 8
  %13 = tail call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %.not27 = icmp eq i64 %11, %13
  br i1 %.not27, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %10
  %14 = tail call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %.not2931.not = icmp eq i64 %14, 0
  br i1 %.not2931.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %19
  %15 = phi i64 [ %22, %19 ], [ 0, %.preheader ]
  %.01733 = phi i32 [ %21, %19 ], [ 0, %.preheader ]
  %.02032 = phi i32 [ %spec.select, %19 ], [ 0, %.preheader ]
  %16 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10ThinVectorIN3HIR7TypeRefEEixEm(ptr noundef nonnull align 8 dereferenceable(8) %5, i64 noundef %15)
  %17 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK10ThinVectorIN3HIR7TypeRefEEixEm(ptr noundef nonnull align 8 dereferenceable(8) %12, i64 noundef %15)
  %18 = tail call noundef i32 @_ZNK3HIR7TypeRef25compare_with_placeholdersERK4SpanRKS0_RKNS_19ResolvePlaceholdersE(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %.not28 = icmp eq i32 %18, 2
  br i1 %.not28, label %.loopexit, label %19

19:                                               ; preds = %.lr.ph
  %20 = icmp eq i32 %18, 1
  %spec.select = select i1 %20, i32 1, i32 %.02032
  %21 = add i32 %.01733, 1
  %22 = zext i32 %21 to i64
  %23 = tail call noundef i64 @_ZNK10ThinVectorIN3HIR7TypeRefEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %.not29 = icmp ugt i64 %23, %22
  br i1 %.not29, label %.lr.ph, label %.loopexit, !llvm.loop !5

.loopexit:                                        ; preds = %19, %.lr.ph, %.preheader, %7, %10
  %.3 = phi i32 [ 2, %10 ], [ 0, %7 ], [ 0, %.preheader ], [ %spec.select, %19 ], [ 2, %.lr.ph ]
  ret i32 %.3
}

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

declare noundef i32 @_ZNK3HIR7TypeRef25compare_with_placeholdersERK4SpanRKS0_RKNS_19ResolvePlaceholdersE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #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 = { "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" }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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