; LLVM IR from trabucayre/openFPGALoader :: src/spiFlash.ll (ZN8SPIFlash12set_quad_bitEb)

; 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.SPIFlash = type <{ ptr, ptr, i8, [3 x i8], i32, ptr, i8, [7 x i8] }>
%struct.flash_t = type <{ %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i8, i8, i8, i8, i8, [3 x i8], i32, i8, [4 x i8], [3 x i8], i32, i16, [2 x i8] }>

@.str.146 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [42 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 dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; 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 @_ZN8SPIFlash12write_enableEv(ptr noundef nonnull align 8 dereferenceable(33)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN8SPIFlash15read_status_regEv(ptr noundef nonnull align 8 dereferenceable(33)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8SPIFlash12set_quad_bitEb(ptr noundef nonnull align 8 dereferenceable(33) %0, i1 noundef zeroext %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i16, align 2
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i16, align 2
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator.0", align 1
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::__cxx11::basic_string", align 8
  %18 = alloca %"class.std::allocator.0", align 1
  %19 = alloca %"class.std::__cxx11::basic_string", align 8
  %20 = alloca %"class.std::allocator.0", align 1
  %21 = alloca %"class.std::__cxx11::basic_string", align 8
  %22 = alloca %"class.std::allocator.0", align 1
  %23 = alloca %"class.std::__cxx11::basic_string", align 8
  %24 = alloca %"class.std::allocator.0", align 1
  %25 = alloca %"class.std::__cxx11::basic_string", align 8
  %26 = alloca %"class.std::allocator.0", align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  %27 = zext i1 %1 to i8
  store i8 %27, ptr %5, align 1, !tbaa !9
  %28 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #4
  store i16 0, ptr %8, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #4
  store i16 0, ptr %11, align 2, !tbaa !11
  %29 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = icmp ne ptr %30, null
  br i1 %31, label %44, label %32

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

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

34:                                               ; preds = %33
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #4
  store i1 false, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %234

35:                                               ; preds = %32
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %14, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %15, align 4
  br label %43

39:                                               ; preds = %33
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %14, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #4
  br label %43

43:                                               ; preds = %39, %35
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #4
  br label %236

44:                                               ; preds = %2
  %45 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  %47 = getelementptr inbounds %struct.flash_t, ptr %46, i32 0, i32 14
  %48 = load i16, ptr %47, align 4, !tbaa !17
  %49 = zext i16 %48 to i32
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %57, label %51

51:                                               ; preds = %44
  %52 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = getelementptr inbounds %struct.flash_t, ptr %53, i32 0, i32 13
  %55 = load i32, ptr %54, align 8, !tbaa !23
  %56 = icmp eq i32 %55, 99
  br i1 %56, label %57, label %69

57:                                               ; preds = %51, %44
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef @.str.147, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %58 unwind label %60

58:                                               ; preds = %57
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %17, i1 noundef zeroext true)
          to label %59 unwind label %64

59:                                               ; preds = %58
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #4
  store i1 false, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %234

60:                                               ; preds = %57
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %14, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %15, align 4
  br label %68

64:                                               ; preds = %58
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %14, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #4
  br label %68

68:                                               ; preds = %64, %60
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #4
  br label %236

69:                                               ; preds = %51
  %70 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %71 = load ptr, ptr %70, align 8, !tbaa !15
  %72 = getelementptr inbounds %struct.flash_t, ptr %71, i32 0, i32 13
  %73 = load i32, ptr %72, align 8, !tbaa !23
  switch i32 %73, label %77 [
    i32 0, label %74
    i32 3, label %75
    i32 2, label %76
  ]

74:                                               ; preds = %69
  store i8 5, ptr %7, align 1, !tbaa !24
  store i8 1, ptr %6, align 1, !tbaa !24
  br label %89

75:                                               ; preds = %69
  store i8 -75, ptr %7, align 1, !tbaa !24
  store i8 -79, ptr %6, align 1, !tbaa !24
  store i32 2, ptr %10, align 4, !tbaa !13
  store i32 2, ptr %9, align 4, !tbaa !13
  br label %89

76:                                               ; preds = %69
  store i8 53, ptr %7, align 1, !tbaa !24
  store i8 1, ptr %6, align 1, !tbaa !24
  store i32 2, ptr %10, align 4, !tbaa !13
  br label %89

77:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 32, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %20) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %19, ptr noundef @.str.148, ptr noundef nonnull align 1 dereferenceable(1) %20)
          to label %78 unwind label %80

78:                                               ; preds = %77
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %19, i1 noundef zeroext true)
          to label %79 unwind label %84

79:                                               ; preds = %78
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %20) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #4
  store i1 false, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %234

80:                                               ; preds = %77
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %14, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %15, align 4
  br label %88

84:                                               ; preds = %78
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %14, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #4
  br label %88

88:                                               ; preds = %84, %80
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %20) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #4
  br label %236

89:                                               ; preds = %76, %75, %74
  %90 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !25
  %92 = load i8, ptr %7, align 1, !tbaa !24
  %93 = load i32, ptr %9, align 4, !tbaa !13
  %94 = load ptr, ptr %91, align 8, !tbaa !26
  %95 = getelementptr inbounds ptr, ptr %94, i64 2
  %96 = load ptr, ptr %95, align 8
  %97 = call noundef i32 %96(ptr noundef nonnull align 8 dereferenceable(56) %91, i8 noundef zeroext %92, ptr noundef null, ptr noundef %8, i32 noundef %93)
  %98 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = getelementptr inbounds %struct.flash_t, ptr %99, i32 0, i32 14
  %101 = load i16, ptr %100, align 4, !tbaa !17
  %102 = zext i16 %101 to i32
  %103 = xor i32 %102, -1
  %104 = load i16, ptr %8, align 2, !tbaa !11
  %105 = zext i16 %104 to i32
  %106 = and i32 %105, %103
  %107 = trunc i32 %106 to i16
  store i16 %107, ptr %8, align 2, !tbaa !11
  %108 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 4
  %109 = load i32, ptr %108, align 4, !tbaa !28
  %110 = icmp eq i32 %109, 8378
  br i1 %110, label %111, label %116

111:                                              ; preds = %89
  %112 = load i8, ptr %5, align 1, !tbaa !9, !range !29, !noundef !30
  %113 = trunc i8 %112 to i1
  %114 = xor i1 %113, true
  %115 = zext i1 %114 to i8
  store i8 %115, ptr %5, align 1, !tbaa !9
  br label %116

116:                                              ; preds = %111, %89
  %117 = load i8, ptr %5, align 1, !tbaa !9, !range !29, !noundef !30
  %118 = trunc i8 %117 to i1
  br i1 %118, label %119, label %124

119:                                              ; preds = %116
  %120 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %121 = load ptr, ptr %120, align 8, !tbaa !15
  %122 = getelementptr inbounds %struct.flash_t, ptr %121, i32 0, i32 14
  %123 = load i16, ptr %122, align 4, !tbaa !17
  store i16 %123, ptr %11, align 2, !tbaa !11
  br label %124

124:                                              ; preds = %119, %116
  %125 = load i16, ptr %11, align 2, !tbaa !11
  %126 = zext i16 %125 to i32
  %127 = load i16, ptr %8, align 2, !tbaa !11
  %128 = zext i16 %127 to i32
  %129 = or i32 %128, %126
  %130 = trunc i32 %129 to i16
  store i16 %130, ptr %8, align 2, !tbaa !11
  %131 = call noundef i32 @_ZN8SPIFlash12write_enableEv(ptr noundef nonnull align 8 dereferenceable(33) %28)
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %145

133:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef @.str.149, ptr noundef nonnull align 1 dereferenceable(1) %22)
          to label %134 unwind label %136

134:                                              ; preds = %133
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %21, i1 noundef zeroext true)
          to label %135 unwind label %140

135:                                              ; preds = %134
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #4
  store i1 false, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %234

136:                                              ; preds = %133
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %14, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %15, align 4
  br label %144

140:                                              ; preds = %134
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %14, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #4
  br label %144

144:                                              ; preds = %140, %136
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #4
  br label %236

145:                                              ; preds = %124
  %146 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %147 = load ptr, ptr %146, align 8, !tbaa !15
  %148 = getelementptr inbounds %struct.flash_t, ptr %147, i32 0, i32 13
  %149 = load i32, ptr %148, align 8, !tbaa !23
  switch i32 %149, label %159 [
    i32 2, label %150
  ]

150:                                              ; preds = %145
  %151 = load i16, ptr %8, align 2, !tbaa !11
  %152 = zext i16 %151 to i32
  %153 = and i32 %152, 255
  %154 = shl i32 %153, 8
  %155 = call noundef zeroext i8 @_ZN8SPIFlash15read_status_regEv(ptr noundef nonnull align 8 dereferenceable(33) %28)
  %156 = zext i8 %155 to i32
  %157 = or i32 %154, %156
  %158 = trunc i32 %157 to i16
  store i16 %158, ptr %8, align 2, !tbaa !11
  br label %160

159:                                              ; preds = %145
  br label %160

160:                                              ; preds = %159, %150
  %161 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 1
  %162 = load ptr, ptr %161, align 8, !tbaa !25
  %163 = load i8, ptr %6, align 1, !tbaa !24
  %164 = load i32, ptr %10, align 4, !tbaa !13
  %165 = load ptr, ptr %162, align 8, !tbaa !26
  %166 = getelementptr inbounds ptr, ptr %165, i64 2
  %167 = load ptr, ptr %166, align 8
  %168 = call noundef i32 %167(ptr noundef nonnull align 8 dereferenceable(56) %162, i8 noundef zeroext %163, ptr noundef %8, ptr noundef null, i32 noundef %164)
  %169 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 1
  %170 = load ptr, ptr %169, align 8, !tbaa !25
  %171 = load ptr, ptr %170, align 8, !tbaa !26
  %172 = getelementptr inbounds ptr, ptr %171, i64 4
  %173 = load ptr, ptr %172, align 8
  %174 = call noundef i32 %173(ptr noundef nonnull align 8 dereferenceable(56) %170, i8 noundef zeroext 5, i8 noundef zeroext 2, i8 noundef zeroext 0, i32 noundef 10000, i1 noundef zeroext false)
  %175 = icmp ne i32 %174, 0
  br i1 %175, label %176, label %188

176:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 32, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef @.str.150, ptr noundef nonnull align 1 dereferenceable(1) %24)
          to label %177 unwind label %179

177:                                              ; preds = %176
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %23, i1 noundef zeroext true)
          to label %178 unwind label %183

178:                                              ; preds = %177
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #4
  store i1 false, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %234

179:                                              ; preds = %176
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %14, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %15, align 4
  br label %187

183:                                              ; preds = %177
  %184 = landingpad { ptr, i32 }
          cleanup
  %185 = extractvalue { ptr, i32 } %184, 0
  store ptr %185, ptr %14, align 8
  %186 = extractvalue { ptr, i32 } %184, 1
  store i32 %186, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #4
  br label %187

187:                                              ; preds = %183, %179
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #4
  br label %236

188:                                              ; preds = %160
  store i16 0, ptr %8, align 2, !tbaa !11
  %189 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 1
  %190 = load ptr, ptr %189, align 8, !tbaa !25
  %191 = load i8, ptr %7, align 1, !tbaa !24
  %192 = load i32, ptr %9, align 4, !tbaa !13
  %193 = load ptr, ptr %190, align 8, !tbaa !26
  %194 = getelementptr inbounds ptr, ptr %193, i64 2
  %195 = load ptr, ptr %194, align 8
  %196 = call noundef i32 %195(ptr noundef nonnull align 8 dereferenceable(56) %190, i8 noundef zeroext %191, ptr noundef null, ptr noundef %8, i32 noundef %192)
  %197 = load i16, ptr %8, align 2, !tbaa !11
  %198 = zext i16 %197 to i32
  %199 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %200 = load ptr, ptr %199, align 8, !tbaa !15
  %201 = getelementptr inbounds %struct.flash_t, ptr %200, i32 0, i32 14
  %202 = load i16, ptr %201, align 4, !tbaa !17
  %203 = zext i16 %202 to i32
  %204 = and i32 %198, %203
  %205 = load i16, ptr %11, align 2, !tbaa !11
  %206 = zext i16 %205 to i32
  %207 = icmp ne i32 %204, %206
  br i1 %207, label %208, label %233

208:                                              ; preds = %188
  %209 = load i16, ptr %8, align 2, !tbaa !11
  %210 = zext i16 %209 to i32
  %211 = load i16, ptr %8, align 2, !tbaa !11
  %212 = zext i16 %211 to i32
  %213 = getelementptr inbounds %class.SPIFlash, ptr %28, i32 0, i32 5
  %214 = load ptr, ptr %213, align 8, !tbaa !15
  %215 = getelementptr inbounds %struct.flash_t, ptr %214, i32 0, i32 14
  %216 = load i16, ptr %215, align 4, !tbaa !17
  %217 = zext i16 %216 to i32
  %218 = and i32 %212, %217
  %219 = load i16, ptr %11, align 2, !tbaa !11
  %220 = zext i16 %219 to i32
  %221 = call i32 (ptr, ...) @printf(ptr noundef @.str.151, i32 noundef %210, i32 noundef %218, i32 noundef %220)
  call void @llvm.lifetime.start.p0(i64 32, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %26) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %26) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef @.str.152, ptr noundef nonnull align 1 dereferenceable(1) %26)
          to label %222 unwind label %224

222:                                              ; preds = %208
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %25, i1 noundef zeroext true)
          to label %223 unwind label %228

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

224:                                              ; preds = %208
  %225 = landingpad { ptr, i32 }
          cleanup
  %226 = extractvalue { ptr, i32 } %225, 0
  store ptr %226, ptr %14, align 8
  %227 = extractvalue { ptr, i32 } %225, 1
  store i32 %227, ptr %15, align 4
  br label %232

228:                                              ; preds = %222
  %229 = landingpad { ptr, i32 }
          cleanup
  %230 = extractvalue { ptr, i32 } %229, 0
  store ptr %230, ptr %14, align 8
  %231 = extractvalue { ptr, i32 } %229, 1
  store i32 %231, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #4
  br label %232

232:                                              ; preds = %228, %224
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %26) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %25) #4
  br label %236

233:                                              ; preds = %188
  store i1 true, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %234

234:                                              ; preds = %233, %223, %178, %135, %79, %59, %34
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  %235 = load i1, ptr %3, align 1
  ret i1 %235

236:                                              ; preds = %232, %187, %144, %88, %68, %43
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  br label %237

237:                                              ; preds = %236
  %238 = load ptr, ptr %14, align 8
  %239 = load i32, ptr %15, align 4
  %240 = insertvalue { ptr, i32 } poison, ptr %238, 0
  %241 = insertvalue { ptr, i32 } %240, i32 %239, 1
  resume { ptr, i32 } %241
}

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, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 24}
!16 = !{!"_ZTS8SPIFlash", !6, i64 8, !7, i64 16, !14, i64 20, !6, i64 24, !10, i64 32}
!17 = !{!18, !12, i64 92}
!18 = !{!"_ZTS7flash_t", !19, i64 0, !19, i64 32, !14, i64 64, !10, i64 68, !10, i64 69, !10, i64 70, !10, i64 71, !7, i64 72, !22, i64 76, !7, i64 80, !7, i64 81, !22, i64 88, !12, i64 92}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !21, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTS8tb_loc_t", !7, i64 0}
!23 = !{!18, !22, i64 88}
!24 = !{!7, !7, i64 0}
!25 = !{!16, !6, i64 8}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}
!28 = !{!16, !14, i64 20}
!29 = !{i8 0, i8 2}
!30 = !{}


; 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.146 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [42 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 dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; 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 @_ZN8SPIFlash12write_enableEv(ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN8SPIFlash15read_status_regEv(ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8SPIFlash12set_quad_bitEb(ptr noundef nonnull align 8 dereferenceable(33) %0, i1 noundef zeroext %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i16, align 2
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator.0", align 1
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::allocator.0", align 1
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator.0", align 1
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator.0", align 1
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %"class.std::allocator.0", align 1
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #5
  store i16 0, ptr %3, align 2, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %18, label %26

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

19:                                               ; preds = %18
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %4, 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) %4) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %130

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) %4) #5
  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) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %131

26:                                               ; preds = %2
  %27 = getelementptr inbounds i8, ptr %17, i64 92
  %28 = load i16, ptr %27, align 4, !tbaa !14
  %29 = icmp eq i16 %28, 0
  br i1 %29, label %33, label %30

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %17, i64 88
  %32 = load i32, ptr %31, align 8, !tbaa !20
  switch i32 %32, label %43 [
    i32 99, label %33
    i32 0, label %51
    i32 3, label %41
    i32 2, label %42
  ]

33:                                               ; preds = %30, %26
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull @.str.147, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %34 unwind label %36

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

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

36:                                               ; preds = %33
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %40

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

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

41:                                               ; preds = %30
  br label %51

42:                                               ; preds = %30
  br label %51

43:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull @.str.148, 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 %48

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

46:                                               ; preds = %43
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %50

48:                                               ; preds = %44
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  br label %50

50:                                               ; preds = %48, %46
  %.pn42 = phi { ptr, i32 } [ %49, %48 ], [ %47, %46 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #5
  br label %131

51:                                               ; preds = %30, %42, %41
  %.025 = phi i8 [ 1, %42 ], [ -79, %41 ], [ 1, %30 ]
  %.024 = phi i8 [ 53, %42 ], [ -75, %41 ], [ 5, %30 ]
  %.023 = phi i32 [ 1, %42 ], [ 2, %41 ], [ 1, %30 ]
  %.022 = phi i32 [ 2, %42 ], [ 2, %41 ], [ 1, %30 ]
  %52 = getelementptr inbounds i8, ptr %0, i64 8
  %53 = load ptr, ptr %52, align 8, !tbaa !21
  %54 = load ptr, ptr %53, align 8, !tbaa !22
  %55 = getelementptr inbounds i8, ptr %54, i64 16
  %56 = load ptr, ptr %55, align 8
  %57 = call noundef i32 %56(ptr noundef nonnull align 8 dereferenceable(56) %53, i8 noundef zeroext %.024, ptr noundef null, ptr noundef nonnull %3, i32 noundef %.023)
  %58 = load ptr, ptr %16, align 8, !tbaa !9
  %59 = getelementptr inbounds i8, ptr %58, i64 92
  %60 = load i16, ptr %59, align 4, !tbaa !14
  %61 = xor i16 %60, -1
  %62 = load i16, ptr %3, align 2, !tbaa !5
  %63 = and i16 %62, %61
  %64 = getelementptr inbounds i8, ptr %0, i64 20
  %65 = load i32, ptr %64, align 4, !tbaa !24
  %66 = icmp eq i32 %65, 8378
  %spec.select = xor i1 %66, %1
  %67 = zext i16 %60 to i32
  %spec.select47 = select i1 %spec.select, i32 %67, i32 0
  %68 = trunc nuw i32 %spec.select47 to i16
  %69 = or i16 %63, %68
  store i16 %69, ptr %3, align 2, !tbaa !5
  %70 = call noundef i32 @_ZN8SPIFlash12write_enableEv(ptr noundef nonnull align 8 dereferenceable(33) %0)
  %.not33 = icmp eq i32 %70, 0
  br i1 %.not33, label %79, label %71

71:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull @.str.149, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %72 unwind label %74

72:                                               ; preds = %71
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %10, i1 noundef zeroext true)
          to label %73 unwind label %76

73:                                               ; preds = %72
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #5
  br label %130

74:                                               ; preds = %71
  %75 = landingpad { ptr, i32 }
          cleanup
  br label %78

76:                                               ; preds = %72
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #5
  br label %78

78:                                               ; preds = %76, %74
  %.pn40 = phi { ptr, i32 } [ %77, %76 ], [ %75, %74 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #5
  br label %131

79:                                               ; preds = %51
  %80 = load ptr, ptr %16, align 8, !tbaa !9
  %81 = getelementptr inbounds i8, ptr %80, i64 88
  %82 = load i32, ptr %81, align 8, !tbaa !20
  %cond = icmp eq i32 %82, 2
  br i1 %cond, label %83, label %89

83:                                               ; preds = %79
  %84 = load i16, ptr %3, align 2, !tbaa !5
  %85 = shl i16 %84, 8
  %86 = call noundef zeroext i8 @_ZN8SPIFlash15read_status_regEv(ptr noundef nonnull align 8 dereferenceable(33) %0)
  %87 = zext i8 %86 to i16
  %88 = or disjoint i16 %85, %87
  store i16 %88, ptr %3, align 2, !tbaa !5
  br label %89

89:                                               ; preds = %79, %83
  %90 = load ptr, ptr %52, align 8, !tbaa !21
  %91 = load ptr, ptr %90, align 8, !tbaa !22
  %92 = getelementptr inbounds i8, ptr %91, i64 16
  %93 = load ptr, ptr %92, align 8
  %94 = call noundef i32 %93(ptr noundef nonnull align 8 dereferenceable(56) %90, i8 noundef zeroext %.025, ptr noundef nonnull %3, ptr noundef null, i32 noundef %.022)
  %95 = load ptr, ptr %52, align 8, !tbaa !21
  %96 = load ptr, ptr %95, align 8, !tbaa !22
  %97 = getelementptr inbounds i8, ptr %96, i64 32
  %98 = load ptr, ptr %97, align 8
  %99 = call noundef i32 %98(ptr noundef nonnull align 8 dereferenceable(56) %95, i8 noundef zeroext 5, i8 noundef zeroext 2, i8 noundef zeroext 0, i32 noundef 10000, i1 noundef zeroext false)
  %.not34 = icmp eq i32 %99, 0
  br i1 %.not34, label %108, label %100

100:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull @.str.150, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %101 unwind label %103

101:                                              ; preds = %100
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %12, i1 noundef zeroext true)
          to label %102 unwind label %105

102:                                              ; preds = %101
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #5
  br label %130

103:                                              ; preds = %100
  %104 = landingpad { ptr, i32 }
          cleanup
  br label %107

105:                                              ; preds = %101
  %106 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  br label %107

107:                                              ; preds = %105, %103
  %.pn38 = phi { ptr, i32 } [ %106, %105 ], [ %104, %103 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #5
  br label %131

108:                                              ; preds = %89
  store i16 0, ptr %3, align 2, !tbaa !5
  %109 = load ptr, ptr %52, align 8, !tbaa !21
  %110 = load ptr, ptr %109, align 8, !tbaa !22
  %111 = getelementptr inbounds i8, ptr %110, i64 16
  %112 = load ptr, ptr %111, align 8
  %113 = call noundef i32 %112(ptr noundef nonnull align 8 dereferenceable(56) %109, i8 noundef zeroext %.024, ptr noundef null, ptr noundef nonnull %3, i32 noundef %.023)
  %114 = load i16, ptr %3, align 2, !tbaa !5
  %115 = load ptr, ptr %16, align 8, !tbaa !9
  %116 = getelementptr inbounds i8, ptr %115, i64 92
  %117 = load i16, ptr %116, align 4, !tbaa !14
  %118 = and i16 %117, %114
  %119 = zext i16 %118 to i32
  %.not35 = icmp eq i32 %spec.select47, %119
  br i1 %.not35, label %130, label %120

120:                                              ; preds = %108
  %121 = zext i16 %114 to i32
  %122 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.151, i32 noundef %121, i32 noundef %119, i32 noundef %spec.select47)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %14) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %15) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull @.str.152, ptr noundef nonnull align 1 dereferenceable(1) %15)
          to label %123 unwind label %125

123:                                              ; preds = %120
  invoke void @_Z10printErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(32) %14, i1 noundef zeroext true)
          to label %124 unwind label %127

124:                                              ; preds = %123
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #5
  br label %130

125:                                              ; preds = %120
  %126 = landingpad { ptr, i32 }
          cleanup
  br label %129

127:                                              ; preds = %123
  %128 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #5
  br label %129

129:                                              ; preds = %127, %125
  %.pn36 = phi { ptr, i32 } [ %128, %127 ], [ %126, %125 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #5
  br label %131

130:                                              ; preds = %108, %124, %102, %73, %45, %35, %20
  %.027 = phi i1 [ false, %35 ], [ false, %45 ], [ false, %73 ], [ false, %102 ], [ false, %124 ], [ false, %20 ], [ true, %108 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #5
  ret i1 %.027

131:                                              ; preds = %129, %107, %78, %50, %40, %25
  %.pn44.pn = phi { ptr, i32 } [ %.pn44, %40 ], [ %.pn42, %50 ], [ %.pn40, %78 ], [ %.pn38, %107 ], [ %.pn36, %129 ], [ %.pn, %25 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn44.pn
}

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 = { 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 #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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"_ZTS8SPIFlash", !11, i64 8, !7, i64 16, !12, i64 20, !11, i64 24, !13, i64 32}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!15, !6, i64 92}
!15 = !{!"_ZTS7flash_t", !16, i64 0, !16, i64 32, !12, i64 64, !13, i64 68, !13, i64 69, !13, i64 70, !13, i64 71, !7, i64 72, !19, i64 76, !7, i64 80, !7, i64 81, !19, i64 88, !6, i64 92}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTS8tb_loc_t", !7, i64 0}
!20 = !{!15, !19, i64 88}
!21 = !{!10, !11, i64 8}
!22 = !{!23, !23, i64 0}
!23 = !{!"vtable pointer", !8, i64 0}
!24 = !{!10, !12, i64 20}


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