; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2011-12/Jan (12 Jan G2)

; 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::__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::basic_ostream" = type { ptr, %"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 }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z6secondB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@card = external dso_local global [14 x [8 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z3genix(i32 noundef, i64 noundef) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4initv() #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  call void @_Z4initv()
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store i64 0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %184, %0
  %11 = load i32, ptr %4, align 4, !tbaa !9
  %12 = load i32, ptr @N, align 4, !tbaa !9
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %188

15:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %16 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %16, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = add nsw i32 %17, 1
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %21
  %23 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 4
  %24 = load i32, ptr %23, align 16, !tbaa !9
  %25 = add nsw i32 %24, 1
  %26 = sext i32 %25 to i64
  %27 = mul nsw i64 %19, %26
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %29
  %31 = getelementptr inbounds [8 x i32], ptr %30, i64 0, i64 5
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = add nsw i64 %27, %33
  %35 = load i32, ptr @M, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = srem i64 %34, %36
  %38 = invoke noundef zeroext i1 @_Z3genix(i32 noundef %18, i64 noundef %37)
          to label %39 unwind label %103

39:                                               ; preds = %15
  %40 = zext i1 %38 to i8
  store i8 %40, ptr %6, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %45
  %47 = getelementptr inbounds [8 x i32], ptr %46, i64 0, i64 6
  %48 = load i32, ptr %47, align 8, !tbaa !9
  %49 = add nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = mul nsw i64 %43, %50
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %53
  %55 = getelementptr inbounds [8 x i32], ptr %54, i64 0, i64 7
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = add nsw i64 %51, %57
  %59 = load i32, ptr @M, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = srem i64 %58, %60
  %62 = invoke noundef zeroext i1 @_Z3genix(i32 noundef %42, i64 noundef %61)
          to label %63 unwind label %107

63:                                               ; preds = %39
  %64 = zext i1 %62 to i8
  store i8 %64, ptr %9, align 1, !tbaa !11
  %65 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %66 = trunc i8 %65 to i1
  %67 = zext i1 %66 to i32
  %68 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %69 = trunc i8 %68 to i1
  %70 = zext i1 %69 to i32
  %71 = and i32 %67, %70
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %132

73:                                               ; preds = %63
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 66)
          to label %75 unwind label %107

75:                                               ; preds = %73
  %76 = load i32, ptr %4, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %77)
          to label %79 unwind label %107

79:                                               ; preds = %75
  %80 = load i8, ptr %78, align 1, !tbaa !15
  %81 = sext i8 %80 to i32
  %82 = icmp eq i32 %81, 66
  br i1 %82, label %83, label %111

83:                                               ; preds = %79
  %84 = load i64, ptr %2, align 8, !tbaa !5
  %85 = load i32, ptr %5, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %86
  %88 = getelementptr inbounds [8 x i32], ptr %87, i64 0, i64 6
  %89 = load i32, ptr %88, align 8, !tbaa !9
  %90 = add nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = mul nsw i64 %84, %91
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %94
  %96 = getelementptr inbounds [8 x i32], ptr %95, i64 0, i64 7
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = add nsw i64 %92, %98
  %100 = load i32, ptr @M, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = srem i64 %99, %101
  store i64 %102, ptr %2, align 8, !tbaa !5
  br label %131

103:                                              ; preds = %15
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %7, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %8, align 4
  br label %187

107:                                              ; preds = %134, %132, %75, %73, %39
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %7, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  br label %187

111:                                              ; preds = %79
  %112 = load i64, ptr %2, align 8, !tbaa !5
  %113 = load i32, ptr %5, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %114
  %116 = getelementptr inbounds [8 x i32], ptr %115, i64 0, i64 4
  %117 = load i32, ptr %116, align 16, !tbaa !9
  %118 = add nsw i32 %117, 1
  %119 = sext i32 %118 to i64
  %120 = mul nsw i64 %112, %119
  %121 = load i32, ptr %5, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %122
  %124 = getelementptr inbounds [8 x i32], ptr %123, i64 0, i64 5
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = add nsw i64 %120, %126
  %128 = load i32, ptr @M, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = srem i64 %127, %129
  store i64 %130, ptr %2, align 8, !tbaa !5
  br label %131

131:                                              ; preds = %111, %83
  br label %183

132:                                              ; preds = %63
  %133 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 84)
          to label %134 unwind label %107

134:                                              ; preds = %132
  %135 = load i32, ptr %4, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %136)
          to label %138 unwind label %107

138:                                              ; preds = %134
  %139 = load i8, ptr %137, align 1, !tbaa !15
  %140 = sext i8 %139 to i32
  %141 = icmp eq i32 %140, 66
  br i1 %141, label %142, label %162

142:                                              ; preds = %138
  %143 = load i64, ptr %2, align 8, !tbaa !5
  %144 = load i32, ptr %5, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %145
  %147 = getelementptr inbounds [8 x i32], ptr %146, i64 0, i64 2
  %148 = load i32, ptr %147, align 8, !tbaa !9
  %149 = add nsw i32 %148, 1
  %150 = sext i32 %149 to i64
  %151 = mul nsw i64 %143, %150
  %152 = load i32, ptr %5, align 4, !tbaa !9
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %153
  %155 = getelementptr inbounds [8 x i32], ptr %154, i64 0, i64 3
  %156 = load i32, ptr %155, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = add nsw i64 %151, %157
  %159 = load i32, ptr @M, align 4, !tbaa !9
  %160 = sext i32 %159 to i64
  %161 = srem i64 %158, %160
  store i64 %161, ptr %2, align 8, !tbaa !5
  br label %182

162:                                              ; preds = %138
  %163 = load i64, ptr %2, align 8, !tbaa !5
  %164 = load i32, ptr %5, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %165
  %167 = getelementptr inbounds [8 x i32], ptr %166, i64 0, i64 0
  %168 = load i32, ptr %167, align 16, !tbaa !9
  %169 = add nsw i32 %168, 1
  %170 = sext i32 %169 to i64
  %171 = mul nsw i64 %163, %170
  %172 = load i32, ptr %5, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %173
  %175 = getelementptr inbounds [8 x i32], ptr %174, i64 0, i64 1
  %176 = load i32, ptr %175, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = add nsw i64 %171, %177
  %179 = load i32, ptr @M, align 4, !tbaa !9
  %180 = sext i32 %179 to i64
  %181 = srem i64 %178, %180
  store i64 %181, ptr %2, align 8, !tbaa !5
  br label %182

182:                                              ; preds = %162, %142
  br label %183

183:                                              ; preds = %182, %131
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %4, align 4, !tbaa !9
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %4, align 4, !tbaa !9
  br label %10, !llvm.loop !16

187:                                              ; preds = %107, %103
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %190

188:                                              ; preds = %14
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %189 = load i32, ptr %1, align 4
  ret i32 %189

190:                                              ; preds = %187
  %191 = load ptr, ptr %7, align 8
  %192 = load i32, ptr %8, align 4
  %193 = insertvalue { ptr, i32 } poison, ptr %191, 0
  %194 = insertvalue { ptr, i32 } %193, i32 %192, 1
  resume { ptr, i32 } %194
}

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #4

; 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) #0 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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::__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::basic_ostream" = type { ptr, %"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 }

@N = external dso_local local_unnamed_addr global i32, align 4
@M = external dso_local local_unnamed_addr global i32, align 4
@_Z6secondB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@card = external dso_local local_unnamed_addr global [14 x [8 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z3genix(i32 noundef, i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  tail call void @_Z4initv()
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  %2 = load i32, ptr @N, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %.pre = load i32, ptr @M, align 4, !tbaa !5
  br label %.lr.ph

._crit_edge:                                      ; preds = %96, %0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  ret i32 0

.lr.ph:                                           ; preds = %.lr.ph.preheader, %96
  %4 = phi i32 [ %.pre, %.lr.ph.preheader ], [ %97, %96 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %96 ]
  %.034 = phi i64 [ 0, %.lr.ph.preheader ], [ %.1, %96 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %5 = getelementptr inbounds [14 x [8 x i32]], ptr @card, i64 0, i64 %indvars.iv
  %6 = getelementptr inbounds i8, ptr %5, i64 16
  %7 = load i32, ptr %6, align 16, !tbaa !5
  %8 = add nsw i32 %7, 1
  %9 = sext i32 %8 to i64
  %10 = mul nsw i64 %.034, %9
  %11 = getelementptr inbounds i8, ptr %5, i64 20
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = add nsw i64 %10, %13
  %15 = sext i32 %4 to i64
  %16 = srem i64 %14, %15
  %17 = trunc nuw nsw i64 %indvars.iv.next to i32
  %18 = invoke noundef zeroext i1 @_Z3genix(i32 noundef %17, i64 noundef %16)
          to label %19 unwind label %52

19:                                               ; preds = %.lr.ph
  %20 = getelementptr inbounds i8, ptr %5, i64 24
  %21 = load i32, ptr %20, align 8, !tbaa !5
  %22 = add nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %24 = mul nsw i64 %.034, %23
  %25 = getelementptr inbounds i8, ptr %5, i64 28
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = add nsw i64 %24, %27
  %29 = load i32, ptr @M, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = srem i64 %28, %30
  %32 = invoke noundef zeroext i1 @_Z3genix(i32 noundef %17, i64 noundef %31)
          to label %33 unwind label %54

33:                                               ; preds = %19
  %34 = and i1 %18, %32
  br i1 %34, label %35, label %65

35:                                               ; preds = %33
  %36 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 66)
          to label %37 unwind label %54

37:                                               ; preds = %35
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %indvars.iv)
  %39 = load i8, ptr %38, align 1, !tbaa !9
  %40 = icmp eq i8 %39, 66
  %41 = load i32, ptr @M, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  br i1 %40, label %43, label %56

43:                                               ; preds = %37
  %44 = load i32, ptr %20, align 8, !tbaa !5
  %45 = add nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = mul nsw i64 %.034, %46
  %48 = load i32, ptr %25, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = add nsw i64 %47, %49
  %51 = srem i64 %50, %42
  br label %96

52:                                               ; preds = %.lr.ph
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %101

54:                                               ; preds = %65, %35, %19
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %101

56:                                               ; preds = %37
  %57 = load i32, ptr %6, align 16, !tbaa !5
  %58 = add nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = mul nsw i64 %.034, %59
  %61 = load i32, ptr %11, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = add nsw i64 %60, %62
  %64 = srem i64 %63, %42
  br label %96

65:                                               ; preds = %33
  %66 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 84)
          to label %67 unwind label %54

67:                                               ; preds = %65
  %68 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z6secondB5cxx11, i64 noundef %indvars.iv)
  %69 = load i8, ptr %68, align 1, !tbaa !9
  %70 = icmp eq i8 %69, 66
  br i1 %70, label %71, label %84

71:                                               ; preds = %67
  %72 = getelementptr inbounds i8, ptr %5, i64 8
  %73 = load i32, ptr %72, align 8, !tbaa !5
  %74 = add nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = mul nsw i64 %.034, %75
  %77 = getelementptr inbounds i8, ptr %5, i64 12
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = add nsw i64 %76, %79
  %81 = load i32, ptr @M, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = srem i64 %80, %82
  br label %96

84:                                               ; preds = %67
  %85 = load i32, ptr %5, align 16, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = sext i32 %86 to i64
  %88 = mul nsw i64 %.034, %87
  %89 = getelementptr inbounds i8, ptr %5, i64 4
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = add nsw i64 %88, %91
  %93 = load i32, ptr @M, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = srem i64 %92, %94
  br label %96

96:                                               ; preds = %71, %84, %43, %56
  %97 = phi i32 [ %41, %43 ], [ %41, %56 ], [ %81, %71 ], [ %93, %84 ]
  %.1 = phi i64 [ %51, %43 ], [ %64, %56 ], [ %83, %71 ], [ %95, %84 ]
  %98 = load i32, ptr @N, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = icmp slt i64 %indvars.iv.next, %99
  br i1 %100, label %.lr.ph, label %._crit_edge, !llvm.loop !10

101:                                              ; preds = %54, %52
  %.pn = phi { ptr, i32 } [ %55, %54 ], [ %53, %52 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn
}

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #4

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


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