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

; 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.Device = type <{ ptr, ptr, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i8, 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] }

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

declare void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193), i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5Gowin12spi_put_gw5aEhPKhPhj(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #3 align 2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i8, align 1
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i8 %1, ptr %8, align 1, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !10
  %22 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %23 = load i32, ptr %11, align 4, !tbaa !10
  %24 = load ptr, ptr %10, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  %26 = zext i1 %25 to i64
  %27 = select i1 %25, i32 1, i32 0
  %28 = add i32 %23, %27
  store i32 %28, ptr %12, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %29 = load i32, ptr %11, align 4, !tbaa !10
  %30 = mul i32 %29, 8
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  %33 = zext i1 %32 to i64
  %34 = select i1 %32, i32 3, i32 0
  %35 = add i32 %30, %34
  store i32 %35, ptr %13, align 4, !tbaa !10
  %36 = load i32, ptr %12, align 4, !tbaa !10
  %37 = zext i32 %36 to i64
  %38 = call ptr @llvm.stacksave.p0()
  store ptr %38, ptr %14, align 8
  %39 = alloca i8, i64 %37, align 16
  store i64 %37, ptr %15, align 8
  %40 = load i32, ptr %12, align 4, !tbaa !10
  %41 = zext i32 %40 to i64
  %42 = alloca i8, i64 %41, align 16
  store i64 %41, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #5
  %43 = load i8, ptr %8, align 1, !tbaa !9
  %44 = call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %43)
  store i8 %44, ptr %17, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #5
  %45 = load i8, ptr %8, align 1, !tbaa !9
  %46 = zext i8 %45 to i32
  %47 = and i32 %46, 1
  %48 = trunc i32 %47 to i8
  store i8 %48, ptr %18, align 1, !tbaa !9
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %80

51:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !10
  br label %52

52:                                               ; preds = %67, %51
  %53 = load i32, ptr %19, align 4, !tbaa !10
  %54 = load i32, ptr %11, align 4, !tbaa !10
  %55 = icmp ult i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %70

57:                                               ; preds = %52
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = load i32, ptr %19, align 4, !tbaa !10
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds i8, ptr %58, i64 %60
  %62 = load i8, ptr %61, align 1, !tbaa !9
  %63 = call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %62)
  %64 = load i32, ptr %19, align 4, !tbaa !10
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds i8, ptr %39, i64 %65
  store i8 %63, ptr %66, align 1, !tbaa !9
  br label %67

67:                                               ; preds = %57
  %68 = load i32, ptr %19, align 4, !tbaa !10
  %69 = add i32 %68, 1
  store i32 %69, ptr %19, align 4, !tbaa !10
  br label %52, !llvm.loop !12

70:                                               ; preds = %56
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = load i32, ptr %11, align 4, !tbaa !10
  %73 = sub i32 %72, 1
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds i8, ptr %71, i64 %74
  %76 = load i8, ptr %75, align 1, !tbaa !9
  %77 = zext i8 %76 to i32
  %78 = and i32 %77, 1
  %79 = trunc i32 %78 to i8
  store i8 %79, ptr %18, align 1, !tbaa !9
  br label %86

80:                                               ; preds = %5
  %81 = load i8, ptr %18, align 1, !tbaa !9
  %82 = zext i8 %81 to i32
  %83 = trunc i32 %82 to i8
  %84 = load i32, ptr %12, align 4, !tbaa !10
  %85 = zext i32 %84 to i64
  call void @llvm.memset.p0.i64(ptr align 16 %39, i8 %83, i64 %85, i1 false)
  br label %86

86:                                               ; preds = %80, %70
  %87 = getelementptr inbounds %class.Device, ptr %22, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !14
  %89 = load i8, ptr %17, align 1, !tbaa !9
  %90 = zext i8 %89 to i32
  %91 = and i32 %90, 1
  %92 = trunc i32 %91 to i8
  call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %88, i32 noundef 1, i8 noundef zeroext %92)
  %93 = load i8, ptr %17, align 1, !tbaa !9
  %94 = zext i8 %93 to i32
  %95 = ashr i32 %94, 1
  %96 = trunc i32 %95 to i8
  store i8 %96, ptr %17, align 1, !tbaa !9
  %97 = getelementptr inbounds %class.Device, ptr %22, i32 0, i32 1
  %98 = load ptr, ptr %97, align 8, !tbaa !14
  %99 = call noundef i32 @_ZN4Jtag10read_writeEPKhPhic(ptr noundef nonnull align 8 dereferenceable(193) %98, ptr noundef %17, ptr noundef null, i32 noundef 7, i8 noundef signext 0)
  %100 = icmp ne i32 0, %99
  br i1 %100, label %101, label %102

101:                                              ; preds = %86
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %159

102:                                              ; preds = %86
  %103 = getelementptr inbounds %class.Device, ptr %22, i32 0, i32 1
  %104 = load ptr, ptr %103, align 8, !tbaa !14
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = icmp ne ptr %105, null
  br i1 %106, label %107, label %108

107:                                              ; preds = %102
  br label %109

108:                                              ; preds = %102
  br label %109

109:                                              ; preds = %108, %107
  %110 = phi ptr [ %42, %107 ], [ null, %108 ]
  %111 = load i32, ptr %13, align 4, !tbaa !10
  %112 = call noundef i32 @_ZN4Jtag10read_writeEPKhPhic(ptr noundef nonnull align 8 dereferenceable(193) %104, ptr noundef %39, ptr noundef %110, i32 noundef %111, i8 noundef signext 0)
  %113 = icmp ne i32 0, %112
  br i1 %113, label %114, label %115

114:                                              ; preds = %109
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %159

115:                                              ; preds = %109
  %116 = getelementptr inbounds %class.Device, ptr %22, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8, !tbaa !14
  %118 = load i8, ptr %18, align 1, !tbaa !9
  call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %117, i32 noundef 0, i8 noundef zeroext %118)
  %119 = getelementptr inbounds %class.Device, ptr %22, i32 0, i32 1
  %120 = load ptr, ptr %119, align 8, !tbaa !14
  call void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193) %120, i32 noundef 5)
  %121 = getelementptr inbounds %class.Device, ptr %22, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !14
  %123 = call noundef i32 @_ZN4Jtag8flushTMSEb(ptr noundef nonnull align 8 dereferenceable(193) %122, i1 noundef zeroext true)
  %124 = load ptr, ptr %10, align 8, !tbaa !5
  %125 = icmp ne ptr %124, null
  br i1 %125, label %126, label %158

126:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !10
  br label %127

127:                                              ; preds = %154, %126
  %128 = load i32, ptr %21, align 4, !tbaa !10
  %129 = load i32, ptr %11, align 4, !tbaa !10
  %130 = icmp ult i32 %128, %129
  br i1 %130, label %132, label %131

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

132:                                              ; preds = %127
  %133 = load i32, ptr %21, align 4, !tbaa !10
  %134 = zext i32 %133 to i64
  %135 = getelementptr inbounds i8, ptr %42, i64 %134
  %136 = load i8, ptr %135, align 1, !tbaa !9
  %137 = zext i8 %136 to i32
  %138 = ashr i32 %137, 3
  %139 = load i32, ptr %21, align 4, !tbaa !10
  %140 = add i32 %139, 1
  %141 = zext i32 %140 to i64
  %142 = getelementptr inbounds i8, ptr %42, i64 %141
  %143 = load i8, ptr %142, align 1, !tbaa !9
  %144 = zext i8 %143 to i32
  %145 = and i32 %144, 7
  %146 = shl i32 %145, 5
  %147 = or i32 %138, %146
  %148 = trunc i32 %147 to i8
  %149 = call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %148)
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = load i32, ptr %21, align 4, !tbaa !10
  %152 = zext i32 %151 to i64
  %153 = getelementptr inbounds i8, ptr %150, i64 %152
  store i8 %149, ptr %153, align 1, !tbaa !9
  br label %154

154:                                              ; preds = %132
  %155 = load i32, ptr %21, align 4, !tbaa !10
  %156 = add i32 %155, 1
  store i32 %156, ptr %21, align 4, !tbaa !10
  br label %127, !llvm.loop !21

157:                                              ; preds = %131
  br label %158

158:                                              ; preds = %157, %115
  store i32 0, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %159

159:                                              ; preds = %158, %114, %101
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #5
  %160 = load ptr, ptr %14, align 8
  call void @llvm.stackrestore.p0(ptr %160)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %161 = load i32, ptr %6, align 4
  ret i32 %161
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

declare noundef i32 @_ZN4Jtag10read_writeEPKhPhic(ptr noundef nonnull align 8 dereferenceable(193), ptr noundef, ptr noundef, i32 noundef, i8 noundef signext) #2

declare noundef i32 @_ZN4Jtag8flushTMSEb(ptr noundef nonnull align 8 dereferenceable(193), i1 noundef zeroext) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { "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 = { 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 = { nocallback nofree nosync nounwind willreturn }
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, !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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !6, i64 8}
!15 = !{!"_ZTS6Device", !6, i64 8, !16, i64 16, !16, i64 48, !19, i64 80, !20, i64 84, !20, i64 85, !20, i64 86}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTSN6Device9prog_modeE", !7, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = distinct !{!21, !13}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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 #2

declare void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -1, 1) i32 @_ZN5Gowin12spi_put_gw5aEhPKhPhj(ptr nocapture noundef nonnull readonly align 8 dereferenceable(192) %0, i8 noundef zeroext %1, ptr noundef readonly %2, ptr noundef writeonly %3, i32 noundef %4) local_unnamed_addr #3 align 2 {
  %6 = alloca i8, align 1
  %.not = icmp ne ptr %3, null
  %7 = zext i1 %.not to i32
  %8 = add i32 %7, %4
  %9 = shl i32 %4, 3
  %10 = select i1 %.not, i32 3, i32 0
  %11 = or disjoint i32 %9, %10
  %12 = zext i32 %8 to i64
  %13 = alloca i8, i64 %12, align 16
  %14 = alloca i8, i64 %12, align 16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  %15 = tail call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %1)
  %.not38 = icmp eq ptr %2, null
  br i1 %.not38, label %25, label %.preheader41

.preheader41:                                     ; preds = %5
  %.not45 = icmp eq i32 %4, 0
  br i1 %.not45, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader41
  %wide.trip.count = zext i32 %4 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.preheader41
  %16 = add i32 %4, -1
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds i8, ptr %2, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !5
  %20 = and i8 %19, 1
  br label %27

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %21 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = tail call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %22)
  %24 = getelementptr inbounds i8, ptr %13, i64 %indvars.iv
  store i8 %23, ptr %24, align 1, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !8

25:                                               ; preds = %5
  %26 = and i8 %1, 1
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %13, i8 %26, i64 %12, i1 false)
  br label %27

27:                                               ; preds = %25, %._crit_edge
  %.033 = phi i8 [ %20, %._crit_edge ], [ %26, %25 ]
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !10
  %30 = and i8 %15, 1
  tail call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %29, i32 noundef 1, i8 noundef zeroext %30)
  %31 = lshr i8 %15, 1
  store i8 %31, ptr %6, align 1, !tbaa !5
  %32 = load ptr, ptr %28, align 8, !tbaa !10
  %33 = call noundef i32 @_ZN4Jtag10read_writeEPKhPhic(ptr noundef nonnull align 8 dereferenceable(193) %32, ptr noundef nonnull %6, ptr noundef null, i32 noundef 7, i8 noundef signext 0)
  %.not39 = icmp eq i32 %33, 0
  br i1 %.not39, label %34, label %.loopexit

34:                                               ; preds = %27
  %35 = load ptr, ptr %28, align 8, !tbaa !10
  %. = select i1 %.not, ptr %14, ptr null
  %36 = call noundef i32 @_ZN4Jtag10read_writeEPKhPhic(ptr noundef nonnull align 8 dereferenceable(193) %35, ptr noundef nonnull %13, ptr noundef %., i32 noundef %11, i8 noundef signext 0)
  %.not40 = icmp eq i32 %36, 0
  br i1 %.not40, label %37, label %.loopexit

37:                                               ; preds = %34
  %38 = load ptr, ptr %28, align 8, !tbaa !10
  call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %38, i32 noundef 0, i8 noundef zeroext %.033)
  %39 = load ptr, ptr %28, align 8, !tbaa !10
  call void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193) %39, i32 noundef 5)
  %40 = load ptr, ptr %28, align 8, !tbaa !10
  %41 = call noundef i32 @_ZN4Jtag8flushTMSEb(ptr noundef nonnull align 8 dereferenceable(193) %40, i1 noundef zeroext true)
  %42 = icmp ne i32 %4, 0
  %or.cond = and i1 %.not, %42
  br i1 %or.cond, label %.lr.ph44.preheader, label %.loopexit

.lr.ph44.preheader:                               ; preds = %37
  %wide.trip.count50 = zext i32 %4 to i64
  br label %.lr.ph44

.lr.ph44:                                         ; preds = %.lr.ph44.preheader, %.lr.ph44
  %indvars.iv47 = phi i64 [ 0, %.lr.ph44.preheader ], [ %indvars.iv.next48, %.lr.ph44 ]
  %43 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv47
  %44 = load i8, ptr %43, align 1, !tbaa !5
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %45 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv.next48
  %46 = load i8, ptr %45, align 1, !tbaa !5
  %47 = call i8 @llvm.fshl.i8(i8 %46, i8 %44, i8 5)
  %48 = call noundef zeroext i8 @_ZN21ConfigBitstreamParser11reverseByteEh(i8 noundef zeroext %47)
  %49 = getelementptr inbounds i8, ptr %3, i64 %indvars.iv47
  store i8 %48, ptr %49, align 1, !tbaa !5
  %exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50
  br i1 %exitcond51.not, label %.loopexit, label %.lr.ph44, !llvm.loop !18

.loopexit:                                        ; preds = %.lr.ph44, %37, %34, %27
  %.034 = phi i32 [ -1, %27 ], [ -1, %34 ], [ 0, %37 ], [ 0, %.lr.ph44 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  ret i32 %.034
}

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

declare noundef i32 @_ZN4Jtag10read_writeEPKhPhic(ptr noundef nonnull align 8 dereferenceable(193), ptr noundef, ptr noundef, i32 noundef, i8 noundef signext) local_unnamed_addr #2

declare noundef i32 @_ZN4Jtag8flushTMSEb(ptr noundef nonnull align 8 dereferenceable(193), i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { "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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !12, i64 8}
!11 = !{!"_ZTS6Device", !12, i64 8, !13, i64 16, !13, i64 48, !16, i64 80, !17, i64 84, !17, i64 85, !17, i64 86}
!12 = !{!"any pointer", !6, i64 0}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !6, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!15 = !{!"long", !6, i64 0}
!16 = !{!"_ZTSN6Device9prog_modeE", !6, i64 0}
!17 = !{!"bool", !6, i64 0}
!18 = distinct !{!18, !9}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass