; LLVM IR from aap/pdp6 :: emu (apr)

; 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.Apr = type { %struct.Device, %struct.IOBus, %struct.Membus, i32, %struct.AprState, %struct.AprState, i32, i64, i64, i32, i32, i32, i8, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, ptr, ptr, i32, i8, [20 x %struct.TPulse], ptr, ptr }
%struct.Device = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.IOBus = type { i64, i64, i64, i64, i64, i64, i32, [128 x %struct.Busdev] }
%struct.Busdev = type { ptr, ptr, i8 }
%struct.Membus = type { i64, i64, i64, i64, i64, i64, ptr, [16 x ptr] }
%struct.AprState = type { i64, i64, i64 }
%struct.TPulse = type { ptr, ptr, i32 }

; Function Attrs: nounwind uwtable
define dso_local void @ar_jfcl_clr(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.Apr, ptr %3, i32 0, i32 6
  %5 = load i32, ptr %4, align 8, !tbaa !9
  %6 = and i32 %5, 256
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %8, label %11

8:                                                ; preds = %1
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.Apr, ptr %9, i32 0, i32 59
  store i8 0, ptr %10, align 1, !tbaa !18
  br label %11

11:                                               ; preds = %8, %1
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.Apr, ptr %12, i32 0, i32 6
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = and i32 %14, 128
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %20

17:                                               ; preds = %11
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Apr, ptr %18, i32 0, i32 60
  store i8 0, ptr %19, align 2, !tbaa !19
  br label %20

20:                                               ; preds = %17, %11
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Apr, ptr %21, i32 0, i32 6
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = and i32 %23, 64
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %29

26:                                               ; preds = %20
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.Apr, ptr %27, i32 0, i32 61
  store i8 0, ptr %28, align 1, !tbaa !20
  br label %29

29:                                               ; preds = %26, %20
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.Apr, ptr %30, i32 0, i32 6
  %32 = load i32, ptr %31, align 8, !tbaa !9
  %33 = and i32 %32, 32
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %38

35:                                               ; preds = %29
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Apr, ptr %36, i32 0, i32 58
  store i8 0, ptr %37, align 4, !tbaa !21
  br label %38

38:                                               ; preds = %35, %29
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  call void @recalc_cpa_req(ptr noundef %39)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @recalc_cpa_req(ptr noundef) #0

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !14, i64 3432}
!10 = !{!"Apr", !11, i64 0, !12, i64 64, !15, i64 3192, !14, i64 3376, !16, i64 3384, !16, i64 3408, !14, i64 3432, !13, i64 3440, !13, i64 3448, !14, i64 3456, !14, i64 3460, !14, i64 3464, !7, i64 3468, !17, i64 3470, !17, i64 3472, !7, i64 3474, !7, i64 3475, !7, i64 3476, !7, i64 3477, !7, i64 3478, !7, i64 3479, !7, i64 3480, !7, i64 3481, !7, i64 3482, !7, i64 3483, !7, i64 3484, !7, i64 3485, !7, i64 3486, !7, i64 3487, !7, i64 3488, !7, i64 3489, !7, i64 3490, !7, i64 3491, !7, i64 3492, !7, i64 3493, !7, i64 3494, !7, i64 3495, !7, i64 3496, !7, i64 3497, !7, i64 3498, !7, i64 3499, !7, i64 3500, !7, i64 3501, !7, i64 3502, !14, i64 3504, !14, i64 3508, !7, i64 3512, !7, i64 3513, !7, i64 3514, !7, i64 3515, !7, i64 3516, !7, i64 3517, !7, i64 3518, !7, i64 3519, !7, i64 3520, !7, i64 3521, !7, i64 3522, !7, i64 3523, !7, i64 3524, !7, i64 3525, !7, i64 3526, !7, i64 3527, !7, i64 3528, !7, i64 3529, !7, i64 3530, !7, i64 3531, !7, i64 3532, !7, i64 3533, !7, i64 3534, !7, i64 3535, !7, i64 3536, !7, i64 3537, !7, i64 3538, !7, i64 3539, !7, i64 3540, !7, i64 3541, !7, i64 3542, !7, i64 3543, !7, i64 3544, !7, i64 3545, !7, i64 3546, !7, i64 3547, !7, i64 3548, !7, i64 3549, !7, i64 3550, !7, i64 3551, !14, i64 3552, !7, i64 3556, !7, i64 3557, !7, i64 3558, !7, i64 3559, !7, i64 3560, !7, i64 3561, !7, i64 3562, !7, i64 3563, !7, i64 3564, !7, i64 3565, !7, i64 3566, !7, i64 3567, !7, i64 3568, !7, i64 3569, !7, i64 3570, !7, i64 3571, !7, i64 3572, !7, i64 3573, !7, i64 3574, !7, i64 3575, !7, i64 3576, !7, i64 3577, !7, i64 3578, !7, i64 3579, !7, i64 3580, !7, i64 3581, !7, i64 3582, !7, i64 3583, !7, i64 3584, !7, i64 3585, !7, i64 3586, !7, i64 3587, !7, i64 3588, !7, i64 3589, !7, i64 3590, !7, i64 3591, !7, i64 3592, !7, i64 3593, !7, i64 3594, !7, i64 3595, !7, i64 3596, !7, i64 3597, !7, i64 3598, !7, i64 3599, !7, i64 3600, !7, i64 3601, !7, i64 3602, !7, i64 3603, !7, i64 3604, !7, i64 3605, !7, i64 3606, !7, i64 3607, !7, i64 3608, !7, i64 3609, !7, i64 3610, !7, i64 3611, !7, i64 3612, !7, i64 3613, !7, i64 3614, !14, i64 3616, !14, i64 3620, !14, i64 3624, !7, i64 3628, !7, i64 3629, !7, i64 3630, !7, i64 3631, !7, i64 3632, !7, i64 3633, !7, i64 3634, !7, i64 3635, !7, i64 3636, !7, i64 3637, !7, i64 3638, !7, i64 3639, !7, i64 3640, !7, i64 3641, !7, i64 3642, !14, i64 3644, !7, i64 3648, !7, i64 3649, !7, i64 3650, !7, i64 3651, !7, i64 3652, !7, i64 3653, !7, i64 3654, !7, i64 3655, !7, i64 3656, !7, i64 3657, !7, i64 3658, !6, i64 3664, !6, i64 3672, !14, i64 3680, !7, i64 3684, !7, i64 3688, !6, i64 4168, !6, i64 4176}
!11 = !{!"Device", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!12 = !{!"IOBus", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !14, i64 48, !7, i64 56}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"Membus", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !6, i64 48, !7, i64 56}
!16 = !{!"AprState", !13, i64 0, !13, i64 8, !13, i64 16}
!17 = !{!"short", !7, i64 0}
!18 = !{!10, !7, i64 3525}
!19 = !{!10, !7, i64 3526}
!20 = !{!10, !7, i64 3527}
!21 = !{!10, !7, i64 3524}


; 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 void @ar_jfcl_clr(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 3432
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = and i32 %3, 256
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %7, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 3525
  store i8 0, ptr %6, align 1, !tbaa !17
  br label %7

7:                                                ; preds = %5, %1
  %8 = and i32 %3, 128
  %.not9 = icmp eq i32 %8, 0
  br i1 %.not9, label %11, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 3526
  store i8 0, ptr %10, align 2, !tbaa !18
  br label %11

11:                                               ; preds = %9, %7
  %12 = and i32 %3, 64
  %.not10 = icmp eq i32 %12, 0
  br i1 %.not10, label %15, label %13

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %0, i64 3527
  store i8 0, ptr %14, align 1, !tbaa !19
  br label %15

15:                                               ; preds = %13, %11
  %16 = and i32 %3, 32
  %.not11 = icmp eq i32 %16, 0
  br i1 %.not11, label %19, label %17

17:                                               ; preds = %15
  %18 = getelementptr inbounds i8, ptr %0, i64 3524
  store i8 0, ptr %18, align 4, !tbaa !20
  br label %19

19:                                               ; preds = %17, %15
  tail call void @recalc_cpa_req(ptr noundef nonnull %0)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @recalc_cpa_req(ptr noundef) local_unnamed_addr #0

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, !13, i64 3432}
!6 = !{!"Apr", !7, i64 0, !11, i64 64, !14, i64 3192, !13, i64 3376, !15, i64 3384, !15, i64 3408, !13, i64 3432, !12, i64 3440, !12, i64 3448, !13, i64 3456, !13, i64 3460, !13, i64 3464, !9, i64 3468, !16, i64 3470, !16, i64 3472, !9, i64 3474, !9, i64 3475, !9, i64 3476, !9, i64 3477, !9, i64 3478, !9, i64 3479, !9, i64 3480, !9, i64 3481, !9, i64 3482, !9, i64 3483, !9, i64 3484, !9, i64 3485, !9, i64 3486, !9, i64 3487, !9, i64 3488, !9, i64 3489, !9, i64 3490, !9, i64 3491, !9, i64 3492, !9, i64 3493, !9, i64 3494, !9, i64 3495, !9, i64 3496, !9, i64 3497, !9, i64 3498, !9, i64 3499, !9, i64 3500, !9, i64 3501, !9, i64 3502, !13, i64 3504, !13, i64 3508, !9, i64 3512, !9, i64 3513, !9, i64 3514, !9, i64 3515, !9, i64 3516, !9, i64 3517, !9, i64 3518, !9, i64 3519, !9, i64 3520, !9, i64 3521, !9, i64 3522, !9, i64 3523, !9, i64 3524, !9, i64 3525, !9, i64 3526, !9, i64 3527, !9, i64 3528, !9, i64 3529, !9, i64 3530, !9, i64 3531, !9, i64 3532, !9, i64 3533, !9, i64 3534, !9, i64 3535, !9, i64 3536, !9, i64 3537, !9, i64 3538, !9, i64 3539, !9, i64 3540, !9, i64 3541, !9, i64 3542, !9, i64 3543, !9, i64 3544, !9, i64 3545, !9, i64 3546, !9, i64 3547, !9, i64 3548, !9, i64 3549, !9, i64 3550, !9, i64 3551, !13, i64 3552, !9, i64 3556, !9, i64 3557, !9, i64 3558, !9, i64 3559, !9, i64 3560, !9, i64 3561, !9, i64 3562, !9, i64 3563, !9, i64 3564, !9, i64 3565, !9, i64 3566, !9, i64 3567, !9, i64 3568, !9, i64 3569, !9, i64 3570, !9, i64 3571, !9, i64 3572, !9, i64 3573, !9, i64 3574, !9, i64 3575, !9, i64 3576, !9, i64 3577, !9, i64 3578, !9, i64 3579, !9, i64 3580, !9, i64 3581, !9, i64 3582, !9, i64 3583, !9, i64 3584, !9, i64 3585, !9, i64 3586, !9, i64 3587, !9, i64 3588, !9, i64 3589, !9, i64 3590, !9, i64 3591, !9, i64 3592, !9, i64 3593, !9, i64 3594, !9, i64 3595, !9, i64 3596, !9, i64 3597, !9, i64 3598, !9, i64 3599, !9, i64 3600, !9, i64 3601, !9, i64 3602, !9, i64 3603, !9, i64 3604, !9, i64 3605, !9, i64 3606, !9, i64 3607, !9, i64 3608, !9, i64 3609, !9, i64 3610, !9, i64 3611, !9, i64 3612, !9, i64 3613, !9, i64 3614, !13, i64 3616, !13, i64 3620, !13, i64 3624, !9, i64 3628, !9, i64 3629, !9, i64 3630, !9, i64 3631, !9, i64 3632, !9, i64 3633, !9, i64 3634, !9, i64 3635, !9, i64 3636, !9, i64 3637, !9, i64 3638, !9, i64 3639, !9, i64 3640, !9, i64 3641, !9, i64 3642, !13, i64 3644, !9, i64 3648, !9, i64 3649, !9, i64 3650, !9, i64 3651, !9, i64 3652, !9, i64 3653, !9, i64 3654, !9, i64 3655, !9, i64 3656, !9, i64 3657, !9, i64 3658, !8, i64 3664, !8, i64 3672, !13, i64 3680, !9, i64 3684, !9, i64 3688, !8, i64 4168, !8, i64 4176}
!7 = !{!"Device", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"IOBus", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !13, i64 48, !9, i64 56}
!12 = !{!"long", !9, i64 0}
!13 = !{!"int", !9, i64 0}
!14 = !{!"Membus", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !8, i64 48, !9, i64 56}
!15 = !{!"AprState", !12, i64 0, !12, i64 8, !12, i64 16}
!16 = !{!"short", !9, i64 0}
!17 = !{!6, !9, i64 3525}
!18 = !{!6, !9, i64 3526}
!19 = !{!6, !9, i64 3527}
!20 = !{!6, !9, i64 3524}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,SROAPass,TailCallElimPass