; LLVM IR from Dovyski/opengl-demos :: libs/glm-0.9.9.3/test/gtc/gtc_round.ll (ZN12ceilMultiple10test_floatEv)

; 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.ceilMultiple::type" = type { double, double, double, double }

@__const._ZN12ceilMultiple10test_floatEv.Data = external hidden unnamed_addr constant [2 x %"struct.ceilMultiple::type"], 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 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; 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 @_ZN12ceilMultiple10test_floatEv() #3 {
  %1 = alloca [2 x %"struct.ceilMultiple::type"], align 16
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const._ZN12ceilMultiple10test_floatEv.Data, i64 64, 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 2, ptr %4, align 8, !tbaa !9
  br label %6

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

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

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

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

35:                                               ; preds = %10
  %36 = 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 64, ptr %1) #4
  ret i32 %36
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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"="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 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN12ceilMultiple4typeIdEE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!13, !13, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"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.ceilMultiple::type" = type { double, double, double, double }

@__const._ZN12ceilMultiple10test_floatEv.Data = external hidden unnamed_addr constant [2 x %"struct.ceilMultiple::type"], 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 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; 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 i32 @_ZN12ceilMultiple10test_floatEv() local_unnamed_addr #3 {
  %1 = alloca [2 x %"struct.ceilMultiple::type"], align 16
  %2 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %1, ptr noundef nonnull align 16 dereferenceable(64) @__const._ZN12ceilMultiple10test_floatEv.Data, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %3 = load double, ptr %1, align 16, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = load double, ptr %4, align 8, !tbaa !10
  %6 = tail call noundef double @_ZN3glm12ceilMultipleIdEET_S1_S1_(double noundef %3, double noundef %5)
  store double %6, ptr %2, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  %9 = call noundef zeroext i1 @_ZN3glm12epsilonEqualIdEEbRKT_S3_S3_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %not. = xor i1 %9, true
  %10 = zext i1 %not. to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %11 = getelementptr inbounds i8, ptr %1, i64 32
  %12 = load double, ptr %11, align 16, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 40
  %14 = load double, ptr %13, align 8, !tbaa !10
  %15 = call noundef double @_ZN3glm12ceilMultipleIdEET_S1_S1_(double noundef %12, double noundef %14)
  store double %15, ptr %2, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %1, i64 48
  %17 = getelementptr inbounds i8, ptr %1, i64 56
  %18 = call noundef zeroext i1 @_ZN3glm12epsilonEqualIdEEbRKT_S3_S3_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %not..1 = xor i1 %18, true
  %19 = zext i1 %not..1 to i32
  %20 = add nuw nsw i32 %10, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %1) #4
  ret i32 %20
}

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

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 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"="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, !7, i64 0}
!6 = !{!"_ZTSN12ceilMultiple4typeIdEE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass