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

; 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] }
%struct.v4l2_requestbuffers = type { i32, i32, i32, i32, [1 x i32] }
%"class.std::allocator" = type { i8 }
%struct.v4l2_buffer = type { i32, i32, i32, i32, i32, %struct.timeval, %struct.v4l2_timecode, i32, i32, %union.anon.1, i32, i32, %union.anon.2 }
%struct.timeval = type { i64, i64 }
%struct.v4l2_timecode = type { i32, i32, i8, i8, i8, i8, [4 x i8] }
%union.anon.1 = type { i64 }
%union.anon.2 = type { i32 }
%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.buffer = type { ptr, i64 }

@_ZTISt13runtime_error = external constant ptr
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

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

declare ptr @__cxa_allocate_exception(i64)

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

declare void @__cxa_free_exception(ptr)

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

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) #5

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Webcam9init_mmapEv(ptr noundef nonnull align 8 dereferenceable(113) %0) #7 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.v4l2_requestbuffers, align 4
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i1, align 1
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca i1, align 1
  %12 = alloca %struct.v4l2_buffer, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %13 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 20, ptr %3) #9
  call void @llvm.memset.p0.i64(ptr align 4 %3, i8 0, i64 20, i1 false)
  %14 = getelementptr inbounds %struct.v4l2_requestbuffers, ptr %3, i32 0, i32 0
  store i32 4, ptr %14, align 4, !tbaa !9
  %15 = getelementptr inbounds %struct.v4l2_requestbuffers, ptr %3, i32 0, i32 1
  store i32 1, ptr %15, align 4, !tbaa !12
  %16 = getelementptr inbounds %struct.v4l2_requestbuffers, ptr %3, i32 0, i32 2
  store i32 1, ptr %16, align 4, !tbaa !13
  %17 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %19 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %18, i64 noundef 3222558216, ptr noundef %3)
  %20 = icmp eq i32 -1, %19
  br i1 %20, label %21, label %49

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

25:                                               ; preds = %21
  store i1 true, ptr %7, align 1
  %26 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #9
  %27 = getelementptr inbounds %class.Webcam, ptr %13, 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 %4, ptr noundef nonnull align 8 dereferenceable(32) %27, ptr noundef @.str.10)
          to label %28 unwind label %30

28:                                               ; preds = %25
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %29 unwind label %34

29:                                               ; preds = %28
  store i1 false, ptr %7, align 1
  invoke void @__cxa_throw(ptr %26, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
          to label %173 unwind label %34

30:                                               ; preds = %25
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %5, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %6, align 4
  br label %38

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

38:                                               ; preds = %34, %30
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #9
  %39 = load i1, ptr %7, align 1
  br i1 %39, label %40, label %41

40:                                               ; preds = %38
  call void @__cxa_free_exception(ptr %26) #9
  br label %41

41:                                               ; preds = %40, %38
  br label %167

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

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

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

49:                                               ; preds = %1
  %50 = getelementptr inbounds %struct.v4l2_requestbuffers, ptr %3, i32 0, i32 0
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = icmp ult i32 %51, 2
  br i1 %52, label %53, label %76

53:                                               ; preds = %49
  store i1 true, ptr %11, align 1
  %54 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef @.str.12, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %55 unwind label %59

55:                                               ; preds = %53
  %56 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 0
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_RKS8_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %56)
          to label %57 unwind label %63

57:                                               ; preds = %55
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %58 unwind label %67

58:                                               ; preds = %57
  store i1 false, ptr %11, align 1
  invoke void @__cxa_throw(ptr %54, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
          to label %173 unwind label %67

59:                                               ; preds = %53
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %5, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %6, align 4
  br label %72

63:                                               ; preds = %55
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %5, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %6, align 4
  br label %71

67:                                               ; preds = %58, %57
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %5, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %6, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  br label %71

71:                                               ; preds = %67, %63
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #9
  br label %72

72:                                               ; preds = %71, %59
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #9
  %73 = load i1, ptr %11, align 1
  br i1 %73, label %74, label %75

74:                                               ; preds = %72
  call void @__cxa_free_exception(ptr %54) #9
  br label %75

75:                                               ; preds = %74, %72
  br label %167

76:                                               ; preds = %49
  %77 = getelementptr inbounds %struct.v4l2_requestbuffers, ptr %3, i32 0, i32 0
  %78 = load i32, ptr %77, align 4, !tbaa !9
  %79 = zext i32 %78 to i64
  %80 = call noalias ptr @calloc(i64 noundef %79, i64 noundef 16) #12
  %81 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 4
  store ptr %80, ptr %81, align 8, !tbaa !22
  %82 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 4
  %83 = load ptr, ptr %82, align 8, !tbaa !22
  %84 = icmp ne ptr %83, null
  br i1 %84, label %92, label %85

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

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

88:                                               ; preds = %85
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %5, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %6, align 4
  call void @__cxa_free_exception(ptr %86) #9
  br label %167

92:                                               ; preds = %76
  %93 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 5
  store i32 0, ptr %93, align 8, !tbaa !23
  br label %94

94:                                               ; preds = %161, %92
  %95 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 5
  %96 = load i32, ptr %95, align 8, !tbaa !23
  %97 = getelementptr inbounds %struct.v4l2_requestbuffers, ptr %3, i32 0, i32 0
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = icmp ult i32 %96, %98
  br i1 %99, label %100, label %166

100:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 88, ptr %12) #9
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 88, i1 false)
  %101 = getelementptr inbounds %struct.v4l2_buffer, ptr %12, i32 0, i32 1
  store i32 1, ptr %101, align 4, !tbaa !24
  %102 = getelementptr inbounds %struct.v4l2_buffer, ptr %12, i32 0, i32 8
  store i32 1, ptr %102, align 4, !tbaa !28
  %103 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 5
  %104 = load i32, ptr %103, align 8, !tbaa !23
  %105 = getelementptr inbounds %struct.v4l2_buffer, ptr %12, i32 0, i32 0
  store i32 %104, ptr %105, align 8, !tbaa !29
  %106 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 1
  %107 = load i32, ptr %106, align 8, !tbaa !14
  %108 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %107, i64 noundef 3227014665, ptr noundef %12)
  %109 = icmp eq i32 -1, %108
  br i1 %109, label %110, label %117

110:                                              ; preds = %100
  %111 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %111, ptr noundef @.str.14)
          to label %112 unwind label %113

112:                                              ; preds = %110
  call void @__cxa_throw(ptr %111, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
  unreachable

113:                                              ; preds = %110
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %5, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %6, align 4
  call void @__cxa_free_exception(ptr %111) #9
  br label %165

117:                                              ; preds = %100
  %118 = getelementptr inbounds %struct.v4l2_buffer, ptr %12, i32 0, i32 10
  %119 = load i32, ptr %118, align 8, !tbaa !30
  %120 = zext i32 %119 to i64
  %121 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 4
  %122 = load ptr, ptr %121, align 8, !tbaa !22
  %123 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 5
  %124 = load i32, ptr %123, align 8, !tbaa !23
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds %struct.buffer, ptr %122, i64 %125
  %127 = getelementptr inbounds %struct.buffer, ptr %126, i32 0, i32 1
  store i64 %120, ptr %127, align 8, !tbaa !31
  %128 = getelementptr inbounds %struct.v4l2_buffer, ptr %12, i32 0, i32 10
  %129 = load i32, ptr %128, align 8, !tbaa !30
  %130 = zext i32 %129 to i64
  %131 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 1
  %132 = load i32, ptr %131, align 8, !tbaa !14
  %133 = getelementptr inbounds %struct.v4l2_buffer, ptr %12, i32 0, i32 9
  %134 = load i32, ptr %133, align 8, !tbaa !33
  %135 = zext i32 %134 to i64
  %136 = call ptr @mmap(ptr noundef null, i64 noundef %130, i32 noundef 3, i32 noundef 1, i32 noundef %132, i64 noundef %135) #9
  %137 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 4
  %138 = load ptr, ptr %137, align 8, !tbaa !22
  %139 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 5
  %140 = load i32, ptr %139, align 8, !tbaa !23
  %141 = zext i32 %140 to i64
  %142 = getelementptr inbounds %struct.buffer, ptr %138, i64 %141
  %143 = getelementptr inbounds %struct.buffer, ptr %142, i32 0, i32 0
  store ptr %136, ptr %143, align 8, !tbaa !34
  %144 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 4
  %145 = load ptr, ptr %144, align 8, !tbaa !22
  %146 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 5
  %147 = load i32, ptr %146, align 8, !tbaa !23
  %148 = zext i32 %147 to i64
  %149 = getelementptr inbounds %struct.buffer, ptr %145, i64 %148
  %150 = getelementptr inbounds %struct.buffer, ptr %149, i32 0, i32 0
  %151 = load ptr, ptr %150, align 8, !tbaa !34
  %152 = icmp eq ptr inttoptr (i64 -1 to ptr), %151
  br i1 %152, label %153, label %160

153:                                              ; preds = %117
  %154 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %154, ptr noundef @.str.15)
          to label %155 unwind label %156

155:                                              ; preds = %153
  call void @__cxa_throw(ptr %154, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
  unreachable

156:                                              ; preds = %153
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %5, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %6, align 4
  call void @__cxa_free_exception(ptr %154) #9
  br label %165

160:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 88, ptr %12) #9
  br label %161

161:                                              ; preds = %160
  %162 = getelementptr inbounds %class.Webcam, ptr %13, i32 0, i32 5
  %163 = load i32, ptr %162, align 8, !tbaa !23
  %164 = add i32 %163, 1
  store i32 %164, ptr %162, align 8, !tbaa !23
  br label %94, !llvm.loop !35

165:                                              ; preds = %156, %113
  call void @llvm.lifetime.end.p0(i64 88, ptr %12) #9
  br label %167

166:                                              ; preds = %94
  call void @llvm.lifetime.end.p0(i64 20, ptr %3) #9
  ret void

167:                                              ; preds = %165, %88, %75, %45, %41
  call void @llvm.lifetime.end.p0(i64 20, ptr %3) #9
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %5, align 8
  %170 = load i32, ptr %6, align 4
  %171 = insertvalue { ptr, i32 } poison, ptr %169, 0
  %172 = insertvalue { ptr, i32 } %171, i32 %170, 1
  resume { ptr, i32 } %172

173:                                              ; preds = %58, %29
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #7 align 2

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #8

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #4

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

!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, !11, i64 0}
!10 = !{!"_ZTS19v4l2_requestbuffers", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !7, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !11, i64 8}
!14 = !{!15, !11, i64 32}
!15 = !{!"_ZTS6Webcam", !16, i64 0, !11, i64 32, !19, i64 40, !6, i64 72, !11, i64 80, !18, i64 88, !18, i64 96, !18, i64 104, !20, i64 112}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTS8RGBImage", !6, i64 0, !18, i64 8, !18, i64 16, !18, i64 24}
!20 = !{!"bool", !7, i64 0}
!21 = !{!11, !11, i64 0}
!22 = !{!15, !6, i64 72}
!23 = !{!15, !11, i64 80}
!24 = !{!25, !11, i64 4}
!25 = !{!"_ZTS11v4l2_buffer", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !26, i64 24, !27, i64 40, !11, i64 56, !11, i64 60, !7, i64 64, !11, i64 72, !11, i64 76, !7, i64 80}
!26 = !{!"_ZTS7timeval", !18, i64 0, !18, i64 8}
!27 = !{!"_ZTS13v4l2_timecode", !11, i64 0, !11, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !7, i64 12}
!28 = !{!25, !11, i64 60}
!29 = !{!25, !11, i64 0}
!30 = !{!25, !11, i64 72}
!31 = !{!32, !18, i64 8}
!32 = !{!"_ZTS6buffer", !6, i64 0, !18, i64 8}
!33 = !{!7, !7, i64 0}
!34 = !{!32, !6, i64 0}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


; 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] }
%struct.v4l2_requestbuffers = type { i32, i32, i32, i32, [1 x i32] }
%"class.std::allocator" = type { i8 }
%struct.v4l2_buffer = type { i32, i32, i32, i32, i32, %struct.timeval, %struct.v4l2_timecode, i32, i32, %union.anon.1, i32, i32, %union.anon.2 }
%struct.timeval = type { i64, i64 }
%struct.v4l2_timecode = type { i32, i32, i8, i8, i8, i8, [4 x i8] }
%union.anon.1 = type { i64 }
%union.anon.2 = type { i32 }
%struct.buffer = type { ptr, i64 }

@_ZTISt13runtime_error = external constant ptr
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

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 #4

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 #5

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Webcam9init_mmapEv(ptr noundef nonnull align 8 dereferenceable(113) %0) local_unnamed_addr #7 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %struct.v4l2_requestbuffers, align 4
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = alloca %struct.v4l2_buffer, align 8
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #9
  %8 = getelementptr inbounds i8, ptr %2, i64 12
  store i64 0, ptr %8, align 4
  store i32 4, ptr %2, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %2, i64 4
  store i32 1, ptr %9, align 4, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 1, ptr %10, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = load i32, ptr %11, align 8, !tbaa !12
  %13 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %12, i64 noundef 3222558216, ptr noundef nonnull %2)
  %14 = icmp eq i32 %13, -1
  br i1 %14, label %15, label %32

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

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #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 %3, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.10)
          to label %21 unwind label %.thread

21:                                               ; preds = %20
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %23 unwind label %.thread25

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

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

.thread:                                          ; preds = %20
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #9
  br label %27

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

27:                                               ; preds = %.thread25, %.thread
  %.pn1924 = phi { ptr, i32 } [ %24, %.thread ], [ %22, %.thread25 ]
  call void @__cxa_free_exception(ptr %19) #9
  br label %97

28:                                               ; preds = %15
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull @.str.11)
          to label %29 unwind label %30

29:                                               ; preds = %28
  call void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
  unreachable

30:                                               ; preds = %28
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %19) #9
  br label %97

32:                                               ; preds = %1
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = icmp ult i32 %33, 2
  br i1 %34, label %35, label %47

35:                                               ; preds = %32
  %36 = call ptr @__cxa_allocate_exception(i64 16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull @.str.12, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %37 unwind label %.thread27

37:                                               ; preds = %35
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_RKS8_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %38 unwind label %41

38:                                               ; preds = %37
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %39 unwind label %43

39:                                               ; preds = %38
  invoke void @__cxa_throw(ptr nonnull %36, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
          to label %98 unwind label %43

.thread27:                                        ; preds = %35
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #9
  br label %46

41:                                               ; preds = %37
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %45

43:                                               ; preds = %39, %38
  %.0 = phi i1 [ false, %39 ], [ true, %38 ]
  %44 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #9
  br label %45

45:                                               ; preds = %41, %43
  %.pn16 = phi { ptr, i32 } [ %44, %43 ], [ %42, %41 ]
  %.1 = phi i1 [ %.0, %43 ], [ true, %41 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #9
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #9
  br i1 %.1, label %46, label %97

46:                                               ; preds = %.thread27, %45
  %.pn16.pn30 = phi { ptr, i32 } [ %40, %.thread27 ], [ %.pn16, %45 ]
  call void @__cxa_free_exception(ptr %36) #9
  br label %97

47:                                               ; preds = %32
  %48 = zext i32 %33 to i64
  %49 = call noalias ptr @calloc(i64 noundef %48, i64 noundef 16) #12
  %50 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %49, ptr %50, align 8, !tbaa !21
  %.not = icmp eq ptr %49, null
  br i1 %.not, label %51, label %.lr.ph

51:                                               ; preds = %47
  %52 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %52, ptr noundef nonnull @.str.13)
          to label %53 unwind label %54

53:                                               ; preds = %51
  call void @__cxa_throw(ptr nonnull %52, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
  unreachable

54:                                               ; preds = %51
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %52) #9
  br label %97

.lr.ph:                                           ; preds = %47
  %56 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 0, ptr %56, align 8, !tbaa !22
  %57 = getelementptr inbounds i8, ptr %7, i64 4
  %58 = getelementptr inbounds i8, ptr %7, i64 60
  %59 = getelementptr inbounds i8, ptr %7, i64 72
  %60 = getelementptr inbounds i8, ptr %7, i64 64
  %61 = getelementptr inbounds i8, ptr %7, i64 8
  br label %62

62:                                               ; preds = %.lr.ph, %92
  %storemerge31 = phi i32 [ 0, %.lr.ph ], [ %93, %92 ]
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %7) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(88) %61, i8 0, i64 80, i1 false)
  store i32 1, ptr %57, align 4, !tbaa !23
  store i32 1, ptr %58, align 4, !tbaa !27
  store i32 %storemerge31, ptr %7, align 8, !tbaa !28
  %63 = load i32, ptr %11, align 8, !tbaa !12
  %64 = call noundef i32 @_ZL6xioctlimPv(i32 noundef %63, i64 noundef 3227014665, ptr noundef nonnull %7)
  %65 = icmp eq i32 %64, -1
  br i1 %65, label %66, label %71

66:                                               ; preds = %62
  %67 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull @.str.14)
          to label %68 unwind label %69

68:                                               ; preds = %66
  call void @__cxa_throw(ptr nonnull %67, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #11
  unreachable

69:                                               ; preds = %66
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %96

71:                                               ; preds = %62
  %72 = load i32, ptr %59, align 8, !tbaa !29
  %73 = zext i32 %72 to i64
  %74 = load ptr, ptr %50, align 8, !tbaa !21
  %75 = load i32, ptr %56, align 8, !tbaa !22
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds %struct.buffer, ptr %74, i64 %76, i32 1
  store i64 %73, ptr %77, align 8, !tbaa !30
  %78 = load i32, ptr %11, align 8, !tbaa !12
  %79 = load i32, ptr %60, align 8, !tbaa !32
  %80 = zext i32 %79 to i64
  %81 = call ptr @mmap(ptr noundef null, i64 noundef %73, i32 noundef 3, i32 noundef 1, i32 noundef %78, i64 noundef %80) #9
  %82 = load ptr, ptr %50, align 8, !tbaa !21
  %83 = load i32, ptr %56, align 8, !tbaa !22
  %84 = zext i32 %83 to i64
  %85 = getelementptr inbounds %struct.buffer, ptr %82, i64 %84
  store ptr %81, ptr %85, align 8, !tbaa !33
  %86 = icmp eq ptr %81, inttoptr (i64 -1 to ptr)
  br i1 %86, label %87, label %92

87:                                               ; preds = %71
  %88 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %88, ptr noundef nonnull @.str.15)
          to label %89 unwind label %90

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

90:                                               ; preds = %87
  %91 = landingpad { ptr, i32 }
          cleanup
  br label %96

92:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %7) #9
  %93 = add i32 %83, 1
  store i32 %93, ptr %56, align 8, !tbaa !22
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = icmp ult i32 %93, %94
  br i1 %95, label %62, label %._crit_edge, !llvm.loop !34

96:                                               ; preds = %90, %69
  %.sink = phi ptr [ %88, %90 ], [ %67, %69 ]
  %.pn = phi { ptr, i32 } [ %91, %90 ], [ %70, %69 ]
  call void @__cxa_free_exception(ptr %.sink) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %7) #9
  br label %97

._crit_edge:                                      ; preds = %92
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #9
  ret void

97:                                               ; preds = %25, %45, %46, %27, %96, %54, %30
  %.pn19.pn = phi { ptr, i32 } [ %.pn1924, %27 ], [ %26, %25 ], [ %31, %30 ], [ %.pn16.pn30, %46 ], [ %.pn16, %45 ], [ %.pn, %96 ], [ %55, %54 ]
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #9
  resume { ptr, i32 } %.pn19.pn

98:                                               ; preds = %39, %23
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #7 align 2

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #8

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #4

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 "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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { noreturn }
attributes #12 = { nounwind allocsize(0,1) }

!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, !7, i64 0}
!6 = !{!"_ZTS19v4l2_requestbuffers", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !8, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}
!12 = !{!13, !7, i64 32}
!13 = !{!"_ZTS6Webcam", !14, i64 0, !7, i64 32, !18, i64 40, !16, i64 72, !7, i64 80, !17, i64 88, !17, i64 96, !17, i64 104, !19, i64 112}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !17, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !16, i64 0}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!"_ZTS8RGBImage", !16, i64 0, !17, i64 8, !17, i64 16, !17, i64 24}
!19 = !{!"bool", !8, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!13, !16, i64 72}
!22 = !{!13, !7, i64 80}
!23 = !{!24, !7, i64 4}
!24 = !{!"_ZTS11v4l2_buffer", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !25, i64 24, !26, i64 40, !7, i64 56, !7, i64 60, !8, i64 64, !7, i64 72, !7, i64 76, !8, i64 80}
!25 = !{!"_ZTS7timeval", !17, i64 0, !17, i64 8}
!26 = !{!"_ZTS13v4l2_timecode", !7, i64 0, !7, i64 4, !8, i64 8, !8, i64 9, !8, i64 10, !8, i64 11, !8, i64 12}
!27 = !{!24, !7, i64 60}
!28 = !{!24, !7, i64 0}
!29 = !{!24, !7, i64 72}
!30 = !{!31, !17, i64 8}
!31 = !{!"_ZTS6buffer", !16, i64 0, !17, i64 8}
!32 = !{!8, !8, i64 0}
!33 = !{!31, !16, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass