; LLVM IR from erwincoumans/tiny-differentiable-simulator :: src/visualizer/opengl (tiny_font_stash)

; 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"

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

; Function Attrs: mustprogress uwtable
define dso_local void @stbtt_Rasterize(ptr noundef %0, float noundef %1, ptr noundef %2, i32 noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, ptr noundef %11) #2 {
  %13 = alloca ptr, align 8
  %14 = alloca float, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca float, align 4
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  store ptr %0, ptr %13, align 8, !tbaa !5
  store float %1, ptr %14, align 4, !tbaa !9
  store ptr %2, ptr %15, align 8, !tbaa !5
  store i32 %3, ptr %16, align 4, !tbaa !11
  store float %4, ptr %17, align 4, !tbaa !9
  store float %5, ptr %18, align 4, !tbaa !9
  store float %6, ptr %19, align 4, !tbaa !9
  store float %7, ptr %20, align 4, !tbaa !9
  store i32 %8, ptr %21, align 4, !tbaa !11
  store i32 %9, ptr %22, align 4, !tbaa !11
  store i32 %10, ptr %23, align 4, !tbaa !11
  store ptr %11, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  %29 = load float, ptr %17, align 4, !tbaa !9
  %30 = load float, ptr %18, align 4, !tbaa !9
  %31 = fcmp ogt float %29, %30
  br i1 %31, label %32, label %34

32:                                               ; preds = %12
  %33 = load float, ptr %18, align 4, !tbaa !9
  br label %36

34:                                               ; preds = %12
  %35 = load float, ptr %17, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %34, %32
  %37 = phi float [ %33, %32 ], [ %35, %34 ]
  store float %37, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #3
  %38 = load ptr, ptr %15, align 8, !tbaa !5
  %39 = load i32, ptr %16, align 4, !tbaa !11
  %40 = load float, ptr %14, align 4, !tbaa !9
  %41 = load float, ptr %25, align 4, !tbaa !9
  %42 = fdiv float %40, %41
  %43 = load ptr, ptr %24, align 8, !tbaa !5
  %44 = call noundef ptr @_ZL19stbtt_FlattenCurvesP12stbtt_vertexifPPiS1_Pv(ptr noundef %38, i32 noundef %39, float noundef %42, ptr noundef %27, ptr noundef %26, ptr noundef %43)
  store ptr %44, ptr %28, align 8, !tbaa !5
  %45 = load ptr, ptr %28, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %62

47:                                               ; preds = %36
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = load ptr, ptr %28, align 8, !tbaa !5
  %50 = load ptr, ptr %27, align 8, !tbaa !5
  %51 = load i32, ptr %26, align 4, !tbaa !11
  %52 = load float, ptr %17, align 4, !tbaa !9
  %53 = load float, ptr %18, align 4, !tbaa !9
  %54 = load float, ptr %19, align 4, !tbaa !9
  %55 = load float, ptr %20, align 4, !tbaa !9
  %56 = load i32, ptr %21, align 4, !tbaa !11
  %57 = load i32, ptr %22, align 4, !tbaa !11
  %58 = load i32, ptr %23, align 4, !tbaa !11
  %59 = load ptr, ptr %24, align 8, !tbaa !5
  call void @_ZL16stbtt__rasterizeP13stbtt__bitmapP12stbtt__pointPiiffffiiiPv(ptr noundef %48, ptr noundef %49, ptr noundef %50, i32 noundef %51, float noundef %52, float noundef %53, float noundef %54, float noundef %55, i32 noundef %56, i32 noundef %57, i32 noundef %58, ptr noundef %59)
  %60 = load ptr, ptr %27, align 8, !tbaa !5
  call void @free(ptr noundef %60) #3
  %61 = load ptr, ptr %28, align 8, !tbaa !5
  call void @free(ptr noundef %61) #3
  br label %62

62:                                               ; preds = %47, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL19stbtt_FlattenCurvesP12stbtt_vertexifPPiS1_Pv(ptr noundef, i32 noundef, float noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL16stbtt__rasterizeP13stbtt__bitmapP12stbtt__pointPiiffffiiiPv(ptr noundef, ptr noundef, ptr noundef, i32 noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !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 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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @stbtt_Rasterize(ptr noundef %0, float noundef %1, ptr noundef %2, i32 noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, ptr noundef %11) local_unnamed_addr #2 {
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = fcmp ogt float %4, %5
  %16 = select i1 %15, float %5, float %4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #3
  %17 = fdiv float %1, %16
  %18 = call noundef ptr @_ZL19stbtt_FlattenCurvesP12stbtt_vertexifPPiS1_Pv(ptr noundef %2, i32 noundef %3, float noundef %17, ptr noundef nonnull %14, ptr noundef nonnull %13, ptr noundef %11)
  %.not = icmp eq ptr %18, null
  br i1 %.not, label %23, label %19

19:                                               ; preds = %12
  %20 = load ptr, ptr %14, align 8, !tbaa !5
  %21 = load i32, ptr %13, align 4, !tbaa !9
  call void @_ZL16stbtt__rasterizeP13stbtt__bitmapP12stbtt__pointPiiffffiiiPv(ptr noundef %0, ptr noundef nonnull %18, ptr noundef %20, i32 noundef %21, float noundef %4, float noundef %5, float noundef %6, float noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, ptr noundef %11)
  %22 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %22) #3
  call void @free(ptr noundef nonnull %18) #3
  br label %23

23:                                               ; preds = %19, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL19stbtt_FlattenCurvesP12stbtt_vertexifPPiS1_Pv(ptr noundef, i32 noundef, float noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL16stbtt__rasterizeP13stbtt__bitmapP12stbtt__pointPiiffffiiiPv(ptr noundef, ptr noundef, ptr noundef, i32 noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { 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}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass