; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (5727)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@e = external dso_local global [10 x %"class.std::vector"], align 16
@mp = external dso_local global [10 x [10 x i32]], align 16
@linker = external dso_local global [10 x i32], align 16
@vis = external dso_local global [10 x i32], align 16
@pos = external dso_local global [10 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsi(i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, 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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  br label %17

17:                                               ; preds = %163, %0
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  %19 = icmp ne i32 %18, -1
  br i1 %19, label %20, label %164

20:                                               ; preds = %17
  call void @llvm.memset.p0.i64(ptr align 16 @mp, i8 0, i64 400, i1 false)
  br label %21

21:                                               ; preds = %25, %20
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr %3, align 4, !tbaa !5
  %24 = icmp ne i32 %22, 0
  br i1 %24, label %25, label %33

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5, ptr noundef %6)
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10 x [10 x i32]], ptr @mp, i64 0, i64 %28
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [10 x i32], ptr %29, i64 0, i64 %31
  store i32 1, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %21, !llvm.loop !9

33:                                               ; preds = %21
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %33
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %163

38:                                               ; preds = %33
  store i32 10, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %49, %38
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %52

44:                                               ; preds = %39
  %45 = load i32, ptr %7, align 4, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [10 x i32], ptr @pos, i64 0, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %44
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %7, align 4, !tbaa !5
  br label %39, !llvm.loop !11

52:                                               ; preds = %43
  br label %53

53:                                               ; preds = %154, %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %63, %53
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %66

59:                                               ; preds = %54
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [10 x %"class.std::vector"], ptr @e, i64 0, i64 %61
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %62) #8
  br label %63

63:                                               ; preds = %59
  %64 = load i32, ptr %8, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %8, align 4, !tbaa !5
  br label %54, !llvm.loop !12

66:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %121, %66
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %124

72:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10 x i32], ptr @pos, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  store i32 %76, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = load i32, ptr %2, align 4, !tbaa !5
  %79 = icmp eq i32 %77, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %72
  %81 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @pos, i64 0, i64 1), align 4, !tbaa !5
  store i32 %81, ptr %12, align 4, !tbaa !5
  br label %88

82:                                               ; preds = %72
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [10 x i32], ptr @pos, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  store i32 %87, ptr %12, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %82, %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %117, %88
  %90 = load i32, ptr %13, align 4, !tbaa !5
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = icmp sle i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %120

94:                                               ; preds = %89
  %95 = load i32, ptr %13, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [10 x [10 x i32]], ptr @mp, i64 0, i64 %96
  %98 = load i32, ptr %11, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10 x i32], ptr %97, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %112, label %103

103:                                              ; preds = %94
  %104 = load i32, ptr %13, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [10 x [10 x i32]], ptr @mp, i64 0, i64 %105
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [10 x i32], ptr %106, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %113

112:                                              ; preds = %103, %94
  br label %117

113:                                              ; preds = %103
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [10 x %"class.std::vector"], ptr @e, i64 0, i64 %115
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %116, ptr noundef nonnull align 4 dereferenceable(4) %9)
  br label %117

117:                                              ; preds = %113, %112
  %118 = load i32, ptr %13, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %13, align 4, !tbaa !5
  br label %89, !llvm.loop !13

120:                                              ; preds = %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %9, align 4, !tbaa !5
  br label %67, !llvm.loop !14

124:                                              ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @linker, i8 -1, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %138, %124
  %126 = load i32, ptr %15, align 4, !tbaa !5
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = icmp sle i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 20, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %141

130:                                              ; preds = %125
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 40, i1 false)
  %131 = load i32, ptr %15, align 4, !tbaa !5
  %132 = call noundef i32 @_Z3dfsi(i32 noundef %131)
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %137

134:                                              ; preds = %130
  %135 = load i32, ptr %14, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %14, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %134, %130
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %15, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %15, align 4, !tbaa !5
  br label %125, !llvm.loop !15

141:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %142 = load i32, ptr %2, align 4, !tbaa !5
  %143 = load i32, ptr %14, align 4, !tbaa !5
  %144 = sub nsw i32 %142, %143
  store i32 %144, ptr %16, align 4, !tbaa !5
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %146 = load i32, ptr %145, align 4, !tbaa !5
  store i32 %146, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = icmp eq i32 %147, 0
  br i1 %148, label %149, label %150

149:                                              ; preds = %141
  store i32 9, ptr %10, align 4
  br label %151

150:                                              ; preds = %141
  store i32 0, ptr %10, align 4
  br label %151

151:                                              ; preds = %150, %149
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  %152 = load i32, ptr %10, align 4
  switch i32 %152, label %166 [
    i32 0, label %153
    i32 9, label %160
  ]

153:                                              ; preds = %151
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %2, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds i32, ptr @pos, i64 %156
  %158 = getelementptr inbounds i32, ptr %157, i64 1
  %159 = call noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef getelementptr inbounds (i32, ptr @pos, i64 2), ptr noundef %158)
  br i1 %159, label %53, label %160, !llvm.loop !16

160:                                              ; preds = %154, %151
  %161 = load i32, ptr %4, align 4, !tbaa !5
  %162 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %161)
  br label %163

163:                                              ; preds = %160, %36
  br label %17, !llvm.loop !17

164:                                              ; preds = %17
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %165 = load i32, ptr %1, align 4
  ret i32 %165

166:                                              ; preds = %151
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 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)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef, ptr noundef) #7

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@e = external dso_local global [10 x %"class.std::vector"], align 16
@mp = external dso_local local_unnamed_addr global [10 x [10 x i32]], align 16
@linker = external dso_local local_unnamed_addr global [10 x i32], align 16
@vis = external dso_local local_unnamed_addr global [10 x i32], align 16
@pos = external dso_local global [10 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsi(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not66 = icmp eq i32 %8, -1
  br i1 %.not66, label %._crit_edge69, label %.lr.ph68

.lr.ph68:                                         ; preds = %0, %76
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) @mp, i8 0, i64 400, i1 false)
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = add nsw i32 %9, -1
  store i32 %10, ptr %2, align 4, !tbaa !5
  %.not2938 = icmp eq i32 %9, 0
  br i1 %.not2938, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph68, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = load i32, ptr %5, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [10 x [10 x i32]], ptr @mp, i64 0, i64 %13, i64 %15
  store i32 1, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr %2, align 4, !tbaa !5
  %.not29 = icmp eq i32 %17, 0
  br i1 %.not29, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph68
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %23

21:                                               ; preds = %._crit_edge
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %76

23:                                               ; preds = %._crit_edge
  store i32 10, ptr %3, align 4, !tbaa !5
  %.not3039 = icmp slt i32 %19, 1
  br i1 %.not3039, label %.preheader.preheader, label %.lr.ph42.preheader

.lr.ph42.preheader:                               ; preds = %23
  %24 = add nuw i32 %19, 1
  %wide.trip.count = zext i32 %24 to i64
  %25 = zext nneg i32 %19 to i64
  %min.iters.check = icmp ult i32 %19, 8
  br i1 %min.iters.check, label %.lr.ph42.preheader93, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph42.preheader
  %n.vec = and i64 %25, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %26 = getelementptr inbounds [10 x i32], ptr @pos, i64 0, i64 %offset.idx
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  store <4 x i32> %vec.ind, ptr %26, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %27, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %28 = icmp eq i64 %index.next, %n.vec
  br i1 %28, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %25
  br i1 %cmp.n, label %.preheader.preheader, label %.lr.ph42.preheader93

.lr.ph42.preheader93:                             ; preds = %middle.block, %.lr.ph42.preheader
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph42.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph42

.lr.ph42:                                         ; preds = %.lr.ph42.preheader93, %.lr.ph42
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph42 ], [ %indvars.iv.ph, %.lr.ph42.preheader93 ]
  %29 = getelementptr inbounds [10 x i32], ptr @pos, i64 0, i64 %indvars.iv
  %30 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %30, ptr %29, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader.preheader, label %.lr.ph42, !llvm.loop !14

.preheader.preheader:                             ; preds = %.lr.ph42, %middle.block, %23
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %70
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %.not3143 = icmp slt i32 %31, 1
  br i1 %.not3143, label %._crit_edge47.thread, label %.lr.ph46

._crit_edge47.thread:                             ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  br label %._crit_edge57.thread

._crit_edge47:                                    ; preds = %.lr.ph46
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  store i32 1, ptr %6, align 4, !tbaa !5
  %.not3253 = icmp slt i32 %33, 1
  br i1 %.not3253, label %._crit_edge57.thread, label %.lr.ph56.split

.lr.ph46:                                         ; preds = %.preheader, %.lr.ph46
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %.lr.ph46 ], [ 1, %.preheader ]
  %32 = getelementptr inbounds [10 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv73
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #8
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %.not31.not = icmp slt i64 %indvars.iv73, %34
  br i1 %.not31.not, label %.lr.ph46, label %._crit_edge47, !llvm.loop !15

._crit_edge57.thread:                             ; preds = %._crit_edge47, %._crit_edge47.thread
  %.ph = phi i32 [ %31, %._crit_edge47.thread ], [ %33, %._crit_edge47 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) @linker, i8 -1, i64 40, i1 false)
  br label %._crit_edge64

._crit_edge57:                                    ; preds = %._crit_edge52
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) @linker, i8 -1, i64 40, i1 false)
  %.not3359 = icmp slt i32 %45, 1
  br i1 %.not3359, label %._crit_edge64, label %.lr.ph63

.lr.ph56.split:                                   ; preds = %._crit_edge47, %._crit_edge52
  %35 = phi i32 [ %45, %._crit_edge52 ], [ %33, %._crit_edge47 ]
  %storemerge54 = phi i32 [ %47, %._crit_edge52 ], [ 1, %._crit_edge47 ]
  %.not3548 = icmp slt i32 %35, 1
  br i1 %.not3548, label %._crit_edge52, label %.lr.ph51

.lr.ph51:                                         ; preds = %.lr.ph56.split
  %36 = icmp eq i32 %storemerge54, %35
  %37 = add nsw i32 %storemerge54, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [10 x i32], ptr @pos, i64 0, i64 %38
  %.023.in = select i1 %36, ptr getelementptr inbounds (i8, ptr @pos, i64 4), ptr %39
  %.023 = load i32, ptr %.023.in, align 4, !tbaa !5
  %40 = sext i32 %storemerge54 to i64
  %41 = getelementptr inbounds [10 x i32], ptr @pos, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = sext i32 %.023 to i64
  br label %48

._crit_edge52.loopexit:                           ; preds = %58
  %.pre79 = load i32, ptr %6, align 4, !tbaa !5
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %._crit_edge52.loopexit, %.lr.ph56.split
  %45 = phi i32 [ %59, %._crit_edge52.loopexit ], [ %35, %.lr.ph56.split ]
  %46 = phi i32 [ %.pre79, %._crit_edge52.loopexit ], [ %storemerge54, %.lr.ph56.split ]
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !5
  %.not32.not = icmp slt i32 %46, %45
  br i1 %.not32.not, label %.lr.ph56.split, label %._crit_edge57, !llvm.loop !16

48:                                               ; preds = %.lr.ph51, %58
  %49 = phi i32 [ %35, %.lr.ph51 ], [ %59, %58 ]
  %50 = phi i32 [ %35, %.lr.ph51 ], [ %60, %58 ]
  %indvars.iv76 = phi i64 [ 1, %.lr.ph51 ], [ %indvars.iv.next77, %58 ]
  %51 = getelementptr inbounds [10 x [10 x i32]], ptr @mp, i64 0, i64 %indvars.iv76, i64 %43
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %.not36 = icmp eq i32 %52, 0
  br i1 %.not36, label %53, label %58

53:                                               ; preds = %48
  %54 = getelementptr inbounds [10 x [10 x i32]], ptr @mp, i64 0, i64 %indvars.iv76, i64 %44
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %.not37 = icmp eq i32 %55, 0
  br i1 %.not37, label %56, label %58

56:                                               ; preds = %53
  %57 = getelementptr inbounds [10 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv76
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %48, %53, %56
  %59 = phi i32 [ %49, %48 ], [ %49, %53 ], [ %.pre, %56 ]
  %60 = phi i32 [ %50, %48 ], [ %50, %53 ], [ %.pre, %56 ]
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %61 = sext i32 %60 to i64
  %.not35.not = icmp slt i64 %indvars.iv76, %61
  br i1 %.not35.not, label %48, label %._crit_edge52.loopexit, !llvm.loop !18

._crit_edge64:                                    ; preds = %.lr.ph63, %._crit_edge57.thread, %._crit_edge57
  %.021.lcssa = phi i32 [ 0, %._crit_edge57 ], [ 0, %._crit_edge57.thread ], [ %spec.select, %.lr.ph63 ]
  %.lcssa = phi i32 [ %45, %._crit_edge57 ], [ %.ph, %._crit_edge57.thread ], [ %69, %.lr.ph63 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  %62 = sub nsw i32 %.lcssa, %.021.lcssa
  store i32 %62, ptr %7, align 4, !tbaa !5
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  store i32 %64, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %split, label %70

.lr.ph63:                                         ; preds = %._crit_edge57, %.lr.ph63
  %.061 = phi i32 [ %68, %.lr.ph63 ], [ 1, %._crit_edge57 ]
  %.02160 = phi i32 [ %spec.select, %.lr.ph63 ], [ 0, %._crit_edge57 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) @vis, i8 0, i64 40, i1 false)
  %66 = call noundef i32 @_Z3dfsi(i32 noundef %.061)
  %.not34 = icmp ne i32 %66, 0
  %67 = zext i1 %.not34 to i32
  %spec.select = add nuw nsw i32 %.02160, %67
  %68 = add nuw nsw i32 %.061, 1
  %69 = load i32, ptr %1, align 4, !tbaa !5
  %.not33.not = icmp slt i32 %.061, %69
  br i1 %.not33.not, label %.lr.ph63, label %._crit_edge64, !llvm.loop !19

70:                                               ; preds = %._crit_edge64
  %71 = load i32, ptr %1, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @pos, i64 4), i64 %72
  %73 = call noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @pos, i64 8), ptr noundef nonnull %gep)
  br i1 %73, label %.preheader, label %._crit_edge80, !llvm.loop !20

._crit_edge80:                                    ; preds = %70
  %.pre81 = load i32, ptr %3, align 4, !tbaa !5
  br label %split

split:                                            ; preds = %._crit_edge64, %._crit_edge80
  %74 = phi i32 [ %.pre81, %._crit_edge80 ], [ 0, %._crit_edge64 ]
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %74)
  br label %76

76:                                               ; preds = %split, %21
  %77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not = icmp eq i32 %77, -1
  br i1 %.not, label %._crit_edge69, label %.lr.ph68, !llvm.loop !21

._crit_edge69:                                    ; preds = %76, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 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 #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #7

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse 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 = { nofree 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass