; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/NIFTI/src/nifti/niftilib (nifti1_tool)

; 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.nt_opts = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [8 x i32], [8 x i32], i32, i32, i32, i32, ptr, %struct.str_list, %struct.int_list, %struct.str_list, %struct.str_list, %struct.str_list, [2048 x i8] }
%struct.int_list = type { i32, ptr }
%struct.str_list = type { i32, ptr }
%struct.nifti_brick_list = type { i32, i64, ptr }
%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_debug = external hidden global i32, align 4
@.str.69 = external hidden unnamed_addr constant [8 x i8], align 1
@stdout = external global ptr, align 8
@.str.493 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.494 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.498 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.499 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.500 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.501 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.502 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.503 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.504 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.505 = external hidden unnamed_addr constant [46 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 willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #1

declare i32 @printf(ptr noundef, ...) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @disp_raw_data(ptr noundef, i32 noundef, i32 noundef, i8 noundef signext, i32 noundef) #4

declare void @nifti_image_free(ptr noundef) #2

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

declare i32 @fflush(ptr noundef) #2

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

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

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

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

29:                                               ; preds = %20
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = call i32 @strncmp(ptr noundef %30, ptr noundef @.str.69, i64 noundef 7) #7
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %46

33:                                               ; preds = %29
  %34 = load i32, ptr @g_debug, align 4, !tbaa !9
  %35 = icmp sgt i32 %34, 1
  br i1 %35, label %36, label %40

36:                                               ; preds = %33
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef @.str.499, ptr noundef %38) #6
  br label %40

40:                                               ; preds = %36, %33
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = call ptr @nifti_image_read_bricks(ptr noundef %41, i32 noundef %42, ptr noundef %43, ptr noundef %44)
  store ptr %45, ptr %6, align 8
  store i32 1, ptr %14, align 4
  br label %189

46:                                               ; preds = %29
  %47 = load i32, ptr @g_debug, align 4, !tbaa !9
  %48 = icmp sgt i32 %47, 1
  br i1 %48, label %49, label %80

49:                                               ; preds = %46
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.500, ptr noundef %51) #6
  %53 = load i32, ptr @g_debug, align 4, !tbaa !9
  %54 = icmp sgt i32 %53, 2
  br i1 %54, label %55, label %79

55:                                               ; preds = %49
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.493)
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.nt_opts, ptr %57, i32 0, i32 23
  %59 = getelementptr inbounds [8 x i32], ptr %58, i64 0, i64 0
  %60 = call i32 @disp_raw_data(ptr noundef %59, i32 noundef 8, i32 noundef 8, i8 noundef signext 32, i32 noundef 1)
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.nt_opts, ptr %61, i32 0, i32 24
  %63 = load i32, ptr %62, align 8, !tbaa !11
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.494, i32 noundef %63)
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %76

67:                                               ; preds = %55
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %70, label %76

70:                                               ; preds = %67
  %71 = load i32, ptr %9, align 4, !tbaa !9
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.501, i32 noundef %71)
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = call i32 @disp_raw_data(ptr noundef %73, i32 noundef 8, i32 noundef %74, i8 noundef signext 32, i32 noundef 1)
  br label %76

76:                                               ; preds = %70, %67, %55
  %77 = load ptr, ptr @stdout, align 8, !tbaa !5
  %78 = call i32 @fflush(ptr noundef %77)
  br label %79

79:                                               ; preds = %76, %49
  br label %80

80:                                               ; preds = %79, %46
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.nt_opts, ptr %81, i32 0, i32 23
  %83 = getelementptr inbounds [8 x i32], ptr %82, i64 0, i64 0
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.nt_opts, ptr %84, i32 0, i32 24
  %86 = load i32, ptr %85, align 8, !tbaa !11
  %87 = call ptr @nifti_make_new_nim(ptr noundef %83, i32 noundef %86, i32 noundef 0)
  store ptr %87, ptr %12, align 8, !tbaa !5
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %93, label %90

90:                                               ; preds = %80
  %91 = load ptr, ptr @stderr, align 8, !tbaa !5
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str.502) #6
  store ptr null, ptr %6, align 8
  store i32 1, ptr %14, align 4
  br label %189

93:                                               ; preds = %80
  %94 = load i32, ptr %9, align 4, !tbaa !9
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.nifti_brick_list, ptr %95, i32 0, i32 0
  store i32 %94, ptr %96, align 8, !tbaa !14
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.nifti_image, ptr %97, i32 0, i32 10
  %99 = load i32, ptr %98, align 8, !tbaa !17
  %100 = sext i32 %99 to i64
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.nifti_image, ptr %101, i32 0, i32 1
  %103 = load i32, ptr %102, align 4, !tbaa !21
  %104 = sext i32 %103 to i64
  %105 = mul i64 %100, %104
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.nifti_image, ptr %106, i32 0, i32 2
  %108 = load i32, ptr %107, align 8, !tbaa !22
  %109 = sext i32 %108 to i64
  %110 = mul i64 %105, %109
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.nifti_image, ptr %111, i32 0, i32 3
  %113 = load i32, ptr %112, align 4, !tbaa !23
  %114 = sext i32 %113 to i64
  %115 = mul i64 %110, %114
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.nifti_brick_list, ptr %116, i32 0, i32 1
  store i64 %115, ptr %117, align 8, !tbaa !24
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.nifti_brick_list, ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 8, !tbaa !14
  %121 = sext i32 %120 to i64
  %122 = call noalias ptr @calloc(i64 noundef %121, i64 noundef 8) #8
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.nifti_brick_list, ptr %123, i32 0, i32 2
  store ptr %122, ptr %124, align 8, !tbaa !25
  %125 = load ptr, ptr %11, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.nifti_brick_list, ptr %125, i32 0, i32 2
  %127 = load ptr, ptr %126, align 8, !tbaa !25
  %128 = icmp ne ptr %127, null
  br i1 %128, label %136, label %129

129:                                              ; preds = %93
  %130 = load ptr, ptr @stderr, align 8, !tbaa !5
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.nifti_brick_list, ptr %131, i32 0, i32 0
  %133 = load i32, ptr %132, align 8, !tbaa !14
  %134 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef @.str.503, i32 noundef %133) #6
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %135)
  store ptr null, ptr %6, align 8
  store i32 1, ptr %14, align 4
  br label %189

136:                                              ; preds = %93
  %137 = load i32, ptr @g_debug, align 4, !tbaa !9
  %138 = icmp sgt i32 %137, 1
  br i1 %138, label %139, label %149

139:                                              ; preds = %136
  %140 = load ptr, ptr @stderr, align 8, !tbaa !5
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.nifti_brick_list, ptr %141, i32 0, i32 0
  %143 = load i32, ptr %142, align 8, !tbaa !14
  %144 = load ptr, ptr %11, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.nifti_brick_list, ptr %144, i32 0, i32 1
  %146 = load i64, ptr %145, align 8, !tbaa !24
  %147 = trunc i64 %146 to i32
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %140, ptr noundef @.str.504, i32 noundef %143, i32 noundef %147) #6
  br label %149

149:                                              ; preds = %139, %136
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %150

150:                                              ; preds = %184, %149
  %151 = load i32, ptr %13, align 4, !tbaa !9
  %152 = load i32, ptr %9, align 4, !tbaa !9
  %153 = icmp slt i32 %151, %152
  br i1 %153, label %154, label %187

154:                                              ; preds = %150
  %155 = load ptr, ptr %11, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.nifti_brick_list, ptr %155, i32 0, i32 1
  %157 = load i64, ptr %156, align 8, !tbaa !24
  %158 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %157) #8
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.nifti_brick_list, ptr %159, i32 0, i32 2
  %161 = load ptr, ptr %160, align 8, !tbaa !25
  %162 = load i32, ptr %13, align 4, !tbaa !9
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds ptr, ptr %161, i64 %163
  store ptr %158, ptr %164, align 8, !tbaa !5
  %165 = load ptr, ptr %11, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.nifti_brick_list, ptr %165, i32 0, i32 2
  %167 = load ptr, ptr %166, align 8, !tbaa !25
  %168 = load i32, ptr %13, align 4, !tbaa !9
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds ptr, ptr %167, i64 %169
  %171 = load ptr, ptr %170, align 8, !tbaa !5
  %172 = icmp ne ptr %171, null
  br i1 %172, label %183, label %173

173:                                              ; preds = %154
  %174 = load ptr, ptr @stderr, align 8, !tbaa !5
  %175 = load i32, ptr %13, align 4, !tbaa !9
  %176 = load ptr, ptr %11, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.nifti_brick_list, ptr %176, i32 0, i32 1
  %178 = load i64, ptr %177, align 8, !tbaa !24
  %179 = trunc i64 %178 to i32
  %180 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef @.str.505, i32 noundef %175, i32 noundef %179) #6
  %181 = load ptr, ptr %11, align 8, !tbaa !5
  call void @nifti_free_NBL(ptr noundef %181)
  %182 = load ptr, ptr %12, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %182)
  store ptr null, ptr %6, align 8
  store i32 1, ptr %14, align 4
  br label %189

183:                                              ; preds = %154
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %13, align 4, !tbaa !9
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %13, align 4, !tbaa !9
  br label %150, !llvm.loop !26

187:                                              ; preds = %150
  %188 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %188, ptr %6, align 8
  store i32 1, ptr %14, align 4
  br label %189

189:                                              ; preds = %187, %173, %129, %90, %40, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %190 = load ptr, ptr %6, align 8
  ret ptr %190
}

declare void @nifti_free_NBL(ptr noundef) #2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 152}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !7, i64 88, !7, i64 120, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !6, i64 168, !13, i64 176, !13, i64 192, !13, i64 208, !13, i64 224, !13, i64 240, !7, i64 256}
!13 = !{!"", !10, i64 0, !6, i64 8}
!14 = !{!15, !10, i64 0}
!15 = !{!"", !10, i64 0, !16, i64 8, !6, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !10, i64 72}
!18 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !16, i64 64, !10, i64 72, !10, 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, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, 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, !10, i64 480, !10, i64 484, !10, i64 488, !10, 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, !10, i64 648, !10, i64 652, !10, i64 656, !6, i64 664, !10, i64 672, !6, i64 680, !10, i64 688}
!19 = !{!"float", !7, i64 0}
!20 = !{!"", !7, i64 0}
!21 = !{!18, !10, i64 4}
!22 = !{!18, !10, i64 8}
!23 = !{!18, !10, i64 12}
!24 = !{!15, !16, i64 8}
!25 = !{!15, !6, i64 16}
!26 = distinct !{!26, !27}
!27 = !{!"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"

@stderr = external local_unnamed_addr global ptr, align 8
@g_debug = external hidden local_unnamed_addr global i32, align 4
@.str.69 = external hidden unnamed_addr constant [8 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.493 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.494 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.498 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.499 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.500 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.501 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.502 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.503 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.504 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.505 = external hidden unnamed_addr constant [46 x i8], align 1

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

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

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

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

declare void @nifti_image_free(ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @nt_read_bricks(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = icmp ne ptr %0, null
  %7 = icmp ne ptr %1, null
  %or.cond = and i1 %6, %7
  %8 = icmp ne ptr %4, null
  %or.cond3 = and i1 %or.cond, %8
  br i1 %or.cond3, label %12, label %9

9:                                                ; preds = %5
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.498, ptr noundef %0, ptr noundef %1, ptr noundef %4) #5
  br label %.loopexit

12:                                               ; preds = %5
  %13 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.69, i64 noundef 7) #6
  %.not = icmp eq i32 %13, 0
  %14 = load i32, ptr @g_debug, align 4, !tbaa !9
  %15 = icmp sgt i32 %14, 1
  br i1 %.not, label %22, label %16

16:                                               ; preds = %12
  br i1 %15, label %17, label %20

17:                                               ; preds = %16
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.499, ptr noundef nonnull %1) #5
  br label %20

20:                                               ; preds = %17, %16
  %21 = tail call ptr @nifti_image_read_bricks(ptr noundef nonnull %1, i32 noundef %2, ptr noundef %3, ptr noundef nonnull %4) #7
  br label %.loopexit

22:                                               ; preds = %12
  br i1 %15, label %23, label %43

23:                                               ; preds = %22
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.500, ptr noundef nonnull %1) #5
  %26 = load i32, ptr @g_debug, align 4, !tbaa !9
  %27 = icmp sgt i32 %26, 2
  br i1 %27, label %28, label %43

28:                                               ; preds = %23
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.493)
  %30 = getelementptr inbounds i8, ptr %0, i64 120
  %31 = tail call i32 @disp_raw_data(ptr noundef nonnull %30, i32 noundef 8, i32 noundef 8, i8 noundef signext 32, i32 noundef 1)
  %32 = getelementptr inbounds i8, ptr %0, i64 152
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.494, i32 noundef %33)
  %35 = icmp ne ptr %3, null
  %36 = icmp sgt i32 %2, 0
  %or.cond5 = and i1 %36, %35
  br i1 %or.cond5, label %37, label %40

37:                                               ; preds = %28
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.501, i32 noundef %2)
  %39 = tail call i32 @disp_raw_data(ptr noundef nonnull %3, i32 noundef 8, i32 noundef %2, i8 noundef signext 32, i32 noundef 1)
  br label %40

40:                                               ; preds = %37, %28
  %41 = load ptr, ptr @stdout, align 8, !tbaa !5
  %42 = tail call i32 @fflush(ptr noundef %41)
  br label %43

43:                                               ; preds = %23, %40, %22
  %44 = getelementptr inbounds i8, ptr %0, i64 120
  %45 = getelementptr inbounds i8, ptr %0, i64 152
  %46 = load i32, ptr %45, align 8, !tbaa !11
  %47 = tail call ptr @nifti_make_new_nim(ptr noundef nonnull %44, i32 noundef %46, i32 noundef 0) #7
  %.not62 = icmp eq ptr %47, null
  br i1 %.not62, label %48, label %51

48:                                               ; preds = %43
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.502) #5
  br label %.loopexit

51:                                               ; preds = %43
  store i32 %2, ptr %4, align 8, !tbaa !14
  %52 = getelementptr inbounds i8, ptr %47, i64 72
  %53 = load i32, ptr %52, align 8, !tbaa !17
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %47, i64 4
  %56 = load i32, ptr %55, align 4, !tbaa !21
  %57 = sext i32 %56 to i64
  %58 = mul nsw i64 %57, %54
  %59 = getelementptr inbounds i8, ptr %47, i64 8
  %60 = load i32, ptr %59, align 8, !tbaa !22
  %61 = sext i32 %60 to i64
  %62 = mul i64 %58, %61
  %63 = getelementptr inbounds i8, ptr %47, i64 12
  %64 = load i32, ptr %63, align 4, !tbaa !23
  %65 = sext i32 %64 to i64
  %66 = mul i64 %62, %65
  %67 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %66, ptr %67, align 8, !tbaa !24
  %68 = sext i32 %2 to i64
  %69 = tail call noalias ptr @calloc(i64 noundef %68, i64 noundef 8) #8
  %70 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %69, ptr %70, align 8, !tbaa !25
  %.not63 = icmp eq ptr %69, null
  br i1 %.not63, label %71, label %74

71:                                               ; preds = %51
  %72 = load ptr, ptr @stderr, align 8, !tbaa !5
  %73 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef nonnull @.str.503, i32 noundef %2) #5
  tail call void @nifti_image_free(ptr noundef nonnull %47) #7
  br label %.loopexit

74:                                               ; preds = %51
  %75 = load i32, ptr @g_debug, align 4, !tbaa !9
  %76 = icmp sgt i32 %75, 1
  br i1 %76, label %77, label %81

77:                                               ; preds = %74
  %78 = load ptr, ptr @stderr, align 8, !tbaa !5
  %79 = trunc i64 %66 to i32
  %80 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef nonnull @.str.504, i32 noundef %2, i32 noundef %79) #5
  br label %81

81:                                               ; preds = %77, %74
  %82 = icmp sgt i32 %2, 0
  br i1 %82, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %81
  %83 = load i64, ptr %67, align 8, !tbaa !24
  %wide.trip.count = zext nneg i32 %2 to i64
  %.pre = load ptr, ptr %70, align 8, !tbaa !25
  br label %84

84:                                               ; preds = %.lr.ph, %96
  %85 = phi ptr [ %.pre, %.lr.ph ], [ %88, %96 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %96 ]
  %86 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %83) #8
  %87 = getelementptr inbounds ptr, ptr %85, i64 %indvars.iv
  store ptr %86, ptr %87, align 8, !tbaa !5
  %88 = load ptr, ptr %70, align 8, !tbaa !25
  %89 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  %.not64 = icmp eq ptr %90, null
  br i1 %.not64, label %91, label %96

91:                                               ; preds = %84
  %92 = trunc nuw nsw i64 %indvars.iv to i32
  %93 = load ptr, ptr @stderr, align 8, !tbaa !5
  %94 = trunc i64 %83 to i32
  %95 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.505, i32 noundef %92, i32 noundef %94) #5
  tail call void @nifti_free_NBL(ptr noundef nonnull %4) #7
  tail call void @nifti_image_free(ptr noundef nonnull %47) #7
  br label %.loopexit

96:                                               ; preds = %84
  %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 %.loopexit, label %84, !llvm.loop !26

.loopexit:                                        ; preds = %96, %81, %91, %71, %48, %20, %9
  %.055 = phi ptr [ %21, %20 ], [ null, %91 ], [ null, %71 ], [ null, %48 ], [ null, %9 ], [ %47, %81 ], [ %47, %96 ]
  ret ptr %.055
}

declare void @nifti_free_NBL(ptr noundef) local_unnamed_addr #3

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

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

attributes #0 = { 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 #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 = { "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 allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { cold nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 152}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !7, i64 88, !7, i64 120, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !6, i64 168, !13, i64 176, !13, i64 192, !13, i64 208, !13, i64 224, !13, i64 240, !7, i64 256}
!13 = !{!"", !10, i64 0, !6, i64 8}
!14 = !{!15, !10, i64 0}
!15 = !{!"", !10, i64 0, !16, i64 8, !6, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !10, i64 72}
!18 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !16, i64 64, !10, i64 72, !10, 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, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, 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, !10, i64 480, !10, i64 484, !10, i64 488, !10, 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, !10, i64 648, !10, i64 652, !10, i64 656, !6, i64 664, !10, i64 672, !6, i64 680, !10, i64 688}
!19 = !{!"float", !7, i64 0}
!20 = !{!"", !7, i64 0}
!21 = !{!18, !10, i64 4}
!22 = !{!18, !10, i64 8}
!23 = !{!18, !10, i64 12}
!24 = !{!15, !16, i64 8}
!25 = !{!15, !6, i64 16}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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