; LLVM IR from tangjz/acm-icpc :: hdu (6072)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Bitset = type { [4 x i64] }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@lbt = external dso_local global [65537 x i32], align 16
@tot = external dso_local global i32, align 4
@seq = external dso_local global [251 x i32], align 16
@ans = external dso_local global i32, align 4
@e = external dso_local global [251 x %struct.Bitset], align 16
@g = external dso_local global [251 x %struct.Bitset], align 16
@cur = external dso_local global %struct.Bitset, align 8
@buf = external dso_local global [251 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

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

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

12:                                               ; preds = %33, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 65537
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %36

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = and i32 %17, 1
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %16
  br label %28

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = ashr i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  br label %28

28:                                               ; preds = %21, %20
  %29 = phi i32 [ 0, %20 ], [ %27, %21 ]
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %31
  store i32 %29, ptr %32, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

36:                                               ; preds = %15
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %38

38:                                               ; preds = %168, %36
  %39 = load i32, ptr @t, align 4, !tbaa !5
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr @t, align 4, !tbaa !5
  %41 = icmp ne i32 %39, 0
  br i1 %41, label %42, label %169

42:                                               ; preds = %38
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %56, %42
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %59

49:                                               ; preds = %44
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [251 x %struct.Bitset], ptr @e, i64 0, i64 %51
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) %52)
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [251 x %struct.Bitset], ptr @g, i64 0, i64 %54
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) %55)
  br label %56

56:                                               ; preds = %49
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !11

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

60:                                               ; preds = %93, %59
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %96

65:                                               ; preds = %60
  %66 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %89, %65
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %72, label %71

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

72:                                               ; preds = %67
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [251 x i8], ptr @buf, i64 0, i64 %74
  %76 = load i8, ptr %75, align 1, !tbaa !12
  %77 = sext i8 %76 to i32
  %78 = icmp eq i32 %77, 49
  br i1 %78, label %79, label %88

79:                                               ; preds = %72
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [251 x %struct.Bitset], ptr @e, i64 0, i64 %81
  %83 = load i32, ptr %6, align 4, !tbaa !5
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %82, i32 noundef %83)
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [251 x %struct.Bitset], ptr @g, i64 0, i64 %85
  %87 = load i32, ptr %4, align 4, !tbaa !5
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %86, i32 noundef %87)
  br label %88

88:                                               ; preds = %79, %72
  br label %89

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

92:                                               ; preds = %71
  br label %93

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

96:                                               ; preds = %64
  br label %97

97:                                               ; preds = %165, %96
  %98 = load i32, ptr @m, align 4, !tbaa !5
  %99 = add nsw i32 %98, -1
  store i32 %99, ptr @m, align 4, !tbaa !5
  %100 = icmp ne i32 %98, 0
  br i1 %100, label %101, label %168

101:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %102 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %7)
  br label %103

103:                                              ; preds = %107, %101
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %7, align 4, !tbaa !5
  %106 = icmp ne i32 %104, 0
  br i1 %106, label %107, label %121

107:                                              ; preds = %103
  %108 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %8, ptr noundef %9)
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = add nsw i32 %109, -1
  store i32 %110, ptr %8, align 4, !tbaa !5
  %111 = load i32, ptr %9, align 4, !tbaa !5
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr %9, align 4, !tbaa !5
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [251 x %struct.Bitset], ptr @e, i64 0, i64 %114
  %116 = load i32, ptr %9, align 4, !tbaa !5
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %115, i32 noundef %116)
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [251 x %struct.Bitset], ptr @g, i64 0, i64 %118
  %120 = load i32, ptr %8, align 4, !tbaa !5
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %119, i32 noundef %120)
  br label %103, !llvm.loop !15

121:                                              ; preds = %103
  %122 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %122, ptr @tot, align 4, !tbaa !5
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) @cur)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %134, %121
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = load i32, ptr @n, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %137

128:                                              ; preds = %123
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = call noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(32) @cur, i32 noundef %129)
  br i1 %130, label %133, label %131

131:                                              ; preds = %128
  %132 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z4dfs1i(i32 noundef %132)
  br label %133

133:                                              ; preds = %131, %128
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %10, align 4, !tbaa !5
  br label %123, !llvm.loop !16

137:                                              ; preds = %127
  store i32 0, ptr @ans, align 4, !tbaa !5
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) @cur)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %162, %137
  %139 = load i32, ptr %11, align 4, !tbaa !5
  %140 = load i32, ptr @n, align 4, !tbaa !5
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 23, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %165

143:                                              ; preds = %138
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [251 x i32], ptr @seq, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = call noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(32) @cur, i32 noundef %147)
  br i1 %148, label %161, label %149

149:                                              ; preds = %143
  store i32 0, ptr @tot, align 4, !tbaa !5
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [251 x i32], ptr @seq, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %153)
  %154 = load i32, ptr @tot, align 4, !tbaa !5
  %155 = load i32, ptr @tot, align 4, !tbaa !5
  %156 = sub nsw i32 %155, 1
  %157 = mul nsw i32 %154, %156
  %158 = ashr i32 %157, 1
  %159 = load i32, ptr @ans, align 4, !tbaa !5
  %160 = add nsw i32 %159, %158
  store i32 %160, ptr @ans, align 4, !tbaa !5
  br label %161

161:                                              ; preds = %149, %143
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %11, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %11, align 4, !tbaa !5
  br label %138, !llvm.loop !17

165:                                              ; preds = %142
  %166 = load i32, ptr @ans, align 4, !tbaa !5
  %167 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %166)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %97, !llvm.loop !18

168:                                              ; preds = %97
  br label %38, !llvm.loop !19

169:                                              ; preds = %38
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #1 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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"

%struct.Bitset = type { [4 x i64] }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@lbt = external dso_local local_unnamed_addr global [65537 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@seq = external dso_local local_unnamed_addr global [251 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local global [251 x %struct.Bitset], align 16
@g = external dso_local global [251 x %struct.Bitset], align 16
@cur = external dso_local global %struct.Bitset, align 8
@buf = external dso_local global [251 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 -1, ptr @lbt, align 16, !tbaa !5
  br label %8

4:                                                ; preds = %8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %6 = load i32, ptr @t, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @t, align 4, !tbaa !5
  %.not55 = icmp eq i32 %6, 0
  br i1 %.not55, label %._crit_edge58, label %.lr.ph57

8:                                                ; preds = %8, %0
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %8 ]
  %9 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %indvars.iv
  store i32 0, ptr %9, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = lshr exact i64 %indvars.iv.next, 1
  %11 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  %14 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %indvars.iv.next
  store i32 %13, ptr %14, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 65537
  br i1 %exitcond.not.1, label %4, label %8, !llvm.loop !9

.loopexit:                                        ; preds = %._crit_edge52, %.preheader
  %15 = load i32, ptr @t, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %._crit_edge58, label %.lr.ph57, !llvm.loop !11

.lr.ph57:                                         ; preds = %4, %.loopexit
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %.preheader

.preheader34:                                     ; preds = %.lr.ph
  %20 = icmp sgt i32 %23, 0
  br i1 %20, label %.lr.ph40, label %.preheader

.lr.ph:                                           ; preds = %.lr.ph57, %.lr.ph
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %.lr.ph ], [ 0, %.lr.ph57 ]
  %21 = getelementptr inbounds [251 x %struct.Bitset], ptr @e, i64 0, i64 %indvars.iv60
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) %21)
  %22 = getelementptr inbounds [251 x %struct.Bitset], ptr @g, i64 0, i64 %indvars.iv60
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) %22)
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next61, %24
  br i1 %25, label %.lr.ph, label %.preheader34, !llvm.loop !12

.preheader:                                       ; preds = %._crit_edge, %.lr.ph57, %.preheader34
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = add nsw i32 %26, -1
  store i32 %27, ptr @m, align 4, !tbaa !5
  %.not3153 = icmp eq i32 %26, 0
  br i1 %.not3153, label %.loopexit, label %.lr.ph54

.lr.ph40:                                         ; preds = %.preheader34, %._crit_edge
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %._crit_edge ], [ 0, %.preheader34 ]
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @buf)
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph38, label %.lr.ph40.._crit_edge_crit_edge

.lr.ph40.._crit_edge_crit_edge:                   ; preds = %.lr.ph40
  %.pre72 = sext i32 %29 to i64
  br label %._crit_edge

.lr.ph38:                                         ; preds = %.lr.ph40
  %31 = getelementptr inbounds [251 x %struct.Bitset], ptr @e, i64 0, i64 %indvars.iv66
  %32 = trunc nuw nsw i64 %indvars.iv66 to i32
  br label %34

._crit_edge:                                      ; preds = %42, %.lr.ph40.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre72, %.lr.ph40.._crit_edge_crit_edge ], [ %44, %42 ]
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %33 = icmp slt i64 %indvars.iv.next67, %.pre-phi
  br i1 %33, label %.lr.ph40, label %.preheader, !llvm.loop !13

34:                                               ; preds = %.lr.ph38, %42
  %35 = phi i32 [ %29, %.lr.ph38 ], [ %43, %42 ]
  %indvars.iv63 = phi i64 [ 0, %.lr.ph38 ], [ %indvars.iv.next64, %42 ]
  %36 = getelementptr inbounds [251 x i8], ptr @buf, i64 0, i64 %indvars.iv63
  %37 = load i8, ptr %36, align 1, !tbaa !14
  %38 = icmp eq i8 %37, 49
  br i1 %38, label %39, label %42

39:                                               ; preds = %34
  %40 = trunc nuw nsw i64 %indvars.iv63 to i32
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %31, i32 noundef %40)
  %41 = getelementptr inbounds [251 x %struct.Bitset], ptr @g, i64 0, i64 %indvars.iv63
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef %32)
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %34, %39
  %43 = phi i32 [ %35, %34 ], [ %.pre, %39 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next64, %44
  br i1 %45, label %34, label %._crit_edge, !llvm.loop !15

.lr.ph54:                                         ; preds = %.preheader, %._crit_edge52
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %47 = load i32, ptr %1, align 4, !tbaa !5
  %48 = add nsw i32 %47, -1
  store i32 %48, ptr %1, align 4, !tbaa !5
  %.not3241 = icmp eq i32 %47, 0
  br i1 %.not3241, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %.lr.ph54, %.lr.ph43
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = add nsw i32 %50, -1
  store i32 %51, ptr %2, align 4, !tbaa !5
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %51 to i64
  %55 = getelementptr inbounds [251 x %struct.Bitset], ptr @e, i64 0, i64 %54
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %55, i32 noundef %53)
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [251 x %struct.Bitset], ptr @g, i64 0, i64 %57
  %59 = load i32, ptr %2, align 4, !tbaa !5
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(32) %58, i32 noundef %59)
  %60 = load i32, ptr %1, align 4, !tbaa !5
  %61 = add nsw i32 %60, -1
  store i32 %61, ptr %1, align 4, !tbaa !5
  %.not32 = icmp eq i32 %60, 0
  br i1 %.not32, label %._crit_edge44, label %.lr.ph43, !llvm.loop !16

._crit_edge44:                                    ; preds = %.lr.ph43, %.lr.ph54
  %62 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %62, ptr @tot, align 4, !tbaa !5
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) @cur)
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %.lr.ph47, label %._crit_edge48

._crit_edge48:                                    ; preds = %69, %._crit_edge44
  store i32 0, ptr @ans, align 4, !tbaa !5
  call void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32) @cur)
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %.lr.ph51, label %._crit_edge52

.lr.ph47:                                         ; preds = %._crit_edge44, %69
  %.02645 = phi i32 [ %70, %69 ], [ 0, %._crit_edge44 ]
  %67 = call noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(32) @cur, i32 noundef %.02645)
  br i1 %67, label %69, label %68

68:                                               ; preds = %.lr.ph47
  call void @_Z4dfs1i(i32 noundef %.02645)
  br label %69

69:                                               ; preds = %.lr.ph47, %68
  %70 = add nuw nsw i32 %.02645, 1
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %.lr.ph47, label %._crit_edge48, !llvm.loop !17

._crit_edge52:                                    ; preds = %88, %._crit_edge48
  %73 = load i32, ptr @ans, align 4, !tbaa !5
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %73)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %75 = load i32, ptr @m, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr @m, align 4, !tbaa !5
  %.not31 = icmp eq i32 %75, 0
  br i1 %.not31, label %.loopexit, label %.lr.ph54, !llvm.loop !18

.lr.ph51:                                         ; preds = %._crit_edge48, %88
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %88 ], [ 0, %._crit_edge48 ]
  %77 = getelementptr inbounds [251 x i32], ptr @seq, i64 0, i64 %indvars.iv69
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = call noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(32) @cur, i32 noundef %78)
  br i1 %79, label %88, label %80

80:                                               ; preds = %.lr.ph51
  store i32 0, ptr @tot, align 4, !tbaa !5
  %81 = load i32, ptr %77, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %81)
  %82 = load i32, ptr @tot, align 4, !tbaa !5
  %83 = add nsw i32 %82, -1
  %84 = mul nsw i32 %83, %82
  %85 = ashr i32 %84, 1
  %86 = load i32, ptr @ans, align 4, !tbaa !5
  %87 = add nsw i32 %85, %86
  store i32 %87, ptr @ans, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %.lr.ph51, %80
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %89 = load i32, ptr @n, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %indvars.iv.next70, %90
  br i1 %91, label %.lr.ph51, label %._crit_edge52, !llvm.loop !19

._crit_edge58:                                    ; preds = %.loopexit, %4
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset5clearEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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