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

@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @is_linear_expression(ptr noundef %0) #2 {
  %2 = alloca i8, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct._ExpNode, ptr %4, i32 0, i32 0
  %6 = load i32, ptr %5, align 8, !tbaa !9
  switch i32 %6, label %74 [
    i32 1005, label %7
    i32 1006, label %36
    i32 1003, label %51
    i32 1004, label %51
    i32 1002, label %65
    i32 1001, label %73
    i32 1000, label %73
  ]

7:                                                ; preds = %1
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct._ExpNode, ptr %8, i32 0, i32 6
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = call zeroext i8 @is_linear_expression(ptr noundef %10)
  %12 = icmp ne i8 %11, 0
  br i1 %12, label %13, label %19

13:                                               ; preds = %7
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct._ExpNode, ptr %14, i32 0, i32 7
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %17 = call zeroext i8 @is_linear_expression(ptr noundef %16)
  %18 = icmp ne i8 %17, 0
  br i1 %18, label %20, label %19

19:                                               ; preds = %13, %7
  store i8 0, ptr %2, align 1
  br label %80

20:                                               ; preds = %13
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ExpNode, ptr %21, i32 0, i32 6
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds %struct._ExpNode, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !9
  %26 = icmp ne i32 %25, 1001
  br i1 %26, label %27, label %35

27:                                               ; preds = %20
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._ExpNode, ptr %28, i32 0, i32 7
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = getelementptr inbounds %struct._ExpNode, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !9
  %33 = icmp ne i32 %32, 1001
  br i1 %33, label %34, label %35

34:                                               ; preds = %27
  store i8 0, ptr %2, align 1
  br label %80

35:                                               ; preds = %27, %20
  br label %79

36:                                               ; preds = %1
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._ExpNode, ptr %37, i32 0, i32 6
  %39 = load ptr, ptr %38, align 8, !tbaa !13
  %40 = call zeroext i8 @is_linear_expression(ptr noundef %39)
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %42, label %49

42:                                               ; preds = %36
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._ExpNode, ptr %43, i32 0, i32 7
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  %46 = getelementptr inbounds %struct._ExpNode, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !9
  %48 = icmp ne i32 %47, 1001
  br i1 %48, label %49, label %50

49:                                               ; preds = %42, %36
  store i8 0, ptr %2, align 1
  br label %80

50:                                               ; preds = %42
  br label %79

51:                                               ; preds = %1, %1
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._ExpNode, ptr %52, i32 0, i32 6
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  %55 = call zeroext i8 @is_linear_expression(ptr noundef %54)
  %56 = icmp ne i8 %55, 0
  br i1 %56, label %57, label %63

57:                                               ; preds = %51
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._ExpNode, ptr %58, i32 0, i32 7
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = call zeroext i8 @is_linear_expression(ptr noundef %60)
  %62 = icmp ne i8 %61, 0
  br i1 %62, label %64, label %63

63:                                               ; preds = %57, %51
  store i8 0, ptr %2, align 1
  br label %80

64:                                               ; preds = %57
  br label %79

65:                                               ; preds = %1
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._ExpNode, ptr %66, i32 0, i32 5
  %68 = load ptr, ptr %67, align 8, !tbaa !15
  %69 = call zeroext i8 @is_linear_expression(ptr noundef %68)
  %70 = icmp ne i8 %69, 0
  br i1 %70, label %72, label %71

71:                                               ; preds = %65
  store i8 0, ptr %2, align 1
  br label %80

72:                                               ; preds = %65
  br label %79

73:                                               ; preds = %1, %1
  br label %79

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

79:                                               ; preds = %73, %72, %64, %50, %35
  store i8 1, ptr %2, align 1
  br label %80

80:                                               ; preds = %79, %71, %63, %49, %34, %19
  %81 = load i8, ptr %2, align 1
  ret i8 %81
}

attributes #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 = { 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, !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}


; 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.7 = external hidden unnamed_addr constant [36 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 zeroext range(i8 0, 2) i8 @is_linear_expression(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  switch i32 %2, label %37 [
    i32 1005, label %3
    i32 1006, label %17
    i32 1003, label %25
    i32 1004, label %25
    i32 1002, label %33
    i32 1001, label %39
    i32 1000, label %39
  ]

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = load ptr, ptr %4, align 8, !tbaa !12
  %6 = tail call zeroext i8 @is_linear_expression(ptr noundef %5)
  %.not15 = icmp eq i8 %6, 0
  br i1 %.not15, label %40, label %7

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %10 = tail call zeroext i8 @is_linear_expression(ptr noundef %9)
  %.not16 = icmp eq i8 %10, 0
  br i1 %.not16, label %40, label %11

11:                                               ; preds = %7
  %12 = load ptr, ptr %4, align 8, !tbaa !12
  %13 = load i32, ptr %12, align 8, !tbaa !5
  %.not17 = icmp eq i32 %13, 1001
  br i1 %.not17, label %39, label %14

14:                                               ; preds = %11
  %15 = load ptr, ptr %8, align 8, !tbaa !13
  %16 = load i32, ptr %15, align 8, !tbaa !5
  %.not18 = icmp eq i32 %16, 1001
  br i1 %.not18, label %39, label %40

17:                                               ; preds = %1
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  %20 = tail call zeroext i8 @is_linear_expression(ptr noundef %19)
  %.not13 = icmp eq i8 %20, 0
  br i1 %.not13, label %40, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = load i32, ptr %23, align 8, !tbaa !5
  %.not14 = icmp eq i32 %24, 1001
  br i1 %.not14, label %39, label %40

25:                                               ; preds = %1, %1
  %26 = getelementptr inbounds i8, ptr %0, i64 40
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  %28 = tail call zeroext i8 @is_linear_expression(ptr noundef %27)
  %.not11 = icmp eq i8 %28, 0
  br i1 %.not11, label %40, label %29

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %0, i64 48
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = tail call zeroext i8 @is_linear_expression(ptr noundef %31)
  %.not12 = icmp eq i8 %32, 0
  br i1 %.not12, label %40, label %39

33:                                               ; preds = %1
  %34 = getelementptr inbounds i8, ptr %0, i64 32
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = tail call zeroext i8 @is_linear_expression(ptr noundef %35)
  %.not = icmp eq i8 %36, 0
  br i1 %.not, label %40, label %39

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

39:                                               ; preds = %1, %1, %33, %29, %21, %11, %14
  br label %40

40:                                               ; preds = %33, %25, %29, %17, %21, %14, %3, %7, %39
  %.0 = phi i8 [ 1, %39 ], [ 0, %7 ], [ 0, %3 ], [ 0, %14 ], [ 0, %21 ], [ 0, %17 ], [ 0, %29 ], [ 0, %25 ], [ 0, %33 ]
  ret i8 %.0
}

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 = !{!"_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}


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