; 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._ParseExpNode = type { i32, ptr, ptr, ptr }
%struct._ExpNode = type { i32, ptr, i32, float, float, ptr, ptr, ptr }
%struct._TokenList = type { ptr, ptr }

@.str.58 = 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

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

; Function Attrs: nounwind
declare double @strtod(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local ptr @make_ExpNode(ptr noundef %0, i32 noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %12, label %10

10:                                               ; preds = %2
  store ptr null, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %11, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %71

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._ParseExpNode, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = call ptr @new_ExpNode(i32 noundef %15)
  store ptr %16, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._ParseExpNode, ptr %17, i32 0, i32 0
  %19 = load i32, ptr %18, align 8, !tbaa !11
  switch i32 %19, label %64 [
    i32 1003, label %20
    i32 1004, label %20
    i32 1005, label %20
    i32 1006, label %20
    i32 1002, label %35
    i32 1001, label %43
    i32 1000, label %53
  ]

20:                                               ; preds = %12, %12, %12, %12
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ParseExpNode, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = call ptr @make_ExpNode(ptr noundef %23, i32 noundef %24)
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._ExpNode, ptr %26, i32 0, i32 6
  store ptr %25, ptr %27, align 8, !tbaa !14
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._ParseExpNode, ptr %28, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = call ptr @make_ExpNode(ptr noundef %30, i32 noundef %31)
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._ExpNode, ptr %33, i32 0, i32 7
  store ptr %32, ptr %34, align 8, !tbaa !18
  br label %69

35:                                               ; preds = %12
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._ParseExpNode, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  %39 = load i32, ptr %5, align 4, !tbaa !9
  %40 = call ptr @make_ExpNode(ptr noundef %38, i32 noundef %39)
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct._ExpNode, ptr %41, i32 0, i32 5
  store ptr %40, ptr %42, align 8, !tbaa !19
  br label %69

43:                                               ; preds = %12
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._ParseExpNode, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !20
  %47 = getelementptr inbounds %struct._TokenList, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !21
  %49 = call double @strtod(ptr noundef %48, ptr noundef null) #5
  %50 = fptrunc double %49 to float
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._ExpNode, ptr %51, i32 0, i32 4
  store float %50, ptr %52, align 8, !tbaa !23
  br label %69

53:                                               ; preds = %12
  %54 = call ptr @new_Fluent()
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._ExpNode, ptr %55, i32 0, i32 1
  store ptr %54, ptr %56, align 8, !tbaa !24
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._ExpNode, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !24
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._ParseExpNode, ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !20
  %63 = load i32, ptr %5, align 4, !tbaa !9
  call void @make_Fluent(ptr noundef %59, ptr noundef %62, i32 noundef %63)
  br label %69

64:                                               ; preds = %12
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._ParseExpNode, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !11
  %68 = call i32 (ptr, ...) @printf(ptr noundef @.str.58, i32 noundef %67)
  call void @exit(i32 noundef 1) #6
  unreachable

69:                                               ; preds = %53, %43, %35, %20
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %70, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %71

71:                                               ; preds = %69, %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %72 = load ptr, ptr %3, align 8
  ret ptr %72
}

declare ptr @new_ExpNode(i32 noundef) #1

declare ptr @new_Fluent() #1

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 "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 }
attributes #6 = { 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 = !{!"_ParseExpNode", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!12, !6, i64 16}
!14 = !{!15, !6, i64 40}
!15 = !{!"_ExpNode", !10, i64 0, !6, i64 8, !10, i64 16, !16, i64 20, !16, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!16 = !{!"float", !7, i64 0}
!17 = !{!12, !6, i64 24}
!18 = !{!15, !6, i64 48}
!19 = !{!15, !6, i64 32}
!20 = !{!12, !6, i64 8}
!21 = !{!22, !6, i64 0}
!22 = !{!"_TokenList", !6, i64 0, !6, i64 8}
!23 = !{!15, !16, i64 24}
!24 = !{!15, !6, i64 8}


; 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.58 = 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

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare double @strtod(ptr noundef readonly, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local ptr @make_ExpNode(ptr noundef readonly %0, i32 noundef %1) local_unnamed_addr #2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %common.ret22, label %3

3:                                                ; preds = %2
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %5 = tail call ptr @new_ExpNode(i32 noundef %4) #5
  %6 = load i32, ptr %0, align 8, !tbaa !5
  switch i32 %6, label %33 [
    i32 1003, label %7
    i32 1004, label %7
    i32 1005, label %7
    i32 1006, label %7
    i32 1002, label %16
    i32 1001, label %21
    i32 1000, label %28
  ]

common.ret22:                                     ; preds = %21, %28, %2, %16, %7
  %common.ret22.op = phi ptr [ %5, %7 ], [ %5, %16 ], [ null, %2 ], [ %5, %28 ], [ %5, %21 ]
  ret ptr %common.ret22.op

7:                                                ; preds = %3, %3, %3, %3
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = tail call ptr @make_ExpNode(ptr noundef %9, i32 noundef %1)
  %11 = getelementptr inbounds i8, ptr %5, i64 40
  store ptr %10, ptr %11, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = tail call ptr @make_ExpNode(ptr noundef %13, i32 noundef %1)
  %15 = getelementptr inbounds i8, ptr %5, i64 48
  store ptr %14, ptr %15, align 8, !tbaa !16
  br label %common.ret22

16:                                               ; preds = %3
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = tail call ptr @make_ExpNode(ptr noundef %18, i32 noundef %1)
  %20 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr %19, ptr %20, align 8, !tbaa !17
  br label %common.ret22

21:                                               ; preds = %3
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = tail call double @strtod(ptr nocapture noundef %24, ptr noundef null) #5
  %26 = fptrunc double %25 to float
  %27 = getelementptr inbounds i8, ptr %5, i64 24
  store float %26, ptr %27, align 8, !tbaa !21
  br label %common.ret22

28:                                               ; preds = %3
  %29 = tail call ptr @new_Fluent() #5
  %30 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %29, ptr %30, align 8, !tbaa !22
  %31 = getelementptr inbounds i8, ptr %0, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  tail call void @make_Fluent(ptr noundef %29, ptr noundef %32, i32 noundef %1)
  br label %common.ret22

33:                                               ; preds = %3
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.58, i32 noundef %6)
  tail call void @exit(i32 noundef 1) #6
  unreachable
}

declare ptr @new_ExpNode(i32 noundef) local_unnamed_addr #4

declare ptr @new_Fluent() local_unnamed_addr #4

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 = { mustprogress nofree nounwind willreturn "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 = { "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 }
attributes #6 = { 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 = !{!"_ParseExpNode", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!13, !10, i64 40}
!13 = !{!"_ExpNode", !7, i64 0, !10, i64 8, !7, i64 16, !14, i64 20, !14, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!14 = !{!"float", !8, i64 0}
!15 = !{!6, !10, i64 24}
!16 = !{!13, !10, i64 48}
!17 = !{!13, !10, i64 32}
!18 = !{!6, !10, i64 8}
!19 = !{!20, !10, i64 0}
!20 = !{!"_TokenList", !10, i64 0, !10, i64 8}
!21 = !{!13, !14, i64 24}
!22 = !{!13, !10, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass