; LLVM IR from erwincoumans/tiny-differentiable-simulator :: src/visualizer/opengl/tiny_fonts.ll (ZN8CTexFontC2Ev)

; 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.CTexFont = type { ptr, i32, i32, [256 x float], [256 x float], [256 x float], [256 x float], [256 x i32], i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8CTexFontC2Ev(ptr noundef nonnull align 8 dereferenceable(5144) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %30, %1
  %6 = load i32, ptr %3, align 4, !tbaa !9
  %7 = icmp slt i32 %6, 256
  br i1 %7, label %9, label %8

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

9:                                                ; preds = %5
  %10 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 3
  %11 = load i32, ptr %3, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [256 x float], ptr %10, i64 0, i64 %12
  store float 0.000000e+00, ptr %13, align 4, !tbaa !11
  %14 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 5
  %15 = load i32, ptr %3, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [256 x float], ptr %14, i64 0, i64 %16
  store float 0.000000e+00, ptr %17, align 4, !tbaa !11
  %18 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 4
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [256 x float], ptr %18, i64 0, i64 %20
  store float 0.000000e+00, ptr %21, align 4, !tbaa !11
  %22 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 6
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [256 x float], ptr %22, i64 0, i64 %24
  store float 0.000000e+00, ptr %25, align 4, !tbaa !11
  %26 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 7
  %27 = load i32, ptr %3, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [256 x i32], ptr %26, i64 0, i64 %28
  store i32 0, ptr %29, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %9
  %31 = load i32, ptr %3, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %3, align 4, !tbaa !9
  br label %5, !llvm.loop !13

33:                                               ; preds = %8
  %34 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 1
  store i32 0, ptr %34, align 8, !tbaa !15
  %35 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 2
  store i32 0, ptr %35, align 4, !tbaa !17
  %36 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 0
  store ptr null, ptr %36, align 8, !tbaa !18
  %37 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 9
  store i32 0, ptr %37, align 4, !tbaa !19
  %38 = getelementptr inbounds %struct.CTexFont, ptr %4, i32 0, i32 8
  store i32 0, ptr %38, align 8, !tbaa !20
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 8}
!16 = !{!"_ZTS8CTexFont", !6, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 1040, !7, i64 2064, !7, i64 3088, !7, i64 4112, !10, i64 5136, !10, i64 5140}
!17 = !{!16, !10, i64 12}
!18 = !{!16, !6, i64 0}
!19 = !{!16, !10, i64 5140}
!20 = !{!16, !10, i64 5136}


; 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 nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @_ZN8CTexFontC2Ev(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(5144) %0) unnamed_addr #0 align 2 {
vector.ph:
  %1 = getelementptr inbounds i8, ptr %0, i64 16
  %2 = getelementptr inbounds i8, ptr %0, i64 2064
  %3 = getelementptr inbounds i8, ptr %0, i64 3088
  %4 = getelementptr inbounds i8, ptr %0, i64 4112
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(2048) %1, i8 0, i64 2048, i1 false)
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.1, %vector.body ]
  %5 = getelementptr inbounds [256 x float], ptr %2, i64 0, i64 %index
  %6 = getelementptr inbounds i8, ptr %5, i64 16
  store <4 x float> zeroinitializer, ptr %5, align 8, !tbaa !5
  store <4 x float> zeroinitializer, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %index
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store <4 x float> zeroinitializer, ptr %7, align 8, !tbaa !5
  store <4 x float> zeroinitializer, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds [256 x i32], ptr %4, i64 0, i64 %index
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store <4 x i32> zeroinitializer, ptr %9, align 8, !tbaa !9
  store <4 x i32> zeroinitializer, ptr %10, align 8, !tbaa !9
  %index.next = or disjoint i64 %index, 8
  %11 = getelementptr inbounds [256 x float], ptr %2, i64 0, i64 %index.next
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  store <4 x float> zeroinitializer, ptr %11, align 8, !tbaa !5
  store <4 x float> zeroinitializer, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %index.next
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  store <4 x float> zeroinitializer, ptr %13, align 8, !tbaa !5
  store <4 x float> zeroinitializer, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds [256 x i32], ptr %4, i64 0, i64 %index.next
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> zeroinitializer, ptr %15, align 8, !tbaa !9
  store <4 x i32> zeroinitializer, ptr %16, align 8, !tbaa !9
  %index.next.1 = add nuw nsw i64 %index, 16
  %17 = icmp eq i64 %index.next.1, 256
  br i1 %17, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %18 = getelementptr inbounds i8, ptr %0, i64 5140
  store i32 0, ptr %18, align 4, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %0, i64 5136
  store i32 0, ptr %19, align 8, !tbaa !18
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  ret void
}

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

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

!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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = !{!16, !10, i64 5140}
!16 = !{!"_ZTS8CTexFont", !17, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 1040, !7, i64 2064, !7, i64 3088, !7, i64 4112, !10, i64 5136, !10, i64 5140}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!16, !10, i64 5136}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass