; 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 = external hidden unnamed_addr constant [70 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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @meter_pointer_on_frame_start(ptr noundef nonnull %0, i32 noundef %1, float noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !11
  %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 168, ptr noundef @__PRETTY_FUNCTION__.meter_pointer_on_frame_start) #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 i32, ptr %5, align 4, !tbaa !9
  %17 = sitofp i32 %16 to float
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.meter_pointer_t, ptr %18, i32 0, i32 1
  %20 = getelementptr inbounds %struct.anon.8, ptr %19, i32 0, i32 3
  %21 = call zeroext i1 @arm_2d_helper_pi_slider_f32(ptr noundef %15, float noundef %17, ptr noundef %20)
  %22 = zext i1 %21 to i8
  store i8 %22, ptr %7, align 1, !tbaa !13
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.meter_pointer_t, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.meter_pointer_t, ptr %25, i32 0, i32 1
  %27 = getelementptr inbounds %struct.anon.8, ptr %26, i32 0, i32 3
  %28 = load float, ptr %27, align 8, !tbaa !15
  %29 = load float, ptr %6, align 4, !tbaa !11
  call void @spin_zoom_widget_on_frame_start_f32(ptr noundef %24, float noundef %28, float noundef %29)
  %30 = load i8, ptr %7, align 1, !tbaa !13, !range !20, !noundef !21
  %31 = trunc i8 %30 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  ret i1 %31
}

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

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

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 = { 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 #3 = { "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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !12, i64 456}
!16 = !{!"meter_pointer_t", !7, i64 0, !17, i64 400}
!17 = !{!"", !18, i64 0, !19, i64 16, !12, i64 56}
!18 = !{!"arm_2d_helper_pi_slider_cfg_t", !10, i64 0, !12, i64 4, !12, i64 8}
!19 = !{!"arm_2d_helper_pi_slider_t", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}


; 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: nounwind uwtable
define dso_local zeroext i1 @meter_pointer_on_frame_start(ptr noundef nonnull %0, i32 noundef %1, float noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 416
  %5 = sitofp i32 %1 to float
  %6 = getelementptr inbounds i8, ptr %0, i64 456
  %7 = tail call zeroext i1 @arm_2d_helper_pi_slider_f32(ptr noundef nonnull %4, float noundef %5, ptr noundef nonnull %6) #2
  %8 = load float, ptr %6, align 8, !tbaa !5
  tail call void @spin_zoom_widget_on_frame_start_f32(ptr noundef nonnull %0, float noundef %8, float noundef %2) #2
  ret i1 %7
}

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

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

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