; LLVM IR from PrantikGhosh/SudokuSolver-using-DIP-OpenCV :: sudoku_solver_16.ll (Z16uncoverColumn_16P4Node)

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

%struct.Node = type { ptr, ptr, ptr, ptr, ptr, i32, [3 x i32] }

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

; 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 void @_Z16uncoverColumn_16P4Node(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.Node, ptr %6, i32 0, i32 2
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %8, ptr %3, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %45, %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = icmp ne ptr %10, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  br label %49

14:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.Node, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  store ptr %17, ptr %5, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %40, %14
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = icmp ne ptr %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  br label %44

23:                                               ; preds = %18
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.Node, ptr %24, i32 0, i32 4
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = getelementptr inbounds %struct.Node, ptr %26, i32 0, i32 5
  %28 = load i32, ptr %27, align 8, !tbaa !14
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %27, align 8, !tbaa !14
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.Node, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = getelementptr inbounds %struct.Node, ptr %33, i32 0, i32 2
  store ptr %30, ptr %34, align 8, !tbaa !9
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Node, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.Node, ptr %38, i32 0, i32 3
  store ptr %35, ptr %39, align 8, !tbaa !15
  br label %40

40:                                               ; preds = %23
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.Node, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !12
  store ptr %43, ptr %5, align 8, !tbaa !5
  br label %18, !llvm.loop !16

44:                                               ; preds = %22
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.Node, ptr %46, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  store ptr %48, ptr %3, align 8, !tbaa !5
  br label %9, !llvm.loop !18

49:                                               ; preds = %13
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.Node, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !12
  %54 = getelementptr inbounds %struct.Node, ptr %53, i32 0, i32 1
  store ptr %50, ptr %54, align 8, !tbaa !19
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.Node, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !19
  %59 = getelementptr inbounds %struct.Node, ptr %58, i32 0, i32 0
  store ptr %55, ptr %59, align 8, !tbaa !12
  ret void
}

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 }

!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, !6, i64 16}
!10 = !{!"_ZTS4Node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !7, i64 44}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !6, i64 32}
!14 = !{!10, !11, i64 40}
!15 = !{!10, !6, i64 24}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = !{!10, !6, i64 8}


; 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 nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @_Z16uncoverColumn_16P4Node(ptr noundef %0) local_unnamed_addr #0 {
  %.017.in23 = getelementptr inbounds i8, ptr %0, i64 16
  %.01724 = load ptr, ptr %.017.in23, align 8, !tbaa !5
  %.not25 = icmp eq ptr %.01724, %0
  br i1 %.not25, label %._crit_edge, label %.preheader

.loopexit:                                        ; preds = %.lr.ph, %.preheader
  %.017.in = getelementptr inbounds i8, ptr %.01726, i64 16
  %.017 = load ptr, ptr %.017.in, align 8, !tbaa !5
  %.not = icmp eq ptr %.017, %0
  br i1 %.not, label %._crit_edge, label %.preheader, !llvm.loop !11

.preheader:                                       ; preds = %1, %.loopexit
  %.01726 = phi ptr [ %.017, %.loopexit ], [ %.01724, %1 ]
  %.020 = load ptr, ptr %.01726, align 8, !tbaa !13
  %.not1921 = icmp eq ptr %.020, %.01726
  br i1 %.not1921, label %.loopexit, label %.lr.ph

._crit_edge:                                      ; preds = %.loopexit, %1
  %2 = load ptr, ptr %0, align 8, !tbaa !13
  %3 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr %0, ptr %3, align 8, !tbaa !14
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !14
  store ptr %0, ptr %5, align 8, !tbaa !13
  ret void

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.022 = phi ptr [ %.0, %.lr.ph ], [ %.020, %.preheader ]
  %6 = getelementptr inbounds i8, ptr %.022, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %7, i64 40
  %9 = load i32, ptr %8, align 8, !tbaa !16
  %10 = add nsw i32 %9, 1
  store i32 %10, ptr %8, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %.022, i64 24
  %12 = load ptr, ptr %11, align 8, !tbaa !17
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  store ptr %.022, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %.022, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 24
  store ptr %.022, ptr %16, align 8, !tbaa !17
  %.0 = load ptr, ptr %.022, align 8, !tbaa !13
  %.not19 = icmp eq ptr %.0, %.01726
  br i1 %.not19, label %.loopexit, label %.lr.ph, !llvm.loop !18
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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 = !{!6, !7, i64 16}
!6 = !{!"_ZTS4Node", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !8, i64 44}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !7, i64 32}
!16 = !{!6, !10, i64 40}
!17 = !{!6, !7, i64 24}
!18 = distinct !{!18, !12}


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