; LLVM IR from HandmadeMath/HandmadeMath :: test/hmm_test.ll (Z25_hmt_test_VectorOps_CrossP21hmt_testresult_struct)

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

%union.HMM_Vec3 = type { %struct.anon.3 }
%struct.anon.3 = type { float, float, float }
%struct.hmt_testresult_struct = type { i32, i32 }

@.str.15 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [34 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 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

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { <2 x float>, float } @_ZL6HMM_V3fff(float noundef, float noundef, float noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z25_hmt_test_VectorOps_CrossP21hmt_testresult_struct(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca %union.HMM_Vec3, align 4
  %4 = alloca { <2 x float>, float }, align 8
  %5 = alloca %union.HMM_Vec3, align 4
  %6 = alloca { <2 x float>, float }, align 8
  %7 = alloca %union.HMM_Vec3, align 4
  %8 = alloca %union.HMM_Vec3, align 4
  %9 = alloca %union.HMM_Vec3, align 4
  %10 = alloca { <2 x float>, float }, align 4
  %11 = alloca { <2 x float>, float }, align 4
  %12 = alloca { <2 x float>, float }, align 8
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %3) #6
  %19 = call { <2 x float>, float } @_ZL6HMM_V3fff(float noundef 1.000000e+00, float noundef 2.000000e+00, float noundef 3.000000e+00)
  %20 = getelementptr inbounds %union.HMM_Vec3, ptr %3, i32 0, i32 0
  store { <2 x float>, float } %19, ptr %4, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 8 %4, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #6
  %21 = call { <2 x float>, float } @_ZL6HMM_V3fff(float noundef 4.000000e+00, float noundef 5.000000e+00, float noundef 6.000000e+00)
  %22 = getelementptr inbounds %union.HMM_Vec3, ptr %5, i32 0, i32 0
  store { <2 x float>, float } %21, ptr %6, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 8 %6, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %3, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %8, i64 12, i1 false)
  %23 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 0
  %24 = load <2 x float>, ptr %23, align 4
  %25 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 1
  %26 = load float, ptr %25, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %9, i64 12, i1 false)
  %27 = getelementptr inbounds { <2 x float>, float }, ptr %11, i32 0, i32 0
  %28 = load <2 x float>, ptr %27, align 4
  %29 = getelementptr inbounds { <2 x float>, float }, ptr %11, i32 0, i32 1
  %30 = load float, ptr %29, align 4
  %31 = call { <2 x float>, float } @_ZL9HMM_Cross8HMM_Vec3S_(<2 x float> %24, float %26, <2 x float> %28, float %30)
  %32 = getelementptr inbounds %union.HMM_Vec3, ptr %7, i32 0, i32 0
  store { <2 x float>, float } %31, ptr %12, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 8 %12, i64 12, i1 false)
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 4, !tbaa !11
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %37 = getelementptr inbounds %struct.anon.3, ptr %7, i32 0, i32 0
  %38 = load float, ptr %37, align 4, !tbaa !10
  store float %38, ptr %13, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %39 = load float, ptr %13, align 4, !tbaa !14
  %40 = fsub float %39, -3.000000e+00
  store float %40, ptr %14, align 4, !tbaa !14
  %41 = load float, ptr %14, align 4, !tbaa !14
  %42 = fcmp olt float %41, 0xBE80000000000000
  br i1 %42, label %46, label %43

43:                                               ; preds = %1
  %44 = load float, ptr %14, align 4, !tbaa !14
  %45 = fcmp olt float 0x3E80000000000000, %44
  br i1 %45, label %46, label %57

46:                                               ; preds = %43, %1
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 4, !tbaa !16
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %48, align 4, !tbaa !16
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef 144)
  %52 = load float, ptr %13, align 4, !tbaa !14
  %53 = fpext float %52 to double
  %54 = load float, ptr %14, align 4, !tbaa !14
  %55 = fpext float %54 to double
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef -3.000000e+00, double noundef %53, double noundef %55)
  br label %57

57:                                               ; preds = %46, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 4, !tbaa !11
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %59, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %62 = getelementptr inbounds %struct.anon.3, ptr %7, i32 0, i32 1
  %63 = load float, ptr %62, align 4, !tbaa !10
  store float %63, ptr %15, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %64 = load float, ptr %15, align 4, !tbaa !14
  %65 = fsub float %64, 6.000000e+00
  store float %65, ptr %16, align 4, !tbaa !14
  %66 = load float, ptr %16, align 4, !tbaa !14
  %67 = fcmp olt float %66, 0xBE80000000000000
  br i1 %67, label %71, label %68

68:                                               ; preds = %57
  %69 = load float, ptr %16, align 4, !tbaa !14
  %70 = fcmp olt float 0x3E80000000000000, %69
  br i1 %70, label %71, label %82

71:                                               ; preds = %68, %57
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !16
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %73, align 4, !tbaa !16
  %76 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef 145)
  %77 = load float, ptr %15, align 4, !tbaa !14
  %78 = fpext float %77 to double
  %79 = load float, ptr %16, align 4, !tbaa !14
  %80 = fpext float %79 to double
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef 6.000000e+00, double noundef %78, double noundef %80)
  br label %82

82:                                               ; preds = %71, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 4, !tbaa !11
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %84, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %87 = getelementptr inbounds %struct.anon.3, ptr %7, i32 0, i32 2
  %88 = load float, ptr %87, align 4, !tbaa !10
  store float %88, ptr %17, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %89 = load float, ptr %17, align 4, !tbaa !14
  %90 = fsub float %89, -3.000000e+00
  store float %90, ptr %18, align 4, !tbaa !14
  %91 = load float, ptr %18, align 4, !tbaa !14
  %92 = fcmp olt float %91, 0xBE80000000000000
  br i1 %92, label %96, label %93

93:                                               ; preds = %82
  %94 = load float, ptr %18, align 4, !tbaa !14
  %95 = fcmp olt float 0x3E80000000000000, %94
  br i1 %95, label %96, label %107

96:                                               ; preds = %93, %82
  %97 = load ptr, ptr %2, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %97, i32 0, i32 1
  %99 = load i32, ptr %98, align 4, !tbaa !16
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %98, align 4, !tbaa !16
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef 146)
  %102 = load float, ptr %17, align 4, !tbaa !14
  %103 = fpext float %102 to double
  %104 = load float, ptr %18, align 4, !tbaa !14
  %105 = fpext float %104 to double
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef -3.000000e+00, double noundef %103, double noundef %105)
  br label %107

107:                                              ; preds = %96, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #6
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { <2 x float>, float } @_ZL9HMM_Cross8HMM_Vec3S_(<2 x float>, float, <2 x float>, float) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint mustprogress 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 = { mustprogress 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 #5 = { inlinehint mustprogress 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i64 0, i64 12, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS21hmt_testresult_struct", !13, i64 0, !13, i64 4}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!12, !13, i64 4}


; 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.15 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { <2 x float>, float } @_ZL6HMM_V3fff(float noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z25_hmt_test_VectorOps_CrossP21hmt_testresult_struct(ptr nocapture noundef %0) local_unnamed_addr #2 {
  %2 = tail call { <2 x float>, float } @_ZL6HMM_V3fff(float noundef 1.000000e+00, float noundef 2.000000e+00, float noundef 3.000000e+00)
  %.fca.0.extract34 = extractvalue { <2 x float>, float } %2, 0
  %.fca.1.extract35 = extractvalue { <2 x float>, float } %2, 1
  %3 = tail call { <2 x float>, float } @_ZL6HMM_V3fff(float noundef 4.000000e+00, float noundef 5.000000e+00, float noundef 6.000000e+00)
  %.fca.0.extract29 = extractvalue { <2 x float>, float } %3, 0
  %.fca.1.extract30 = extractvalue { <2 x float>, float } %3, 1
  %4 = tail call { <2 x float>, float } @_ZL9HMM_Cross8HMM_Vec3S_(<2 x float> %.fca.0.extract34, float %.fca.1.extract35, <2 x float> %.fca.0.extract29, float %.fca.1.extract30)
  %.fca.0.extract = extractvalue { <2 x float>, float } %4, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %4, 1
  %5 = load i32, ptr %0, align 4, !tbaa !5
  %6 = add nsw i32 %5, 1
  store i32 %6, ptr %0, align 4, !tbaa !5
  %.sroa.028.0.vec.extract = extractelement <2 x float> %.fca.0.extract, i64 0
  %7 = fadd float %.sroa.028.0.vec.extract, 3.000000e+00
  %8 = tail call float @llvm.fabs.f32(float %7)
  %or.cond = fcmp ogt float %8, 0x3E80000000000000
  br i1 %or.cond, label %9, label %17

9:                                                ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !10
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %10, align 4, !tbaa !10
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef 144)
  %14 = fpext float %.sroa.028.0.vec.extract to double
  %15 = fpext float %7 to double
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, double noundef -3.000000e+00, double noundef %14, double noundef %15)
  %.pre = load i32, ptr %0, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %1, %9
  %18 = phi i32 [ %6, %1 ], [ %.pre, %9 ]
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %0, align 4, !tbaa !5
  %.sroa.028.4.vec.extract = extractelement <2 x float> %.fca.0.extract, i64 1
  %20 = fadd float %.sroa.028.4.vec.extract, -6.000000e+00
  %21 = tail call float @llvm.fabs.f32(float %20)
  %or.cond3 = fcmp ogt float %21, 0x3E80000000000000
  br i1 %or.cond3, label %22, label %30

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %0, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !10
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %23, align 4, !tbaa !10
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef 145)
  %27 = fpext float %.sroa.028.4.vec.extract to double
  %28 = fpext float %20 to double
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, double noundef 6.000000e+00, double noundef %27, double noundef %28)
  %.pre46 = load i32, ptr %0, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %17, %22
  %31 = phi i32 [ %19, %17 ], [ %.pre46, %22 ]
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %0, align 4, !tbaa !5
  %33 = fadd float %.fca.1.extract, 3.000000e+00
  %34 = tail call float @llvm.fabs.f32(float %33)
  %or.cond5 = fcmp ogt float %34, 0x3E80000000000000
  br i1 %or.cond5, label %35, label %43

35:                                               ; preds = %30
  %36 = getelementptr inbounds i8, ptr %0, i64 4
  %37 = load i32, ptr %36, align 4, !tbaa !10
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %36, align 4, !tbaa !10
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef 146)
  %40 = fpext float %.fca.1.extract to double
  %41 = fpext float %33 to double
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, double noundef -3.000000e+00, double noundef %40, double noundef %41)
  br label %43

43:                                               ; preds = %30, %35
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { <2 x float>, float } @_ZL9HMM_Cross8HMM_Vec3S_(<2 x float>, float, <2 x float>, float) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #4

attributes #0 = { nofree 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 = { inlinehint mustprogress 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 = { mustprogress 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 = { inlinehint mustprogress 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !7, i64 0}
!6 = !{!"_ZTS21hmt_testresult_struct", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}


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