; LLVM IR from musetronstar/tagd :: tagl/src (lemon)

; 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.lemon = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, ptr }
%struct.state = type { ptr, ptr, i32, ptr, i32, i32, i32, i32, i32, ptr, i32 }
%struct.action = type { ptr, i32, %union.anon, ptr, ptr, ptr }
%union.anon = type { ptr }
%struct.symbol = type { ptr, i32, i32, ptr, ptr, i32, i32, ptr, i32, i32, ptr, i32, ptr, i32, i32, i32, ptr }

@.str.3 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.271 = external hidden unnamed_addr constant [49 x i8], align 1
@__PRETTY_FUNCTION__.ResortStates = external hidden unnamed_addr constant [34 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

; 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 @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @ResortStates(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %100, %1
  %8 = load i32, ptr %3, align 4, !tbaa !9
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.lemon, ptr %9, i32 0, i32 3
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = icmp slt i32 %8, %11
  br i1 %12, label %13, label %103

13:                                               ; preds = %7
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.lemon, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds ptr, ptr %16, i64 %18
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %20, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.state, ptr %21, i32 0, i32 5
  store i32 0, ptr %22, align 4, !tbaa !14
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.state, ptr %23, i32 0, i32 4
  store i32 0, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.state, ptr %25, i32 0, i32 8
  store i32 -1, ptr %26, align 8, !tbaa !17
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.state, ptr %27, i32 0, i32 6
  store i32 -2147483647, ptr %28, align 8, !tbaa !18
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.state, ptr %29, i32 0, i32 7
  store i32 -2147483647, ptr %30, align 4, !tbaa !19
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.state, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  store ptr %33, ptr %5, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %95, %13
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %99

37:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call i32 @compute_action(ptr noundef %38, ptr noundef %39)
  store i32 %40, ptr %6, align 4, !tbaa !9
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = icmp sge i32 %41, 0
  br i1 %42, label %43, label %94

43:                                               ; preds = %37
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.action, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !21
  %47 = getelementptr inbounds %struct.symbol, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !23
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.lemon, ptr %49, i32 0, i32 8
  %51 = load i32, ptr %50, align 4, !tbaa !25
  %52 = icmp slt i32 %48, %51
  br i1 %52, label %53, label %58

53:                                               ; preds = %43
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.state, ptr %54, i32 0, i32 4
  %56 = load i32, ptr %55, align 8, !tbaa !16
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %55, align 8, !tbaa !16
  br label %93

58:                                               ; preds = %43
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.action, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !21
  %62 = getelementptr inbounds %struct.symbol, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !23
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.lemon, ptr %64, i32 0, i32 7
  %66 = load i32, ptr %65, align 8, !tbaa !26
  %67 = icmp slt i32 %63, %66
  br i1 %67, label %68, label %73

68:                                               ; preds = %58
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.state, ptr %69, i32 0, i32 5
  %71 = load i32, ptr %70, align 4, !tbaa !14
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !14
  br label %92

73:                                               ; preds = %58
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.state, ptr %74, i32 0, i32 10
  %76 = load i32, ptr %75, align 8, !tbaa !27
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %86, label %78

78:                                               ; preds = %73
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.state, ptr %79, i32 0, i32 9
  %81 = load ptr, ptr %80, align 8, !tbaa !28
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.action, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !29
  %85 = icmp eq ptr %81, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %78, %73
  br label %88

87:                                               ; preds = %78
  call void @__assert_fail(ptr noundef @.str.271, ptr noundef @.str.3, i32 noundef 4996, ptr noundef @__PRETTY_FUNCTION__.ResortStates) #5
  unreachable

88:                                               ; preds = %86
  %89 = load i32, ptr %6, align 4, !tbaa !9
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.state, ptr %90, i32 0, i32 8
  store i32 %89, ptr %91, align 8, !tbaa !17
  br label %92

92:                                               ; preds = %88, %68
  br label %93

93:                                               ; preds = %92, %53
  br label %94

94:                                               ; preds = %93, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %95

95:                                               ; preds = %94
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.action, ptr %96, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !30
  store ptr %98, ptr %5, align 8, !tbaa !5
  br label %34, !llvm.loop !31

99:                                               ; preds = %34
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %3, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %3, align 4, !tbaa !9
  br label %7, !llvm.loop !33

103:                                              ; preds = %7
  %104 = load ptr, ptr %2, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.lemon, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !13
  %107 = getelementptr inbounds ptr, ptr %106, i64 1
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.lemon, ptr %108, i32 0, i32 3
  %110 = load i32, ptr %109, align 8, !tbaa !11
  %111 = sub nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  call void @qsort(ptr noundef %107, i64 noundef %112, i64 noundef 8, ptr noundef @stateResortCompare)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %113

113:                                              ; preds = %129, %103
  %114 = load i32, ptr %3, align 4, !tbaa !9
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.lemon, ptr %115, i32 0, i32 3
  %117 = load i32, ptr %116, align 8, !tbaa !11
  %118 = icmp slt i32 %114, %117
  br i1 %118, label %119, label %132

119:                                              ; preds = %113
  %120 = load i32, ptr %3, align 4, !tbaa !9
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.lemon, ptr %121, i32 0, i32 0
  %123 = load ptr, ptr %122, align 8, !tbaa !13
  %124 = load i32, ptr %3, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds ptr, ptr %123, i64 %125
  %127 = load ptr, ptr %126, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.state, ptr %127, i32 0, i32 2
  store i32 %120, ptr %128, align 8, !tbaa !34
  br label %129

129:                                              ; preds = %119
  %130 = load i32, ptr %3, align 4, !tbaa !9
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %3, align 4, !tbaa !9
  br label %113, !llvm.loop !35

132:                                              ; preds = %113
  %133 = load ptr, ptr %2, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.lemon, ptr %133, i32 0, i32 3
  %135 = load i32, ptr %134, align 8, !tbaa !11
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.lemon, ptr %136, i32 0, i32 4
  store i32 %135, ptr %137, align 4, !tbaa !36
  br label %138

138:                                              ; preds = %159, %132
  %139 = load ptr, ptr %2, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.lemon, ptr %139, i32 0, i32 4
  %141 = load i32, ptr %140, align 4, !tbaa !36
  %142 = icmp sgt i32 %141, 1
  br i1 %142, label %143, label %157

143:                                              ; preds = %138
  %144 = load ptr, ptr %2, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.lemon, ptr %144, i32 0, i32 0
  %146 = load ptr, ptr %145, align 8, !tbaa !13
  %147 = load ptr, ptr %2, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.lemon, ptr %147, i32 0, i32 4
  %149 = load i32, ptr %148, align 4, !tbaa !36
  %150 = sub nsw i32 %149, 1
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds ptr, ptr %146, i64 %151
  %153 = load ptr, ptr %152, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.state, ptr %153, i32 0, i32 10
  %155 = load i32, ptr %154, align 8, !tbaa !27
  %156 = icmp ne i32 %155, 0
  br label %157

157:                                              ; preds = %143, %138
  %158 = phi i1 [ false, %138 ], [ %156, %143 ]
  br i1 %158, label %159, label %164

159:                                              ; preds = %157
  %160 = load ptr, ptr %2, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.lemon, ptr %160, i32 0, i32 4
  %162 = load i32, ptr %161, align 4, !tbaa !36
  %163 = add nsw i32 %162, -1
  store i32 %163, ptr %161, align 4, !tbaa !36
  br label %138, !llvm.loop !37

164:                                              ; preds = %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @stateResortCompare(ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !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 24}
!12 = !{!"lemon", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !6, i64 72, !10, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !10, i64 248, !10, i64 252, !10, i64 256, !10, i64 260, !10, i64 264, !10, i64 268, !10, i64 272, !6, i64 280}
!13 = !{!12, !6, i64 0}
!14 = !{!15, !10, i64 36}
!15 = !{!"state", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !6, i64 56, !10, i64 64}
!16 = !{!15, !10, i64 32}
!17 = !{!15, !10, i64 48}
!18 = !{!15, !10, i64 40}
!19 = !{!15, !10, i64 44}
!20 = !{!15, !6, i64 24}
!21 = !{!22, !6, i64 0}
!22 = !{!"action", !6, i64 0, !10, i64 8, !7, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!23 = !{!24, !10, i64 8}
!24 = !{!"symbol", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !6, i64 40, !10, i64 48, !10, i64 52, !6, i64 56, !10, i64 64, !6, i64 72, !10, i64 80, !10, i64 84, !10, i64 88, !6, i64 96}
!25 = !{!12, !10, i64 44}
!26 = !{!12, !10, i64 40}
!27 = !{!15, !10, i64 64}
!28 = !{!15, !6, i64 56}
!29 = !{!7, !7, i64 0}
!30 = !{!22, !6, i64 32}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}
!34 = !{!15, !10, i64 16}
!35 = distinct !{!35, !32}
!36 = !{!12, !10, i64 28}
!37 = distinct !{!37, !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.3 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.271 = external hidden unnamed_addr constant [49 x i8], align 1
@__PRETTY_FUNCTION__.ResortStates = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @ResortStates(ptr noundef %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph56, label %._crit_edge57

.lr.ph56:                                         ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 44
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  br label %7

7:                                                ; preds = %.lr.ph56, %._crit_edge
  %8 = phi i32 [ %3, %.lr.ph56 ], [ %48, %._crit_edge ]
  %indvars.iv = phi i64 [ 0, %.lr.ph56 ], [ %indvars.iv.next, %._crit_edge ]
  %9 = load ptr, ptr %0, align 8, !tbaa !11
  %10 = getelementptr inbounds ptr, ptr %9, i64 %indvars.iv
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %11, i64 36
  %13 = getelementptr inbounds i8, ptr %11, i64 32
  %14 = getelementptr inbounds i8, ptr %11, i64 48
  store i32 -1, ptr %14, align 8, !tbaa !13
  store <4 x i32> <i32 0, i32 0, i32 -2147483647, i32 -2147483647>, ptr %13, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %11, i64 24
  %.04051 = load ptr, ptr %15, align 8, !tbaa !12
  %.not4652 = icmp eq ptr %.04051, null
  br i1 %.not4652, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %7
  %16 = getelementptr inbounds i8, ptr %11, i64 64
  %17 = getelementptr inbounds i8, ptr %11, i64 56
  br label %18

18:                                               ; preds = %.lr.ph, %46
  %.04053 = phi ptr [ %.04051, %.lr.ph ], [ %.040, %46 ]
  %19 = tail call i32 @compute_action(ptr noundef nonnull %0, ptr noundef nonnull %.04053)
  %20 = icmp sgt i32 %19, -1
  br i1 %20, label %21, label %46

21:                                               ; preds = %18
  %22 = load ptr, ptr %.04053, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = load i32, ptr %23, align 8, !tbaa !18
  %25 = load i32, ptr %5, align 4, !tbaa !20
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %30

27:                                               ; preds = %21
  %28 = load i32, ptr %13, align 8, !tbaa !21
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %13, align 8, !tbaa !21
  br label %46

30:                                               ; preds = %21
  %31 = load i32, ptr %6, align 8, !tbaa !22
  %32 = icmp slt i32 %24, %31
  br i1 %32, label %33, label %36

33:                                               ; preds = %30
  %34 = load i32, ptr %12, align 4, !tbaa !23
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %12, align 4, !tbaa !23
  br label %46

36:                                               ; preds = %30
  %37 = load i32, ptr %16, align 8, !tbaa !24
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %45, label %39

39:                                               ; preds = %36
  %40 = load ptr, ptr %17, align 8, !tbaa !25
  %41 = getelementptr inbounds i8, ptr %.04053, i64 16
  %42 = load ptr, ptr %41, align 8, !tbaa !26
  %43 = icmp eq ptr %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  tail call void @__assert_fail(ptr noundef nonnull @.str.271, ptr noundef nonnull @.str.3, i32 noundef 4996, ptr noundef nonnull @__PRETTY_FUNCTION__.ResortStates) #3
  unreachable

45:                                               ; preds = %36, %39
  store i32 %19, ptr %14, align 8, !tbaa !13
  br label %46

46:                                               ; preds = %27, %45, %33, %18
  %47 = getelementptr inbounds i8, ptr %.04053, i64 32
  %.040 = load ptr, ptr %47, align 8, !tbaa !12
  %.not46 = icmp eq ptr %.040, null
  br i1 %.not46, label %._crit_edge.loopexit, label %18, !llvm.loop !27

._crit_edge.loopexit:                             ; preds = %46
  %.pre = load i32, ptr %2, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %7
  %48 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %8, %7 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next, %49
  br i1 %50, label %7, label %._crit_edge57, !llvm.loop !29

._crit_edge57:                                    ; preds = %._crit_edge, %1
  %.lcssa47 = phi i32 [ %3, %1 ], [ %48, %._crit_edge ]
  %51 = load ptr, ptr %0, align 8, !tbaa !11
  %52 = getelementptr inbounds i8, ptr %51, i64 8
  %53 = add nsw i32 %.lcssa47, -1
  %54 = sext i32 %53 to i64
  tail call void @qsort(ptr noundef nonnull %52, i64 noundef %54, i64 noundef 8, ptr noundef nonnull @stateResortCompare) #4
  %55 = load i32, ptr %2, align 8, !tbaa !5
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph60, label %.critedge

.lr.ph60:                                         ; preds = %._crit_edge57
  %57 = load ptr, ptr %0, align 8, !tbaa !11
  %wide.trip.count = zext nneg i32 %55 to i64
  %xtraiter = and i64 %wide.trip.count, 7
  %58 = icmp ult i32 %55, 8
  br i1 %58, label %._crit_edge61.unr-lcssa, label %.lr.ph60.new

.lr.ph60.new:                                     ; preds = %.lr.ph60
  %unroll_iter = and i64 %wide.trip.count, 2147483640
  br label %59

59:                                               ; preds = %59, %.lr.ph60.new
  %indvars.iv70 = phi i64 [ 0, %.lr.ph60.new ], [ %indvars.iv.next71.7, %59 ]
  %niter = phi i64 [ 0, %.lr.ph60.new ], [ %niter.next.7, %59 ]
  %60 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv70
  %61 = load ptr, ptr %60, align 8, !tbaa !12
  %62 = getelementptr inbounds i8, ptr %61, i64 16
  %63 = trunc nuw nsw i64 %indvars.iv70 to i32
  store i32 %63, ptr %62, align 8, !tbaa !30
  %indvars.iv.next71 = or disjoint i64 %indvars.iv70, 1
  %64 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv.next71
  %65 = load ptr, ptr %64, align 8, !tbaa !12
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  %67 = trunc nuw nsw i64 %indvars.iv.next71 to i32
  store i32 %67, ptr %66, align 8, !tbaa !30
  %indvars.iv.next71.1 = or disjoint i64 %indvars.iv70, 2
  %68 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv.next71.1
  %69 = load ptr, ptr %68, align 8, !tbaa !12
  %70 = getelementptr inbounds i8, ptr %69, i64 16
  %71 = trunc nuw nsw i64 %indvars.iv.next71.1 to i32
  store i32 %71, ptr %70, align 8, !tbaa !30
  %indvars.iv.next71.2 = or disjoint i64 %indvars.iv70, 3
  %72 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv.next71.2
  %73 = load ptr, ptr %72, align 8, !tbaa !12
  %74 = getelementptr inbounds i8, ptr %73, i64 16
  %75 = trunc nuw nsw i64 %indvars.iv.next71.2 to i32
  store i32 %75, ptr %74, align 8, !tbaa !30
  %indvars.iv.next71.3 = or disjoint i64 %indvars.iv70, 4
  %76 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv.next71.3
  %77 = load ptr, ptr %76, align 8, !tbaa !12
  %78 = getelementptr inbounds i8, ptr %77, i64 16
  %79 = trunc nuw nsw i64 %indvars.iv.next71.3 to i32
  store i32 %79, ptr %78, align 8, !tbaa !30
  %indvars.iv.next71.4 = or disjoint i64 %indvars.iv70, 5
  %80 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv.next71.4
  %81 = load ptr, ptr %80, align 8, !tbaa !12
  %82 = getelementptr inbounds i8, ptr %81, i64 16
  %83 = trunc nuw nsw i64 %indvars.iv.next71.4 to i32
  store i32 %83, ptr %82, align 8, !tbaa !30
  %indvars.iv.next71.5 = or disjoint i64 %indvars.iv70, 6
  %84 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv.next71.5
  %85 = load ptr, ptr %84, align 8, !tbaa !12
  %86 = getelementptr inbounds i8, ptr %85, i64 16
  %87 = trunc nuw nsw i64 %indvars.iv.next71.5 to i32
  store i32 %87, ptr %86, align 8, !tbaa !30
  %indvars.iv.next71.6 = or disjoint i64 %indvars.iv70, 7
  %88 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv.next71.6
  %89 = load ptr, ptr %88, align 8, !tbaa !12
  %90 = getelementptr inbounds i8, ptr %89, i64 16
  %91 = trunc nuw nsw i64 %indvars.iv.next71.6 to i32
  store i32 %91, ptr %90, align 8, !tbaa !30
  %indvars.iv.next71.7 = add nuw nsw i64 %indvars.iv70, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge61.unr-lcssa, label %59, !llvm.loop !31

._crit_edge61.unr-lcssa:                          ; preds = %59, %.lr.ph60
  %indvars.iv70.unr = phi i64 [ 0, %.lr.ph60 ], [ %indvars.iv.next71.7, %59 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge61, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge61.unr-lcssa, %.epil.preheader
  %indvars.iv70.epil = phi i64 [ %indvars.iv.next71.epil, %.epil.preheader ], [ %indvars.iv70.unr, %._crit_edge61.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge61.unr-lcssa ]
  %92 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv70.epil
  %93 = load ptr, ptr %92, align 8, !tbaa !12
  %94 = getelementptr inbounds i8, ptr %93, i64 16
  %95 = trunc nuw nsw i64 %indvars.iv70.epil to i32
  store i32 %95, ptr %94, align 8, !tbaa !30
  %indvars.iv.next71.epil = add nuw nsw i64 %indvars.iv70.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge61, label %.epil.preheader, !llvm.loop !32

._crit_edge61:                                    ; preds = %.epil.preheader, %._crit_edge61.unr-lcssa
  %.not73 = icmp eq i32 %55, 1
  br i1 %.not73, label %.critedge, label %.lr.ph65

.lr.ph65:                                         ; preds = %._crit_edge61
  %96 = load ptr, ptr %0, align 8, !tbaa !11
  %invariant.gep = getelementptr i8, ptr %96, i64 -8
  br label %97

97:                                               ; preds = %.lr.ph65, %102
  %storemerge63 = phi i32 [ %55, %.lr.ph65 ], [ %103, %102 ]
  %98 = zext nneg i32 %storemerge63 to i64
  %gep = getelementptr ptr, ptr %invariant.gep, i64 %98
  %99 = load ptr, ptr %gep, align 8, !tbaa !12
  %100 = getelementptr inbounds i8, ptr %99, i64 64
  %101 = load i32, ptr %100, align 8, !tbaa !24
  %.not = icmp eq i32 %101, 0
  br i1 %.not, label %.critedge, label %102

102:                                              ; preds = %97
  %103 = add nsw i32 %storemerge63, -1
  %104 = icmp sgt i32 %storemerge63, 2
  br i1 %104, label %97, label %.critedge, !llvm.loop !34

.critedge:                                        ; preds = %97, %102, %._crit_edge57, %._crit_edge61
  %storemerge.lcssa = phi i32 [ %55, %._crit_edge61 ], [ %55, %._crit_edge57 ], [ 1, %102 ], [ %storemerge63, %97 ]
  %105 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %storemerge.lcssa, ptr %105, align 4, !tbaa !35
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @stateResortCompare(ptr noundef, ptr noundef) #2

attributes #0 = { 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 #1 = { nofree "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 }
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, !10, i64 24}
!6 = !{!"lemon", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !7, i64 72, !10, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !10, i64 248, !10, i64 252, !10, i64 256, !10, i64 260, !10, i64 264, !10, i64 268, !10, i64 272, !7, i64 280}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !10, i64 48}
!14 = !{!"state", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !7, i64 56, !10, i64 64}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !7, i64 0}
!17 = !{!"action", !7, i64 0, !10, i64 8, !8, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!18 = !{!19, !10, i64 8}
!19 = !{!"symbol", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36, !7, i64 40, !10, i64 48, !10, i64 52, !7, i64 56, !10, i64 64, !7, i64 72, !10, i64 80, !10, i64 84, !10, i64 88, !7, i64 96}
!20 = !{!6, !10, i64 44}
!21 = !{!14, !10, i64 32}
!22 = !{!6, !10, i64 40}
!23 = !{!14, !10, i64 36}
!24 = !{!14, !10, i64 64}
!25 = !{!14, !7, i64 56}
!26 = !{!8, !8, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = !{!14, !10, i64 16}
!31 = distinct !{!31, !28}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.unroll.disable"}
!34 = distinct !{!34, !28}
!35 = !{!6, !10, i64 28}


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