; LLVM IR from eyangch/competitive-programming :: Codeforces/1475 (f)

; 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] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::bitset<1000>::reference" = type { ptr, i64 }

@N = external dso_local global i32, align 4
@a = external dso_local global [1000 x %"class.std::bitset"], align 16
@b = external dso_local global [1000 x %"class.std::bitset"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::bitset<1000>::reference", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::bitset<1000>::reference", align 8
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::bitset<1000>::reference", align 8
  %16 = alloca %"class.std::bitset<1000>::reference", align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"class.std::bitset<1000>::reference", align 8
  %20 = alloca %"class.std::bitset<1000>::reference", align 8
  %21 = alloca i32, align 4
  %22 = alloca i8, align 1
  %23 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %24 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %25 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %26 = getelementptr i8, ptr %25, i64 -24
  %27 = load i64, ptr %26, align 8
  %28 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %27
  %29 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %28, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %31

31:                                               ; preds = %254, %0
  %32 = load i32, ptr %2, align 4, !tbaa !8
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %2, align 4, !tbaa !8
  %34 = icmp ne i32 %32, 0
  br i1 %34, label %35, label %261

35:                                               ; preds = %31
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %37

37:                                               ; preds = %86, %35
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = load i32, ptr @N, align 4, !tbaa !8
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 4, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %90

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(128) %45) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  %47 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %48 unwind label %54

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

49:                                               ; preds = %73, %48
  %50 = load i32, ptr %8, align 4, !tbaa !8
  %51 = load i32, ptr @N, align 4, !tbaa !8
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %58, label %53

53:                                               ; preds = %49
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %85

54:                                               ; preds = %42
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %6, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %7, align 4
  br label %89

58:                                               ; preds = %49
  %59 = load i32, ptr %8, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %60)
          to label %62 unwind label %76

62:                                               ; preds = %58
  %63 = load i8, ptr %61, align 1, !tbaa !11
  %64 = sext i8 %63 to i32
  %65 = icmp eq i32 %64, 49
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %66 = load i32, ptr %3, align 4, !tbaa !8
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %67
  %69 = load i32, ptr %8, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  invoke void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1000>::reference") align 8 %9, ptr noundef nonnull align 8 dereferenceable(128) %68, i64 noundef %70)
          to label %71 unwind label %80

71:                                               ; preds = %62
  %72 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm1000EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %9, i1 noundef zeroext %65) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  br label %73

73:                                               ; preds = %71
  %74 = load i32, ptr %8, align 4, !tbaa !8
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %8, align 4, !tbaa !8
  br label %49, !llvm.loop !12

76:                                               ; preds = %58
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %6, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %7, align 4
  br label %84

80:                                               ; preds = %62
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %6, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  br label %84

84:                                               ; preds = %80, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %89

85:                                               ; preds = %53
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #6
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %3, align 4, !tbaa !8
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %3, align 4, !tbaa !8
  br label %37, !llvm.loop !14

89:                                               ; preds = %84, %54
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %263

90:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !8
  br label %91

91:                                               ; preds = %140, %90
  %92 = load i32, ptr %10, align 4, !tbaa !8
  %93 = load i32, ptr @N, align 4, !tbaa !8
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %144

96:                                               ; preds = %91
  %97 = load i32, ptr %10, align 4, !tbaa !8
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @b, i64 0, i64 %98
  %100 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(128) %99) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  %101 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %102 unwind label %108

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

103:                                              ; preds = %127, %102
  %104 = load i32, ptr %12, align 4, !tbaa !8
  %105 = load i32, ptr @N, align 4, !tbaa !8
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %112, label %107

107:                                              ; preds = %103
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %139

108:                                              ; preds = %96
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %6, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %7, align 4
  br label %143

112:                                              ; preds = %103
  %113 = load i32, ptr %12, align 4, !tbaa !8
  %114 = sext i32 %113 to i64
  %115 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %11, i64 noundef %114)
          to label %116 unwind label %130

116:                                              ; preds = %112
  %117 = load i8, ptr %115, align 1, !tbaa !11
  %118 = sext i8 %117 to i32
  %119 = icmp eq i32 %118, 49
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  %120 = load i32, ptr %10, align 4, !tbaa !8
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @b, i64 0, i64 %121
  %123 = load i32, ptr %12, align 4, !tbaa !8
  %124 = sext i32 %123 to i64
  invoke void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1000>::reference") align 8 %13, ptr noundef nonnull align 8 dereferenceable(128) %122, i64 noundef %124)
          to label %125 unwind label %134

125:                                              ; preds = %116
  %126 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm1000EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %13, i1 noundef zeroext %119) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %127

127:                                              ; preds = %125
  %128 = load i32, ptr %12, align 4, !tbaa !8
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %12, align 4, !tbaa !8
  br label %103, !llvm.loop !15

130:                                              ; preds = %112
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %6, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %7, align 4
  br label %138

134:                                              ; preds = %116
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %6, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %138

138:                                              ; preds = %134, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %143

139:                                              ; preds = %107
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %10, align 4, !tbaa !8
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %10, align 4, !tbaa !8
  br label %91, !llvm.loop !16

143:                                              ; preds = %138, %108
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %263

144:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %145

145:                                              ; preds = %185, %144
  %146 = load i32, ptr %14, align 4, !tbaa !8
  %147 = load i32, ptr @N, align 4, !tbaa !8
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %150, label %149

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

150:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  %151 = load i32, ptr %14, align 4, !tbaa !8
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %152
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1000>::reference") align 8 %15, ptr noundef nonnull align 8 dereferenceable(128) %153, i64 noundef 0)
  %154 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  %155 = zext i1 %154 to i32
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #6
  %156 = load i32, ptr %14, align 4, !tbaa !8
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @b, i64 0, i64 %157
  invoke void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1000>::reference") align 8 %16, ptr noundef nonnull align 8 dereferenceable(128) %158, i64 noundef 0)
          to label %159 unwind label %169

159:                                              ; preds = %150
  %160 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %16) #6
  %161 = zext i1 %160 to i32
  %162 = icmp ne i32 %155, %161
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  br i1 %162, label %163, label %184

163:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !8
  br label %164

164:                                              ; preds = %180, %163
  %165 = load i32, ptr %17, align 4, !tbaa !8
  %166 = load i32, ptr @N, align 4, !tbaa !8
  %167 = icmp slt i32 %165, %166
  br i1 %167, label %173, label %168

168:                                              ; preds = %164
  store i32 19, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %183

169:                                              ; preds = %150
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %6, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %263

173:                                              ; preds = %164
  %174 = load i32, ptr %14, align 4, !tbaa !8
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %175
  %177 = load i32, ptr %17, align 4, !tbaa !8
  %178 = sext i32 %177 to i64
  %179 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE4flipEm(ptr noundef nonnull align 8 dereferenceable(128) %176, i64 noundef %178)
  br label %180

180:                                              ; preds = %173
  %181 = load i32, ptr %17, align 4, !tbaa !8
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %17, align 4, !tbaa !8
  br label %164, !llvm.loop !17

183:                                              ; preds = %168
  br label %184

184:                                              ; preds = %183, %159
  br label %185

185:                                              ; preds = %184
  %186 = load i32, ptr %14, align 4, !tbaa !8
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %14, align 4, !tbaa !8
  br label %145, !llvm.loop !18

188:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !8
  br label %189

189:                                              ; preds = %227, %188
  %190 = load i32, ptr %18, align 4, !tbaa !8
  %191 = load i32, ptr @N, align 4, !tbaa !8
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %189
  store i32 22, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %230

194:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %195 = load i32, ptr %18, align 4, !tbaa !8
  %196 = sext i32 %195 to i64
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1000>::reference") align 8 %19, ptr noundef nonnull align 8 dereferenceable(128) @a, i64 noundef %196)
  %197 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %19) #6
  %198 = zext i1 %197 to i32
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #6
  %199 = load i32, ptr %18, align 4, !tbaa !8
  %200 = sext i32 %199 to i64
  invoke void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1000>::reference") align 8 %20, ptr noundef nonnull align 8 dereferenceable(128) @b, i64 noundef %200)
          to label %201 unwind label %211

201:                                              ; preds = %194
  %202 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %20) #6
  %203 = zext i1 %202 to i32
  %204 = icmp ne i32 %198, %203
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %20) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  br i1 %204, label %205, label %226

205:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !8
  br label %206

206:                                              ; preds = %222, %205
  %207 = load i32, ptr %21, align 4, !tbaa !8
  %208 = load i32, ptr @N, align 4, !tbaa !8
  %209 = icmp slt i32 %207, %208
  br i1 %209, label %215, label %210

210:                                              ; preds = %206
  store i32 25, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %225

211:                                              ; preds = %194
  %212 = landingpad { ptr, i32 }
          cleanup
  %213 = extractvalue { ptr, i32 } %212, 0
  store ptr %213, ptr %6, align 8
  %214 = extractvalue { ptr, i32 } %212, 1
  store i32 %214, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %263

215:                                              ; preds = %206
  %216 = load i32, ptr %21, align 4, !tbaa !8
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %217
  %219 = load i32, ptr %18, align 4, !tbaa !8
  %220 = sext i32 %219 to i64
  %221 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE4flipEm(ptr noundef nonnull align 8 dereferenceable(128) %218, i64 noundef %220)
  br label %222

222:                                              ; preds = %215
  %223 = load i32, ptr %21, align 4, !tbaa !8
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %21, align 4, !tbaa !8
  br label %206, !llvm.loop !19

225:                                              ; preds = %210
  br label %226

226:                                              ; preds = %225, %201
  br label %227

227:                                              ; preds = %226
  %228 = load i32, ptr %18, align 4, !tbaa !8
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %18, align 4, !tbaa !8
  br label %189, !llvm.loop !20

230:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #6
  store i8 1, ptr %22, align 1, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 0, ptr %23, align 4, !tbaa !8
  br label %231

231:                                              ; preds = %251, %230
  %232 = load i32, ptr %23, align 4, !tbaa !8
  %233 = load i32, ptr @N, align 4, !tbaa !8
  %234 = icmp slt i32 %232, %233
  br i1 %234, label %236, label %235

235:                                              ; preds = %231
  store i32 28, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %254

236:                                              ; preds = %231
  %237 = load i32, ptr %23, align 4, !tbaa !8
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %238
  %240 = load i32, ptr %23, align 4, !tbaa !8
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @b, i64 0, i64 %241
  %243 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EEeqERKS0_(ptr noundef nonnull align 8 dereferenceable(128) %239, ptr noundef nonnull align 8 dereferenceable(128) %242) #6
  %244 = zext i1 %243 to i32
  %245 = load i8, ptr %22, align 1, !tbaa !21, !range !23, !noundef !24
  %246 = trunc i8 %245 to i1
  %247 = zext i1 %246 to i32
  %248 = and i32 %247, %244
  %249 = icmp ne i32 %248, 0
  %250 = zext i1 %249 to i8
  store i8 %250, ptr %22, align 1, !tbaa !21
  br label %251

251:                                              ; preds = %236
  %252 = load i32, ptr %23, align 4, !tbaa !8
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %23, align 4, !tbaa !8
  br label %231, !llvm.loop !25

254:                                              ; preds = %235
  %255 = load i8, ptr %22, align 1, !tbaa !21, !range !23, !noundef !24
  %256 = trunc i8 %255 to i1
  %257 = zext i1 %256 to i64
  %258 = select i1 %256, ptr @.str, ptr @.str.1
  %259 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef %258)
  %260 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %259, ptr noundef @.str.2)
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #6
  br label %31, !llvm.loop !26

261:                                              ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %262 = load i32, ptr %1, align 4
  ret i32 %262

263:                                              ; preds = %211, %169, %143, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %264

264:                                              ; preds = %263
  %265 = load ptr, ptr %6, align 8
  %266 = load i32, ptr %7, align 4
  %267 = insertvalue { ptr, i32 } poison, ptr %265, 0
  %268 = insertvalue { ptr, i32 } %267, i32 %266, 1
  resume { ptr, i32 } %268
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<1000>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(128), i64 noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

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 = { 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 #3 = { 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = !{!22, !22, i64 0}
!22 = !{!"bool", !10, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !13}
!26 = distinct !{!26, !13}


; 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] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::bitset<1000>::reference" = type { ptr, i64 }

@N = external dso_local global i32, align 4
@a = external dso_local global [1000 x %"class.std::bitset"], align 16
@b = external dso_local global [1000 x %"class.std::bitset"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::bitset<1000>::reference", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::bitset<1000>::reference", align 8
  %6 = alloca %"class.std::bitset<1000>::reference", align 8
  %7 = alloca %"class.std::bitset<1000>::reference", align 8
  %8 = alloca %"class.std::bitset<1000>::reference", align 8
  %9 = alloca %"class.std::bitset<1000>::reference", align 8
  %10 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %17 = load i32, ptr %1, align 4, !tbaa !8
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr %1, align 4, !tbaa !8
  %.not83 = icmp eq i32 %17, 0
  br i1 %.not83, label %._crit_edge86, label %.lr.ph85

.lr.ph85:                                         ; preds = %0, %85
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %20 = load i32, ptr @N, align 4, !tbaa !8
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph65, label %._crit_edge82.thread

.preheader61:                                     ; preds = %._crit_edge
  %22 = icmp sgt i32 %28, 0
  br i1 %22, label %.lr.ph70, label %._crit_edge82.thread

.lr.ph65:                                         ; preds = %.lr.ph85, %._crit_edge
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %._crit_edge ], [ 0, %.lr.ph85 ]
  %23 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv91
  %24 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(128) %23) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #6
  %25 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %.preheader57 unwind label %31

.preheader57:                                     ; preds = %.lr.ph65
  %26 = load i32, ptr @N, align 4, !tbaa !8
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader57
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %28 = load i32, ptr @N, align 4, !tbaa !8
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next92, %29
  br i1 %30, label %.lr.ph65, label %.preheader61, !llvm.loop !11

31:                                               ; preds = %.lr.ph65
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  br label %98

.lr.ph:                                           ; preds = %.preheader57, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader57 ]
  %33 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %indvars.iv)
  %34 = load i8, ptr %33, align 1, !tbaa !13
  %35 = icmp eq i8 %34, 49
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1000>::reference") align 8 %3, ptr noundef nonnull align 8 dereferenceable(128) %23, i64 noundef %indvars.iv)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm1000EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %3, i1 noundef zeroext %35) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = load i32, ptr @N, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next, %38
  br i1 %39, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.preheader60:                                     ; preds = %._crit_edge68
  %40 = icmp sgt i32 %46, 0
  br i1 %40, label %.lr.ph74, label %._crit_edge82.thread

.lr.ph70:                                         ; preds = %.preheader61, %._crit_edge68
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %._crit_edge68 ], [ 0, %.preheader61 ]
  %41 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @b, i64 0, i64 %indvars.iv97
  %42 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(128) %41) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  %43 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %.preheader56 unwind label %49

.preheader56:                                     ; preds = %.lr.ph70
  %44 = load i32, ptr @N, align 4, !tbaa !8
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph67, label %._crit_edge68

._crit_edge68:                                    ; preds = %.lr.ph67, %.preheader56
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %46 = load i32, ptr @N, align 4, !tbaa !8
  %47 = sext i32 %46 to i64
  %48 = icmp slt i64 %indvars.iv.next98, %47
  br i1 %48, label %.lr.ph70, label %.preheader60, !llvm.loop !15

49:                                               ; preds = %.lr.ph70
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  br label %98

.lr.ph67:                                         ; preds = %.preheader56, %.lr.ph67
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %.lr.ph67 ], [ 0, %.preheader56 ]
  %51 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %indvars.iv94)
  %52 = load i8, ptr %51, align 1, !tbaa !13
  %53 = icmp eq i8 %52, 49
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1000>::reference") align 8 %5, ptr noundef nonnull align 8 dereferenceable(128) %41, i64 noundef %indvars.iv94)
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm1000EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %5, i1 noundef zeroext %53) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %55 = load i32, ptr @N, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next95, %56
  br i1 %57, label %.lr.ph67, label %._crit_edge68, !llvm.loop !16

.preheader59:                                     ; preds = %.loopexit55
  %58 = icmp sgt i32 %70, 0
  br i1 %58, label %.lr.ph78, label %._crit_edge82.thread

.lr.ph74:                                         ; preds = %.preheader60, %.loopexit55
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %.loopexit55 ], [ 0, %.preheader60 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %59 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv103
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1000>::reference") align 8 %6, ptr noundef nonnull align 8 dereferenceable(128) %59, i64 noundef 0)
  %60 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  %61 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @b, i64 0, i64 %indvars.iv103
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1000>::reference") align 8 %7, ptr noundef nonnull align 8 dereferenceable(128) %61, i64 noundef 0)
  %62 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  %63 = xor i1 %60, %62
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  %64 = load i32, ptr @N, align 4
  %65 = icmp sgt i32 %64, 0
  %or.cond = select i1 %63, i1 %65, i1 false
  br i1 %or.cond, label %.lr.ph72, label %.lr.ph74..loopexit55_crit_edge

.lr.ph74..loopexit55_crit_edge:                   ; preds = %.lr.ph74
  %.pre = sext i32 %64 to i64
  br label %.loopexit55

.lr.ph72:                                         ; preds = %.lr.ph74, %.lr.ph72
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %.lr.ph72 ], [ 0, %.lr.ph74 ]
  %66 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE4flipEm(ptr noundef nonnull align 8 dereferenceable(128) %59, i64 noundef %indvars.iv100)
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %67 = load i32, ptr @N, align 4, !tbaa !8
  %68 = sext i32 %67 to i64
  %69 = icmp slt i64 %indvars.iv.next101, %68
  br i1 %69, label %.lr.ph72, label %.loopexit55, !llvm.loop !17

.loopexit55:                                      ; preds = %.lr.ph72, %.lr.ph74..loopexit55_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.lr.ph74..loopexit55_crit_edge ], [ %68, %.lr.ph72 ]
  %70 = phi i32 [ %64, %.lr.ph74..loopexit55_crit_edge ], [ %67, %.lr.ph72 ]
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %71 = icmp slt i64 %indvars.iv.next104, %.pre-phi
  br i1 %71, label %.lr.ph74, label %.preheader59, !llvm.loop !18

.preheader58:                                     ; preds = %.loopexit
  %72 = icmp sgt i32 %83, 0
  br i1 %72, label %.lr.ph81, label %._crit_edge82.thread

.lr.ph78:                                         ; preds = %.preheader59, %.loopexit
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %.loopexit ], [ 0, %.preheader59 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1000>::reference") align 8 %8, ptr noundef nonnull align 8 dereferenceable(128) @a, i64 noundef %indvars.iv109)
  %73 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #6
  call void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1000>::reference") align 8 %9, ptr noundef nonnull align 8 dereferenceable(128) @b, i64 noundef %indvars.iv109)
  %74 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  %75 = xor i1 %73, %74
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  call void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  %76 = load i32, ptr @N, align 4
  %77 = icmp sgt i32 %76, 0
  %or.cond89 = select i1 %75, i1 %77, i1 false
  br i1 %or.cond89, label %.lr.ph76, label %.lr.ph78..loopexit_crit_edge

.lr.ph78..loopexit_crit_edge:                     ; preds = %.lr.ph78
  %.pre114 = sext i32 %76 to i64
  br label %.loopexit

.lr.ph76:                                         ; preds = %.lr.ph78, %.lr.ph76
  %indvars.iv106 = phi i64 [ %indvars.iv.next107, %.lr.ph76 ], [ 0, %.lr.ph78 ]
  %78 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv106
  %79 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1000EE4flipEm(ptr noundef nonnull align 8 dereferenceable(128) %78, i64 noundef %indvars.iv109)
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %80 = load i32, ptr @N, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = icmp slt i64 %indvars.iv.next107, %81
  br i1 %82, label %.lr.ph76, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph76, %.lr.ph78..loopexit_crit_edge
  %.pre-phi115 = phi i64 [ %.pre114, %.lr.ph78..loopexit_crit_edge ], [ %81, %.lr.ph76 ]
  %83 = phi i32 [ %76, %.lr.ph78..loopexit_crit_edge ], [ %80, %.lr.ph76 ]
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %84 = icmp slt i64 %indvars.iv.next110, %.pre-phi115
  br i1 %84, label %.lr.ph78, label %.preheader58, !llvm.loop !20

._crit_edge82:                                    ; preds = %.lr.ph81
  br i1 %94, label %._crit_edge82.thread, label %85

._crit_edge82.thread:                             ; preds = %.lr.ph85, %.preheader61, %.preheader60, %.preheader59, %.preheader58, %._crit_edge82
  br label %85

85:                                               ; preds = %._crit_edge82, %._crit_edge82.thread
  %86 = phi ptr [ @.str, %._crit_edge82.thread ], [ @.str.1, %._crit_edge82 ]
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %86)
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef nonnull @.str.2)
  %89 = load i32, ptr %1, align 4, !tbaa !8
  %90 = add nsw i32 %89, -1
  store i32 %90, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %89, 0
  br i1 %.not, label %._crit_edge86, label %.lr.ph85, !llvm.loop !21

.lr.ph81:                                         ; preds = %.preheader58, %.lr.ph81
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %.lr.ph81 ], [ 0, %.preheader58 ]
  %.04079 = phi i1 [ %94, %.lr.ph81 ], [ true, %.preheader58 ]
  %91 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv112
  %92 = getelementptr inbounds [1000 x %"class.std::bitset"], ptr @b, i64 0, i64 %indvars.iv112
  %93 = call noundef zeroext i1 @_ZNKSt6bitsetILm1000EEeqERKS0_(ptr noundef nonnull align 8 dereferenceable(128) %91, ptr noundef nonnull align 8 dereferenceable(128) %92) #6
  %94 = and i1 %.04079, %93
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %95 = load i32, ptr @N, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = icmp slt i64 %indvars.iv.next113, %96
  br i1 %97, label %.lr.ph81, label %._crit_edge82, !llvm.loop !22

._crit_edge86:                                    ; preds = %85, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

98:                                               ; preds = %49, %31
  %.pn = phi { ptr, i32 } [ %32, %31 ], [ %50, %49 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #2 align 2

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm1000EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<1000>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(128), i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm1000EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; 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 nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm1000EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

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 = { 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 #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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !10, i64 0}
!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 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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