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

; 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::__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.std::allocator.0" = type { i8 }
%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.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.664 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.665 = external hidden unnamed_addr constant [39 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: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32), i1 noundef zeroext) #3

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

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

; 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 void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193), i32 noundef) #3

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

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

declare i32 @usleep(i32 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5Gowin20prepare_flash_accessEv(ptr noundef nonnull align 8 dereferenceable(192) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::allocator.0", align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  %11 = getelementptr inbounds %class.Gowin, ptr %10, i32 0, i32 10
  %12 = load i8, ptr %11, align 8, !tbaa !9, !range !26, !noundef !27
  %13 = trunc i8 %12 to i1
  br i1 %13, label %14, label %22

14:                                               ; preds = %1
  %15 = load ptr, ptr %10, align 8, !tbaa !28
  %16 = getelementptr inbounds ptr, ptr %15, i64 11
  %17 = load ptr, ptr %16, align 8
  call void %17(ptr noundef nonnull align 8 dereferenceable(192) %10)
  %18 = getelementptr inbounds %class.Device, ptr %10, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !30
  call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %19, i32 noundef 1, i8 noundef zeroext 1)
  %20 = getelementptr inbounds %class.Device, ptr %10, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !30
  call void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193) %21, i32 noundef 1000000)
  br label %22

22:                                               ; preds = %14, %1
  %23 = call noundef zeroext i1 @_ZN5Gowin9eraseSRAMEv(ptr noundef nonnull align 8 dereferenceable(192) %10)
  br i1 %23, label %36, label %24

24:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef @.str.664, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %25 unwind label %27

25:                                               ; preds = %24
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %4, i1 noundef zeroext true)
          to label %26 unwind label %31

26:                                               ; preds = %25
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #4
  store i1 false, ptr %2, align 1
  br label %71

27:                                               ; preds = %24
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %6, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %7, align 4
  br label %35

31:                                               ; preds = %25
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %6, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  br label %35

35:                                               ; preds = %31, %27
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #4
  br label %73

36:                                               ; preds = %22
  %37 = getelementptr inbounds %class.Gowin, ptr %10, i32 0, i32 10
  %38 = load i8, ptr %37, align 8, !tbaa !9, !range !26, !noundef !27
  %39 = trunc i8 %38 to i1
  br i1 %39, label %40, label %57

40:                                               ; preds = %36
  %41 = call i32 @usleep(i32 noundef 100000)
  %42 = call noundef zeroext i1 @_ZN5Gowin15gw5a_enable_spiEv(ptr noundef nonnull align 8 dereferenceable(192) %10)
  br i1 %42, label %55, label %43

43:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef @.str.665, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %44 unwind label %46

44:                                               ; preds = %43
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %8, i1 noundef zeroext true)
          to label %45 unwind label %50

45:                                               ; preds = %44
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #4
  store i1 false, ptr %2, align 1
  br label %71

46:                                               ; preds = %43
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %6, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %7, align 4
  br label %54

50:                                               ; preds = %44
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %6, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %7, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  br label %54

54:                                               ; preds = %50, %46
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #4
  br label %73

55:                                               ; preds = %40
  %56 = call i32 @usleep(i32 noundef 100000)
  br label %67

57:                                               ; preds = %36
  %58 = getelementptr inbounds %class.Gowin, ptr %10, i32 0, i32 9
  %59 = load i8, ptr %58, align 1, !tbaa !31, !range !26, !noundef !27
  %60 = trunc i8 %59 to i1
  br i1 %60, label %66, label %61

61:                                               ; preds = %57
  %62 = call noundef zeroext i1 @_ZN5Gowin9enableCfgEv(ptr noundef nonnull align 8 dereferenceable(192) %10)
  br i1 %62, label %64, label %63

63:                                               ; preds = %61
  store i1 false, ptr %2, align 1
  br label %71

64:                                               ; preds = %61
  %65 = call noundef zeroext i1 @_ZN5Gowin12send_commandEh(ptr noundef nonnull align 8 dereferenceable(192) %10, i8 noundef zeroext 61)
  br label %66

66:                                               ; preds = %64, %57
  br label %67

67:                                               ; preds = %66, %55
  %68 = getelementptr inbounds %class.Device, ptr %10, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !30
  %70 = call noundef i32 @_ZN4Jtag10setClkFreqEj(ptr noundef nonnull align 8 dereferenceable(193) %69, i32 noundef 10000000)
  store i1 true, ptr %2, align 1
  br label %71

71:                                               ; preds = %67, %63, %45, %26
  %72 = load i1, ptr %2, align 1
  ret i1 %72

73:                                               ; preds = %54, %35
  %74 = load ptr, ptr %6, align 8
  %75 = load i32, ptr %7, align 4
  %76 = insertvalue { ptr, i32 } poison, ptr %74, 0
  %77 = insertvalue { ptr, i32 } %76, i32 %75, 1
  resume { ptr, i32 } %77
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { "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 = !{!10, !16, i64 176}
!10 = !{!"_ZTS5Gowin", !11, i64 0, !17, i64 88, !19, i64 144, !19, i64 152, !19, i64 160, !18, i64 168, !16, i64 172, !16, i64 173, !16, i64 174, !16, i64 175, !16, i64 176, !16, i64 177, !16, i64 178, !7, i64 179, !7, i64 180, !7, i64 181, !7, i64 182, !7, i64 183, !25, i64 184, !25, i64 188}
!11 = !{!"_ZTS6Device", !6, i64 8, !12, i64 16, !12, i64 48, !15, i64 80, !16, i64 84, !16, i64 85, !16, i64 86}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN6Device9prog_modeE", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS12SPIInterface", !7, i64 8, !18, i64 12, !16, i64 16, !16, i64 17, !16, i64 18, !12, i64 24}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSSt10unique_ptrI21ConfigBitstreamParserSt14default_deleteIS0_EE", !20, i64 0}
!20 = !{!"_ZTSSt15__uniq_ptr_dataI21ConfigBitstreamParserSt14default_deleteIS0_ELb1ELb1EE", !21, i64 0}
!21 = !{!"_ZTSSt15__uniq_ptr_implI21ConfigBitstreamParserSt14default_deleteIS0_EE", !22, i64 0}
!22 = !{!"_ZTSSt5tupleIJP21ConfigBitstreamParserSt14default_deleteIS0_EEE", !23, i64 0}
!23 = !{!"_ZTSSt11_Tuple_implILm0EJP21ConfigBitstreamParserSt14default_deleteIS0_EEE", !24, i64 0}
!24 = !{!"_ZTSSt10_Head_baseILm0EP21ConfigBitstreamParserLb0EE", !6, i64 0}
!25 = !{!"_ZTSN13JtagInterface10tck_edge_tE", !7, i64 0}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!29, !29, i64 0}
!29 = !{!"vtable pointer", !8, i64 0}
!30 = !{!11, !6, i64 8}
!31 = !{!10, !16, i64 175}


; 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::__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.std::allocator.0" = type { i8 }

@.str.664 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.665 = external hidden unnamed_addr constant [39 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 nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32), i1 noundef zeroext) local_unnamed_addr #3

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

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

; 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 void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193), i32 noundef) local_unnamed_addr #3

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

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

declare i32 @usleep(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5Gowin20prepare_flash_accessEv(ptr noundef nonnull align 8 dereferenceable(192) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator.0", align 1
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = getelementptr inbounds i8, ptr %0, i64 176
  %7 = load i8, ptr %6, align 8, !tbaa !5, !range !25, !noundef !26
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %9, label %16

9:                                                ; preds = %1
  %10 = load ptr, ptr %0, align 8, !tbaa !27
  %11 = getelementptr inbounds i8, ptr %10, i64 88
  %12 = load ptr, ptr %11, align 8
  tail call void %12(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !29
  tail call void @_ZN4Jtag9set_stateENS_10tapState_tEh(ptr noundef nonnull align 8 dereferenceable(193) %14, i32 noundef 1, i8 noundef zeroext 1)
  %15 = load ptr, ptr %13, align 8, !tbaa !29
  tail call void @_ZN4Jtag9toggleClkEi(ptr noundef nonnull align 8 dereferenceable(193) %15, i32 noundef 1000000)
  br label %16

16:                                               ; preds = %9, %1
  %17 = tail call noundef zeroext i1 @_ZN5Gowin9eraseSRAMEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  br i1 %17, label %26, label %18

18:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull @.str.664, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %19 unwind label %21

19:                                               ; preds = %18
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %2, i1 noundef zeroext true)
          to label %20 unwind label %23

20:                                               ; preds = %19
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #4
  br label %54

21:                                               ; preds = %18
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %25

23:                                               ; preds = %19
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  br label %25

25:                                               ; preds = %23, %21
  %.pn = phi { ptr, i32 } [ %24, %23 ], [ %22, %21 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #4
  br label %55

26:                                               ; preds = %16
  %27 = load i8, ptr %6, align 8, !tbaa !5, !range !25, !noundef !26
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %29, label %42

29:                                               ; preds = %26
  %30 = tail call i32 @usleep(i32 noundef 100000)
  %31 = tail call noundef zeroext i1 @_ZN5Gowin15gw5a_enable_spiEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  br i1 %31, label %40, label %32

32:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @.str.665, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %33 unwind label %35

33:                                               ; preds = %32
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %4, i1 noundef zeroext true)
          to label %34 unwind label %37

34:                                               ; preds = %33
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  br label %54

35:                                               ; preds = %32
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %39

37:                                               ; preds = %33
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  br label %39

39:                                               ; preds = %37, %35
  %.pn8 = phi { ptr, i32 } [ %38, %37 ], [ %36, %35 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  br label %55

40:                                               ; preds = %29
  %41 = tail call i32 @usleep(i32 noundef 100000)
  br label %50

42:                                               ; preds = %26
  %43 = getelementptr inbounds i8, ptr %0, i64 175
  %44 = load i8, ptr %43, align 1, !tbaa !30, !range !25, !noundef !26
  %45 = trunc nuw i8 %44 to i1
  br i1 %45, label %50, label %46

46:                                               ; preds = %42
  %47 = tail call noundef zeroext i1 @_ZN5Gowin9enableCfgEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  br i1 %47, label %48, label %54

48:                                               ; preds = %46
  %49 = tail call noundef zeroext i1 @_ZN5Gowin12send_commandEh(ptr noundef nonnull align 8 dereferenceable(192) %0, i8 noundef zeroext 61)
  br label %50

50:                                               ; preds = %42, %48, %40
  %51 = getelementptr inbounds i8, ptr %0, i64 8
  %52 = load ptr, ptr %51, align 8, !tbaa !29
  %53 = tail call noundef i32 @_ZN4Jtag10setClkFreqEj(ptr noundef nonnull align 8 dereferenceable(193) %52, i32 noundef 10000000)
  br label %54

54:                                               ; preds = %46, %50, %34, %20
  %.06 = phi i1 [ true, %50 ], [ false, %34 ], [ false, %20 ], [ false, %46 ]
  ret i1 %.06

55:                                               ; preds = %39, %25
  %.pn8.pn = phi { ptr, i32 } [ %.pn8, %39 ], [ %.pn, %25 ]
  resume { ptr, i32 } %.pn8.pn
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { "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, !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 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !10, i64 0}
!29 = !{!7, !8, i64 8}
!30 = !{!6, !15, i64 175}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass