; LLVM IR from tangjz/acm-icpc :: uvalive (5874)

; 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<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<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 <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@val = external dso_local global [404 x i32], align 16
@e = external dso_local global [404 x [404 x i32]], align 16
@match = external dso_local global [404 x i32], align 16
@ans = external dso_local global i32, align 4
@Hash = external dso_local global %"class.std::set", align 8
@vis = external dso_local global [404 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4pathi(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 %"struct.std::pair", align 8
  %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
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %11

11:                                               ; preds = %121, %0
  %12 = load i32, ptr @t, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @t, align 4, !tbaa !5
  %14 = icmp ne i32 %12, 0
  br i1 %14, label %15, label %125

15:                                               ; preds = %11
  call void @_ZNSt3setIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #6
  call void @llvm.memset.p0.i64(ptr align 16 @match, i8 -1, i64 1616, i1 false)
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %31, %15
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %34

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @val, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %25)
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %28
  %30 = getelementptr inbounds [404 x i32], ptr %29, i64 0, i64 0
  store i32 0, ptr %30, align 16, !tbaa !5
  br label %31

31:                                               ; preds = %22
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

34:                                               ; preds = %21
  br label %35

35:                                               ; preds = %39, %34
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  store i32 %37, ptr @m, align 4, !tbaa !5
  %38 = icmp ne i32 %36, 0
  br i1 %38, label %39, label %46

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %41 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %42 = getelementptr inbounds { ptr, i8 }, ptr %4, i32 0, i32 0
  %43 = extractvalue { ptr, i8 } %41, 0
  store ptr %43, ptr %42, align 8
  %44 = getelementptr inbounds { ptr, i8 }, ptr %4, i32 0, i32 1
  %45 = extractvalue { ptr, i8 } %41, 1
  store i8 %45, ptr %44, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %35, !llvm.loop !11

46:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %102, %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  store i32 9, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %105

52:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %7, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %98, %52
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  store i32 12, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %101

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [404 x i32], ptr @val, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [404 x i32], ptr @val, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %64, %68
  store i32 %69, ptr %8, align 4, !tbaa !5
  %70 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %71 = icmp ne i64 %70, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br i1 %71, label %72, label %97

72:                                               ; preds = %60
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %75
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %78
  %80 = getelementptr inbounds [404 x i32], ptr %79, i64 0, i64 0
  %81 = load i32, ptr %80, align 16, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %80, align 16, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [404 x i32], ptr %76, i64 0, i64 %83
  store i32 %73, ptr %84, align 4, !tbaa !5
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %87
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %90
  %92 = getelementptr inbounds [404 x i32], ptr %91, i64 0, i64 0
  %93 = load i32, ptr %92, align 16, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %92, align 16, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [404 x i32], ptr %88, i64 0, i64 %95
  store i32 %85, ptr %96, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %72, %60
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %7, align 4, !tbaa !5
  br label %55, !llvm.loop !12

101:                                              ; preds = %59
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %5, align 4, !tbaa !5
  br label %47, !llvm.loop !13

105:                                              ; preds = %51
  store i32 0, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %118, %105
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  store i32 15, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %121

111:                                              ; preds = %106
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 404, i1 false)
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = call noundef zeroext i1 @_Z4pathi(i32 noundef %112)
  br i1 %113, label %114, label %117

114:                                              ; preds = %111
  %115 = load i32, ptr @ans, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr @ans, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %114, %111
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %9, align 4, !tbaa !5
  br label %106, !llvm.loop !14

121:                                              ; preds = %110
  %122 = load i32, ptr @ans, align 4, !tbaa !5
  %123 = ashr i32 %122, 1
  %124 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %123)
  br label %11, !llvm.loop !15

125:                                              ; preds = %11
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) #4 align 2

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

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

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

declare i32 @printf(ptr noundef, ...) #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 = { 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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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}


; 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<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<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 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@val = external dso_local global [404 x i32], align 16
@e = external dso_local local_unnamed_addr global [404 x [404 x i32]], align 16
@match = external dso_local local_unnamed_addr global [404 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@Hash = external dso_local global %"class.std::set", align 8
@vis = external dso_local local_unnamed_addr global [404 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4pathi(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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not37 = icmp eq i32 %4, 0
  br i1 %.not37, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %0, %._crit_edge36
  call void @_ZNSt3setIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1616) @match, i8 -1, i64 1616, i1 false)
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.preheader25

.preheader25:                                     ; preds = %.lr.ph, %.lr.ph39
  %9 = phi i32 [ %7, %.lr.ph39 ], [ %15, %.lr.ph ]
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @m, align 4, !tbaa !5
  %.not2327 = icmp eq i32 %10, 0
  br i1 %.not2327, label %.preheader, label %.lr.ph28

.lr.ph:                                           ; preds = %.lr.ph39, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph39 ]
  %12 = getelementptr inbounds i32, ptr @val, i64 %indvars.iv
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %12)
  %14 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %indvars.iv
  store i32 0, ptr %14, align 16, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %.preheader25, !llvm.loop !9

.preheader.loopexit:                              ; preds = %.lr.ph28
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader25
  %18 = phi i32 [ %.pre, %.preheader.loopexit ], [ %9, %.preheader25 ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph32, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader
  store i32 0, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge36

.lr.ph28:                                         ; preds = %.preheader25, %.lr.ph28
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %21 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr @m, align 4, !tbaa !5
  %.not23 = icmp eq i32 %22, 0
  br i1 %.not23, label %.preheader.loopexit, label %.lr.ph28, !llvm.loop !11

.loopexit.loopexit:                               ; preds = %50
  %.pre51 = sext i32 %51 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph32
  %.pre-phi = phi i64 [ %.pre51, %.loopexit.loopexit ], [ %28, %.lr.ph32 ]
  %24 = phi i32 [ %51, %.loopexit.loopexit ], [ %27, %.lr.ph32 ]
  %25 = icmp slt i64 %indvars.iv.next48, %.pre-phi
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  br i1 %25, label %.lr.ph32, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %.loopexit
  store i32 0, ptr @ans, align 4, !tbaa !5
  %26 = icmp sgt i32 %24, 0
  br i1 %26, label %.lr.ph35, label %._crit_edge36

.lr.ph32:                                         ; preds = %.preheader, %.loopexit
  %27 = phi i32 [ %24, %.loopexit ], [ %18, %.preheader ]
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %.loopexit ], [ 0, %.preheader ]
  %indvars.iv42 = phi i64 [ %indvars.iv.next43, %.loopexit ], [ 1, %.preheader ]
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next48, %28
  br i1 %29, label %.lr.ph30, label %.loopexit

.lr.ph30:                                         ; preds = %.lr.ph32
  %30 = getelementptr inbounds [404 x i32], ptr @val, i64 0, i64 %indvars.iv47
  %31 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %indvars.iv47
  %32 = trunc nuw nsw i64 %indvars.iv47 to i32
  br label %33

33:                                               ; preds = %.lr.ph30, %50
  %indvars.iv44 = phi i64 [ %indvars.iv42, %.lr.ph30 ], [ %indvars.iv.next45, %50 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %34 = load i32, ptr %30, align 4, !tbaa !5
  %35 = getelementptr inbounds [404 x i32], ptr @val, i64 0, i64 %indvars.iv44
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %36, %34
  store i32 %37, ptr %2, align 4, !tbaa !5
  %38 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %.not24 = icmp eq i64 %38, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  br i1 %.not24, label %50, label %39

39:                                               ; preds = %33
  %40 = load i32, ptr %31, align 16, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %31, align 16, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %indvars.iv47, i64 %42
  %44 = trunc nuw nsw i64 %indvars.iv44 to i32
  store i32 %44, ptr %43, align 4, !tbaa !5
  %45 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %indvars.iv44
  %46 = load i32, ptr %45, align 16, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %45, align 16, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [404 x [404 x i32]], ptr @e, i64 0, i64 %indvars.iv44, i64 %48
  store i32 %32, ptr %49, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %33, %39
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = trunc nuw i64 %indvars.iv.next45 to i32
  %53 = icmp sgt i32 %51, %52
  br i1 %53, label %33, label %.loopexit.loopexit, !llvm.loop !13

._crit_edge36.loopexit:                           ; preds = %63
  %.pre50 = load i32, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge36

._crit_edge36:                                    ; preds = %._crit_edge.thread, %._crit_edge36.loopexit, %._crit_edge
  %54 = phi i32 [ %.pre50, %._crit_edge36.loopexit ], [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ]
  %55 = ashr i32 %54, 1
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %55)
  %57 = load i32, ptr @t, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %57, 0
  br i1 %.not, label %._crit_edge40, label %.lr.ph39, !llvm.loop !14

.lr.ph35:                                         ; preds = %._crit_edge, %63
  %.033 = phi i32 [ %64, %63 ], [ 0, %._crit_edge ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) @vis, i8 0, i64 404, i1 false)
  %59 = call noundef zeroext i1 @_Z4pathi(i32 noundef %.033)
  br i1 %59, label %60, label %63

60:                                               ; preds = %.lr.ph35
  %61 = load i32, ptr @ans, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr @ans, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %.lr.ph35, %60
  %64 = add nuw nsw i32 %.033, 1
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %.lr.ph35, label %._crit_edge36.loopexit, !llvm.loop !15

._crit_edge40:                                    ; preds = %._crit_edge36, %0
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 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 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass