; LLVM IR from upupming/algorithm :: acwing/算法竞赛进阶指南/0x29-总结与练习/189. 乳草的入侵.ll (Z3dfsiii)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::pair.0" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@g = external dso_local global [110 x [110 x i8]], align 16
@s = external dso_local global %"class.std::set", align 8

; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3dfsiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::pair", align 4
  %18 = alloca %"struct.std::pair.0", align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %20
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [110 x i8], ptr %21, i64 0, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !9
  store i8 %25, ptr %8, align 1, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %27
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [110 x i8], ptr %28, i64 0, i64 %30
  store i8 77, ptr %31, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %32 = call noundef i64 @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %33 = call noundef zeroext i1 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #4
  br i1 %33, label %34, label %36

34:                                               ; preds = %3
  %35 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %35, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %110

36:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 2147483647, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 -1, ptr %12, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %93, %36
  %38 = load i32, ptr %12, align 4, !tbaa !5
  %39 = icmp sle i32 %38, 1
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %96

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 -1, ptr %13, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %89, %41
  %43 = load i32, ptr %13, align 4, !tbaa !5
  %44 = icmp sle i32 %43, 1
  br i1 %44, label %46, label %45

45:                                               ; preds = %42
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %92

46:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = load i32, ptr %12, align 4, !tbaa !5
  %49 = add nsw i32 %47, %48
  store i32 %49, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = load i32, ptr %13, align 4, !tbaa !5
  %52 = add nsw i32 %50, %51
  store i32 %52, ptr %15, align 4, !tbaa !5
  %53 = load i32, ptr %14, align 4, !tbaa !5
  %54 = load i32, ptr %15, align 4, !tbaa !5
  %55 = call noundef zeroext i1 @_Z5validii(i32 noundef %53, i32 noundef %54)
  br i1 %55, label %57, label %56

56:                                               ; preds = %46
  store i32 7, ptr %10, align 4
  br label %86

57:                                               ; preds = %46
  %58 = load i32, ptr %15, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %59
  %61 = load i32, ptr %14, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [110 x i8], ptr %60, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !9
  %65 = sext i8 %64 to i32
  %66 = icmp eq i32 %65, 42
  br i1 %66, label %77, label %67

67:                                               ; preds = %57
  %68 = load i32, ptr %15, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %69
  %71 = load i32, ptr %14, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [110 x i8], ptr %70, i64 0, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !9
  %75 = sext i8 %74 to i32
  %76 = icmp eq i32 %75, 77
  br i1 %76, label %77, label %78

77:                                               ; preds = %67, %57
  store i32 7, ptr %10, align 4
  br label %86

78:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  %81 = load i32, ptr %14, align 4, !tbaa !5
  %82 = load i32, ptr %15, align 4, !tbaa !5
  %83 = call noundef i32 @_Z3dfsiii(i32 noundef %80, i32 noundef %81, i32 noundef %82)
  store i32 %83, ptr %16, align 4, !tbaa !5
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %85 = load i32, ptr %84, align 4, !tbaa !5
  store i32 %85, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  store i32 0, ptr %10, align 4
  br label %86

86:                                               ; preds = %78, %77, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %87 = load i32, ptr %10, align 4
  switch i32 %87, label %112 [
    i32 0, label %88
    i32 7, label %89
  ]

88:                                               ; preds = %86
  br label %89

89:                                               ; preds = %88, %86
  %90 = load i32, ptr %13, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %13, align 4, !tbaa !5
  br label %42, !llvm.loop !10

92:                                               ; preds = %45
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %12, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %12, align 4, !tbaa !5
  br label %37, !llvm.loop !12

96:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %97 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %17)
  %98 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 0
  %99 = extractvalue { ptr, i8 } %97, 0
  store ptr %99, ptr %98, align 8
  %100 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 1
  %101 = extractvalue { ptr, i8 } %97, 1
  store i8 %101, ptr %100, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  %102 = load i8, ptr %8, align 1, !tbaa !9
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %104
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [110 x i8], ptr %105, i64 0, i64 %107
  store i8 %102, ptr %108, align 1, !tbaa !9
  %109 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %109, ptr %4, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %110

110:                                              ; preds = %96, %34
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  %111 = load i32, ptr %4, align 4
  ret i32 %111

112:                                              ; preds = %86
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint 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 #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"}
!12 = distinct !{!12, !11}


; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@g = external dso_local local_unnamed_addr global [110 x [110 x i8]], align 16
@s = external dso_local global %"class.std::set", align 8

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3dfsiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  store i32 %1, ptr %4, align 4, !tbaa !5
  store i32 %2, ptr %5, align 4, !tbaa !5
  %10 = sext i32 %2 to i64
  %11 = sext i32 %1 to i64
  %12 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %10, i64 %11
  %13 = load i8, ptr %12, align 1, !tbaa !9
  store i8 77, ptr %12, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %14 = call noundef i64 @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  %15 = call noundef zeroext i1 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #4
  br i1 %15, label %151, label %.preheader

.preheader:                                       ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  store i32 2147483647, ptr %7, align 4, !tbaa !5
  %16 = add nsw i32 %0, 1
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  %21 = call noundef zeroext i1 @_Z5validii(i32 noundef %18, i32 noundef %20)
  br i1 %21, label %22, label %31

22:                                               ; preds = %.preheader
  %23 = sext i32 %20 to i64
  %24 = sext i32 %18 to i64
  %25 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %23, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !9
  switch i8 %26, label %27 [
    i8 42, label %31
    i8 77, label %31
  ]

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %28 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %18, i32 noundef %20)
  store i32 %28, ptr %8, align 4, !tbaa !5
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %30 = load i32, ptr %29, align 4, !tbaa !5
  store i32 %30, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %31

31:                                               ; preds = %22, %22, %.preheader, %27
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = call noundef zeroext i1 @_Z5validii(i32 noundef %33, i32 noundef %34)
  br i1 %35, label %36, label %45

36:                                               ; preds = %31
  %37 = sext i32 %34 to i64
  %38 = sext i32 %33 to i64
  %39 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %37, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !9
  switch i8 %40, label %41 [
    i8 42, label %45
    i8 77, label %45
  ]

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %42 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %33, i32 noundef %34)
  store i32 %42, ptr %8, align 4, !tbaa !5
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %44 = load i32, ptr %43, align 4, !tbaa !5
  store i32 %44, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %45

45:                                               ; preds = %41, %36, %36, %31
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  %50 = call noundef zeroext i1 @_Z5validii(i32 noundef %47, i32 noundef %49)
  br i1 %50, label %51, label %.preheader.1

51:                                               ; preds = %45
  %52 = sext i32 %49 to i64
  %53 = sext i32 %47 to i64
  %54 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %52, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !9
  switch i8 %55, label %56 [
    i8 42, label %.preheader.1
    i8 77, label %.preheader.1
  ]

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %57 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %47, i32 noundef %49)
  store i32 %57, ptr %8, align 4, !tbaa !5
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %59 = load i32, ptr %58, align 4, !tbaa !5
  store i32 %59, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %.preheader.1

.preheader.1:                                     ; preds = %56, %51, %51, %45
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = add nsw i32 %61, -1
  %63 = call noundef zeroext i1 @_Z5validii(i32 noundef %60, i32 noundef %62)
  br i1 %63, label %64, label %73

64:                                               ; preds = %.preheader.1
  %65 = sext i32 %62 to i64
  %66 = sext i32 %60 to i64
  %67 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %65, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !9
  switch i8 %68, label %69 [
    i8 42, label %73
    i8 77, label %73
  ]

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %70 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %60, i32 noundef %62)
  store i32 %70, ptr %8, align 4, !tbaa !5
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %72 = load i32, ptr %71, align 4, !tbaa !5
  store i32 %72, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %73

73:                                               ; preds = %69, %64, %64, %.preheader.1
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = call noundef zeroext i1 @_Z5validii(i32 noundef %74, i32 noundef %75)
  br i1 %76, label %77, label %86

77:                                               ; preds = %73
  %78 = sext i32 %75 to i64
  %79 = sext i32 %74 to i64
  %80 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %78, i64 %79
  %81 = load i8, ptr %80, align 1, !tbaa !9
  switch i8 %81, label %82 [
    i8 42, label %86
    i8 77, label %86
  ]

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %83 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %74, i32 noundef %75)
  store i32 %83, ptr %8, align 4, !tbaa !5
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %85 = load i32, ptr %84, align 4, !tbaa !5
  store i32 %85, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %86

86:                                               ; preds = %82, %77, %77, %73
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  %90 = call noundef zeroext i1 @_Z5validii(i32 noundef %87, i32 noundef %89)
  br i1 %90, label %91, label %.preheader.2

91:                                               ; preds = %86
  %92 = sext i32 %89 to i64
  %93 = sext i32 %87 to i64
  %94 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %92, i64 %93
  %95 = load i8, ptr %94, align 1, !tbaa !9
  switch i8 %95, label %96 [
    i8 42, label %.preheader.2
    i8 77, label %.preheader.2
  ]

96:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %97 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %87, i32 noundef %89)
  store i32 %97, ptr %8, align 4, !tbaa !5
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %99 = load i32, ptr %98, align 4, !tbaa !5
  store i32 %99, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %.preheader.2

.preheader.2:                                     ; preds = %96, %91, %91, %86
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = add nsw i32 %102, -1
  %104 = call noundef zeroext i1 @_Z5validii(i32 noundef %101, i32 noundef %103)
  br i1 %104, label %105, label %114

105:                                              ; preds = %.preheader.2
  %106 = sext i32 %103 to i64
  %107 = sext i32 %101 to i64
  %108 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %106, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !9
  switch i8 %109, label %110 [
    i8 42, label %114
    i8 77, label %114
  ]

110:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %111 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %101, i32 noundef %103)
  store i32 %111, ptr %8, align 4, !tbaa !5
  %112 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %113 = load i32, ptr %112, align 4, !tbaa !5
  store i32 %113, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %114

114:                                              ; preds = %110, %105, %105, %.preheader.2
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  %117 = load i32, ptr %5, align 4, !tbaa !5
  %118 = call noundef zeroext i1 @_Z5validii(i32 noundef %116, i32 noundef %117)
  br i1 %118, label %119, label %128

119:                                              ; preds = %114
  %120 = sext i32 %117 to i64
  %121 = sext i32 %116 to i64
  %122 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %120, i64 %121
  %123 = load i8, ptr %122, align 1, !tbaa !9
  switch i8 %123, label %124 [
    i8 42, label %128
    i8 77, label %128
  ]

124:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %125 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %116, i32 noundef %117)
  store i32 %125, ptr %8, align 4, !tbaa !5
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %127 = load i32, ptr %126, align 4, !tbaa !5
  store i32 %127, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %128

128:                                              ; preds = %124, %119, %119, %114
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  %133 = call noundef zeroext i1 @_Z5validii(i32 noundef %130, i32 noundef %132)
  br i1 %133, label %134, label %143

134:                                              ; preds = %128
  %135 = sext i32 %132 to i64
  %136 = sext i32 %130 to i64
  %137 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %135, i64 %136
  %138 = load i8, ptr %137, align 1, !tbaa !9
  switch i8 %138, label %139 [
    i8 42, label %143
    i8 77, label %143
  ]

139:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %140 = call noundef i32 @_Z3dfsiii(i32 noundef %16, i32 noundef %130, i32 noundef %132)
  store i32 %140, ptr %8, align 4, !tbaa !5
  %141 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %142 = load i32, ptr %141, align 4, !tbaa !5
  store i32 %142, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %143

143:                                              ; preds = %139, %134, %134, %128
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %144 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  %145 = load i32, ptr %5, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [110 x [110 x i8]], ptr @g, i64 0, i64 %146, i64 %148
  store i8 %13, ptr %149, align 1, !tbaa !9
  %150 = load i32, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  br label %151

151:                                              ; preds = %3, %143
  %.0 = phi i32 [ %150, %143 ], [ %0, %3 ]
  ret i32 %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass