; LLVM IR from DarrenSweeney/3D-Physics-Engine :: Physics Engine/Imgui (imgui)

; 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.ImVec2 = type { float, float }

@__const._ZN18ImGuiTextEditState25RenderTextScrolledClippedEP6ImFontfPKc6ImVec2ff.s = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden <2 x float> @_ZplRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float>, ptr noundef, ptr noundef, i1 noundef zeroext) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN18ImGuiTextEditState22GetTextPointerClippedAEP6ImFontfPKcfP6ImVec2(ptr noundef, float noundef, ptr noundef, float noundef, ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN18ImGuiTextEditState25RenderTextScrolledClippedEP6ImFontfPKc6ImVec2ff(ptr noundef %0, float noundef %1, ptr noundef %2, <2 x float> %3, float noundef %4, float noundef %5) #4 align 2 {
  %7 = alloca %struct.ImVec2, align 4
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca %struct.ImVec2, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i8, align 1
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca %struct.ImVec2, align 4
  %21 = alloca %struct.ImVec2, align 4
  %22 = alloca [2 x i8], align 1
  %23 = alloca %struct.ImVec2, align 4
  %24 = alloca %struct.ImVec2, align 4
  %25 = alloca %struct.ImVec2, align 4
  store <2 x float> %3, ptr %7, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store float %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store float %4, ptr %11, align 4, !tbaa !9
  store float %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %13)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = load float, ptr %9, align 4, !tbaa !9
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = load float, ptr %12, align 4, !tbaa !9
  %30 = call noundef ptr @_ZN18ImGuiTextEditState22GetTextPointerClippedAEP6ImFontfPKcfP6ImVec2(ptr noundef %26, float noundef %27, ptr noundef %28, float noundef %29, ptr noundef null)
  store ptr %30, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = load float, ptr %9, align 4, !tbaa !9
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = load float, ptr %11, align 4, !tbaa !9
  %35 = call noundef ptr @_ZN18ImGuiTextEditState22GetTextPointerClippedAEP6ImFontfPKcfP6ImVec2(ptr noundef %31, float noundef %32, ptr noundef %33, float noundef %34, ptr noundef %13)
  store ptr %35, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #5
  store i8 126, ptr %16, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %36 = load float, ptr %9, align 4, !tbaa !9
  %37 = fmul float %36, 0x3FD99999A0000000
  store float %37, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %38 = load ptr, ptr %14, align 8, !tbaa !5
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = icmp ugt ptr %38, %39
  br i1 %40, label %41, label %47

41:                                               ; preds = %6
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  %43 = load ptr, ptr %15, align 8, !tbaa !5
  %44 = icmp ult ptr %42, %43
  br i1 %44, label %45, label %47

45:                                               ; preds = %41
  %46 = load float, ptr %17, align 4, !tbaa !9
  br label %48

47:                                               ; preds = %41, %6
  br label %48

48:                                               ; preds = %47, %45
  %49 = phi float [ %46, %45 ], [ 0.000000e+00, %47 ]
  store float %49, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %50 = load ptr, ptr %15, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %50, i64 0
  %52 = load i8, ptr %51, align 1, !tbaa !11
  %53 = sext i8 %52 to i32
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %61

55:                                               ; preds = %48
  %56 = load ptr, ptr %15, align 8, !tbaa !5
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = icmp ugt ptr %56, %57
  br i1 %58, label %59, label %61

59:                                               ; preds = %55
  %60 = load float, ptr %17, align 4, !tbaa !9
  br label %62

61:                                               ; preds = %55, %48
  br label %62

62:                                               ; preds = %61, %59
  %63 = phi float [ %60, %59 ], [ 0.000000e+00, %61 ]
  store float %63, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %64 = load float, ptr %18, align 4, !tbaa !9
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %21, float noundef %64, float noundef 0.000000e+00)
  %65 = call <2 x float> @_ZplRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %21)
  store <2 x float> %65, ptr %20, align 4
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = load float, ptr %18, align 4, !tbaa !9
  %68 = fcmp ogt float %67, 0.000000e+00
  %69 = zext i1 %68 to i64
  %70 = select i1 %68, i32 1, i32 0
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i8, ptr %66, i64 %71
  %73 = load ptr, ptr %15, align 8, !tbaa !5
  %74 = load float, ptr %19, align 4, !tbaa !9
  %75 = fcmp ogt float %74, 0.000000e+00
  %76 = zext i1 %75 to i64
  %77 = select i1 %75, i32 1, i32 0
  %78 = sext i32 %77 to i64
  %79 = sub i64 0, %78
  %80 = getelementptr inbounds i8, ptr %73, i64 %79
  %81 = load <2 x float>, ptr %20, align 4
  call void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float> %81, ptr noundef %72, ptr noundef %80, i1 noundef zeroext false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 2, ptr %22) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %22, ptr align 1 @__const._ZN18ImGuiTextEditState25RenderTextScrolledClippedEP6ImFontfPKc6ImVec2ff.s, i64 2, i1 false)
  %82 = load float, ptr %18, align 4, !tbaa !9
  %83 = fcmp ogt float %82, 0.000000e+00
  br i1 %83, label %84, label %87

84:                                               ; preds = %62
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !12
  %85 = getelementptr inbounds [2 x i8], ptr %22, i64 0, i64 0
  %86 = load <2 x float>, ptr %23, align 4
  call void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float> %86, ptr noundef %85, ptr noundef null, i1 noundef zeroext true)
  br label %87

87:                                               ; preds = %84, %62
  %88 = load float, ptr %19, align 4, !tbaa !9
  %89 = fcmp ogt float %88, 0.000000e+00
  br i1 %89, label %90, label %97

90:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  %91 = load float, ptr %11, align 4, !tbaa !9
  %92 = load float, ptr %19, align 4, !tbaa !9
  %93 = fsub float %91, %92
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %25, float noundef %93, float noundef 0.000000e+00)
  %94 = call <2 x float> @_ZplRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %25)
  store <2 x float> %94, ptr %24, align 4
  %95 = getelementptr inbounds [2 x i8], ptr %22, i64 0, i64 0
  %96 = load <2 x float>, ptr %24, align 4
  call void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float> %96, ptr noundef %95, ptr noundef null, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  br label %97

97:                                               ; preds = %90, %87
  call void @llvm.lifetime.end.p0(i64 2, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  ret void
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}


; 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.ImVec2 = type { float, float }

@__const._ZN18ImGuiTextEditState25RenderTextScrolledClippedEP6ImFontfPKc6ImVec2ff.s = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden <2 x float> @_ZplRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float>, ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN18ImGuiTextEditState22GetTextPointerClippedAEP6ImFontfPKcfP6ImVec2(ptr noundef, float noundef, ptr noundef, float noundef, ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN18ImGuiTextEditState25RenderTextScrolledClippedEP6ImFontfPKc6ImVec2ff(ptr noundef %0, float noundef %1, ptr noundef %2, <2 x float> %3, float noundef %4, float noundef %5) local_unnamed_addr #3 align 2 {
  %7 = alloca %struct.ImVec2, align 8
  %8 = alloca %struct.ImVec2, align 4
  %9 = alloca %struct.ImVec2, align 4
  %10 = alloca [2 x i8], align 2
  %11 = alloca %struct.ImVec2, align 4
  store <2 x float> %3, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %8)
  %12 = call noundef ptr @_ZN18ImGuiTextEditState22GetTextPointerClippedAEP6ImFontfPKcfP6ImVec2(ptr noundef %0, float noundef %1, ptr noundef %2, float noundef %5, ptr noundef null)
  %13 = call noundef ptr @_ZN18ImGuiTextEditState22GetTextPointerClippedAEP6ImFontfPKcfP6ImVec2(ptr noundef %0, float noundef %1, ptr noundef %12, float noundef %4, ptr noundef nonnull %8)
  %14 = fmul float %1, 0x3FD99999A0000000
  %15 = icmp ugt ptr %12, %2
  %16 = icmp ult ptr %12, %13
  %or.cond = and i1 %15, %16
  %17 = select i1 %or.cond, float %14, float 0.000000e+00
  %18 = load i8, ptr %13, align 1, !tbaa !5
  %.not = icmp ne i8 %18, 0
  %or.cond30 = and i1 %16, %.not
  %19 = select i1 %or.cond30, float %14, float 0.000000e+00
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %9, float noundef %17, float noundef 0.000000e+00)
  %20 = call <2 x float> @_ZplRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %9)
  %21 = fcmp ogt float %17, 0.000000e+00
  %22 = zext i1 %21 to i64
  %23 = getelementptr inbounds i8, ptr %12, i64 %22
  %24 = fcmp ogt float %19, 0.000000e+00
  %.neg = sext i1 %24 to i64
  %25 = getelementptr inbounds i8, ptr %13, i64 %.neg
  call void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float> %20, ptr noundef %23, ptr noundef nonnull %25, i1 noundef zeroext false)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %10) #4
  %26 = load i16, ptr @__const._ZN18ImGuiTextEditState25RenderTextScrolledClippedEP6ImFontfPKc6ImVec2ff.s, align 1
  store i16 %26, ptr %10, align 2
  br i1 %21, label %27, label %28

27:                                               ; preds = %6
  %.sroa.01.0.copyload = load <2 x float>, ptr %7, align 8
  call void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float> %.sroa.01.0.copyload, ptr noundef nonnull %10, ptr noundef null, i1 noundef zeroext true)
  br label %28

28:                                               ; preds = %27, %6
  br i1 %24, label %29, label %32

29:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  %30 = fsub float %4, %19
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %11, float noundef %30, float noundef 0.000000e+00)
  %31 = call <2 x float> @_ZplRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %11)
  call void @_ZL10RenderText6ImVec2PKcS1_b(<2 x float> %31, ptr noundef nonnull %10, ptr noundef null, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  br label %32

32:                                               ; preds = %29, %28
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  ret void
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


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