; LLVM IR from tsotchke/quantum_rng :: tests (quantum_stats)

; 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.quantum_metrics_t = type { double, double, double, double, double, double, double }

@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @print_quantum_analysis(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %4 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %5 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %6 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.quantum_metrics_t, ptr %7, i32 0, i32 0
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %9)
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.quantum_metrics_t, ptr %11, i32 0, i32 1
  %13 = load double, ptr %12, align 8, !tbaa !12
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, double noundef %13)
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.quantum_metrics_t, ptr %15, i32 0, i32 2
  %17 = load double, ptr %16, align 8, !tbaa !13
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, double noundef %17)
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.quantum_metrics_t, ptr %21, i32 0, i32 3
  %23 = load double, ptr %22, align 8, !tbaa !14
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, double noundef %23)
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.quantum_metrics_t, ptr %25, i32 0, i32 4
  %27 = load double, ptr %26, align 8, !tbaa !15
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, double noundef %27)
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.quantum_metrics_t, ptr %29, i32 0, i32 5
  %31 = load double, ptr %30, align 8, !tbaa !16
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, double noundef %31)
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.quantum_metrics_t, ptr %33, i32 0, i32 6
  %35 = load double, ptr %34, align 8, !tbaa !17
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, double noundef %35)
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.quantum_metrics_t, ptr %39, i32 0, i32 1
  %41 = load double, ptr %40, align 8, !tbaa !12
  %42 = fcmp ogt double %41, 5.000000e-01
  %43 = zext i1 %42 to i64
  %44 = select i1 %42, ptr @.str.15, ptr @.str.16
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, ptr noundef %44)
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.quantum_metrics_t, ptr %46, i32 0, i32 0
  %48 = load double, ptr %47, align 8, !tbaa !9
  %49 = fcmp olt double %48, 1.000000e-01
  %50 = zext i1 %49 to i64
  %51 = select i1 %49, ptr @.str.18, ptr @.str.19
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, ptr noundef %51)
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.quantum_metrics_t, ptr %53, i32 0, i32 2
  %55 = load double, ptr %54, align 8, !tbaa !13
  %56 = fcmp ogt double %55, 4.500000e-01
  br i1 %56, label %57, label %62

57:                                               ; preds = %1
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.quantum_metrics_t, ptr %58, i32 0, i32 2
  %60 = load double, ptr %59, align 8, !tbaa !13
  %61 = fcmp olt double %60, 5.500000e-01
  br label %62

62:                                               ; preds = %57, %1
  %63 = phi i1 [ false, %1 ], [ %61, %57 ]
  %64 = zext i1 %63 to i64
  %65 = select i1 %63, ptr @.str.21, ptr @.str.22
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, ptr noundef %65)
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.quantum_metrics_t, ptr %67, i32 0, i32 5
  %69 = load double, ptr %68, align 8, !tbaa !16
  %70 = fcmp ogt double %69, 7.500000e+00
  br i1 %70, label %71, label %72

71:                                               ; preds = %62
  br label %79

72:                                               ; preds = %62
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.quantum_metrics_t, ptr %73, i32 0, i32 5
  %75 = load double, ptr %74, align 8, !tbaa !16
  %76 = fcmp ogt double %75, 7.000000e+00
  %77 = zext i1 %76 to i64
  %78 = select i1 %76, ptr @.str.18, ptr @.str.25
  br label %79

79:                                               ; preds = %72, %71
  %80 = phi ptr [ @.str.24, %71 ], [ %78, %72 ]
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.23, ptr noundef %80)
  ret void
}

declare i32 @printf(ptr noundef, ...) #1

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

!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 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!10, !11, i64 16}
!14 = !{!10, !11, i64 24}
!15 = !{!10, !11, i64 32}
!16 = !{!10, !11, i64 40}
!17 = !{!10, !11, i64 48}


; 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 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_quantum_analysis(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %6 = load double, ptr %0, align 8, !tbaa !5
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %6)
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !10
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, double noundef %9)
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load double, ptr %11, align 8, !tbaa !11
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %12)
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load double, ptr %16, align 8, !tbaa !12
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, double noundef %17)
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  %20 = load double, ptr %19, align 8, !tbaa !13
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, double noundef %20)
  %22 = getelementptr inbounds i8, ptr %0, i64 40
  %23 = load double, ptr %22, align 8, !tbaa !14
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, double noundef %23)
  %25 = getelementptr inbounds i8, ptr %0, i64 48
  %26 = load double, ptr %25, align 8, !tbaa !15
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, double noundef %26)
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  %30 = load double, ptr %8, align 8, !tbaa !10
  %31 = fcmp ogt double %30, 5.000000e-01
  %32 = select i1 %31, ptr @.str.15, ptr @.str.16
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, ptr noundef nonnull %32)
  %34 = load double, ptr %0, align 8, !tbaa !5
  %35 = fcmp olt double %34, 1.000000e-01
  %36 = select i1 %35, ptr @.str.18, ptr @.str.19
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef nonnull %36)
  %38 = load double, ptr %11, align 8, !tbaa !11
  %39 = fcmp ogt double %38, 4.500000e-01
  %40 = fcmp olt double %38, 5.500000e-01
  %41 = and i1 %39, %40
  %42 = select i1 %41, ptr @.str.21, ptr @.str.22
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, ptr noundef nonnull %42)
  %44 = load double, ptr %22, align 8, !tbaa !14
  %45 = fcmp ogt double %44, 7.500000e+00
  %46 = fcmp ogt double %44, 7.000000e+00
  %47 = select i1 %46, ptr @.str.18, ptr @.str.25
  %48 = select i1 %45, ptr @.str.24, ptr %47
  %49 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23, ptr noundef nonnull %48)
  ret void
}

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

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

!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 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !7, i64 32}
!14 = !{!6, !7, i64 40}
!15 = !{!6, !7, i64 48}


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