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

; 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._command_line = type { [256 x i8], [256 x i8], [256 x i8], i32, i32, i32, i8, i32, float }
%struct._OpConn = type { ptr, i8, ptr, i32, i8, i8, i32, i8, float }

@gcmd_line = external global %struct._command_line, align 4
@gop_conn = external global ptr, align 8
@lused_O = external dso_local global ptr, align 8
@lnum_used_O = external dso_local global i32, align 4
@gcost_minimizing = external global i8, align 1
@gh_cost = external global float, align 4
@lh = external dso_local global i32, align 4
@.str.60 = external hidden unnamed_addr constant [25 x i8], align 1

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

declare void @print_op_name(i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @select_op(i32 noundef %0, i32 noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %5 = load ptr, ptr @gop_conn, align 8, !tbaa !9
  %6 = load i32, ptr %4, align 4, !tbaa !5
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds %struct._OpConn, ptr %5, i64 %7
  %9 = getelementptr inbounds %struct._OpConn, ptr %8, i32 0, i32 6
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = sub nsw i32 %11, 1
  %13 = icmp ne i32 %10, %12
  br i1 %13, label %14, label %66

14:                                               ; preds = %2
  %15 = load ptr, ptr @gop_conn, align 8, !tbaa !9
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds %struct._OpConn, ptr %15, i64 %17
  %19 = getelementptr inbounds %struct._OpConn, ptr %18, i32 0, i32 6
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = icmp eq i32 %20, -1
  br i1 %21, label %22, label %29

22:                                               ; preds = %14
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = load ptr, ptr @lused_O, align 8, !tbaa !9
  %25 = load i32, ptr @lnum_used_O, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @lnum_used_O, align 4, !tbaa !5
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds i32, ptr %24, i64 %27
  store i32 %23, ptr %28, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %22, %14
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sub nsw i32 %30, 1
  %32 = load ptr, ptr @gop_conn, align 8, !tbaa !9
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds %struct._OpConn, ptr %32, i64 %34
  %36 = getelementptr inbounds %struct._OpConn, ptr %35, i32 0, i32 6
  store i32 %31, ptr %36, align 8, !tbaa !11
  %37 = load ptr, ptr @gop_conn, align 8, !tbaa !9
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds %struct._OpConn, ptr %37, i64 %39
  %41 = getelementptr inbounds %struct._OpConn, ptr %40, i32 0, i32 1
  %42 = load i8, ptr %41, align 8, !tbaa !14
  %43 = icmp ne i8 %42, 0
  br i1 %43, label %59, label %44

44:                                               ; preds = %29
  %45 = load i32, ptr @lh, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @lh, align 4, !tbaa !5
  %47 = load i8, ptr @gcost_minimizing, align 1, !tbaa !15
  %48 = icmp ne i8 %47, 0
  br i1 %48, label %49, label %58

49:                                               ; preds = %44
  %50 = load ptr, ptr @gop_conn, align 8, !tbaa !9
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %struct._OpConn, ptr %50, i64 %52
  %54 = getelementptr inbounds %struct._OpConn, ptr %53, i32 0, i32 8
  %55 = load float, ptr %54, align 8, !tbaa !16
  %56 = load float, ptr @gh_cost, align 4, !tbaa !17
  %57 = fadd float %56, %55
  store float %57, ptr @gh_cost, align 4, !tbaa !17
  br label %58

58:                                               ; preds = %49, %44
  br label %59

59:                                               ; preds = %58, %29
  %60 = load i32, ptr getelementptr inbounds (%struct._command_line, ptr @gcmd_line, i32 0, i32 3), align 4, !tbaa !18
  %61 = icmp eq i32 %60, 127
  br i1 %61, label %62, label %65

62:                                               ; preds = %59
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.60)
  %64 = load i32, ptr %4, align 4, !tbaa !5
  call void @print_op_name(i32 noundef %64)
  br label %65

65:                                               ; preds = %62, %59
  br label %66

66:                                               ; preds = %65, %2
  ret void
}

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

!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, !6, i64 32}
!12 = !{!"_OpConn", !10, i64 0, !7, i64 8, !10, i64 16, !6, i64 24, !7, i64 28, !7, i64 29, !6, i64 32, !7, i64 36, !13, i64 40}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !7, i64 8}
!15 = !{!7, !7, i64 0}
!16 = !{!12, !13, i64 40}
!17 = !{!13, !13, i64 0}
!18 = !{!19, !6, i64 768}
!19 = !{!"_command_line", !7, i64 0, !7, i64 256, !7, i64 512, !6, i64 768, !6, i64 772, !6, i64 776, !7, i64 780, !6, i64 784, !13, i64 788}


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

%struct._command_line = type { [256 x i8], [256 x i8], [256 x i8], i32, i32, i32, i8, i32, float }
%struct._OpConn = type { ptr, i8, ptr, i32, i8, i8, i32, i8, float }

@gcmd_line = external local_unnamed_addr global %struct._command_line, align 4
@gop_conn = external local_unnamed_addr global ptr, align 8
@lused_O = external dso_local local_unnamed_addr global ptr, align 8
@lnum_used_O = external dso_local local_unnamed_addr global i32, align 4
@gcost_minimizing = external local_unnamed_addr global i8, align 1
@gh_cost = external local_unnamed_addr global float, align 4
@lh = external dso_local local_unnamed_addr global i32, align 4
@.str.60 = external hidden unnamed_addr constant [25 x i8], align 1

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

declare void @print_op_name(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @select_op(i32 noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = load ptr, ptr @gop_conn, align 8, !tbaa !5
  %4 = sext i32 %1 to i64
  %5 = getelementptr inbounds %struct._OpConn, ptr %3, i64 %4, i32 6
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = add nsw i32 %0, -1
  %.not = icmp eq i32 %6, %7
  br i1 %.not, label %33, label %8

8:                                                ; preds = %2
  %9 = icmp eq i32 %6, -1
  br i1 %9, label %10, label %16

10:                                               ; preds = %8
  %11 = load ptr, ptr @lused_O, align 8, !tbaa !5
  %12 = load i32, ptr @lnum_used_O, align 4, !tbaa !13
  %13 = add nsw i32 %12, 1
  store i32 %13, ptr @lnum_used_O, align 4, !tbaa !13
  %14 = sext i32 %12 to i64
  %15 = getelementptr inbounds i32, ptr %11, i64 %14
  store i32 %1, ptr %15, align 4, !tbaa !13
  br label %16

16:                                               ; preds = %10, %8
  store i32 %7, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct._OpConn, ptr %3, i64 %4, i32 1
  %18 = load i8, ptr %17, align 8, !tbaa !14
  %.not10 = icmp eq i8 %18, 0
  br i1 %.not10, label %19, label %28

19:                                               ; preds = %16
  %20 = load i32, ptr @lh, align 4, !tbaa !13
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr @lh, align 4, !tbaa !13
  %22 = load i8, ptr @gcost_minimizing, align 1, !tbaa !15
  %.not11 = icmp eq i8 %22, 0
  br i1 %.not11, label %28, label %23

23:                                               ; preds = %19
  %24 = getelementptr inbounds %struct._OpConn, ptr %3, i64 %4, i32 8
  %25 = load float, ptr %24, align 8, !tbaa !16
  %26 = load float, ptr @gh_cost, align 4, !tbaa !17
  %27 = fadd float %25, %26
  store float %27, ptr @gh_cost, align 4, !tbaa !17
  br label %28

28:                                               ; preds = %19, %23, %16
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @gcmd_line, i64 768), align 4, !tbaa !18
  %30 = icmp eq i32 %29, 127
  br i1 %30, label %31, label %33

31:                                               ; preds = %28
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.60)
  tail call void @print_op_name(i32 noundef %1) #3
  br label %33

33:                                               ; preds = %28, %31, %2
  ret void
}

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 = { "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 = { 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 32}
!10 = !{!"_OpConn", !6, i64 0, !7, i64 8, !6, i64 16, !11, i64 24, !7, i64 28, !7, i64 29, !11, i64 32, !7, i64 36, !12, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !7, i64 8}
!15 = !{!7, !7, i64 0}
!16 = !{!10, !12, i64 40}
!17 = !{!12, !12, i64 0}
!18 = !{!19, !11, i64 768}
!19 = !{!"_command_line", !7, i64 0, !7, i64 256, !7, i64 512, !11, i64 768, !11, i64 772, !11, i64 776, !7, i64 780, !11, i64 784, !12, i64 788}


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