; LLVM IR from ARM-software/Arm-2D :: Helper/Source/arm_2d_helper_list.ll_ (arm_2d_list_core_indicator_pi_mode_config)

; 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.__arm_2d_list_core_t = type { %struct.anon, %struct.anon.0, %struct.anon.22 }
%struct.anon = type { %struct.__arm_2d_list_core_cfg_t }
%struct.__arm_2d_list_core_cfg_t = type { %struct.arm_2d_size_t, ptr, %union.anon, ptr, ptr, ptr, i32, ptr, i16, i16, i16, i16, ptr }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon = type { ptr }
%struct.anon.0 = type { %struct.anon.1, %struct.anon.19 }
%struct.anon.1 = type { %struct.arm_2d_tile_t, %struct.arm_2d_tile_t, %struct.__arm_2d_list_work_area_t, i8, %union.anon.17 }
%struct.arm_2d_tile_t = type { %union.anon.2, %union.anon.13, %union.anon.16 }
%union.anon.2 = type { %struct.anon.3 }
%struct.anon.3 = type { i8, %union.arm_2d_color_info_t, %union.anon.6 }
%union.arm_2d_color_info_t = type { %struct.anon.4 }
%struct.anon.4 = type { i8 }
%union.anon.6 = type { i16 }
%union.anon.13 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.14, %union.anon.15 }
%union.anon.14 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.15 = type { %struct.arm_2d_size_t }
%union.anon.16 = type { ptr }
%struct.__arm_2d_list_work_area_t = type { ptr, %struct.arm_2d_region_t, %struct.arm_2d_list_item_param_t, i32 }
%struct.arm_2d_list_item_param_t = type { i8, i8, i16 }
%union.anon.17 = type { %struct.anon.18 }
%struct.anon.18 = type { i16 }
%struct.anon.19 = type { %struct.arm_2d_tile_t, i64, i64, %struct.arm_2d_helper_pi_slider_t, %struct.anon.20, i16, i8, i8, %struct.anon.21 }
%struct.arm_2d_helper_pi_slider_t = type { [40 x i8] }
%struct.anon.20 = type { i32, i32, i32, %struct.arm_2d_region_t }
%struct.anon.21 = type { i16, i32 }
%struct.anon.22 = type { i8, i8, i16, i32, %union.anon.23 }
%union.anon.23 = type { %struct.anon.24 }
%struct.anon.24 = type { i16, i16, i16, i16 }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [88 x i8], align 1
@__PRETTY_FUNCTION__.__arm_2d_list_core_indicator_pi_mode_config = external hidden unnamed_addr constant [114 x i8], align 1

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

declare ptr @arm_2d_helper_pi_slider_init(ptr noundef, ptr noundef, i16 noundef signext) #1

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

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

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

11:                                               ; preds = %3
  br label %13

12:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 796, ptr noundef @__PRETTY_FUNCTION__.__arm_2d_list_core_indicator_pi_mode_config) #4
  unreachable

13:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.__arm_2d_list_core_t, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %struct.anon, ptr %15, i32 0, i32 0
  %17 = getelementptr inbounds %struct.__arm_2d_list_core_cfg_t, ptr %16, i32 0, i32 11
  %18 = load i16, ptr %17, align 2
  %19 = lshr i16 %18, 2
  %20 = and i16 %19, 1
  %21 = icmp ne i16 %20, 0
  %22 = zext i1 %21 to i8
  store i8 %22, ptr %7, align 1, !tbaa !9
  %23 = load i8, ptr %5, align 1, !tbaa !9, !range !11, !noundef !12
  %24 = trunc i8 %23 to i1
  br i1 %24, label %33, label %25

25:                                               ; preds = %13
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.__arm_2d_list_core_t, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %struct.anon, ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds %struct.__arm_2d_list_core_cfg_t, ptr %28, i32 0, i32 11
  %30 = load i16, ptr %29, align 2
  %31 = and i16 %30, -5
  %32 = or i16 %31, 0
  store i16 %32, ptr %29, align 2
  br label %65

33:                                               ; preds = %13
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = icmp ne ptr null, %34
  br i1 %35, label %36, label %64

36:                                               ; preds = %33
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.__arm_2d_list_core_t, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %struct.anon, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %struct.__arm_2d_list_core_cfg_t, ptr %39, i32 0, i32 11
  %41 = load i16, ptr %40, align 2
  %42 = and i16 %41, -5
  %43 = or i16 %42, 4
  store i16 %43, ptr %40, align 2
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = icmp ne ptr null, %44
  br i1 %45, label %46, label %63

46:                                               ; preds = %36
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.__arm_2d_list_core_t, ptr %48, i32 0, i32 0
  %50 = getelementptr inbounds %struct.anon, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds %struct.__arm_2d_list_core_cfg_t, ptr %50, i32 0, i32 12
  store ptr %47, ptr %51, align 8, !tbaa !13
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.__arm_2d_list_core_t, ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds %struct.anon.0, ptr %53, i32 0, i32 1
  %55 = getelementptr inbounds %struct.anon.19, ptr %54, i32 0, i32 3
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.__arm_2d_list_core_t, ptr %57, i32 0, i32 2
  %59 = getelementptr inbounds %struct.anon.22, ptr %58, i32 0, i32 3
  %60 = load i32, ptr %59, align 4, !tbaa !32
  %61 = trunc i32 %60 to i16
  %62 = call ptr @arm_2d_helper_pi_slider_init(ptr noundef %55, ptr noundef %56, i16 noundef signext %61)
  br label %63

63:                                               ; preds = %46, %36
  br label %64

64:                                               ; preds = %63, %33
  br label %65

65:                                               ; preds = %64, %25
  %66 = load i8, ptr %7, align 1, !tbaa !9, !range !11, !noundef !12
  %67 = trunc i8 %66 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  ret i1 %67
}

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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !6, i64 72}
!14 = !{!"__arm_2d_list_core_t", !15, i64 0, !20, i64 80, !31, i64 272}
!15 = !{!"", !16, i64 0}
!16 = !{!"__arm_2d_list_core_cfg_t", !17, i64 0, !6, i64 8, !7, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !19, i64 48, !6, i64 56, !18, i64 64, !18, i64 66, !18, i64 68, !18, i64 70, !18, i64 70, !18, i64 70, !6, i64 72}
!17 = !{!"arm_2d_size_t", !18, i64 0, !18, i64 2}
!18 = !{!"short", !7, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"", !21, i64 0, !26, i64 80}
!21 = !{!"", !22, i64 0, !22, i64 24, !23, i64 48, !7, i64 72, !7, i64 74}
!22 = !{!"arm_2d_tile_t", !7, i64 0, !7, i64 4, !7, i64 16}
!23 = !{!"__arm_2d_list_work_area_t", !6, i64 0, !24, i64 8, !25, i64 16, !19, i64 20}
!24 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!25 = !{!"arm_2d_list_item_param_t", !7, i64 0, !7, i64 0, !7, i64 1, !18, i64 2}
!26 = !{!"", !22, i64 0, !27, i64 24, !27, i64 32, !28, i64 40, !29, i64 80, !18, i64 100, !7, i64 102, !7, i64 103, !7, i64 103, !7, i64 103, !30, i64 104}
!27 = !{!"long", !7, i64 0}
!28 = !{!"arm_2d_helper_pi_slider_t", !7, i64 0}
!29 = !{!"", !19, i64 0, !19, i64 4, !19, i64 8, !24, i64 12}
!30 = !{!"", !18, i64 0, !19, i64 4}
!31 = !{!"", !7, i64 0, !10, i64 1, !18, i64 2, !19, i64 4, !7, i64 8}
!32 = !{!14, !19, i64 276}


; 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 ptr @arm_2d_helper_pi_slider_init(ptr noundef, ptr noundef, i16 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @__arm_2d_list_core_indicator_pi_mode_config(ptr noundef nonnull %0, i1 noundef zeroext %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 70
  %5 = load i16, ptr %4, align 2
  br i1 %1, label %8, label %6

6:                                                ; preds = %3
  %7 = and i16 %5, -5
  store i16 %7, ptr %4, align 2
  br label %17

8:                                                ; preds = %3
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %17, label %9

9:                                                ; preds = %8
  %10 = or i16 %5, 4
  store i16 %10, ptr %4, align 2
  %11 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %2, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 200
  %13 = getelementptr inbounds i8, ptr %0, i64 276
  %14 = load i32, ptr %13, align 4, !tbaa !28
  %15 = trunc i32 %14 to i16
  %16 = tail call ptr @arm_2d_helper_pi_slider_init(ptr noundef nonnull %12, ptr noundef nonnull %2, i16 noundef signext %15) #2
  br label %17

17:                                               ; preds = %8, %9, %6
  %18 = and i16 %5, 4
  %19 = icmp ne i16 %18, 0
  ret i1 %19
}

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, !13, i64 72}
!6 = !{!"__arm_2d_list_core_t", !7, i64 0, !15, i64 80, !26, i64 272}
!7 = !{!"", !8, i64 0}
!8 = !{!"__arm_2d_list_core_cfg_t", !9, i64 0, !13, i64 8, !11, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !14, i64 48, !13, i64 56, !10, i64 64, !10, i64 66, !10, i64 68, !10, i64 70, !10, i64 70, !10, i64 70, !13, i64 72}
!9 = !{!"arm_2d_size_t", !10, i64 0, !10, i64 2}
!10 = !{!"short", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = !{!"any pointer", !11, i64 0}
!14 = !{!"int", !11, i64 0}
!15 = !{!"", !16, i64 0, !21, i64 80}
!16 = !{!"", !17, i64 0, !17, i64 24, !18, i64 48, !11, i64 72, !11, i64 74}
!17 = !{!"arm_2d_tile_t", !11, i64 0, !11, i64 4, !11, i64 16}
!18 = !{!"__arm_2d_list_work_area_t", !13, i64 0, !19, i64 8, !20, i64 16, !14, i64 20}
!19 = !{!"arm_2d_region_t", !11, i64 0, !11, i64 4}
!20 = !{!"arm_2d_list_item_param_t", !11, i64 0, !11, i64 0, !11, i64 1, !10, i64 2}
!21 = !{!"", !17, i64 0, !22, i64 24, !22, i64 32, !23, i64 40, !24, i64 80, !10, i64 100, !11, i64 102, !11, i64 103, !11, i64 103, !11, i64 103, !25, i64 104}
!22 = !{!"long", !11, i64 0}
!23 = !{!"arm_2d_helper_pi_slider_t", !11, i64 0}
!24 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !19, i64 12}
!25 = !{!"", !10, i64 0, !14, i64 4}
!26 = !{!"", !11, i64 0, !27, i64 1, !10, i64 2, !14, i64 4, !11, i64 8}
!27 = !{!"_Bool", !11, i64 0}
!28 = !{!6, !14, i64 276}


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