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

; 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 @PWMSSModuleClkConfig(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  %3 = load volatile i32, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  %4 = or i32 %3, 2
  store volatile i32 %4, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  br label %5

5:                                                ; preds = %9, %1
  %6 = load volatile i32, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  %7 = and i32 %6, 3
  %8 = icmp ne i32 %7, 2
  br i1 %8, label %9, label %10

9:                                                ; preds = %5
  br label %5, !llvm.loop !9

10:                                               ; preds = %5
  %11 = load volatile i32, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  %12 = or i32 %11, 2
  store volatile i32 %12, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  br label %13

13:                                               ; preds = %17, %10
  %14 = load volatile i32, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  %15 = and i32 %14, 3
  %16 = icmp ne i32 %15, 2
  br i1 %16, label %17, label %18

17:                                               ; preds = %13
  br label %13, !llvm.loop !11

18:                                               ; preds = %13
  %19 = load volatile i32, ptr inttoptr (i64 1155530972 to ptr), align 4, !tbaa !5
  %20 = or i32 %19, 2
  store volatile i32 %20, ptr inttoptr (i64 1155530972 to ptr), align 4, !tbaa !5
  br label %21

21:                                               ; preds = %25, %18
  %22 = load volatile i32, ptr inttoptr (i64 1155530972 to ptr), align 4, !tbaa !5
  %23 = and i32 %22, 3
  %24 = icmp ne i32 %23, 2
  br i1 %24, label %25, label %26

25:                                               ; preds = %21
  br label %21, !llvm.loop !12

26:                                               ; preds = %21
  %27 = load volatile i32, ptr inttoptr (i64 1155530976 to ptr), align 4, !tbaa !5
  %28 = or i32 %27, 2
  store volatile i32 %28, ptr inttoptr (i64 1155530976 to ptr), align 4, !tbaa !5
  br label %29

29:                                               ; preds = %33, %26
  %30 = load volatile i32, ptr inttoptr (i64 1155530976 to ptr), align 4, !tbaa !5
  %31 = and i32 %30, 3
  %32 = icmp ne i32 %31, 2
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  br label %29, !llvm.loop !13

34:                                               ; preds = %29
  %35 = load volatile i32, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  %36 = or i32 %35, 2
  store volatile i32 %36, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  br label %37

37:                                               ; preds = %41, %34
  %38 = load volatile i32, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  %39 = and i32 %38, 3
  %40 = icmp ne i32 %39, 2
  br i1 %40, label %41, label %42

41:                                               ; preds = %37
  br label %37, !llvm.loop !14

42:                                               ; preds = %37
  %43 = load volatile i32, ptr inttoptr (i64 1155530752 to ptr), align 4, !tbaa !5
  %44 = or i32 %43, 2
  store volatile i32 %44, ptr inttoptr (i64 1155530752 to ptr), align 4, !tbaa !5
  br label %45

45:                                               ; preds = %49, %42
  %46 = load volatile i32, ptr inttoptr (i64 1155530752 to ptr), align 4, !tbaa !5
  %47 = and i32 %46, 3
  %48 = icmp ne i32 %47, 2
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  br label %45, !llvm.loop !15

50:                                               ; preds = %45
  %51 = load volatile i32, ptr inttoptr (i64 1155530848 to ptr), align 4, !tbaa !5
  %52 = or i32 %51, 2
  store volatile i32 %52, ptr inttoptr (i64 1155530848 to ptr), align 4, !tbaa !5
  br label %53

53:                                               ; preds = %57, %50
  %54 = load volatile i32, ptr inttoptr (i64 1155530848 to ptr), align 4, !tbaa !5
  %55 = and i32 %54, 3
  %56 = icmp ne i32 %55, 2
  br i1 %56, label %57, label %58

57:                                               ; preds = %53
  br label %53, !llvm.loop !16

58:                                               ; preds = %53
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = icmp eq i32 0, %59
  br i1 %60, label %61, label %76

61:                                               ; preds = %58
  %62 = load volatile i32, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  %63 = or i32 %62, 2
  store volatile i32 %63, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  br label %64

64:                                               ; preds = %68, %61
  %65 = load volatile i32, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  %66 = and i32 %65, 3
  %67 = icmp ne i32 2, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %64
  br label %64, !llvm.loop !17

69:                                               ; preds = %64
  br label %70

70:                                               ; preds = %74, %69
  %71 = load volatile i32, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  %72 = and i32 %71, 196608
  %73 = icmp ne i32 0, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  br label %70, !llvm.loop !18

75:                                               ; preds = %70
  br label %115

76:                                               ; preds = %58
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = icmp eq i32 1, %77
  br i1 %78, label %79, label %94

79:                                               ; preds = %76
  %80 = load volatile i32, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  %81 = or i32 %80, 2
  store volatile i32 %81, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  br label %82

82:                                               ; preds = %86, %79
  %83 = load volatile i32, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  %84 = and i32 %83, 3
  %85 = icmp ne i32 2, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %82
  br label %82, !llvm.loop !19

87:                                               ; preds = %82
  br label %88

88:                                               ; preds = %92, %87
  %89 = load volatile i32, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  %90 = and i32 %89, 196608
  %91 = icmp ne i32 0, %90
  br i1 %91, label %92, label %93

92:                                               ; preds = %88
  br label %88, !llvm.loop !20

93:                                               ; preds = %88
  br label %114

94:                                               ; preds = %76
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = icmp eq i32 2, %95
  br i1 %96, label %97, label %112

97:                                               ; preds = %94
  %98 = load volatile i32, ptr inttoptr (i64 1155530968 to ptr), align 4, !tbaa !5
  %99 = or i32 %98, 2
  store volatile i32 %99, ptr inttoptr (i64 1155530968 to ptr), align 4, !tbaa !5
  br label %100

100:                                              ; preds = %104, %97
  %101 = load volatile i32, ptr inttoptr (i64 1155530968 to ptr), align 4, !tbaa !5
  %102 = and i32 %101, 3
  %103 = icmp ne i32 2, %102
  br i1 %103, label %104, label %105

104:                                              ; preds = %100
  br label %100, !llvm.loop !21

105:                                              ; preds = %100
  br label %106

106:                                              ; preds = %110, %105
  %107 = load volatile i32, ptr inttoptr (i64 1155530968 to ptr), align 4, !tbaa !5
  %108 = and i32 %107, 196608
  %109 = icmp ne i32 0, %108
  br i1 %109, label %110, label %111

110:                                              ; preds = %106
  br label %106, !llvm.loop !22

111:                                              ; preds = %106
  br label %113

112:                                              ; preds = %94
  br label %113

113:                                              ; preds = %112, %111
  br label %114

114:                                              ; preds = %113, %93
  br label %115

115:                                              ; preds = %114, %75
  br label %116

116:                                              ; preds = %121, %115
  %117 = load volatile i32, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  %118 = and i32 %117, 8
  %119 = icmp ne i32 %118, 0
  %120 = xor i1 %119, true
  br i1 %120, label %121, label %122

121:                                              ; preds = %116
  br label %116, !llvm.loop !23

122:                                              ; preds = %116
  br label %123

123:                                              ; preds = %128, %122
  %124 = load volatile i32, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  %125 = and i32 %124, 16
  %126 = icmp ne i32 %125, 0
  %127 = xor i1 %126, true
  br i1 %127, label %128, label %129

128:                                              ; preds = %123
  br label %123, !llvm.loop !24

129:                                              ; preds = %123
  br label %130

130:                                              ; preds = %135, %129
  %131 = load volatile i32, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  %132 = and i32 %131, 48
  %133 = icmp ne i32 %132, 0
  %134 = xor i1 %133, true
  br i1 %134, label %135, label %136

135:                                              ; preds = %130
  br label %130, !llvm.loop !25

136:                                              ; preds = %130
  br label %137

137:                                              ; preds = %142, %136
  %138 = load volatile i32, ptr inttoptr (i64 1155530752 to ptr), align 4, !tbaa !5
  %139 = and i32 %138, 256
  %140 = icmp ne i32 %139, 0
  %141 = xor i1 %140, true
  br i1 %141, label %142, label %143

142:                                              ; preds = %137
  br label %137, !llvm.loop !26

143:                                              ; preds = %137
  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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


; 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 @PWMSSModuleClkConfig(i32 noundef %0) local_unnamed_addr #0 {
  %2 = load volatile i32, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  %3 = or i32 %2, 2
  store volatile i32 %3, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  br label %4

4:                                                ; preds = %4, %1
  %5 = load volatile i32, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  %6 = and i32 %5, 3
  %.not = icmp eq i32 %6, 2
  br i1 %.not, label %7, label %4, !llvm.loop !9

7:                                                ; preds = %4
  %8 = load volatile i32, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  %9 = or i32 %8, 2
  store volatile i32 %9, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  br label %10

10:                                               ; preds = %10, %7
  %11 = load volatile i32, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  %12 = and i32 %11, 3
  %.not3 = icmp eq i32 %12, 2
  br i1 %.not3, label %13, label %10, !llvm.loop !11

13:                                               ; preds = %10
  %14 = load volatile i32, ptr inttoptr (i64 1155530972 to ptr), align 4, !tbaa !5
  %15 = or i32 %14, 2
  store volatile i32 %15, ptr inttoptr (i64 1155530972 to ptr), align 4, !tbaa !5
  br label %16

16:                                               ; preds = %16, %13
  %17 = load volatile i32, ptr inttoptr (i64 1155530972 to ptr), align 4, !tbaa !5
  %18 = and i32 %17, 3
  %.not4 = icmp eq i32 %18, 2
  br i1 %.not4, label %19, label %16, !llvm.loop !12

19:                                               ; preds = %16
  %20 = load volatile i32, ptr inttoptr (i64 1155530976 to ptr), align 32, !tbaa !5
  %21 = or i32 %20, 2
  store volatile i32 %21, ptr inttoptr (i64 1155530976 to ptr), align 32, !tbaa !5
  br label %22

22:                                               ; preds = %22, %19
  %23 = load volatile i32, ptr inttoptr (i64 1155530976 to ptr), align 32, !tbaa !5
  %24 = and i32 %23, 3
  %.not5 = icmp eq i32 %24, 2
  br i1 %.not5, label %25, label %22, !llvm.loop !13

25:                                               ; preds = %22
  %26 = load volatile i32, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  %27 = or i32 %26, 2
  store volatile i32 %27, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  br label %28

28:                                               ; preds = %28, %25
  %29 = load volatile i32, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  %30 = and i32 %29, 3
  %.not6 = icmp eq i32 %30, 2
  br i1 %.not6, label %31, label %28, !llvm.loop !14

31:                                               ; preds = %28
  %32 = load volatile i32, ptr inttoptr (i64 1155530752 to ptr), align 2097152, !tbaa !5
  %33 = or i32 %32, 2
  store volatile i32 %33, ptr inttoptr (i64 1155530752 to ptr), align 2097152, !tbaa !5
  br label %34

34:                                               ; preds = %34, %31
  %35 = load volatile i32, ptr inttoptr (i64 1155530752 to ptr), align 2097152, !tbaa !5
  %36 = and i32 %35, 3
  %.not7 = icmp eq i32 %36, 2
  br i1 %.not7, label %37, label %34, !llvm.loop !15

37:                                               ; preds = %34
  %38 = load volatile i32, ptr inttoptr (i64 1155530848 to ptr), align 32, !tbaa !5
  %39 = or i32 %38, 2
  store volatile i32 %39, ptr inttoptr (i64 1155530848 to ptr), align 32, !tbaa !5
  br label %40

40:                                               ; preds = %40, %37
  %41 = load volatile i32, ptr inttoptr (i64 1155530848 to ptr), align 32, !tbaa !5
  %42 = and i32 %41, 3
  %.not8 = icmp eq i32 %42, 2
  br i1 %.not8, label %43, label %40, !llvm.loop !16

43:                                               ; preds = %40
  switch i32 %0, label %.loopexit.preheader [
    i32 0, label %44
    i32 1, label %52
    i32 2, label %60
  ]

44:                                               ; preds = %43
  %45 = load volatile i32, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  %46 = or i32 %45, 2
  store volatile i32 %46, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  br label %47

47:                                               ; preds = %47, %44
  %48 = load volatile i32, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  %49 = and i32 %48, 3
  %.not13 = icmp eq i32 %49, 2
  br i1 %.not13, label %.preheader21, label %47, !llvm.loop !17

.preheader21:                                     ; preds = %47, %.preheader21
  %50 = load volatile i32, ptr inttoptr (i64 1155530964 to ptr), align 4, !tbaa !5
  %51 = and i32 %50, 196608
  %.not14 = icmp eq i32 %51, 0
  br i1 %.not14, label %.loopexit.preheader, label %.preheader21, !llvm.loop !18

52:                                               ; preds = %43
  %53 = load volatile i32, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  %54 = or i32 %53, 2
  store volatile i32 %54, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  br label %55

55:                                               ; preds = %55, %52
  %56 = load volatile i32, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  %57 = and i32 %56, 3
  %.not11 = icmp eq i32 %57, 2
  br i1 %.not11, label %.preheader22, label %55, !llvm.loop !19

.preheader22:                                     ; preds = %55, %.preheader22
  %58 = load volatile i32, ptr inttoptr (i64 1155530956 to ptr), align 4, !tbaa !5
  %59 = and i32 %58, 196608
  %.not12 = icmp eq i32 %59, 0
  br i1 %.not12, label %.loopexit.preheader, label %.preheader22, !llvm.loop !20

60:                                               ; preds = %43
  %61 = load volatile i32, ptr inttoptr (i64 1155530968 to ptr), align 8, !tbaa !5
  %62 = or i32 %61, 2
  store volatile i32 %62, ptr inttoptr (i64 1155530968 to ptr), align 8, !tbaa !5
  br label %63

63:                                               ; preds = %63, %60
  %64 = load volatile i32, ptr inttoptr (i64 1155530968 to ptr), align 8, !tbaa !5
  %65 = and i32 %64, 3
  %.not9 = icmp eq i32 %65, 2
  br i1 %.not9, label %.preheader24, label %63, !llvm.loop !21

.preheader24:                                     ; preds = %63, %.preheader24
  %66 = load volatile i32, ptr inttoptr (i64 1155530968 to ptr), align 8, !tbaa !5
  %67 = and i32 %66, 196608
  %.not10 = icmp eq i32 %67, 0
  br i1 %.not10, label %.loopexit.preheader, label %.preheader24, !llvm.loop !22

.loopexit.preheader:                              ; preds = %.preheader24, %.preheader22, %.preheader21, %43
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.preheader, %.loopexit
  %68 = load volatile i32, ptr inttoptr (i64 1155530756 to ptr), align 4, !tbaa !5
  %69 = and i32 %68, 8
  %.not15 = icmp eq i32 %69, 0
  br i1 %.not15, label %.loopexit, label %.preheader20, !llvm.loop !23

.preheader20:                                     ; preds = %.loopexit, %.preheader20
  %70 = load volatile i32, ptr inttoptr (i64 1155530764 to ptr), align 4, !tbaa !5
  %71 = and i32 %70, 16
  %.not16 = icmp eq i32 %71, 0
  br i1 %.not16, label %.preheader20, label %.preheader19, !llvm.loop !24

.preheader19:                                     ; preds = %.preheader20, %.preheader19
  %72 = load volatile i32, ptr inttoptr (i64 1155531052 to ptr), align 4, !tbaa !5
  %73 = and i32 %72, 48
  %.not17 = icmp eq i32 %73, 0
  br i1 %.not17, label %.preheader19, label %.preheader, !llvm.loop !25

.preheader:                                       ; preds = %.preheader19, %.preheader
  %74 = load volatile i32, ptr inttoptr (i64 1155530752 to ptr), align 2097152, !tbaa !5
  %75 = and i32 %74, 256
  %.not18 = icmp eq i32 %75, 0
  br i1 %.not18, label %.preheader, label %76, !llvm.loop !26

76:                                               ; preds = %.preheader
  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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass