; 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_SetJointFrictionTorque = external hidden unnamed_addr constant [50 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_SetJointFrictionTorque(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
  %7 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.Human, ptr %8, i32 0, i32 2
  %10 = load i8, ptr %9, align 4, !tbaa !11, !range !14, !noundef !15
  %11 = trunc i8 %10 to i1
  %12 = zext i1 %11 to i32
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  br label %16

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

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

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

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

23:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %35

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

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

35:                                               ; preds = %23
  br label %74

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

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

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

41:                                               ; preds = %37
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.Human, ptr %42, i32 0, i32 0
  %44 = load i32, ptr %6, align 4, !tbaa !16
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [11 x %struct.Bone], ptr %43, i64 0, i64 %45
  %47 = getelementptr inbounds %struct.Bone, ptr %46, i32 0, i32 1
  %48 = load i64, ptr %47, align 4
  call void @b2RevoluteJoint_EnableMotor(i64 %48, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.Human, ptr %49, i32 0, i32 1
  %51 = load float, ptr %50, align 4, !tbaa !20
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.Human, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %6, align 4, !tbaa !16
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [11 x %struct.Bone], ptr %53, i64 0, i64 %55
  %57 = getelementptr inbounds %struct.Bone, ptr %56, i32 0, i32 2
  %58 = load float, ptr %57, align 4, !tbaa !21
  %59 = fmul float %51, %58
  store float %59, ptr %7, align 4, !tbaa !9
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Human, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %6, align 4, !tbaa !16
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [11 x %struct.Bone], ptr %61, i64 0, i64 %63
  %65 = getelementptr inbounds %struct.Bone, ptr %64, i32 0, i32 1
  %66 = load float, ptr %7, align 4, !tbaa !9
  %67 = load float, ptr %4, align 4, !tbaa !9
  %68 = fmul float %66, %67
  %69 = load i64, ptr %65, align 4
  call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %69, float noundef %68)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %70

70:                                               ; preds = %41
  %71 = load i32, ptr %6, align 4, !tbaa !16
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %6, align 4, !tbaa !16
  br label %37, !llvm.loop !26

73:                                               ; preds = %40
  br label %74

74:                                               ; preds = %73, %35
  ret void
}

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

declare void @b2RevoluteJoint_SetMaxMotorTorque(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 = !{!12, !10, i64 264}
!21 = !{!22, !10, i64 16}
!22 = !{!"Bone", !23, i64 0, !25, i64 8, !10, i64 16, !17, i64 20}
!23 = !{!"b2BodyId", !17, i64 0, !24, i64 4, !24, i64 6}
!24 = !{!"short", !7, i64 0}
!25 = !{!"b2JointId", !17, i64 0, !24, i64 4, !24, i64 6}
!26 = distinct !{!26, !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_SetJointFrictionTorque = external hidden unnamed_addr constant [50 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_SetJointFrictionTorque(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 563, ptr noundef nonnull @__PRETTY_FUNCTION__.Human_SetJointFrictionTorque) #3
  unreachable

7:                                                ; preds = %2
  %8 = fcmp oeq float %1, 0.000000e+00
  br i1 %8, label %.preheader.preheader, label %.preheader18

.preheader.preheader:                             ; preds = %7
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load i64, ptr %9, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %10, i1 noundef zeroext false) #4
  %11 = getelementptr inbounds i8, ptr %0, i64 56
  %12 = load i64, ptr %11, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %12, i1 noundef zeroext false) #4
  %13 = getelementptr inbounds i8, ptr %0, i64 80
  %14 = load i64, ptr %13, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %14, i1 noundef zeroext false) #4
  %15 = getelementptr inbounds i8, ptr %0, i64 104
  %16 = load i64, ptr %15, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %16, i1 noundef zeroext false) #4
  %17 = getelementptr inbounds i8, ptr %0, i64 128
  %18 = load i64, ptr %17, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %18, i1 noundef zeroext false) #4
  %19 = getelementptr inbounds i8, ptr %0, i64 152
  %20 = load i64, ptr %19, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %20, i1 noundef zeroext false) #4
  %21 = getelementptr inbounds i8, ptr %0, i64 176
  %22 = load i64, ptr %21, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %22, i1 noundef zeroext false) #4
  %23 = getelementptr inbounds i8, ptr %0, i64 200
  %24 = load i64, ptr %23, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %24, i1 noundef zeroext false) #4
  %25 = getelementptr inbounds i8, ptr %0, i64 224
  %26 = load i64, ptr %25, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %26, i1 noundef zeroext false) #4
  %27 = getelementptr inbounds i8, ptr %0, i64 248
  %28 = load i64, ptr %27, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %28, i1 noundef zeroext false) #4
  br label %.loopexit

.preheader18:                                     ; preds = %7
  %29 = getelementptr inbounds i8, ptr %0, i64 264
  %30 = getelementptr inbounds i8, ptr %0, i64 32
  %31 = load i64, ptr %30, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %31, i1 noundef zeroext true) #4
  %32 = load float, ptr %29, align 4, !tbaa !13
  %33 = getelementptr inbounds i8, ptr %0, i64 40
  %34 = load float, ptr %33, align 4, !tbaa !14
  %35 = fmul float %32, %34
  %36 = fmul float %35, %1
  %37 = load i64, ptr %30, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %37, float noundef %36) #4
  %38 = getelementptr inbounds i8, ptr %0, i64 56
  %39 = load i64, ptr %38, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %39, i1 noundef zeroext true) #4
  %40 = load float, ptr %29, align 4, !tbaa !13
  %41 = getelementptr inbounds i8, ptr %0, i64 64
  %42 = load float, ptr %41, align 4, !tbaa !14
  %43 = fmul float %40, %42
  %44 = fmul float %43, %1
  %45 = load i64, ptr %38, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %45, float noundef %44) #4
  %46 = getelementptr inbounds i8, ptr %0, i64 80
  %47 = load i64, ptr %46, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %47, i1 noundef zeroext true) #4
  %48 = load float, ptr %29, align 4, !tbaa !13
  %49 = getelementptr inbounds i8, ptr %0, i64 88
  %50 = load float, ptr %49, align 4, !tbaa !14
  %51 = fmul float %48, %50
  %52 = fmul float %51, %1
  %53 = load i64, ptr %46, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %53, float noundef %52) #4
  %54 = getelementptr inbounds i8, ptr %0, i64 104
  %55 = load i64, ptr %54, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %55, i1 noundef zeroext true) #4
  %56 = load float, ptr %29, align 4, !tbaa !13
  %57 = getelementptr inbounds i8, ptr %0, i64 112
  %58 = load float, ptr %57, align 4, !tbaa !14
  %59 = fmul float %56, %58
  %60 = fmul float %59, %1
  %61 = load i64, ptr %54, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %61, float noundef %60) #4
  %62 = getelementptr inbounds i8, ptr %0, i64 128
  %63 = load i64, ptr %62, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %63, i1 noundef zeroext true) #4
  %64 = load float, ptr %29, align 4, !tbaa !13
  %65 = getelementptr inbounds i8, ptr %0, i64 136
  %66 = load float, ptr %65, align 4, !tbaa !14
  %67 = fmul float %64, %66
  %68 = fmul float %67, %1
  %69 = load i64, ptr %62, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %69, float noundef %68) #4
  %70 = getelementptr inbounds i8, ptr %0, i64 152
  %71 = load i64, ptr %70, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %71, i1 noundef zeroext true) #4
  %72 = load float, ptr %29, align 4, !tbaa !13
  %73 = getelementptr inbounds i8, ptr %0, i64 160
  %74 = load float, ptr %73, align 4, !tbaa !14
  %75 = fmul float %72, %74
  %76 = fmul float %75, %1
  %77 = load i64, ptr %70, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %77, float noundef %76) #4
  %78 = getelementptr inbounds i8, ptr %0, i64 176
  %79 = load i64, ptr %78, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %79, i1 noundef zeroext true) #4
  %80 = load float, ptr %29, align 4, !tbaa !13
  %81 = getelementptr inbounds i8, ptr %0, i64 184
  %82 = load float, ptr %81, align 4, !tbaa !14
  %83 = fmul float %80, %82
  %84 = fmul float %83, %1
  %85 = load i64, ptr %78, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %85, float noundef %84) #4
  %86 = getelementptr inbounds i8, ptr %0, i64 200
  %87 = load i64, ptr %86, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %87, i1 noundef zeroext true) #4
  %88 = load float, ptr %29, align 4, !tbaa !13
  %89 = getelementptr inbounds i8, ptr %0, i64 208
  %90 = load float, ptr %89, align 4, !tbaa !14
  %91 = fmul float %88, %90
  %92 = fmul float %91, %1
  %93 = load i64, ptr %86, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %93, float noundef %92) #4
  %94 = getelementptr inbounds i8, ptr %0, i64 224
  %95 = load i64, ptr %94, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %95, i1 noundef zeroext true) #4
  %96 = load float, ptr %29, align 4, !tbaa !13
  %97 = getelementptr inbounds i8, ptr %0, i64 232
  %98 = load float, ptr %97, align 4, !tbaa !14
  %99 = fmul float %96, %98
  %100 = fmul float %99, %1
  %101 = load i64, ptr %94, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %101, float noundef %100) #4
  %102 = getelementptr inbounds i8, ptr %0, i64 248
  %103 = load i64, ptr %102, align 4
  tail call void @b2RevoluteJoint_EnableMotor(i64 %103, i1 noundef zeroext true) #4
  %104 = load float, ptr %29, align 4, !tbaa !13
  %105 = getelementptr inbounds i8, ptr %0, i64 256
  %106 = load float, ptr %105, align 4, !tbaa !14
  %107 = fmul float %104, %106
  %108 = fmul float %107, %1
  %109 = load i64, ptr %102, align 4
  tail call void @b2RevoluteJoint_SetMaxMotorTorque(i64 %109, float noundef %108) #4
  br label %.loopexit

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

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

declare void @b2RevoluteJoint_SetMaxMotorTorque(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 = !{}
!13 = !{!6, !9, i64 264}
!14 = !{!15, !9, i64 16}
!15 = !{!"Bone", !16, i64 0, !19, i64 8, !9, i64 16, !17, i64 20}
!16 = !{!"b2BodyId", !17, i64 0, !18, i64 4, !18, i64 6}
!17 = !{!"int", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!"b2JointId", !17, i64 0, !18, i64 4, !18, i64 6}


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