; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/MINC/src/libminc/nifti (nifti1_io)

; 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.nifti_global_options = type { i32, i32, i32 }
%struct.nifti_image = type { i32, i32, i32, i32, i32, i32, i32, i32, [8 x i32], i64, i32, i32, float, float, float, float, float, float, float, [8 x float], float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, %struct.mat44, %struct.mat44, %struct.mat44, %struct.mat44, float, i32, i32, i32, i32, float, float, float, [16 x i8], [80 x i8], [24 x i8], ptr, ptr, i32, i32, i32, ptr, i32, ptr, i32 }
%struct.mat44 = type { [4 x [4 x float]] }

@stderr = external global ptr, align 8
@g_opts = external hidden global %struct.nifti_global_options, align 4
@.str.389 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.390 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.391 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.392 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.393 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.394 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.395 = external hidden unnamed_addr constant [45 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @nifti_image_load_prep(ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

declare i32 @Xznzclose(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_nim_is_valid(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @nifti_read_collapsed_image(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [8 x i32], align 16
  %10 = alloca [8 x i32], align 16
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %23

17:                                               ; preds = %3
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %23

20:                                               ; preds = %17
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %29, label %23

23:                                               ; preds = %20, %17, %3
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.389, ptr noundef %25, ptr noundef %26, ptr noundef %27) #4
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

29:                                               ; preds = %20
  %30 = load i32, ptr @g_opts, align 4, !tbaa !9
  %31 = icmp sgt i32 %30, 2
  br i1 %31, label %32, label %70

32:                                               ; preds = %29
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.390) #4
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %35

35:                                               ; preds = %46, %32
  %36 = load i32, ptr %12, align 4, !tbaa !12
  %37 = icmp slt i32 %36, 8
  br i1 %37, label %38, label %49

38:                                               ; preds = %35
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load i32, ptr %12, align 4, !tbaa !12
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr %40, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !12
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.391, i32 noundef %44) #4
  br label %46

46:                                               ; preds = %38
  %47 = load i32, ptr %12, align 4, !tbaa !12
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %12, align 4, !tbaa !12
  br label %35, !llvm.loop !13

49:                                               ; preds = %35
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.392) #4
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %52

52:                                               ; preds = %64, %49
  %53 = load i32, ptr %12, align 4, !tbaa !12
  %54 = icmp slt i32 %53, 8
  br i1 %54, label %55, label %67

55:                                               ; preds = %52
  %56 = load ptr, ptr @stderr, align 8, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.nifti_image, ptr %57, i32 0, i32 8
  %59 = load i32, ptr %12, align 4, !tbaa !12
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [8 x i32], ptr %58, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !12
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef @.str.391, i32 noundef %62) #4
  br label %64

64:                                               ; preds = %55
  %65 = load i32, ptr %12, align 4, !tbaa !12
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %12, align 4, !tbaa !12
  br label %52, !llvm.loop !15

67:                                               ; preds = %52
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = call i32 @fputc(i32 noundef 10, ptr noundef %68)
  br label %70

70:                                               ; preds = %67, %29
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = load i32, ptr @g_opts, align 4, !tbaa !9
  %73 = icmp sgt i32 %72, 0
  %74 = zext i1 %73 to i32
  %75 = call i32 @nifti_nim_is_valid(ptr noundef %71, i32 noundef %74)
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %83, label %77

77:                                               ; preds = %70
  %78 = load ptr, ptr @stderr, align 8, !tbaa !5
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.nifti_image, ptr %79, i32 0, i32 55
  %81 = load ptr, ptr %80, align 8, !tbaa !16
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef @.str.393, ptr noundef %81) #4
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

83:                                               ; preds = %70
  store i32 1, ptr %12, align 4, !tbaa !12
  br label %84

84:                                               ; preds = %121, %83
  %85 = load i32, ptr %12, align 4, !tbaa !12
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.nifti_image, ptr %86, i32 0, i32 8
  %88 = getelementptr inbounds [8 x i32], ptr %87, i64 0, i64 0
  %89 = load i32, ptr %88, align 8, !tbaa !12
  %90 = icmp sle i32 %85, %89
  br i1 %90, label %91, label %124

91:                                               ; preds = %84
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load i32, ptr %12, align 4, !tbaa !12
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i32, ptr %92, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !12
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.nifti_image, ptr %97, i32 0, i32 8
  %99 = load i32, ptr %12, align 4, !tbaa !12
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [8 x i32], ptr %98, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !12
  %103 = icmp sge i32 %96, %102
  br i1 %103, label %104, label %120

104:                                              ; preds = %91
  %105 = load ptr, ptr @stderr, align 8, !tbaa !5
  %106 = load i32, ptr %12, align 4, !tbaa !12
  %107 = load i32, ptr %12, align 4, !tbaa !12
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = load i32, ptr %12, align 4, !tbaa !12
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i32, ptr %108, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !12
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.nifti_image, ptr %113, i32 0, i32 8
  %115 = load i32, ptr %12, align 4, !tbaa !12
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [8 x i32], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !12
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef @.str.394, i32 noundef %106, i32 noundef %107, i32 noundef %112, i32 noundef %118) #4
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

120:                                              ; preds = %91
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %12, align 4, !tbaa !12
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %12, align 4, !tbaa !12
  br label %84, !llvm.loop !21

124:                                              ; preds = %84
  %125 = load ptr, ptr %5, align 8, !tbaa !5
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds [8 x i32], ptr %9, i64 0, i64 0
  %128 = getelementptr inbounds [8 x i32], ptr %10, i64 0, i64 0
  %129 = call i32 @make_pivot_list(ptr noundef %125, ptr noundef %126, ptr noundef %127, ptr noundef %128, ptr noundef %11)
  %130 = icmp slt i32 %129, 0
  br i1 %130, label %131, label %132

131:                                              ; preds = %124
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

132:                                              ; preds = %124
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds [8 x i32], ptr %10, i64 0, i64 0
  %135 = load i32, ptr %11, align 4, !tbaa !12
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.nifti_image, ptr %136, i32 0, i32 10
  %138 = load i32, ptr %137, align 8, !tbaa !22
  %139 = call i32 @rci_alloc_mem(ptr noundef %133, ptr noundef %134, i32 noundef %135, i32 noundef %138)
  store i32 %139, ptr %13, align 4, !tbaa !12
  %140 = load i32, ptr %13, align 4, !tbaa !12
  %141 = icmp slt i32 %140, 0
  br i1 %141, label %142, label %143

142:                                              ; preds = %132
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

143:                                              ; preds = %132
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = call ptr @nifti_image_load_prep(ptr noundef %144)
  store ptr %145, ptr %8, align 8, !tbaa !5
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = icmp ne ptr %146, null
  br i1 %147, label %152, label %148

148:                                              ; preds = %143
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = load ptr, ptr %149, align 8, !tbaa !5
  call void @free(ptr noundef %150) #4
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %151, align 8, !tbaa !5
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

152:                                              ; preds = %143
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = getelementptr inbounds [8 x i32], ptr %9, i64 0, i64 0
  %155 = getelementptr inbounds [8 x i32], ptr %10, i64 0, i64 0
  %156 = load i32, ptr %11, align 4, !tbaa !12
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = load ptr, ptr %7, align 8, !tbaa !5
  %159 = load ptr, ptr %158, align 8, !tbaa !5
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  %162 = call i64 @znztell(ptr noundef %161)
  %163 = call i32 @rci_read_data(ptr noundef %153, ptr noundef %154, ptr noundef %155, i32 noundef %156, ptr noundef %157, ptr noundef %159, ptr noundef %160, i64 noundef %162)
  store i32 %163, ptr %12, align 4, !tbaa !12
  %164 = call i32 @Xznzclose(ptr noundef %8)
  %165 = load i32, ptr %12, align 4, !tbaa !12
  %166 = icmp slt i32 %165, 0
  br i1 %166, label %167, label %171

167:                                              ; preds = %152
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = load ptr, ptr %168, align 8, !tbaa !5
  call void @free(ptr noundef %169) #4
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %170, align 8, !tbaa !5
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

171:                                              ; preds = %152
  %172 = load i32, ptr @g_opts, align 4, !tbaa !9
  %173 = icmp sgt i32 %172, 1
  br i1 %173, label %174, label %181

174:                                              ; preds = %171
  %175 = load ptr, ptr @stderr, align 8, !tbaa !5
  %176 = load i32, ptr %13, align 4, !tbaa !12
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.nifti_image, ptr %177, i32 0, i32 55
  %179 = load ptr, ptr %178, align 8, !tbaa !16
  %180 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %175, ptr noundef @.str.395, i32 noundef %176, ptr noundef %179) #4
  br label %181

181:                                              ; preds = %174, %171
  %182 = load i32, ptr %13, align 4, !tbaa !12
  store i32 %182, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %183

183:                                              ; preds = %181, %167, %148, %142, %131, %104, %77, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %184 = load i32, ptr %4, align 4
  ret i32 %184
}

; Function Attrs: nounwind uwtable
declare hidden i32 @make_pivot_list(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @rci_alloc_mem(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @rci_read_data(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

declare i64 @znztell(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 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 #4 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !6, i64 632}
!17 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !7, i64 32, !18, i64 64, !11, i64 72, !11, i64 76, !19, i64 80, !19, i64 84, !19, i64 88, !19, i64 92, !19, i64 96, !19, i64 100, !19, i64 104, !7, i64 108, !19, i64 140, !19, i64 144, !19, i64 148, !19, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !19, i64 188, !19, i64 192, !19, i64 196, !19, i64 200, !19, i64 204, !19, i64 208, !19, i64 212, !19, i64 216, !20, i64 220, !20, i64 284, !20, i64 348, !20, i64 412, !19, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !19, i64 496, !19, i64 500, !19, i64 504, !7, i64 508, !7, i64 524, !7, i64 604, !6, i64 632, !6, i64 640, !11, i64 648, !11, i64 652, !11, i64 656, !6, i64 664, !11, i64 672, !6, i64 680, !11, i64 688}
!18 = !{!"long", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"", !7, i64 0}
!21 = distinct !{!21, !14}
!22 = !{!17, !11, i64 72}


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

@stderr = external local_unnamed_addr global ptr, align 8
@g_opts = external hidden local_unnamed_addr global %struct.nifti_global_options, align 4
@.str.389 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.390 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.391 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.392 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.393 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.394 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.395 = external hidden unnamed_addr constant [45 x i8], align 1

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fputc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden ptr @nifti_image_load_prep(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

declare i32 @Xznzclose(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_nim_is_valid(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, -2147483648) i32 @nifti_read_collapsed_image(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = alloca [8 x i32], align 16
  %6 = alloca [8 x i32], align 16
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %8 = icmp ne ptr %0, null
  %9 = icmp ne ptr %1, null
  %or.cond = and i1 %8, %9
  %10 = icmp ne ptr %2, null
  %or.cond3 = and i1 %or.cond, %10
  br i1 %or.cond3, label %14, label %11

11:                                               ; preds = %3
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.389, ptr noundef %0, ptr noundef %1, ptr noundef %2) #6
  br label %138

14:                                               ; preds = %3
  %15 = load i32, ptr @g_opts, align 4, !tbaa !9
  %16 = icmp sgt i32 %15, 2
  br i1 %16, label %17, label %87

17:                                               ; preds = %14
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.390) #6
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = load i32, ptr %1, align 4, !tbaa !12
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.391, i32 noundef %21) #6
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 4
  %25 = load i32, ptr %24, align 4, !tbaa !12
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.391, i32 noundef %25) #6
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %1, i64 8
  %29 = load i32, ptr %28, align 4, !tbaa !12
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.391, i32 noundef %29) #6
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %1, i64 12
  %33 = load i32, ptr %32, align 4, !tbaa !12
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.391, i32 noundef %33) #6
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %1, i64 16
  %37 = load i32, ptr %36, align 4, !tbaa !12
  %38 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.391, i32 noundef %37) #6
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %1, i64 20
  %41 = load i32, ptr %40, align 4, !tbaa !12
  %42 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.391, i32 noundef %41) #6
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %1, i64 24
  %45 = load i32, ptr %44, align 4, !tbaa !12
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str.391, i32 noundef %45) #6
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %1, i64 28
  %49 = load i32, ptr %48, align 4, !tbaa !12
  %50 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.391, i32 noundef %49) #6
  %51 = load ptr, ptr @stderr, align 8, !tbaa !5
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef nonnull @.str.392) #6
  %53 = getelementptr inbounds i8, ptr %0, i64 32
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = load i32, ptr %53, align 4, !tbaa !12
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.391, i32 noundef %55) #6
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %0, i64 36
  %59 = load i32, ptr %58, align 4, !tbaa !12
  %60 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.391, i32 noundef %59) #6
  %61 = load ptr, ptr @stderr, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %0, i64 40
  %63 = load i32, ptr %62, align 4, !tbaa !12
  %64 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.391, i32 noundef %63) #6
  %65 = load ptr, ptr @stderr, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %0, i64 44
  %67 = load i32, ptr %66, align 4, !tbaa !12
  %68 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef nonnull @.str.391, i32 noundef %67) #6
  %69 = load ptr, ptr @stderr, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %0, i64 48
  %71 = load i32, ptr %70, align 4, !tbaa !12
  %72 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef nonnull @.str.391, i32 noundef %71) #6
  %73 = load ptr, ptr @stderr, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %0, i64 52
  %75 = load i32, ptr %74, align 4, !tbaa !12
  %76 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef nonnull @.str.391, i32 noundef %75) #6
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %0, i64 56
  %79 = load i32, ptr %78, align 4, !tbaa !12
  %80 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.391, i32 noundef %79) #6
  %81 = load ptr, ptr @stderr, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %0, i64 60
  %83 = load i32, ptr %82, align 4, !tbaa !12
  %84 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.391, i32 noundef %83) #6
  %85 = load ptr, ptr @stderr, align 8, !tbaa !5
  %86 = tail call i32 @fputc(i32 noundef 10, ptr noundef %85)
  %.pre = load i32, ptr @g_opts, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %17, %14
  %88 = phi i32 [ %.pre, %17 ], [ %15, %14 ]
  %89 = icmp sgt i32 %88, 0
  %90 = zext i1 %89 to i32
  %91 = tail call i32 @nifti_nim_is_valid(ptr noundef nonnull %0, i32 noundef %90)
  %.not = icmp eq i32 %91, 0
  br i1 %.not, label %95, label %.preheader

.preheader:                                       ; preds = %87
  %92 = getelementptr inbounds i8, ptr %0, i64 32
  %93 = load i32, ptr %92, align 8, !tbaa !12
  %.not5764 = icmp slt i32 %93, 1
  br i1 %.not5764, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %94 = add nuw i32 %93, 1
  %wide.trip.count = zext i32 %94 to i64
  br label %.lr.ph

95:                                               ; preds = %87
  %96 = load ptr, ptr @stderr, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %0, i64 632
  %98 = load ptr, ptr %97, align 8, !tbaa !13
  %99 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef nonnull @.str.393, ptr noundef %98) #6
  br label %138

.lr.ph:                                           ; preds = %.lr.ph.preheader, %108
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %108 ]
  %100 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
  %101 = load i32, ptr %100, align 4, !tbaa !12
  %102 = getelementptr inbounds [8 x i32], ptr %92, i64 0, i64 %indvars.iv
  %103 = load i32, ptr %102, align 4, !tbaa !12
  %.not59 = icmp slt i32 %101, %103
  br i1 %.not59, label %108, label %104

104:                                              ; preds = %.lr.ph
  %105 = trunc nuw nsw i64 %indvars.iv to i32
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef nonnull @.str.394, i32 noundef %105, i32 noundef %105, i32 noundef %101, i32 noundef %103) #6
  br label %138

108:                                              ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !18

._crit_edge:                                      ; preds = %108, %.preheader
  %109 = call i32 @make_pivot_list(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %110 = icmp slt i32 %109, 0
  br i1 %110, label %138, label %111

111:                                              ; preds = %._crit_edge
  %112 = load i32, ptr %7, align 4, !tbaa !12
  %113 = getelementptr inbounds i8, ptr %0, i64 72
  %114 = load i32, ptr %113, align 8, !tbaa !20
  %115 = call i32 @rci_alloc_mem(ptr noundef nonnull %2, ptr noundef nonnull %6, i32 noundef %112, i32 noundef %114)
  %116 = icmp slt i32 %115, 0
  br i1 %116, label %138, label %117

117:                                              ; preds = %111
  %118 = call ptr @nifti_image_load_prep(ptr noundef nonnull %0)
  store ptr %118, ptr %4, align 8, !tbaa !5
  %.not58 = icmp eq ptr %118, null
  br i1 %.not58, label %119, label %121

119:                                              ; preds = %117
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %120) #5
  store ptr null, ptr %2, align 8, !tbaa !5
  br label %138

121:                                              ; preds = %117
  %122 = load i32, ptr %7, align 4, !tbaa !12
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = call i64 @znztell(ptr noundef nonnull %118) #5
  %125 = call i32 @rci_read_data(ptr noundef nonnull %0, ptr noundef nonnull %5, ptr noundef nonnull %6, i32 noundef %122, ptr noundef nonnull %1, ptr noundef %123, ptr noundef nonnull %118, i64 noundef %124)
  %126 = call i32 @Xznzclose(ptr noundef nonnull %4) #5
  %127 = icmp slt i32 %125, 0
  br i1 %127, label %128, label %130

128:                                              ; preds = %121
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %129) #5
  store ptr null, ptr %2, align 8, !tbaa !5
  br label %138

130:                                              ; preds = %121
  %131 = load i32, ptr @g_opts, align 4, !tbaa !9
  %132 = icmp sgt i32 %131, 1
  br i1 %132, label %133, label %138

133:                                              ; preds = %130
  %134 = load ptr, ptr @stderr, align 8, !tbaa !5
  %135 = getelementptr inbounds i8, ptr %0, i64 632
  %136 = load ptr, ptr %135, align 8, !tbaa !13
  %137 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef nonnull @.str.395, i32 noundef %115, ptr noundef %136) #6
  br label %138

138:                                              ; preds = %130, %133, %111, %._crit_edge, %128, %119, %104, %95, %11
  %.0 = phi i32 [ -1, %104 ], [ -1, %128 ], [ -1, %119 ], [ -1, %95 ], [ -1, %11 ], [ -1, %._crit_edge ], [ -1, %111 ], [ %115, %133 ], [ %115, %130 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden i32 @make_pivot_list(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @rci_alloc_mem(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @rci_read_data(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i64 @znztell(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!14, !6, i64 632}
!14 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !7, i64 32, !15, i64 64, !11, i64 72, !11, i64 76, !16, i64 80, !16, i64 84, !16, i64 88, !16, i64 92, !16, i64 96, !16, i64 100, !16, i64 104, !7, i64 108, !16, i64 140, !16, i64 144, !16, i64 148, !16, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !16, i64 188, !16, i64 192, !16, i64 196, !16, i64 200, !16, i64 204, !16, i64 208, !16, i64 212, !16, i64 216, !17, i64 220, !17, i64 284, !17, i64 348, !17, i64 412, !16, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !16, i64 496, !16, i64 500, !16, i64 504, !7, i64 508, !7, i64 524, !7, i64 604, !6, i64 632, !6, i64 640, !11, i64 648, !11, i64 652, !11, i64 656, !6, i64 664, !11, i64 672, !6, i64 680, !11, i64 688}
!15 = !{!"long", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!14, !11, i64 72}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass