; LLVM IR from Dovyski/opengl-demos :: libs/glm-0.9.9.3/test/gtx/gtx_common.ll (Z16test_openBoundedv)

; 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.glm::vec.16" = type { %union.anon.17 }
%union.anon.17 = type { %struct.anon.18 }
%struct.anon.18 = type { i8, i8 }
%"struct.glm::vec.36" = type { %union.anon.37 }
%union.anon.37 = type { %struct.anon.38 }
%struct.anon.38 = type { i32, i32 }

; 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: mustprogress uwtable
define dso_local noundef i32 @_Z16test_openBoundedv() #1 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.glm::vec.16", align 1
  %3 = alloca %"struct.glm::vec.36", align 4
  %4 = alloca %"struct.glm::vec.36", align 4
  %5 = alloca %"struct.glm::vec.36", align 4
  %6 = alloca %"struct.glm::vec.16", align 1
  %7 = alloca %"struct.glm::vec.36", align 4
  %8 = alloca %"struct.glm::vec.36", align 4
  %9 = alloca %"struct.glm::vec.36", align 4
  %10 = alloca %"struct.glm::vec.16", align 1
  %11 = alloca %"struct.glm::vec.36", align 4
  %12 = alloca %"struct.glm::vec.36", align 4
  %13 = alloca %"struct.glm::vec.36", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %3, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 3)
  %14 = call i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5)
  %15 = getelementptr inbounds %"struct.glm::vec.16", ptr %2, i32 0, i32 0
  %16 = getelementptr inbounds %union.anon.17, ptr %15, i32 0, i32 0
  store i16 %14, ptr %16, align 1
  %17 = call noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2) %2)
  %18 = zext i1 %17 to i64
  %19 = select i1 %17, i32 0, i32 1
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = add nsw i32 %20, %19
  store i32 %21, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %8, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %9, i32 noundef 3)
  %22 = call i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %9)
  %23 = getelementptr inbounds %"struct.glm::vec.16", ptr %6, i32 0, i32 0
  %24 = getelementptr inbounds %union.anon.17, ptr %23, i32 0, i32 0
  store i16 %22, ptr %24, align 1
  %25 = call noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2) %6)
  %26 = xor i1 %25, true
  %27 = zext i1 %26 to i64
  %28 = select i1 %26, i32 0, i32 1
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = add nsw i32 %29, %28
  store i32 %30, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %11, i32 noundef 3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %12, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %13, i32 noundef 3)
  %31 = call i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(8) %13)
  %32 = getelementptr inbounds %"struct.glm::vec.16", ptr %10, i32 0, i32 0
  %33 = getelementptr inbounds %union.anon.17, ptr %32, i32 0, i32 0
  store i16 %31, ptr %33, align 1
  %34 = call noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2) %10)
  %35 = xor i1 %34, true
  %36 = zext i1 %35 to i64
  %37 = select i1 %35, i32 0, i32 1
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = add nsw i32 %38, %37
  store i32 %39, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #4
  %40 = load i32, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret i32 %40
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) unnamed_addr #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #3 = { inlinehint 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" }
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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; 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.glm::vec.16" = type { %union.anon.17 }
%union.anon.17 = type { %struct.anon.18 }
%struct.anon.18 = type { i8, i8 }
%"struct.glm::vec.36" = type { %union.anon.37 }
%union.anon.37 = type { %struct.anon.38 }
%struct.anon.38 = type { i32, i32 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 4) i32 @_Z16test_openBoundedv() local_unnamed_addr #1 {
  %1 = alloca %"struct.glm::vec.16", align 2
  %2 = alloca %"struct.glm::vec.36", align 4
  %3 = alloca %"struct.glm::vec.36", align 4
  %4 = alloca %"struct.glm::vec.36", align 4
  %5 = alloca %"struct.glm::vec.16", align 2
  %6 = alloca %"struct.glm::vec.36", align 4
  %7 = alloca %"struct.glm::vec.36", align 4
  %8 = alloca %"struct.glm::vec.36", align 4
  %9 = alloca %"struct.glm::vec.16", align 2
  %10 = alloca %"struct.glm::vec.36", align 4
  %11 = alloca %"struct.glm::vec.36", align 4
  %12 = alloca %"struct.glm::vec.36", align 4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %2, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %3, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 3)
  %13 = call i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %4)
  store i16 %13, ptr %1, align 2
  %14 = call noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2) %1)
  %not. = xor i1 %14, true
  %15 = zext i1 %not. to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %6, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %8, i32 noundef 3)
  %16 = call i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store i16 %16, ptr %5, align 2
  %17 = call noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2) %5)
  %18 = zext i1 %17 to i32
  %19 = add nuw nsw i32 %18, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %10, i32 noundef 3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %11, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #4
  call void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8) %12, i32 noundef 3)
  %20 = call i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %12)
  store i16 %20, ptr %9, align 2
  %21 = call noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2) %9)
  %22 = zext i1 %21 to i32
  %23 = add nuw nsw i32 %19, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %9) #4
  ret i32 %23
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3glm3allILi2ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(2)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i16 @_ZN3glm11openBoundedILi2EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_S7_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3glm3vecILi2EiLNS_9qualifierE0EEC2Ei(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #3 = { inlinehint 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" }
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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass