; LLVM IR from vectozavr/3dzavr :: engine/io/microui (microui)

; 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.mu_Rect = type { i32, i32, i32, i32 }
%struct.mu_Context = type { ptr, ptr, ptr, %struct.mu_Style, ptr, i32, i32, i32, %struct.mu_Rect, i32, i32, i32, ptr, ptr, ptr, [127 x i8], i32, %struct.anon, %struct.anon.0, %struct.anon.1, %struct.anon.2, %struct.anon.3, %struct.anon.4, [48 x %struct.mu_PoolItem], [48 x %struct.mu_Container], [48 x %struct.mu_PoolItem], %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, i32, i32, i32, i32, [32 x i8] }
%struct.mu_Style = type { ptr, %struct.mu_Vec2, i32, i32, i32, i32, i32, i32, [14 x %struct.mu_Color] }
%struct.mu_Color = type { i8, i8, i8, i8 }
%struct.anon = type { i32, [262144 x i8] }
%struct.anon.0 = type { i32, [32 x ptr] }
%struct.anon.1 = type { i32, [32 x ptr] }
%struct.anon.2 = type { i32, [32 x %struct.mu_Rect] }
%struct.anon.3 = type { i32, [32 x i32] }
%struct.anon.4 = type { i32, [16 x %struct.mu_Layout] }
%struct.mu_Layout = type { %struct.mu_Rect, %struct.mu_Rect, %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, [16 x i32], i32, i32, i32, i32, i32 }
%struct.mu_Container = type { ptr, ptr, %struct.mu_Rect, %struct.mu_Rect, %struct.mu_Vec2, %struct.mu_Vec2, i32, i32 }
%struct.mu_PoolItem = type { i32, i32 }
%struct.mu_Vec2 = type { i32, i32 }

; 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 uwtable
declare dso_local i32 @mu_get_id(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local { i64, i64 } @mu_layout_next(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_frame(ptr noundef, i32 noundef, i64, i64, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_text(ptr noundef, ptr noundef, i64, i64, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @mu_update_control(ptr noundef, i32 noundef, i64, i64, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @number_textbox(ptr noundef, ptr noundef, i64, i64, i32 noundef) #1

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @mu_number_ex(ptr noundef %0, ptr noundef %1, float noundef %2, ptr noundef %3, i32 noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca [128 x i8], align 16
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.mu_Rect, align 4
  %16 = alloca float, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 128, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = call i32 @mu_get_id(ptr noundef %18, ptr noundef %8, i32 noundef 8)
  store i32 %19, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #4
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = call { i64, i64 } @mu_layout_next(ptr noundef %20)
  %22 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %23 = extractvalue { i64, i64 } %21, 0
  store i64 %23, ptr %22, align 4
  %24 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %25 = extractvalue { i64, i64 } %21, 1
  store i64 %25, ptr %24, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = load float, ptr %26, align 4, !tbaa !9
  store float %27, ptr %16, align 4, !tbaa !9
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load i32, ptr %14, align 4, !tbaa !11
  %31 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %32 = load i64, ptr %31, align 4
  %33 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %34 = load i64, ptr %33, align 4
  %35 = call i32 @number_textbox(ptr noundef %28, ptr noundef %29, i64 %32, i64 %34, i32 noundef %30)
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %39

37:                                               ; preds = %5
  %38 = load i32, ptr %13, align 4, !tbaa !11
  store i32 %38, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %97

39:                                               ; preds = %5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = load i32, ptr %14, align 4, !tbaa !11
  %42 = load i32, ptr %11, align 4, !tbaa !11
  %43 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %44 = load i64, ptr %43, align 4
  %45 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %46 = load i64, ptr %45, align 4
  call void @mu_update_control(ptr noundef %40, i32 noundef %41, i64 %44, i64 %46, i32 noundef %42)
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.mu_Context, ptr %47, i32 0, i32 6
  %49 = load i32, ptr %48, align 4, !tbaa !13
  %50 = load i32, ptr %14, align 4, !tbaa !11
  %51 = icmp eq i32 %49, %50
  br i1 %51, label %52, label %67

52:                                               ; preds = %39
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mu_Context, ptr %53, i32 0, i32 30
  %55 = load i32, ptr %54, align 8, !tbaa !20
  %56 = icmp eq i32 %55, 1
  br i1 %56, label %57, label %67

57:                                               ; preds = %52
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.mu_Context, ptr %58, i32 0, i32 28
  %60 = getelementptr inbounds %struct.mu_Vec2, ptr %59, i32 0, i32 0
  %61 = load i32, ptr %60, align 8, !tbaa !21
  %62 = sitofp i32 %61 to float
  %63 = load float, ptr %9, align 4, !tbaa !9
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = call float @llvm.fmuladd.f32(float %62, float %63, float %65)
  store float %66, ptr %64, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %57, %52, %39
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = load float, ptr %68, align 4, !tbaa !9
  %70 = load float, ptr %16, align 4, !tbaa !9
  %71 = fcmp une float %69, %70
  br i1 %71, label %72, label %75

72:                                               ; preds = %67
  %73 = load i32, ptr %13, align 4, !tbaa !11
  %74 = or i32 %73, 4
  store i32 %74, ptr %13, align 4, !tbaa !11
  br label %75

75:                                               ; preds = %72, %67
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load i32, ptr %14, align 4, !tbaa !11
  %78 = load i32, ptr %11, align 4, !tbaa !11
  %79 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %80 = load i64, ptr %79, align 4
  %81 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %82 = load i64, ptr %81, align 4
  call void @mu_draw_control_frame(ptr noundef %76, i32 noundef %77, i64 %80, i64 %82, i32 noundef 9, i32 noundef %78)
  %83 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = load float, ptr %85, align 4, !tbaa !9
  %87 = fpext float %86 to double
  %88 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %83, ptr noundef %84, double noundef %87) #4
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds [128 x i8], ptr %12, i64 0, i64 0
  %91 = load i32, ptr %11, align 4, !tbaa !11
  %92 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %93 = load i64, ptr %92, align 4
  %94 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %95 = load i64, ptr %94, align 4
  call void @mu_draw_control_text(ptr noundef %89, ptr noundef %90, i64 %93, i64 %95, i32 noundef 0, i32 noundef %91)
  %96 = load i32, ptr %13, align 4, !tbaa !11
  store i32 %96, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %97

97:                                               ; preds = %75, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr %12) #4
  %98 = load i32, ptr %6, align 4
  ret i32 %98
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 132}
!14 = !{!"mu_Context", !6, i64 0, !6, i64 8, !6, i64 16, !15, i64 24, !6, i64 120, !12, i64 128, !12, i64 132, !12, i64 136, !17, i64 140, !12, i64 156, !12, i64 160, !12, i64 164, !6, i64 168, !6, i64 176, !6, i64 184, !7, i64 192, !12, i64 320, !18, i64 324, !19, i64 262472, !19, i64 262736, !18, i64 263000, !18, i64 263516, !18, i64 263648, !7, i64 265892, !7, i64 266280, !7, i64 269736, !16, i64 270120, !16, i64 270128, !16, i64 270136, !16, i64 270144, !12, i64 270152, !12, i64 270156, !12, i64 270160, !12, i64 270164, !7, i64 270168}
!15 = !{!"", !6, i64 0, !16, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !7, i64 40}
!16 = !{!"", !12, i64 0, !12, i64 4}
!17 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!18 = !{!"", !12, i64 0, !7, i64 4}
!19 = !{!"", !12, i64 0, !7, i64 8}
!20 = !{!14, !12, i64 270152}
!21 = !{!14, !12, i64 270136}


; 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: nounwind uwtable
declare dso_local i32 @mu_get_id(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local { i64, i64 } @mu_layout_next(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_frame(ptr noundef, i32 noundef, i64, i64, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_text(ptr noundef, ptr noundef, i64, i64, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @mu_update_control(ptr noundef, i32 noundef, i64, i64, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @number_textbox(ptr noundef, ptr noundef, i64, i64, i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 5) i32 @mu_number_ex(ptr noundef %0, ptr noundef %1, float noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = alloca ptr, align 8
  %7 = alloca [128 x i8], align 16
  store ptr %1, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %7) #4
  %8 = call i32 @mu_get_id(ptr noundef %0, ptr noundef nonnull %6, i32 noundef 8)
  %9 = call { i64, i64 } @mu_layout_next(ptr noundef %0)
  %10 = extractvalue { i64, i64 } %9, 0
  %11 = extractvalue { i64, i64 } %9, 1
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = call i32 @number_textbox(ptr noundef %0, ptr noundef nonnull %12, i64 %10, i64 %11, i32 noundef %8)
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %37

15:                                               ; preds = %5
  call void @mu_update_control(ptr noundef %0, i32 noundef %8, i64 %10, i64 %11, i32 noundef %4)
  %16 = getelementptr inbounds i8, ptr %0, i64 132
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = icmp eq i32 %17, %8
  br i1 %18, label %19, label %._crit_edge

._crit_edge:                                      ; preds = %15
  %.pre = load ptr, ptr %6, align 8, !tbaa !5
  br label %29

19:                                               ; preds = %15
  %20 = getelementptr inbounds i8, ptr %0, i64 270152
  %21 = load i32, ptr %20, align 8, !tbaa !19
  %22 = icmp eq i32 %21, 1
  %.pre29 = load ptr, ptr %6, align 8, !tbaa !5
  br i1 %22, label %23, label %29

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %0, i64 270136
  %25 = load i32, ptr %24, align 8, !tbaa !20
  %26 = sitofp i32 %25 to float
  %27 = load float, ptr %.pre29, align 4, !tbaa !9
  %28 = call float @llvm.fmuladd.f32(float %26, float %2, float %27)
  store float %28, ptr %.pre29, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %._crit_edge, %23, %19
  %30 = phi ptr [ %.pre, %._crit_edge ], [ %.pre29, %23 ], [ %.pre29, %19 ]
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = fcmp une float %31, %13
  %.028 = select i1 %32, i32 4, i32 0
  call void @mu_draw_control_frame(ptr noundef nonnull %0, i32 noundef %8, i64 %10, i64 %11, i32 noundef 9, i32 noundef %4)
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = load float, ptr %33, align 4, !tbaa !9
  %35 = fpext float %34 to double
  %36 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) %3, double noundef %35) #4
  call void @mu_draw_control_text(ptr noundef nonnull %0, ptr noundef nonnull %7, i64 %10, i64 %11, i32 noundef 0, i32 noundef %4)
  br label %37

37:                                               ; preds = %5, %29
  %.0 = phi i32 [ %.028, %29 ], [ 0, %5 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %7) #4
  ret i32 %.0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nofree 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !15, i64 132}
!12 = !{!"mu_Context", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 120, !15, i64 128, !15, i64 132, !15, i64 136, !16, i64 140, !15, i64 156, !15, i64 160, !15, i64 164, !6, i64 168, !6, i64 176, !6, i64 184, !7, i64 192, !15, i64 320, !17, i64 324, !18, i64 262472, !18, i64 262736, !17, i64 263000, !17, i64 263516, !17, i64 263648, !7, i64 265892, !7, i64 266280, !7, i64 269736, !14, i64 270120, !14, i64 270128, !14, i64 270136, !14, i64 270144, !15, i64 270152, !15, i64 270156, !15, i64 270160, !15, i64 270164, !7, i64 270168}
!13 = !{!"", !6, i64 0, !14, i64 8, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !7, i64 40}
!14 = !{!"", !15, i64 0, !15, i64 4}
!15 = !{!"int", !7, i64 0}
!16 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!17 = !{!"", !15, i64 0, !7, i64 4}
!18 = !{!"", !15, i64 0, !7, i64 8}
!19 = !{!12, !15, i64 270152}
!20 = !{!12, !15, i64 270136}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass