; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Image.ll (ZN7R2Image4ReadEPKc)

; 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.R2Image = type { i32, i32, i32, i32, ptr }

@stderr = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7R2Image4ReadEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  %9 = getelementptr inbounds %class.R2Image, ptr %8, i32 0, i32 4
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = icmp ne ptr %10, null
  br i1 %11, label %12, label %19

12:                                               ; preds = %2
  %13 = getelementptr inbounds %class.R2Image, ptr %8, i32 0, i32 4
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = icmp eq ptr %14, null
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @_ZdaPv(ptr noundef %14) #5
  br label %17

17:                                               ; preds = %16, %12
  %18 = getelementptr inbounds %class.R2Image, ptr %8, i32 0, i32 4
  store ptr null, ptr %18, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %17, %2
  %20 = getelementptr inbounds %class.R2Image, ptr %8, i32 0, i32 1
  store i32 0, ptr %20, align 4, !tbaa !12
  %21 = getelementptr inbounds %class.R2Image, ptr %8, i32 0, i32 0
  store i32 0, ptr %21, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call noundef ptr @strrchr(ptr noundef %22, i32 noundef 46) #7
  store ptr %23, ptr %6, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %28, label %25

25:                                               ; preds = %19
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.11) #6
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

28:                                               ; preds = %19
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = call i32 @strncmp(ptr noundef %29, ptr noundef @.str.12, i64 noundef 4) #7
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %35, label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call noundef i32 @_ZN7R2Image7ReadBMPEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %33)
  store i32 %34, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

35:                                               ; preds = %28
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = call i32 @strncmp(ptr noundef %36, ptr noundef @.str.13, i64 noundef 4) #7
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %42, label %39

39:                                               ; preds = %35
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call noundef i32 @_ZN7R2Image7ReadPPMEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %40)
  store i32 %41, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

42:                                               ; preds = %35
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = call i32 @strncmp(ptr noundef %43, ptr noundef @.str.14, i64 noundef 4) #7
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %49, label %46

46:                                               ; preds = %42
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call noundef i32 @_ZN7R2Image7ReadPPMEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %47)
  store i32 %48, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

49:                                               ; preds = %42
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = call i32 @strncmp(ptr noundef %50, ptr noundef @.str.15, i64 noundef 4) #7
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %56, label %53

53:                                               ; preds = %49
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = call noundef i32 @_ZN7R2Image7ReadPFMEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %54)
  store i32 %55, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

56:                                               ; preds = %49
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = call i32 @strncmp(ptr noundef %57, ptr noundef @.str.16, i64 noundef 4) #7
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %63, label %60

60:                                               ; preds = %56
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = call noundef i32 @_ZN7R2Image8ReadJPEGEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %61)
  store i32 %62, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

63:                                               ; preds = %56
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = call i32 @strncmp(ptr noundef %64, ptr noundef @.str.17, i64 noundef 5) #7
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %70, label %67

67:                                               ; preds = %63
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = call noundef i32 @_ZN7R2Image8ReadJPEGEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %68)
  store i32 %69, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

70:                                               ; preds = %63
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = call i32 @strncmp(ptr noundef %71, ptr noundef @.str.18, i64 noundef 4) #7
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %77, label %74

74:                                               ; preds = %70
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = call noundef i32 @_ZN7R2Image8ReadTIFFEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %75)
  store i32 %76, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

77:                                               ; preds = %70
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = call i32 @strncmp(ptr noundef %78, ptr noundef @.str.19, i64 noundef 5) #7
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %84, label %81

81:                                               ; preds = %77
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = call noundef i32 @_ZN7R2Image8ReadTIFFEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %82)
  store i32 %83, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

84:                                               ; preds = %77
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = call i32 @strncmp(ptr noundef %85, ptr noundef @.str.20, i64 noundef 4) #7
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %91, label %88

88:                                               ; preds = %84
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = call noundef i32 @_ZN7R2Image7ReadPNGEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %89)
  store i32 %90, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

91:                                               ; preds = %84
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = call i32 @strncmp(ptr noundef %92, ptr noundef @.str.21, i64 noundef 4) #7
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %98, label %95

95:                                               ; preds = %91
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = call noundef i32 @_ZN7R2Image7ReadRAWEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %96)
  store i32 %97, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

98:                                               ; preds = %91
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = call i32 @strncmp(ptr noundef %99, ptr noundef @.str.22, i64 noundef 4) #7
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %105, label %102

102:                                              ; preds = %98
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = call noundef i32 @_ZN7R2Image7ReadGRDEPKc(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef %103)
  store i32 %104, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

105:                                              ; preds = %98
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr @stderr, align 8, !tbaa !5
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef @.str.23) #6
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %118

118:                                              ; preds = %115, %102, %95, %88, %81, %74, %67, %60, %53, %46, %39, %32, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %119 = load i32, ptr %3, align 4
  ret i32 %119
}

; 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: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #4

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

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

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

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

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

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

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin 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 #3 = { 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 #4 = { nounwind willreturn memory(read) "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 = { builtin nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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, !6, i64 16}
!10 = !{!"_ZTS7R2Image", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !11, i64 0}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7R2Image4ReadEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %6, label %5

5:                                                ; preds = %2
  tail call void @_ZdaPv(ptr noundef nonnull %4) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  br label %6

6:                                                ; preds = %5, %2
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 0, ptr %7, align 4, !tbaa !11
  store i32 0, ptr %0, align 8, !tbaa !12
  %8 = tail call noundef ptr @strrchr(ptr noundef nonnull dereferenceable(1) %1, i32 noundef 46) #5
  %.not26 = icmp eq ptr %8, null
  br i1 %.not26, label %9, label %12

9:                                                ; preds = %6
  %10 = load ptr, ptr @stderr, align 8, !tbaa !13
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.11) #6
  br label %59

12:                                               ; preds = %6
  %13 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.12, i64 noundef 4) #5
  %.not27 = icmp eq i32 %13, 0
  br i1 %.not27, label %14, label %16

14:                                               ; preds = %12
  %15 = tail call noundef i32 @_ZN7R2Image7ReadBMPEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

16:                                               ; preds = %12
  %17 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.13, i64 noundef 4) #5
  %.not28 = icmp eq i32 %17, 0
  br i1 %.not28, label %18, label %20

18:                                               ; preds = %16
  %19 = tail call noundef i32 @_ZN7R2Image7ReadPPMEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

20:                                               ; preds = %16
  %21 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.14, i64 noundef 4) #5
  %.not29 = icmp eq i32 %21, 0
  br i1 %.not29, label %22, label %24

22:                                               ; preds = %20
  %23 = tail call noundef i32 @_ZN7R2Image7ReadPPMEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

24:                                               ; preds = %20
  %25 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.15, i64 noundef 4) #5
  %.not30 = icmp eq i32 %25, 0
  br i1 %.not30, label %26, label %28

26:                                               ; preds = %24
  %27 = tail call noundef i32 @_ZN7R2Image7ReadPFMEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

28:                                               ; preds = %24
  %29 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.16, i64 noundef 4) #5
  %.not31 = icmp eq i32 %29, 0
  br i1 %.not31, label %30, label %32

30:                                               ; preds = %28
  %31 = tail call noundef i32 @_ZN7R2Image8ReadJPEGEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

32:                                               ; preds = %28
  %33 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.17, i64 noundef 5) #5
  %.not32 = icmp eq i32 %33, 0
  br i1 %.not32, label %34, label %36

34:                                               ; preds = %32
  %35 = tail call noundef i32 @_ZN7R2Image8ReadJPEGEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

36:                                               ; preds = %32
  %37 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.18, i64 noundef 4) #5
  %.not33 = icmp eq i32 %37, 0
  br i1 %.not33, label %38, label %40

38:                                               ; preds = %36
  %39 = tail call noundef i32 @_ZN7R2Image8ReadTIFFEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

40:                                               ; preds = %36
  %41 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.19, i64 noundef 5) #5
  %.not34 = icmp eq i32 %41, 0
  br i1 %.not34, label %42, label %44

42:                                               ; preds = %40
  %43 = tail call noundef i32 @_ZN7R2Image8ReadTIFFEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

44:                                               ; preds = %40
  %45 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.20, i64 noundef 4) #5
  %.not35 = icmp eq i32 %45, 0
  br i1 %.not35, label %46, label %48

46:                                               ; preds = %44
  %47 = tail call noundef i32 @_ZN7R2Image7ReadPNGEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

48:                                               ; preds = %44
  %49 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.21, i64 noundef 4) #5
  %.not36 = icmp eq i32 %49, 0
  br i1 %.not36, label %50, label %52

50:                                               ; preds = %48
  %51 = tail call noundef i32 @_ZN7R2Image7ReadRAWEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

52:                                               ; preds = %48
  %53 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) @.str.22, i64 noundef 4) #5
  %.not37 = icmp eq i32 %53, 0
  br i1 %.not37, label %54, label %56

54:                                               ; preds = %52
  %55 = tail call noundef i32 @_ZN7R2Image7ReadGRDEPKc(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1)
  br label %59

56:                                               ; preds = %52
  %57 = load ptr, ptr @stderr, align 8, !tbaa !13
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.23) #6
  br label %59

59:                                               ; preds = %56, %54, %50, %46, %42, %38, %34, %30, %26, %22, %18, %14, %9
  %.0 = phi i32 [ 0, %56 ], [ %55, %54 ], [ %51, %50 ], [ %47, %46 ], [ %43, %42 ], [ %39, %38 ], [ %35, %34 ], [ %31, %30 ], [ %27, %26 ], [ %23, %22 ], [ %19, %18 ], [ %15, %14 ], [ 0, %9 ]
  ret i32 %.0
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #3

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

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

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

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

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

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

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

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

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 = { nobuiltin 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { builtin nounwind }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 16}
!6 = !{!"_ZTS7R2Image", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 0}
!13 = !{!10, !10, i64 0}


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