; LLVM IR from jpvt/Computer_Graphics :: Assignment #3/third_party/glm/test/gtc/gtc_bitfield.ll (ZN4mask10test_uvec4Ev)

; 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.mask::type.0" = type { %"struct.glm::vec", %"struct.glm::vec" }
%"struct.glm::vec" = type { %union.anon, %union.anon.1, %union.anon.2, %union.anon.3 }
%union.anon = type { i32 }
%union.anon.1 = type { i32 }
%union.anon.2 = type { i32 }
%union.anon.3 = type { i32 }
%"struct.glm::vec.4" = type { %union.anon.5, %union.anon.6, %union.anon.7, %union.anon.8 }
%union.anon.5 = type { i8 }
%union.anon.6 = type { i8 }
%union.anon.7 = type { i8 }
%union.anon.8 = type { i8 }

@__const._ZN4mask10test_uvec4Ev.Data = external hidden unnamed_addr constant [6 x %"struct.mask::type.0"], align 16

; 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: 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: mustprogress uwtable
define dso_local noundef i32 @_ZN4mask10test_uvec4Ev() #2 {
  %1 = alloca [6 x %"struct.mask::type.0"], align 16
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"struct.glm::vec", align 4
  %6 = alloca %"struct.glm::vec.4", align 1
  call void @llvm.lifetime.start.p0(i64 192, ptr %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const._ZN4mask10test_uvec4Ev.Data, i64 192, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 0, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 6, ptr %4, align 8, !tbaa !9
  br label %7

7:                                                ; preds = %30, %0
  %8 = load i64, ptr %3, align 8, !tbaa !9
  %9 = load i64, ptr %4, align 8, !tbaa !9
  %10 = icmp ult i64 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %33

12:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  %13 = load i64, ptr %3, align 8, !tbaa !9
  %14 = getelementptr inbounds [6 x %"struct.mask::type.0"], ptr %1, i64 0, i64 %13
  %15 = getelementptr inbounds %"struct.mask::type.0", ptr %14, i32 0, i32 0
  %16 = call { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %15)
  %17 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 0
  %18 = extractvalue { i64, i64 } %16, 0
  store i64 %18, ptr %17, align 4
  %19 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 1
  %20 = extractvalue { i64, i64 } %16, 1
  store i64 %20, ptr %19, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %21 = load i64, ptr %3, align 8, !tbaa !9
  %22 = getelementptr inbounds [6 x %"struct.mask::type.0"], ptr %1, i64 0, i64 %21
  %23 = getelementptr inbounds %"struct.mask::type.0", ptr %22, i32 0, i32 1
  %24 = call i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(16) %5)
  store i32 %24, ptr %6, align 1
  %25 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %6)
  %26 = zext i1 %25 to i64
  %27 = select i1 %25, i32 0, i32 1
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, %27
  store i32 %29, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  br label %30

30:                                               ; preds = %12
  %31 = load i64, ptr %3, align 8, !tbaa !9
  %32 = add i64 %31, 1
  store i64 %32, ptr %3, align 8, !tbaa !9
  br label %7, !llvm.loop !11

33:                                               ; preds = %11
  %34 = load i32, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 192, ptr %1) #4
  ret i32 %34
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16)) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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.mask::type.0" = type { %"struct.glm::vec", %"struct.glm::vec" }
%"struct.glm::vec" = type { %union.anon, %union.anon.1, %union.anon.2, %union.anon.3 }
%union.anon = type { i32 }
%union.anon.1 = type { i32 }
%union.anon.2 = type { i32 }
%union.anon.3 = type { i32 }
%"struct.glm::vec.4" = type { %union.anon.5, %union.anon.6, %union.anon.7, %union.anon.8 }
%union.anon.5 = type { i8 }
%union.anon.6 = type { i8 }
%union.anon.7 = type { i8 }
%union.anon.8 = type { i8 }

@__const._ZN4mask10test_uvec4Ev.Data = external hidden unnamed_addr constant [6 x %"struct.mask::type.0"], align 16

; 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 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: mustprogress uwtable
define dso_local noundef i32 @_ZN4mask10test_uvec4Ev() local_unnamed_addr #2 {
  %1 = alloca [6 x %"struct.mask::type.0"], align 16
  %2 = alloca %"struct.glm::vec", align 8
  %3 = alloca %"struct.glm::vec.4", align 4
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(192) %1, ptr noundef nonnull align 16 dereferenceable(192) @__const._ZN4mask10test_uvec4Ev.Data, i64 192, i1 false)
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %5 = call { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %1)
  %6 = extractvalue { i64, i64 } %5, 0
  store i64 %6, ptr %2, align 8
  %7 = extractvalue { i64, i64 } %5, 1
  store i64 %7, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = call i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(16) %2)
  store i32 %9, ptr %3, align 4
  %10 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %3)
  %not. = xor i1 %10, true
  %11 = zext i1 %not. to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %12 = getelementptr inbounds i8, ptr %1, i64 32
  %13 = call { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %12)
  %14 = extractvalue { i64, i64 } %13, 0
  store i64 %14, ptr %2, align 8
  %15 = extractvalue { i64, i64 } %13, 1
  store i64 %15, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %16 = getelementptr inbounds i8, ptr %1, i64 48
  %17 = call i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(16) %2)
  store i32 %17, ptr %3, align 4
  %18 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %3)
  %not..1 = xor i1 %18, true
  %19 = zext i1 %not..1 to i32
  %20 = add nuw nsw i32 %11, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %21 = getelementptr inbounds i8, ptr %1, i64 64
  %22 = call { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %21)
  %23 = extractvalue { i64, i64 } %22, 0
  store i64 %23, ptr %2, align 8
  %24 = extractvalue { i64, i64 } %22, 1
  store i64 %24, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %25 = getelementptr inbounds i8, ptr %1, i64 80
  %26 = call i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(16) %2)
  store i32 %26, ptr %3, align 4
  %27 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %3)
  %not..2 = xor i1 %27, true
  %28 = zext i1 %not..2 to i32
  %29 = add nuw nsw i32 %20, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %30 = getelementptr inbounds i8, ptr %1, i64 96
  %31 = call { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %30)
  %32 = extractvalue { i64, i64 } %31, 0
  store i64 %32, ptr %2, align 8
  %33 = extractvalue { i64, i64 } %31, 1
  store i64 %33, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %34 = getelementptr inbounds i8, ptr %1, i64 112
  %35 = call i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16) %34, ptr noundef nonnull align 4 dereferenceable(16) %2)
  store i32 %35, ptr %3, align 4
  %36 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %3)
  %not..3 = xor i1 %36, true
  %37 = zext i1 %not..3 to i32
  %38 = add nuw nsw i32 %29, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %39 = getelementptr inbounds i8, ptr %1, i64 128
  %40 = call { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %39)
  %41 = extractvalue { i64, i64 } %40, 0
  store i64 %41, ptr %2, align 8
  %42 = extractvalue { i64, i64 } %40, 1
  store i64 %42, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %43 = getelementptr inbounds i8, ptr %1, i64 144
  %44 = call i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16) %43, ptr noundef nonnull align 4 dereferenceable(16) %2)
  store i32 %44, ptr %3, align 4
  %45 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %3)
  %not..4 = xor i1 %45, true
  %46 = zext i1 %not..4 to i32
  %47 = add nuw nsw i32 %38, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %48 = getelementptr inbounds i8, ptr %1, i64 160
  %49 = call { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %48)
  %50 = extractvalue { i64, i64 } %49, 0
  store i64 %50, ptr %2, align 8
  %51 = extractvalue { i64, i64 } %49, 1
  store i64 %51, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %52 = getelementptr inbounds i8, ptr %1, i64 176
  %53 = call i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16) %52, ptr noundef nonnull align 4 dereferenceable(16) %2)
  store i32 %53, ptr %3, align 4
  %54 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %3)
  %not..5 = xor i1 %54, true
  %55 = zext i1 %not..5 to i32
  %56 = add nuw nsw i32 %47, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %1) #4
  ret i32 %56
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i64 } @_ZN3glm4maskILi4EiLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZN3glm5equalILi4EiLNS_9qualifierE0EEENS_3vecIXT_EbXT1_EEERKNS2_IXT_ET0_XT1_EEES7_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 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,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass