; LLVM IR from Dovyski/opengl-demos :: libs/glm-0.9.9.3/test/core/core_type_vec3.ll (Z14test_vec3_sizev)

; 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" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float, float }
%"struct.glm::vec.703" = type { %union.anon.704 }
%union.anon.704 = type { %struct.anon.705 }
%struct.anon.705 = type { double, double, double }

; 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 @_Z14test_vec3_sizev() #1 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.glm::vec", align 4
  %3 = alloca %"struct.glm::vec.703", align 8
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = add nsw i32 %5, 0
  store i32 %6, ptr %1, align 4, !tbaa !5
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = add nsw i32 %7, 0
  store i32 %8, ptr %1, align 4, !tbaa !5
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = add nsw i32 %9, 0
  store i32 %10, ptr %1, align 4, !tbaa !5
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = add nsw i32 %11, 0
  store i32 %12, ptr %1, align 4, !tbaa !5
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = add nsw i32 %13, 0
  store i32 %14, ptr %1, align 4, !tbaa !5
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = add nsw i32 %15, 0
  store i32 %16, ptr %1, align 4, !tbaa !5
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = add nsw i32 %17, 0
  store i32 %18, ptr %1, align 4, !tbaa !5
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = add nsw i32 %19, 0
  store i32 %20, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %2) #4
  call void @llvm.memset.p0.i64(ptr align 4 %2, i8 0, i64 12, i1 false)
  %21 = call noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv()
  %22 = icmp eq i32 %21, 3
  %23 = zext i1 %22 to i64
  %24 = select i1 %22, i32 0, i32 1
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = add nsw i32 %25, %24
  store i32 %26, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 12, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #4
  call void @llvm.memset.p0.i64(ptr align 8 %3, i8 0, i64 24, i1 false)
  %27 = call noundef i32 @_ZN3glm3vecILi3EdLNS_9qualifierE0EE6lengthEv()
  %28 = icmp eq i32 %27, 3
  %29 = zext i1 %28 to i64
  %30 = select i1 %28, i32 0, i32 1
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %32 = add nsw i32 %31, %30
  store i32 %32, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #4
  %33 = call noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv()
  %34 = icmp eq i32 %33, 3
  %35 = zext i1 %34 to i64
  %36 = select i1 %34, i32 0, i32 1
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = add nsw i32 %37, %36
  store i32 %38, ptr %1, align 4, !tbaa !5
  %39 = call noundef i32 @_ZN3glm3vecILi3EdLNS_9qualifierE0EE6lengthEv()
  %40 = icmp eq i32 %39, 3
  %41 = zext i1 %40 to i64
  %42 = select i1 %40, i32 0, i32 1
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = add nsw i32 %43, %42
  store i32 %44, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %45 = call noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv()
  %46 = sext i32 %45 to i64
  store i64 %46, ptr %4, align 8, !tbaa !9
  %47 = load i64, ptr %4, align 8, !tbaa !9
  %48 = icmp eq i64 %47, 3
  %49 = zext i1 %48 to i64
  %50 = select i1 %48, i32 0, i32 1
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = add nsw i32 %51, %50
  store i32 %52, ptr %1, align 4, !tbaa !5
  %53 = load i32, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret i32 %53
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv() #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3glm3vecILi3EdLNS_9qualifierE0EE6lengthEv() #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}


; 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 nounwind uwtable
define dso_local noundef range(i32 0, 6) i32 @_Z14test_vec3_sizev() local_unnamed_addr #0 {
  %1 = tail call noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv()
  %2 = icmp ne i32 %1, 3
  %3 = zext i1 %2 to i32
  %4 = tail call noundef i32 @_ZN3glm3vecILi3EdLNS_9qualifierE0EE6lengthEv()
  %5 = icmp ne i32 %4, 3
  %6 = zext i1 %5 to i32
  %7 = add nuw nsw i32 %6, %3
  %8 = tail call noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv()
  %9 = icmp ne i32 %8, 3
  %10 = zext i1 %9 to i32
  %11 = add nuw nsw i32 %7, %10
  %12 = tail call noundef i32 @_ZN3glm3vecILi3EdLNS_9qualifierE0EE6lengthEv()
  %13 = icmp ne i32 %12, 3
  %14 = zext i1 %13 to i32
  %15 = add nuw nsw i32 %11, %14
  %16 = tail call noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv()
  %17 = icmp ne i32 %16, 3
  %18 = zext i1 %17 to i32
  %19 = add nuw nsw i32 %15, %18
  ret i32 %19
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3glm3vecILi3EfLNS_9qualifierE0EE6lengthEv() local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3glm3vecILi3EdLNS_9qualifierE0EE6lengthEv() local_unnamed_addr #0 align 2

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)"}


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