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

@lset = external dso_local global ptr, align 8
@lmax_set = external dso_local global i32, align 4
@.str.128 = external hidden unnamed_addr constant [67 x i8], align 1
@lhitting_sets = external dso_local global ptr, align 8
@.str.129 = external hidden unnamed_addr constant [45 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 allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @ANDs_below_ORs_in_wff(ptr noundef %0) #5 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, 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
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct._WffNode, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !9
  switch i32 %10, label %84 [
    i32 2008, label %11
    i32 2009, label %11
    i32 2006, label %13
    i32 2007, label %68
    i32 2005, label %83
    i32 2002, label %83
    i32 2003, label %83
    i32 2000, label %83
    i32 2001, label %83
  ]

11:                                               ; preds = %1, %1
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.128)
  call void @exit(i32 noundef 1) #7
  unreachable

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

18:                                               ; preds = %32, %13
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %36

21:                                               ; preds = %18
  call void @ANDs_below_ORs_in_wff(ptr noundef %3)
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._WffNode, ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %25 = icmp eq i32 %24, 2007
  br i1 %25, label %26, label %29

26:                                               ; preds = %21
  %27 = load i32, ptr %5, align 4, !tbaa !12
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %5, align 4, !tbaa !12
  br label %29

29:                                               ; preds = %26, %21
  %30 = load i32, ptr %6, align 4, !tbaa !12
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %6, align 4, !tbaa !12
  br label %32

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

36:                                               ; preds = %18
  %37 = load i32, ptr %5, align 4, !tbaa !12
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %41

39:                                               ; preds = %36
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  call void @merge_next_step_ANDs_and_ORs_in_wff(ptr noundef %40)
  br label %90

41:                                               ; preds = %36
  store ptr null, ptr @lhitting_sets, align 8, !tbaa !5
  %42 = load i32, ptr %6, align 4, !tbaa !12
  %43 = load i32, ptr @lmax_set, align 4, !tbaa !12
  %44 = icmp sgt i32 %42, %43
  br i1 %44, label %45, label %51

45:                                               ; preds = %41
  %46 = load ptr, ptr @lset, align 8, !tbaa !5
  call void @free(ptr noundef %46) #6
  %47 = load i32, ptr %6, align 4, !tbaa !12
  %48 = sext i32 %47 to i64
  %49 = call noalias ptr @calloc(i64 noundef %48, i64 noundef 8) #8
  store ptr %49, ptr @lset, align 8, !tbaa !5
  %50 = load i32, ptr %6, align 4, !tbaa !12
  store i32 %50, ptr @lmax_set, align 4, !tbaa !12
  br label %51

51:                                               ; preds = %45, %41
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._WffNode, ptr %53, i32 0, i32 4
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  call void @collect_hitting_sets(ptr noundef %55, i32 noundef 0)
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._WffNode, ptr %57, i32 0, i32 0
  store i32 2007, ptr %58, align 8, !tbaa !9
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._WffNode, ptr %60, i32 0, i32 4
  %62 = load ptr, ptr %61, align 8, !tbaa !13
  store ptr %62, ptr %4, align 8, !tbaa !5
  %63 = load ptr, ptr @lhitting_sets, align 8, !tbaa !5
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._WffNode, ptr %65, i32 0, i32 4
  store ptr %63, ptr %66, align 8, !tbaa !13
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  call void @merge_next_step_ANDs_and_ORs_in_wff(ptr noundef %67)
  br label %90

68:                                               ; preds = %1
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._WffNode, ptr %70, i32 0, i32 4
  %72 = load ptr, ptr %71, align 8, !tbaa !13
  store ptr %72, ptr %3, align 8, !tbaa !5
  br label %73

73:                                               ; preds = %77, %68
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %81

76:                                               ; preds = %73
  call void @ANDs_below_ORs_in_wff(ptr noundef %3)
  br label %77

77:                                               ; preds = %76
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._WffNode, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !14
  store ptr %80, ptr %3, align 8, !tbaa !5
  br label %73, !llvm.loop !17

81:                                               ; preds = %73
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  call void @merge_next_step_ANDs_and_ORs_in_wff(ptr noundef %82)
  br label %90

83:                                               ; preds = %1, %1, %1, %1, %1
  br label %90

84:                                               ; preds = %1
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._WffNode, ptr %86, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !9
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.129, i32 noundef %88)
  call void @exit(i32 noundef 1) #7
  unreachable

90:                                               ; preds = %83, %81, %51, %39
  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 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @merge_next_step_ANDs_and_ORs_in_wff(ptr noundef) #5

; Function Attrs: nounwind uwtable
declare dso_local void @collect_hitting_sets(ptr noundef, i32 noundef) #5

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 allocsize(0,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 #4 = { 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 #5 = { 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 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0,1) }

!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, !11, i64 0}
!10 = !{!"_WffNode", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !6, i64 64, !11, i64 72, !6, i64 80, !6, i64 88, !7, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !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"

@lset = external dso_local local_unnamed_addr global ptr, align 8
@lmax_set = external dso_local local_unnamed_addr global i32, align 4
@.str.128 = external hidden unnamed_addr constant [67 x i8], align 1
@lhitting_sets = external dso_local local_unnamed_addr global ptr, align 8
@.str.129 = external hidden unnamed_addr constant [45 x i8], align 1

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

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

; Function Attrs: mustprogress 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) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local void @ANDs_below_ORs_in_wff(ptr noundef %0) local_unnamed_addr #5 {
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = load i32, ptr %3, align 8, !tbaa !9
  switch i32 %4, label %33 [
    i32 2008, label %5
    i32 2009, label %5
    i32 2006, label %7
    i32 2007, label %29
    i32 2005, label %35
    i32 2002, label %35
    i32 2003, label %35
    i32 2000, label %35
    i32 2001, label %35
  ]

5:                                                ; preds = %1, %1
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.128)
  tail call void @exit(i32 noundef 1) #7
  unreachable

7:                                                ; preds = %1
  %8 = getelementptr inbounds i8, ptr %3, i64 24
  %storemerge1721 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %storemerge1721, ptr %2, align 8, !tbaa !5
  %.not1822 = icmp eq ptr %storemerge1721, null
  br i1 %.not1822, label %.sink.split, label %.lr.ph26

.lr.ph26:                                         ; preds = %7, %.lr.ph26
  %.024 = phi i32 [ %13, %.lr.ph26 ], [ 0, %7 ]
  %.01623 = phi i32 [ %spec.select, %.lr.ph26 ], [ 0, %7 ]
  call void @ANDs_below_ORs_in_wff(ptr noundef nonnull %2)
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = icmp eq i32 %10, 2007
  %12 = zext i1 %11 to i32
  %spec.select = add nuw nsw i32 %.01623, %12
  %13 = add nuw nsw i32 %.024, 1
  %14 = getelementptr inbounds i8, ptr %9, i64 32
  %storemerge17 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %storemerge17, ptr %2, align 8, !tbaa !5
  %.not18 = icmp eq ptr %storemerge17, null
  br i1 %.not18, label %._crit_edge27, label %.lr.ph26, !llvm.loop !12

._crit_edge27:                                    ; preds = %.lr.ph26
  %15 = icmp eq i32 %spec.select, 0
  br i1 %15, label %.sink.split, label %16

16:                                               ; preds = %._crit_edge27
  store ptr null, ptr @lhitting_sets, align 8, !tbaa !5
  %17 = load i32, ptr @lmax_set, align 4, !tbaa !14
  %.not31 = icmp slt i32 %.024, %17
  br i1 %.not31, label %22, label %18

18:                                               ; preds = %16
  %19 = load ptr, ptr @lset, align 8, !tbaa !5
  call void @free(ptr noundef %19) #6
  %20 = zext nneg i32 %13 to i64
  %21 = call noalias ptr @calloc(i64 noundef %20, i64 noundef 8) #8
  store ptr %21, ptr @lset, align 8, !tbaa !5
  store i32 %13, ptr @lmax_set, align 4, !tbaa !14
  br label %22

22:                                               ; preds = %18, %16
  %23 = load ptr, ptr %0, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 24
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  call void @collect_hitting_sets(ptr noundef %25, i32 noundef 0)
  %26 = load ptr, ptr %0, align 8, !tbaa !5
  store i32 2007, ptr %26, align 8, !tbaa !9
  %27 = getelementptr inbounds i8, ptr %26, i64 24
  %28 = load ptr, ptr @lhitting_sets, align 8, !tbaa !5
  store ptr %28, ptr %27, align 8, !tbaa !15
  br label %.sink.split

29:                                               ; preds = %1
  %30 = getelementptr inbounds i8, ptr %3, i64 24
  %storemerge19 = load ptr, ptr %30, align 8, !tbaa !5
  store ptr %storemerge19, ptr %2, align 8, !tbaa !5
  %.not20 = icmp eq ptr %storemerge19, null
  br i1 %.not20, label %.sink.split, label %.lr.ph

.lr.ph:                                           ; preds = %29, %.lr.ph
  call void @ANDs_below_ORs_in_wff(ptr noundef nonnull %2)
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 32
  %storemerge = load ptr, ptr %32, align 8, !tbaa !5
  store ptr %storemerge, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %storemerge, null
  br i1 %.not, label %.sink.split, label %.lr.ph, !llvm.loop !16

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

.sink.split:                                      ; preds = %.lr.ph, %29, %._crit_edge27, %7, %22
  call void @merge_next_step_ANDs_and_ORs_in_wff(ptr noundef nonnull %0)
  br label %35

35:                                               ; preds = %.sink.split, %1, %1, %1, %1, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @collect_hitting_sets(ptr noundef, i32 noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0,1) }

!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, !11, i64 0}
!10 = !{!"_WffNode", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !6, i64 64, !11, i64 72, !6, i64 80, !6, i64 88, !7, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !6, i64 24}
!16 = distinct !{!16, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass