; LLVM IR from brpapa/algorithms :: solutions/uva/989.ll (Z2bti)

; 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::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
@board = external dso_local global [9 x [9 x i32]], align 16
@changeable = external dso_local global [9 x [9 x i8]], align 16
@hasSolution = external dso_local global i8, align 1
@usedOnRow = external dso_local global [9 x [10 x i8]], align 16
@usedOnCol = external dso_local global [9 x [10 x i8]], align 16
@usedOnBox = external dso_local global [9 x [10 x i8]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10markUsedAsbiii(i1 noundef zeroext, i32 noundef, i32 noundef, i32 noundef) #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 uwtable
define dso_local void @_Z2bti(i32 noundef %0) #2 {
  %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
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = mul nsw i32 %11, %12
  %14 = sdiv i32 %10, %13
  store i32 %14, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = mul nsw i32 %16, %17
  %19 = srem i32 %15, %18
  store i32 %19, ptr %4, align 4, !tbaa !5
  %20 = load i8, ptr @hasSolution, align 1, !tbaa !9, !range !11, !noundef !12
  %21 = trunc i8 %20 to i1
  br i1 %21, label %22, label %23

22:                                               ; preds = %1
  store i32 1, ptr %5, align 4
  br label %158

23:                                               ; preds = %1
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = mul nsw i32 %25, %26
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = mul nsw i32 %28, %29
  %31 = mul nsw i32 %27, %30
  %32 = icmp eq i32 %24, %31
  br i1 %32, label %33, label %80

33:                                               ; preds = %23
  store i8 1, ptr @hasSolution, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %76, %33
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = mul nsw i32 %36, %37
  %39 = icmp slt i32 %35, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %34
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %79

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

42:                                               ; preds = %60, %41
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = mul nsw i32 %44, %45
  %47 = sub nsw i32 %46, 1
  %48 = icmp slt i32 %43, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %42
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %63

50:                                               ; preds = %42
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [9 x [9 x i32]], ptr @board, i64 0, i64 %52
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [9 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %57)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef @.str)
  br label %60

60:                                               ; preds = %50
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %7, align 4, !tbaa !5
  br label %42, !llvm.loop !13

63:                                               ; preds = %49
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [9 x [9 x i32]], ptr @board, i64 0, i64 %65
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = mul nsw i32 %67, %68
  %70 = sub nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [9 x i32], ptr %66, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %73)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %76

76:                                               ; preds = %63
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %6, align 4, !tbaa !5
  br label %34, !llvm.loop !15

79:                                               ; preds = %40
  store i32 1, ptr %5, align 4
  br label %158

80:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = load i32, ptr %3, align 4, !tbaa !5
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = sdiv i32 %82, %83
  %85 = mul nsw i32 %81, %84
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = sdiv i32 %86, %87
  %89 = add nsw i32 %85, %88
  store i32 %89, ptr %8, align 4, !tbaa !5
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [9 x [9 x i8]], ptr @changeable, i64 0, i64 %91
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [9 x i8], ptr %92, i64 0, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !9, !range !11, !noundef !12
  %97 = trunc i8 %96 to i1
  br i1 %97, label %101, label %98

98:                                               ; preds = %80
  %99 = load i32, ptr %2, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  call void @_Z2bti(i32 noundef %100)
  br label %157

101:                                              ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %153, %101
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = load i32, ptr @n, align 4, !tbaa !5
  %106 = mul nsw i32 %104, %105
  %107 = icmp sle i32 %103, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %102
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %156

109:                                              ; preds = %102
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [9 x [10 x i8]], ptr @usedOnRow, i64 0, i64 %111
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [10 x i8], ptr %112, i64 0, i64 %114
  %116 = load i8, ptr %115, align 1, !tbaa !9, !range !11, !noundef !12
  %117 = trunc i8 %116 to i1
  br i1 %117, label %152, label %118

118:                                              ; preds = %109
  %119 = load i32, ptr %4, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [9 x [10 x i8]], ptr @usedOnCol, i64 0, i64 %120
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [10 x i8], ptr %121, i64 0, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !9, !range !11, !noundef !12
  %126 = trunc i8 %125 to i1
  br i1 %126, label %152, label %127

127:                                              ; preds = %118
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [9 x [10 x i8]], ptr @usedOnBox, i64 0, i64 %129
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [10 x i8], ptr %130, i64 0, i64 %132
  %134 = load i8, ptr %133, align 1, !tbaa !9, !range !11, !noundef !12
  %135 = trunc i8 %134 to i1
  br i1 %135, label %152, label %136

136:                                              ; preds = %127
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = load i32, ptr %3, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [9 x [9 x i32]], ptr @board, i64 0, i64 %139
  %141 = load i32, ptr %4, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [9 x i32], ptr %140, i64 0, i64 %142
  store i32 %137, ptr %143, align 4, !tbaa !5
  %144 = load i32, ptr %3, align 4, !tbaa !5
  %145 = load i32, ptr %4, align 4, !tbaa !5
  %146 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z10markUsedAsbiii(i1 noundef zeroext true, i32 noundef %144, i32 noundef %145, i32 noundef %146)
  %147 = load i32, ptr %2, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  call void @_Z2bti(i32 noundef %148)
  %149 = load i32, ptr %3, align 4, !tbaa !5
  %150 = load i32, ptr %4, align 4, !tbaa !5
  %151 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z10markUsedAsbiii(i1 noundef zeroext false, i32 noundef %149, i32 noundef %150, i32 noundef %151)
  br label %152

152:                                              ; preds = %136, %127, %118, %109
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %9, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %9, align 4, !tbaa !5
  br label %102, !llvm.loop !16

156:                                              ; preds = %108
  br label %157

157:                                              ; preds = %156, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  store i32 0, ptr %5, align 4
  br label %158

158:                                              ; preds = %157, %79, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %159 = load i32, ptr %5, align 4
  switch i32 %159, label %161 [
    i32 0, label %160
    i32 1, label %160
  ]

160:                                              ; preds = %158, %158
  ret void

161:                                              ; preds = %158
  unreachable
}

; 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) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

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 = { 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 #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 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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::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
@board = external dso_local local_unnamed_addr global [9 x [9 x i32]], align 16
@changeable = external dso_local local_unnamed_addr global [9 x [9 x i8]], align 16
@hasSolution = external dso_local local_unnamed_addr global i8, align 1
@usedOnRow = external dso_local local_unnamed_addr global [9 x [10 x i8]], align 16
@usedOnCol = external dso_local local_unnamed_addr global [9 x [10 x i8]], align 16
@usedOnBox = external dso_local local_unnamed_addr global [9 x [10 x i8]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10markUsedAsbiii(i1 noundef zeroext, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2bti(i32 noundef %0) local_unnamed_addr #1 {
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = mul nsw i32 %2, %2
  %.fr37 = freeze i32 %3
  %4 = load i8, ptr @hasSolution, align 1, !tbaa !9, !range !11, !noundef !12
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %6 = mul nuw nsw i32 %.fr37, %.fr37
  %7 = icmp eq i32 %6, %0
  br i1 %7, label %.split, label %.lr.ph71

.split:                                           ; preds = %tailrecurse, %.lr.ph
  store i8 1, ptr @hasSolution, align 1, !tbaa !9
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.split, %._crit_edge
  %8 = phi i32 [ %16, %._crit_edge ], [ %2, %.split ]
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %._crit_edge ], [ 0, %.split ]
  %9 = mul nsw i32 %8, %8
  %10 = icmp ugt i32 %9, 1
  br i1 %10, label %.lr.ph76, label %.preheader.._crit_edge_crit_edge

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %11 = add nsw i32 %9, -1
  %.pre96 = sext i32 %11 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph76, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre96, %.preheader.._crit_edge_crit_edge ], [ %27, %.lr.ph76 ]
  %12 = getelementptr inbounds [9 x [9 x i32]], ptr @board, i64 0, i64 %indvars.iv93, i64 %.pre-phi
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %13)
  %15 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = mul nsw i32 %16, %16
  %18 = zext nneg i32 %17 to i64
  %19 = icmp ult i64 %indvars.iv.next94, %18
  br i1 %19, label %.preheader, label %.loopexit, !llvm.loop !13

.lr.ph76:                                         ; preds = %.preheader, %.lr.ph76
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.lr.ph76 ], [ 0, %.preheader ]
  %20 = getelementptr inbounds [9 x [9 x i32]], ptr @board, i64 0, i64 %indvars.iv93, i64 %indvars.iv90
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %21)
  %23 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull @.str)
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = mul nsw i32 %24, %24
  %26 = add nsw i32 %25, -1
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next91, %27
  br i1 %28, label %.lr.ph76, label %._crit_edge, !llvm.loop !15

.lr.ph71:                                         ; preds = %.lr.ph, %tailrecurse
  %.tr6070 = phi i32 [ %43, %tailrecurse ], [ %0, %.lr.ph ]
  %29 = srem i32 %.tr6070, %.fr37
  %30 = sdiv i32 %.tr6070, %.fr37
  %31 = sext i32 %30 to i64
  %32 = sext i32 %29 to i64
  %33 = getelementptr inbounds [9 x [9 x i8]], ptr @changeable, i64 0, i64 %31, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !9, !range !11, !noundef !12
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %.preheader38, label %tailrecurse

.preheader38:                                     ; preds = %.lr.ph71
  %.not72 = icmp eq i32 %2, 0
  br i1 %.not72, label %.loopexit, label %.lr.ph74

.lr.ph74:                                         ; preds = %.preheader38
  %36 = srem i32 %30, %2
  %37 = sub i32 %30, %36
  %38 = sdiv i32 %29, %2
  %39 = add nsw i32 %37, %38
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [9 x [9 x i32]], ptr @board, i64 0, i64 %31, i64 %32
  %42 = add nsw i32 %.tr6070, 1
  br label %45

tailrecurse:                                      ; preds = %.lr.ph71
  %43 = add nsw i32 %.tr6070, 1
  %44 = icmp eq i32 %6, %43
  br i1 %44, label %.split, label %.lr.ph71

45:                                               ; preds = %.lr.ph74, %60
  %46 = phi i32 [ %2, %.lr.ph74 ], [ %61, %60 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph74 ], [ %indvars.iv.next, %60 ]
  %47 = getelementptr inbounds [9 x [10 x i8]], ptr @usedOnRow, i64 0, i64 %31, i64 %indvars.iv
  %48 = load i8, ptr %47, align 1, !tbaa !9, !range !11, !noundef !12
  %49 = trunc nuw i8 %48 to i1
  br i1 %49, label %60, label %50

50:                                               ; preds = %45
  %51 = getelementptr inbounds [9 x [10 x i8]], ptr @usedOnCol, i64 0, i64 %32, i64 %indvars.iv
  %52 = load i8, ptr %51, align 1, !tbaa !9, !range !11, !noundef !12
  %53 = trunc nuw i8 %52 to i1
  br i1 %53, label %60, label %54

54:                                               ; preds = %50
  %55 = getelementptr inbounds [9 x [10 x i8]], ptr @usedOnBox, i64 0, i64 %40, i64 %indvars.iv
  %56 = load i8, ptr %55, align 1, !tbaa !9, !range !11, !noundef !12
  %57 = trunc nuw i8 %56 to i1
  br i1 %57, label %60, label %58

58:                                               ; preds = %54
  %59 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %59, ptr %41, align 4, !tbaa !5
  tail call void @_Z10markUsedAsbiii(i1 noundef zeroext true, i32 noundef %30, i32 noundef %29, i32 noundef %59)
  tail call void @_Z2bti(i32 noundef %42)
  tail call void @_Z10markUsedAsbiii(i1 noundef zeroext false, i32 noundef %30, i32 noundef %29, i32 noundef %59)
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %45, %50, %54, %58
  %61 = phi i32 [ %46, %45 ], [ %46, %50 ], [ %46, %54 ], [ %.pre, %58 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %62 = mul nsw i32 %61, %61
  %63 = zext nneg i32 %62 to i64
  %.not.not = icmp ult i64 %indvars.iv, %63
  br i1 %.not.not, label %45, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %60, %._crit_edge, %1, %.preheader38, %.split
  ret void
}

; 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 #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { 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 #3 = { "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" }

!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 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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