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

; 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.35" = type { i32, i32, i32, i32 }

@__const._ZN12ceilMultiple8test_intEv.Data = external hidden unnamed_addr constant [9 x %"struct.ceilMultiple::type.35"], 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: mustprogress uwtable
define dso_local noundef i32 @_ZN12ceilMultiple8test_intEv() #2 {
  %1 = alloca [9 x %"struct.ceilMultiple::type.35"], align 16
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 144, ptr %1) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const._ZN12ceilMultiple8test_intEv.Data, i64 144, 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 9, ptr %4, align 8, !tbaa !9
  br label %6

6:                                                ; preds = %31, %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 %34

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef, i32 noundef) #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 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN12ceilMultiple4typeIiEE", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !6, i64 8}
!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.ceilMultiple::type.35" = type { i32, i32, i32, i32 }

@__const._ZN12ceilMultiple8test_intEv.Data = external hidden unnamed_addr constant [9 x %"struct.ceilMultiple::type.35"], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12ceilMultiple8test_intEv() local_unnamed_addr #0 {
  %1 = load i32, ptr @__const._ZN12ceilMultiple8test_intEv.Data, align 16, !tbaa !5
  %2 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 4), align 4, !tbaa !10
  %3 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %1, i32 noundef %2)
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 8), align 8, !tbaa !11
  %5 = icmp ne i32 %4, %3
  %6 = zext i1 %5 to i32
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 16), align 16, !tbaa !5
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 20), align 4, !tbaa !10
  %9 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %7, i32 noundef %8)
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 24), align 8, !tbaa !11
  %11 = icmp ne i32 %10, %9
  %12 = zext i1 %11 to i32
  %13 = add nuw nsw i32 %6, %12
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 32), align 16, !tbaa !5
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 36), align 4, !tbaa !10
  %16 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %14, i32 noundef %15)
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 40), align 8, !tbaa !11
  %18 = icmp ne i32 %17, %16
  %19 = zext i1 %18 to i32
  %20 = add nuw nsw i32 %13, %19
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 48), align 16, !tbaa !5
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 52), align 4, !tbaa !10
  %23 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %21, i32 noundef %22)
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 56), align 8, !tbaa !11
  %25 = icmp ne i32 %24, %23
  %26 = zext i1 %25 to i32
  %27 = add nuw nsw i32 %20, %26
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 64), align 16, !tbaa !5
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 68), align 4, !tbaa !10
  %30 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %28, i32 noundef %29)
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 72), align 8, !tbaa !11
  %32 = icmp ne i32 %31, %30
  %33 = zext i1 %32 to i32
  %34 = add nuw nsw i32 %27, %33
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 80), align 16, !tbaa !5
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 84), align 4, !tbaa !10
  %37 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %35, i32 noundef %36)
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 88), align 8, !tbaa !11
  %39 = icmp ne i32 %38, %37
  %40 = zext i1 %39 to i32
  %41 = add nuw nsw i32 %34, %40
  %42 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 96), align 16, !tbaa !5
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 100), align 4, !tbaa !10
  %44 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %42, i32 noundef %43)
  %45 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 104), align 8, !tbaa !11
  %46 = icmp ne i32 %45, %44
  %47 = zext i1 %46 to i32
  %48 = add nuw nsw i32 %41, %47
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 112), align 16, !tbaa !5
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 116), align 4, !tbaa !10
  %51 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %49, i32 noundef %50)
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 120), align 8, !tbaa !11
  %53 = icmp ne i32 %52, %51
  %54 = zext i1 %53 to i32
  %55 = add nuw nsw i32 %48, %54
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 128), align 16, !tbaa !5
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 132), align 4, !tbaa !10
  %58 = tail call noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef %56, i32 noundef %57)
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @__const._ZN12ceilMultiple8test_intEv.Data, i64 136), align 8, !tbaa !11
  %60 = icmp ne i32 %59, %58
  %61 = zext i1 %60 to i32
  %62 = add nuw nsw i32 %55, %61
  ret i32 %62
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3glm12ceilMultipleIiEET_S1_S1_(i32 noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { 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" }

!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 = !{!"_ZTSN12ceilMultiple4typeIiEE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}


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