; LLVM IR from lfarcaro/ARINC653_ARMV7A_Z7000 :: ARINC653_ARMV7A_Z7000.sw/ARINC653_ARMV7A_Z7000_bsp/ps7_cortexa9_0/libsrc/sdps_v3_6 (BusWidth)

; 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.XSdPs = type { %struct.XSdPs_Config, i32, i32, i32, i32, i8, i8, i8, i8, i32, i8, [4 x i32], i32, [4 x i32], i32, i32, i32, ptr, [8 x i8], [32 x %struct.XSdPs_Adma2Descriptor], i64, [24 x i8] }
%struct.XSdPs_Config = type { i16, i32, i32, i32, i32, i32, i32, i32, i8 }
%struct.XSdPs_Adma2Descriptor = type <{ i16, i16, i64 }>

@Xil_AssertStatus = external global i32, align 4
@.str = external hidden unnamed_addr constant [167 x i8], align 1

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

declare void @Xil_Assert(ptr noundef, i32 noundef) #1

declare i32 @XSdPs_CmdTransfer(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @XSdPs_WriteReg16(i32 noundef, i8 noundef zeroext, i16 noundef zeroext) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @XSdPs_ReadReg16(i32 noundef, i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @XSdPs_Change_BusWidth(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  store i32 0, ptr @Xil_AssertStatus, align 4, !tbaa !9
  br label %12

11:                                               ; preds = %1
  call void @Xil_Assert(ptr noundef @.str, i32 noundef 265)
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !9
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %195

12:                                               ; preds = %10
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.XSdPs, ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = icmp eq i32 %15, 286331153
  br i1 %16, label %17, label %18

17:                                               ; preds = %12
  store i32 0, ptr @Xil_AssertStatus, align 4, !tbaa !9
  br label %19

18:                                               ; preds = %12
  call void @Xil_Assert(ptr noundef @.str, i32 noundef 266)
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !9
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %195

19:                                               ; preds = %17
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.XSdPs, ptr %20, i32 0, i32 7
  %22 = load i8, ptr %21, align 2, !tbaa !16
  %23 = zext i8 %22 to i32
  %24 = icmp eq i32 %23, 2
  br i1 %24, label %25, label %32

25:                                               ; preds = %19
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.XSdPs, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %struct.XSdPs_Config, ptr %27, i32 0, i32 5
  %29 = load i32, ptr %28, align 4, !tbaa !17
  %30 = icmp ult i32 %29, 4
  br i1 %30, label %31, label %32

31:                                               ; preds = %25
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %193

32:                                               ; preds = %25, %19
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.XSdPs, ptr %33, i32 0, i32 5
  %35 = load i8, ptr %34, align 4, !tbaa !18
  %36 = zext i8 %35 to i32
  %37 = icmp eq i32 %36, 1
  br i1 %37, label %38, label %63

38:                                               ; preds = %32
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.XSdPs, ptr %40, i32 0, i32 12
  %42 = load i32, ptr %41, align 16, !tbaa !19
  %43 = call i32 @XSdPs_CmdTransfer(ptr noundef %39, i32 noundef 14080, i32 noundef %42, i32 noundef 0)
  store i32 %43, ptr %4, align 4, !tbaa !9
  %44 = load i32, ptr %4, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = icmp ne i64 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %38
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %193

48:                                               ; preds = %38
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.XSdPs, ptr %49, i32 0, i32 8
  store i8 2, ptr %50, align 1, !tbaa !20
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.XSdPs, ptr %51, i32 0, i32 8
  %53 = load i8, ptr %52, align 1, !tbaa !20
  %54 = zext i8 %53 to i32
  store i32 %54, ptr %6, align 4, !tbaa !9
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = load i32, ptr %6, align 4, !tbaa !9
  %57 = call i32 @XSdPs_CmdTransfer(ptr noundef %55, i32 noundef 34304, i32 noundef %56, i32 noundef 0)
  store i32 %57, ptr %4, align 4, !tbaa !9
  %58 = load i32, ptr %4, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = icmp ne i64 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %48
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %193

62:                                               ; preds = %48
  br label %143

63:                                               ; preds = %32
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.XSdPs, ptr %64, i32 0, i32 7
  %66 = load i8, ptr %65, align 2, !tbaa !16
  %67 = zext i8 %66 to i32
  %68 = icmp eq i32 %67, 2
  br i1 %68, label %69, label %84

69:                                               ; preds = %63
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.XSdPs, ptr %70, i32 0, i32 5
  %72 = load i8, ptr %71, align 4, !tbaa !18
  %73 = zext i8 %72 to i32
  %74 = icmp eq i32 %73, 5
  br i1 %74, label %75, label %84

75:                                               ; preds = %69
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.XSdPs, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %struct.XSdPs_Config, ptr %77, i32 0, i32 5
  %79 = load i32, ptr %78, align 4, !tbaa !17
  %80 = icmp eq i32 %79, 8
  br i1 %80, label %81, label %84

81:                                               ; preds = %75
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.XSdPs, ptr %82, i32 0, i32 8
  store i8 3, ptr %83, align 1, !tbaa !20
  br label %87

84:                                               ; preds = %75, %69, %63
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.XSdPs, ptr %85, i32 0, i32 8
  store i8 2, ptr %86, align 1, !tbaa !20
  br label %87

87:                                               ; preds = %84, %81
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.XSdPs, ptr %88, i32 0, i32 8
  %90 = load i8, ptr %89, align 1, !tbaa !20
  %91 = zext i8 %90 to i32
  %92 = icmp eq i32 %91, 3
  br i1 %92, label %93, label %101

93:                                               ; preds = %87
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.XSdPs, ptr %94, i32 0, i32 16
  %96 = load i32, ptr %95, align 4, !tbaa !21
  %97 = icmp eq i32 %96, 4
  br i1 %97, label %98, label %99

98:                                               ; preds = %93
  store i32 62326272, ptr %6, align 4, !tbaa !9
  br label %100

99:                                               ; preds = %93
  store i32 62325248, ptr %6, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %99, %98
  br label %109

101:                                              ; preds = %87
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.XSdPs, ptr %102, i32 0, i32 16
  %104 = load i32, ptr %103, align 4, !tbaa !21
  %105 = icmp eq i32 %104, 4
  br i1 %105, label %106, label %107

106:                                              ; preds = %101
  store i32 62326016, ptr %6, align 4, !tbaa !9
  br label %108

107:                                              ; preds = %101
  store i32 62324992, ptr %6, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %107, %106
  br label %109

109:                                              ; preds = %108, %100
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = load i32, ptr %6, align 4, !tbaa !9
  %112 = call i32 @XSdPs_CmdTransfer(ptr noundef %110, i32 noundef 1536, i32 noundef %111, i32 noundef 0)
  store i32 %112, ptr %4, align 4, !tbaa !9
  %113 = load i32, ptr %4, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = icmp ne i64 %114, 0
  br i1 %115, label %116, label %117

116:                                              ; preds = %109
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %193

117:                                              ; preds = %109
  br label %118

118:                                              ; preds = %134, %117
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.XSdPs, ptr %119, i32 0, i32 0
  %121 = getelementptr inbounds %struct.XSdPs_Config, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !22
  %123 = call zeroext i16 @XSdPs_ReadReg16(i32 noundef %122, i8 noundef zeroext 48)
  %124 = zext i16 %123 to i32
  store i32 %124, ptr %5, align 4, !tbaa !9
  %125 = load i32, ptr %5, align 4, !tbaa !9
  %126 = and i32 %125, 32768
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %133

128:                                              ; preds = %118
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.XSdPs, ptr %129, i32 0, i32 0
  %131 = getelementptr inbounds %struct.XSdPs_Config, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !22
  call void @XSdPs_WriteReg16(i32 noundef %132, i8 noundef zeroext 50, i16 noundef zeroext -3073)
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %193

133:                                              ; preds = %118
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %5, align 4, !tbaa !9
  %136 = and i32 %135, 2
  %137 = icmp eq i32 %136, 0
  br i1 %137, label %118, label %138, !llvm.loop !23

138:                                              ; preds = %134
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.XSdPs, ptr %139, i32 0, i32 0
  %141 = getelementptr inbounds %struct.XSdPs_Config, ptr %140, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !22
  call void @XSdPs_WriteReg16(i32 noundef %142, i8 noundef zeroext 48, i16 noundef zeroext 2)
  br label %143

143:                                              ; preds = %138, %62
  call void @usleep(i64 noundef 1000)
  %144 = load ptr, ptr %3, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.XSdPs, ptr %144, i32 0, i32 0
  %146 = getelementptr inbounds %struct.XSdPs_Config, ptr %145, i32 0, i32 1
  %147 = load i32, ptr %146, align 4, !tbaa !22
  %148 = call zeroext i8 @XSdPs_ReadReg8(i32 noundef %147, i8 noundef zeroext 40)
  %149 = zext i8 %148 to i32
  store i32 %149, ptr %5, align 4, !tbaa !9
  %150 = load ptr, ptr %3, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.XSdPs, ptr %150, i32 0, i32 8
  %152 = load i8, ptr %151, align 1, !tbaa !20
  %153 = zext i8 %152 to i32
  %154 = icmp eq i32 %153, 3
  br i1 %154, label %155, label %158

155:                                              ; preds = %143
  %156 = load i32, ptr %5, align 4, !tbaa !9
  %157 = or i32 %156, 32
  store i32 %157, ptr %5, align 4, !tbaa !9
  br label %161

158:                                              ; preds = %143
  %159 = load i32, ptr %5, align 4, !tbaa !9
  %160 = or i32 %159, 2
  store i32 %160, ptr %5, align 4, !tbaa !9
  br label %161

161:                                              ; preds = %158, %155
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.XSdPs, ptr %162, i32 0, i32 0
  %164 = getelementptr inbounds %struct.XSdPs_Config, ptr %163, i32 0, i32 1
  %165 = load i32, ptr %164, align 4, !tbaa !22
  %166 = load i32, ptr %5, align 4, !tbaa !9
  %167 = trunc i32 %166 to i8
  call void @XSdPs_WriteReg8(i32 noundef %165, i8 noundef zeroext 40, i8 noundef zeroext %167)
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.XSdPs, ptr %168, i32 0, i32 16
  %170 = load i32, ptr %169, align 4, !tbaa !21
  %171 = icmp eq i32 %170, 4
  br i1 %171, label %172, label %192

172:                                              ; preds = %161
  %173 = load ptr, ptr %3, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.XSdPs, ptr %173, i32 0, i32 0
  %175 = getelementptr inbounds %struct.XSdPs_Config, ptr %174, i32 0, i32 1
  %176 = load i32, ptr %175, align 4, !tbaa !22
  %177 = call zeroext i16 @XSdPs_ReadReg16(i32 noundef %176, i8 noundef zeroext 62)
  %178 = zext i16 %177 to i32
  store i32 %178, ptr %5, align 4, !tbaa !9
  %179 = load i32, ptr %5, align 4, !tbaa !9
  %180 = and i32 %179, 65528
  store i32 %180, ptr %5, align 4, !tbaa !9
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.XSdPs, ptr %181, i32 0, i32 16
  %183 = load i32, ptr %182, align 4, !tbaa !21
  %184 = load i32, ptr %5, align 4, !tbaa !9
  %185 = or i32 %184, %183
  store i32 %185, ptr %5, align 4, !tbaa !9
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.XSdPs, ptr %186, i32 0, i32 0
  %188 = getelementptr inbounds %struct.XSdPs_Config, ptr %187, i32 0, i32 1
  %189 = load i32, ptr %188, align 4, !tbaa !22
  %190 = load i32, ptr %5, align 4, !tbaa !9
  %191 = trunc i32 %190 to i16
  call void @XSdPs_WriteReg16(i32 noundef %189, i8 noundef zeroext 62, i16 noundef zeroext %191)
  br label %192

192:                                              ; preds = %172, %161
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %193

193:                                              ; preds = %192, %128, %116, %61, %47, %31
  %194 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %194, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %195

195:                                              ; preds = %193, %18, %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %196 = load i32, ptr %2, align 4
  ret i32 %196
}

declare void @usleep(i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @XSdPs_ReadReg8(i32 noundef, i8 noundef zeroext) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @XSdPs_WriteReg8(i32 noundef, i8 noundef zeroext, i8 noundef zeroext) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = { 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 = { 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, !10, i64 36}
!12 = !{!"", !13, i64 0, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !7, i64 52, !7, i64 53, !7, i64 54, !7, i64 55, !10, i64 56, !7, i64 60, !7, i64 64, !10, i64 80, !7, i64 84, !10, i64 100, !10, i64 104, !10, i64 108, !6, i64 112, !7, i64 128, !15, i64 512}
!13 = !{!"", !14, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32}
!14 = !{!"short", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!12, !7, i64 54}
!17 = !{!12, !10, i64 20}
!18 = !{!12, !7, i64 52}
!19 = !{!12, !10, i64 80}
!20 = !{!12, !7, i64 55}
!21 = !{!12, !10, i64 108}
!22 = !{!12, !10, i64 4}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


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

@Xil_AssertStatus = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [167 x i8], align 1

declare void @Xil_Assert(ptr noundef, i32 noundef) local_unnamed_addr #0

declare i32 @XSdPs_CmdTransfer(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @XSdPs_WriteReg16(i32 noundef, i8 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @XSdPs_ReadReg16(i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @XSdPs_Change_BusWidth(ptr noundef %0) local_unnamed_addr #2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %2

2:                                                ; preds = %1
  store i32 0, ptr @Xil_AssertStatus, align 4, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 36
  %4 = load i32, ptr %3, align 4, !tbaa !9
  %5 = icmp eq i32 %4, 286331153
  br i1 %5, label %7, label %11

6:                                                ; preds = %1
  tail call void @Xil_Assert(ptr noundef nonnull @.str, i32 noundef 265) #3
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !5
  br label %75

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 54
  %9 = load i8, ptr %8, align 2, !tbaa !15
  %10 = icmp eq i8 %9, 2
  br i1 %10, label %12, label %16

11:                                               ; preds = %2
  tail call void @Xil_Assert(ptr noundef nonnull @.str, i32 noundef 266) #3
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !5
  br label %75

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %0, i64 20
  %14 = load i32, ptr %13, align 4, !tbaa !16
  %15 = icmp ult i32 %14, 4
  br i1 %15, label %75, label %16

16:                                               ; preds = %12, %7
  %17 = getelementptr inbounds i8, ptr %0, i64 52
  %18 = load i8, ptr %17, align 4, !tbaa !17
  %19 = icmp eq i8 %18, 1
  br i1 %19, label %20, label %27

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 80
  %22 = load i32, ptr %21, align 16, !tbaa !18
  %23 = tail call i32 @XSdPs_CmdTransfer(ptr noundef nonnull %0, i32 noundef 14080, i32 noundef %22, i32 noundef 0) #3
  %.not50 = icmp eq i32 %23, 0
  br i1 %.not50, label %24, label %75

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %0, i64 55
  store i8 2, ptr %25, align 1, !tbaa !19
  %26 = tail call i32 @XSdPs_CmdTransfer(ptr noundef nonnull %0, i32 noundef 34304, i32 noundef 2, i32 noundef 0) #3
  %.not51 = icmp eq i32 %26, 0
  br i1 %.not51, label %56, label %75

27:                                               ; preds = %16
  %28 = icmp eq i8 %18, 5
  %or.cond = and i1 %10, %28
  br i1 %or.cond, label %29, label %38

29:                                               ; preds = %27
  %30 = getelementptr inbounds i8, ptr %0, i64 20
  %31 = load i32, ptr %30, align 4, !tbaa !16
  %32 = icmp eq i32 %31, 8
  br i1 %32, label %33, label %38

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %0, i64 55
  store i8 3, ptr %34, align 1, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %0, i64 108
  %36 = load i32, ptr %35, align 4, !tbaa !20
  %37 = icmp eq i32 %36, 4
  %. = select i1 %37, i32 62326272, i32 62325248
  br label %43

38:                                               ; preds = %29, %27
  %39 = getelementptr inbounds i8, ptr %0, i64 55
  store i8 2, ptr %39, align 1, !tbaa !19
  %40 = getelementptr inbounds i8, ptr %0, i64 108
  %41 = load i32, ptr %40, align 4, !tbaa !20
  %42 = icmp eq i32 %41, 4
  %.52 = select i1 %42, i32 62326016, i32 62324992
  br label %43

43:                                               ; preds = %38, %33
  %.0 = phi i32 [ %., %33 ], [ %.52, %38 ]
  %44 = tail call i32 @XSdPs_CmdTransfer(ptr noundef nonnull %0, i32 noundef 1536, i32 noundef %.0, i32 noundef 0) #3
  %.not48 = icmp eq i32 %44, 0
  br i1 %.not48, label %.preheader, label %75

.preheader:                                       ; preds = %43
  %45 = getelementptr inbounds i8, ptr %0, i64 4
  br label %46

46:                                               ; preds = %.preheader, %51
  %47 = load i32, ptr %45, align 4, !tbaa !21
  %48 = tail call zeroext i16 @XSdPs_ReadReg16(i32 noundef %47, i8 noundef zeroext 48)
  %.not49 = icmp sgt i16 %48, -1
  br i1 %.not49, label %51, label %49

49:                                               ; preds = %46
  %50 = load i32, ptr %45, align 4, !tbaa !21
  tail call void @XSdPs_WriteReg16(i32 noundef %50, i8 noundef zeroext 50, i16 noundef zeroext -3073)
  br label %75

51:                                               ; preds = %46
  %52 = and i16 %48, 2
  %53 = icmp eq i16 %52, 0
  br i1 %53, label %46, label %54, !llvm.loop !22

54:                                               ; preds = %51
  %55 = load i32, ptr %45, align 4, !tbaa !21
  tail call void @XSdPs_WriteReg16(i32 noundef %55, i8 noundef zeroext 48, i16 noundef zeroext 2)
  br label %56

56:                                               ; preds = %24, %54
  tail call void @usleep(i64 noundef 1000) #3
  %57 = getelementptr inbounds i8, ptr %0, i64 4
  %58 = load i32, ptr %57, align 4, !tbaa !21
  %59 = tail call zeroext i8 @XSdPs_ReadReg8(i32 noundef %58, i8 noundef zeroext 40)
  %60 = getelementptr inbounds i8, ptr %0, i64 55
  %61 = load i8, ptr %60, align 1, !tbaa !19
  %62 = icmp eq i8 %61, 3
  %.043.v = select i1 %62, i8 32, i8 2
  %.043 = or i8 %.043.v, %59
  %63 = load i32, ptr %57, align 4, !tbaa !21
  tail call void @XSdPs_WriteReg8(i32 noundef %63, i8 noundef zeroext 40, i8 noundef zeroext %.043)
  %64 = getelementptr inbounds i8, ptr %0, i64 108
  %65 = load i32, ptr %64, align 4, !tbaa !20
  %66 = icmp eq i32 %65, 4
  br i1 %66, label %67, label %75

67:                                               ; preds = %56
  %68 = load i32, ptr %57, align 4, !tbaa !21
  %69 = tail call zeroext i16 @XSdPs_ReadReg16(i32 noundef %68, i8 noundef zeroext 62)
  %70 = and i16 %69, -8
  %71 = load i32, ptr %64, align 4, !tbaa !20
  %72 = load i32, ptr %57, align 4, !tbaa !21
  %73 = trunc i32 %71 to i16
  %74 = or i16 %70, %73
  tail call void @XSdPs_WriteReg16(i32 noundef %72, i8 noundef zeroext 62, i16 noundef zeroext %74)
  br label %75

75:                                               ; preds = %49, %12, %20, %24, %43, %67, %56, %11, %6
  %.045 = phi i32 [ 0, %11 ], [ 0, %6 ], [ 1, %49 ], [ 0, %12 ], [ 1, %20 ], [ 1, %24 ], [ 1, %43 ], [ 0, %67 ], [ 0, %56 ]
  ret i32 %.045
}

declare void @usleep(i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @XSdPs_ReadReg8(i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @XSdPs_WriteReg8(i32 noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

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 = { inlinehint 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 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 36}
!10 = !{!"", !11, i64 0, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !7, i64 52, !7, i64 53, !7, i64 54, !7, i64 55, !6, i64 56, !7, i64 60, !7, i64 64, !6, i64 80, !7, i64 84, !6, i64 100, !6, i64 104, !6, i64 108, !13, i64 112, !7, i64 128, !14, i64 512}
!11 = !{!"", !12, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !7, i64 32}
!12 = !{!"short", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !7, i64 54}
!16 = !{!10, !6, i64 20}
!17 = !{!10, !7, i64 52}
!18 = !{!10, !6, i64 80}
!19 = !{!10, !7, i64 55}
!20 = !{!10, !6, i64 108}
!21 = !{!10, !6, i64 4}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass