; LLVM IR from EntityFX/anybench :: src/benchmarks/generic/whetstone (whets)

; 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"

@TimeUsed = external hidden global float, align 4
@Check = external hidden global float, align 4
@loop_time = external hidden global [9 x float], align 16
@headings = external hidden global [9 x [18 x i8]], align 16
@results = external hidden global [9 x float], align 16
@.str.21 = external hidden unnamed_addr constant [15 x i8], align 1
@loop_mops = external hidden global [9 x float], align 16
@loop_mflops = external hidden global [9 x float], align 16
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 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

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

; 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 @pout(ptr noundef %0, float noundef %1, i32 noundef %2, float noundef %3, float noundef %4, i32 noundef %5, i32 noundef %6) #2 {
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store float %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !11
  store float %3, ptr %11, align 4, !tbaa !9
  store float %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !11
  store i32 %6, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %17 = load float, ptr @Check, align 4, !tbaa !9
  %18 = load float, ptr %11, align 4, !tbaa !9
  %19 = fadd float %17, %18
  store float %19, ptr @Check, align 4, !tbaa !9
  %20 = load float, ptr %12, align 4, !tbaa !9
  %21 = load i32, ptr %14, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [9 x float], ptr @loop_time, i64 0, i64 %22
  store float %20, ptr %23, align 4, !tbaa !9
  %24 = load i32, ptr %14, align 4, !tbaa !11
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [9 x [18 x i8]], ptr @headings, i64 0, i64 %25
  %27 = getelementptr inbounds [18 x i8], ptr %26, i64 0, i64 0
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = call ptr @strcpy(ptr noundef %27, ptr noundef %28) #4
  %30 = load float, ptr @TimeUsed, align 4, !tbaa !9
  %31 = load float, ptr %12, align 4, !tbaa !9
  %32 = fadd float %30, %31
  store float %32, ptr @TimeUsed, align 4, !tbaa !9
  %33 = load i32, ptr %13, align 4, !tbaa !11
  %34 = icmp eq i32 %33, 1
  br i1 %34, label %35, label %40

35:                                               ; preds = %7
  %36 = load float, ptr %11, align 4, !tbaa !9
  %37 = load i32, ptr %14, align 4, !tbaa !11
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [9 x float], ptr @results, i64 0, i64 %38
  store float %36, ptr %39, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %35, %7
  %41 = load i32, ptr %13, align 4, !tbaa !11
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %113

43:                                               ; preds = %40
  %44 = load i32, ptr %14, align 4, !tbaa !11
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [9 x [18 x i8]], ptr @headings, i64 0, i64 %45
  %47 = getelementptr inbounds [18 x i8], ptr %46, i64 0, i64 0
  %48 = load i32, ptr %14, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [9 x float], ptr @results, i64 0, i64 %49
  %51 = load float, ptr %50, align 4, !tbaa !9
  %52 = fpext float %51 to double
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, ptr noundef %47, double noundef %52)
  %54 = load i32, ptr %10, align 4, !tbaa !11
  %55 = icmp eq i32 %54, 1
  br i1 %55, label %56, label %84

56:                                               ; preds = %43
  %57 = load float, ptr %12, align 4, !tbaa !9
  %58 = fcmp ogt float %57, 0.000000e+00
  br i1 %58, label %59, label %64

59:                                               ; preds = %56
  %60 = load float, ptr %9, align 4, !tbaa !9
  %61 = load float, ptr %12, align 4, !tbaa !9
  %62 = fmul float 1.000000e+06, %61
  %63 = fdiv float %60, %62
  store float %63, ptr %16, align 4, !tbaa !9
  br label %65

64:                                               ; preds = %56
  store float 0.000000e+00, ptr %16, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %64, %59
  %66 = load i32, ptr %14, align 4, !tbaa !11
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [9 x float], ptr @loop_mops, i64 0, i64 %67
  store float 9.999900e+04, ptr %68, align 4, !tbaa !9
  %69 = load float, ptr %16, align 4, !tbaa !9
  %70 = load i32, ptr %14, align 4, !tbaa !11
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [9 x float], ptr @loop_mflops, i64 0, i64 %71
  store float %69, ptr %72, align 4, !tbaa !9
  %73 = load i32, ptr %14, align 4, !tbaa !11
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [9 x float], ptr @loop_mflops, i64 0, i64 %74
  %76 = load float, ptr %75, align 4, !tbaa !9
  %77 = fpext float %76 to double
  %78 = load i32, ptr %14, align 4, !tbaa !11
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [9 x float], ptr @loop_time, i64 0, i64 %79
  %81 = load float, ptr %80, align 4, !tbaa !9
  %82 = fpext float %81 to double
  %83 = call i32 (ptr, ...) @printf(ptr noundef @.str.22, double noundef %77, double noundef %82)
  br label %112

84:                                               ; preds = %43
  %85 = load float, ptr %12, align 4, !tbaa !9
  %86 = fcmp ogt float %85, 0.000000e+00
  br i1 %86, label %87, label %92

87:                                               ; preds = %84
  %88 = load float, ptr %9, align 4, !tbaa !9
  %89 = load float, ptr %12, align 4, !tbaa !9
  %90 = fmul float 1.000000e+06, %89
  %91 = fdiv float %88, %90
  store float %91, ptr %15, align 4, !tbaa !9
  br label %93

92:                                               ; preds = %84
  store float 0.000000e+00, ptr %15, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %92, %87
  %94 = load float, ptr %15, align 4, !tbaa !9
  %95 = load i32, ptr %14, align 4, !tbaa !11
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [9 x float], ptr @loop_mops, i64 0, i64 %96
  store float %94, ptr %97, align 4, !tbaa !9
  %98 = load i32, ptr %14, align 4, !tbaa !11
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [9 x float], ptr @loop_mflops, i64 0, i64 %99
  store float 0.000000e+00, ptr %100, align 4, !tbaa !9
  %101 = load i32, ptr %14, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [9 x float], ptr @loop_mops, i64 0, i64 %102
  %104 = load float, ptr %103, align 4, !tbaa !9
  %105 = fpext float %104 to double
  %106 = load i32, ptr %14, align 4, !tbaa !11
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [9 x float], ptr @loop_time, i64 0, i64 %107
  %109 = load float, ptr %108, align 4, !tbaa !9
  %110 = fpext float %109 to double
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.23, double noundef %105, double noundef %110)
  br label %112

112:                                              ; preds = %93, %65
  br label %113

113:                                              ; preds = %112, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  ret void
}

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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 "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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; 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"

@TimeUsed = external hidden local_unnamed_addr global float, align 4
@Check = external hidden local_unnamed_addr global float, align 4
@loop_time = external hidden local_unnamed_addr global [9 x float], align 16
@headings = external hidden global [9 x [18 x i8]], align 16
@results = external hidden local_unnamed_addr global [9 x float], align 16
@.str.21 = external hidden unnamed_addr constant [15 x i8], align 1
@loop_mops = external hidden local_unnamed_addr global [9 x float], align 16
@loop_mflops = external hidden local_unnamed_addr global [9 x float], align 16
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @pout(ptr nocapture noundef readonly %0, float noundef %1, i32 noundef %2, float noundef %3, float noundef %4, i32 noundef %5, i32 noundef %6) local_unnamed_addr #1 {
  %8 = load float, ptr @Check, align 4, !tbaa !5
  %9 = fadd float %8, %3
  store float %9, ptr @Check, align 4, !tbaa !5
  %10 = sext i32 %6 to i64
  %11 = getelementptr inbounds [9 x float], ptr @loop_time, i64 0, i64 %10
  store float %4, ptr %11, align 4, !tbaa !5
  %12 = getelementptr inbounds [9 x [18 x i8]], ptr @headings, i64 0, i64 %10
  %13 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %12, ptr noundef nonnull dereferenceable(1) %0) #3
  %14 = load float, ptr @TimeUsed, align 4, !tbaa !5
  %15 = fadd float %14, %4
  store float %15, ptr @TimeUsed, align 4, !tbaa !5
  switch i32 %5, label %38 [
    i32 1, label %16
    i32 0, label %18
  ]

16:                                               ; preds = %7
  %17 = getelementptr inbounds [9 x float], ptr @results, i64 0, i64 %10
  store float %3, ptr %17, align 4, !tbaa !5
  br label %38

18:                                               ; preds = %7
  %19 = getelementptr inbounds [9 x float], ptr @results, i64 0, i64 %10
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = fpext float %20 to double
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, ptr noundef nonnull %12, double noundef %21)
  %23 = icmp eq i32 %2, 1
  %24 = fcmp ogt float %4, 0.000000e+00
  %25 = fmul float %4, 1.000000e+06
  %26 = fdiv float %1, %25
  %.0 = select i1 %24, float %26, float 0.000000e+00
  %27 = getelementptr inbounds [9 x float], ptr @loop_mops, i64 0, i64 %10
  %28 = getelementptr inbounds [9 x float], ptr @loop_mflops, i64 0, i64 %10
  %29 = fpext float %.0 to double
  br i1 %23, label %30, label %34

30:                                               ; preds = %18
  store float 9.999900e+04, ptr %27, align 4, !tbaa !5
  store float %.0, ptr %28, align 4, !tbaa !5
  %31 = load float, ptr %11, align 4, !tbaa !5
  %32 = fpext float %31 to double
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22, double noundef %29, double noundef %32)
  br label %38

34:                                               ; preds = %18
  store float %.0, ptr %27, align 4, !tbaa !5
  store float 0.000000e+00, ptr %28, align 4, !tbaa !5
  %35 = load float, ptr %11, align 4, !tbaa !5
  %36 = fpext float %35 to double
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23, double noundef %29, double noundef %36)
  br label %38

38:                                               ; preds = %16, %7, %30, %34
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #2

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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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