; LLVM IR from AlgoGenesis/C :: Miscellaneous Algorithms/8 puzzle (program)

; 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.Position = type { i32, i32 }
%struct.Node = type { [3 x [3 x i32]], %struct.Position, ptr }

@dx = external dso_local global [4 x i32], align 16
@dy = external dso_local global [4 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @initQueue() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isEmpty() #0

; Function Attrs: nounwind uwtable
declare dso_local void @enqueue(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @dequeue() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isGoal(ptr 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: nounwind uwtable
declare dso_local void @printPuzzle(ptr noundef) #0

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @isValid(i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @createNode(ptr noundef, i64, ptr noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local void @solve(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.Position, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca [3 x [3 x i32]], align 16
  %13 = alloca %struct.Position, align 4
  %14 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @initQueue()
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %44, %1
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = icmp slt i32 %16, 3
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %40, %19
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = icmp slt i32 %21, 3
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %43

24:                                               ; preds = %20
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [3 x i32], ptr %25, i64 %27
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [3 x i32], ptr %28, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %24
  %35 = load i32, ptr %4, align 4, !tbaa !9
  %36 = getelementptr inbounds %struct.Position, ptr %3, i32 0, i32 0
  store i32 %35, ptr %36, align 4, !tbaa !11
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = getelementptr inbounds %struct.Position, ptr %3, i32 0, i32 1
  store i32 %37, ptr %38, align 4, !tbaa !13
  br label %39

39:                                               ; preds = %34, %24
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %6, align 4, !tbaa !9
  br label %20, !llvm.loop !14

43:                                               ; preds = %23
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %4, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %4, align 4, !tbaa !9
  br label %15, !llvm.loop !16

47:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = load i64, ptr %3, align 4
  %50 = call ptr @createNode(ptr noundef %48, i64 %49, ptr noundef null)
  store ptr %50, ptr %7, align 8, !tbaa !5
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  call void @enqueue(ptr noundef %51)
  br label %52

52:                                               ; preds = %142, %47
  %53 = call i32 @isEmpty()
  %54 = icmp ne i32 %53, 0
  %55 = xor i1 %54, true
  br i1 %55, label %56, label %143

56:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %57 = call ptr @dequeue()
  store ptr %57, ptr %8, align 8, !tbaa !5
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.Node, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds [3 x [3 x i32]], ptr %59, i64 0, i64 0
  %61 = call i32 @isGoal(ptr noundef %60)
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %68

63:                                               ; preds = %56
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.Node, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds [3 x [3 x i32]], ptr %66, i64 0, i64 0
  call void @printPuzzle(ptr noundef %67)
  store i32 1, ptr %5, align 4
  br label %140

68:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %136, %68
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = icmp slt i32 %70, 4
  br i1 %71, label %73, label %72

72:                                               ; preds = %69
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %139

73:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.Node, ptr %74, i32 0, i32 1
  %76 = getelementptr inbounds %struct.Position, ptr %75, i32 0, i32 0
  %77 = load i32, ptr %76, align 4, !tbaa !17
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = add nsw i32 %77, %81
  store i32 %82, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.Node, ptr %83, i32 0, i32 1
  %85 = getelementptr inbounds %struct.Position, ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 4, !tbaa !19
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = add nsw i32 %86, %90
  store i32 %91, ptr %11, align 4, !tbaa !9
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = call i32 @isValid(i32 noundef %92, i32 noundef %93)
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %135

96:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 36, ptr %12) #4
  %97 = getelementptr inbounds [3 x [3 x i32]], ptr %12, i64 0, i64 0
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.Node, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds [3 x [3 x i32]], ptr %99, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %97, ptr align 8 %100, i64 36, i1 false)
  %101 = load i32, ptr %10, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [3 x [3 x i32]], ptr %12, i64 0, i64 %102
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [3 x i32], ptr %103, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.Node, ptr %108, i32 0, i32 1
  %110 = getelementptr inbounds %struct.Position, ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 4, !tbaa !17
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [3 x [3 x i32]], ptr %12, i64 0, i64 %112
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.Node, ptr %114, i32 0, i32 1
  %116 = getelementptr inbounds %struct.Position, ptr %115, i32 0, i32 1
  %117 = load i32, ptr %116, align 4, !tbaa !19
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [3 x i32], ptr %113, i64 0, i64 %118
  store i32 %107, ptr %119, align 4, !tbaa !9
  %120 = load i32, ptr %10, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [3 x [3 x i32]], ptr %12, i64 0, i64 %121
  %123 = load i32, ptr %11, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [3 x i32], ptr %122, i64 0, i64 %124
  store i32 0, ptr %125, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %126 = getelementptr inbounds %struct.Position, ptr %13, i32 0, i32 0
  %127 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %127, ptr %126, align 4, !tbaa !11
  %128 = getelementptr inbounds %struct.Position, ptr %13, i32 0, i32 1
  %129 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %129, ptr %128, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %130 = getelementptr inbounds [3 x [3 x i32]], ptr %12, i64 0, i64 0
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = load i64, ptr %13, align 4
  %133 = call ptr @createNode(ptr noundef %130, i64 %132, ptr noundef %131)
  store ptr %133, ptr %14, align 8, !tbaa !5
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  call void @enqueue(ptr noundef %134)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 36, ptr %12) #4
  br label %135

135:                                              ; preds = %96, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %9, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %9, align 4, !tbaa !9
  br label %69, !llvm.loop !20

139:                                              ; preds = %72
  store i32 0, ptr %5, align 4
  br label %140

140:                                              ; preds = %139, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %141 = load i32, ptr %5, align 4
  switch i32 %141, label %145 [
    i32 0, label %142
  ]

142:                                              ; preds = %140
  br label %52, !llvm.loop !21

143:                                              ; preds = %52
  %144 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %5, align 4
  br label %145

145:                                              ; preds = %143, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  %146 = load i32, ptr %5, align 4
  switch i32 %146, label %148 [
    i32 0, label %147
    i32 1, label %147
  ]

147:                                              ; preds = %145, %145
  ret void

148:                                              ; preds = %145
  unreachable
}

attributes #0 = { 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !10, i64 4}
!13 = !{!12, !10, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !10, i64 36}
!18 = !{!"Node", !7, i64 0, !12, i64 36, !6, i64 48}
!19 = !{!18, !10, i64 40}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}


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

@dx = external dso_local local_unnamed_addr global [4 x i32], align 16
@dy = external dso_local local_unnamed_addr global [4 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @initQueue() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isEmpty() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @enqueue(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @dequeue() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isGoal(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @printPuzzle(ptr noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @isValid(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @createNode(ptr noundef, i64, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local void @solve(ptr noundef %0) local_unnamed_addr #0 {
.preheader40:
  %1 = alloca [3 x [3 x i32]], align 16
  tail call void @initQueue()
  %2 = getelementptr inbounds i8, ptr %0, i64 4
  %3 = load <8 x i32>, ptr %2, align 4, !tbaa !5
  %4 = icmp eq <8 x i32> %3, zeroinitializer
  %5 = extractelement <8 x i1> %4, i64 0
  %6 = select i1 %5, i64 4294967296, i64 0
  %7 = extractelement <8 x i1> %4, i64 1
  %8 = select i1 %7, i64 8589934592, i64 %6
  %9 = extractelement <8 x i1> %4, i64 2
  %10 = select i1 %9, i64 0, i64 %8
  %11 = extractelement <8 x i1> %4, i64 3
  %12 = extractelement <8 x i1> %4, i64 4
  %13 = select i1 %12, i1 true, i1 %11
  %narrow58 = select i1 %13, i1 true, i1 %9
  %14 = select i1 %11, i64 4294967296, i64 %10
  %15 = select i1 %12, i64 8589934592, i64 %14
  %16 = extractelement <8 x i1> %4, i64 6
  %17 = extractelement <8 x i1> %4, i64 7
  %18 = select i1 %17, i1 true, i1 %16
  %19 = extractelement <8 x i1> %4, i64 5
  %20 = select i1 %18, i1 true, i1 %19
  %21 = zext i1 %narrow58 to i64
  %22 = select i1 %19, i64 0, i64 %15
  %23 = select i1 %16, i64 4294967296, i64 %22
  %.sroa.431.0.insert.shift = select i1 %17, i64 8589934592, i64 %23
  %.sroa.030.0.insert.ext = select i1 %20, i64 2, i64 %21
  %.sroa.030.0.insert.insert = or disjoint i64 %.sroa.431.0.insert.shift, %.sroa.030.0.insert.ext
  %24 = tail call ptr @createNode(ptr noundef %0, i64 %.sroa.030.0.insert.insert, ptr noundef null)
  tail call void @enqueue(ptr noundef %24)
  %25 = tail call i32 @isEmpty()
  %.not49 = icmp eq i32 %25, 0
  br i1 %.not49, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader40, %106
  %26 = call ptr @dequeue()
  %27 = call i32 @isGoal(ptr noundef %26)
  %.not37 = icmp eq i32 %27, 0
  br i1 %.not37, label %.preheader, label %.thread

.preheader:                                       ; preds = %.lr.ph
  %28 = getelementptr inbounds i8, ptr %26, i64 36
  %29 = getelementptr inbounds i8, ptr %26, i64 40
  %30 = load i32, ptr %28, align 4, !tbaa !9
  %31 = load i32, ptr @dx, align 16, !tbaa !5
  %32 = add nsw i32 %31, %30
  %33 = load i32, ptr %29, align 4, !tbaa !13
  %34 = load i32, ptr @dy, align 16, !tbaa !5
  %35 = add nsw i32 %34, %33
  %36 = call i32 @isValid(i32 noundef %32, i32 noundef %35)
  %.not38 = icmp eq i32 %36, 0
  br i1 %.not38, label %49, label %38

.thread:                                          ; preds = %.lr.ph
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @printPuzzle(ptr noundef %26)
  br label %109

38:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %1, ptr noundef nonnull align 8 dereferenceable(36) %26, i64 36, i1 false)
  %39 = sext i32 %32 to i64
  %40 = sext i32 %35 to i64
  %41 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %39, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = load i32, ptr %28, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = load i32, ptr %29, align 4, !tbaa !13
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %44, i64 %46
  store i32 %42, ptr %47, align 4, !tbaa !5
  store i32 0, ptr %41, align 4, !tbaa !5
  %.sroa.4.0.insert.ext = zext i32 %35 to i64
  %.sroa.4.0.insert.shift = shl nuw i64 %.sroa.4.0.insert.ext, 32
  %.sroa.0.0.insert.ext = zext i32 %32 to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.4.0.insert.shift, %.sroa.0.0.insert.ext
  %48 = call ptr @createNode(ptr noundef nonnull %1, i64 %.sroa.0.0.insert.insert, ptr noundef nonnull %26)
  call void @enqueue(ptr noundef %48)
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %1) #4
  br label %49

49:                                               ; preds = %38, %.preheader
  %50 = load i32, ptr %28, align 4, !tbaa !9
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !5
  %52 = add nsw i32 %51, %50
  %53 = load i32, ptr %29, align 4, !tbaa !13
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !5
  %55 = add nsw i32 %54, %53
  %56 = call i32 @isValid(i32 noundef %52, i32 noundef %55)
  %.not38.1 = icmp eq i32 %56, 0
  br i1 %.not38.1, label %68, label %57

57:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %1, ptr noundef nonnull align 8 dereferenceable(36) %26, i64 36, i1 false)
  %58 = sext i32 %52 to i64
  %59 = sext i32 %55 to i64
  %60 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %58, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %28, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = load i32, ptr %29, align 4, !tbaa !13
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %63, i64 %65
  store i32 %61, ptr %66, align 4, !tbaa !5
  store i32 0, ptr %60, align 4, !tbaa !5
  %.sroa.4.0.insert.ext.1 = zext i32 %55 to i64
  %.sroa.4.0.insert.shift.1 = shl nuw i64 %.sroa.4.0.insert.ext.1, 32
  %.sroa.0.0.insert.ext.1 = zext i32 %52 to i64
  %.sroa.0.0.insert.insert.1 = or disjoint i64 %.sroa.4.0.insert.shift.1, %.sroa.0.0.insert.ext.1
  %67 = call ptr @createNode(ptr noundef nonnull %1, i64 %.sroa.0.0.insert.insert.1, ptr noundef nonnull %26)
  call void @enqueue(ptr noundef %67)
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %1) #4
  br label %68

68:                                               ; preds = %57, %49
  %69 = load i32, ptr %28, align 4, !tbaa !9
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !5
  %71 = add nsw i32 %70, %69
  %72 = load i32, ptr %29, align 4, !tbaa !13
  %73 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !5
  %74 = add nsw i32 %73, %72
  %75 = call i32 @isValid(i32 noundef %71, i32 noundef %74)
  %.not38.2 = icmp eq i32 %75, 0
  br i1 %.not38.2, label %87, label %76

76:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %1, ptr noundef nonnull align 8 dereferenceable(36) %26, i64 36, i1 false)
  %77 = sext i32 %71 to i64
  %78 = sext i32 %74 to i64
  %79 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %77, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr %28, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = load i32, ptr %29, align 4, !tbaa !13
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %82, i64 %84
  store i32 %80, ptr %85, align 4, !tbaa !5
  store i32 0, ptr %79, align 4, !tbaa !5
  %.sroa.4.0.insert.ext.2 = zext i32 %74 to i64
  %.sroa.4.0.insert.shift.2 = shl nuw i64 %.sroa.4.0.insert.ext.2, 32
  %.sroa.0.0.insert.ext.2 = zext i32 %71 to i64
  %.sroa.0.0.insert.insert.2 = or disjoint i64 %.sroa.4.0.insert.shift.2, %.sroa.0.0.insert.ext.2
  %86 = call ptr @createNode(ptr noundef nonnull %1, i64 %.sroa.0.0.insert.insert.2, ptr noundef nonnull %26)
  call void @enqueue(ptr noundef %86)
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %1) #4
  br label %87

87:                                               ; preds = %76, %68
  %88 = load i32, ptr %28, align 4, !tbaa !9
  %89 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !5
  %90 = add nsw i32 %89, %88
  %91 = load i32, ptr %29, align 4, !tbaa !13
  %92 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !5
  %93 = add nsw i32 %92, %91
  %94 = call i32 @isValid(i32 noundef %90, i32 noundef %93)
  %.not38.3 = icmp eq i32 %94, 0
  br i1 %.not38.3, label %106, label %95

95:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %1, ptr noundef nonnull align 8 dereferenceable(36) %26, i64 36, i1 false)
  %96 = sext i32 %90 to i64
  %97 = sext i32 %93 to i64
  %98 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %96, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = load i32, ptr %28, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = load i32, ptr %29, align 4, !tbaa !13
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [3 x [3 x i32]], ptr %1, i64 0, i64 %101, i64 %103
  store i32 %99, ptr %104, align 4, !tbaa !5
  store i32 0, ptr %98, align 4, !tbaa !5
  %.sroa.4.0.insert.ext.3 = zext i32 %93 to i64
  %.sroa.4.0.insert.shift.3 = shl nuw i64 %.sroa.4.0.insert.ext.3, 32
  %.sroa.0.0.insert.ext.3 = zext i32 %90 to i64
  %.sroa.0.0.insert.insert.3 = or disjoint i64 %.sroa.4.0.insert.shift.3, %.sroa.0.0.insert.ext.3
  %105 = call ptr @createNode(ptr noundef nonnull %1, i64 %.sroa.0.0.insert.insert.3, ptr noundef nonnull %26)
  call void @enqueue(ptr noundef %105)
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %1) #4
  br label %106

106:                                              ; preds = %95, %87
  %107 = call i32 @isEmpty()
  %.not = icmp eq i32 %107, 0
  br i1 %.not, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %106, %.preheader40
  %108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %109

109:                                              ; preds = %.thread, %._crit_edge
  ret void
}

attributes #0 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 36}
!10 = !{!"Node", !7, i64 0, !11, i64 36, !12, i64 48}
!11 = !{!"", !6, i64 0, !6, i64 4}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!10, !6, i64 40}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass