; LLVM IR from lfarcaro/ARINC653_ARMV7A_AM335X :: Hardware (raster)

; 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: nounwind uwtable
define dso_local void @RasterSoftWareResetControlDisable(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = icmp eq i32 1, %5
  br i1 %6, label %7, label %14

7:                                                ; preds = %2
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %9 = add i32 %8, 112
  %10 = zext i32 %9 to i64
  %11 = inttoptr i64 %10 to ptr
  %12 = load volatile i32, ptr %11, align 4, !tbaa !5
  %13 = and i32 %12, -2
  store volatile i32 %13, ptr %11, align 4, !tbaa !5
  br label %37

14:                                               ; preds = %2
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp eq i32 4, %15
  br i1 %16, label %17, label %24

17:                                               ; preds = %14
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = add i32 %18, 112
  %20 = zext i32 %19 to i64
  %21 = inttoptr i64 %20 to ptr
  %22 = load volatile i32, ptr %21, align 4, !tbaa !5
  %23 = and i32 %22, -5
  store volatile i32 %23, ptr %21, align 4, !tbaa !5
  br label %36

24:                                               ; preds = %14
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = icmp eq i32 8, %25
  br i1 %26, label %27, label %34

27:                                               ; preds = %24
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = add i32 %28, 112
  %30 = zext i32 %29 to i64
  %31 = inttoptr i64 %30 to ptr
  %32 = load volatile i32, ptr %31, align 4, !tbaa !5
  %33 = and i32 %32, -9
  store volatile i32 %33, ptr %31, align 4, !tbaa !5
  br label %35

34:                                               ; preds = %24
  br label %35

35:                                               ; preds = %34, %27
  br label %36

36:                                               ; preds = %35, %17
  br label %37

37:                                               ; preds = %36, %7
  ret void
}

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; 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: nofree norecurse nounwind uwtable
define dso_local void @RasterSoftWareResetControlDisable(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  switch i32 %1, label %8 [
    i32 1, label %.sink.split
    i32 4, label %.sink.split
    i32 8, label %.sink.split
  ]

.sink.split:                                      ; preds = %2, %2, %2
  %.sink8 = xor i32 %1, -1
  %3 = add i32 %0, 112
  %4 = zext i32 %3 to i64
  %5 = inttoptr i64 %4 to ptr
  %6 = load volatile i32, ptr %5, align 4, !tbaa !5
  %7 = and i32 %6, %.sink8
  store volatile i32 %7, ptr %5, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %.sink.split, %2
  ret void
}

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass