; LLVM IR from HandmadeMath/HandmadeMath :: test/hmm_test.ll (Z25_hmt_test_UnaryMinus_Vec3P21hmt_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
@__const._Z25_hmt_test_UnaryMinus_Vec3P21hmt_testresult_struct.VectorOne = external hidden unnamed_addr constant %union.HMM_Vec3, align 4

; 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: mustprogress uwtable
define dso_local void @_Z25_hmt_test_UnaryMinus_Vec3P21hmt_testresult_struct(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca %union.HMM_Vec3, align 4
  %4 = alloca %union.HMM_Vec3, align 4
  %5 = alloca %union.HMM_Vec3, align 4
  %6 = alloca { <2 x float>, float }, align 4
  %7 = alloca { <2 x float>, float }, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %3) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 @__const._Z25_hmt_test_UnaryMinus_Vec3P21hmt_testresult_struct.VectorOne, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %3, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %5, i64 12, i1 false)
  %14 = getelementptr inbounds { <2 x float>, float }, ptr %6, i32 0, i32 0
  %15 = load <2 x float>, ptr %14, align 4
  %16 = getelementptr inbounds { <2 x float>, float }, ptr %6, i32 0, i32 1
  %17 = load float, ptr %16, align 4
  %18 = call { <2 x float>, float } @_Zng8HMM_Vec3(<2 x float> %15, float %17)
  %19 = getelementptr inbounds %union.HMM_Vec3, ptr %4, i32 0, i32 0
  store { <2 x float>, float } %18, ptr %7, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 8 %7, i64 12, i1 false)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %21, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %24 = getelementptr inbounds %struct.anon.3, ptr %4, i32 0, i32 0
  %25 = load float, ptr %24, align 4, !tbaa !10
  store float %25, ptr %8, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %26 = load float, ptr %8, align 4, !tbaa !14
  %27 = fsub float %26, -1.000000e+00
  store float %27, ptr %9, align 4, !tbaa !14
  %28 = load float, ptr %9, align 4, !tbaa !14
  %29 = fcmp olt float %28, 0xBE80000000000000
  br i1 %29, label %33, label %30

30:                                               ; preds = %1
  %31 = load float, ptr %9, align 4, !tbaa !14
  %32 = fcmp olt float 0x3E80000000000000, %31
  br i1 %32, label %33, label %44

33:                                               ; preds = %30, %1
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 4, !tbaa !16
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %35, align 4, !tbaa !16
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef 343)
  %39 = load float, ptr %8, align 4, !tbaa !14
  %40 = fpext float %39 to double
  %41 = load float, ptr %9, align 4, !tbaa !14
  %42 = fpext float %41 to double
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef -1.000000e+00, double noundef %40, double noundef %42)
  br label %44

44:                                               ; preds = %33, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 4, !tbaa !11
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %46, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %49 = getelementptr inbounds %struct.anon.3, ptr %4, i32 0, i32 1
  %50 = load float, ptr %49, align 4, !tbaa !10
  store float %50, ptr %10, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %51 = load float, ptr %10, align 4, !tbaa !14
  %52 = fsub float %51, -2.000000e+00
  store float %52, ptr %11, align 4, !tbaa !14
  %53 = load float, ptr %11, align 4, !tbaa !14
  %54 = fcmp olt float %53, 0xBE80000000000000
  br i1 %54, label %58, label %55

55:                                               ; preds = %44
  %56 = load float, ptr %11, align 4, !tbaa !14
  %57 = fcmp olt float 0x3E80000000000000, %56
  br i1 %57, label %58, label %69

58:                                               ; preds = %55, %44
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !16
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %60, align 4, !tbaa !16
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef 344)
  %64 = load float, ptr %10, align 4, !tbaa !14
  %65 = fpext float %64 to double
  %66 = load float, ptr %11, align 4, !tbaa !14
  %67 = fpext float %66 to double
  %68 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef -2.000000e+00, double noundef %65, double noundef %67)
  br label %69

69:                                               ; preds = %58, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %71, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %74 = getelementptr inbounds %struct.anon.3, ptr %4, i32 0, i32 2
  %75 = load float, ptr %74, align 4, !tbaa !10
  store float %75, ptr %12, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %76 = load float, ptr %12, align 4, !tbaa !14
  %77 = fsub float %76, -3.000000e+00
  store float %77, ptr %13, align 4, !tbaa !14
  %78 = load float, ptr %13, align 4, !tbaa !14
  %79 = fcmp olt float %78, 0xBE80000000000000
  br i1 %79, label %83, label %80

80:                                               ; preds = %69
  %81 = load float, ptr %13, align 4, !tbaa !14
  %82 = fcmp olt float 0x3E80000000000000, %81
  br i1 %82, label %83, label %94

83:                                               ; preds = %80, %69
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.hmt_testresult_struct, ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 4, !tbaa !16
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %85, align 4, !tbaa !16
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef 345)
  %89 = load float, ptr %12, align 4, !tbaa !14
  %90 = fpext float %89 to double
  %91 = load float, ptr %13, align 4, !tbaa !14
  %92 = fpext float %91 to double
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef -3.000000e+00, double noundef %90, double noundef %92)
  br label %94

94:                                               ; preds = %83, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #5
  ret void
}

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

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 = { 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 = { 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 #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++ 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"

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

@.str.15 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [34 x i8], align 1
@__const._Z25_hmt_test_UnaryMinus_Vec3P21hmt_testresult_struct.VectorOne = external hidden unnamed_addr constant %union.HMM_Vec3, align 4

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z25_hmt_test_UnaryMinus_Vec3P21hmt_testresult_struct(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %.sroa.025.0.copyload = load <2 x float>, ptr @__const._Z25_hmt_test_UnaryMinus_Vec3P21hmt_testresult_struct.VectorOne, align 4
  %.sroa.4.0.copyload = load float, ptr getelementptr inbounds (i8, ptr @__const._Z25_hmt_test_UnaryMinus_Vec3P21hmt_testresult_struct.VectorOne, i64 8), align 4
  %2 = tail call { <2 x float>, float } @_Zng8HMM_Vec3(<2 x float> %.sroa.025.0.copyload, float %.sroa.4.0.copyload)
  %.fca.0.extract = extractvalue { <2 x float>, float } %2, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %2, 1
  %3 = load i32, ptr %0, align 4, !tbaa !5
  %4 = add nsw i32 %3, 1
  store i32 %4, ptr %0, align 4, !tbaa !5
  %.sroa.024.0.vec.extract = extractelement <2 x float> %.fca.0.extract, i64 0
  %5 = fadd float %.sroa.024.0.vec.extract, 1.000000e+00
  %6 = tail call float @llvm.fabs.f32(float %5)
  %or.cond = fcmp ogt float %6, 0x3E80000000000000
  br i1 %or.cond, label %7, label %15

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

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

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

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

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

41:                                               ; preds = %28, %33
  ret void
}

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

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

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 = { 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 #2 = { 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 #3 = { 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