; LLVM IR from bbrister/SIFT3D :: cli (denseSift3D)

; 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._Image = type { ptr, i32, double, i64, i32, i32, i32, double, double, double, i64, i64, i64, i32, i32 }
%struct._SIFT3D = type { %struct._Mesh, %struct._GSS_filters, %struct._SIFT_cl_kernels, %struct._Pyramid, %struct._Pyramid, %struct._Image, double, double, i32 }
%struct._Mesh = type { ptr, i32 }
%struct._GSS_filters = type { %struct._Gauss_filter, ptr, i32, i32 }
%struct._Gauss_filter = type { double, %struct._Sep_FIR_filter }
%struct._Sep_FIR_filter = type { i32, ptr, i32, i32, i32 }
%struct._SIFT_cl_kernels = type { i32 }
%struct._Pyramid = type { ptr, double, double, i32, i32, i32, i32, i32 }

@help_msg = external dso_local constant [607 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @err_msg(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @err_msgu(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [1024 x i8], align 16
  %7 = alloca [1024 x i8], align 16
  %8 = alloca %struct._Image, align 8
  %9 = alloca %struct._Image, align 8
  %10 = alloca %struct._Image, align 8
  %11 = alloca %struct._SIFT3D, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca [1024 x i8], align 16
  %20 = alloca [1024 x i8], align 16
  %21 = alloca [1024 x i8], align 16
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1024, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 104, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 104, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 104, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 304, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = call i32 @parse_gnu(i32 noundef %22, ptr noundef %23)
  switch i32 %24, label %28 [
    i32 1, label %25
    i32 2, label %27
  ]

25:                                               ; preds = %2
  %26 = call i32 @puts(ptr noundef @help_msg)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

27:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

28:                                               ; preds = %2
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = icmp slt i32 %29, 3
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  call void @err_msg(ptr noundef @.str.1)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

32:                                               ; preds = %28
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 3
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  call void @err_msg(ptr noundef @.str.2)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

36:                                               ; preds = %32
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 1
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  store ptr %40, ptr %12, align 8, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 2
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  store ptr %43, ptr %13, align 8, !tbaa !9
  call void @init_im(ptr noundef %8)
  call void @init_im(ptr noundef %9)
  call void @init_im(ptr noundef %10)
  %44 = call i32 @init_SIFT3D(ptr noundef %11)
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %37
  call void @err_msgu(ptr noundef @.str.3)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

47:                                               ; preds = %37
  %48 = load ptr, ptr %12, align 8, !tbaa !9
  %49 = call i32 @im_read(ptr noundef %48, ptr noundef %8)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %56

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 1024, ptr %19) #6
  %52 = getelementptr inbounds [1024 x i8], ptr %19, i64 0, i64 0
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %52, i64 noundef 1024, ptr noundef @.str.4, ptr noundef %53) #6
  %55 = getelementptr inbounds [1024 x i8], ptr %19, i64 0, i64 0
  call void @err_msg(ptr noundef %55)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 1024, ptr %19) #6
  br label %130

56:                                               ; preds = %47
  %57 = load ptr, ptr %13, align 8, !tbaa !9
  %58 = call ptr @strrchr(ptr noundef %57, i32 noundef 37) #7
  store ptr %58, ptr %14, align 8, !tbaa !9
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  call void @err_msg(ptr noundef @.str.5)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

61:                                               ; preds = %56
  %62 = load ptr, ptr %14, align 8, !tbaa !9
  %63 = load ptr, ptr %13, align 8, !tbaa !9
  %64 = ptrtoint ptr %62 to i64
  %65 = ptrtoint ptr %63 to i64
  %66 = sub i64 %64, %65
  %67 = trunc i64 %66 to i32
  store i32 %67, ptr %17, align 4, !tbaa !5
  %68 = load ptr, ptr %13, align 8, !tbaa !9
  %69 = call i64 @strlen(ptr noundef %68) #7
  %70 = getelementptr inbounds %struct._Image, ptr %8, i32 0, i32 13
  %71 = load i32, ptr %70, align 8, !tbaa !11
  %72 = sitofp i32 %71 to double
  %73 = call double @log10(double noundef %72) #6
  %74 = call double @llvm.ceil.f64(double %73)
  %75 = fptosi double %74 to i32
  %76 = sext i32 %75 to i64
  %77 = add i64 %69, %76
  %78 = sub i64 %77, 1
  store i64 %78, ptr %15, align 8, !tbaa !15
  %79 = load i64, ptr %15, align 8, !tbaa !15
  %80 = icmp ugt i64 %79, 1024
  br i1 %80, label %81, label %85

81:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 1024, ptr %20) #6
  %82 = getelementptr inbounds [1024 x i8], ptr %20, i64 0, i64 0
  %83 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %82, i64 noundef 1024, ptr noundef @.str.6, i32 noundef 1024) #6
  %84 = getelementptr inbounds [1024 x i8], ptr %20, i64 0, i64 0
  call void @err_msg(ptr noundef %84)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 1024, ptr %20) #6
  br label %130

85:                                               ; preds = %61
  %86 = call i32 @SIFT3D_extract_dense_descriptors(ptr noundef %11, ptr noundef %8, ptr noundef %9)
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %85
  call void @err_msgu(ptr noundef @.str.7)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

89:                                               ; preds = %85
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %126, %89
  %91 = load i32, ptr %16, align 4, !tbaa !5
  %92 = getelementptr inbounds %struct._Image, ptr %9, i32 0, i32 13
  %93 = load i32, ptr %92, align 8, !tbaa !11
  %94 = icmp slt i32 %91, %93
  br i1 %94, label %95, label %129

95:                                               ; preds = %90
  %96 = load i32, ptr %16, align 4, !tbaa !5
  %97 = call i32 @im_channel(ptr noundef %9, ptr noundef %10, i32 noundef %96)
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %95
  call void @err_msgu(ptr noundef @.str.8)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

100:                                              ; preds = %95
  %101 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  store i8 0, ptr %101, align 16, !tbaa !16
  %102 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 0
  %103 = load i32, ptr %16, align 4, !tbaa !5
  %104 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %102, i64 noundef 1024, ptr noundef @.str.9, i32 noundef %103) #6
  %105 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %106 = load ptr, ptr %13, align 8, !tbaa !9
  %107 = load i32, ptr %17, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = call ptr @strncat(ptr noundef %105, ptr noundef %106, i64 noundef %108) #6
  %110 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %111 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 0
  %112 = call ptr @strcat(ptr noundef %110, ptr noundef %111) #6
  %113 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %114 = load ptr, ptr %14, align 8, !tbaa !9
  %115 = getelementptr inbounds i8, ptr %114, i64 1
  %116 = call ptr @strcat(ptr noundef %113, ptr noundef %115) #6
  %117 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %118 = call i32 @im_write(ptr noundef %117, ptr noundef %10)
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %125

120:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 1024, ptr %21) #6
  %121 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  %122 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %123 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %121, i64 noundef 1024, ptr noundef @.str.10, ptr noundef %122) #6
  %124 = getelementptr inbounds [1024 x i8], ptr %21, i64 0, i64 0
  call void @err_msg(ptr noundef %124)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 1024, ptr %21) #6
  br label %130

125:                                              ; preds = %100
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %16, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %16, align 4, !tbaa !5
  br label %90, !llvm.loop !17

129:                                              ; preds = %90
  store i32 0, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %130

130:                                              ; preds = %129, %120, %99, %88, %81, %60, %51, %46, %35, %31, %27, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 304, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %6) #6
  %131 = load i32, ptr %3, align 4
  ret i32 %131
}

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

declare i32 @parse_gnu(i32 noundef, ptr noundef) #2

declare i32 @puts(ptr noundef) #2

declare void @init_im(ptr noundef) #2

declare i32 @init_SIFT3D(ptr noundef) #2

declare i32 @im_read(ptr noundef, ptr noundef) #2

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

; 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(read)
declare ptr @strrchr(ptr noundef, i32 noundef) #4

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

; Function Attrs: nounwind
declare double @log10(double noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

declare i32 @SIFT3D_extract_dense_descriptors(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @im_channel(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare ptr @strncat(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #3

declare i32 @im_write(ptr noundef, ptr noundef) #2

attributes #0 = { 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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 96}
!12 = !{!"_Image", !10, i64 0, !6, i64 8, !13, i64 16, !14, i64 24, !6, i64 32, !6, i64 36, !6, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !6, i64 96, !6, i64 100}
!13 = !{!"double", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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"

%struct._Image = type { ptr, i32, double, i64, i32, i32, i32, double, double, double, i64, i64, i64, i32, i32 }
%struct._SIFT3D = type { %struct._Mesh, %struct._GSS_filters, %struct._SIFT_cl_kernels, %struct._Pyramid, %struct._Pyramid, %struct._Image, double, double, i32 }
%struct._Mesh = type { ptr, i32 }
%struct._GSS_filters = type { %struct._Gauss_filter, ptr, i32, i32 }
%struct._Gauss_filter = type { double, %struct._Sep_FIR_filter }
%struct._Sep_FIR_filter = type { i32, ptr, i32, i32, i32 }
%struct._SIFT_cl_kernels = type { i32 }
%struct._Pyramid = type { ptr, double, double, i32, i32, i32, i32, i32 }

@help_msg = external dso_local constant [607 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @err_msg(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @err_msgu(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca [1024 x i8], align 16
  %4 = alloca [1024 x i8], align 16
  %5 = alloca %struct._Image, align 8
  %6 = alloca %struct._Image, align 8
  %7 = alloca %struct._Image, align 8
  %8 = alloca %struct._SIFT3D, align 8
  %9 = alloca [1024 x i8], align 16
  %10 = alloca [1024 x i8], align 16
  %11 = alloca [1024 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 304, ptr nonnull %8) #8
  %12 = tail call i32 @parse_gnu(i32 noundef %0, ptr noundef %1) #8
  switch i32 %12, label %15 [
    i32 1, label %13
    i32 2, label %.loopexit
  ]

13:                                               ; preds = %2
  %14 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @help_msg)
  br label %.loopexit

15:                                               ; preds = %2
  %16 = icmp slt i32 %0, 3
  br i1 %16, label %17, label %18

17:                                               ; preds = %15
  tail call void @err_msg(ptr noundef nonnull @.str.1)
  br label %.loopexit

18:                                               ; preds = %15
  %.not = icmp eq i32 %0, 3
  br i1 %.not, label %20, label %19

19:                                               ; preds = %18
  tail call void @err_msg(ptr noundef nonnull @.str.2)
  br label %.loopexit

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %1, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %1, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  call void @init_im(ptr noundef nonnull %5) #8
  call void @init_im(ptr noundef nonnull %6) #8
  call void @init_im(ptr noundef nonnull %7) #8
  %25 = call i32 @init_SIFT3D(ptr noundef nonnull %8) #8
  %.not23 = icmp eq i32 %25, 0
  br i1 %.not23, label %27, label %26

26:                                               ; preds = %20
  call void @err_msgu(ptr noundef nonnull @.str.3)
  br label %.loopexit

27:                                               ; preds = %20
  %28 = call i32 @im_read(ptr noundef %22, ptr noundef nonnull %5) #8
  %.not24 = icmp eq i32 %28, 0
  br i1 %.not24, label %31, label %29

29:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %9) #8
  %30 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %9, i64 noundef 1024, ptr noundef nonnull @.str.4, ptr noundef %22) #8
  call void @err_msg(ptr noundef nonnull %9)
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %9) #8
  br label %.loopexit

31:                                               ; preds = %27
  %32 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %24, i32 noundef 37) #9
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  call void @err_msg(ptr noundef nonnull @.str.5)
  br label %.loopexit

35:                                               ; preds = %31
  %36 = ptrtoint ptr %32 to i64
  %37 = ptrtoint ptr %24 to i64
  %38 = sub i64 %36, %37
  %39 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %24) #9
  %40 = getelementptr inbounds i8, ptr %5, i64 96
  %41 = load i32, ptr %40, align 8, !tbaa !9
  %42 = sitofp i32 %41 to double
  %43 = call double @log10(double noundef %42) #8
  %44 = call double @llvm.ceil.f64(double %43)
  %45 = fptosi double %44 to i32
  %46 = sext i32 %45 to i64
  %47 = add i64 %39, -1026
  %48 = add i64 %47, %46
  %49 = icmp ult i64 %48, -1025
  br i1 %49, label %50, label %52

50:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %10) #8
  %51 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %10, i64 noundef 1024, ptr noundef nonnull @.str.6, i32 noundef 1024) #8
  call void @err_msg(ptr noundef nonnull %10)
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %10) #8
  br label %.loopexit

52:                                               ; preds = %35
  %53 = call i32 @SIFT3D_extract_dense_descriptors(ptr noundef nonnull %8, ptr noundef nonnull %5, ptr noundef nonnull %6) #8
  %.not25 = icmp eq i32 %53, 0
  br i1 %.not25, label %.preheader, label %59

.preheader:                                       ; preds = %52
  %54 = getelementptr inbounds i8, ptr %6, i64 96
  %55 = load i32, ptr %54, align 8, !tbaa !9
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %sext = shl i64 %38, 32
  %57 = ashr exact i64 %sext, 32
  %58 = getelementptr inbounds i8, ptr %32, i64 1
  br label %64

59:                                               ; preds = %52
  call void @err_msgu(ptr noundef nonnull @.str.7)
  br label %.loopexit

60:                                               ; preds = %67
  %61 = add nuw nsw i32 %.02028, 1
  %62 = load i32, ptr %54, align 8, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %64, label %.loopexit, !llvm.loop !14

64:                                               ; preds = %.lr.ph, %60
  %.02028 = phi i32 [ 0, %.lr.ph ], [ %61, %60 ]
  %65 = call i32 @im_channel(ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef %.02028) #8
  %.not26 = icmp eq i32 %65, 0
  br i1 %.not26, label %67, label %66

66:                                               ; preds = %64
  call void @err_msgu(ptr noundef nonnull @.str.8)
  br label %.loopexit

67:                                               ; preds = %64
  store i8 0, ptr %3, align 16, !tbaa !16
  %68 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 1024, ptr noundef nonnull @.str.9, i32 noundef %.02028) #8
  %69 = call ptr @strncat(ptr noundef nonnull dereferenceable(1) %3, ptr noundef %24, i64 noundef %57) #8
  %70 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) %4) #8
  %71 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) %58) #8
  %72 = call i32 @im_write(ptr noundef nonnull %3, ptr noundef nonnull %7) #8
  %.not27 = icmp eq i32 %72, 0
  br i1 %.not27, label %60, label %73

73:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %11) #8
  %74 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %11, i64 noundef 1024, ptr noundef nonnull @.str.10, ptr noundef nonnull %3) #8
  call void @err_msg(ptr noundef nonnull %11)
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %11) #8
  br label %.loopexit

.loopexit:                                        ; preds = %60, %.preheader, %2, %73, %66, %59, %50, %34, %29, %26, %19, %17, %13
  %.0 = phi i32 [ 1, %17 ], [ 1, %19 ], [ 1, %26 ], [ 1, %29 ], [ 1, %34 ], [ 1, %50 ], [ 1, %59 ], [ 1, %66 ], [ 1, %73 ], [ 0, %13 ], [ 0, %2 ], [ 0, %.preheader ], [ 0, %60 ]
  call void @llvm.lifetime.end.p0(i64 304, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #8
  ret i32 %.0
}

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

declare i32 @parse_gnu(i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3

declare void @init_im(ptr noundef) local_unnamed_addr #2

declare i32 @init_SIFT3D(ptr noundef) local_unnamed_addr #2

declare i32 @im_read(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; 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 nounwind willreturn memory(argmem: read)
declare ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log10(double noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #6

declare i32 @SIFT3D_extract_dense_descriptors(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @im_channel(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #7

declare i32 @im_write(ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 = { "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 = { 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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(write) "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 nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 }
attributes #9 = { 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/C++ TBAA"}
!9 = !{!10, !11, i64 96}
!10 = !{!"_Image", !6, i64 0, !11, i64 8, !12, i64 16, !13, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !11, i64 96, !11, i64 100}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass