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

; 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.fd_set = type { [16 x i64] }
%struct.timeval = type { i64, i64 }
%"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.buffer = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@_ZTISt13runtime_error = external constant ptr
@.str.1 = external hidden unnamed_addr constant [17 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 uwtable
define dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6Webcam5frameEi(ptr noundef nonnull align 8 dereferenceable(113) %0, i32 noundef %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %struct.fd_set, align 8
  %7 = alloca %struct.timeval, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca i1, align 1
  %16 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %17 = load ptr, ptr %4, align 8
  br label %18

18:                                               ; preds = %121, %119, %2
  call void @llvm.lifetime.start.p0(i64 128, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  br label %19

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store ptr %6, ptr %10, align 8, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %30, %19
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = icmp ult i64 %22, 16
  br i1 %23, label %24, label %33

24:                                               ; preds = %20
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.fd_set, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds [16 x i64], ptr %26, i64 0, i64 %28
  store i64 0, ptr %29, align 8, !tbaa !11
  br label %30

30:                                               ; preds = %24
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = add i32 %31, 1
  store i32 %32, ptr %9, align 4, !tbaa !9
  br label %20, !llvm.loop !13

33:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  %36 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !15
  %38 = srem i32 %37, 64
  %39 = zext i32 %38 to i64
  %40 = shl i64 1, %39
  %41 = getelementptr inbounds %struct.fd_set, ptr %6, i32 0, i32 0
  %42 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 1
  %43 = load i32, ptr %42, align 8, !tbaa !15
  %44 = sdiv i32 %43, 64
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [16 x i64], ptr %41, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !11
  %48 = or i64 %47, %40
  store i64 %48, ptr %46, align 8, !tbaa !11
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds %struct.timeval, ptr %7, i32 0, i32 0
  store i64 %50, ptr %51, align 8, !tbaa !21
  %52 = getelementptr inbounds %struct.timeval, ptr %7, i32 0, i32 1
  store i64 0, ptr %52, align 8, !tbaa !23
  %53 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !15
  %55 = add nsw i32 %54, 1
  %56 = call i32 @select(i32 noundef %55, ptr noundef %6, ptr noundef null, ptr noundef null, ptr noundef %7)
  store i32 %56, ptr %8, align 4, !tbaa !9
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = icmp eq i32 -1, %57
  br i1 %58, label %59, label %71

59:                                               ; preds = %35
  %60 = call ptr @__errno_location() #8
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = icmp eq i32 4, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %59
  store i32 3, ptr %11, align 4
  br label %119, !llvm.loop !24

64:                                               ; preds = %59
  %65 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %65, ptr noundef @.str)
          to label %66 unwind label %67

66:                                               ; preds = %64
  call void @__cxa_throw(ptr %65, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #9
  unreachable

67:                                               ; preds = %64
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %12, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %13, align 4
  call void @__cxa_free_exception(ptr %65) #7
  br label %122

71:                                               ; preds = %35
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = icmp eq i32 0, %72
  br i1 %73, label %74, label %91

74:                                               ; preds = %71
  store i1 true, ptr %15, align 1
  %75 = call ptr @__cxa_allocate_exception(i64 16) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #7
  %76 = getelementptr inbounds %class.Webcam, ptr %17, 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 %14, ptr noundef nonnull align 8 dereferenceable(32) %76, ptr noundef @.str.1)
          to label %77 unwind label %79

77:                                               ; preds = %74
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %75, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %78 unwind label %83

78:                                               ; preds = %77
  store i1 false, ptr %15, align 1
  invoke void @__cxa_throw(ptr %75, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #9
          to label %130 unwind label %83

79:                                               ; preds = %74
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %12, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %13, align 4
  br label %87

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

87:                                               ; preds = %83, %79
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #7
  %88 = load i1, ptr %15, align 1
  br i1 %88, label %89, label %90

89:                                               ; preds = %87
  call void @__cxa_free_exception(ptr %75) #7
  br label %90

90:                                               ; preds = %89, %87
  br label %122

91:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %92 = call noundef zeroext i1 @_ZN6Webcam10read_frameEv(ptr noundef nonnull align 8 dereferenceable(113) %17)
  %93 = zext i1 %92 to i32
  store i32 %93, ptr %16, align 4, !tbaa !9
  %94 = load i32, ptr %16, align 4, !tbaa !9
  %95 = icmp ne i32 %94, -1
  br i1 %95, label %96, label %117

96:                                               ; preds = %91
  %97 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !25
  %99 = load i32, ptr %16, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds %struct.buffer, ptr %98, i64 %100
  %102 = getelementptr inbounds %struct.buffer, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !26
  %104 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 3
  %105 = getelementptr inbounds %struct.RGBImage, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !28
  %107 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 7
  %108 = load i64, ptr %107, align 8, !tbaa !29
  %109 = trunc i64 %108 to i32
  %110 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 8
  %111 = load i64, ptr %110, align 8, !tbaa !30
  %112 = trunc i64 %111 to i32
  %113 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 9
  %114 = load i64, ptr %113, align 8, !tbaa !31
  %115 = trunc i64 %114 to i32
  call void @_ZL24v4lconvert_yuyv_to_rgb24PKhPhiii(ptr noundef %103, ptr noundef %106, i32 noundef %109, i32 noundef %112, i32 noundef %115)
  %116 = getelementptr inbounds %class.Webcam, ptr %17, i32 0, i32 3
  store ptr %116, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %118

117:                                              ; preds = %91
  store i32 0, ptr %11, align 4
  br label %118

118:                                              ; preds = %117, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %119

119:                                              ; preds = %118, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr %6) #7
  %120 = load i32, ptr %11, align 4
  switch i32 %120, label %130 [
    i32 0, label %121
    i32 3, label %18
    i32 1, label %123
  ]

121:                                              ; preds = %119
  br label %18, !llvm.loop !24

122:                                              ; preds = %90, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr %6) #7
  br label %125

123:                                              ; preds = %119
  %124 = load ptr, ptr %3, align 8
  ret ptr %124

125:                                              ; preds = %122
  %126 = load ptr, ptr %12, align 8
  %127 = load i32, ptr %13, align 4
  %128 = insertvalue { ptr, i32 } poison, ptr %126, 0
  %129 = insertvalue { ptr, i32 } %128, i32 %127, 1
  resume { ptr, i32 } %129

130:                                              ; preds = %119, %78
  unreachable
}

; 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

declare i32 @select(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

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

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

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

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

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 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 = { "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 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 #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 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 32}
!16 = !{!"_ZTS6Webcam", !17, i64 0, !10, i64 32, !19, i64 40, !6, i64 72, !10, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !20, i64 112}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !12, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!19 = !{!"_ZTS8RGBImage", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!20 = !{!"bool", !7, i64 0}
!21 = !{!22, !12, i64 0}
!22 = !{!"_ZTS7timeval", !12, i64 0, !12, i64 8}
!23 = !{!22, !12, i64 8}
!24 = distinct !{!24, !14}
!25 = !{!16, !6, i64 72}
!26 = !{!27, !6, i64 0}
!27 = !{!"_ZTS6buffer", !6, i64 0, !12, i64 8}
!28 = !{!16, !6, i64 40}
!29 = !{!16, !12, i64 88}
!30 = !{!16, !12, i64 96}
!31 = !{!16, !12, 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.fd_set = type { [16 x i64] }
%struct.timeval = type { i64, i64 }
%"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.buffer = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@_ZTISt13runtime_error = external constant ptr
@.str.1 = external hidden unnamed_addr constant [17 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 uwtable
define dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6Webcam5frameEi(ptr noundef nonnull align 8 dereferenceable(113) %0, i32 noundef %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.fd_set, align 8
  %4 = alloca %struct.timeval, align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = sext i32 %1 to i64
  %8 = getelementptr inbounds i8, ptr %4, i64 8
  br label %9

9:                                                ; preds = %39, %2
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %3, i8 0, i64 128, i1 false), !tbaa !5
  %10 = load i32, ptr %6, align 8, !tbaa !9
  %11 = srem i32 %10, 64
  %12 = zext nneg i32 %11 to i64
  %13 = shl nuw i64 1, %12
  %14 = sdiv i32 %10, 64
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [16 x i64], ptr %3, i64 0, i64 %15
  %17 = load i64, ptr %16, align 8, !tbaa !5
  %18 = or i64 %13, %17
  store i64 %18, ptr %16, align 8, !tbaa !5
  store i64 %7, ptr %4, align 8, !tbaa !17
  store i64 0, ptr %8, align 8, !tbaa !19
  %19 = add nsw i32 %10, 1
  %20 = call i32 @select(i32 noundef %19, ptr noundef nonnull %3, ptr noundef null, ptr noundef null, ptr noundef nonnull %4)
  switch i32 %20, label %41 [
    i32 -1, label %21
    i32 0, label %30
  ]

21:                                               ; preds = %9
  %22 = tail call ptr @__errno_location() #9
  %23 = load i32, ptr %22, align 4, !tbaa !20
  %24 = icmp eq i32 %23, 4
  br i1 %24, label %39, label %25, !llvm.loop !21

25:                                               ; preds = %21
  %26 = call ptr @__cxa_allocate_exception(i64 16) #8
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull @.str)
          to label %27 unwind label %28

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

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

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

32:                                               ; preds = %30
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %34 unwind label %.thread31

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

34:                                               ; preds = %32
  invoke void @__cxa_throw(ptr nonnull %31, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #10
          to label %59 unwind label %36

.thread:                                          ; preds = %30
  %35 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  br label %38

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

38:                                               ; preds = %.thread31, %.thread
  %.pn30 = phi { ptr, i32 } [ %35, %.thread ], [ %33, %.thread31 ]
  call void @__cxa_free_exception(ptr %31) #8
  br label %40

39:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #8
  br label %9

40:                                               ; preds = %36, %38, %28
  %.pn26 = phi { ptr, i32 } [ %29, %28 ], [ %.pn30, %38 ], [ %37, %36 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #8
  resume { ptr, i32 } %.pn26

41:                                               ; preds = %9
  %42 = call noundef zeroext i1 @_ZN6Webcam10read_frameEv(ptr noundef nonnull align 8 dereferenceable(113) %0)
  %43 = getelementptr inbounds i8, ptr %0, i64 72
  %44 = load ptr, ptr %43, align 8, !tbaa !23
  %45 = zext i1 %42 to i64
  %46 = getelementptr inbounds %struct.buffer, ptr %44, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !24
  %48 = getelementptr inbounds i8, ptr %0, i64 40
  %49 = load ptr, ptr %48, align 8, !tbaa !26
  %50 = getelementptr inbounds i8, ptr %0, i64 88
  %51 = load i64, ptr %50, align 8, !tbaa !27
  %52 = trunc i64 %51 to i32
  %53 = getelementptr inbounds i8, ptr %0, i64 96
  %54 = load i64, ptr %53, align 8, !tbaa !28
  %55 = trunc i64 %54 to i32
  %56 = getelementptr inbounds i8, ptr %0, i64 104
  %57 = load i64, ptr %56, align 8, !tbaa !29
  %58 = trunc i64 %57 to i32
  call void @_ZL24v4lconvert_yuyv_to_rgb24PKhPhiii(ptr noundef %47, ptr noundef %49, i32 noundef %52, i32 noundef %55, i32 noundef %58)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #8
  ret ptr %48

59:                                               ; preds = %34
  unreachable
}

; 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

declare i32 @select(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

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

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

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

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 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 = { "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 = { 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 #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 = { nounwind }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { 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 = !{!"long", !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, !13, i64 72, !14, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !16, i64 112}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !6, i64 8, !7, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS8RGBImage", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"bool", !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS7timeval", !6, i64 0, !6, i64 8}
!19 = !{!18, !6, i64 8}
!20 = !{!14, !14, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!10, !13, i64 72}
!24 = !{!25, !13, i64 0}
!25 = !{!"_ZTS6buffer", !13, i64 0, !6, i64 8}
!26 = !{!10, !13, i64 40}
!27 = !{!10, !6, i64 88}
!28 = !{!10, !6, i64 96}
!29 = !{!10, !6, i64 104}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass