; LLVM IR from zeux/meshoptimizer :: gltf/material.ll (Z17hasValidTransformRK18cgltf_texture_view)

; 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.cgltf_texture_view = type { ptr, i32, float, i32, %struct.cgltf_texture_transform }
%struct.cgltf_texture_transform = type { [2 x float], float, [2 x float], i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z17hasValidTransformRK18cgltf_texture_view(ptr noundef nonnull align 8 dereferenceable(48) %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.cgltf_texture_view, ptr %4, i32 0, i32 3
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %8, label %60

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.cgltf_texture_view, ptr %9, i32 0, i32 4
  %11 = getelementptr inbounds %struct.cgltf_texture_transform, ptr %10, i32 0, i32 0
  %12 = getelementptr inbounds [2 x float], ptr %11, i64 0, i64 0
  %13 = load float, ptr %12, align 4, !tbaa !14
  %14 = fcmp une float %13, 0.000000e+00
  br i1 %14, label %42, label %15

15:                                               ; preds = %8
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.cgltf_texture_view, ptr %16, i32 0, i32 4
  %18 = getelementptr inbounds %struct.cgltf_texture_transform, ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds [2 x float], ptr %18, i64 0, i64 1
  %20 = load float, ptr %19, align 4, !tbaa !14
  %21 = fcmp une float %20, 0.000000e+00
  br i1 %21, label %42, label %22

22:                                               ; preds = %15
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.cgltf_texture_view, ptr %23, i32 0, i32 4
  %25 = getelementptr inbounds %struct.cgltf_texture_transform, ptr %24, i32 0, i32 2
  %26 = getelementptr inbounds [2 x float], ptr %25, i64 0, i64 0
  %27 = load float, ptr %26, align 4, !tbaa !14
  %28 = fcmp une float %27, 1.000000e+00
  br i1 %28, label %42, label %29

29:                                               ; preds = %22
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.cgltf_texture_view, ptr %30, i32 0, i32 4
  %32 = getelementptr inbounds %struct.cgltf_texture_transform, ptr %31, i32 0, i32 2
  %33 = getelementptr inbounds [2 x float], ptr %32, i64 0, i64 1
  %34 = load float, ptr %33, align 4, !tbaa !14
  %35 = fcmp une float %34, 1.000000e+00
  br i1 %35, label %42, label %36

36:                                               ; preds = %29
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.cgltf_texture_view, ptr %37, i32 0, i32 4
  %39 = getelementptr inbounds %struct.cgltf_texture_transform, ptr %38, i32 0, i32 1
  %40 = load float, ptr %39, align 4, !tbaa !15
  %41 = fcmp une float %40, 0.000000e+00
  br i1 %41, label %42, label %43

42:                                               ; preds = %36, %29, %22, %15, %8
  store i1 true, ptr %2, align 1
  br label %61

43:                                               ; preds = %36
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.cgltf_texture_view, ptr %44, i32 0, i32 4
  %46 = getelementptr inbounds %struct.cgltf_texture_transform, ptr %45, i32 0, i32 3
  %47 = load i32, ptr %46, align 4, !tbaa !16
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %59

49:                                               ; preds = %43
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.cgltf_texture_view, ptr %50, i32 0, i32 4
  %52 = getelementptr inbounds %struct.cgltf_texture_transform, ptr %51, i32 0, i32 4
  %53 = load i32, ptr %52, align 4, !tbaa !17
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.cgltf_texture_view, ptr %54, i32 0, i32 1
  %56 = load i32, ptr %55, align 8, !tbaa !18
  %57 = icmp ne i32 %53, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %49
  store i1 true, ptr %2, align 1
  br label %61

59:                                               ; preds = %49, %43
  br label %60

60:                                               ; preds = %59, %1
  store i1 false, ptr %2, align 1
  br label %61

61:                                               ; preds = %60, %58, %42
  %62 = load i1, ptr %2, align 1
  ret i1 %62
}

attributes #0 = { mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 16}
!10 = !{!"_ZTS18cgltf_texture_view", !6, i64 0, !11, i64 8, !12, i64 12, !11, i64 16, !13, i64 20}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_ZTS23cgltf_texture_transform", !7, i64 0, !12, i64 8, !7, i64 12, !11, i64 20, !11, i64 24}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !12, i64 28}
!16 = !{!10, !11, i64 40}
!17 = !{!10, !11, i64 44}
!18 = !{!10, !11, i64 8}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef zeroext i1 @_Z17hasValidTransformRK18cgltf_texture_view(ptr nocapture noundef nonnull readonly align 8 dereferenceable(48) %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %24, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 20
  %6 = load <4 x float>, ptr %5, align 4
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = load <4 x float>, ptr %7, align 8
  %9 = shufflevector <4 x float> %6, <4 x float> %8, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
  %.fr = freeze <4 x float> %9
  %10 = fcmp une <4 x float> %.fr, <float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %11 = getelementptr inbounds i8, ptr %0, i64 28
  %12 = load float, ptr %11, align 4
  %13 = fcmp une float %12, 0.000000e+00
  %14 = bitcast <4 x i1> %10 to i4
  %15 = icmp ne i4 %14, 0
  %op.rdx = select i1 %15, i1 true, i1 %13
  br i1 %op.rdx, label %25, label %16

16:                                               ; preds = %4
  %17 = getelementptr inbounds i8, ptr %0, i64 40
  %18 = load i32, ptr %17, align 8, !tbaa !13
  %.not10 = icmp eq i32 %18, 0
  br i1 %.not10, label %24, label %19

19:                                               ; preds = %16
  %20 = getelementptr inbounds i8, ptr %0, i64 44
  %21 = load i32, ptr %20, align 4, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load i32, ptr %22, align 8, !tbaa !15
  %.not11 = icmp eq i32 %21, %23
  br i1 %.not11, label %24, label %25

24:                                               ; preds = %16, %19, %1
  br label %25

25:                                               ; preds = %19, %4, %24
  %.0 = phi i1 [ false, %24 ], [ true, %4 ], [ true, %19 ]
  ret i1 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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, !10, i64 16}
!6 = !{!"_ZTS18cgltf_texture_view", !7, i64 0, !10, i64 8, !11, i64 12, !10, i64 16, !12, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"_ZTS23cgltf_texture_transform", !8, i64 0, !11, i64 8, !8, i64 12, !10, i64 20, !10, i64 24}
!13 = !{!6, !10, i64 40}
!14 = !{!6, !10, i64 44}
!15 = !{!6, !10, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,VectorCombinePass