; LLVM IR from erincatto/box2d :: shared (human)

; 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.b2Vec2 = type { float, float }
%struct.b2BodyId = type { i32, i16, i16 }
%struct.Human = type { [11 x %struct.Bone], float, i8 }
%struct.Bone = type { %struct.b2BodyId, %struct.b2JointId, float, i32 }
%struct.b2JointId = type { i32, i16, i16 }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 @Human_SetVelocity(ptr noundef %0, <2 x float> %1) #2 {
  %3 = alloca %struct.b2Vec2, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.b2BodyId, align 4
  store <2 x float> %1, ptr %3, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %8

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

11:                                               ; preds = %8
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %32

12:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.Human, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [11 x %struct.Bone], ptr %14, i64 0, i64 %16
  %18 = getelementptr inbounds %struct.Bone, ptr %17, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !11
  %19 = getelementptr inbounds %struct.b2BodyId, ptr %7, i32 0, i32 0
  %20 = load i32, ptr %19, align 4, !tbaa !14
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %12
  store i32 4, ptr %6, align 4
  br label %26

23:                                               ; preds = %12
  %24 = load i64, ptr %7, align 4
  %25 = load <2 x float>, ptr %3, align 4
  call void @b2Body_SetLinearVelocity(i64 %24, <2 x float> %25)
  store i32 0, ptr %6, align 4
  br label %26

26:                                               ; preds = %23, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %27 = load i32, ptr %6, align 4
  switch i32 %27, label %33 [
    i32 0, label %28
    i32 4, label %29
  ]

28:                                               ; preds = %26
  br label %29

29:                                               ; preds = %28, %26
  %30 = load i32, ptr %5, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %5, align 4, !tbaa !9
  br label %8, !llvm.loop !16

32:                                               ; preds = %11
  ret void

33:                                               ; preds = %26
  unreachable
}

declare void @b2Body_SetLinearVelocity(i64, <2 x float>) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind 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 = { "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 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 4, !9, i64 4, i64 2, !12, i64 6, i64 2, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !10, i64 0}
!15 = !{!"b2BodyId", !10, i64 0, !13, i64 4, !13, i64 6}
!16 = distinct !{!16, !17}
!17 = !{!"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: nounwind uwtable
define dso_local void @Human_SetVelocity(ptr nocapture noundef readonly %0, <2 x float> %1) local_unnamed_addr #0 {
  %.sroa.0.0.copyload = load i32, ptr %0, align 4, !tbaa !5
  %3 = icmp eq i32 %.sroa.0.0.copyload, 0
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 4
  %.sroa.5.sroa.0.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4
  %.sroa.5.0.insert.ext = zext i32 %.sroa.5.sroa.0.0.copyload to i64
  %.sroa.5.0.insert.shift = shl nuw i64 %.sroa.5.0.insert.ext, 32
  %.sroa.0.0.insert.ext = zext i32 %.sroa.0.0.copyload to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.5.0.insert.shift, %.sroa.0.0.insert.ext
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert, <2 x float> %1) #2
  br label %5

5:                                                ; preds = %2, %4
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %.sroa.0.0.copyload.1 = load i32, ptr %6, align 4, !tbaa !5
  %7 = icmp eq i32 %.sroa.0.0.copyload.1, 0
  br i1 %7, label %9, label %8

8:                                                ; preds = %5
  %.sroa.5.0..sroa_idx.1 = getelementptr inbounds i8, ptr %0, i64 28
  %.sroa.5.sroa.0.0.copyload.1 = load i32, ptr %.sroa.5.0..sroa_idx.1, align 4
  %.sroa.5.0.insert.ext.1 = zext i32 %.sroa.5.sroa.0.0.copyload.1 to i64
  %.sroa.5.0.insert.shift.1 = shl nuw i64 %.sroa.5.0.insert.ext.1, 32
  %.sroa.0.0.insert.ext.1 = zext i32 %.sroa.0.0.copyload.1 to i64
  %.sroa.0.0.insert.insert.1 = or disjoint i64 %.sroa.5.0.insert.shift.1, %.sroa.0.0.insert.ext.1
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.1, <2 x float> %1) #2
  br label %9

9:                                                ; preds = %8, %5
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %.sroa.0.0.copyload.2 = load i32, ptr %10, align 4, !tbaa !5
  %11 = icmp eq i32 %.sroa.0.0.copyload.2, 0
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  %.sroa.5.0..sroa_idx.2 = getelementptr inbounds i8, ptr %0, i64 52
  %.sroa.5.sroa.0.0.copyload.2 = load i32, ptr %.sroa.5.0..sroa_idx.2, align 4
  %.sroa.5.0.insert.ext.2 = zext i32 %.sroa.5.sroa.0.0.copyload.2 to i64
  %.sroa.5.0.insert.shift.2 = shl nuw i64 %.sroa.5.0.insert.ext.2, 32
  %.sroa.0.0.insert.ext.2 = zext i32 %.sroa.0.0.copyload.2 to i64
  %.sroa.0.0.insert.insert.2 = or disjoint i64 %.sroa.5.0.insert.shift.2, %.sroa.0.0.insert.ext.2
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.2, <2 x float> %1) #2
  br label %13

13:                                               ; preds = %12, %9
  %14 = getelementptr inbounds i8, ptr %0, i64 72
  %.sroa.0.0.copyload.3 = load i32, ptr %14, align 4, !tbaa !5
  %15 = icmp eq i32 %.sroa.0.0.copyload.3, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  %.sroa.5.0..sroa_idx.3 = getelementptr inbounds i8, ptr %0, i64 76
  %.sroa.5.sroa.0.0.copyload.3 = load i32, ptr %.sroa.5.0..sroa_idx.3, align 4
  %.sroa.5.0.insert.ext.3 = zext i32 %.sroa.5.sroa.0.0.copyload.3 to i64
  %.sroa.5.0.insert.shift.3 = shl nuw i64 %.sroa.5.0.insert.ext.3, 32
  %.sroa.0.0.insert.ext.3 = zext i32 %.sroa.0.0.copyload.3 to i64
  %.sroa.0.0.insert.insert.3 = or disjoint i64 %.sroa.5.0.insert.shift.3, %.sroa.0.0.insert.ext.3
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.3, <2 x float> %1) #2
  br label %17

17:                                               ; preds = %16, %13
  %18 = getelementptr inbounds i8, ptr %0, i64 96
  %.sroa.0.0.copyload.4 = load i32, ptr %18, align 4, !tbaa !5
  %19 = icmp eq i32 %.sroa.0.0.copyload.4, 0
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  %.sroa.5.0..sroa_idx.4 = getelementptr inbounds i8, ptr %0, i64 100
  %.sroa.5.sroa.0.0.copyload.4 = load i32, ptr %.sroa.5.0..sroa_idx.4, align 4
  %.sroa.5.0.insert.ext.4 = zext i32 %.sroa.5.sroa.0.0.copyload.4 to i64
  %.sroa.5.0.insert.shift.4 = shl nuw i64 %.sroa.5.0.insert.ext.4, 32
  %.sroa.0.0.insert.ext.4 = zext i32 %.sroa.0.0.copyload.4 to i64
  %.sroa.0.0.insert.insert.4 = or disjoint i64 %.sroa.5.0.insert.shift.4, %.sroa.0.0.insert.ext.4
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.4, <2 x float> %1) #2
  br label %21

21:                                               ; preds = %20, %17
  %22 = getelementptr inbounds i8, ptr %0, i64 120
  %.sroa.0.0.copyload.5 = load i32, ptr %22, align 4, !tbaa !5
  %23 = icmp eq i32 %.sroa.0.0.copyload.5, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  %.sroa.5.0..sroa_idx.5 = getelementptr inbounds i8, ptr %0, i64 124
  %.sroa.5.sroa.0.0.copyload.5 = load i32, ptr %.sroa.5.0..sroa_idx.5, align 4
  %.sroa.5.0.insert.ext.5 = zext i32 %.sroa.5.sroa.0.0.copyload.5 to i64
  %.sroa.5.0.insert.shift.5 = shl nuw i64 %.sroa.5.0.insert.ext.5, 32
  %.sroa.0.0.insert.ext.5 = zext i32 %.sroa.0.0.copyload.5 to i64
  %.sroa.0.0.insert.insert.5 = or disjoint i64 %.sroa.5.0.insert.shift.5, %.sroa.0.0.insert.ext.5
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.5, <2 x float> %1) #2
  br label %25

25:                                               ; preds = %24, %21
  %26 = getelementptr inbounds i8, ptr %0, i64 144
  %.sroa.0.0.copyload.6 = load i32, ptr %26, align 4, !tbaa !5
  %27 = icmp eq i32 %.sroa.0.0.copyload.6, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  %.sroa.5.0..sroa_idx.6 = getelementptr inbounds i8, ptr %0, i64 148
  %.sroa.5.sroa.0.0.copyload.6 = load i32, ptr %.sroa.5.0..sroa_idx.6, align 4
  %.sroa.5.0.insert.ext.6 = zext i32 %.sroa.5.sroa.0.0.copyload.6 to i64
  %.sroa.5.0.insert.shift.6 = shl nuw i64 %.sroa.5.0.insert.ext.6, 32
  %.sroa.0.0.insert.ext.6 = zext i32 %.sroa.0.0.copyload.6 to i64
  %.sroa.0.0.insert.insert.6 = or disjoint i64 %.sroa.5.0.insert.shift.6, %.sroa.0.0.insert.ext.6
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.6, <2 x float> %1) #2
  br label %29

29:                                               ; preds = %28, %25
  %30 = getelementptr inbounds i8, ptr %0, i64 168
  %.sroa.0.0.copyload.7 = load i32, ptr %30, align 4, !tbaa !5
  %31 = icmp eq i32 %.sroa.0.0.copyload.7, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  %.sroa.5.0..sroa_idx.7 = getelementptr inbounds i8, ptr %0, i64 172
  %.sroa.5.sroa.0.0.copyload.7 = load i32, ptr %.sroa.5.0..sroa_idx.7, align 4
  %.sroa.5.0.insert.ext.7 = zext i32 %.sroa.5.sroa.0.0.copyload.7 to i64
  %.sroa.5.0.insert.shift.7 = shl nuw i64 %.sroa.5.0.insert.ext.7, 32
  %.sroa.0.0.insert.ext.7 = zext i32 %.sroa.0.0.copyload.7 to i64
  %.sroa.0.0.insert.insert.7 = or disjoint i64 %.sroa.5.0.insert.shift.7, %.sroa.0.0.insert.ext.7
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.7, <2 x float> %1) #2
  br label %33

33:                                               ; preds = %32, %29
  %34 = getelementptr inbounds i8, ptr %0, i64 192
  %.sroa.0.0.copyload.8 = load i32, ptr %34, align 4, !tbaa !5
  %35 = icmp eq i32 %.sroa.0.0.copyload.8, 0
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  %.sroa.5.0..sroa_idx.8 = getelementptr inbounds i8, ptr %0, i64 196
  %.sroa.5.sroa.0.0.copyload.8 = load i32, ptr %.sroa.5.0..sroa_idx.8, align 4
  %.sroa.5.0.insert.ext.8 = zext i32 %.sroa.5.sroa.0.0.copyload.8 to i64
  %.sroa.5.0.insert.shift.8 = shl nuw i64 %.sroa.5.0.insert.ext.8, 32
  %.sroa.0.0.insert.ext.8 = zext i32 %.sroa.0.0.copyload.8 to i64
  %.sroa.0.0.insert.insert.8 = or disjoint i64 %.sroa.5.0.insert.shift.8, %.sroa.0.0.insert.ext.8
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.8, <2 x float> %1) #2
  br label %37

37:                                               ; preds = %36, %33
  %38 = getelementptr inbounds i8, ptr %0, i64 216
  %.sroa.0.0.copyload.9 = load i32, ptr %38, align 4, !tbaa !5
  %39 = icmp eq i32 %.sroa.0.0.copyload.9, 0
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  %.sroa.5.0..sroa_idx.9 = getelementptr inbounds i8, ptr %0, i64 220
  %.sroa.5.sroa.0.0.copyload.9 = load i32, ptr %.sroa.5.0..sroa_idx.9, align 4
  %.sroa.5.0.insert.ext.9 = zext i32 %.sroa.5.sroa.0.0.copyload.9 to i64
  %.sroa.5.0.insert.shift.9 = shl nuw i64 %.sroa.5.0.insert.ext.9, 32
  %.sroa.0.0.insert.ext.9 = zext i32 %.sroa.0.0.copyload.9 to i64
  %.sroa.0.0.insert.insert.9 = or disjoint i64 %.sroa.5.0.insert.shift.9, %.sroa.0.0.insert.ext.9
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.9, <2 x float> %1) #2
  br label %41

41:                                               ; preds = %40, %37
  %42 = getelementptr inbounds i8, ptr %0, i64 240
  %.sroa.0.0.copyload.10 = load i32, ptr %42, align 4, !tbaa !5
  %43 = icmp eq i32 %.sroa.0.0.copyload.10, 0
  br i1 %43, label %45, label %44

44:                                               ; preds = %41
  %.sroa.5.0..sroa_idx.10 = getelementptr inbounds i8, ptr %0, i64 244
  %.sroa.5.sroa.0.0.copyload.10 = load i32, ptr %.sroa.5.0..sroa_idx.10, align 4
  %.sroa.5.0.insert.ext.10 = zext i32 %.sroa.5.sroa.0.0.copyload.10 to i64
  %.sroa.5.0.insert.shift.10 = shl nuw i64 %.sroa.5.0.insert.ext.10, 32
  %.sroa.0.0.insert.ext.10 = zext i32 %.sroa.0.0.copyload.10 to i64
  %.sroa.0.0.insert.insert.10 = or disjoint i64 %.sroa.5.0.insert.shift.10, %.sroa.0.0.insert.ext.10
  tail call void @b2Body_SetLinearVelocity(i64 %.sroa.0.0.insert.insert.10, <2 x float> %1) #2
  br label %45

45:                                               ; preds = %44, %41
  ret void
}

declare void @b2Body_SetLinearVelocity(i64, <2 x float>) local_unnamed_addr #1

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass