; LLVM IR from Chasmiccoder/Algos-for-Amigos :: Computer-Science/1-DSA-Fundamentals/p05_Tower_of_Hanoi.ll (Z5solvei)

; 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 }
%struct.towers = type { %"class.std::vector", %"class.std::vector", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11printPuzzleP6towersii(ptr noundef, i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 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)) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z8completeP6towersi(ptr noundef, i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvei(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %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
  %10 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %11 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #7
  call void @_ZN6towersC2Ev(ptr noundef nonnull align 8 dereferenceable(72) %11) #6
  store ptr %11, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 -1, ptr %6, align 4, !tbaa !5
  store i32 -1, ptr %5, align 4, !tbaa !5
  store i32 -1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %12 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %12, ptr %7, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %28, %1
  %14 = load i32, ptr %7, align 4, !tbaa !5
  %15 = icmp sge i32 %14, 1
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %31

17:                                               ; preds = %13
  %18 = load ptr, ptr %3, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.towers, ptr %18, i32 0, i32 0
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %20 = load ptr, ptr %3, align 8, !tbaa !9
  %21 = getelementptr inbounds %struct.towers, ptr %20, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %8, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %24 = load ptr, ptr %3, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct.towers, ptr %24, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %9, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %28

28:                                               ; preds = %17
  %29 = load i32, ptr %7, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr %7, align 4, !tbaa !5
  br label %13, !llvm.loop !11

31:                                               ; preds = %16
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sub nsw i32 %32, 1
  store i32 %33, ptr %4, align 4, !tbaa !5
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.6)
  %35 = load ptr, ptr %3, align 8, !tbaa !9
  %36 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %35, i32 noundef 0, i32 noundef %36)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %115, %31
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = srem i32 %39, 2
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %73

42:                                               ; preds = %38
  %43 = load ptr, ptr %3, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.towers, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %3, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.towers, ptr %45, i32 0, i32 1
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %44, ptr noundef nonnull align 8 dereferenceable(24) %46, ptr noundef %4, ptr noundef %5, i32 noundef %47)
  %49 = load ptr, ptr %3, align 8, !tbaa !9
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef %49, i32 noundef %50)
  br i1 %51, label %52, label %53

52:                                               ; preds = %42
  br label %120

53:                                               ; preds = %42
  %54 = load ptr, ptr %3, align 8, !tbaa !9
  %55 = load i32, ptr %10, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %10, align 4, !tbaa !5
  %57 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %54, i32 noundef %55, i32 noundef %57)
  %58 = load ptr, ptr %3, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.towers, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %3, align 8, !tbaa !9
  %61 = getelementptr inbounds %struct.towers, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %2, align 4, !tbaa !5
  %63 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %59, ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef %4, ptr noundef %6, i32 noundef %62)
  %64 = load ptr, ptr %3, align 8, !tbaa !9
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef %64, i32 noundef %65)
  br i1 %66, label %67, label %68

67:                                               ; preds = %53
  br label %120

68:                                               ; preds = %53
  %69 = load ptr, ptr %3, align 8, !tbaa !9
  %70 = load i32, ptr %10, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %10, align 4, !tbaa !5
  %72 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %69, i32 noundef %70, i32 noundef %72)
  br label %104

73:                                               ; preds = %38
  %74 = load ptr, ptr %3, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.towers, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %3, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.towers, ptr %76, i32 0, i32 2
  %78 = load i32, ptr %2, align 4, !tbaa !5
  %79 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %75, ptr noundef nonnull align 8 dereferenceable(24) %77, ptr noundef %4, ptr noundef %6, i32 noundef %78)
  %80 = load ptr, ptr %3, align 8, !tbaa !9
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef %80, i32 noundef %81)
  br i1 %82, label %83, label %84

83:                                               ; preds = %73
  br label %120

84:                                               ; preds = %73
  %85 = load ptr, ptr %3, align 8, !tbaa !9
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %10, align 4, !tbaa !5
  %88 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %85, i32 noundef %86, i32 noundef %88)
  %89 = load ptr, ptr %3, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct.towers, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %3, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.towers, ptr %91, i32 0, i32 1
  %93 = load i32, ptr %2, align 4, !tbaa !5
  %94 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %90, ptr noundef nonnull align 8 dereferenceable(24) %92, ptr noundef %4, ptr noundef %5, i32 noundef %93)
  %95 = load ptr, ptr %3, align 8, !tbaa !9
  %96 = load i32, ptr %2, align 4, !tbaa !5
  %97 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef %95, i32 noundef %96)
  br i1 %97, label %98, label %99

98:                                               ; preds = %84
  br label %120

99:                                               ; preds = %84
  %100 = load ptr, ptr %3, align 8, !tbaa !9
  %101 = load i32, ptr %10, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %10, align 4, !tbaa !5
  %103 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %100, i32 noundef %101, i32 noundef %103)
  br label %104

104:                                              ; preds = %99, %68
  %105 = load ptr, ptr %3, align 8, !tbaa !9
  %106 = getelementptr inbounds %struct.towers, ptr %105, i32 0, i32 1
  %107 = load ptr, ptr %3, align 8, !tbaa !9
  %108 = getelementptr inbounds %struct.towers, ptr %107, i32 0, i32 2
  %109 = load i32, ptr %2, align 4, !tbaa !5
  %110 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %106, ptr noundef nonnull align 8 dereferenceable(24) %108, ptr noundef %5, ptr noundef %6, i32 noundef %109)
  %111 = load ptr, ptr %3, align 8, !tbaa !9
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %113 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef %111, i32 noundef %112)
  br i1 %113, label %114, label %115

114:                                              ; preds = %104
  br label %120

115:                                              ; preds = %104
  %116 = load ptr, ptr %3, align 8, !tbaa !9
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %10, align 4, !tbaa !5
  %119 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %116, i32 noundef %117, i32 noundef %119)
  br label %37, !llvm.loop !13

120:                                              ; preds = %114, %98, %83, %67, %52
  %121 = load ptr, ptr %3, align 8, !tbaa !9
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %121, i32 noundef %122, i32 noundef %123)
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %125 = load ptr, ptr %3, align 8, !tbaa !9
  %126 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11printPuzzleP6towersii(ptr noundef %125, i32 noundef -1, i32 noundef %126)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6towersC2Ev(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nobuiltin allocsize(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 #5 = { inlinehint 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }

!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 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !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"

%"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 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11printPuzzleP6towersii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; 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 #0 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)) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z8completeP6towersi(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvei(i32 noundef %0) local_unnamed_addr #0 {
  %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 = tail call noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #6
  tail call void @_ZN6towersC2Ev(ptr noundef nonnull align 8 dereferenceable(72) %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 -1, ptr %4, align 4, !tbaa !5
  store i32 -1, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 %0, ptr %5, align 4, !tbaa !5
  %9 = icmp sgt i32 %0, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %10 = getelementptr inbounds i8, ptr %8, i64 24
  %11 = add nuw nsw i32 %0, 1
  %12 = getelementptr inbounds i8, ptr %8, i64 48
  br label %33

._crit_edge:                                      ; preds = %33, %1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %13 = add nsw i32 %0, -1
  store i32 %13, ptr %2, align 4, !tbaa !5
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.6)
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef 0, i32 noundef %0)
  %15 = and i32 %0, 1
  %16 = icmp eq i32 %15, 0
  %17 = getelementptr inbounds i8, ptr %8, i64 48
  %18 = getelementptr inbounds i8, ptr %8, i64 24
  br i1 %16, label %.split.us, label %.split

.split.us:                                        ; preds = %._crit_edge
  %19 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef %0)
  %20 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %20, label %.split55.us, label %.lr.ph63

.lr.ph63:                                         ; preds = %.split.us, %27
  %.0.us62 = phi i32 [ %28, %27 ], [ 1, %.split.us ]
  %21 = add nuw nsw i32 %.0.us62, 1
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef %.0.us62, i32 noundef %0)
  %22 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull %2, ptr noundef nonnull %4, i32 noundef %0)
  %23 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %23, label %.split55.us, label %24

24:                                               ; preds = %.lr.ph63
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef %21, i32 noundef %0)
  %.1.us = add nuw nsw i32 %.0.us62, 2
  %25 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull %3, ptr noundef nonnull %4, i32 noundef %0)
  %26 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %26, label %.split55.us, label %27

27:                                               ; preds = %24
  %28 = add nuw nsw i32 %.0.us62, 3
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef %.1.us, i32 noundef %0)
  %29 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef %0)
  %30 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %30, label %.split55.us, label %.lr.ph63, !llvm.loop !9

.split:                                           ; preds = %._crit_edge
  %31 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull %2, ptr noundef nonnull %4, i32 noundef %0)
  %32 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %32, label %.split55.us, label %.lr.ph57

33:                                               ; preds = %.lr.ph, %33
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 %11, ptr %6, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  store i32 %11, ptr %7, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr %5, align 4, !tbaa !5
  %36 = icmp sgt i32 %34, 1
  br i1 %36, label %33, label %._crit_edge, !llvm.loop !11

.lr.ph57:                                         ; preds = %.split, %43
  %.056 = phi i32 [ %44, %43 ], [ 1, %.split ]
  %37 = add nuw nsw i32 %.056, 1
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef %.056, i32 noundef %0)
  %38 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef %0)
  %39 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %39, label %.split55.us, label %40

40:                                               ; preds = %.lr.ph57
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef %37, i32 noundef %0)
  %.1 = add nuw nsw i32 %.056, 2
  %41 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull %3, ptr noundef nonnull %4, i32 noundef %0)
  %42 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %42, label %.split55.us, label %43

43:                                               ; preds = %40
  %44 = add nuw nsw i32 %.056, 3
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef %.1, i32 noundef %0)
  %45 = call noundef zeroext i1 @_Z4moveRSt6vectorIiSaIiEES2_PiS3_i(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull %2, ptr noundef nonnull %4, i32 noundef %0)
  %46 = call noundef zeroext i1 @_Z8completeP6towersi(ptr noundef nonnull %8, i32 noundef %0)
  br i1 %46, label %.split55.us, label %.lr.ph57, !llvm.loop !9

.split55.us:                                      ; preds = %40, %.lr.ph57, %43, %24, %.lr.ph63, %27, %.split, %.split.us
  %.us-phi = phi i32 [ 1, %.split.us ], [ 1, %.split ], [ %.1.us, %24 ], [ %21, %.lr.ph63 ], [ %28, %27 ], [ %.1, %40 ], [ %37, %.lr.ph57 ], [ %44, %43 ]
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef %.us-phi, i32 noundef %0)
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @_Z11printPuzzleP6towersii(ptr noundef nonnull %8, i32 noundef -1, i32 noundef %0)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6towersC2Ev(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #5 align 2

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

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nobuiltin allocsize(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 #5 = { inlinehint 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 #6 = { builtin allocsize(0) }
attributes #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass