; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-10-21 (F - Filter - lzy)

; 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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [16 x i64] }

@m = external dso_local global i32, align 4
@f = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@a = external dso_local global [109 x i32], align 16
@u = external dso_local global i32, align 4
@b = external dso_local global [1009 x %"class.std::bitset"], align 16
@c = external dso_local global { [16 x i64] }, align 8
@y = external dso_local global [1009 x i8], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 %"class.std::bitset", align 8
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = load ptr, ptr @stdin, align 8, !tbaa !5
  %13 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %12)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %14)
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @m, ptr noundef @f)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %33, %0
  %18 = load i32, ptr %2, align 4, !tbaa !9
  %19 = load i32, ptr @f, align 4, !tbaa !9
  %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 %36

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

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

36:                                               ; preds = %21
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %82, %36
  %39 = load i32, ptr %3, align 4, !tbaa !9
  %40 = load i32, ptr @n, align 4, !tbaa !9
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %85

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

44:                                               ; preds = %78, %43
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = load i32, ptr @m, align 4, !tbaa !9
  %47 = add nsw i32 %46, 3
  %48 = sdiv i32 %47, 4
  %49 = icmp slt i32 %45, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %44
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %81

51:                                               ; preds = %44
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %74, %51
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = icmp slt i32 %54, 4
  br i1 %55, label %57, label %56

56:                                               ; preds = %53
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %77

57:                                               ; preds = %53
  %58 = load i32, ptr @t, align 4, !tbaa !9
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = ashr i32 %58, %59
  %61 = and i32 %60, 1
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %73

63:                                               ; preds = %57
  %64 = load i32, ptr %3, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1009 x %"class.std::bitset"], ptr @b, i64 0, i64 %65
  %67 = load i32, ptr %5, align 4, !tbaa !9
  %68 = mul nsw i32 4, %67
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = add nsw i32 %68, %69
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %66, i64 noundef %71, i1 noundef zeroext true)
  br label %73

73:                                               ; preds = %63, %57
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %6, align 4, !tbaa !9
  br label %53, !llvm.loop !13

77:                                               ; preds = %56
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %5, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %5, align 4, !tbaa !9
  br label %44, !llvm.loop !14

81:                                               ; preds = %50
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %3, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %3, align 4, !tbaa !9
  br label %38, !llvm.loop !15

85:                                               ; preds = %42
  %86 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %146, %85
  %88 = load i32, ptr %7, align 4, !tbaa !9
  %89 = load i32, ptr @q, align 4, !tbaa !9
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %149

92:                                               ; preds = %87
  %93 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @u)
  %94 = load i32, ptr @m, align 4, !tbaa !9
  %95 = load i32, ptr @u, align 4, !tbaa !9
  %96 = srem i32 %95, %94
  store i32 %96, ptr @u, align 4, !tbaa !9
  %97 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE5resetEv(ptr noundef nonnull align 8 dereferenceable(128) @c) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %114, %92
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = load i32, ptr @f, align 4, !tbaa !9
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %98
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %117

103:                                              ; preds = %98
  %104 = load i32, ptr @u, align 4, !tbaa !9
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [109 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = mul nsw i32 %104, %108
  %110 = load i32, ptr @m, align 4, !tbaa !9
  %111 = srem i32 %109, %110
  %112 = sext i32 %111 to i64
  %113 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) @c, i64 noundef %112, i1 noundef zeroext true)
  br label %114

114:                                              ; preds = %103
  %115 = load i32, ptr %8, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %8, align 4, !tbaa !9
  br label %98, !llvm.loop !16

117:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %118

118:                                              ; preds = %142, %117
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = load i32, ptr @n, align 4, !tbaa !9
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %145

123:                                              ; preds = %118
  %124 = load i32, ptr %9, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1009 x i8], ptr @y, i64 0, i64 %125
  %127 = load i8, ptr %126, align 1, !tbaa !17, !range !19, !noundef !20
  %128 = trunc i8 %127 to i1
  br i1 %128, label %141, label %129

129:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 128, ptr %10) #6
  %130 = load i32, ptr %9, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1009 x %"class.std::bitset"], ptr @b, i64 0, i64 %131
  call void @_ZStanILm1009EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %10, ptr noundef nonnull align 8 dereferenceable(128) %132, ptr noundef nonnull align 8 dereferenceable(128) @c) #6
  %133 = call noundef zeroext i1 @_ZNKSt6bitsetILm1009EEeqERKS0_(ptr noundef nonnull align 8 dereferenceable(128) %10, ptr noundef nonnull align 8 dereferenceable(128) @c) #6
  %134 = load i32, ptr %9, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1009 x i8], ptr @y, i64 0, i64 %135
  %137 = zext i1 %133 to i8
  store i8 %137, ptr %136, align 1, !tbaa !17
  %138 = zext i1 %133 to i32
  %139 = load i32, ptr @ans, align 4, !tbaa !9
  %140 = add nsw i32 %139, %138
  store i32 %140, ptr @ans, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 128, ptr %10) #6
  br label %141

141:                                              ; preds = %129, %123
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %9, align 4, !tbaa !9
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %9, align 4, !tbaa !9
  br label %118, !llvm.loop !21

145:                                              ; preds = %122
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %7, align 4, !tbaa !9
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %7, align 4, !tbaa !9
  br label %87, !llvm.loop !22

149:                                              ; preds = %91
  %150 = load i32, ptr @ans, align 4, !tbaa !9
  %151 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %150)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %152

152:                                              ; preds = %167, %149
  %153 = load i32, ptr %11, align 4, !tbaa !9
  %154 = load i32, ptr @n, align 4, !tbaa !9
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %170

157:                                              ; preds = %152
  %158 = load i32, ptr %11, align 4, !tbaa !9
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [1009 x i8], ptr @y, i64 0, i64 %159
  %161 = load i8, ptr %160, align 1, !tbaa !17, !range !19, !noundef !20
  %162 = trunc i8 %161 to i1
  br i1 %162, label %163, label %166

163:                                              ; preds = %157
  %164 = load i32, ptr %11, align 4, !tbaa !9
  %165 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %164)
  br label %166

166:                                              ; preds = %163, %157
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %11, align 4, !tbaa !9
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %11, align 4, !tbaa !9
  br label %152, !llvm.loop !23

170:                                              ; preds = %156
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

; 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 noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128), i64 noundef, i1 noundef zeroext) #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZStanILm1009EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(128)) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm1009EEeqERKS0_(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(128)) #4 align 2

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

attributes #0 = { 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 #1 = { "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 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 = { 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 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


; 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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [16 x i64] }

@m = external dso_local global i32, align 4
@f = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@a = external dso_local global [109 x i32], align 16
@u = external dso_local global i32, align 4
@b = external dso_local global [1009 x %"class.std::bitset"], align 16
@c = external dso_local global { [16 x i64] }, align 8
@y = external dso_local local_unnamed_addr global [1009 x i8], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"class.std::bitset", align 8
  %2 = load ptr, ptr @stdin, align 8, !tbaa !5
  %3 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %2)
  %4 = load ptr, ptr @stdout, align 8, !tbaa !5
  %5 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %4)
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @m, ptr noundef nonnull @f)
  %7 = load i32, ptr @f, align 4, !tbaa !9
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @n)
  %10 = load i32, ptr @n, align 4, !tbaa !9
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.preheader35.preheader, label %._crit_edge42

.preheader35.preheader:                           ; preds = %._crit_edge
  %.pre = load i32, ptr @m, align 4, !tbaa !9
  br label %.preheader35

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %12)
  %14 = load i32, ptr @m, align 4, !tbaa !9
  %15 = load i32, ptr %12, align 4, !tbaa !9
  %16 = srem i32 %15, %14
  store i32 %16, ptr %12, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @f, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader35:                                     ; preds = %.preheader35.preheader, %._crit_edge40
  %20 = phi i32 [ %10, %.preheader35.preheader ], [ %27, %._crit_edge40 ]
  %21 = phi i32 [ %.pre, %.preheader35.preheader ], [ %28, %._crit_edge40 ]
  %indvars.iv64 = phi i64 [ 0, %.preheader35.preheader ], [ %indvars.iv.next65, %._crit_edge40 ]
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph39, label %._crit_edge40

.lr.ph39:                                         ; preds = %.preheader35
  %23 = getelementptr inbounds [1009 x %"class.std::bitset"], ptr @b, i64 0, i64 %indvars.iv64
  br label %31

._crit_edge42:                                    ; preds = %._crit_edge40, %._crit_edge
  %24 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @q)
  %25 = load i32, ptr @q, align 4, !tbaa !9
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph51, label %._crit_edge52

._crit_edge40.loopexit:                           ; preds = %56
  %.pre79 = load i32, ptr @n, align 4, !tbaa !9
  br label %._crit_edge40

._crit_edge40:                                    ; preds = %._crit_edge40.loopexit, %.preheader35
  %27 = phi i32 [ %.pre79, %._crit_edge40.loopexit ], [ %20, %.preheader35 ]
  %28 = phi i32 [ %57, %._crit_edge40.loopexit ], [ %21, %.preheader35 ]
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %29 = sext i32 %27 to i64
  %30 = icmp slt i64 %indvars.iv.next65, %29
  br i1 %30, label %.preheader35, label %._crit_edge42, !llvm.loop !13

31:                                               ; preds = %.lr.ph39, %56
  %indvars.iv61 = phi i64 [ 0, %.lr.ph39 ], [ %indvars.iv.next62, %56 ]
  %32 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @t)
  %33 = shl nsw i64 %indvars.iv61, 2
  %34 = load i32, ptr @t, align 4, !tbaa !9
  %35 = and i32 %34, 1
  %.not = icmp eq i32 %35, 0
  br i1 %.not, label %38, label %36

36:                                               ; preds = %31
  %37 = tail call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %23, i64 noundef %33, i1 noundef zeroext true)
  %.pre76 = load i32, ptr @t, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %31, %36
  %39 = phi i32 [ %34, %31 ], [ %.pre76, %36 ]
  %40 = and i32 %39, 2
  %.not.1 = icmp eq i32 %40, 0
  br i1 %.not.1, label %44, label %41

41:                                               ; preds = %38
  %42 = or disjoint i64 %33, 1
  %43 = tail call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %23, i64 noundef %42, i1 noundef zeroext true)
  %.pre77 = load i32, ptr @t, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %41, %38
  %45 = phi i32 [ %.pre77, %41 ], [ %39, %38 ]
  %46 = and i32 %45, 4
  %.not.2 = icmp eq i32 %46, 0
  br i1 %.not.2, label %50, label %47

47:                                               ; preds = %44
  %48 = or disjoint i64 %33, 2
  %49 = tail call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %23, i64 noundef %48, i1 noundef zeroext true)
  %.pre78 = load i32, ptr @t, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %47, %44
  %51 = phi i32 [ %.pre78, %47 ], [ %45, %44 ]
  %52 = and i32 %51, 8
  %.not.3 = icmp eq i32 %52, 0
  br i1 %.not.3, label %56, label %53

53:                                               ; preds = %50
  %54 = or disjoint i64 %33, 3
  %55 = tail call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %23, i64 noundef %54, i1 noundef zeroext true)
  br label %56

56:                                               ; preds = %53, %50
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %57 = load i32, ptr @m, align 4, !tbaa !9
  %58 = add nsw i32 %57, 3
  %59 = sdiv i32 %58, 4
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next62, %60
  br i1 %61, label %31, label %._crit_edge40.loopexit, !llvm.loop !14

._crit_edge52:                                    ; preds = %._crit_edge48, %._crit_edge42
  %62 = load i32, ptr @ans, align 4, !tbaa !9
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %62)
  %64 = load i32, ptr @n, align 4, !tbaa !9
  %65 = icmp sgt i32 %64, 0
  br i1 %65, label %.lr.ph55, label %._crit_edge56

.lr.ph51:                                         ; preds = %._crit_edge42, %._crit_edge48
  %.03049 = phi i32 [ %86, %._crit_edge48 ], [ 0, %._crit_edge42 ]
  %66 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @u)
  %67 = load i32, ptr @m, align 4, !tbaa !9
  %68 = load i32, ptr @u, align 4, !tbaa !9
  %69 = srem i32 %68, %67
  store i32 %69, ptr @u, align 4, !tbaa !9
  %70 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE5resetEv(ptr noundef nonnull align 8 dereferenceable(128) @c) #7
  %71 = load i32, ptr @f, align 4, !tbaa !9
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %.lr.ph45, label %.preheader

.preheader:                                       ; preds = %.lr.ph45, %.lr.ph51
  %73 = load i32, ptr @n, align 4, !tbaa !9
  %74 = icmp sgt i32 %73, 0
  br i1 %74, label %.lr.ph47, label %._crit_edge48

.lr.ph45:                                         ; preds = %.lr.ph51, %.lr.ph45
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph45 ], [ 0, %.lr.ph51 ]
  %75 = load i32, ptr @u, align 4, !tbaa !9
  %76 = getelementptr inbounds [109 x i32], ptr @a, i64 0, i64 %indvars.iv67
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = mul nsw i32 %77, %75
  %79 = load i32, ptr @m, align 4, !tbaa !9
  %80 = srem i32 %78, %79
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) @c, i64 noundef %81, i1 noundef zeroext true)
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %83 = load i32, ptr @f, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = icmp slt i64 %indvars.iv.next68, %84
  br i1 %85, label %.lr.ph45, label %.preheader, !llvm.loop !15

._crit_edge48:                                    ; preds = %100, %.preheader
  %86 = add nuw nsw i32 %.03049, 1
  %87 = load i32, ptr @q, align 4, !tbaa !9
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %.lr.ph51, label %._crit_edge52, !llvm.loop !16

.lr.ph47:                                         ; preds = %.preheader, %100
  %89 = phi i32 [ %101, %100 ], [ %73, %.preheader ]
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %100 ], [ 0, %.preheader ]
  %90 = getelementptr inbounds [1009 x i8], ptr @y, i64 0, i64 %indvars.iv70
  %91 = load i8, ptr %90, align 1, !tbaa !17, !range !19, !noundef !20
  %92 = trunc nuw i8 %91 to i1
  br i1 %92, label %100, label %93

93:                                               ; preds = %.lr.ph47
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %1) #7
  %94 = getelementptr inbounds [1009 x %"class.std::bitset"], ptr @b, i64 0, i64 %indvars.iv70
  call void @_ZStanILm1009EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %1, ptr noundef nonnull align 8 dereferenceable(128) %94, ptr noundef nonnull align 8 dereferenceable(128) @c) #7
  %95 = call noundef zeroext i1 @_ZNKSt6bitsetILm1009EEeqERKS0_(ptr noundef nonnull align 8 dereferenceable(128) %1, ptr noundef nonnull align 8 dereferenceable(128) @c) #7
  %96 = zext i1 %95 to i8
  store i8 %96, ptr %90, align 1, !tbaa !17
  %97 = zext i1 %95 to i32
  %98 = load i32, ptr @ans, align 4, !tbaa !9
  %99 = add nsw i32 %98, %97
  store i32 %99, ptr @ans, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %1) #7
  %.pre80 = load i32, ptr @n, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %.lr.ph47, %93
  %101 = phi i32 [ %89, %.lr.ph47 ], [ %.pre80, %93 ]
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %102 = sext i32 %101 to i64
  %103 = icmp slt i64 %indvars.iv.next71, %102
  br i1 %103, label %.lr.ph47, label %._crit_edge48, !llvm.loop !21

._crit_edge56:                                    ; preds = %111, %._crit_edge52
  ret i32 0

.lr.ph55:                                         ; preds = %._crit_edge52, %111
  %104 = phi i32 [ %112, %111 ], [ %64, %._crit_edge52 ]
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %111 ], [ 0, %._crit_edge52 ]
  %105 = getelementptr inbounds [1009 x i8], ptr @y, i64 0, i64 %indvars.iv73
  %106 = load i8, ptr %105, align 1, !tbaa !17, !range !19, !noundef !20
  %107 = trunc nuw i8 %106 to i1
  br i1 %107, label %108, label %111

108:                                              ; preds = %.lr.ph55
  %109 = trunc nuw nsw i64 %indvars.iv73 to i32
  %110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %109)
  %.pre81 = load i32, ptr @n, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %.lr.ph55, %108
  %112 = phi i32 [ %104, %.lr.ph55 ], [ %.pre81, %108 ]
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %113 = sext i32 %112 to i64
  %114 = icmp slt i64 %indvars.iv.next74, %113
  br i1 %114, label %.lr.ph55, label %._crit_edge56, !llvm.loop !22
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1009EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128), i64 noundef, i1 noundef zeroext) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZStanILm1009EESt6bitsetIXT_EERKS1_S3_(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm1009EEeqERKS0_(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #5 align 2

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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