; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/Random/BUTTONS (A)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global [1000 x [1000 x i32]], align 16
@b = external dso_local global [1000 x [1000 x i32]], align 16
@f = external dso_local global [1000 x [1000 x i32]], align 16
@ok1 = external dso_local global i8, align 1
@ok2 = external dso_local global i8, align 1
@r1 = external dso_local global %"class.std::vector", align 8
@c1 = external dso_local global %"class.std::vector", align 8
@r2 = external dso_local global %"class.std::vector", align 8
@c2 = external dso_local global %"class.std::vector", align 8
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7allzerov() #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 nounwind uwtable
declare dso_local void @_Z14toggle_column1i(i32 noundef) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6match1v() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6match2v() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6print1v() #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6print2v() #2

; 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
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @t)
  br label %12

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

16:                                               ; preds = %12
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @n)
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @r1) #5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @r2) #5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @c1) #5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @c2) #5
  store i8 1, ptr @ok2, align 1, !tbaa !9
  store i8 1, ptr @ok1, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %18

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

22:                                               ; preds = %18
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %57

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

24:                                               ; preds = %50, %23
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %53

29:                                               ; preds = %24
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1000 x i32], ptr %32, i64 0, i64 %34
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %35)
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000 x i32], ptr %39, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000 x [1000 x i32]], ptr @b, i64 0, i64 %45
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1000 x i32], ptr %46, i64 0, i64 %48
  store i32 %43, ptr %49, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %29
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %4, align 4, !tbaa !5
  br label %24, !llvm.loop !11

53:                                               ; preds = %28
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !13

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

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

62:                                               ; preds = %58
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %84

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

64:                                               ; preds = %77, %63
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1000 x [1000 x i32]], ptr @f, i64 0, i64 %71
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000 x i32], ptr %72, i64 0, i64 %74
  %76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %75)
  br label %77

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

80:                                               ; preds = %68
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %5, align 4, !tbaa !5
  br label %58, !llvm.loop !15

84:                                               ; preds = %62
  %85 = call noundef zeroext i1 @_Z7allzerov()
  br i1 %85, label %86, label %88

86:                                               ; preds = %84
  %87 = call i32 @puts(ptr noundef @.str.6)
  br label %12, !llvm.loop !16

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

89:                                               ; preds = %107, %88
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %110

94:                                               ; preds = %89
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1000 x i32], ptr @f, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp ne i32 %98, %102
  br i1 %103, label %104, label %106

104:                                              ; preds = %94
  %105 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z14toggle_column1i(i32 noundef %105)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @c1, ptr noundef nonnull align 4 dereferenceable(4) %7)
  br label %106

106:                                              ; preds = %104, %94
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !5
  br label %89, !llvm.loop !17

110:                                              ; preds = %93
  call void @_Z6match1v()
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %122, %110
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %125

116:                                              ; preds = %111
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = xor i32 %120, 1
  store i32 %121, ptr %119, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %116
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %8, align 4, !tbaa !5
  br label %111, !llvm.loop !18

125:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @r2, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %144, %125
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = load i32, ptr @n, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %147

131:                                              ; preds = %126
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [1000 x i32], ptr @f, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = icmp ne i32 %135, %139
  br i1 %140, label %141, label %143

141:                                              ; preds = %131
  %142 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z14toggle_column2i(i32 noundef %142)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @c2, ptr noundef nonnull align 4 dereferenceable(4) %10)
  br label %143

143:                                              ; preds = %141, %131
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %10, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %10, align 4, !tbaa !5
  br label %126, !llvm.loop !19

147:                                              ; preds = %130
  call void @_Z6match2v()
  %148 = load i8, ptr @ok1, align 1, !tbaa !9, !range !20, !noundef !21
  %149 = trunc i8 %148 to i1
  br i1 %149, label %155, label %150

150:                                              ; preds = %147
  %151 = load i8, ptr @ok2, align 1, !tbaa !9, !range !20, !noundef !21
  %152 = trunc i8 %151 to i1
  br i1 %152, label %155, label %153

153:                                              ; preds = %150
  %154 = call i32 @puts(ptr noundef @.str.7)
  br label %179

155:                                              ; preds = %150, %147
  %156 = load i8, ptr @ok1, align 1, !tbaa !9, !range !20, !noundef !21
  %157 = trunc i8 %156 to i1
  br i1 %157, label %158, label %172

158:                                              ; preds = %155
  %159 = load i8, ptr @ok2, align 1, !tbaa !9, !range !20, !noundef !21
  %160 = trunc i8 %159 to i1
  br i1 %160, label %161, label %172

161:                                              ; preds = %158
  %162 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @r1) #5
  %163 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @c1) #5
  %164 = add i64 %162, %163
  %165 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @r2) #5
  %166 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @c2) #5
  %167 = add i64 %165, %166
  %168 = icmp ule i64 %164, %167
  br i1 %168, label %169, label %170

169:                                              ; preds = %161
  call void @_Z6print1v()
  br label %171

170:                                              ; preds = %161
  call void @_Z6print2v()
  br label %171

171:                                              ; preds = %170, %169
  br label %178

172:                                              ; preds = %158, %155
  %173 = load i8, ptr @ok1, align 1, !tbaa !9, !range !20, !noundef !21
  %174 = trunc i8 %173 to i1
  br i1 %174, label %175, label %176

175:                                              ; preds = %172
  call void @_Z6print1v()
  br label %177

176:                                              ; preds = %172
  call void @_Z6print2v()
  br label %177

177:                                              ; preds = %176, %175
  br label %178

178:                                              ; preds = %177, %171
  br label %179

179:                                              ; preds = %178, %153
  br label %12, !llvm.loop !16

180:                                              ; preds = %12
  ret i32 0
}

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

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

declare i32 @puts(ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global [1000 x [1000 x i32]], align 16
@b = external dso_local local_unnamed_addr global [1000 x [1000 x i32]], align 16
@f = external dso_local global [1000 x [1000 x i32]], align 16
@ok1 = external dso_local local_unnamed_addr global i8, align 1
@ok2 = external dso_local local_unnamed_addr global i8, align 1
@r1 = external dso_local global %"class.std::vector", align 8
@c1 = external dso_local global %"class.std::vector", align 8
@r2 = external dso_local global %"class.std::vector", align 8
@c2 = external dso_local global %"class.std::vector", align 8
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7allzerov() 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 nounwind uwtable
declare dso_local void @_Z14toggle_column1i(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6match1v() local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6match2v() local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6print1v() local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6print2v() local_unnamed_addr #2

; 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
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @t)
  %5 = load i32, ptr @t, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @t, align 4, !tbaa !5
  %.not51 = icmp eq i32 %5, 0
  br i1 %.not51, label %._crit_edge54, label %.lr.ph53

.lr.ph53:                                         ; preds = %0, %.backedge
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @n)
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @r1) #5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @r2) #5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @c1) #5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @c2) #5
  store i8 1, ptr @ok2, align 1, !tbaa !9
  store i8 1, ptr @ok1, align 1, !tbaa !9
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.preheader30, label %._crit_edge38

.preheader31:                                     ; preds = %._crit_edge
  %10 = icmp sgt i32 %13, 0
  br i1 %10, label %.preheader, label %._crit_edge38

.preheader30:                                     ; preds = %.lr.ph53, %._crit_edge
  %11 = phi i32 [ %13, %._crit_edge ], [ %8, %.lr.ph53 ]
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %._crit_edge ], [ 0, %.lr.ph53 ]
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %.preheader30.._crit_edge_crit_edge

.preheader30.._crit_edge_crit_edge:               ; preds = %.preheader30
  %.pre73 = sext i32 %11 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader30.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre73, %.preheader30.._crit_edge_crit_edge ], [ %20, %.lr.ph ]
  %13 = phi i32 [ %11, %.preheader30.._crit_edge_crit_edge ], [ %19, %.lr.ph ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %14 = icmp slt i64 %indvars.iv.next59, %.pre-phi
  br i1 %14, label %.preheader30, label %.preheader31, !llvm.loop !11

.lr.ph:                                           ; preds = %.preheader30, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader30 ]
  %15 = getelementptr inbounds [1000 x [1000 x i32]], ptr @a, i64 0, i64 %indvars.iv58, i64 %indvars.iv
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %15)
  %17 = load i32, ptr %15, align 4, !tbaa !5
  %18 = getelementptr inbounds [1000 x [1000 x i32]], ptr @b, i64 0, i64 %indvars.iv58, i64 %indvars.iv
  store i32 %17, ptr %18, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = icmp slt i64 %indvars.iv.next, %20
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.preheader:                                       ; preds = %.preheader31, %._crit_edge36
  %22 = phi i32 [ %25, %._crit_edge36 ], [ %13, %.preheader31 ]
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %._crit_edge36 ], [ 0, %.preheader31 ]
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph35, label %.preheader.._crit_edge36_crit_edge

.preheader.._crit_edge36_crit_edge:               ; preds = %.preheader
  %.pre74 = sext i32 %22 to i64
  br label %._crit_edge36

._crit_edge38:                                    ; preds = %._crit_edge36, %.lr.ph53, %.preheader31
  %24 = call noundef zeroext i1 @_Z7allzerov()
  br i1 %24, label %32, label %36

._crit_edge36:                                    ; preds = %.lr.ph35, %.preheader.._crit_edge36_crit_edge
  %.pre-phi75 = phi i64 [ %.pre74, %.preheader.._crit_edge36_crit_edge ], [ %30, %.lr.ph35 ]
  %25 = phi i32 [ %22, %.preheader.._crit_edge36_crit_edge ], [ %29, %.lr.ph35 ]
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %26 = icmp slt i64 %indvars.iv.next65, %.pre-phi75
  br i1 %26, label %.preheader, label %._crit_edge38, !llvm.loop !15

.lr.ph35:                                         ; preds = %.preheader, %.lr.ph35
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.lr.ph35 ], [ 0, %.preheader ]
  %27 = getelementptr inbounds [1000 x [1000 x i32]], ptr @f, i64 0, i64 %indvars.iv64, i64 %indvars.iv61
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %27)
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next62, %30
  br i1 %31, label %.lr.ph35, label %._crit_edge36, !llvm.loop !16

32:                                               ; preds = %._crit_edge38
  %33 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.backedge

.backedge:                                        ; preds = %80, %92, %93, %90, %91, %32
  %34 = load i32, ptr @t, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %34, 0
  br i1 %.not, label %._crit_edge54, label %.lr.ph53, !llvm.loop !17

36:                                               ; preds = %._crit_edge38
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph41, label %._crit_edge42

._crit_edge42:                                    ; preds = %53, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  call void @_Z6match1v()
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph45.preheader, label %._crit_edge46

.lr.ph45.preheader:                               ; preds = %._crit_edge42
  %wide.trip.count = zext nneg i32 %39 to i64
  %min.iters.check = icmp ult i32 %39, 8
  br i1 %min.iters.check, label %.lr.ph45.preheader85, label %vector.ph

.lr.ph45.preheader85:                             ; preds = %middle.block, %.lr.ph45.preheader
  %indvars.iv67.ph = phi i64 [ 0, %.lr.ph45.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph45

vector.ph:                                        ; preds = %.lr.ph45.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %41 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %index
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %wide.load = load <4 x i32>, ptr %41, align 16, !tbaa !5
  %wide.load84 = load <4 x i32>, ptr %42, align 16, !tbaa !5
  %43 = xor <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %44 = xor <4 x i32> %wide.load84, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %43, ptr %41, align 16, !tbaa !5
  store <4 x i32> %44, ptr %42, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %45 = icmp eq i64 %index.next, %n.vec
  br i1 %45, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge46, label %.lr.ph45.preheader85

.lr.ph41:                                         ; preds = %36, %53
  %46 = phi i32 [ %54, %53 ], [ %37, %36 ]
  %storemerge39 = phi i32 [ %56, %53 ], [ 0, %36 ]
  %47 = sext i32 %storemerge39 to i64
  %48 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = getelementptr inbounds [1000 x i32], ptr @f, i64 0, i64 %47
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %.not28 = icmp eq i32 %49, %51
  br i1 %.not28, label %53, label %52

52:                                               ; preds = %.lr.ph41
  call void @_Z14toggle_column1i(i32 noundef %storemerge39)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @c1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  %.pre70 = load i32, ptr @n, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %.lr.ph41, %52
  %54 = phi i32 [ %46, %.lr.ph41 ], [ %.pre70, %52 ]
  %55 = phi i32 [ %storemerge39, %.lr.ph41 ], [ %.pre, %52 ]
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %1, align 4, !tbaa !5
  %57 = icmp slt i32 %56, %54
  br i1 %57, label %.lr.ph41, label %._crit_edge42, !llvm.loop !21

._crit_edge46:                                    ; preds = %.lr.ph45, %middle.block, %._crit_edge42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @r2, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph49, label %._crit_edge50

.lr.ph45:                                         ; preds = %.lr.ph45.preheader85, %.lr.ph45
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph45 ], [ %indvars.iv67.ph, %.lr.ph45.preheader85 ]
  %60 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %indvars.iv67
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = xor i32 %61, 1
  store i32 %62, ptr %60, align 4, !tbaa !5
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge46, label %.lr.ph45, !llvm.loop !22

._crit_edge50:                                    ; preds = %74, %._crit_edge46
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @_Z6match2v()
  %63 = load i8, ptr @ok1, align 1, !tbaa !9, !range !23, !noundef !24
  %64 = trunc nuw i8 %63 to i1
  %65 = load i8, ptr @ok2, align 1, !tbaa !9, !range !23, !noundef !24
  %66 = trunc nuw i8 %65 to i1
  br i1 %64, label %82, label %79

.lr.ph49:                                         ; preds = %._crit_edge46, %74
  %67 = phi i32 [ %75, %74 ], [ %58, %._crit_edge46 ]
  %storemerge2547 = phi i32 [ %77, %74 ], [ 0, %._crit_edge46 ]
  %68 = sext i32 %storemerge2547 to i64
  %69 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = getelementptr inbounds [1000 x i32], ptr @f, i64 0, i64 %68
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %.not27 = icmp eq i32 %70, %72
  br i1 %.not27, label %74, label %73

73:                                               ; preds = %.lr.ph49
  call void @_Z14toggle_column2i(i32 noundef %storemerge2547)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @c2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %.pre71 = load i32, ptr %3, align 4, !tbaa !5
  %.pre72 = load i32, ptr @n, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %.lr.ph49, %73
  %75 = phi i32 [ %67, %.lr.ph49 ], [ %.pre72, %73 ]
  %76 = phi i32 [ %storemerge2547, %.lr.ph49 ], [ %.pre71, %73 ]
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %3, align 4, !tbaa !5
  %78 = icmp slt i32 %77, %75
  br i1 %78, label %.lr.ph49, label %._crit_edge50, !llvm.loop !25

79:                                               ; preds = %._crit_edge50
  br i1 %66, label %93, label %80

80:                                               ; preds = %79
  %81 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %.backedge

82:                                               ; preds = %._crit_edge50
  br i1 %66, label %83, label %92

83:                                               ; preds = %82
  %84 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @r1) #5
  %85 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @c1) #5
  %86 = add i64 %85, %84
  %87 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @r2) #5
  %88 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @c2) #5
  %89 = add i64 %88, %87
  %.not26 = icmp ugt i64 %86, %89
  br i1 %.not26, label %91, label %90

90:                                               ; preds = %83
  call void @_Z6print1v()
  br label %.backedge

91:                                               ; preds = %83
  call void @_Z6print2v()
  br label %.backedge

92:                                               ; preds = %82
  call void @_Z6print1v()
  br label %.backedge

93:                                               ; preds = %79
  call void @_Z6print2v()
  br label %.backedge

._crit_edge54:                                    ; preds = %.backedge, %0
  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 @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !20, !19}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !12}


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