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

; 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.RainData = type { [30 x %struct.Group], float, i32, i32, i32 }
%struct.Group = type { [2 x %struct.Human] }
%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 }
%struct.b2WorldId = type { i16, i16 }
%struct.b2Vec2 = type { float, float }

@g_rainData = external dso_local global %struct.RainData, align 4
@.str = external hidden unnamed_addr constant [61 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@__PRETTY_FUNCTION__.CreateGroup = external hidden unnamed_addr constant [38 x i8], align 1

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
define dso_local void @CreateGroup(i32 %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca %struct.b2WorldId, align 2
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca %struct.b2Vec2, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  store i32 %0, ptr %4, align 2
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 3
  br i1 %18, label %19, label %23

19:                                               ; preds = %3
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = icmp slt i32 %20, 10
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  br label %24

23:                                               ; preds = %19, %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 267, ptr noundef @__PRETTY_FUNCTION__.CreateGroup) #5
  unreachable

24:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = mul nsw i32 %25, 10
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = add nsw i32 %26, %27
  store i32 %28, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %29 = load i32, ptr getelementptr inbounds (%struct.RainData, ptr @g_rainData, i32 0, i32 2), align 4, !tbaa !9
  %30 = sitofp i32 %29 to float
  %31 = load float, ptr getelementptr inbounds (%struct.RainData, ptr @g_rainData, i32 0, i32 1), align 4, !tbaa !12
  %32 = fmul float %30, %31
  store float %32, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %33 = load float, ptr %8, align 4, !tbaa !13
  %34 = fmul float 1.000000e+00, %33
  %35 = fdiv float %34, 1.000000e+01
  store float %35, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %36 = load float, ptr %8, align 4, !tbaa !13
  %37 = load float, ptr %9, align 4, !tbaa !13
  %38 = load i32, ptr %6, align 4, !tbaa !5
  %39 = sitofp i32 %38 to float
  %40 = fadd float %39, 5.000000e-01
  %41 = fmul float %37, %40
  %42 = call float @llvm.fmuladd.f32(float -5.000000e-01, float %36, float %41)
  %43 = getelementptr inbounds %struct.b2Vec2, ptr %10, i32 0, i32 0
  store float %42, ptr %43, align 4, !tbaa !14
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = sitofp i32 %44 to float
  %46 = call float @llvm.fmuladd.f32(float 4.500000e+01, float %45, float 4.000000e+01)
  %47 = getelementptr inbounds %struct.b2Vec2, ptr %10, i32 0, i32 1
  store float %46, ptr %47, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store float 1.000000e+00, ptr %11, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store float 0x3FA99999A0000000, ptr %12, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store float 5.000000e+00, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store float 5.000000e-01, ptr %14, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %73, %24
  %49 = load i32, ptr %15, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 2
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %76

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [30 x %struct.Group], ptr @g_rainData, i64 0, i64 %54
  %56 = getelementptr inbounds %struct.Group, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds [2 x %struct.Human], ptr %56, i64 0, i64 0
  %58 = load i32, ptr %15, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds %struct.Human, ptr %57, i64 %59
  store ptr %60, ptr %16, align 8, !tbaa !17
  %61 = load ptr, ptr %16, align 8, !tbaa !17
  %62 = load float, ptr %11, align 4, !tbaa !13
  %63 = load float, ptr %12, align 4, !tbaa !13
  %64 = load float, ptr %13, align 4, !tbaa !13
  %65 = load float, ptr %14, align 4, !tbaa !13
  %66 = load i32, ptr %15, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  %68 = load i32, ptr %4, align 2
  %69 = load <2 x float>, ptr %10, align 4
  call void @CreateHuman(ptr noundef %61, i32 %68, <2 x float> %69, float noundef %62, float noundef %63, float noundef %64, float noundef %65, i32 noundef %67, ptr noundef null, i1 noundef zeroext false)
  %70 = getelementptr inbounds %struct.b2Vec2, ptr %10, i32 0, i32 0
  %71 = load float, ptr %70, align 4, !tbaa !14
  %72 = fadd float %71, 5.000000e-01
  store float %72, ptr %70, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %73

73:                                               ; preds = %52
  %74 = load i32, ptr %15, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %15, align 4, !tbaa !5
  br label %48, !llvm.loop !19

76:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret void
}

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

declare void @CreateHuman(ptr noundef, i32, <2 x float>, float noundef, float noundef, float noundef, float noundef, i32 noundef, ptr noundef, i1 noundef zeroext) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #4 = { "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 = { noreturn nounwind }
attributes #6 = { 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"}
!9 = !{!10, !6, i64 16324}
!10 = !{!"RainData", !7, i64 0, !11, i64 16320, !6, i64 16324, !6, i64 16328, !6, i64 16332}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 16320}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !11, i64 0}
!15 = !{!"b2Vec2", !11, i64 0, !11, i64 4}
!16 = !{!15, !11, i64 4}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"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"

%struct.RainData = type { [30 x %struct.Group], float, i32, i32, i32 }
%struct.Group = type { [2 x %struct.Human] }
%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 }

@g_rainData = external dso_local global %struct.RainData, align 4
@.str = external hidden unnamed_addr constant [61 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@__PRETTY_FUNCTION__.CreateGroup = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @CreateGroup(i32 %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp slt i32 %1, 3
  %5 = icmp slt i32 %2, 10
  %or.cond = and i1 %4, %5
  br i1 %or.cond, label %7, label %6

6:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 267, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateGroup) #4
  unreachable

7:                                                ; preds = %3
  %8 = mul nsw i32 %1, 10
  %9 = add nsw i32 %8, %2
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @g_rainData, i64 16324), align 4, !tbaa !5
  %11 = sitofp i32 %10 to float
  %12 = load float, ptr getelementptr inbounds (i8, ptr @g_rainData, i64 16320), align 4, !tbaa !11
  %13 = fmul float %12, %11
  %14 = fdiv float %13, 1.000000e+01
  %15 = sitofp i32 %2 to float
  %16 = fadd float %15, 5.000000e-01
  %17 = fmul float %16, %14
  %18 = sitofp i32 %1 to float
  %19 = insertelement <2 x float> poison, float %13, i64 0
  %20 = insertelement <2 x float> %19, float %18, i64 1
  %21 = insertelement <2 x float> <float poison, float 4.000000e+01>, float %17, i64 0
  %22 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %20, <2 x float> <float -5.000000e-01, float 4.500000e+01>, <2 x float> %21)
  %23 = sext i32 %9 to i64
  %24 = getelementptr inbounds [30 x %struct.Group], ptr @g_rainData, i64 0, i64 %23
  tail call void @CreateHuman(ptr noundef nonnull %24, i32 %0, <2 x float> %22, float noundef 1.000000e+00, float noundef 0x3FA99999A0000000, float noundef 5.000000e+00, float noundef 5.000000e-01, i32 noundef 1, ptr noundef null, i1 noundef zeroext false) #5
  %25 = extractelement <2 x float> %22, i64 0
  %26 = fadd float %25, 5.000000e-01
  %.sroa.0.0.vec.insert12 = insertelement <2 x float> %22, float %26, i64 0
  %27 = getelementptr inbounds i8, ptr %24, i64 272
  tail call void @CreateHuman(ptr noundef nonnull %27, i32 %0, <2 x float> %.sroa.0.0.vec.insert12, float noundef 1.000000e+00, float noundef 0x3FA99999A0000000, float noundef 5.000000e+00, float noundef 5.000000e-01, i32 noundef 2, ptr noundef null, i1 noundef zeroext false) #5
  ret void
}

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

declare void @CreateHuman(ptr noundef, i32, <2 x float>, float noundef, float noundef, float noundef, float noundef, i32 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #3

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 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 16324}
!6 = !{!"RainData", !7, i64 0, !9, i64 16320, !10, i64 16324, !10, i64 16328, !10, i64 16332}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"float", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!6, !9, i64 16320}


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