; LLVM IR from ArefMq/SoccerBallDetection :: interfaces/camera/webcam.ll (ZN6Webcam11init_deviceEv)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.v4l2_capability = type { [16 x i8], [32 x i8], [32 x i8], i32, i32, i32, [3 x i32] }
%struct.v4l2_cropcap = type { i32, %struct.v4l2_rect, %struct.v4l2_rect, %struct.v4l2_fract }
%struct.v4l2_rect = type { i32, i32, i32, i32 }
%struct.v4l2_fract = type { i32, i32 }
%struct.v4l2_crop = type { i32, %struct.v4l2_rect }
%struct.v4l2_format = type { i32, %union.anon.3 }
%union.anon.3 = type { %struct.v4l2_window, [144 x i8] }
%struct.v4l2_window = type { %struct.v4l2_rect, i32, i32, ptr, i32, ptr, i8 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%class.Webcam = type <{ %"class.std::__cxx11::basic_string", i32, [4 x i8], %struct.RGBImage, ptr, i32, [4 x i8], i64, i64, i64, i8, [7 x i8] }>
%struct.RGBImage = type { ptr, i64, i64, i64 }
%struct.v4l2_pix_format = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, %union.anon.4, i32, i32 }
%union.anon.4 = type { i32 }

@_ZTISt13runtime_error = external constant ptr
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Webcam11init_deviceEv(ptr noundef nonnull align 8 dereferenceable(113) %0) #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.v4l2_capability, align 4
  %4 = alloca %struct.v4l2_cropcap, align 4
  %5 = alloca %struct.v4l2_crop, align 4
  %6 = alloca %struct.v4l2_format, align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i1, align 1
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca i1, align 1
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca i1, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 104, ptr %3) #9
  call void @llvm.lifetime.start.p0(i64 44, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 20, ptr %5) #9
  call void @llvm.lifetime.start.p0(i64 208, ptr %6) #9
  %16 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 1
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %17, i64 noundef 2154321408, ptr noundef %3)
  %19 = icmp eq i32 -1, %18
  br i1 %19, label %20, label %48

20:                                               ; preds = %1
  %21 = call ptr @__errno_location() #10
  %22 = load i32, ptr %21, align 4, !tbaa !17
  %23 = icmp eq i32 22, %22
  br i1 %23, label %24, label %41

24:                                               ; preds = %20
  store i1 true, ptr %10, align 1
  %25 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #9
  %26 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 0
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %26, ptr noundef @.str.17)
          to label %27 unwind label %29

27:                                               ; preds = %24
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %28 unwind label %33

28:                                               ; preds = %27
  store i1 false, ptr %10, align 1
  invoke void @__cxa_throw(ptr %25, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
          to label %192 unwind label %33

29:                                               ; preds = %24
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %8, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %9, align 4
  br label %37

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

37:                                               ; preds = %33, %29
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #9
  %38 = load i1, ptr %10, align 1
  br i1 %38, label %39, label %40

39:                                               ; preds = %37
  call void @__cxa_free_exception(ptr %25) #9
  br label %40

40:                                               ; preds = %39, %37
  br label %186

41:                                               ; preds = %20
  %42 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef @.str.18)
          to label %43 unwind label %44

43:                                               ; preds = %41
  call void @__cxa_throw(ptr %42, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
  unreachable

44:                                               ; preds = %41
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %8, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %9, align 4
  call void @__cxa_free_exception(ptr %42) #9
  br label %186

48:                                               ; preds = %1
  %49 = getelementptr inbounds %struct.v4l2_capability, ptr %3, i32 0, i32 4
  %50 = load i32, ptr %49, align 4, !tbaa !18
  %51 = and i32 %50, 1
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %70, label %53

53:                                               ; preds = %48
  store i1 true, ptr %12, align 1
  %54 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #9
  %55 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 0
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) %55, ptr noundef @.str.19)
          to label %56 unwind label %58

56:                                               ; preds = %53
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %57 unwind label %62

57:                                               ; preds = %56
  store i1 false, ptr %12, align 1
  invoke void @__cxa_throw(ptr %54, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
          to label %192 unwind label %62

58:                                               ; preds = %53
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %8, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %9, align 4
  br label %66

62:                                               ; preds = %57, %56
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %8, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %9, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #9
  br label %66

66:                                               ; preds = %62, %58
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #9
  %67 = load i1, ptr %12, align 1
  br i1 %67, label %68, label %69

68:                                               ; preds = %66
  call void @__cxa_free_exception(ptr %54) #9
  br label %69

69:                                               ; preds = %68, %66
  br label %186

70:                                               ; preds = %48
  %71 = getelementptr inbounds %struct.v4l2_capability, ptr %3, i32 0, i32 4
  %72 = load i32, ptr %71, align 4, !tbaa !18
  %73 = and i32 %72, 67108864
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %92, label %75

75:                                               ; preds = %70
  store i1 true, ptr %14, align 1
  %76 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #9
  %77 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 0
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %13, ptr noundef nonnull align 8 dereferenceable(32) %77, ptr noundef @.str.20)
          to label %78 unwind label %80

78:                                               ; preds = %75
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %76, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %79 unwind label %84

79:                                               ; preds = %78
  store i1 false, ptr %14, align 1
  invoke void @__cxa_throw(ptr %76, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
          to label %192 unwind label %84

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

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

88:                                               ; preds = %84, %80
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #9
  %89 = load i1, ptr %14, align 1
  br i1 %89, label %90, label %91

90:                                               ; preds = %88
  call void @__cxa_free_exception(ptr %76) #9
  br label %91

91:                                               ; preds = %90, %88
  br label %186

92:                                               ; preds = %70
  call void @llvm.memset.p0.i64(ptr align 4 %4, i8 0, i64 44, i1 false)
  %93 = getelementptr inbounds %struct.v4l2_cropcap, ptr %4, i32 0, i32 0
  store i32 1, ptr %93, align 4, !tbaa !20
  %94 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 1
  %95 = load i32, ptr %94, align 8, !tbaa !9
  %96 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %95, i64 noundef 3224131130, ptr noundef %4)
  %97 = icmp eq i32 0, %96
  br i1 %97, label %98, label %112

98:                                               ; preds = %92
  %99 = getelementptr inbounds %struct.v4l2_crop, ptr %5, i32 0, i32 0
  store i32 1, ptr %99, align 4, !tbaa !24
  %100 = getelementptr inbounds %struct.v4l2_cropcap, ptr %4, i32 0, i32 2
  %101 = getelementptr inbounds %struct.v4l2_crop, ptr %5, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %101, ptr align 4 %100, i64 16, i1 false), !tbaa.struct !26
  %102 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 1
  %103 = load i32, ptr %102, align 8, !tbaa !9
  %104 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %103, i64 noundef 1075074620, ptr noundef %5)
  %105 = icmp eq i32 -1, %104
  br i1 %105, label %106, label %111

106:                                              ; preds = %98
  %107 = call ptr @__errno_location() #10
  %108 = load i32, ptr %107, align 4, !tbaa !17
  switch i32 %108, label %109 [
    i32 22, label %110
  ]

109:                                              ; preds = %106
  br label %110

110:                                              ; preds = %109, %106
  br label %111

111:                                              ; preds = %110, %98
  br label %113

112:                                              ; preds = %92
  br label %113

113:                                              ; preds = %112, %111
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 208, i1 false)
  %114 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 0
  store i32 1, ptr %114, align 8, !tbaa !27
  %115 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 10
  %116 = load i8, ptr %115, align 8, !tbaa !29, !range !30, !noundef !31
  %117 = trunc i8 %116 to i1
  br i1 %117, label %118, label %172

118:                                              ; preds = %113
  %119 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 7
  %120 = load i64, ptr %119, align 8, !tbaa !32
  %121 = trunc i64 %120 to i32
  %122 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %123 = getelementptr inbounds %struct.v4l2_pix_format, ptr %122, i32 0, i32 0
  store i32 %121, ptr %123, align 8, !tbaa !33
  %124 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 8
  %125 = load i64, ptr %124, align 8, !tbaa !34
  %126 = trunc i64 %125 to i32
  %127 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %128 = getelementptr inbounds %struct.v4l2_pix_format, ptr %127, i32 0, i32 1
  store i32 %126, ptr %128, align 4, !tbaa !33
  %129 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %130 = getelementptr inbounds %struct.v4l2_pix_format, ptr %129, i32 0, i32 2
  store i32 1448695129, ptr %130, align 8, !tbaa !33
  %131 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %132 = getelementptr inbounds %struct.v4l2_pix_format, ptr %131, i32 0, i32 3
  store i32 4, ptr %132, align 4, !tbaa !33
  %133 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 1
  %134 = load i32, ptr %133, align 8, !tbaa !9
  %135 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %134, i64 noundef 3234878981, ptr noundef %6)
  %136 = icmp eq i32 -1, %135
  br i1 %136, label %137, label %144

137:                                              ; preds = %118
  %138 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %138, ptr noundef @.str.21)
          to label %139 unwind label %140

139:                                              ; preds = %137
  call void @__cxa_throw(ptr %138, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
  unreachable

140:                                              ; preds = %137
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %8, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %9, align 4
  call void @__cxa_free_exception(ptr %138) #9
  br label %186

144:                                              ; preds = %118
  %145 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %146 = getelementptr inbounds %struct.v4l2_pix_format, ptr %145, i32 0, i32 2
  %147 = load i32, ptr %146, align 8, !tbaa !33
  %148 = icmp ne i32 %147, 1448695129
  br i1 %148, label %149, label %156

149:                                              ; preds = %144
  %150 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %150, ptr noundef @.str.22)
          to label %151 unwind label %152

151:                                              ; preds = %149
  call void @__cxa_throw(ptr %150, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
  unreachable

152:                                              ; preds = %149
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %8, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %9, align 4
  call void @__cxa_free_exception(ptr %150) #9
  br label %186

156:                                              ; preds = %144
  %157 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %158 = getelementptr inbounds %struct.v4l2_pix_format, ptr %157, i32 0, i32 0
  %159 = load i32, ptr %158, align 8, !tbaa !33
  %160 = zext i32 %159 to i64
  %161 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 7
  store i64 %160, ptr %161, align 8, !tbaa !32
  %162 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %163 = getelementptr inbounds %struct.v4l2_pix_format, ptr %162, i32 0, i32 1
  %164 = load i32, ptr %163, align 4, !tbaa !33
  %165 = zext i32 %164 to i64
  %166 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 8
  store i64 %165, ptr %166, align 8, !tbaa !34
  %167 = getelementptr inbounds %struct.v4l2_format, ptr %6, i32 0, i32 1
  %168 = getelementptr inbounds %struct.v4l2_pix_format, ptr %167, i32 0, i32 4
  %169 = load i32, ptr %168, align 8, !tbaa !33
  %170 = zext i32 %169 to i64
  %171 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 9
  store i64 %170, ptr %171, align 8, !tbaa !35
  br label %185

172:                                              ; preds = %113
  %173 = getelementptr inbounds %class.Webcam, ptr %15, i32 0, i32 1
  %174 = load i32, ptr %173, align 8, !tbaa !9
  %175 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %174, i64 noundef 3234878980, ptr noundef %6)
  %176 = icmp eq i32 -1, %175
  br i1 %176, label %177, label %184

177:                                              ; preds = %172
  %178 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %178, ptr noundef @.str.23)
          to label %179 unwind label %180

179:                                              ; preds = %177
  call void @__cxa_throw(ptr %178, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
  unreachable

180:                                              ; preds = %177
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %8, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %9, align 4
  call void @__cxa_free_exception(ptr %178) #9
  br label %186

184:                                              ; preds = %172
  br label %185

185:                                              ; preds = %184, %156
  call void @_ZN6Webcam9init_mmapEv(ptr noundef nonnull align 8 dereferenceable(113) %15)
  call void @llvm.lifetime.end.p0(i64 208, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 44, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 104, ptr %3) #9
  ret void

186:                                              ; preds = %180, %152, %140, %91, %69, %44, %40
  call void @llvm.lifetime.end.p0(i64 208, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 44, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 104, ptr %3) #9
  br label %187

187:                                              ; preds = %186
  %188 = load ptr, ptr %8, align 8
  %189 = load i32, ptr %9, align 4
  %190 = insertvalue { ptr, i32 } poison, ptr %188, 0
  %191 = insertvalue { ptr, i32 } %190, i32 %189, 1
  resume { ptr, i32 } %191

192:                                              ; preds = %79, %57, %28
  unreachable
}

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

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

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #3

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #4

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #6

declare void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL6xioctlimPv(i32 noundef, i64 noundef, ptr noundef) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(none) "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 = { "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 "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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { noreturn }

!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, !14, i64 32}
!10 = !{!"_ZTS6Webcam", !11, i64 0, !14, i64 32, !15, i64 40, !6, i64 72, !14, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !16, i64 112}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !13, i64 8, !7, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS8RGBImage", !6, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!16 = !{!"bool", !7, i64 0}
!17 = !{!14, !14, i64 0}
!18 = !{!19, !14, i64 84}
!19 = !{!"_ZTS15v4l2_capability", !7, i64 0, !7, i64 16, !7, i64 48, !14, i64 80, !14, i64 84, !14, i64 88, !7, i64 92}
!20 = !{!21, !14, i64 0}
!21 = !{!"_ZTS12v4l2_cropcap", !14, i64 0, !22, i64 4, !22, i64 20, !23, i64 36}
!22 = !{!"_ZTS9v4l2_rect", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!23 = !{!"_ZTS10v4l2_fract", !14, i64 0, !14, i64 4}
!24 = !{!25, !14, i64 0}
!25 = !{!"_ZTS9v4l2_crop", !14, i64 0, !22, i64 4}
!26 = !{i64 0, i64 4, !17, i64 4, i64 4, !17, i64 8, i64 4, !17, i64 12, i64 4, !17}
!27 = !{!28, !14, i64 0}
!28 = !{!"_ZTS11v4l2_format", !14, i64 0, !7, i64 8}
!29 = !{!10, !16, i64 112}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!10, !13, i64 88}
!33 = !{!7, !7, i64 0}
!34 = !{!10, !13, i64 96}
!35 = !{!10, !13, i64 104}


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

%struct.v4l2_capability = type { [16 x i8], [32 x i8], [32 x i8], i32, i32, i32, [3 x i32] }
%struct.v4l2_cropcap = type { i32, %struct.v4l2_rect, %struct.v4l2_rect, %struct.v4l2_fract }
%struct.v4l2_rect = type { i32, i32, i32, i32 }
%struct.v4l2_fract = type { i32, i32 }
%struct.v4l2_crop = type { i32, %struct.v4l2_rect }
%struct.v4l2_format = type { i32, %union.anon.3 }
%union.anon.3 = type { %struct.v4l2_window, [144 x i8] }
%struct.v4l2_window = type { %struct.v4l2_rect, i32, i32, ptr, i32, ptr, 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] }

@_ZTISt13runtime_error = external constant ptr
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Webcam11init_deviceEv(ptr noundef nonnull align 8 dereferenceable(113) %0) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %struct.v4l2_capability, align 4
  %3 = alloca %struct.v4l2_cropcap, align 4
  %4 = alloca %struct.v4l2_crop, align 4
  %5 = alloca %struct.v4l2_format, align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %2) #9
  call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 208, ptr nonnull %5) #9
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %11 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %10, i64 noundef 2154321408, ptr noundef nonnull %2)
  %12 = icmp eq i32 %11, -1
  br i1 %12, label %13, label %30

13:                                               ; preds = %1
  %14 = tail call ptr @__errno_location() #10
  %15 = load i32, ptr %14, align 4, !tbaa !16
  %16 = icmp eq i32 %15, 22
  %17 = call ptr @__cxa_allocate_exception(i64 16) #9
  br i1 %16, label %18, label %26

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #9
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.17)
          to label %19 unwind label %.thread

19:                                               ; preds = %18
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %21 unwind label %.thread26

.thread26:                                        ; preds = %19
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #9
  br label %25

21:                                               ; preds = %19
  invoke void @__cxa_throw(ptr nonnull %17, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
          to label %108 unwind label %23

.thread:                                          ; preds = %18
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #9
  br label %25

23:                                               ; preds = %21
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #9
  br label %107

25:                                               ; preds = %.thread26, %.thread
  %.pn2025 = phi { ptr, i32 } [ %22, %.thread ], [ %20, %.thread26 ]
  call void @__cxa_free_exception(ptr %17) #9
  br label %107

26:                                               ; preds = %13
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull @.str.18)
          to label %27 unwind label %28

27:                                               ; preds = %26
  call void @__cxa_throw(ptr nonnull %17, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
  unreachable

28:                                               ; preds = %26
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %17) #9
  br label %107

30:                                               ; preds = %1
  %31 = getelementptr inbounds i8, ptr %2, i64 84
  %32 = load i32, ptr %31, align 4, !tbaa !17
  %33 = and i32 %32, 1
  %.not = icmp eq i32 %33, 0
  br i1 %.not, label %34, label %43

34:                                               ; preds = %30
  %35 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #9
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.19)
          to label %36 unwind label %.thread28

36:                                               ; preds = %34
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %38 unwind label %.thread32

.thread32:                                        ; preds = %36
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #9
  br label %42

38:                                               ; preds = %36
  invoke void @__cxa_throw(ptr nonnull %35, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
          to label %108 unwind label %40

.thread28:                                        ; preds = %34
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #9
  br label %42

40:                                               ; preds = %38
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #9
  br label %107

42:                                               ; preds = %.thread32, %.thread28
  %.pn31 = phi { ptr, i32 } [ %39, %.thread28 ], [ %37, %.thread32 ]
  call void @__cxa_free_exception(ptr %35) #9
  br label %107

43:                                               ; preds = %30
  %44 = and i32 %32, 67108864
  %.not16 = icmp eq i32 %44, 0
  br i1 %.not16, label %45, label %54

45:                                               ; preds = %43
  %46 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #9
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.20)
          to label %47 unwind label %.thread34

47:                                               ; preds = %45
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %46, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %49 unwind label %.thread38

.thread38:                                        ; preds = %47
  %48 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #9
  br label %53

49:                                               ; preds = %47
  invoke void @__cxa_throw(ptr nonnull %46, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
          to label %108 unwind label %51

.thread34:                                        ; preds = %45
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #9
  br label %53

51:                                               ; preds = %49
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #9
  br label %107

53:                                               ; preds = %.thread38, %.thread34
  %.pn1737 = phi { ptr, i32 } [ %50, %.thread34 ], [ %48, %.thread38 ]
  call void @__cxa_free_exception(ptr %46) #9
  br label %107

54:                                               ; preds = %43
  %55 = getelementptr inbounds i8, ptr %3, i64 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(44) %55, i8 0, i64 40, i1 false)
  store i32 1, ptr %3, align 4, !tbaa !19
  %56 = load i32, ptr %9, align 8, !tbaa !5
  %57 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %56, i64 noundef 3224131130, ptr noundef nonnull %3)
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %64

59:                                               ; preds = %54
  store i32 1, ptr %4, align 4, !tbaa !23
  %60 = getelementptr inbounds i8, ptr %3, i64 20
  %61 = getelementptr inbounds i8, ptr %4, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %61, ptr noundef nonnull align 4 dereferenceable(16) %60, i64 16, i1 false), !tbaa.struct !25
  %62 = load i32, ptr %9, align 8, !tbaa !5
  %63 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %62, i64 noundef 1075074620, ptr noundef nonnull %4)
  br label %64

64:                                               ; preds = %59, %54
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(208) %5, i8 0, i64 208, i1 false)
  store i32 1, ptr %5, align 8, !tbaa !26
  %65 = getelementptr inbounds i8, ptr %0, i64 112
  %66 = load i8, ptr %65, align 8, !tbaa !28, !range !29, !noundef !30
  %67 = trunc nuw i8 %66 to i1
  br i1 %67, label %68, label %97

68:                                               ; preds = %64
  %69 = getelementptr inbounds i8, ptr %0, i64 88
  %70 = getelementptr inbounds i8, ptr %5, i64 8
  %71 = load <2 x i64>, ptr %69, align 8, !tbaa !31
  %72 = trunc <2 x i64> %71 to <2 x i32>
  store <2 x i32> %72, ptr %70, align 8, !tbaa !32
  %73 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 1448695129, ptr %73, align 8, !tbaa !32
  %74 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 4, ptr %74, align 4, !tbaa !32
  %75 = load i32, ptr %9, align 8, !tbaa !5
  %76 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %75, i64 noundef 3234878981, ptr noundef nonnull %5)
  %77 = icmp eq i32 %76, -1
  br i1 %77, label %78, label %83

78:                                               ; preds = %68
  %79 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %79, ptr noundef nonnull @.str.21)
          to label %80 unwind label %81

80:                                               ; preds = %78
  call void @__cxa_throw(ptr nonnull %79, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
  unreachable

81:                                               ; preds = %78
  %82 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %79) #9
  br label %107

83:                                               ; preds = %68
  %84 = load i32, ptr %73, align 8, !tbaa !32
  %.not19 = icmp eq i32 %84, 1448695129
  br i1 %.not19, label %90, label %85

85:                                               ; preds = %83
  %86 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %86, ptr noundef nonnull @.str.22)
          to label %87 unwind label %88

87:                                               ; preds = %85
  call void @__cxa_throw(ptr nonnull %86, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
  unreachable

88:                                               ; preds = %85
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %86) #9
  br label %107

90:                                               ; preds = %83
  %91 = load <2 x i32>, ptr %70, align 8, !tbaa !32
  %92 = zext <2 x i32> %91 to <2 x i64>
  store <2 x i64> %92, ptr %69, align 8, !tbaa !31
  %93 = getelementptr inbounds i8, ptr %5, i64 24
  %94 = load i32, ptr %93, align 8, !tbaa !32
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds i8, ptr %0, i64 104
  store i64 %95, ptr %96, align 8, !tbaa !33
  br label %106

97:                                               ; preds = %64
  %98 = load i32, ptr %9, align 8, !tbaa !5
  %99 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %98, i64 noundef 3234878980, ptr noundef nonnull %5)
  %100 = icmp eq i32 %99, -1
  br i1 %100, label %101, label %106

101:                                              ; preds = %97
  %102 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %102, ptr noundef nonnull @.str.23)
          to label %103 unwind label %104

103:                                              ; preds = %101
  call void @__cxa_throw(ptr nonnull %102, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
  unreachable

104:                                              ; preds = %101
  %105 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %102) #9
  br label %107

106:                                              ; preds = %97, %90
  call void @_ZN6Webcam9init_mmapEv(ptr noundef nonnull align 8 dereferenceable(113) %0)
  call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %2) #9
  ret void

107:                                              ; preds = %51, %40, %23, %53, %42, %25, %104, %88, %81, %28
  %.pn20.pn = phi { ptr, i32 } [ %.pn2025, %25 ], [ %24, %23 ], [ %29, %28 ], [ %82, %81 ], [ %89, %88 ], [ %105, %104 ], [ %.pn1737, %53 ], [ %52, %51 ], [ %.pn31, %42 ], [ %41, %40 ]
  call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %2) #9
  resume { ptr, i32 } %.pn20.pn

108:                                              ; preds = %49, %38, %21
  unreachable
}

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

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #3

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #4

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #6

declare void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL6xioctlimPv(i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8

attributes #0 = { 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { "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 "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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { noreturn }

!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, !13, i64 32}
!6 = !{!"_ZTS6Webcam", !7, i64 0, !13, i64 32, !14, i64 40, !9, i64 72, !13, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !15, i64 112}
!7 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !8, i64 0, !12, i64 8, !10, i64 16}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"int", !10, i64 0}
!14 = !{!"_ZTS8RGBImage", !9, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!15 = !{!"bool", !10, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!18, !13, i64 84}
!18 = !{!"_ZTS15v4l2_capability", !10, i64 0, !10, i64 16, !10, i64 48, !13, i64 80, !13, i64 84, !13, i64 88, !10, i64 92}
!19 = !{!20, !13, i64 0}
!20 = !{!"_ZTS12v4l2_cropcap", !13, i64 0, !21, i64 4, !21, i64 20, !22, i64 36}
!21 = !{!"_ZTS9v4l2_rect", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!22 = !{!"_ZTS10v4l2_fract", !13, i64 0, !13, i64 4}
!23 = !{!24, !13, i64 0}
!24 = !{!"_ZTS9v4l2_crop", !13, i64 0, !21, i64 4}
!25 = !{i64 0, i64 4, !16, i64 4, i64 4, !16, i64 8, i64 4, !16, i64 12, i64 4, !16}
!26 = !{!27, !13, i64 0}
!27 = !{!"_ZTS11v4l2_format", !13, i64 0, !10, i64 8}
!28 = !{!6, !15, i64 112}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!12, !12, i64 0}
!32 = !{!10, !10, i64 0}
!33 = !{!6, !12, i64 104}


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