; LLVM IR from erincatto/box2d :: src (geometry)

; 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.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [50 x i8], align 1
@b2Vec2_zero = external hidden constant %struct.b2Vec2, align 4

declare zeroext i1 @b2IsValidFloat(float noundef) #0

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; 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) #3

; Function Attrs: nounwind uwtable
define dso_local void @b2MakeBox(ptr dead_on_unwind noalias writable sret(%struct.b2Polygon) align 4 %0, float noundef %1, float noundef %2) #4 {
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca %struct.b2Vec2, align 4
  %7 = alloca %struct.b2Vec2, align 4
  %8 = alloca %struct.b2Vec2, align 4
  %9 = alloca %struct.b2Vec2, align 4
  %10 = alloca %struct.b2Vec2, align 4
  %11 = alloca %struct.b2Vec2, align 4
  %12 = alloca %struct.b2Vec2, align 4
  %13 = alloca %struct.b2Vec2, align 4
  store float %1, ptr %4, align 4, !tbaa !5
  store float %2, ptr %5, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %3
  %15 = load float, ptr %4, align 4, !tbaa !5
  %16 = call zeroext i1 @b2IsValidFloat(float noundef %15)
  br i1 %16, label %17, label %20

17:                                               ; preds = %14
  %18 = load float, ptr %4, align 4, !tbaa !5
  %19 = fcmp ogt float %18, 0.000000e+00
  br i1 %19, label %24, label %20

20:                                               ; preds = %17, %14
  %21 = call i32 @b2InternalAssertFcn(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 140)
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  call void @llvm.trap()
  br label %24

24:                                               ; preds = %23, %20, %17
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %27 = load float, ptr %5, align 4, !tbaa !5
  %28 = call zeroext i1 @b2IsValidFloat(float noundef %27)
  br i1 %28, label %29, label %32

29:                                               ; preds = %26
  %30 = load float, ptr %5, align 4, !tbaa !5
  %31 = fcmp ogt float %30, 0.000000e+00
  br i1 %31, label %36, label %32

32:                                               ; preds = %29, %26
  %33 = call i32 @b2InternalAssertFcn(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 141)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  call void @llvm.trap()
  br label %36

36:                                               ; preds = %35, %32, %29
  br label %37

37:                                               ; preds = %36
  call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 144, i1 false)
  %38 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 4
  store i32 4, ptr %38, align 4, !tbaa !9
  %39 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %40 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %39, i64 0, i64 0
  %41 = getelementptr inbounds %struct.b2Vec2, ptr %6, i32 0, i32 0
  %42 = load float, ptr %4, align 4, !tbaa !5
  %43 = fneg float %42
  store float %43, ptr %41, align 4, !tbaa !13
  %44 = getelementptr inbounds %struct.b2Vec2, ptr %6, i32 0, i32 1
  %45 = load float, ptr %5, align 4, !tbaa !5
  %46 = fneg float %45
  store float %46, ptr %44, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !15
  %47 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %48 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %47, i64 0, i64 1
  %49 = getelementptr inbounds %struct.b2Vec2, ptr %7, i32 0, i32 0
  %50 = load float, ptr %4, align 4, !tbaa !5
  store float %50, ptr %49, align 4, !tbaa !13
  %51 = getelementptr inbounds %struct.b2Vec2, ptr %7, i32 0, i32 1
  %52 = load float, ptr %5, align 4, !tbaa !5
  %53 = fneg float %52
  store float %53, ptr %51, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !15
  %54 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %55 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %54, i64 0, i64 2
  %56 = getelementptr inbounds %struct.b2Vec2, ptr %8, i32 0, i32 0
  %57 = load float, ptr %4, align 4, !tbaa !5
  store float %57, ptr %56, align 4, !tbaa !13
  %58 = getelementptr inbounds %struct.b2Vec2, ptr %8, i32 0, i32 1
  %59 = load float, ptr %5, align 4, !tbaa !5
  store float %59, ptr %58, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %55, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !15
  %60 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %61 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %60, i64 0, i64 3
  %62 = getelementptr inbounds %struct.b2Vec2, ptr %9, i32 0, i32 0
  %63 = load float, ptr %4, align 4, !tbaa !5
  %64 = fneg float %63
  store float %64, ptr %62, align 4, !tbaa !13
  %65 = getelementptr inbounds %struct.b2Vec2, ptr %9, i32 0, i32 1
  %66 = load float, ptr %5, align 4, !tbaa !5
  store float %66, ptr %65, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %61, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !15
  %67 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %68 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %67, i64 0, i64 0
  %69 = getelementptr inbounds %struct.b2Vec2, ptr %10, i32 0, i32 0
  store float 0.000000e+00, ptr %69, align 4, !tbaa !13
  %70 = getelementptr inbounds %struct.b2Vec2, ptr %10, i32 0, i32 1
  store float -1.000000e+00, ptr %70, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %68, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !15
  %71 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %72 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %71, i64 0, i64 1
  %73 = getelementptr inbounds %struct.b2Vec2, ptr %11, i32 0, i32 0
  store float 1.000000e+00, ptr %73, align 4, !tbaa !13
  %74 = getelementptr inbounds %struct.b2Vec2, ptr %11, i32 0, i32 1
  store float 0.000000e+00, ptr %74, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %72, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !15
  %75 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %76 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %75, i64 0, i64 2
  %77 = getelementptr inbounds %struct.b2Vec2, ptr %12, i32 0, i32 0
  store float 0.000000e+00, ptr %77, align 4, !tbaa !13
  %78 = getelementptr inbounds %struct.b2Vec2, ptr %12, i32 0, i32 1
  store float 1.000000e+00, ptr %78, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %76, ptr align 4 %12, i64 8, i1 false), !tbaa.struct !15
  %79 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %80 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %79, i64 0, i64 3
  %81 = getelementptr inbounds %struct.b2Vec2, ptr %13, i32 0, i32 0
  store float -1.000000e+00, ptr %81, align 4, !tbaa !13
  %82 = getelementptr inbounds %struct.b2Vec2, ptr %13, i32 0, i32 1
  store float 0.000000e+00, ptr %82, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %80, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !15
  %83 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 3
  store float 0.000000e+00, ptr %83, align 4, !tbaa !16
  %84 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %84, ptr align 4 @b2Vec2_zero, i64 8, i1 false), !tbaa.struct !15
  ret void
}

attributes #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 #1 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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" }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 140}
!10 = !{!"b2Polygon", !7, i64 0, !7, i64 64, !11, i64 128, !6, i64 136, !12, i64 140}
!11 = !{!"b2Vec2", !6, i64 0, !6, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!11, !6, i64 0}
!14 = !{!11, !6, i64 4}
!15 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!16 = !{!10, !6, i64 136}


; 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.b2Vec2 = type { float, float }
%struct.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [50 x i8], align 1
@b2Vec2_zero = external hidden local_unnamed_addr constant %struct.b2Vec2, align 4

declare zeroext i1 @b2IsValidFloat(float noundef) local_unnamed_addr #0

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
define dso_local void @b2MakeBox(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.b2Polygon) align 4 %0, float noundef %1, float noundef %2) local_unnamed_addr #3 {
  %4 = tail call zeroext i1 @b2IsValidFloat(float noundef %1) #4
  %5 = fcmp ogt float %1, 0.000000e+00
  %or.cond = and i1 %5, %4
  br i1 %or.cond, label %9, label %6

6:                                                ; preds = %3
  %7 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 140) #4
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %9, label %8

8:                                                ; preds = %6
  tail call void @llvm.trap()
  unreachable

9:                                                ; preds = %3, %6
  %10 = tail call zeroext i1 @b2IsValidFloat(float noundef %2) #4
  %11 = fcmp ogt float %2, 0.000000e+00
  %or.cond3 = and i1 %11, %10
  br i1 %or.cond3, label %15, label %12

12:                                               ; preds = %9
  %13 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 141) #4
  %.not29 = icmp eq i32 %13, 0
  br i1 %.not29, label %15, label %14

14:                                               ; preds = %12
  tail call void @llvm.trap()
  unreachable

15:                                               ; preds = %12, %9
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(144) %16, i8 0, i64 96, i1 false)
  %17 = getelementptr inbounds i8, ptr %0, i64 140
  store i32 4, ptr %17, align 4, !tbaa !5
  %18 = fneg float %1
  %19 = fneg float %2
  store float %18, ptr %0, align 4, !tbaa !12
  %.sroa.217.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 4
  store float %19, ptr %.sroa.217.0..sroa_idx, align 4, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  store float %1, ptr %20, align 4, !tbaa !12
  %.sroa.215.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 12
  store float %19, ptr %.sroa.215.0..sroa_idx, align 4, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  store float %1, ptr %21, align 4, !tbaa !12
  %.sroa.213.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 20
  store float %2, ptr %.sroa.213.0..sroa_idx, align 4, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  store float %18, ptr %22, align 4, !tbaa !12
  %.sroa.211.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 28
  store float %2, ptr %.sroa.211.0..sroa_idx, align 4, !tbaa !12
  %.sroa.29.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 68
  store <2 x float> <float -1.000000e+00, float 1.000000e+00>, ptr %.sroa.29.0..sroa_idx, align 4, !tbaa !12
  %23 = getelementptr inbounds i8, ptr %0, i64 80
  store <2 x float> <float 0.000000e+00, float 1.000000e+00>, ptr %23, align 4, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %0, i64 88
  store float -1.000000e+00, ptr %24, align 4, !tbaa !12
  %25 = getelementptr inbounds i8, ptr %0, i64 136
  store float 0.000000e+00, ptr %25, align 4, !tbaa !13
  %26 = getelementptr inbounds i8, ptr %0, i64 128
  %27 = load i64, ptr @b2Vec2_zero, align 4
  store i64 %27, ptr %26, align 4
  ret void
}

attributes #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 #1 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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, !11, i64 140}
!6 = !{!"b2Polygon", !7, i64 0, !7, i64 64, !9, i64 128, !10, i64 136, !11, i64 140}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"b2Vec2", !10, i64 0, !10, i64 4}
!10 = !{!"float", !7, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !10, i64 0}
!13 = !{!6, !10, i64 136}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass