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

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

@lcomp = external dso_local global i32, align 4
@lnum_F = external dso_local global i32, align 4
@lc = external dso_local global float, align 4

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

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

; Function Attrs: nounwind uwtable
define dso_local void @put_comp_into_normalized_locals(i32 noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %9 = call ptr @new_ExpNode(i32 noundef 1004)
  store ptr %9, ptr %7, align 8, !tbaa !9
  store i32 0, ptr @lnum_F, align 4, !tbaa !5
  store float 0.000000e+00, ptr @lc, align 4, !tbaa !11
  %10 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %10, ptr @lcomp, align 4, !tbaa !5
  %11 = load i32, ptr @lcomp, align 4, !tbaa !5
  %12 = icmp eq i32 %11, 3001
  br i1 %12, label %13, label %24

13:                                               ; preds = %3
  %14 = load ptr, ptr %6, align 8, !tbaa !9
  %15 = load ptr, ptr %7, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct._ExpNode, ptr %15, i32 0, i32 6
  store ptr %14, ptr %16, align 8, !tbaa !13
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = load ptr, ptr %7, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct._ExpNode, ptr %18, i32 0, i32 7
  store ptr %17, ptr %19, align 8, !tbaa !15
  %20 = load ptr, ptr %7, align 8, !tbaa !9
  call void @collect_normalized_locals(ptr noundef %20, i8 noundef zeroext 1)
  store i32 3005, ptr @lcomp, align 4, !tbaa !5
  %21 = load float, ptr @lc, align 4, !tbaa !11
  %22 = fmul float %21, -1.000000e+00
  store float %22, ptr @lc, align 4, !tbaa !11
  %23 = load ptr, ptr %7, align 8, !tbaa !9
  call void @free(ptr noundef %23) #4
  store i32 1, ptr %8, align 4
  br label %49

24:                                               ; preds = %3
  %25 = load i32, ptr @lcomp, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 3002
  br i1 %26, label %27, label %38

27:                                               ; preds = %24
  %28 = load ptr, ptr %6, align 8, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct._ExpNode, ptr %29, i32 0, i32 6
  store ptr %28, ptr %30, align 8, !tbaa !13
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = load ptr, ptr %7, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct._ExpNode, ptr %32, i32 0, i32 7
  store ptr %31, ptr %33, align 8, !tbaa !15
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  call void @collect_normalized_locals(ptr noundef %34, i8 noundef zeroext 1)
  store i32 3004, ptr @lcomp, align 4, !tbaa !5
  %35 = load float, ptr @lc, align 4, !tbaa !11
  %36 = fmul float %35, -1.000000e+00
  store float %36, ptr @lc, align 4, !tbaa !11
  %37 = load ptr, ptr %7, align 8, !tbaa !9
  call void @free(ptr noundef %37) #4
  store i32 1, ptr %8, align 4
  br label %49

38:                                               ; preds = %24
  %39 = load ptr, ptr %5, align 8, !tbaa !9
  %40 = load ptr, ptr %7, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct._ExpNode, ptr %40, i32 0, i32 6
  store ptr %39, ptr %41, align 8, !tbaa !13
  %42 = load ptr, ptr %6, align 8, !tbaa !9
  %43 = load ptr, ptr %7, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct._ExpNode, ptr %43, i32 0, i32 7
  store ptr %42, ptr %44, align 8, !tbaa !15
  %45 = load ptr, ptr %7, align 8, !tbaa !9
  call void @collect_normalized_locals(ptr noundef %45, i8 noundef zeroext 1)
  %46 = load float, ptr @lc, align 4, !tbaa !11
  %47 = fmul float %46, -1.000000e+00
  store float %47, ptr @lc, align 4, !tbaa !11
  %48 = load ptr, ptr %7, align 8, !tbaa !9
  call void @free(ptr noundef %48) #4
  store i32 0, ptr %8, align 4
  br label %49

49:                                               ; preds = %38, %27, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %50 = load i32, ptr %8, align 4
  switch i32 %50, label %52 [
    i32 0, label %51
    i32 1, label %51
  ]

51:                                               ; preds = %49, %49
  ret void

52:                                               ; preds = %49
  unreachable
}

; Function Attrs: nounwind uwtable
declare dso_local void @collect_normalized_locals(ptr noundef, i8 noundef zeroext) #1

declare ptr @new_ExpNode(i32 noundef) #2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 "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 }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 40}
!14 = !{!"_ExpNode", !6, i64 0, !10, i64 8, !6, i64 16, !12, i64 20, !12, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!15 = !{!14, !10, i64 48}


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

@lcomp = external dso_local local_unnamed_addr global i32, align 4
@lnum_F = external dso_local local_unnamed_addr global i32, align 4
@lc = external dso_local local_unnamed_addr global float, align 4

; Function Attrs: nounwind uwtable
define dso_local void @put_comp_into_normalized_locals(i32 noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call ptr @new_ExpNode(i32 noundef 1004) #3
  store i32 0, ptr @lnum_F, align 4, !tbaa !5
  store float 0.000000e+00, ptr @lc, align 4, !tbaa !9
  store i32 %0, ptr @lcomp, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 40
  %6 = getelementptr inbounds i8, ptr %4, i64 48
  switch i32 %0, label %9 [
    i32 3001, label %7
    i32 3002, label %8
  ]

7:                                                ; preds = %3
  store ptr %2, ptr %5, align 8, !tbaa !11
  store ptr %1, ptr %6, align 8, !tbaa !14
  tail call void @collect_normalized_locals(ptr noundef %4, i8 noundef zeroext 1)
  store i32 3005, ptr @lcomp, align 4, !tbaa !5
  br label %10

8:                                                ; preds = %3
  store ptr %2, ptr %5, align 8, !tbaa !11
  store ptr %1, ptr %6, align 8, !tbaa !14
  tail call void @collect_normalized_locals(ptr noundef %4, i8 noundef zeroext 1)
  store i32 3004, ptr @lcomp, align 4, !tbaa !5
  br label %10

9:                                                ; preds = %3
  store ptr %1, ptr %5, align 8, !tbaa !11
  store ptr %2, ptr %6, align 8, !tbaa !14
  tail call void @collect_normalized_locals(ptr noundef %4, i8 noundef zeroext 1)
  br label %10

10:                                               ; preds = %9, %8, %7
  %11 = load float, ptr @lc, align 4, !tbaa !9
  %12 = fneg float %11
  store float %12, ptr @lc, align 4, !tbaa !9
  tail call void @free(ptr noundef %4) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @collect_normalized_locals(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

declare ptr @new_ExpNode(i32 noundef) local_unnamed_addr #1

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

attributes #0 = { 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 #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 = { 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 #3 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !13, i64 40}
!12 = !{!"_ExpNode", !6, i64 0, !13, i64 8, !6, i64 16, !10, i64 20, !10, i64 24, !13, i64 32, !13, i64 40, !13, i64 48}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!12, !13, i64 48}


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