; LLVM IR from trabucayre/openFPGALoader :: src/gowin.ll (ZN5Gowin8spi_waitEhhhjb)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%class.Gowin = type { %class.Device.base, %class.SPIInterface, %"class.std::unique_ptr", %"class.std::unique_ptr", %"class.std::unique_ptr", i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32 }
%class.Device.base = type <{ ptr, ptr, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i8, i8, i8 }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%class.SPIInterface = type { ptr, i8, i32, i8, i8, i8, %"class.std::__cxx11::basic_string" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.68" }
%"struct.std::_Head_base.68" = type { ptr }
%class.Device = type <{ ptr, ptr, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i8, i8, i8, i8 }>

@.str.659 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.660 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.661 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.662 = external hidden unnamed_addr constant [6 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.663 = external hidden unnamed_addr constant [12 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

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

declare void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193), i32 noundef, i8 noundef zeroext) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5Gowin12send_commandEh(ptr noundef nonnull align 8 dereferenceable(192), i8 noundef zeroext) #2 align 2

declare noundef i32 @_ZN4Jtag7shiftDREPKhPhiNS_10tapState_tE(ptr noundef nonnull align 8 dereferenceable(193), ptr noundef, ptr noundef, i32 noundef, i32 noundef) #1

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193)) #2 align 2

declare noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192), ptr noundef, ptr noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5Gowin8spi_waitEhhhjb(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i32 noundef %4, i1 noundef zeroext %5) unnamed_addr #2 align 2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca [3 x i8], align 1
  %17 = alloca [3 x i8], align 1
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = alloca i8, align 1
  %21 = alloca i8, align 1
  %22 = alloca i8, align 1
  %23 = alloca i8, align 1
  %24 = alloca i8, align 1
  %25 = alloca i8, align 1
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i8 %1, ptr %9, align 1, !tbaa !9
  store i8 %2, ptr %10, align 1, !tbaa !9
  store i8 %3, ptr %11, align 1, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !10
  %26 = zext i1 %5 to i8
  store i8 %26, ptr %13, align 1, !tbaa !12
  %27 = load ptr, ptr %8, align 8
  %28 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 10
  %29 = load i8, ptr %28, align 8, !tbaa !14, !range !29, !noundef !30
  %30 = trunc i8 %29 to i1
  br i1 %30, label %31, label %39

31:                                               ; preds = %6
  %32 = load i8, ptr %9, align 1, !tbaa !9
  %33 = load i8, ptr %10, align 1, !tbaa !9
  %34 = load i8, ptr %11, align 1, !tbaa !9
  %35 = load i32, ptr %12, align 4, !tbaa !10
  %36 = load i8, ptr %13, align 1, !tbaa !12, !range !29, !noundef !30
  %37 = trunc i8 %36 to i1
  %38 = call noundef i32 @_ZN5Gowin13spi_wait_gw5aEhhhjb(ptr noundef nonnull align 8 dereferenceable(192) %27, i8 noundef zeroext %32, i8 noundef zeroext %33, i8 noundef zeroext %34, i32 noundef %35, i1 noundef zeroext %37)
  store i32 %38, ptr %7, align 4
  br label %289

39:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !10
  %40 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 9
  %41 = load i8, ptr %40, align 1, !tbaa !31, !range !29, !noundef !30
  %42 = trunc i8 %41 to i1
  br i1 %42, label %43, label %118

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 3, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 3, ptr %17) #4
  %44 = load i8, ptr %9, align 1, !tbaa !9
  %45 = call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %44)
  %46 = getelementptr inbounds [3 x i8], ptr %17, i64 0, i64 0
  store i8 %45, ptr %46, align 1, !tbaa !9
  br label %47

47:                                               ; preds = %105, %43
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  %48 = call noundef zeroext i1 @_ZN5Gowin12send_commandEh(ptr noundef nonnull align 8 dereferenceable(192) %27, i8 noundef zeroext 22)
  %49 = zext i1 %48 to i8
  store i8 %49, ptr %18, align 1, !tbaa !12
  %50 = load i8, ptr %18, align 1, !tbaa !12, !range !29, !noundef !30
  %51 = trunc i8 %50 to i1
  br i1 %51, label %53, label %52

52:                                               ; preds = %47
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %102

53:                                               ; preds = %47
  %54 = getelementptr inbounds %class.Device, ptr %27, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !32
  call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %55, i32 noundef 7, i8 noundef zeroext 1)
  %56 = getelementptr inbounds %class.Device, ptr %27, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !32
  %58 = getelementptr inbounds [3 x i8], ptr %17, i64 0, i64 0
  %59 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 0
  %60 = call noundef i32 @_ZN4Jtag7shiftDREPKhPhiNS_10tapState_tE(ptr noundef nonnull align 8 dereferenceable(193) %57, ptr noundef %58, ptr noundef %59, i32 noundef 24, i32 noundef 1)
  %61 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 1
  %62 = load i8, ptr %61, align 1, !tbaa !9
  %63 = zext i8 %62 to i32
  %64 = ashr i32 %63, 1
  %65 = trunc i32 %64 to i8
  %66 = call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %65)
  %67 = zext i8 %66 to i32
  %68 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 2
  %69 = load i8, ptr %68, align 1, !tbaa !9
  %70 = zext i8 %69 to i32
  %71 = and i32 1, %70
  %72 = or i32 %67, %71
  %73 = trunc i32 %72 to i8
  store i8 %73, ptr %14, align 1, !tbaa !9
  %74 = load i32, ptr %15, align 4, !tbaa !10
  %75 = add i32 %74, 1
  store i32 %75, ptr %15, align 4, !tbaa !10
  %76 = load i32, ptr %15, align 4, !tbaa !10
  %77 = load i32, ptr %12, align 4, !tbaa !10
  %78 = icmp eq i32 %76, %77
  br i1 %78, label %79, label %89

79:                                               ; preds = %53
  %80 = load i8, ptr %14, align 1, !tbaa !9
  %81 = zext i8 %80 to i32
  %82 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 0
  %83 = load i8, ptr %82, align 1, !tbaa !9
  %84 = zext i8 %83 to i32
  %85 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 1
  %86 = load i8, ptr %85, align 1, !tbaa !9
  %87 = zext i8 %86 to i32
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.659, i32 noundef %81, i32 noundef %84, i32 noundef %87)
  store i32 2, ptr %19, align 4
  br label %102

89:                                               ; preds = %53
  %90 = load i8, ptr %13, align 1, !tbaa !12, !range !29, !noundef !30
  %91 = trunc i8 %90 to i1
  br i1 %91, label %92, label %101

92:                                               ; preds = %89
  %93 = load i8, ptr %14, align 1, !tbaa !9
  %94 = zext i8 %93 to i32
  %95 = load i8, ptr %10, align 1, !tbaa !9
  %96 = zext i8 %95 to i32
  %97 = load i8, ptr %11, align 1, !tbaa !9
  %98 = zext i8 %97 to i32
  %99 = load i32, ptr %15, align 4, !tbaa !10
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str.660, i32 noundef %94, i32 noundef %96, i32 noundef %98, i32 noundef %99)
  br label %101

101:                                              ; preds = %92, %89
  store i32 0, ptr %19, align 4
  br label %102

102:                                              ; preds = %101, %79, %52
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  %103 = load i32, ptr %19, align 4
  switch i32 %103, label %115 [
    i32 0, label %104
    i32 2, label %114
  ]

104:                                              ; preds = %102
  br label %105

105:                                              ; preds = %104
  %106 = load i8, ptr %14, align 1, !tbaa !9
  %107 = zext i8 %106 to i32
  %108 = load i8, ptr %10, align 1, !tbaa !9
  %109 = zext i8 %108 to i32
  %110 = and i32 %107, %109
  %111 = load i8, ptr %11, align 1, !tbaa !9
  %112 = zext i8 %111 to i32
  %113 = icmp ne i32 %110, %112
  br i1 %113, label %47, label %114, !llvm.loop !33

114:                                              ; preds = %105, %102
  store i32 0, ptr %19, align 4
  br label %115

115:                                              ; preds = %114, %102
  call void @llvm.lifetime.end.p0(i64 3, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr %16) #4
  %116 = load i32, ptr %19, align 4
  switch i32 %116, label %288 [
    i32 0, label %117
  ]

117:                                              ; preds = %115
  br label %277

118:                                              ; preds = %39
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #4
  %119 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 17
  %120 = load i8, ptr %119, align 1, !tbaa !35
  %121 = zext i8 %120 to i32
  %122 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 16
  %123 = load i8, ptr %122, align 2, !tbaa !36
  %124 = zext i8 %123 to i32
  %125 = or i32 %121, %124
  %126 = trunc i32 %125 to i8
  store i8 %126, ptr %20, align 1, !tbaa !9
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %27, ptr noundef %20, ptr noundef null, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #4
  store i8 0, ptr %21, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #4
  store i8 -128, ptr %22, align 1, !tbaa !9
  br label %127

127:                                              ; preds = %165, %118
  %128 = load i8, ptr %21, align 1, !tbaa !9
  %129 = zext i8 %128 to i32
  %130 = icmp slt i32 %129, 8
  br i1 %130, label %132, label %131

131:                                              ; preds = %127
  store i32 4, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #4
  br label %172

132:                                              ; preds = %127
  %133 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 17
  %134 = load i8, ptr %133, align 1, !tbaa !35
  %135 = zext i8 %134 to i32
  %136 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 16
  %137 = load i8, ptr %136, align 2, !tbaa !36
  %138 = zext i8 %137 to i32
  %139 = or i32 %135, %138
  %140 = trunc i32 %139 to i8
  store i8 %140, ptr %20, align 1, !tbaa !9
  %141 = load i8, ptr %9, align 1, !tbaa !9
  %142 = zext i8 %141 to i32
  %143 = load i8, ptr %22, align 1, !tbaa !9
  %144 = zext i8 %143 to i32
  %145 = and i32 %142, %144
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %155

147:                                              ; preds = %132
  %148 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 15
  %149 = load i8, ptr %148, align 1, !tbaa !37
  %150 = zext i8 %149 to i32
  %151 = load i8, ptr %20, align 1, !tbaa !9
  %152 = zext i8 %151 to i32
  %153 = or i32 %152, %150
  %154 = trunc i32 %153 to i8
  store i8 %154, ptr %20, align 1, !tbaa !9
  br label %155

155:                                              ; preds = %147, %132
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %27, ptr noundef %20, ptr noundef null, i32 noundef 8)
  %156 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 13
  %157 = load i8, ptr %156, align 1, !tbaa !38
  %158 = zext i8 %157 to i32
  %159 = load i8, ptr %20, align 1, !tbaa !9
  %160 = zext i8 %159 to i32
  %161 = or i32 %160, %158
  %162 = trunc i32 %161 to i8
  store i8 %162, ptr %20, align 1, !tbaa !9
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %27, ptr noundef %20, ptr noundef null, i32 noundef 8)
  %163 = getelementptr inbounds %class.Device, ptr %27, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8, !tbaa !32
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %164)
  br label %165

165:                                              ; preds = %155
  %166 = load i8, ptr %21, align 1, !tbaa !9
  %167 = add i8 %166, 1
  store i8 %167, ptr %21, align 1, !tbaa !9
  %168 = load i8, ptr %22, align 1, !tbaa !9
  %169 = zext i8 %168 to i32
  %170 = ashr i32 %169, 1
  %171 = trunc i32 %170 to i8
  store i8 %171, ptr %22, align 1, !tbaa !9
  br label %127, !llvm.loop !39

172:                                              ; preds = %131
  %173 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 17
  %174 = load i8, ptr %173, align 1, !tbaa !35
  %175 = zext i8 %174 to i32
  %176 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 16
  %177 = load i8, ptr %176, align 2, !tbaa !36
  %178 = zext i8 %177 to i32
  %179 = or i32 %175, %178
  %180 = trunc i32 %179 to i8
  store i8 %180, ptr %20, align 1, !tbaa !9
  br label %181

181:                                              ; preds = %250, %172
  store i8 0, ptr %14, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #4
  store i8 0, ptr %23, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #4
  store i8 -128, ptr %24, align 1, !tbaa !9
  br label %182

182:                                              ; preds = %220, %181
  %183 = load i8, ptr %23, align 1, !tbaa !9
  %184 = zext i8 %183 to i32
  %185 = icmp slt i32 %184, 8
  br i1 %185, label %187, label %186

186:                                              ; preds = %182
  store i32 9, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #4
  br label %227

187:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 1, ptr %25) #4
  %188 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 13
  %189 = load i8, ptr %188, align 1, !tbaa !38
  %190 = zext i8 %189 to i32
  %191 = xor i32 %190, -1
  %192 = load i8, ptr %20, align 1, !tbaa !9
  %193 = zext i8 %192 to i32
  %194 = and i32 %193, %191
  %195 = trunc i32 %194 to i8
  store i8 %195, ptr %20, align 1, !tbaa !9
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %27, ptr noundef %20, ptr noundef null, i32 noundef 8)
  %196 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 13
  %197 = load i8, ptr %196, align 1, !tbaa !38
  %198 = zext i8 %197 to i32
  %199 = load i8, ptr %20, align 1, !tbaa !9
  %200 = zext i8 %199 to i32
  %201 = or i32 %200, %198
  %202 = trunc i32 %201 to i8
  store i8 %202, ptr %20, align 1, !tbaa !9
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %27, ptr noundef %20, ptr noundef %25, i32 noundef 8)
  %203 = getelementptr inbounds %class.Device, ptr %27, i32 0, i32 1
  %204 = load ptr, ptr %203, align 8, !tbaa !32
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %204)
  %205 = load i8, ptr %25, align 1, !tbaa !9
  %206 = zext i8 %205 to i32
  %207 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 16
  %208 = load i8, ptr %207, align 2, !tbaa !36
  %209 = zext i8 %208 to i32
  %210 = and i32 %206, %209
  %211 = icmp ne i32 %210, 0
  br i1 %211, label %212, label %219

212:                                              ; preds = %187
  %213 = load i8, ptr %24, align 1, !tbaa !9
  %214 = zext i8 %213 to i32
  %215 = load i8, ptr %14, align 1, !tbaa !9
  %216 = zext i8 %215 to i32
  %217 = or i32 %216, %214
  %218 = trunc i32 %217 to i8
  store i8 %218, ptr %14, align 1, !tbaa !9
  br label %219

219:                                              ; preds = %212, %187
  call void @llvm.lifetime.end.p0(i64 1, ptr %25) #4
  br label %220

220:                                              ; preds = %219
  %221 = load i8, ptr %23, align 1, !tbaa !9
  %222 = add i8 %221, 1
  store i8 %222, ptr %23, align 1, !tbaa !9
  %223 = load i8, ptr %24, align 1, !tbaa !9
  %224 = zext i8 %223 to i32
  %225 = ashr i32 %224, 1
  %226 = trunc i32 %225 to i8
  store i8 %226, ptr %24, align 1, !tbaa !9
  br label %182, !llvm.loop !40

227:                                              ; preds = %186
  %228 = load i32, ptr %15, align 4, !tbaa !10
  %229 = add i32 %228, 1
  store i32 %229, ptr %15, align 4, !tbaa !10
  %230 = load i32, ptr %15, align 4, !tbaa !10
  %231 = load i32, ptr %12, align 4, !tbaa !10
  %232 = icmp eq i32 %230, %231
  br i1 %232, label %233, label %237

233:                                              ; preds = %227
  %234 = load i8, ptr %14, align 1, !tbaa !9
  %235 = zext i8 %234 to i32
  %236 = call i32 (ptr, ...) @printf(ptr noundef @.str.661, i32 noundef %235)
  br label %259

237:                                              ; preds = %227
  %238 = load i8, ptr %13, align 1, !tbaa !12, !range !29, !noundef !30
  %239 = trunc i8 %238 to i1
  br i1 %239, label %240, label %249

240:                                              ; preds = %237
  %241 = load i8, ptr %14, align 1, !tbaa !9
  %242 = zext i8 %241 to i32
  %243 = load i8, ptr %10, align 1, !tbaa !9
  %244 = zext i8 %243 to i32
  %245 = load i8, ptr %11, align 1, !tbaa !9
  %246 = zext i8 %245 to i32
  %247 = load i32, ptr %15, align 4, !tbaa !10
  %248 = call i32 (ptr, ...) @printf(ptr noundef @.str.660, i32 noundef %242, i32 noundef %244, i32 noundef %246, i32 noundef %247)
  br label %249

249:                                              ; preds = %240, %237
  br label %250

250:                                              ; preds = %249
  %251 = load i8, ptr %14, align 1, !tbaa !9
  %252 = zext i8 %251 to i32
  %253 = load i8, ptr %10, align 1, !tbaa !9
  %254 = zext i8 %253 to i32
  %255 = and i32 %252, %254
  %256 = load i8, ptr %11, align 1, !tbaa !9
  %257 = zext i8 %256 to i32
  %258 = icmp ne i32 %255, %257
  br i1 %258, label %181, label %259, !llvm.loop !41

259:                                              ; preds = %250, %233
  %260 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 13
  %261 = load i8, ptr %260, align 1, !tbaa !38
  %262 = zext i8 %261 to i32
  %263 = xor i32 %262, -1
  %264 = load i8, ptr %20, align 1, !tbaa !9
  %265 = zext i8 %264 to i32
  %266 = and i32 %265, %263
  %267 = trunc i32 %266 to i8
  store i8 %267, ptr %20, align 1, !tbaa !9
  %268 = getelementptr inbounds %class.Gowin, ptr %27, i32 0, i32 14
  %269 = load i8, ptr %268, align 4, !tbaa !42
  %270 = zext i8 %269 to i32
  %271 = load i8, ptr %20, align 1, !tbaa !9
  %272 = zext i8 %271 to i32
  %273 = or i32 %272, %270
  %274 = trunc i32 %273 to i8
  store i8 %274, ptr %20, align 1, !tbaa !9
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %27, ptr noundef %20, ptr noundef null, i32 noundef 8)
  %275 = getelementptr inbounds %class.Device, ptr %27, i32 0, i32 1
  %276 = load ptr, ptr %275, align 8, !tbaa !32
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %276)
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #4
  br label %277

277:                                              ; preds = %259, %117
  %278 = load i32, ptr %15, align 4, !tbaa !10
  %279 = load i32, ptr %12, align 4, !tbaa !10
  %280 = icmp eq i32 %278, %279
  br i1 %280, label %281, label %287

281:                                              ; preds = %277
  %282 = load i8, ptr %14, align 1, !tbaa !9
  %283 = zext i8 %282 to i32
  %284 = call i32 (ptr, ...) @printf(ptr noundef @.str.662, i32 noundef %283)
  %285 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.663)
  %286 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %285, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 -62, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %288

287:                                              ; preds = %277
  store i32 0, ptr %7, align 4
  store i32 1, ptr %19, align 4
  br label %288

288:                                              ; preds = %287, %281, %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #4
  br label %289

289:                                              ; preds = %288, %31
  %290 = load i32, ptr %7, align 4
  ret i32 %290
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5Gowin13spi_wait_gw5aEhhhjb(ptr noundef nonnull align 8 dereferenceable(192), i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i32 noundef, i1 noundef zeroext) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

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 = { mustprogress 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 = { inlinehint mustprogress 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++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!15, !13, i64 176}
!15 = !{!"_ZTS5Gowin", !16, i64 0, !21, i64 88, !22, i64 144, !22, i64 152, !22, i64 160, !11, i64 168, !13, i64 172, !13, i64 173, !13, i64 174, !13, i64 175, !13, i64 176, !13, i64 177, !13, i64 178, !7, i64 179, !7, i64 180, !7, i64 181, !7, i64 182, !7, i64 183, !28, i64 184, !28, i64 188}
!16 = !{!"_ZTS6Device", !6, i64 8, !17, i64 16, !17, i64 48, !20, i64 80, !13, i64 84, !13, i64 85, !13, i64 86}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !19, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!"_ZTSN6Device9prog_modeE", !7, i64 0}
!21 = !{!"_ZTS12SPIInterface", !7, i64 8, !11, i64 12, !13, i64 16, !13, i64 17, !13, i64 18, !17, i64 24}
!22 = !{!"_ZTSSt10unique_ptrI21ConfigBitstreamParserSt14default_deleteIS0_EE", !23, i64 0}
!23 = !{!"_ZTSSt15__uniq_ptr_dataI21ConfigBitstreamParserSt14default_deleteIS0_ELb1ELb1EE", !24, i64 0}
!24 = !{!"_ZTSSt15__uniq_ptr_implI21ConfigBitstreamParserSt14default_deleteIS0_EE", !25, i64 0}
!25 = !{!"_ZTSSt5tupleIJP21ConfigBitstreamParserSt14default_deleteIS0_EEE", !26, i64 0}
!26 = !{!"_ZTSSt11_Tuple_implILm0EJP21ConfigBitstreamParserSt14default_deleteIS0_EEE", !27, i64 0}
!27 = !{!"_ZTSSt10_Head_baseILm0EP21ConfigBitstreamParserLb0EE", !6, i64 0}
!28 = !{!"_ZTSN13JtagInterface10tck_edge_tE", !7, i64 0}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!15, !13, i64 175}
!32 = !{!16, !6, i64 8}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!15, !7, i64 183}
!36 = !{!15, !7, i64 182}
!37 = !{!15, !7, i64 181}
!38 = !{!15, !7, i64 179}
!39 = distinct !{!39, !34}
!40 = distinct !{!40, !34}
!41 = distinct !{!41, !34}
!42 = !{!15, !7, i64 180}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@.str.659 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.660 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.661 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.662 = external hidden unnamed_addr constant [6 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.663 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

declare void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193), i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5Gowin12send_commandEh(ptr noundef nonnull align 8 dereferenceable(192), i8 noundef zeroext) local_unnamed_addr #2 align 2

declare noundef i32 @_ZN4Jtag7shiftDREPKhPhiNS_10tapState_tE(ptr noundef nonnull align 8 dereferenceable(193), ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193)) local_unnamed_addr #2 align 2

declare noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5Gowin8spi_waitEhhhjb(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i32 noundef %4, i1 noundef zeroext %5) unnamed_addr #2 align 2 {
  %7 = alloca [3 x i8], align 1
  %8 = alloca [3 x i8], align 1
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = getelementptr inbounds i8, ptr %0, i64 176
  %12 = load i8, ptr %11, align 8, !tbaa !5, !range !25, !noundef !26
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %14, label %16

14:                                               ; preds = %6
  %15 = tail call noundef i32 @_ZN5Gowin13spi_wait_gw5aEhhhjb(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i32 noundef %4, i1 noundef zeroext %5)
  br label %386

16:                                               ; preds = %6
  %17 = getelementptr inbounds i8, ptr %0, i64 175
  %18 = load i8, ptr %17, align 1, !tbaa !27, !range !25, !noundef !26
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %20, label %56

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %8) #5
  %21 = tail call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %1)
  store i8 %21, ptr %8, align 1, !tbaa !28
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = getelementptr inbounds i8, ptr %7, i64 1
  %24 = getelementptr inbounds i8, ptr %7, i64 2
  %25 = zext i8 %2 to i32
  %26 = zext i8 %3 to i32
  br label %27

27:                                               ; preds = %52, %20
  %.053 = phi i32 [ 0, %20 ], [ %39, %52 ]
  %28 = call noundef zeroext i1 @_ZN5Gowin12send_commandEh(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext 22)
  br i1 %28, label %29, label %55

29:                                               ; preds = %27
  %30 = load ptr, ptr %22, align 8, !tbaa !29
  call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %30, i32 noundef 7, i8 noundef zeroext 1)
  %31 = load ptr, ptr %22, align 8, !tbaa !29
  %32 = call noundef i32 @_ZN4Jtag7shiftDREPKhPhiNS_10tapState_tE(ptr noundef nonnull align 8 dereferenceable(193) %31, ptr noundef nonnull %8, ptr noundef nonnull %7, i32 noundef 24, i32 noundef 1)
  %33 = load i8, ptr %23, align 1, !tbaa !28
  %34 = lshr i8 %33, 1
  %35 = call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %34)
  %36 = load i8, ptr %24, align 1, !tbaa !28
  %37 = and i8 %36, 1
  %38 = or i8 %37, %35
  %39 = add i32 %.053, 1
  %40 = icmp eq i32 %39, %4
  br i1 %40, label %45, label %41

41:                                               ; preds = %29
  br i1 %5, label %42, label %52

42:                                               ; preds = %41
  %43 = zext i8 %38 to i32
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.660, i32 noundef %43, i32 noundef %25, i32 noundef %26, i32 noundef %39)
  br label %52

45:                                               ; preds = %29
  %46 = zext i8 %38 to i32
  %47 = load i8, ptr %7, align 1, !tbaa !28
  %48 = zext i8 %47 to i32
  %49 = load i8, ptr %23, align 1, !tbaa !28
  %50 = zext i8 %49 to i32
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.659, i32 noundef %46, i32 noundef %48, i32 noundef %50)
  br label %.thread81

52:                                               ; preds = %42, %41
  %53 = and i8 %38, %2
  %.not66 = icmp eq i8 %53, %3
  br i1 %.not66, label %.thread81, label %27, !llvm.loop !30

.thread81:                                        ; preds = %52, %45
  %54 = phi i32 [ %4, %45 ], [ %39, %52 ]
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %7) #5
  br label %379

55:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %7) #5
  br label %386

56:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #5
  %57 = getelementptr inbounds i8, ptr %0, i64 183
  %58 = load i8, ptr %57, align 1, !tbaa !32
  %59 = getelementptr inbounds i8, ptr %0, i64 182
  %60 = load i8, ptr %59, align 2, !tbaa !33
  %61 = or i8 %60, %58
  store i8 %61, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %62 = zext i8 %1 to i32
  %63 = getelementptr inbounds i8, ptr %0, i64 181
  %64 = getelementptr inbounds i8, ptr %0, i64 179
  %65 = getelementptr inbounds i8, ptr %0, i64 8
  %66 = load i8, ptr %57, align 1, !tbaa !32
  %67 = load i8, ptr %59, align 2, !tbaa !33
  %68 = or i8 %67, %66
  store i8 %68, ptr %9, align 1, !tbaa !28
  %.not65 = icmp sgt i8 %1, -1
  br i1 %.not65, label %174, label %171

.split.us:                                        ; preds = %258, %167
  %.255.us = phi i32 [ %165, %167 ], [ 0, %258 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %69 = load i8, ptr %64, align 1, !tbaa !34
  %70 = xor i8 %69, -1
  %71 = load i8, ptr %9, align 1, !tbaa !28
  %72 = and i8 %71, %70
  store i8 %72, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %73 = load i8, ptr %64, align 1, !tbaa !34
  %74 = load i8, ptr %9, align 1, !tbaa !28
  %75 = or i8 %74, %73
  store i8 %75, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %76 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %76)
  %77 = load i8, ptr %10, align 1, !tbaa !28
  %78 = load i8, ptr %59, align 2, !tbaa !33
  %79 = and i8 %78, %77
  %.not64.us = icmp eq i8 %79, 0
  %80 = select i1 %.not64.us, i8 0, i8 -128
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %81 = load i8, ptr %64, align 1, !tbaa !34
  %82 = xor i8 %81, -1
  %83 = load i8, ptr %9, align 1, !tbaa !28
  %84 = and i8 %83, %82
  store i8 %84, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %85 = load i8, ptr %64, align 1, !tbaa !34
  %86 = load i8, ptr %9, align 1, !tbaa !28
  %87 = or i8 %86, %85
  store i8 %87, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %88 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %88)
  %89 = load i8, ptr %10, align 1, !tbaa !28
  %90 = load i8, ptr %59, align 2, !tbaa !33
  %91 = and i8 %90, %89
  %.not64.us.1 = icmp eq i8 %91, 0
  %92 = select i1 %.not64.us.1, i8 0, i8 64
  %spec.select.us.1 = or disjoint i8 %92, %80
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %93 = load i8, ptr %64, align 1, !tbaa !34
  %94 = xor i8 %93, -1
  %95 = load i8, ptr %9, align 1, !tbaa !28
  %96 = and i8 %95, %94
  store i8 %96, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %97 = load i8, ptr %64, align 1, !tbaa !34
  %98 = load i8, ptr %9, align 1, !tbaa !28
  %99 = or i8 %98, %97
  store i8 %99, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %100 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %100)
  %101 = load i8, ptr %10, align 1, !tbaa !28
  %102 = load i8, ptr %59, align 2, !tbaa !33
  %103 = and i8 %102, %101
  %.not64.us.2 = icmp eq i8 %103, 0
  %104 = select i1 %.not64.us.2, i8 0, i8 32
  %spec.select.us.2 = or disjoint i8 %104, %spec.select.us.1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %105 = load i8, ptr %64, align 1, !tbaa !34
  %106 = xor i8 %105, -1
  %107 = load i8, ptr %9, align 1, !tbaa !28
  %108 = and i8 %107, %106
  store i8 %108, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %109 = load i8, ptr %64, align 1, !tbaa !34
  %110 = load i8, ptr %9, align 1, !tbaa !28
  %111 = or i8 %110, %109
  store i8 %111, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %112 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %112)
  %113 = load i8, ptr %10, align 1, !tbaa !28
  %114 = load i8, ptr %59, align 2, !tbaa !33
  %115 = and i8 %114, %113
  %.not64.us.3 = icmp eq i8 %115, 0
  %116 = select i1 %.not64.us.3, i8 0, i8 16
  %spec.select.us.3 = or disjoint i8 %116, %spec.select.us.2
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %117 = load i8, ptr %64, align 1, !tbaa !34
  %118 = xor i8 %117, -1
  %119 = load i8, ptr %9, align 1, !tbaa !28
  %120 = and i8 %119, %118
  store i8 %120, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %121 = load i8, ptr %64, align 1, !tbaa !34
  %122 = load i8, ptr %9, align 1, !tbaa !28
  %123 = or i8 %122, %121
  store i8 %123, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %124 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %124)
  %125 = load i8, ptr %10, align 1, !tbaa !28
  %126 = load i8, ptr %59, align 2, !tbaa !33
  %127 = and i8 %126, %125
  %.not64.us.4 = icmp eq i8 %127, 0
  %128 = select i1 %.not64.us.4, i8 0, i8 8
  %spec.select.us.4 = or disjoint i8 %128, %spec.select.us.3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %129 = load i8, ptr %64, align 1, !tbaa !34
  %130 = xor i8 %129, -1
  %131 = load i8, ptr %9, align 1, !tbaa !28
  %132 = and i8 %131, %130
  store i8 %132, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %133 = load i8, ptr %64, align 1, !tbaa !34
  %134 = load i8, ptr %9, align 1, !tbaa !28
  %135 = or i8 %134, %133
  store i8 %135, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %136 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %136)
  %137 = load i8, ptr %10, align 1, !tbaa !28
  %138 = load i8, ptr %59, align 2, !tbaa !33
  %139 = and i8 %138, %137
  %.not64.us.5 = icmp eq i8 %139, 0
  %140 = select i1 %.not64.us.5, i8 0, i8 4
  %spec.select.us.5 = or disjoint i8 %140, %spec.select.us.4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %141 = load i8, ptr %64, align 1, !tbaa !34
  %142 = xor i8 %141, -1
  %143 = load i8, ptr %9, align 1, !tbaa !28
  %144 = and i8 %143, %142
  store i8 %144, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %145 = load i8, ptr %64, align 1, !tbaa !34
  %146 = load i8, ptr %9, align 1, !tbaa !28
  %147 = or i8 %146, %145
  store i8 %147, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %148 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %148)
  %149 = load i8, ptr %10, align 1, !tbaa !28
  %150 = load i8, ptr %59, align 2, !tbaa !33
  %151 = and i8 %150, %149
  %.not64.us.6 = icmp eq i8 %151, 0
  %152 = select i1 %.not64.us.6, i8 0, i8 2
  %spec.select.us.6 = or i8 %152, %spec.select.us.5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %153 = load i8, ptr %64, align 1, !tbaa !34
  %154 = xor i8 %153, -1
  %155 = load i8, ptr %9, align 1, !tbaa !28
  %156 = and i8 %155, %154
  store i8 %156, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %157 = load i8, ptr %64, align 1, !tbaa !34
  %158 = load i8, ptr %9, align 1, !tbaa !28
  %159 = or i8 %158, %157
  store i8 %159, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %160 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %160)
  %161 = load i8, ptr %10, align 1, !tbaa !28
  %162 = load i8, ptr %59, align 2, !tbaa !33
  %163 = and i8 %162, %161
  %.not64.us.7 = icmp ne i8 %163, 0
  %164 = zext i1 %.not64.us.7 to i8
  %spec.select.us.7 = or i8 %spec.select.us.6, %164
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  %165 = add i32 %.255.us, 1
  %166 = icmp eq i32 %165, %4
  br i1 %166, label %.split101.us, label %167

167:                                              ; preds = %.split.us
  %168 = zext i8 %spec.select.us.7 to i32
  %169 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.660, i32 noundef %168, i32 noundef %266, i32 noundef %267, i32 noundef %165)
  %170 = and i8 %spec.select.us.7, %2
  %.not.us = icmp eq i8 %170, %3
  br i1 %.not.us, label %.loopexit, label %.split.us, !llvm.loop !35

171:                                              ; preds = %56
  %172 = load i8, ptr %63, align 1, !tbaa !36
  %173 = or i8 %172, %68
  store i8 %173, ptr %9, align 1, !tbaa !28
  br label %174

174:                                              ; preds = %171, %56
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %175 = load i8, ptr %64, align 1, !tbaa !34
  %176 = load i8, ptr %9, align 1, !tbaa !28
  %177 = or i8 %176, %175
  store i8 %177, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %178 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %178)
  %179 = load i8, ptr %57, align 1, !tbaa !32
  %180 = load i8, ptr %59, align 2, !tbaa !33
  %181 = or i8 %180, %179
  store i8 %181, ptr %9, align 1, !tbaa !28
  %182 = and i32 %62, 64
  %.not65.1 = icmp eq i32 %182, 0
  br i1 %.not65.1, label %186, label %183

183:                                              ; preds = %174
  %184 = load i8, ptr %63, align 1, !tbaa !36
  %185 = or i8 %184, %181
  store i8 %185, ptr %9, align 1, !tbaa !28
  br label %186

186:                                              ; preds = %183, %174
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %187 = load i8, ptr %64, align 1, !tbaa !34
  %188 = load i8, ptr %9, align 1, !tbaa !28
  %189 = or i8 %188, %187
  store i8 %189, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %190 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %190)
  %191 = load i8, ptr %57, align 1, !tbaa !32
  %192 = load i8, ptr %59, align 2, !tbaa !33
  %193 = or i8 %192, %191
  store i8 %193, ptr %9, align 1, !tbaa !28
  %194 = and i32 %62, 32
  %.not65.2 = icmp eq i32 %194, 0
  br i1 %.not65.2, label %198, label %195

195:                                              ; preds = %186
  %196 = load i8, ptr %63, align 1, !tbaa !36
  %197 = or i8 %196, %193
  store i8 %197, ptr %9, align 1, !tbaa !28
  br label %198

198:                                              ; preds = %195, %186
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %199 = load i8, ptr %64, align 1, !tbaa !34
  %200 = load i8, ptr %9, align 1, !tbaa !28
  %201 = or i8 %200, %199
  store i8 %201, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %202 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %202)
  %203 = load i8, ptr %57, align 1, !tbaa !32
  %204 = load i8, ptr %59, align 2, !tbaa !33
  %205 = or i8 %204, %203
  store i8 %205, ptr %9, align 1, !tbaa !28
  %206 = and i32 %62, 16
  %.not65.3 = icmp eq i32 %206, 0
  br i1 %.not65.3, label %210, label %207

207:                                              ; preds = %198
  %208 = load i8, ptr %63, align 1, !tbaa !36
  %209 = or i8 %208, %205
  store i8 %209, ptr %9, align 1, !tbaa !28
  br label %210

210:                                              ; preds = %207, %198
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %211 = load i8, ptr %64, align 1, !tbaa !34
  %212 = load i8, ptr %9, align 1, !tbaa !28
  %213 = or i8 %212, %211
  store i8 %213, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %214 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %214)
  %215 = load i8, ptr %57, align 1, !tbaa !32
  %216 = load i8, ptr %59, align 2, !tbaa !33
  %217 = or i8 %216, %215
  store i8 %217, ptr %9, align 1, !tbaa !28
  %218 = and i32 %62, 8
  %.not65.4 = icmp eq i32 %218, 0
  br i1 %.not65.4, label %222, label %219

219:                                              ; preds = %210
  %220 = load i8, ptr %63, align 1, !tbaa !36
  %221 = or i8 %220, %217
  store i8 %221, ptr %9, align 1, !tbaa !28
  br label %222

222:                                              ; preds = %219, %210
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %223 = load i8, ptr %64, align 1, !tbaa !34
  %224 = load i8, ptr %9, align 1, !tbaa !28
  %225 = or i8 %224, %223
  store i8 %225, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %226 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %226)
  %227 = load i8, ptr %57, align 1, !tbaa !32
  %228 = load i8, ptr %59, align 2, !tbaa !33
  %229 = or i8 %228, %227
  store i8 %229, ptr %9, align 1, !tbaa !28
  %230 = and i32 %62, 4
  %.not65.5 = icmp eq i32 %230, 0
  br i1 %.not65.5, label %234, label %231

231:                                              ; preds = %222
  %232 = load i8, ptr %63, align 1, !tbaa !36
  %233 = or i8 %232, %229
  store i8 %233, ptr %9, align 1, !tbaa !28
  br label %234

234:                                              ; preds = %231, %222
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %235 = load i8, ptr %64, align 1, !tbaa !34
  %236 = load i8, ptr %9, align 1, !tbaa !28
  %237 = or i8 %236, %235
  store i8 %237, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %238 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %238)
  %239 = load i8, ptr %57, align 1, !tbaa !32
  %240 = load i8, ptr %59, align 2, !tbaa !33
  %241 = or i8 %240, %239
  store i8 %241, ptr %9, align 1, !tbaa !28
  %242 = and i32 %62, 2
  %.not65.6 = icmp eq i32 %242, 0
  br i1 %.not65.6, label %246, label %243

243:                                              ; preds = %234
  %244 = load i8, ptr %63, align 1, !tbaa !36
  %245 = or i8 %244, %241
  store i8 %245, ptr %9, align 1, !tbaa !28
  br label %246

246:                                              ; preds = %243, %234
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %247 = load i8, ptr %64, align 1, !tbaa !34
  %248 = load i8, ptr %9, align 1, !tbaa !28
  %249 = or i8 %248, %247
  store i8 %249, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %250 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %250)
  %251 = load i8, ptr %57, align 1, !tbaa !32
  %252 = load i8, ptr %59, align 2, !tbaa !33
  %253 = or i8 %252, %251
  store i8 %253, ptr %9, align 1, !tbaa !28
  %254 = and i32 %62, 1
  %.not65.7 = icmp eq i32 %254, 0
  br i1 %.not65.7, label %258, label %255

255:                                              ; preds = %246
  %256 = load i8, ptr %63, align 1, !tbaa !36
  %257 = or i8 %256, %253
  store i8 %257, ptr %9, align 1, !tbaa !28
  br label %258

258:                                              ; preds = %255, %246
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %259 = load i8, ptr %64, align 1, !tbaa !34
  %260 = load i8, ptr %9, align 1, !tbaa !28
  %261 = or i8 %260, %259
  store i8 %261, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %262 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %262)
  %263 = load i8, ptr %57, align 1, !tbaa !32
  %264 = load i8, ptr %59, align 2, !tbaa !33
  %265 = or i8 %264, %263
  store i8 %265, ptr %9, align 1, !tbaa !28
  %266 = zext i8 %2 to i32
  %267 = zext i8 %3 to i32
  br i1 %5, label %.split.us, label %.split

.split:                                           ; preds = %258, %368
  %.255 = phi i32 [ %364, %368 ], [ 0, %258 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %268 = load i8, ptr %64, align 1, !tbaa !34
  %269 = xor i8 %268, -1
  %270 = load i8, ptr %9, align 1, !tbaa !28
  %271 = and i8 %270, %269
  store i8 %271, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %272 = load i8, ptr %64, align 1, !tbaa !34
  %273 = load i8, ptr %9, align 1, !tbaa !28
  %274 = or i8 %273, %272
  store i8 %274, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %275 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %275)
  %276 = load i8, ptr %10, align 1, !tbaa !28
  %277 = load i8, ptr %59, align 2, !tbaa !33
  %278 = and i8 %277, %276
  %.not64 = icmp eq i8 %278, 0
  %279 = select i1 %.not64, i8 0, i8 -128
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %280 = load i8, ptr %64, align 1, !tbaa !34
  %281 = xor i8 %280, -1
  %282 = load i8, ptr %9, align 1, !tbaa !28
  %283 = and i8 %282, %281
  store i8 %283, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %284 = load i8, ptr %64, align 1, !tbaa !34
  %285 = load i8, ptr %9, align 1, !tbaa !28
  %286 = or i8 %285, %284
  store i8 %286, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %287 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %287)
  %288 = load i8, ptr %10, align 1, !tbaa !28
  %289 = load i8, ptr %59, align 2, !tbaa !33
  %290 = and i8 %289, %288
  %.not64.1 = icmp eq i8 %290, 0
  %291 = select i1 %.not64.1, i8 0, i8 64
  %spec.select.1 = or disjoint i8 %291, %279
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %292 = load i8, ptr %64, align 1, !tbaa !34
  %293 = xor i8 %292, -1
  %294 = load i8, ptr %9, align 1, !tbaa !28
  %295 = and i8 %294, %293
  store i8 %295, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %296 = load i8, ptr %64, align 1, !tbaa !34
  %297 = load i8, ptr %9, align 1, !tbaa !28
  %298 = or i8 %297, %296
  store i8 %298, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %299 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %299)
  %300 = load i8, ptr %10, align 1, !tbaa !28
  %301 = load i8, ptr %59, align 2, !tbaa !33
  %302 = and i8 %301, %300
  %.not64.2 = icmp eq i8 %302, 0
  %303 = select i1 %.not64.2, i8 0, i8 32
  %spec.select.2 = or disjoint i8 %303, %spec.select.1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %304 = load i8, ptr %64, align 1, !tbaa !34
  %305 = xor i8 %304, -1
  %306 = load i8, ptr %9, align 1, !tbaa !28
  %307 = and i8 %306, %305
  store i8 %307, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %308 = load i8, ptr %64, align 1, !tbaa !34
  %309 = load i8, ptr %9, align 1, !tbaa !28
  %310 = or i8 %309, %308
  store i8 %310, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %311 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %311)
  %312 = load i8, ptr %10, align 1, !tbaa !28
  %313 = load i8, ptr %59, align 2, !tbaa !33
  %314 = and i8 %313, %312
  %.not64.3 = icmp eq i8 %314, 0
  %315 = select i1 %.not64.3, i8 0, i8 16
  %spec.select.3 = or disjoint i8 %315, %spec.select.2
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %316 = load i8, ptr %64, align 1, !tbaa !34
  %317 = xor i8 %316, -1
  %318 = load i8, ptr %9, align 1, !tbaa !28
  %319 = and i8 %318, %317
  store i8 %319, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %320 = load i8, ptr %64, align 1, !tbaa !34
  %321 = load i8, ptr %9, align 1, !tbaa !28
  %322 = or i8 %321, %320
  store i8 %322, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %323 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %323)
  %324 = load i8, ptr %10, align 1, !tbaa !28
  %325 = load i8, ptr %59, align 2, !tbaa !33
  %326 = and i8 %325, %324
  %.not64.4 = icmp eq i8 %326, 0
  %327 = select i1 %.not64.4, i8 0, i8 8
  %spec.select.4 = or disjoint i8 %327, %spec.select.3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %328 = load i8, ptr %64, align 1, !tbaa !34
  %329 = xor i8 %328, -1
  %330 = load i8, ptr %9, align 1, !tbaa !28
  %331 = and i8 %330, %329
  store i8 %331, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %332 = load i8, ptr %64, align 1, !tbaa !34
  %333 = load i8, ptr %9, align 1, !tbaa !28
  %334 = or i8 %333, %332
  store i8 %334, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %335 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %335)
  %336 = load i8, ptr %10, align 1, !tbaa !28
  %337 = load i8, ptr %59, align 2, !tbaa !33
  %338 = and i8 %337, %336
  %.not64.5 = icmp eq i8 %338, 0
  %339 = select i1 %.not64.5, i8 0, i8 4
  %spec.select.5 = or disjoint i8 %339, %spec.select.4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %340 = load i8, ptr %64, align 1, !tbaa !34
  %341 = xor i8 %340, -1
  %342 = load i8, ptr %9, align 1, !tbaa !28
  %343 = and i8 %342, %341
  store i8 %343, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %344 = load i8, ptr %64, align 1, !tbaa !34
  %345 = load i8, ptr %9, align 1, !tbaa !28
  %346 = or i8 %345, %344
  store i8 %346, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %347 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %347)
  %348 = load i8, ptr %10, align 1, !tbaa !28
  %349 = load i8, ptr %59, align 2, !tbaa !33
  %350 = and i8 %349, %348
  %.not64.6 = icmp eq i8 %350, 0
  %351 = select i1 %.not64.6, i8 0, i8 2
  %spec.select.6 = or i8 %351, %spec.select.5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #5
  %352 = load i8, ptr %64, align 1, !tbaa !34
  %353 = xor i8 %352, -1
  %354 = load i8, ptr %9, align 1, !tbaa !28
  %355 = and i8 %354, %353
  store i8 %355, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %356 = load i8, ptr %64, align 1, !tbaa !34
  %357 = load i8, ptr %9, align 1, !tbaa !28
  %358 = or i8 %357, %356
  store i8 %358, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 8)
  %359 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %359)
  %360 = load i8, ptr %10, align 1, !tbaa !28
  %361 = load i8, ptr %59, align 2, !tbaa !33
  %362 = and i8 %361, %360
  %.not64.7 = icmp ne i8 %362, 0
  %363 = zext i1 %.not64.7 to i8
  %spec.select.7 = or i8 %spec.select.6, %363
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #5
  %364 = add i32 %.255, 1
  %365 = icmp eq i32 %364, %4
  br i1 %365, label %.split101.us, label %368

.split101.us:                                     ; preds = %.split, %.split.us
  %.us-phi102 = phi i8 [ %spec.select.us.7, %.split.us ], [ %spec.select.7, %.split ]
  %366 = zext i8 %.us-phi102 to i32
  %367 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.661, i32 noundef %366)
  br label %.loopexit

368:                                              ; preds = %.split
  %369 = and i8 %spec.select.7, %2
  %.not = icmp eq i8 %369, %3
  br i1 %.not, label %.loopexit, label %.split, !llvm.loop !35

.loopexit:                                        ; preds = %368, %167, %.split101.us
  %370 = phi i32 [ %4, %.split101.us ], [ %165, %167 ], [ %364, %368 ]
  %.259.lcssa92 = phi i8 [ %.us-phi102, %.split101.us ], [ %spec.select.us.7, %167 ], [ %spec.select.7, %368 ]
  %371 = load i8, ptr %64, align 1, !tbaa !34
  %372 = xor i8 %371, -1
  %373 = load i8, ptr %9, align 1, !tbaa !28
  %374 = and i8 %373, %372
  %375 = getelementptr inbounds i8, ptr %0, i64 180
  %376 = load i8, ptr %375, align 4, !tbaa !37
  %377 = or i8 %376, %374
  store i8 %377, ptr %9, align 1, !tbaa !28
  call void @_ZN5Gowin15spi_gowin_writeEPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef nonnull %9, ptr noundef null, i32 noundef 8)
  %378 = load ptr, ptr %65, align 8, !tbaa !29
  call void @_ZN4Jtag5flushEv(ptr noundef nonnull align 8 dereferenceable(193) %378)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #5
  br label %379

379:                                              ; preds = %.thread81, %.loopexit
  %.4 = phi i8 [ %.259.lcssa92, %.loopexit ], [ %38, %.thread81 ]
  %.356 = phi i32 [ %370, %.loopexit ], [ %54, %.thread81 ]
  %380 = icmp eq i32 %.356, %4
  br i1 %380, label %381, label %386

381:                                              ; preds = %379
  %382 = zext i8 %.4 to i32
  %383 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.662, i32 noundef %382)
  %384 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.663)
  %385 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %384, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %386

386:                                              ; preds = %55, %381, %379, %14
  %.3 = phi i32 [ %15, %14 ], [ -62, %381 ], [ -1, %55 ], [ 0, %379 ]
  ret i32 %.3
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5Gowin13spi_wait_gw5aEhhhjb(ptr noundef nonnull align 8 dereferenceable(192), i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i32 noundef, i1 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { mustprogress 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 = { mustprogress 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 = { nofree 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 #4 = { inlinehint mustprogress 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 #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, !15, i64 176}
!6 = !{!"_ZTS5Gowin", !7, i64 0, !16, i64 88, !18, i64 144, !18, i64 152, !18, i64 160, !17, i64 168, !15, i64 172, !15, i64 173, !15, i64 174, !15, i64 175, !15, i64 176, !15, i64 177, !15, i64 178, !9, i64 179, !9, i64 180, !9, i64 181, !9, i64 182, !9, i64 183, !24, i64 184, !24, i64 188}
!7 = !{!"_ZTS6Device", !8, i64 8, !11, i64 16, !11, i64 48, !14, i64 80, !15, i64 84, !15, i64 85, !15, i64 86}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !13, i64 8, !9, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !8, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!"_ZTSN6Device9prog_modeE", !9, i64 0}
!15 = !{!"bool", !9, i64 0}
!16 = !{!"_ZTS12SPIInterface", !9, i64 8, !17, i64 12, !15, i64 16, !15, i64 17, !15, i64 18, !11, i64 24}
!17 = !{!"int", !9, i64 0}
!18 = !{!"_ZTSSt10unique_ptrI21ConfigBitstreamParserSt14default_deleteIS0_EE", !19, i64 0}
!19 = !{!"_ZTSSt15__uniq_ptr_dataI21ConfigBitstreamParserSt14default_deleteIS0_ELb1ELb1EE", !20, i64 0}
!20 = !{!"_ZTSSt15__uniq_ptr_implI21ConfigBitstreamParserSt14default_deleteIS0_EE", !21, i64 0}
!21 = !{!"_ZTSSt5tupleIJP21ConfigBitstreamParserSt14default_deleteIS0_EEE", !22, i64 0}
!22 = !{!"_ZTSSt11_Tuple_implILm0EJP21ConfigBitstreamParserSt14default_deleteIS0_EEE", !23, i64 0}
!23 = !{!"_ZTSSt10_Head_baseILm0EP21ConfigBitstreamParserLb0EE", !8, i64 0}
!24 = !{!"_ZTSN13JtagInterface10tck_edge_tE", !9, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!6, !15, i64 175}
!28 = !{!9, !9, i64 0}
!29 = !{!7, !8, i64 8}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!6, !9, i64 183}
!33 = !{!6, !9, i64 182}
!34 = !{!6, !9, i64 179}
!35 = distinct !{!35, !31}
!36 = !{!6, !9, i64 181}
!37 = !{!6, !9, i64 180}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass