; LLVM IR from ARM-software/Arm-2D :: examples/common/controls (meter_pointer)

; 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.meter_pointer_t = type { %union.anon, %struct.anon.8 }
%union.anon = type { %struct.spin_zoom_widget_t }
%struct.spin_zoom_widget_t = type { %struct.anon, [320 x i8] }
%struct.anon = type { %struct.spin_zoom_widget_cfg_t }
%struct.spin_zoom_widget_cfg_t = type { ptr, %struct.anon.0, ptr, %struct.anon.3, i32 }
%struct.anon.0 = type { ptr, ptr, %union.anon.1, %union.anon.2 }
%union.anon.1 = type { %struct.arm_2d_point_float_t }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.2 = type { i16 }
%struct.anon.3 = type { %struct.anon.4, %struct.anon.5, %struct.anon.6 }
%struct.anon.4 = type { float, i32 }
%struct.anon.5 = type { float, i32 }
%struct.anon.6 = type { float, %union.anon.7, float }
%union.anon.7 = type { float }
%struct.anon.8 = type { %struct.arm_2d_helper_pi_slider_cfg_t, [4 x i8], %struct.arm_2d_helper_pi_slider_t, float, [4 x i8] }
%struct.arm_2d_helper_pi_slider_cfg_t = type { i32, float, float }
%struct.arm_2d_helper_pi_slider_t = type { [40 x i8] }

@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__.meter_pointer_on_frame_start_f32 = external hidden unnamed_addr constant [72 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; 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

declare zeroext i1 @arm_2d_helper_pi_slider_f32(ptr noundef, float noundef, ptr noundef) #2

declare void @spin_zoom_widget_on_frame_start_f32(ptr noundef, float noundef, float noundef) #2

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @meter_pointer_on_frame_start_f32(ptr noundef nonnull %0, float noundef %1, float noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp ne ptr null, %8
  br i1 %9, label %10, label %11

10:                                               ; preds = %3
  br label %12

11:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 187, ptr noundef @__PRETTY_FUNCTION__.meter_pointer_on_frame_start_f32) #4
  unreachable

12:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.meter_pointer_t, ptr %13, i32 0, i32 1
  %15 = getelementptr inbounds %struct.anon.8, ptr %14, i32 0, i32 2
  %16 = load float, ptr %5, align 4, !tbaa !9
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.meter_pointer_t, ptr %17, i32 0, i32 1
  %19 = getelementptr inbounds %struct.anon.8, ptr %18, i32 0, i32 3
  %20 = call zeroext i1 @arm_2d_helper_pi_slider_f32(ptr noundef %15, float noundef %16, ptr noundef %19)
  %21 = zext i1 %20 to i8
  store i8 %21, ptr %7, align 1, !tbaa !11
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.meter_pointer_t, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.meter_pointer_t, ptr %24, i32 0, i32 1
  %26 = getelementptr inbounds %struct.anon.8, ptr %25, i32 0, i32 3
  %27 = load float, ptr %26, align 8, !tbaa !13
  %28 = load float, ptr %6, align 4, !tbaa !9
  call void @spin_zoom_widget_on_frame_start_f32(ptr noundef %23, float noundef %27, float noundef %28)
  %29 = load i8, ptr %7, align 1, !tbaa !11, !range !19, !noundef !20
  %30 = trunc i8 %29 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  ret i1 %30
}

attributes #0 = { noreturn 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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 = { noreturn nounwind }
attributes #5 = { 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 = !{!"_Bool", !7, i64 0}
!13 = !{!14, !10, i64 456}
!14 = !{!"meter_pointer_t", !7, i64 0, !15, i64 400}
!15 = !{!"", !16, i64 0, !18, i64 16, !10, i64 56}
!16 = !{!"arm_2d_helper_pi_slider_cfg_t", !17, i64 0, !10, i64 4, !10, i64 8}
!17 = !{!"int", !7, i64 0}
!18 = !{!"arm_2d_helper_pi_slider_t", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}


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

declare zeroext i1 @arm_2d_helper_pi_slider_f32(ptr noundef, float noundef, ptr noundef) local_unnamed_addr #0

declare void @spin_zoom_widget_on_frame_start_f32(ptr noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @meter_pointer_on_frame_start_f32(ptr noundef nonnull %0, float noundef %1, float noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 416
  %5 = getelementptr inbounds i8, ptr %0, i64 456
  %6 = tail call zeroext i1 @arm_2d_helper_pi_slider_f32(ptr noundef nonnull %4, float noundef %1, ptr noundef nonnull %5) #2
  %7 = load float, ptr %5, align 8, !tbaa !5
  tail call void @spin_zoom_widget_on_frame_start_f32(ptr noundef nonnull %0, float noundef %7, float noundef %2) #2
  ret i1 %6
}

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

!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, !12, i64 456}
!6 = !{!"meter_pointer_t", !7, i64 0, !9, i64 400}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"", !10, i64 0, !13, i64 16, !12, i64 56}
!10 = !{!"arm_2d_helper_pi_slider_cfg_t", !11, i64 0, !12, i64 4, !12, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"arm_2d_helper_pi_slider_t", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass