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

; 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::qua" = type { float, float, float, float }
%"struct.glm::vec.11" = type { %union.anon.12, %union.anon.13, %union.anon.14, %union.anon.15 }
%union.anon.12 = type { i8 }
%union.anon.13 = type { i8 }
%union.anon.14 = type { i8 }
%union.anon.15 = type { i8 }
%"struct.glm::mat" = type { [4 x %"struct.glm::vec.16"] }
%"struct.glm::vec.16" = type { %union.anon.17, %union.anon.18, %union.anon.19, %union.anon.20 }
%union.anon.17 = type { float }
%union.anon.18 = type { float }
%union.anon.19 = type { float }
%union.anon.20 = type { float }

@__const._Z13test_identityv.Q = external hidden unnamed_addr constant %"struct.glm::qua", 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 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3glm3quaIfLNS_9qualifierE0EEC2Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #2 align 2

; 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 @_ZN3glm5equalIfLNS_9qualifierE0EEENS_3vecILi4EbXT0_EEERKNS_3quaIT_XT0_EEES8_S5_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16), float noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z13test_identityv() #5 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.glm::qua", align 4
  %3 = alloca %"struct.glm::vec.11", align 1
  %4 = alloca %"struct.glm::qua", align 4
  %5 = alloca %"struct.glm::vec.11", align 1
  %6 = alloca %"struct.glm::qua", align 4
  %7 = alloca %"struct.glm::mat", align 4
  %8 = alloca %"struct.glm::mat", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %2, ptr align 4 @__const._Z13test_identityv.Q, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #7
  call void @_ZN3glm3quaIfLNS_9qualifierE0EEC2Effff(ptr noundef nonnull align 4 dereferenceable(16) %4, float noundef 1.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %9 = call i32 @_ZN3glm5equalIfLNS_9qualifierE0EEENS_3vecILi4EbXT0_EEERKNS_3quaIT_XT0_EEES8_S5_(ptr noundef nonnull align 4 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(16) %4, float noundef 0x3F1A36E2E0000000)
  store i32 %9, ptr %3, align 1
  %10 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %3)
  %11 = zext i1 %10 to i64
  %12 = select i1 %10, i32 0, i32 1
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = add nsw i32 %13, %12
  store i32 %14, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #7
  call void @_ZN3glm3quaIfLNS_9qualifierE0EEC2Effff(ptr noundef nonnull align 4 dereferenceable(16) %6, float noundef 1.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %15 = call i32 @_ZN3glm8notEqualIfLNS_9qualifierE0EEENS_3vecILi4EbXT0_EEERKNS_3quaIT_XT0_EEES8_S5_(ptr noundef nonnull align 4 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(16) %6, float noundef 0x3F1A36E2E0000000)
  store i32 %15, ptr %5, align 1
  %16 = call noundef zeroext i1 @_ZN3glm3anyILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %5)
  %17 = zext i1 %16 to i64
  %18 = select i1 %16, i32 1, i32 0
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = add nsw i32 %19, %18
  store i32 %20, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 64, ptr %7) #7
  call void @llvm.memset.p0.i64(ptr align 4 %7, i8 0, i64 64, i1 false)
  %21 = getelementptr inbounds %"struct.glm::mat", ptr %7, i32 0, i32 0
  %22 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.glm::vec.16", ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %union.anon.17, ptr %23, i32 0, i32 0
  store float 1.000000e+00, ptr %24, align 4
  %25 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %21, i32 0, i32 1
  %26 = getelementptr inbounds %"struct.glm::vec.16", ptr %25, i32 0, i32 1
  %27 = getelementptr inbounds %union.anon.18, ptr %26, i32 0, i32 0
  store float 1.000000e+00, ptr %27, align 4
  %28 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %21, i32 0, i32 2
  %29 = getelementptr inbounds %"struct.glm::vec.16", ptr %28, i32 0, i32 2
  %30 = getelementptr inbounds %union.anon.19, ptr %29, i32 0, i32 0
  store float 1.000000e+00, ptr %30, align 4
  %31 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %21, i32 0, i32 3
  %32 = getelementptr inbounds %"struct.glm::vec.16", ptr %31, i32 0, i32 3
  %33 = getelementptr inbounds %union.anon.20, ptr %32, i32 0, i32 0
  store float 1.000000e+00, ptr %33, align 4
  call void @llvm.lifetime.start.p0(i64 64, ptr %8) #7
  call void @llvm.memset.p0.i64(ptr align 4 %8, i8 0, i64 64, i1 false)
  %34 = getelementptr inbounds %"struct.glm::mat", ptr %8, i32 0, i32 0
  %35 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %34, i32 0, i32 0
  %36 = getelementptr inbounds %"struct.glm::vec.16", ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds %union.anon.17, ptr %36, i32 0, i32 0
  store float 1.000000e+00, ptr %37, align 4
  %38 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %34, i32 0, i32 1
  %39 = getelementptr inbounds %"struct.glm::vec.16", ptr %38, i32 0, i32 1
  %40 = getelementptr inbounds %union.anon.18, ptr %39, i32 0, i32 0
  store float 1.000000e+00, ptr %40, align 4
  %41 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %34, i32 0, i32 2
  %42 = getelementptr inbounds %"struct.glm::vec.16", ptr %41, i32 0, i32 2
  %43 = getelementptr inbounds %union.anon.19, ptr %42, i32 0, i32 0
  store float 1.000000e+00, ptr %43, align 4
  %44 = getelementptr inbounds [4 x %"struct.glm::vec.16"], ptr %34, i32 0, i32 3
  %45 = getelementptr inbounds %"struct.glm::vec.16", ptr %44, i32 0, i32 3
  %46 = getelementptr inbounds %union.anon.20, ptr %45, i32 0, i32 0
  store float 1.000000e+00, ptr %46, align 4
  %47 = load i32, ptr %1, align 4, !tbaa !5
  %48 = add nsw i32 %47, 0
  store i32 %48, ptr %1, align 4, !tbaa !5
  %49 = load i32, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 64, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  ret i32 %49
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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::qua" = type { float, float, float, float }
%"struct.glm::vec.11" = type { %union.anon.12, %union.anon.13, %union.anon.14, %union.anon.15 }
%union.anon.12 = type { i8 }
%union.anon.13 = type { i8 }
%union.anon.14 = type { i8 }
%union.anon.15 = type { i8 }

@__const._Z13test_identityv.Q = external hidden unnamed_addr constant %"struct.glm::qua", align 4

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3glm3quaIfLNS_9qualifierE0EEC2Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #2 align 2

; 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 @_ZN3glm5equalIfLNS_9qualifierE0EEENS_3vecILi4EbXT0_EEERKNS_3quaIT_XT0_EEES8_S5_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16), float noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 3) i32 @_Z13test_identityv() local_unnamed_addr #5 {
  %1 = alloca %"struct.glm::qua", align 4
  %2 = alloca %"struct.glm::vec.11", align 4
  %3 = alloca %"struct.glm::qua", align 4
  %4 = alloca %"struct.glm::vec.11", align 4
  %5 = alloca %"struct.glm::qua", align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(16) @__const._Z13test_identityv.Q, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @_ZN3glm3quaIfLNS_9qualifierE0EEC2Effff(ptr noundef nonnull align 4 dereferenceable(16) %3, float noundef 1.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %6 = call i32 @_ZN3glm5equalIfLNS_9qualifierE0EEENS_3vecILi4EbXT0_EEERKNS_3quaIT_XT0_EEES8_S5_(ptr noundef nonnull align 4 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(16) %3, float noundef 0x3F1A36E2E0000000)
  store i32 %6, ptr %2, align 4
  %7 = call noundef zeroext i1 @_ZN3glm3allILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %2)
  %not. = xor i1 %7, true
  %8 = zext i1 %not. to i32
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @_ZN3glm3quaIfLNS_9qualifierE0EEC2Effff(ptr noundef nonnull align 4 dereferenceable(16) %5, float noundef 1.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %9 = call i32 @_ZN3glm8notEqualIfLNS_9qualifierE0EEENS_3vecILi4EbXT0_EEERKNS_3quaIT_XT0_EEES8_S5_(ptr noundef nonnull align 4 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(16) %5, float noundef 0x3F1A36E2E0000000)
  store i32 %9, ptr %4, align 4
  %10 = call noundef zeroext i1 @_ZN3glm3anyILi4ELNS_9qualifierE0EEEbRKNS_3vecIXT_EbXT0_EEE(ptr noundef nonnull align 1 dereferenceable(4) %4)
  %11 = zext i1 %10 to i32
  %12 = add nuw nsw i32 %11, %8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  ret i32 %12
}

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

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

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


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