; LLVM IR from jdeokkim/ferox :: tests/src (ferox_tests)

; 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 { i8, i8, i8, i8, i32, %struct.greatest_suite_info, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, [128 x i8], [2 x %struct.greatest_prng], i64, i64 }
%struct.greatest_suite_info = type { i32, i32, i32, i32, i64, i64, i64, i64 }
%struct.greatest_prng = type { i8, i8, [6 x i8], i64, i64, i64, i64, i64, i64, i64 }

@greatest_info = external dso_local global %struct.greatest_run_info, align 8
@stdout = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind
declare i64 @clock() #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

; 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
define dso_local void @greatest_test_post(i32 noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  %4 = call i64 @clock() #5
  store i64 %4, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), i32 0, i32 7), align 8, !tbaa !9
  %5 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), i32 0, i32 7), align 8, !tbaa !9
  %6 = icmp eq i64 %5, -1
  br i1 %6, label %7, label %10

7:                                                ; preds = %1
  %8 = load ptr, ptr @stdout, align 8, !tbaa !14
  %9 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef @.str.2, ptr noundef @.str.4) #5
  call void @exit(i32 noundef 1) #6
  unreachable

10:                                               ; preds = %1
  %11 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 16), align 8, !tbaa !15
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %17

13:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %14 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 17), align 8, !tbaa !16
  store ptr %14, ptr %3, align 8, !tbaa !14
  %15 = load ptr, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 16), align 8, !tbaa !15
  %16 = load ptr, ptr %3, align 8, !tbaa !14
  call void %15(ptr noundef %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %17

17:                                               ; preds = %13, %10
  store i8 0, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 2), align 2, !tbaa !17
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = icmp sle i32 %18, -1
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  call void @greatest_do_fail()
  br label %31

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp sge i32 %22, 1
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  call void @greatest_do_skip()
  br label %30

25:                                               ; preds = %21
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  call void @greatest_do_pass()
  br label %29

29:                                               ; preds = %28, %25
  br label %30

30:                                               ; preds = %29, %24
  br label %31

31:                                               ; preds = %30, %20
  store ptr null, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 23), align 8, !tbaa !18
  %32 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), align 8, !tbaa !19
  %33 = add i32 %32, 1
  store i32 %33, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), align 8, !tbaa !19
  %34 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 18), align 8, !tbaa !20
  %35 = add i32 %34, 1
  store i32 %35, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 18), align 8, !tbaa !20
  %36 = load i8, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 1), align 1, !tbaa !21
  %37 = zext i8 %36 to i32
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %39, label %52

39:                                               ; preds = %31
  %40 = load ptr, ptr @stdout, align 8, !tbaa !14
  %41 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), i32 0, i32 7), align 8, !tbaa !9
  %42 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), i32 0, i32 6), align 8, !tbaa !22
  %43 = sub i64 %41, %42
  %44 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), i32 0, i32 7), align 8, !tbaa !9
  %45 = load i64, ptr getelementptr inbounds (%struct.greatest_suite_info, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 5), i32 0, i32 6), align 8, !tbaa !22
  %46 = sub nsw i64 %44, %45
  %47 = sitofp i64 %46 to double
  %48 = fdiv double %47, 1.000000e+06
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.5, i64 noundef %43, double noundef %48) #5
  %50 = load ptr, ptr @stdout, align 8, !tbaa !14
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.6) #5
  br label %61

52:                                               ; preds = %31
  %53 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 18), align 8, !tbaa !20
  %54 = load i32, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 19), align 4, !tbaa !23
  %55 = urem i32 %53, %54
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %60

57:                                               ; preds = %52
  %58 = load ptr, ptr @stdout, align 8, !tbaa !14
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str.6) #5
  store i32 0, ptr getelementptr inbounds (%struct.greatest_run_info, ptr @greatest_info, i32 0, i32 18), align 8, !tbaa !20
  br label %60

60:                                               ; preds = %57, %52
  br label %61

61:                                               ; preds = %60, %39
  %62 = load ptr, ptr @stdout, align 8, !tbaa !14
  %63 = call i32 @fflush(ptr noundef %62)
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @greatest_do_fail() #3

; Function Attrs: nounwind uwtable
declare hidden void @greatest_do_skip() #3

; Function Attrs: nounwind uwtable
declare hidden void @greatest_do_pass() #3

declare i32 @fflush(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = { "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 #5 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 48}
!10 = !{!"greatest_run_info", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 4, !11, i64 8, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !6, i64 128, !6, i64 132, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !7, i64 168, !7, i64 296, !12, i64 424, !12, i64 432}
!11 = !{!"greatest_suite_info", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40}
!12 = !{!"long", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!10, !13, i64 112}
!16 = !{!10, !13, i64 120}
!17 = !{!10, !7, i64 2}
!18 = !{!10, !13, i64 160}
!19 = !{!10, !6, i64 8}
!20 = !{!10, !6, i64 128}
!21 = !{!10, !7, i64 1}
!22 = !{!10, !12, i64 40}
!23 = !{!10, !6, i64 132}


; 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 { i8, i8, i8, i8, i32, %struct.greatest_suite_info, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, [128 x i8], [2 x %struct.greatest_prng], i64, i64 }
%struct.greatest_suite_info = type { i32, i32, i32, i32, i64, i64, i64, i64 }
%struct.greatest_prng = type { i8, i8, [6 x i8], i64, i64, i64, i64, i64, i64, 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.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = 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: nounwind
declare i64 @clock() local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @greatest_test_post(i32 noundef %0) local_unnamed_addr #3 {
  %2 = tail call i64 @clock() #4
  store i64 %2, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 48), align 8, !tbaa !5
  %3 = icmp eq i64 %2, -1
  br i1 %3, label %4, label %7

4:                                                ; preds = %1
  %5 = load ptr, ptr @stdout, align 8, !tbaa !13
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.4) #4
  tail call void @exit(i32 noundef 1) #5
  unreachable

7:                                                ; preds = %1
  %8 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 112), align 8, !tbaa !14
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %11, label %9

9:                                                ; preds = %7
  %10 = load ptr, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 120), align 8, !tbaa !15
  tail call void %8(ptr noundef %10) #4
  br label %11

11:                                               ; preds = %9, %7
  store i8 0, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 2), align 2, !tbaa !16
  %12 = icmp slt i32 %0, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %11
  tail call void @greatest_do_fail()
  br label %17

14:                                               ; preds = %11
  %.not4 = icmp eq i32 %0, 0
  br i1 %.not4, label %16, label %15

15:                                               ; preds = %14
  tail call void @greatest_do_skip()
  br label %17

16:                                               ; preds = %14
  tail call void @greatest_do_pass()
  br label %17

17:                                               ; preds = %15, %16, %13
  store ptr null, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 160), align 8, !tbaa !17
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 8), align 8, !tbaa !18
  %19 = add i32 %18, 1
  store i32 %19, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 8), align 8, !tbaa !18
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !19
  %21 = add i32 %20, 1
  store i32 %21, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !19
  %22 = load i8, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 1), align 1, !tbaa !20
  %.not5 = icmp eq i8 %22, 0
  br i1 %.not5, label %33, label %23

23:                                               ; preds = %17
  %24 = load ptr, ptr @stdout, align 8, !tbaa !13
  %25 = load i64, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 48), align 8, !tbaa !5
  %26 = load i64, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 40), align 8, !tbaa !21
  %27 = sub i64 %25, %26
  %28 = sitofp i64 %27 to double
  %29 = fdiv double %28, 1.000000e+06
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.5, i64 noundef %27, double noundef %29) #4
  %31 = load ptr, ptr @stdout, align 8, !tbaa !13
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.6) #4
  br label %40

33:                                               ; preds = %17
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 132), align 4, !tbaa !22
  %35 = urem i32 %21, %34
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %40

37:                                               ; preds = %33
  %38 = load ptr, ptr @stdout, align 8, !tbaa !13
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.6) #4
  store i32 0, ptr getelementptr inbounds (i8, ptr @greatest_info, i64 128), align 8, !tbaa !19
  br label %40

40:                                               ; preds = %33, %37, %23
  %41 = load ptr, ptr @stdout, align 8, !tbaa !13
  %42 = tail call i32 @fflush(ptr noundef %41)
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @greatest_do_fail() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @greatest_do_skip() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @greatest_do_pass() local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #0

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 = { 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 = { 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 #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, !11, i64 48}
!6 = !{!"greatest_run_info", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !9, i64 4, !10, i64 8, !9, i64 56, !9, i64 60, !9, i64 64, !9, i64 68, !9, i64 72, !9, i64 76, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !9, i64 128, !9, i64 132, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !7, i64 168, !7, i64 296, !11, i64 424, !11, i64 432}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"greatest_suite_info", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!6, !12, i64 112}
!15 = !{!6, !12, i64 120}
!16 = !{!6, !7, i64 2}
!17 = !{!6, !12, i64 160}
!18 = !{!6, !9, i64 8}
!19 = !{!6, !9, i64 128}
!20 = !{!6, !7, i64 1}
!21 = !{!6, !11, i64 40}
!22 = !{!6, !9, i64 132}


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