; LLVM IR from tyalie/Sudoku-Generator-CPP :: src/Generator/SudokuProp.ll (ZN10SudokuProp13prop1_2DigitsER6Sudokucc)

; 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"

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN10SudokuProp13prop1_2DigitsER6Sudokucc(ptr noundef nonnull align 1 dereferenceable(82) %0, i8 noundef signext %1, i8 noundef signext %2) #0 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i8 %1, ptr %6, align 1, !tbaa !9
  store i8 %2, ptr %7, align 1, !tbaa !9
  %9 = load i8, ptr %6, align 1, !tbaa !9
  %10 = sext i8 %9 to i32
  %11 = load i8, ptr %7, align 1, !tbaa !9
  %12 = sext i8 %11 to i32
  %13 = icmp eq i32 %10, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  br label %54

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

16:                                               ; preds = %50, %15
  %17 = load i32, ptr %8, align 4, !tbaa !10
  %18 = icmp slt i32 %17, 81
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %53

20:                                               ; preds = %16
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load i32, ptr %8, align 4, !tbaa !10
  %23 = sext i32 %22 to i64
  %24 = call noundef signext i8 @_ZNK6Sudoku10getAtIndexEm(ptr noundef nonnull align 1 dereferenceable(82) %21, i64 noundef %23)
  %25 = sext i8 %24 to i32
  %26 = load i8, ptr %6, align 1, !tbaa !9
  %27 = sext i8 %26 to i32
  %28 = icmp eq i32 %25, %27
  br i1 %28, label %29, label %34

29:                                               ; preds = %20
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i32, ptr %8, align 4, !tbaa !10
  %32 = sext i32 %31 to i64
  %33 = load i8, ptr %7, align 1, !tbaa !9
  call void @_ZN6Sudoku10setAtIndexEmc(ptr noundef nonnull align 1 dereferenceable(82) %30, i64 noundef %32, i8 noundef signext %33)
  br label %49

34:                                               ; preds = %20
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load i32, ptr %8, align 4, !tbaa !10
  %37 = sext i32 %36 to i64
  %38 = call noundef signext i8 @_ZNK6Sudoku10getAtIndexEm(ptr noundef nonnull align 1 dereferenceable(82) %35, i64 noundef %37)
  %39 = sext i8 %38 to i32
  %40 = load i8, ptr %7, align 1, !tbaa !9
  %41 = sext i8 %40 to i32
  %42 = icmp eq i32 %39, %41
  br i1 %42, label %43, label %48

43:                                               ; preds = %34
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load i32, ptr %8, align 4, !tbaa !10
  %46 = sext i32 %45 to i64
  %47 = load i8, ptr %6, align 1, !tbaa !9
  call void @_ZN6Sudoku10setAtIndexEmc(ptr noundef nonnull align 1 dereferenceable(82) %44, i64 noundef %46, i8 noundef signext %47)
  br label %48

48:                                               ; preds = %43, %34
  br label %49

49:                                               ; preds = %48, %29
  br label %50

50:                                               ; preds = %49
  %51 = load i32, ptr %8, align 4, !tbaa !10
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %8, align 4, !tbaa !10
  br label %16, !llvm.loop !12

53:                                               ; preds = %19
  store i1 true, ptr %4, align 1
  br label %54

54:                                               ; preds = %53, %14
  %55 = load i1, ptr %4, align 1
  ret i1 %55
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZNK6Sudoku10getAtIndexEm(ptr noundef nonnull align 1 dereferenceable(82), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Sudoku10setAtIndexEmc(ptr noundef nonnull align 1 dereferenceable(82), i64 noundef, i8 noundef signext) #2 align 2

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN10SudokuProp13prop1_2DigitsER6Sudokucc(ptr noundef nonnull align 1 dereferenceable(82) %0, i8 noundef signext %1, i8 noundef signext %2) local_unnamed_addr #0 align 2 {
  %4 = icmp ne i8 %1, %2
  br i1 %4, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %3, %10
  %indvars.iv = phi i64 [ %indvars.iv.next, %10 ], [ 0, %3 ]
  %5 = tail call noundef signext i8 @_ZNK6Sudoku10getAtIndexEm(ptr noundef nonnull align 1 dereferenceable(82) %0, i64 noundef %indvars.iv)
  %6 = icmp eq i8 %5, %1
  br i1 %6, label %.sink.split, label %7

7:                                                ; preds = %.preheader
  %8 = tail call noundef signext i8 @_ZNK6Sudoku10getAtIndexEm(ptr noundef nonnull align 1 dereferenceable(82) %0, i64 noundef %indvars.iv)
  %9 = icmp eq i8 %8, %2
  br i1 %9, label %.sink.split, label %10

.sink.split:                                      ; preds = %7, %.preheader
  %.sink = phi i8 [ %2, %.preheader ], [ %1, %7 ]
  tail call void @_ZN6Sudoku10setAtIndexEmc(ptr noundef nonnull align 1 dereferenceable(82) %0, i64 noundef %indvars.iv, i8 noundef signext %.sink)
  br label %10

10:                                               ; preds = %.sink.split, %7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 81
  br i1 %exitcond.not, label %.loopexit, label %.preheader, !llvm.loop !5

.loopexit:                                        ; preds = %10, %3
  ret i1 %4
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZNK6Sudoku10getAtIndexEm(ptr noundef nonnull align 1 dereferenceable(82), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Sudoku10setAtIndexEmc(ptr noundef nonnull align 1 dereferenceable(82), i64 noundef, i8 noundef signext) 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" }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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