; LLVM IR from codemistic/Data-Structures-and-Algorithms :: CPP/recursion/Classic_Sudoke_Solver (Sudoku_Solver)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z18value_canbe_placedRSt6vectorIS_IiSaIiEESaIS1_EEiiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #1 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %38, %5
  %21 = load i32, ptr %12, align 4, !tbaa !9
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 2, ptr %13, align 4
  br label %41

25:                                               ; preds = %20
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %28) #3
  %30 = load i32, ptr %12, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %31) #3
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = load i32, ptr %11, align 4, !tbaa !9
  %35 = icmp eq i32 %33, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %25
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %41

37:                                               ; preds = %25
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %12, align 4, !tbaa !9
  br label %20, !llvm.loop !11

41:                                               ; preds = %36, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  %42 = load i32, ptr %13, align 4
  switch i32 %42, label %125 [
    i32 2, label %43
    i32 1, label %123
  ]

43:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %62, %43
  %45 = load i32, ptr %14, align 4, !tbaa !9
  %46 = load i32, ptr %8, align 4, !tbaa !9
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 5, ptr %13, align 4
  br label %65

49:                                               ; preds = %44
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load i32, ptr %14, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %50, i64 noundef %52) #3
  %54 = load i32, ptr %10, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %55) #3
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !9
  %59 = icmp eq i32 %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %49
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %65

61:                                               ; preds = %49
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %14, align 4, !tbaa !9
  br label %44, !llvm.loop !13

65:                                               ; preds = %60, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %66 = load i32, ptr %13, align 4
  switch i32 %66, label %125 [
    i32 5, label %67
    i32 1, label %123
  ]

67:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = sitofp i32 %68 to double
  %70 = call double @sqrt(double noundef %69) #3
  %71 = fptosi double %70 to i32
  store i32 %71, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = sdiv i32 %72, %73
  %75 = load i32, ptr %15, align 4, !tbaa !9
  %76 = mul nsw i32 %74, %75
  store i32 %76, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = load i32, ptr %15, align 4, !tbaa !9
  %79 = sdiv i32 %77, %78
  %80 = load i32, ptr %15, align 4, !tbaa !9
  %81 = mul nsw i32 %79, %80
  store i32 %81, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %82 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %82, ptr %18, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %116, %67
  %84 = load i32, ptr %18, align 4, !tbaa !9
  %85 = load i32, ptr %16, align 4, !tbaa !9
  %86 = add nsw i32 %85, 2
  %87 = icmp sle i32 %84, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %83
  store i32 8, ptr %13, align 4
  br label %119

89:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %90 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %90, ptr %19, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %110, %89
  %92 = load i32, ptr %19, align 4, !tbaa !9
  %93 = load i32, ptr %17, align 4, !tbaa !9
  %94 = add nsw i32 %93, 2
  %95 = icmp sle i32 %92, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %91
  store i32 11, ptr %13, align 4
  br label %113

97:                                               ; preds = %91
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = load i32, ptr %18, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %98, i64 noundef %100) #3
  %102 = load i32, ptr %19, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %101, i64 noundef %103) #3
  %105 = load i32, ptr %104, align 4, !tbaa !9
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = icmp eq i32 %105, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %97
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %113

109:                                              ; preds = %97
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %19, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %19, align 4, !tbaa !9
  br label %91, !llvm.loop !14

113:                                              ; preds = %108, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  %114 = load i32, ptr %13, align 4
  switch i32 %114, label %119 [
    i32 11, label %115
  ]

115:                                              ; preds = %113
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %18, align 4, !tbaa !9
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %18, align 4, !tbaa !9
  br label %83, !llvm.loop !15

119:                                              ; preds = %113, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  %120 = load i32, ptr %13, align 4
  switch i32 %120, label %122 [
    i32 8, label %121
  ]

121:                                              ; preds = %119
  store i1 true, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %122

122:                                              ; preds = %121, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %123

123:                                              ; preds = %122, %65, %41
  %124 = load i1, ptr %6, align 1
  ret i1 %124

125:                                              ; preds = %65, %41
  unreachable
}

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

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


; 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
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z18value_canbe_placedRSt6vectorIS_IiSaIiEESaIS1_EEiiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = icmp sgt i32 %1, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5
  %7 = sext i32 %2 to i64
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %10

8:                                                ; preds = %10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader59, label %10, !llvm.loop !5

.preheader59:                                     ; preds = %8
  br i1 %6, label %.lr.ph64, label %._crit_edge

.lr.ph64:                                         ; preds = %.preheader59
  %9 = sext i32 %3 to i64
  %wide.trip.count74 = zext nneg i32 %1 to i64
  br label %16

10:                                               ; preds = %.lr.ph, %8
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %8 ]
  %11 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %7) #2
  %12 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %indvars.iv) #2
  %13 = load i32, ptr %12, align 4, !tbaa !7
  %14 = icmp eq i32 %13, %4
  br i1 %14, label %.critedge50, label %8

15:                                               ; preds = %16
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
  br i1 %exitcond75.not, label %._crit_edge, label %16, !llvm.loop !11

16:                                               ; preds = %.lr.ph64, %15
  %indvars.iv71 = phi i64 [ 0, %.lr.ph64 ], [ %indvars.iv.next72, %15 ]
  %17 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv71) #2
  %18 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %9) #2
  %19 = load i32, ptr %18, align 4, !tbaa !7
  %20 = icmp eq i32 %19, %4
  br i1 %20, label %.critedge50, label %15

._crit_edge:                                      ; preds = %15, %5, %.preheader59
  %21 = sitofp i32 %1 to double
  %22 = tail call double @sqrt(double noundef %21) #2
  %23 = fptosi double %22 to i32
  %24 = srem i32 %2, %23
  %25 = sub nsw i32 %2, %24
  %26 = srem i32 %3, %23
  %27 = sub nsw i32 %3, %26
  %28 = add nsw i32 %25, 2
  %29 = add nsw i32 %27, 2
  %30 = sext i32 %27 to i64
  %31 = sext i32 %29 to i64
  %32 = sext i32 %25 to i64
  %33 = sext i32 %28 to i64
  br label %.preheader

.preheader:                                       ; preds = %._crit_edge, %.critedge
  %indvars.iv79 = phi i64 [ %32, %._crit_edge ], [ %indvars.iv.next80, %.critedge ]
  br label %35

34:                                               ; preds = %35
  %indvars.iv.next77 = add nsw i64 %indvars.iv76, 1
  %.not46.not = icmp slt i64 %indvars.iv76, %31
  br i1 %.not46.not, label %35, label %.critedge, !llvm.loop !12

35:                                               ; preds = %.preheader, %34
  %indvars.iv76 = phi i64 [ %30, %.preheader ], [ %indvars.iv.next77, %34 ]
  %36 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv79) #2
  %37 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %indvars.iv76) #2
  %38 = load i32, ptr %37, align 4, !tbaa !7
  %39 = icmp eq i32 %38, %4
  br i1 %39, label %.critedge50, label %34

.critedge:                                        ; preds = %34
  %indvars.iv.next80 = add nsw i64 %indvars.iv79, 1
  %.not.not = icmp slt i64 %indvars.iv79, %33
  br i1 %.not.not, label %.preheader, label %.critedge50, !llvm.loop !13

.critedge50:                                      ; preds = %10, %16, %.critedge, %35
  %.6 = phi i1 [ false, %35 ], [ true, %.critedge ], [ false, %16 ], [ false, %10 ]
  ret i1 %.6
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1

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 nofree nounwind willreturn memory(write) "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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}


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