; LLVM IR from seppo0010/rlite :: tests (test)

; 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.greatest_run_info = type { i32, i32, i32, i32, i32, i32, %struct.greatest_suite_info, ptr, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.greatest_suite_info = type { i32, i32, i32, i32, i64, i64, i64, i64 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@greatest_info = external dso_local global %struct.greatest_run_info, align 8
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

; Function Attrs: nounwind uwtable
define dso_local void @greatest_do_fail(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load i32, ptr @greatest_info, align 8, !tbaa !9
  %4 = and i32 %3, 1
  %5 = icmp ne i32 %4, 0
  br i1 %5, label %6, label %19

6:                                                ; preds = %1
  %7 = load ptr, ptr @stdout, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 9), align 8, !tbaa !14
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %13

11:                                               ; preds = %6
  %12 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 9), align 8, !tbaa !14
  br label %14

13:                                               ; preds = %6
  br label %14

14:                                               ; preds = %13, %11
  %15 = phi ptr [ %12, %11 ], [ @.str.6, %13 ]
  %16 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), align 8, !tbaa !15
  %17 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 8), align 8, !tbaa !16
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef @.str.8, ptr noundef %8, ptr noundef %15, ptr noundef %16, i32 noundef %17) #2
  br label %42

19:                                               ; preds = %1
  %20 = load ptr, ptr @stdout, align 8, !tbaa !5
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str.9) #2
  %22 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 14), align 8, !tbaa !17
  %23 = add i32 %22, 1
  store i32 %23, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 14), align 8, !tbaa !17
  %24 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 14), align 8, !tbaa !17
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %29

26:                                               ; preds = %19
  %27 = load ptr, ptr @stdout, align 8, !tbaa !5
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.4) #2
  store i32 0, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 14), align 8, !tbaa !17
  br label %29

29:                                               ; preds = %26, %19
  %30 = load ptr, ptr @stdout, align 8, !tbaa !5
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 9), align 8, !tbaa !14
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %36

34:                                               ; preds = %29
  %35 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 9), align 8, !tbaa !14
  br label %37

36:                                               ; preds = %29
  br label %37

37:                                               ; preds = %36, %34
  %38 = phi ptr [ %35, %34 ], [ @.str.6, %36 ]
  %39 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 7), align 8, !tbaa !15
  %40 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 8), align 8, !tbaa !16
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.10, ptr noundef %31, ptr noundef %38, ptr noundef %39, i32 noundef %40) #2
  br label %42

42:                                               ; preds = %37, %14
  %43 = load i32, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 6), i32 0, i32 2), align 8, !tbaa !18
  %44 = add i32 %43, 1
  store i32 %44, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 6), i32 0, i32 2), align 8, !tbaa !18
  ret void
}

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

!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 = !{!"greatest_run_info", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, i64 24, !6, i64 72, !11, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !11, i64 128, !11, i64 132, !6, i64 136, !6, i64 144, !13, i64 152, !13, i64 160, !7, i64 168}
!11 = !{!"int", !7, i64 0}
!12 = !{!"greatest_suite_info", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !6, i64 88}
!15 = !{!10, !6, i64 72}
!16 = !{!10, !11, i64 80}
!17 = !{!10, !11, i64 128}
!18 = !{!10, !11, 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"

%struct.greatest_run_info = type { i32, i32, i32, i32, i32, i32, %struct.greatest_suite_info, ptr, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.greatest_suite_info = type { i32, i32, i32, i32, i64, i64, i64, i64 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@greatest_info = external dso_local local_unnamed_addr global %struct.greatest_run_info, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @greatest_do_fail(ptr noundef %0) local_unnamed_addr #1 {
  %2 = load i32, ptr @greatest_info, align 8, !tbaa !5
  %3 = and i32 %2, 1
  %.not = icmp eq i32 %3, 0
  %4 = load ptr, ptr @stdout, align 8, !tbaa !13
  br i1 %.not, label %11, label %5

5:                                                ; preds = %1
  %6 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 88), align 8
  %.not4 = icmp eq ptr %6, null
  %7 = select i1 %.not4, ptr @.str.6, ptr %6
  %8 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 72), align 8, !tbaa !14
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 80), align 8, !tbaa !15
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.8, ptr noundef %0, ptr noundef nonnull %7, ptr noundef %8, i32 noundef %9) #2
  br label %25

11:                                               ; preds = %1
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.9) #2
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !16
  %14 = add i32 %13, 1
  store i32 %14, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !16
  %.not2 = icmp eq i32 %14, 0
  br i1 %.not2, label %18, label %15

15:                                               ; preds = %11
  %16 = load ptr, ptr @stdout, align 8, !tbaa !13
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.4) #2
  store i32 0, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !16
  br label %18

18:                                               ; preds = %15, %11
  %19 = load ptr, ptr @stdout, align 8, !tbaa !13
  %20 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 88), align 8
  %.not3 = icmp eq ptr %20, null
  %21 = select i1 %.not3, ptr @.str.6, ptr %20
  %22 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 72), align 8, !tbaa !14
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 80), align 8, !tbaa !15
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.10, ptr noundef %0, ptr noundef nonnull %21, ptr noundef %22, i32 noundef %23) #2
  br label %25

25:                                               ; preds = %18, %5
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 32), align 8, !tbaa !17
  %27 = add i32 %26, 1
  store i32 %27, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 32), align 8, !tbaa !17
  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 = { nofree 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 }

!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 = !{!"greatest_run_info", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !12, i64 72, !7, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !7, i64 128, !7, i64 132, !12, i64 136, !12, i64 144, !11, i64 152, !11, i64 160, !8, i64 168}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"greatest_suite_info", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!6, !12, i64 72}
!15 = !{!6, !7, i64 80}
!16 = !{!6, !7, i64 128}
!17 = !{!6, !7, i64 32}


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