; 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.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 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_pass(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 %17

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 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef @.str.5, ptr noundef %8, ptr noundef %15) #2
  br label %20

17:                                               ; preds = %1
  %18 = load ptr, ptr @stdout, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str.7) #2
  br label %20

20:                                               ; preds = %17, %14
  %21 = 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 1), align 4, !tbaa !15
  %22 = add i32 %21, 1
  store i32 %22, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 6), i32 0, i32 1), align 4, !tbaa !15
  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, !11, i64 28}


; 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.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 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_pass(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 %9, label %5

5:                                                ; preds = %1
  %6 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 88), align 8
  %.not1 = icmp eq ptr %6, null
  %7 = select i1 %.not1, ptr @.str.6, ptr %6
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.5, ptr noundef %0, ptr noundef nonnull %7) #2
  br label %11

9:                                                ; preds = %1
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.7) #2
  br label %11

11:                                               ; preds = %9, %5
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 28), align 4, !tbaa !14
  %13 = add i32 %12, 1
  store i32 %13, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 28), align 4, !tbaa !14
  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, !7, i64 28}


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