; 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._ExpNode = type { i32, ptr, i32, float, float, ptr, ptr, ptr }
%struct._Fluent = type { i32, [5 x i32] }

@gf_arity = external global [50 x i32], align 16
@.str.102 = external hidden unnamed_addr constant [35 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

declare ptr @new_ExpNode(i32 noundef) #1

declare ptr @new_Fluent() #1

; Function Attrs: nounwind uwtable
define dso_local ptr @copy_Exp(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct._ExpNode, ptr %5, i32 0, i32 0
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = call ptr @new_ExpNode(i32 noundef %7)
  store ptr %8, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct._ExpNode, ptr %9, i32 0, i32 0
  %11 = load i32, ptr %10, align 8, !tbaa !9
  switch i32 %11, label %94 [
    i32 1003, label %12
    i32 1004, label %12
    i32 1005, label %12
    i32 1006, label %12
    i32 1002, label %25
    i32 1001, label %32
    i32 1000, label %38
  ]

12:                                               ; preds = %1, %1, %1, %1
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._ExpNode, ptr %13, i32 0, i32 6
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = call ptr @copy_Exp(ptr noundef %15)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._ExpNode, ptr %17, i32 0, i32 6
  store ptr %16, ptr %18, align 8, !tbaa !13
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._ExpNode, ptr %19, i32 0, i32 7
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = call ptr @copy_Exp(ptr noundef %21)
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._ExpNode, ptr %23, i32 0, i32 7
  store ptr %22, ptr %24, align 8, !tbaa !14
  br label %99

25:                                               ; preds = %1
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._ExpNode, ptr %26, i32 0, i32 5
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = call ptr @copy_Exp(ptr noundef %28)
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._ExpNode, ptr %30, i32 0, i32 5
  store ptr %29, ptr %31, align 8, !tbaa !15
  br label %99

32:                                               ; preds = %1
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._ExpNode, ptr %33, i32 0, i32 4
  %35 = load float, ptr %34, align 8, !tbaa !16
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._ExpNode, ptr %36, i32 0, i32 4
  store float %35, ptr %37, align 8, !tbaa !16
  br label %99

38:                                               ; preds = %1
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._ExpNode, ptr %39, i32 0, i32 1
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %87

43:                                               ; preds = %38
  %44 = call ptr @new_Fluent()
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._ExpNode, ptr %45, i32 0, i32 1
  store ptr %44, ptr %46, align 8, !tbaa !17
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._ExpNode, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  %50 = getelementptr inbounds %struct._Fluent, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 4, !tbaa !18
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._ExpNode, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !17
  %55 = getelementptr inbounds %struct._Fluent, ptr %54, i32 0, i32 0
  store i32 %51, ptr %55, align 4, !tbaa !18
  store i32 0, ptr %4, align 4, !tbaa !20
  br label %56

56:                                               ; preds = %83, %43
  %57 = load i32, ptr %4, align 4, !tbaa !20
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._ExpNode, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !17
  %61 = getelementptr inbounds %struct._Fluent, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 4, !tbaa !18
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [50 x i32], ptr @gf_arity, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !20
  %66 = icmp slt i32 %57, %65
  br i1 %66, label %67, label %86

67:                                               ; preds = %56
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._ExpNode, ptr %68, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !17
  %71 = getelementptr inbounds %struct._Fluent, ptr %70, i32 0, i32 1
  %72 = load i32, ptr %4, align 4, !tbaa !20
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [5 x i32], ptr %71, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !20
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._ExpNode, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = getelementptr inbounds %struct._Fluent, ptr %78, i32 0, i32 1
  %80 = load i32, ptr %4, align 4, !tbaa !20
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [5 x i32], ptr %79, i64 0, i64 %81
  store i32 %75, ptr %82, align 4, !tbaa !20
  br label %83

83:                                               ; preds = %67
  %84 = load i32, ptr %4, align 4, !tbaa !20
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %4, align 4, !tbaa !20
  br label %56, !llvm.loop !21

86:                                               ; preds = %56
  br label %93

87:                                               ; preds = %38
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._ExpNode, ptr %88, i32 0, i32 2
  %90 = load i32, ptr %89, align 8, !tbaa !23
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct._ExpNode, ptr %91, i32 0, i32 2
  store i32 %90, ptr %92, align 8, !tbaa !23
  br label %93

93:                                               ; preds = %87, %86
  br label %99

94:                                               ; preds = %1
  %95 = load ptr, ptr %2, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._ExpNode, ptr %95, i32 0, i32 0
  %97 = load i32, ptr %96, align 8, !tbaa !9
  %98 = call i32 (ptr, ...) @printf(ptr noundef @.str.102, i32 noundef %97)
  call void @exit(i32 noundef 1) #5
  unreachable

99:                                               ; preds = %93, %32, %25, %12
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret ptr %100
}

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, !11, i64 0}
!10 = !{!"_ExpNode", !11, i64 0, !6, i64 8, !11, i64 16, !12, i64 20, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !6, i64 40}
!14 = !{!10, !6, i64 48}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !12, i64 24}
!17 = !{!10, !6, i64 8}
!18 = !{!19, !11, i64 0}
!19 = !{!"_Fluent", !11, i64 0, !7, i64 4}
!20 = !{!11, !11, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!10, !11, i64 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"

@gf_arity = external local_unnamed_addr global [50 x i32], align 16
@.str.102 = external hidden unnamed_addr constant [35 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

declare ptr @new_ExpNode(i32 noundef) local_unnamed_addr #2

declare ptr @new_Fluent() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @copy_Exp(ptr nocapture noundef readonly %0) local_unnamed_addr #3 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  %3 = tail call ptr @new_ExpNode(i32 noundef %2) #4
  %4 = load i32, ptr %0, align 8, !tbaa !5
  switch i32 %4, label %48 [
    i32 1003, label %5
    i32 1004, label %5
    i32 1005, label %5
    i32 1006, label %5
    i32 1002, label %14
    i32 1001, label %19
    i32 1000, label %23
  ]

common.ret26:                                     ; preds = %44, %19, %26, %37, %14, %5
  %common.ret26.op = phi ptr [ %3, %5 ], [ %3, %14 ], [ %3, %37 ], [ %3, %26 ], [ %3, %19 ], [ %3, %44 ]
  ret ptr %common.ret26.op

5:                                                ; preds = %1, %1, %1, %1
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %8 = tail call ptr @copy_Exp(ptr noundef %7)
  %9 = getelementptr inbounds i8, ptr %3, i64 40
  store ptr %8, ptr %9, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = tail call ptr @copy_Exp(ptr noundef %11)
  %13 = getelementptr inbounds i8, ptr %3, i64 48
  store ptr %12, ptr %13, align 8, !tbaa !13
  br label %common.ret26

14:                                               ; preds = %1
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %17 = tail call ptr @copy_Exp(ptr noundef %16)
  %18 = getelementptr inbounds i8, ptr %3, i64 32
  store ptr %17, ptr %18, align 8, !tbaa !14
  br label %common.ret26

19:                                               ; preds = %1
  %20 = getelementptr inbounds i8, ptr %0, i64 24
  %21 = load float, ptr %20, align 8, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %3, i64 24
  store float %21, ptr %22, align 8, !tbaa !15
  br label %common.ret26

23:                                               ; preds = %1
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %44, label %26

26:                                               ; preds = %23
  %27 = tail call ptr @new_Fluent() #4
  %28 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %27, ptr %28, align 8, !tbaa !16
  %29 = load ptr, ptr %24, align 8, !tbaa !16
  %30 = load i32, ptr %29, align 4, !tbaa !17
  store i32 %30, ptr %27, align 4, !tbaa !17
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [50 x i32], ptr @gf_arity, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !19
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph, label %common.ret26

.lr.ph:                                           ; preds = %26
  %35 = getelementptr inbounds i8, ptr %29, i64 4
  %36 = getelementptr inbounds i8, ptr %27, i64 4
  br label %37

37:                                               ; preds = %.lr.ph, %37
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %37 ]
  %38 = getelementptr inbounds [5 x i32], ptr %35, i64 0, i64 %indvars.iv
  %39 = load i32, ptr %38, align 4, !tbaa !19
  %40 = getelementptr inbounds [5 x i32], ptr %36, i64 0, i64 %indvars.iv
  store i32 %39, ptr %40, align 4, !tbaa !19
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = load i32, ptr %32, align 4, !tbaa !19
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next, %42
  br i1 %43, label %37, label %common.ret26, !llvm.loop !20

44:                                               ; preds = %23
  %45 = getelementptr inbounds i8, ptr %0, i64 16
  %46 = load i32, ptr %45, align 8, !tbaa !22
  %47 = getelementptr inbounds i8, ptr %3, i64 16
  store i32 %46, ptr %47, align 8, !tbaa !22
  br label %common.ret26

48:                                               ; preds = %1
  %49 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.102, i32 noundef %4)
  tail call void @exit(i32 noundef 1) #5
  unreachable
}

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 = { "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, !7, i64 0}
!6 = !{!"_ExpNode", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 20, !11, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 40}
!13 = !{!6, !10, i64 48}
!14 = !{!6, !10, i64 32}
!15 = !{!6, !11, i64 24}
!16 = !{!6, !10, i64 8}
!17 = !{!18, !7, i64 0}
!18 = !{!"_Fluent", !7, i64 0, !8, i64 4}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!6, !7, i64 16}


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