; LLVM IR from erayzesen/QuarkPhysics :: QuarkPhysics/extensions/qplatformerbody.ll (ZN15QPlatformerBody4JumpEfb)

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

%class.QPlatformerBody = type { %class.QRigidBody.base, i8, i8, i32, float, float, ptr, %struct.QVector, float, %struct.QVector, %struct.QVector, %struct.QVector, float, %struct.QVector, %struct.QVector, i8, i8, i32, float, float, i32, float, i32, i32, i32, i32, float, float }
%class.QRigidBody.base = type { %class.QBody.base, i8, %struct.QVector, float }
%class.QBody.base = type <{ ptr, float, float, ptr, %struct.QVector, %struct.QVector, float, float, %class.QAABB, i32, i8, i8, i8, i8, float, i32, i8, [3 x i8], float, i8, i8, [2 x i8], %struct.QVector, float, float, float, float, float, i32, i32, i8, i8, i8, i8, i32, i32, i32, i8, [3 x i8], %"class.std::function", %"class.std::function", %"class.std::function.0", i8, [7 x i8], %"class.std::vector", i32, i8 }>
%class.QAABB = type { %struct.QVector, %struct.QVector, %struct.QVector, float }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::function.0" = type { %"class.std::_Function_base", ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl" }
%"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl" = type { %"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.QVector = type { float, float }

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN15QPlatformerBody4JumpEfb(ptr noundef nonnull align 8 dereferenceable(440) %0, float noundef %1, i1 noundef zeroext %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  %10 = zext i1 %2 to i8
  store i8 %10, ptr %6, align 1, !tbaa !11
  %11 = load ptr, ptr %4, align 8
  %12 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 20
  %13 = load i32, ptr %12, align 8, !tbaa !13
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %70

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #2
  %16 = load i8, ptr %6, align 1, !tbaa !11, !range !31, !noundef !32
  %17 = trunc i8 %16 to i1
  %18 = zext i1 %17 to i8
  store i8 %18, ptr %7, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #2
  %19 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 1
  %20 = load i8, ptr %19, align 4, !tbaa !33, !range !31, !noundef !32
  %21 = trunc i8 %20 to i1
  br i1 %21, label %22, label %28

22:                                               ; preds = %15
  %23 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 25
  %24 = load i32, ptr %23, align 4, !tbaa !34
  %25 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 24
  %26 = load i32, ptr %25, align 8, !tbaa !35
  %27 = icmp sgt i32 %24, %26
  br label %28

28:                                               ; preds = %22, %15
  %29 = phi i1 [ false, %15 ], [ %27, %22 ]
  %30 = zext i1 %29 to i8
  store i8 %30, ptr %8, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #2
  %31 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 1
  %32 = load i8, ptr %31, align 4, !tbaa !33, !range !31, !noundef !32
  %33 = trunc i8 %32 to i1
  %34 = zext i1 %33 to i32
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %43

36:                                               ; preds = %28
  %37 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 23
  %38 = load i32, ptr %37, align 4, !tbaa !36
  %39 = add nsw i32 %38, 1
  %40 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 22
  %41 = load i32, ptr %40, align 8, !tbaa !37
  %42 = icmp slt i32 %39, %41
  br label %43

43:                                               ; preds = %36, %28
  %44 = phi i1 [ false, %28 ], [ %42, %36 ]
  %45 = zext i1 %44 to i8
  store i8 %45, ptr %9, align 1, !tbaa !11
  %46 = load i8, ptr %7, align 1, !tbaa !11, !range !31, !noundef !32
  %47 = trunc i8 %46 to i1
  br i1 %47, label %54, label %48

48:                                               ; preds = %43
  %49 = load i8, ptr %8, align 1, !tbaa !11, !range !31, !noundef !32
  %50 = trunc i8 %49 to i1
  br i1 %50, label %54, label %51

51:                                               ; preds = %48
  %52 = load i8, ptr %9, align 1, !tbaa !11, !range !31, !noundef !32
  %53 = trunc i8 %52 to i1
  br i1 %53, label %54, label %59

54:                                               ; preds = %51, %48, %43
  %55 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 20
  store i32 1, ptr %55, align 8, !tbaa !13
  %56 = load float, ptr %5, align 4, !tbaa !9
  %57 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 21
  store float %56, ptr %57, align 4, !tbaa !38
  %58 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 25
  store i32 0, ptr %58, align 4, !tbaa !34
  br label %59

59:                                               ; preds = %54, %51
  %60 = load i8, ptr %8, align 1, !tbaa !11, !range !31, !noundef !32
  %61 = trunc i8 %60 to i1
  br i1 %61, label %65, label %62

62:                                               ; preds = %59
  %63 = load i8, ptr %9, align 1, !tbaa !11, !range !31, !noundef !32
  %64 = trunc i8 %63 to i1
  br i1 %64, label %65, label %69

65:                                               ; preds = %62, %59
  %66 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 23
  %67 = load i32, ptr %66, align 4, !tbaa !36
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %66, align 4, !tbaa !36
  br label %69

69:                                               ; preds = %65, %62
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #2
  br label %77

70:                                               ; preds = %3
  %71 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 20
  %72 = load i32, ptr %71, align 8, !tbaa !13
  %73 = icmp eq i32 %72, 1
  br i1 %73, label %74, label %76

74:                                               ; preds = %70
  %75 = getelementptr inbounds %class.QPlatformerBody, ptr %11, i32 0, i32 20
  store i32 2, ptr %75, align 8, !tbaa !13
  br label %76

76:                                               ; preds = %74, %70
  br label %77

77:                                               ; preds = %76, %69
  ret ptr %11
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !30, i64 408}
!14 = !{!"_ZTS15QPlatformerBody", !15, i64 0, !12, i64 308, !12, i64 309, !21, i64 312, !10, i64 316, !10, i64 320, !6, i64 328, !17, i64 336, !10, i64 344, !17, i64 348, !17, i64 356, !17, i64 364, !10, i64 372, !17, i64 376, !17, i64 384, !12, i64 392, !12, i64 393, !21, i64 396, !10, i64 400, !10, i64 404, !30, i64 408, !10, i64 412, !21, i64 416, !21, i64 420, !21, i64 424, !21, i64 428, !10, i64 432, !10, i64 436}
!15 = !{!"_ZTS10QRigidBody", !16, i64 0, !12, i64 293, !17, i64 296, !10, i64 304}
!16 = !{!"_ZTS5QBody", !10, i64 8, !10, i64 12, !6, i64 16, !17, i64 24, !17, i64 32, !10, i64 40, !10, i64 44, !18, i64 48, !19, i64 76, !12, i64 80, !12, i64 81, !12, i64 82, !10, i64 84, !20, i64 88, !12, i64 92, !10, i64 96, !12, i64 100, !12, i64 101, !17, i64 104, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !21, i64 132, !21, i64 136, !12, i64 140, !12, i64 141, !12, i64 142, !21, i64 144, !21, i64 148, !21, i64 152, !12, i64 156, !22, i64 160, !22, i64 192, !24, i64 224, !12, i64 256, !25, i64 264, !29, i64 288, !12, i64 292}
!17 = !{!"_ZTS7QVector", !10, i64 0, !10, i64 4}
!18 = !{!"_ZTS5QAABB", !17, i64 0, !17, i64 8, !17, i64 16, !10, i64 24}
!19 = !{!"_ZTSN5QBody5ModesE", !7, i64 0}
!20 = !{!"_ZTSN5QBody9BodyTypesE", !7, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!"_ZTSSt8functionIFvP5QBodyEE", !23, i64 0, !6, i64 24}
!23 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!24 = !{!"_ZTSSt8functionIFbP5QBodyNS0_13CollisionInfoEEE", !23, i64 0, !6, i64 24}
!25 = !{!"_ZTSSt6vectorIP5QMeshSaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIP5QMeshSaIS1_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"_ZTSN5QBody16SimulationModelsE", !7, i64 0}
!30 = !{!"_ZTSN15QPlatformerBody9JumpModesE", !7, i64 0}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!14, !12, i64 308}
!34 = !{!14, !21, i64 428}
!35 = !{!14, !21, i64 424}
!36 = !{!14, !21, i64 420}
!37 = !{!14, !21, i64 416}
!38 = !{!14, !10, i64 412}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef nonnull ptr @_ZN15QPlatformerBody4JumpEfb(ptr noundef nonnull returned align 8 dereferenceable(440) %0, float noundef %1, i1 noundef zeroext %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 408
  %5 = load i32, ptr %4, align 8, !tbaa !5
  switch i32 %5, label %29 [
    i32 0, label %6
    i32 1, label %28
  ]

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 308
  %8 = load i8, ptr %7, align 4, !tbaa !28, !range !29, !noundef !30
  %9 = trunc nuw i8 %8 to i1
  %10 = getelementptr inbounds i8, ptr %0, i64 428
  %11 = load i32, ptr %10, align 4
  %12 = getelementptr inbounds i8, ptr %0, i64 424
  %13 = load i32, ptr %12, align 8
  %14 = icmp sgt i32 %11, %13
  %15 = select i1 %9, i1 %14, i1 false
  %16 = icmp eq i8 %8, 0
  %17 = getelementptr inbounds i8, ptr %0, i64 420
  %18 = load i32, ptr %17, align 4
  %19 = add nsw i32 %18, 1
  %20 = getelementptr inbounds i8, ptr %0, i64 416
  %21 = load i32, ptr %20, align 8
  %22 = icmp slt i32 %19, %21
  %23 = select i1 %16, i1 %22, i1 false
  %brmerge = select i1 %2, i1 true, i1 %15
  %brmerge7 = select i1 %brmerge, i1 true, i1 %23
  br i1 %brmerge7, label %24, label %26

24:                                               ; preds = %6
  store i32 1, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 412
  store float %1, ptr %25, align 4, !tbaa !31
  store i32 0, ptr %10, align 4, !tbaa !32
  br label %26

26:                                               ; preds = %6, %24
  %brmerge8 = select i1 %15, i1 true, i1 %23
  br i1 %brmerge8, label %27, label %29

27:                                               ; preds = %26
  store i32 %19, ptr %17, align 4, !tbaa !33
  br label %29

28:                                               ; preds = %3
  store i32 2, ptr %4, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %3, %27, %26, %28
  ret ptr %0
}

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

!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, !27, i64 408}
!6 = !{!"_ZTS15QPlatformerBody", !7, i64 0, !16, i64 308, !16, i64 309, !18, i64 312, !9, i64 316, !9, i64 320, !12, i64 328, !13, i64 336, !9, i64 344, !13, i64 348, !13, i64 356, !13, i64 364, !9, i64 372, !13, i64 376, !13, i64 384, !16, i64 392, !16, i64 393, !18, i64 396, !9, i64 400, !9, i64 404, !27, i64 408, !9, i64 412, !18, i64 416, !18, i64 420, !18, i64 424, !18, i64 428, !9, i64 432, !9, i64 436}
!7 = !{!"_ZTS10QRigidBody", !8, i64 0, !16, i64 293, !13, i64 296, !9, i64 304}
!8 = !{!"_ZTS5QBody", !9, i64 8, !9, i64 12, !12, i64 16, !13, i64 24, !13, i64 32, !9, i64 40, !9, i64 44, !14, i64 48, !15, i64 76, !16, i64 80, !16, i64 81, !16, i64 82, !9, i64 84, !17, i64 88, !16, i64 92, !9, i64 96, !16, i64 100, !16, i64 101, !13, i64 104, !9, i64 112, !9, i64 116, !9, i64 120, !9, i64 124, !9, i64 128, !18, i64 132, !18, i64 136, !16, i64 140, !16, i64 141, !16, i64 142, !18, i64 144, !18, i64 148, !18, i64 152, !16, i64 156, !19, i64 160, !19, i64 192, !21, i64 224, !16, i64 256, !22, i64 264, !26, i64 288, !16, i64 292}
!9 = !{!"float", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!"_ZTS7QVector", !9, i64 0, !9, i64 4}
!14 = !{!"_ZTS5QAABB", !13, i64 0, !13, i64 8, !13, i64 16, !9, i64 24}
!15 = !{!"_ZTSN5QBody5ModesE", !10, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = !{!"_ZTSN5QBody9BodyTypesE", !10, i64 0}
!18 = !{!"int", !10, i64 0}
!19 = !{!"_ZTSSt8functionIFvP5QBodyEE", !20, i64 0, !12, i64 24}
!20 = !{!"_ZTSSt14_Function_base", !10, i64 0, !12, i64 16}
!21 = !{!"_ZTSSt8functionIFbP5QBodyNS0_13CollisionInfoEEE", !20, i64 0, !12, i64 24}
!22 = !{!"_ZTSSt6vectorIP5QMeshSaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIP5QMeshSaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!26 = !{!"_ZTSN5QBody16SimulationModelsE", !10, i64 0}
!27 = !{!"_ZTSN15QPlatformerBody9JumpModesE", !10, i64 0}
!28 = !{!6, !16, i64 308}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!6, !9, i64 412}
!32 = !{!6, !18, i64 428}
!33 = !{!6, !18, i64 420}


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