; LLVM IR from pmwkaa/monotone :: test/suite (suite)

; 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.TestSuite = type { ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, i32, i32, ptr, ptr, ptr, i32, %struct.List, ptr, ptr, ptr, ptr, ptr, i32, %struct.List, %struct.List }
%struct.List = type { ptr, ptr }
%struct.TestGroup = type { ptr, ptr, i8, %struct.List, %struct.List }

@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [32 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: nounwind uwtable
declare dso_local void @test_suite_cleanup(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @test_suite_run(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  call void @test_suite_cleanup(ptr noundef %10)
  %11 = call ptr @dlopen(ptr noundef null, i32 noundef 2) #4
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.TestSuite, ptr %12, i32 0, i32 0
  store ptr %11, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = call i32 @test_suite_plan(ptr noundef %14)
  store i32 %15, ptr %4, align 4, !tbaa !13
  %16 = load i32, ptr %4, align 4, !tbaa !13
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %18, label %19

18:                                               ; preds = %1
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %104

19:                                               ; preds = %1
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.TestSuite, ptr %20, i32 0, i32 10
  store ptr null, ptr %21, align 8, !tbaa !14
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.TestSuite, ptr %22, i32 0, i32 19
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %44

26:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.TestSuite, ptr %28, i32 0, i32 19
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = call ptr @test_group_find(ptr noundef %27, ptr noundef %30)
  store ptr %31, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %39

34:                                               ; preds = %26
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.TestSuite, ptr %36, i32 0, i32 19
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  call void (ptr, ptr, ...) @test_error(ptr noundef %35, ptr noundef @.str.1, ptr noundef %38)
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %43

39:                                               ; preds = %26
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = call i32 @test_suite_execute_group(ptr noundef %40, ptr noundef %41)
  store i32 %42, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %43

43:                                               ; preds = %39, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %104

44:                                               ; preds = %19
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.TestSuite, ptr %45, i32 0, i32 18
  %47 = load ptr, ptr %46, align 8, !tbaa !16
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %67

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.TestSuite, ptr %51, i32 0, i32 18
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = call ptr @test_find(ptr noundef %50, ptr noundef %53)
  store ptr %54, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %62

57:                                               ; preds = %49
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.TestSuite, ptr %59, i32 0, i32 18
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  call void (ptr, ptr, ...) @test_error(ptr noundef %58, ptr noundef @.str.2, ptr noundef %61)
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %66

62:                                               ; preds = %49
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = call i32 @test_suite_execute_with_options(ptr noundef %63, ptr noundef %64)
  store i32 %65, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %66

66:                                               ; preds = %62, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %104

67:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.TestSuite, ptr %68, i32 0, i32 22
  %70 = getelementptr inbounds %struct.List, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !17
  store ptr %71, ptr %8, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %97, %67
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.TestSuite, ptr %74, i32 0, i32 22
  %76 = icmp ne ptr %73, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %72
  store i32 2, ptr %5, align 4
  br label %101

78:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 -40
  store ptr %80, ptr %9, align 8, !tbaa !5
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.TestGroup, ptr %81, i32 0, i32 2
  %83 = load i8, ptr %82, align 8, !tbaa !18, !range !21, !noundef !22
  %84 = trunc i8 %83 to i1
  br i1 %84, label %85, label %86

85:                                               ; preds = %78
  store i32 4, ptr %5, align 4
  br label %94

86:                                               ; preds = %78
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = call i32 @test_suite_execute_group(ptr noundef %87, ptr noundef %88)
  store i32 %89, ptr %4, align 4, !tbaa !13
  %90 = load i32, ptr %4, align 4, !tbaa !13
  %91 = icmp eq i32 %90, -1
  br i1 %91, label %92, label %93

92:                                               ; preds = %86
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %94

93:                                               ; preds = %86
  store i32 0, ptr %5, align 4
  br label %94

94:                                               ; preds = %93, %92, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %95 = load i32, ptr %5, align 4
  switch i32 %95, label %101 [
    i32 0, label %96
    i32 4, label %97
  ]

96:                                               ; preds = %94
  br label %97

97:                                               ; preds = %96, %94
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.List, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !23
  store ptr %100, ptr %8, align 8, !tbaa !5
  br label %72, !llvm.loop !24

101:                                              ; preds = %94, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %102 = load i32, ptr %5, align 4
  switch i32 %102, label %104 [
    i32 2, label %103
  ]

103:                                              ; preds = %101
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %104

104:                                              ; preds = %103, %101, %66, %43, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %105 = load i32, ptr %2, align 4
  ret i32 %105
}

; Function Attrs: nounwind
declare ptr @dlopen(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @test_suite_plan(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @test_group_find(ptr noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @test_error(ptr noundef, ptr noundef, ...) #3

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

; Function Attrs: nounwind uwtable
declare hidden ptr @test_find(ptr noundef, ptr noundef) #1

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

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

!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, !6, i64 0}
!10 = !{!"TestSuite", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !12, i64 104, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !11, i64 160, !12, i64 168, !12, i64 184}
!11 = !{!"int", !7, i64 0}
!12 = !{!"List", !6, i64 0, !6, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 72}
!15 = !{!10, !6, i64 152}
!16 = !{!10, !6, i64 144}
!17 = !{!10, !6, i64 184}
!18 = !{!19, !20, i64 16}
!19 = !{!"TestGroup", !6, i64 0, !6, i64 8, !20, i64 16, !12, i64 24, !12, i64 40}
!20 = !{!"_Bool", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!12, !6, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; 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.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @test_suite_cleanup(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @test_suite_run(ptr noundef %0) local_unnamed_addr #0 {
  tail call void @test_suite_cleanup(ptr noundef %0)
  %2 = tail call ptr @dlopen(ptr noundef null, i32 noundef 2) #3
  store ptr %2, ptr %0, align 8, !tbaa !5
  %3 = tail call i32 @test_suite_plan(ptr noundef nonnull %0)
  %4 = icmp eq i32 %3, -1
  br i1 %4, label %._crit_edge, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr null, ptr %6, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %0, i64 152
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %16, label %9

9:                                                ; preds = %5
  %10 = tail call ptr @test_group_find(ptr noundef nonnull %0, ptr noundef nonnull %8)
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %14

12:                                               ; preds = %9
  %13 = load ptr, ptr %7, align 8, !tbaa !13
  tail call void (ptr, ptr, ...) @test_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.1, ptr noundef %13)
  br label %._crit_edge

14:                                               ; preds = %9
  %15 = tail call i32 @test_suite_execute_group(ptr noundef nonnull %0, ptr noundef nonnull %10)
  br label %._crit_edge

16:                                               ; preds = %5
  %17 = getelementptr inbounds i8, ptr %0, i64 144
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %.not39 = icmp eq ptr %18, null
  br i1 %.not39, label %26, label %19

19:                                               ; preds = %16
  %20 = tail call ptr @test_find(ptr noundef nonnull %0, ptr noundef nonnull %18)
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = load ptr, ptr %17, align 8, !tbaa !14
  tail call void (ptr, ptr, ...) @test_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.2, ptr noundef %23)
  br label %._crit_edge

24:                                               ; preds = %19
  %25 = tail call i32 @test_suite_execute_with_options(ptr noundef nonnull %0, ptr noundef nonnull %20)
  br label %._crit_edge

26:                                               ; preds = %16
  %27 = getelementptr inbounds i8, ptr %0, i64 184
  %.03242 = load ptr, ptr %27, align 8, !tbaa !15
  %.not4043.not = icmp eq ptr %.03242, %27
  br i1 %.not4043.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %26, %35
  %.03244 = phi ptr [ %.032, %35 ], [ %.03242, %26 ]
  %28 = getelementptr inbounds i8, ptr %.03244, i64 -24
  %29 = load i8, ptr %28, align 8, !tbaa !16, !range !19, !noundef !20
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %35, label %31

31:                                               ; preds = %.lr.ph
  %32 = getelementptr inbounds i8, ptr %.03244, i64 -40
  %33 = tail call i32 @test_suite_execute_group(ptr noundef nonnull %0, ptr noundef nonnull %32)
  %34 = icmp eq i32 %33, -1
  br i1 %34, label %._crit_edge, label %35

35:                                               ; preds = %.lr.ph, %31
  %.032 = load ptr, ptr %.03244, align 8, !tbaa !15
  %.not40.not = icmp eq ptr %.032, %27
  br i1 %.not40.not, label %._crit_edge, label %.lr.ph, !llvm.loop !21

._crit_edge:                                      ; preds = %31, %35, %26, %22, %24, %12, %14, %1
  %.5 = phi i32 [ -1, %1 ], [ -1, %12 ], [ %15, %14 ], [ -1, %22 ], [ %25, %24 ], [ 0, %26 ], [ -1, %31 ], [ 0, %35 ]
  ret i32 %.5
}

; Function Attrs: nounwind
declare ptr @dlopen(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @test_suite_plan(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @test_group_find(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @test_error(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @test_suite_execute_group(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @test_find(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_suite_execute_with_options(ptr noundef, ptr noundef) local_unnamed_addr #0

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 = { 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 = { inlinehint 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, !7, i64 0}
!6 = !{!"TestSuite", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !10, i64 96, !11, i64 104, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !10, i64 160, !11, i64 168, !11, i64 184}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"List", !7, i64 0, !7, i64 8}
!12 = !{!6, !7, i64 72}
!13 = !{!6, !7, i64 152}
!14 = !{!6, !7, i64 144}
!15 = !{!11, !7, i64 0}
!16 = !{!17, !18, i64 16}
!17 = !{!"TestGroup", !7, i64 0, !7, i64 8, !18, i64 16, !11, i64 24, !11, i64 40}
!18 = !{!"_Bool", !8, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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