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

; 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.25" = type { %union.anon.26, %union.anon.27 }
%union.anon.26 = type { float }
%union.anon.27 = type { float }
%"struct.glm::vec.28" = type { %union.anon.29, %union.anon.30 }
%union.anon.29 = type { double }
%union.anon.30 = type { double }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [110 x i8], align 1
@__PRETTY_FUNCTION__._Z17test_circularRandv = external hidden unnamed_addr constant [24 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z17test_circularRandv() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca float, align 4
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.glm::vec.25", align 4
  %8 = alloca %"struct.glm::vec.28", align 8
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store i64 10000, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store float 0.000000e+00, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store double 0.000000e+00, ptr %4, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store double 2.000000e+00, ptr %5, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %13

13:                                               ; preds = %32, %0
  %14 = load i64, ptr %6, align 8, !tbaa !9
  %15 = load i64, ptr %2, align 8, !tbaa !9
  %16 = icmp ult i64 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %35

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %19 = call <2 x float> @_ZN3glm12circularRandIfEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(float noundef 1.000000e+00)
  store <2 x float> %19, ptr %7, align 4
  %20 = call noundef float @_ZN3glm6lengthILi2EfLNS_9qualifierE0EEET0_RKNS_3vecIXT_ES2_XT1_EEE(ptr noundef nonnull align 4 dereferenceable(8) %7)
  %21 = load float, ptr %3, align 4, !tbaa !11
  %22 = fadd float %21, %20
  store float %22, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %23 = load double, ptr %5, align 8, !tbaa !13
  %24 = call { double, double } @_ZN3glm12circularRandIdEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(double noundef %23)
  %25 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 0
  %26 = extractvalue { double, double } %24, 0
  store double %26, ptr %25, align 8
  %27 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 1
  %28 = extractvalue { double, double } %24, 1
  store double %28, ptr %27, align 8
  %29 = call noundef double @_ZN3glm6lengthILi2EdLNS_9qualifierE0EEET0_RKNS_3vecIXT_ES2_XT1_EEE(ptr noundef nonnull align 8 dereferenceable(16) %8)
  %30 = load double, ptr %4, align 8, !tbaa !13
  %31 = fadd double %30, %29
  store double %31, ptr %4, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  br label %32

32:                                               ; preds = %18
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = add i64 %33, 1
  store i64 %34, ptr %6, align 8, !tbaa !9
  br label %13, !llvm.loop !15

35:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %36 = load i64, ptr %2, align 8, !tbaa !9
  %37 = uitofp i64 %36 to float
  store float %37, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store float 0x3F847AE140000000, ptr %10, align 4, !tbaa !11
  %38 = call noundef zeroext i1 @_ZN3glm12epsilonEqualIfEEbRKT_S3_S3_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %39 = zext i1 %38 to i64
  %40 = select i1 %38, i32 0, i32 1
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %42 = add nsw i32 %41, %40
  store i32 %42, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %43 = load i64, ptr %2, align 8, !tbaa !9
  %44 = uitofp i64 %43 to double
  %45 = load double, ptr %5, align 8, !tbaa !13
  %46 = fmul double %44, %45
  store double %46, ptr %11, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store double 1.000000e-02, ptr %12, align 8, !tbaa !13
  %47 = call noundef zeroext i1 @_ZN3glm12epsilonEqualIdEEbRKT_S3_S3_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %48 = zext i1 %47 to i64
  %49 = select i1 %47, i32 0, i32 1
  %50 = load i32, ptr %1, align 4, !tbaa !5
  %51 = add nsw i32 %50, %49
  store i32 %51, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %53 = icmp ne i32 %52, 0
  %54 = xor i1 %53, true
  br i1 %54, label %55, label %56

55:                                               ; preds = %35
  br label %58

56:                                               ; preds = %35
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 241, ptr noundef @__PRETTY_FUNCTION__._Z17test_circularRandv) #6
  unreachable

57:                                               ; No predecessors!
  br label %58

58:                                               ; preds = %57, %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %59 = load i32, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret i32 %59
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN3glm12circularRandIfEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(float noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN3glm6lengthILi2EdLNS_9qualifierE0EEET0_RKNS_3vecIXT_ES2_XT1_EEE(ptr noundef nonnull align 8 dereferenceable(16)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZN3glm12circularRandIdEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 = { 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 #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 = { nounwind }
attributes #6 = { noreturn 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 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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.glm::vec.25" = type { %union.anon.26, %union.anon.27 }
%union.anon.26 = type { float }
%union.anon.27 = type { float }
%"struct.glm::vec.28" = type { %union.anon.29, %union.anon.30 }
%union.anon.29 = type { double }
%union.anon.30 = type { double }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [110 x i8], align 1
@__PRETTY_FUNCTION__._Z17test_circularRandv = external hidden unnamed_addr constant [24 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 3) i32 @_Z17test_circularRandv() local_unnamed_addr #3 {
  %1 = alloca float, align 4
  %2 = alloca double, align 8
  %3 = alloca %"struct.glm::vec.25", align 8
  %4 = alloca %"struct.glm::vec.28", align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %9 = getelementptr inbounds i8, ptr %4, i64 8
  br label %13

10:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store float 1.000000e+04, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  store float 0x3F847AE140000000, ptr %6, align 4, !tbaa !5
  %11 = call noundef zeroext i1 @_ZN3glm12epsilonEqualIfEEbRKT_S3_S3_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store double 2.000000e+04, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  store double 1.000000e-02, ptr %8, align 8, !tbaa !9
  %12 = call noundef zeroext i1 @_ZN3glm12epsilonEqualIdEEbRKT_S3_S3_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  %.demorgan = and i1 %11, %12
  br i1 %.demorgan, label %26, label %25

13:                                               ; preds = %0, %13
  %14 = phi double [ 0.000000e+00, %0 ], [ %23, %13 ]
  %15 = phi float [ 0.000000e+00, %0 ], [ %18, %13 ]
  %.011 = phi i64 [ 0, %0 ], [ %24, %13 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %16 = call <2 x float> @_ZN3glm12circularRandIfEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(float noundef 1.000000e+00)
  store <2 x float> %16, ptr %3, align 8
  %17 = call noundef float @_ZN3glm6lengthILi2EfLNS_9qualifierE0EEET0_RKNS_3vecIXT_ES2_XT1_EEE(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %18 = fadd float %17, %15
  store float %18, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %19 = call { double, double } @_ZN3glm12circularRandIdEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(double noundef 2.000000e+00)
  %20 = extractvalue { double, double } %19, 0
  store double %20, ptr %4, align 8
  %21 = extractvalue { double, double } %19, 1
  store double %21, ptr %9, align 8
  %22 = call noundef double @_ZN3glm6lengthILi2EdLNS_9qualifierE0EEET0_RKNS_3vecIXT_ES2_XT1_EEE(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %23 = fadd double %22, %14
  store double %23, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  %24 = add nuw nsw i64 %.011, 1
  %exitcond.not = icmp eq i64 %24, 10000
  br i1 %exitcond.not, label %10, label %13, !llvm.loop !11

25:                                               ; preds = %10
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 241, ptr noundef nonnull @__PRETTY_FUNCTION__._Z17test_circularRandv) #6
  unreachable

26:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN3glm12circularRandIfEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(float noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN3glm6lengthILi2EdLNS_9qualifierE0EEET0_RKNS_3vecIXT_ES2_XT1_EEE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZN3glm12circularRandIdEENS_3vecILi2ET_LNS_9qualifierE0EEES2_(double noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 = { 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 #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 = { nounwind }
attributes #6 = { noreturn 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass