; LLVM IR from Dovyski/opengl-demos :: libs/glm-0.9.9.3/test/gtc/gtc_ulp.ll (Z19test_ulp_float_stepv)

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3glm8notEqualIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3glm5equalIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3glm14float_distanceEff(float noundef, float 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: mustprogress uwtable
define dso_local noundef i32 @_Z19test_ulp_float_stepv() #2 {
  %1 = alloca i32, align 4
  %2 = alloca float, align 4
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store float 1.000000e+00, ptr %2, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 10, ptr %3, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %48, %0
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = icmp slt i32 %9, 1000
  br i1 %10, label %12, label %11

11:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %51

12:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %13 = load float, ptr %2, align 4, !tbaa !9
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = call noundef float @_ZN3glm10next_floatIfEET_S1_i(float noundef %13, i32 noundef %14)
  store float %15, ptr %4, align 4, !tbaa !9
  %16 = call noundef zeroext i1 @_ZN3glm8notEqualIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef 0)
  %17 = zext i1 %16 to i64
  %18 = select i1 %16, i32 0, i32 1
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = add nsw i32 %19, %18
  store i32 %20, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %21 = load float, ptr %4, align 4, !tbaa !9
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = call noundef float @_ZN3glm10prev_floatIfEET_S1_i(float noundef %21, i32 noundef %22)
  store float %23, ptr %5, align 4, !tbaa !9
  %24 = call noundef zeroext i1 @_ZN3glm5equalIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %5, i32 noundef 0)
  %25 = zext i1 %24 to i64
  %26 = select i1 %24, i32 0, i32 1
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = add nsw i32 %27, %26
  store i32 %28, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %29 = load float, ptr %2, align 4, !tbaa !9
  %30 = load float, ptr %4, align 4, !tbaa !9
  %31 = call noundef i32 @_ZN3glm14float_distanceEff(float noundef %29, float noundef %30)
  store i32 %31, ptr %6, align 4, !tbaa !5
  %32 = load i32, ptr %6, align 4, !tbaa !5
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = icmp eq i32 %32, %33
  %35 = zext i1 %34 to i64
  %36 = select i1 %34, i32 0, i32 1
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = add nsw i32 %37, %36
  store i32 %38, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %39 = load float, ptr %2, align 4, !tbaa !9
  %40 = load float, ptr %5, align 4, !tbaa !9
  %41 = call noundef i32 @_ZN3glm14float_distanceEff(float noundef %39, float noundef %40)
  store i32 %41, ptr %7, align 4, !tbaa !5
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = icmp eq i32 %42, 0
  %44 = zext i1 %43 to i64
  %45 = select i1 %43, i32 0, i32 1
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = add nsw i32 %46, %45
  store i32 %47, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %48

48:                                               ; preds = %12
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = mul nsw i32 %49, 10
  store i32 %50, ptr %3, align 4, !tbaa !5
  br label %8, !llvm.loop !11

51:                                               ; preds = %11
  %52 = load i32, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret i32 %52
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3glm10next_floatIfEET_S1_i(float noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3glm10prev_floatIfEET_S1_i(float noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 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 = { inlinehint mustprogress 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 }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3glm8notEqualIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3glm5equalIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3glm14float_distanceEff(float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z19test_ulp_float_stepv() local_unnamed_addr #2 {
  %1 = alloca float, align 4
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  store float 1.000000e+00, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %4 = tail call noundef float @_ZN3glm10next_floatIfEET_S1_i(float noundef 1.000000e+00, i32 noundef 10)
  store float %4, ptr %2, align 4, !tbaa !5
  %5 = call noundef zeroext i1 @_ZN3glm8notEqualIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef 0)
  %not. = xor i1 %5, true
  %6 = zext i1 %not. to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %7 = load float, ptr %2, align 4, !tbaa !5
  %8 = call noundef float @_ZN3glm10prev_floatIfEET_S1_i(float noundef %7, i32 noundef 10)
  store float %8, ptr %3, align 4, !tbaa !5
  %9 = call noundef zeroext i1 @_ZN3glm5equalIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef 0)
  %not.13 = xor i1 %9, true
  %10 = zext i1 %not.13 to i32
  %11 = add nuw nsw i32 %6, %10
  %12 = load float, ptr %1, align 4, !tbaa !5
  %13 = load float, ptr %2, align 4, !tbaa !5
  %14 = call noundef i32 @_ZN3glm14float_distanceEff(float noundef %12, float noundef %13)
  %15 = icmp ne i32 %14, 10
  %16 = zext i1 %15 to i32
  %17 = add nuw nsw i32 %11, %16
  %18 = load float, ptr %1, align 4, !tbaa !5
  %19 = load float, ptr %3, align 4, !tbaa !5
  %20 = call noundef i32 @_ZN3glm14float_distanceEff(float noundef %18, float noundef %19)
  %21 = icmp ne i32 %20, 0
  %22 = zext i1 %21 to i32
  %23 = add nuw nsw i32 %17, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %24 = load float, ptr %1, align 4, !tbaa !5
  %25 = call noundef float @_ZN3glm10next_floatIfEET_S1_i(float noundef %24, i32 noundef 100)
  store float %25, ptr %2, align 4, !tbaa !5
  %26 = call noundef zeroext i1 @_ZN3glm8notEqualIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef 0)
  %not..1 = xor i1 %26, true
  %27 = zext i1 %not..1 to i32
  %28 = add nuw nsw i32 %23, %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %29 = load float, ptr %2, align 4, !tbaa !5
  %30 = call noundef float @_ZN3glm10prev_floatIfEET_S1_i(float noundef %29, i32 noundef 100)
  store float %30, ptr %3, align 4, !tbaa !5
  %31 = call noundef zeroext i1 @_ZN3glm5equalIfEEbRKT_S3_i(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef 0)
  %not.13.1 = xor i1 %31, true
  %32 = zext i1 %not.13.1 to i32
  %33 = add nuw nsw i32 %28, %32
  %34 = load float, ptr %1, align 4, !tbaa !5
  %35 = load float, ptr %2, align 4, !tbaa !5
  %36 = call noundef i32 @_ZN3glm14float_distanceEff(float noundef %34, float noundef %35)
  %37 = icmp ne i32 %36, 100
  %38 = zext i1 %37 to i32
  %39 = add nuw nsw i32 %33, %38
  %40 = load float, ptr %1, align 4, !tbaa !5
  %41 = load float, ptr %3, align 4, !tbaa !5
  %42 = call noundef i32 @_ZN3glm14float_distanceEff(float noundef %40, float noundef %41)
  %43 = icmp ne i32 %42, 0
  %44 = zext i1 %43 to i32
  %45 = add nuw nsw i32 %39, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret i32 %45
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3glm10next_floatIfEET_S1_i(float noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3glm10prev_floatIfEET_S1_i(float noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 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 = { inlinehint mustprogress 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 }

!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++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass