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

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__.Human_SetJointSpringHertz = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local void @Human_SetJointSpringHertz(ptr noundef %0, float noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.Human, ptr %7, i32 0, i32 2
  %9 = load i8, ptr %8, align 4, !tbaa !11, !range !14, !noundef !15
  %10 = trunc i8 %9 to i1
  %11 = zext i1 %10 to i32
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %14

13:                                               ; preds = %2
  br label %15

14:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 584, ptr noundef @__PRETTY_FUNCTION__.Human_SetJointSpringHertz) #4
  unreachable

15:                                               ; preds = %13
  %16 = load float, ptr %4, align 4, !tbaa !9
  %17 = fcmp oeq float %16, 0.000000e+00
  br i1 %17, label %18, label %35

18:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !16
  br label %19

19:                                               ; preds = %31, %18
  %20 = load i32, ptr %5, align 4, !tbaa !16
  %21 = icmp slt i32 %20, 11
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %34

23:                                               ; preds = %19
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.Human, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %5, align 4, !tbaa !16
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [11 x %struct.Bone], ptr %25, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.Bone, ptr %28, i32 0, i32 1
  %30 = load i64, ptr %29, align 4
  call void @b2RevoluteJoint_EnableSpring(i64 %30, i1 noundef zeroext false)
  br label %31

31:                                               ; preds = %23
  %32 = load i32, ptr %5, align 4, !tbaa !16
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %5, align 4, !tbaa !16
  br label %19, !llvm.loop !18

34:                                               ; preds = %22
  br label %60

35:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !16
  br label %36

36:                                               ; preds = %56, %35
  %37 = load i32, ptr %6, align 4, !tbaa !16
  %38 = icmp slt i32 %37, 11
  br i1 %38, label %40, label %39

39:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %59

40:                                               ; preds = %36
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.Human, ptr %41, i32 0, i32 0
  %43 = load i32, ptr %6, align 4, !tbaa !16
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [11 x %struct.Bone], ptr %42, i64 0, i64 %44
  %46 = getelementptr inbounds %struct.Bone, ptr %45, i32 0, i32 1
  %47 = load i64, ptr %46, align 4
  call void @b2RevoluteJoint_EnableSpring(i64 %47, i1 noundef zeroext true)
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.Human, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %6, align 4, !tbaa !16
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [11 x %struct.Bone], ptr %49, i64 0, i64 %51
  %53 = getelementptr inbounds %struct.Bone, ptr %52, i32 0, i32 1
  %54 = load float, ptr %4, align 4, !tbaa !9
  %55 = load i64, ptr %53, align 4
  call void @b2RevoluteJoint_SetSpringHertz(i64 %55, float noundef %54)
  br label %56

56:                                               ; preds = %40
  %57 = load i32, ptr %6, align 4, !tbaa !16
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %6, align 4, !tbaa !16
  br label %36, !llvm.loop !20

59:                                               ; preds = %39
  br label %60

60:                                               ; preds = %59, %34
  ret void
}

declare void @b2RevoluteJoint_EnableSpring(i64, i1 noundef zeroext) #3

declare void @b2RevoluteJoint_SetSpringHertz(i64, float noundef) #3

attributes #0 = { noreturn 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { noreturn nounwind }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !13, i64 268}
!12 = !{!"Human", !7, i64 0, !10, i64 264, !13, i64 268}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


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

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__.Human_SetJointSpringHertz = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @Human_SetJointSpringHertz(ptr nocapture noundef readonly %0, float noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 268
  %4 = load i8, ptr %3, align 4, !tbaa !5, !range !11, !noundef !12
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %7, label %6

6:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 584, ptr noundef nonnull @__PRETTY_FUNCTION__.Human_SetJointSpringHertz) #3
  unreachable

7:                                                ; preds = %2
  %8 = fcmp oeq float %1, 0.000000e+00
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load i64, ptr %9, align 4
  br i1 %8, label %.preheader.preheader, label %.preheader14.preheader

.preheader14.preheader:                           ; preds = %7
  tail call void @b2RevoluteJoint_EnableSpring(i64 %10, i1 noundef zeroext true) #4
  %11 = load i64, ptr %9, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %11, float noundef %1) #4
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  %13 = load i64, ptr %12, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %13, i1 noundef zeroext true) #4
  %14 = load i64, ptr %12, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %14, float noundef %1) #4
  %15 = getelementptr inbounds i8, ptr %0, i64 80
  %16 = load i64, ptr %15, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %16, i1 noundef zeroext true) #4
  %17 = load i64, ptr %15, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %17, float noundef %1) #4
  %18 = getelementptr inbounds i8, ptr %0, i64 104
  %19 = load i64, ptr %18, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %19, i1 noundef zeroext true) #4
  %20 = load i64, ptr %18, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %20, float noundef %1) #4
  %21 = getelementptr inbounds i8, ptr %0, i64 128
  %22 = load i64, ptr %21, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %22, i1 noundef zeroext true) #4
  %23 = load i64, ptr %21, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %23, float noundef %1) #4
  %24 = getelementptr inbounds i8, ptr %0, i64 152
  %25 = load i64, ptr %24, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %25, i1 noundef zeroext true) #4
  %26 = load i64, ptr %24, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %26, float noundef %1) #4
  %27 = getelementptr inbounds i8, ptr %0, i64 176
  %28 = load i64, ptr %27, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %28, i1 noundef zeroext true) #4
  %29 = load i64, ptr %27, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %29, float noundef %1) #4
  %30 = getelementptr inbounds i8, ptr %0, i64 200
  %31 = load i64, ptr %30, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %31, i1 noundef zeroext true) #4
  %32 = load i64, ptr %30, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %32, float noundef %1) #4
  %33 = getelementptr inbounds i8, ptr %0, i64 224
  %34 = load i64, ptr %33, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %34, i1 noundef zeroext true) #4
  %35 = load i64, ptr %33, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %35, float noundef %1) #4
  %36 = getelementptr inbounds i8, ptr %0, i64 248
  %37 = load i64, ptr %36, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %37, i1 noundef zeroext true) #4
  %38 = load i64, ptr %36, align 4
  tail call void @b2RevoluteJoint_SetSpringHertz(i64 %38, float noundef %1) #4
  br label %.loopexit

.preheader.preheader:                             ; preds = %7
  tail call void @b2RevoluteJoint_EnableSpring(i64 %10, i1 noundef zeroext false) #4
  %39 = getelementptr inbounds i8, ptr %0, i64 56
  %40 = load i64, ptr %39, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %40, i1 noundef zeroext false) #4
  %41 = getelementptr inbounds i8, ptr %0, i64 80
  %42 = load i64, ptr %41, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %42, i1 noundef zeroext false) #4
  %43 = getelementptr inbounds i8, ptr %0, i64 104
  %44 = load i64, ptr %43, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %44, i1 noundef zeroext false) #4
  %45 = getelementptr inbounds i8, ptr %0, i64 128
  %46 = load i64, ptr %45, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %46, i1 noundef zeroext false) #4
  %47 = getelementptr inbounds i8, ptr %0, i64 152
  %48 = load i64, ptr %47, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %48, i1 noundef zeroext false) #4
  %49 = getelementptr inbounds i8, ptr %0, i64 176
  %50 = load i64, ptr %49, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %50, i1 noundef zeroext false) #4
  %51 = getelementptr inbounds i8, ptr %0, i64 200
  %52 = load i64, ptr %51, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %52, i1 noundef zeroext false) #4
  %53 = getelementptr inbounds i8, ptr %0, i64 224
  %54 = load i64, ptr %53, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %54, i1 noundef zeroext false) #4
  %55 = getelementptr inbounds i8, ptr %0, i64 248
  %56 = load i64, ptr %55, align 4
  tail call void @b2RevoluteJoint_EnableSpring(i64 %56, i1 noundef zeroext false) #4
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader14.preheader, %.preheader.preheader
  ret void
}

declare void @b2RevoluteJoint_EnableSpring(i64, i1 noundef zeroext) local_unnamed_addr #2

declare void @b2RevoluteJoint_SetSpringHertz(i64, float noundef) local_unnamed_addr #2

attributes #0 = { noreturn 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 = { 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 = { "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 = { noreturn nounwind }
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, !10, i64 268}
!6 = !{!"Human", !7, i64 0, !9, i64 264, !10, i64 268}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"float", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


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