; LLVM IR from askforalfred/alfred :: gen/ff_planner (inst_pre)

; 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._WffNode = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, i8 }

@.str.125 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.126 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [38 x i8], align 1

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

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @is_dnf(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct._WffNode, ptr %7, i32 0, i32 0
  %9 = load i32, ptr %8, align 8, !tbaa !11
  switch i32 %9, label %75 [
    i32 2008, label %10
    i32 2009, label %10
    i32 2006, label %12
    i32 2007, label %36
    i32 2005, label %72
    i32 2002, label %74
    i32 2003, label %74
    i32 2000, label %74
    i32 2001, label %74
  ]

10:                                               ; preds = %1, %1
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.125)
  call void @exit(i32 noundef 1) #5
  unreachable

12:                                               ; preds = %1
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._WffNode, ptr %13, i32 0, i32 4
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  store ptr %15, ptr %4, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %31, %12
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %35

19:                                               ; preds = %16
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._WffNode, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = icmp eq i32 %22, 2002
  br i1 %23, label %29, label %24

24:                                               ; preds = %19
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._WffNode, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !11
  %28 = icmp eq i32 %27, 2003
  br i1 %28, label %29, label %30

29:                                               ; preds = %24, %19
  br label %31

30:                                               ; preds = %24
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %80

31:                                               ; preds = %29
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._WffNode, ptr %32, i32 0, i32 5
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  store ptr %34, ptr %4, align 8, !tbaa !5
  br label %16, !llvm.loop !15

35:                                               ; preds = %16
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %80

36:                                               ; preds = %1
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._WffNode, ptr %37, i32 0, i32 4
  %39 = load ptr, ptr %38, align 8, !tbaa !13
  store ptr %39, ptr %4, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %66, %36
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %70

43:                                               ; preds = %40
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %5, align 4, !tbaa !9
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._WffNode, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = icmp eq i32 %48, 2002
  br i1 %49, label %64, label %50

50:                                               ; preds = %43
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._WffNode, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !11
  %54 = icmp eq i32 %53, 2003
  br i1 %54, label %64, label %55

55:                                               ; preds = %50
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._WffNode, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = icmp eq i32 %58, 2006
  br i1 %59, label %60, label %65

60:                                               ; preds = %55
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = call i32 @is_dnf(ptr noundef %61)
  %63 = icmp ne i32 %62, -1
  br i1 %63, label %64, label %65

64:                                               ; preds = %60, %50, %43
  br label %66

65:                                               ; preds = %60, %55
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %80

66:                                               ; preds = %64
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._WffNode, ptr %67, i32 0, i32 5
  %69 = load ptr, ptr %68, align 8, !tbaa !14
  store ptr %69, ptr %4, align 8, !tbaa !5
  br label %40, !llvm.loop !17

70:                                               ; preds = %40
  %71 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %71, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %80

72:                                               ; preds = %1
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.126)
  call void @exit(i32 noundef 1) #5
  unreachable

74:                                               ; preds = %1, %1, %1, %1
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %80

75:                                               ; preds = %1
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._WffNode, ptr %76, i32 0, i32 0
  %78 = load i32, ptr %77, align 8, !tbaa !11
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.127, i32 noundef %78)
  call void @exit(i32 noundef 1) #5
  unreachable

80:                                               ; preds = %74, %70, %65, %35, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %81 = load i32, ptr %2, align 4
  ret i32 %81
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { noreturn 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 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 = { nounwind }
attributes #5 = { noreturn 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 = !{!"_WffNode", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !6, i64 64, !10, i64 72, !6, i64 80, !6, i64 88, !7, i64 96}
!13 = !{!12, !6, i64 24}
!14 = !{!12, !6, i64 32}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@.str.125 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.126 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.127 = external hidden unnamed_addr constant [38 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @is_dnf(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  switch i32 %2, label %21 [
    i32 2008, label %3
    i32 2009, label %3
    i32 2006, label %5
    i32 2007, label %11
    i32 2005, label %19
    i32 2002, label %.loopexit
    i32 2003, label %.loopexit
    i32 2000, label %.loopexit
    i32 2001, label %.loopexit
  ]

3:                                                ; preds = %1, %1
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.125)
  tail call void @exit(i32 noundef 1) #3
  unreachable

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %.01632 = load ptr, ptr %6, align 8, !tbaa !11
  %.not2133 = icmp eq ptr %.01632, null
  br i1 %.not2133, label %.loopexit, label %.lr.ph35

7:                                                ; preds = %.lr.ph35
  %8 = getelementptr inbounds i8, ptr %.01634, i64 32
  %.016 = load ptr, ptr %8, align 8, !tbaa !11
  %.not21 = icmp eq ptr %.016, null
  br i1 %.not21, label %.loopexit, label %.lr.ph35, !llvm.loop !12

.lr.ph35:                                         ; preds = %5, %7
  %.01634 = phi ptr [ %.016, %7 ], [ %.01632, %5 ]
  %9 = load i32, ptr %.01634, align 8, !tbaa !5
  %10 = and i32 %9, -2
  %switch = icmp eq i32 %10, 2002
  br i1 %switch, label %7, label %.loopexit

11:                                               ; preds = %1
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %.124 = load ptr, ptr %12, align 8, !tbaa !11
  %.not25 = icmp eq ptr %.124, null
  br i1 %.not25, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %11, %17
  %.127 = phi ptr [ %.1, %17 ], [ %.124, %11 ]
  %.026 = phi i32 [ %13, %17 ], [ 0, %11 ]
  %13 = add nuw nsw i32 %.026, 1
  %14 = load i32, ptr %.127, align 8, !tbaa !5
  switch i32 %14, label %.loopexit [
    i32 2002, label %17
    i32 2003, label %17
    i32 2006, label %15
  ]

15:                                               ; preds = %.lr.ph
  %16 = tail call i32 @is_dnf(ptr noundef nonnull %.127)
  %.not20 = icmp eq i32 %16, -1
  br i1 %.not20, label %.loopexit, label %17

17:                                               ; preds = %.lr.ph, %.lr.ph, %15
  %18 = getelementptr inbounds i8, ptr %.127, i64 32
  %.1 = load ptr, ptr %18, align 8, !tbaa !11
  %.not = icmp eq ptr %.1, null
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !14

19:                                               ; preds = %1
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.126)
  tail call void @exit(i32 noundef 1) #3
  unreachable

21:                                               ; preds = %1
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.127, i32 noundef %2)
  tail call void @exit(i32 noundef 1) #3
  unreachable

.loopexit:                                        ; preds = %.lr.ph, %15, %17, %7, %.lr.ph35, %11, %5, %1, %1, %1, %1
  %.017 = phi i32 [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %5 ], [ 0, %11 ], [ 1, %7 ], [ -1, %.lr.ph35 ], [ -1, %.lr.ph ], [ -1, %15 ], [ %13, %17 ]
  ret i32 %.017
}

attributes #0 = { 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 #1 = { noreturn 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 #2 = { 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 = { noreturn 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, !7, i64 0}
!6 = !{!"_WffNode", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !10, i64 64, !7, i64 72, !10, i64 80, !10, i64 88, !8, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


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