; 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.115 = external hidden unnamed_addr constant [24 x i8], align 1
@__const.nifti_read_ascii_image.lfunc = external hidden unnamed_addr constant [25 x i8], align 16
@.str.192 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.193 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.194 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.195 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.196 = external hidden unnamed_addr constant [47 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

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

declare i32 @Xznzclose(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare dso_local i64 @nifti_get_volsize(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_is_gzfile(ptr noundef) #4

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

declare i64 @znzread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @nifti_read_ascii_image(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca [25 x i8], align 16
  %17 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 25, ptr %16) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 @__const.nifti_read_ascii_image.lfunc, i64 25, i1 false)
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = call i32 @nifti_is_gzfile(ptr noundef %18)
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %28

21:                                               ; preds = %4
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = getelementptr inbounds [25 x i8], ptr %16, i64 0, i64 0
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str.115, ptr noundef %23, ptr noundef @.str.192, ptr noundef %24) #6
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %26) #6
  %27 = call i32 @Xznzclose(ptr noundef %6)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %134

28:                                               ; preds = %4
  %29 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %29, ptr %11, align 4, !tbaa !9
  %30 = load i32, ptr @g_opts, align 4, !tbaa !11
  %31 = icmp sgt i32 %30, 1
  br i1 %31, label %32, label %37

32:                                               ; preds = %28
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.193, ptr noundef %34, i32 noundef %35) #6
  br label %37

37:                                               ; preds = %32, %28
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = icmp sgt i32 %38, 65530
  br i1 %39, label %40, label %41

40:                                               ; preds = %37
  store i32 65530, ptr %11, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %40, %37
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  %44 = sext i32 %43 to i64
  %45 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %44) #7
  store ptr %45, ptr %15, align 8, !tbaa !5
  %46 = load ptr, ptr %15, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %54, label %48

48:                                               ; preds = %41
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = getelementptr inbounds [25 x i8], ptr %16, i64 0, i64 0
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.194, ptr noundef %50, i32 noundef 65530) #6
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %52) #6
  %53 = call i32 @Xznzclose(ptr noundef %6)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %134

54:                                               ; preds = %41
  %55 = load ptr, ptr %15, align 8, !tbaa !5
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = sub nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = call i64 @znzread(ptr noundef %55, i64 noundef 1, i64 noundef %58, ptr noundef %59)
  %61 = icmp ule i64 %60, 0
  br i1 %61, label %62, label %65

62:                                               ; preds = %54
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %63) #6
  %64 = call i32 @Xznzclose(ptr noundef %6)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %134

65:                                               ; preds = %54
  %66 = load ptr, ptr %15, align 8, !tbaa !5
  %67 = call ptr @nifti_image_from_ascii(ptr noundef %66, ptr noundef %12)
  store ptr %67, ptr %10, align 8, !tbaa !5
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %68) #6
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %78

71:                                               ; preds = %65
  %72 = load ptr, ptr @stderr, align 8, !tbaa !5
  %73 = getelementptr inbounds [25 x i8], ptr %16, i64 0, i64 0
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.115, ptr noundef %73, ptr noundef @.str.195, ptr noundef %74) #6
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %76) #6
  %77 = call i32 @Xznzclose(ptr noundef %6)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %134

78:                                               ; preds = %65
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.nifti_image, ptr %79, i32 0, i32 47
  store i32 3, ptr %80, align 8, !tbaa !13
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = sub nsw i32 %81, %82
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = call i64 @nifti_get_volsize(ptr noundef %84)
  %86 = trunc i64 %85 to i32
  %87 = sub nsw i32 %83, %86
  store i32 %87, ptr %13, align 4, !tbaa !9
  %88 = load i32, ptr %13, align 4, !tbaa !9
  %89 = icmp sgt i32 %88, 4
  br i1 %89, label %90, label %105

90:                                               ; preds = %78
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = call i64 @znzseek(ptr noundef %91, i64 noundef %93, i32 noundef 0)
  %95 = icmp slt i64 %94, 0
  br i1 %95, label %96, label %100

96:                                               ; preds = %90
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %97) #6
  %98 = call i32 @Xznzclose(ptr noundef %6)
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %99) #6
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %134

100:                                              ; preds = %90
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load i32, ptr %13, align 4, !tbaa !9
  %104 = call i32 @nifti_read_extensions(ptr noundef %101, ptr noundef %102, i32 noundef %103)
  br label %105

105:                                              ; preds = %100, %78
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %106) #6
  %107 = call i32 @Xznzclose(ptr noundef %6)
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.nifti_image, ptr %108, i32 0, i32 57
  store i32 -1, ptr %109, align 8, !tbaa !18
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %115

112:                                              ; preds = %105
  %113 = load ptr, ptr %10, align 8, !tbaa !5
  %114 = call i32 @nifti_image_load(ptr noundef %113)
  store i32 %114, ptr %14, align 4, !tbaa !9
  br label %118

115:                                              ; preds = %105
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.nifti_image, ptr %116, i32 0, i32 60
  store ptr null, ptr %117, align 8, !tbaa !19
  br label %118

118:                                              ; preds = %115, %112
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %132

121:                                              ; preds = %118
  %122 = load i32, ptr %14, align 4, !tbaa !9
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %132

124:                                              ; preds = %121
  %125 = load i32, ptr @g_opts, align 4, !tbaa !11
  %126 = icmp sgt i32 %125, 1
  br i1 %126, label %127, label %130

127:                                              ; preds = %124
  %128 = load ptr, ptr @stderr, align 8, !tbaa !5
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %128, ptr noundef @.str.196) #6
  br label %130

130:                                              ; preds = %127, %124
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %131) #6
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %134

132:                                              ; preds = %121, %118
  %133 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %133, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %134

134:                                              ; preds = %132, %130, %96, %71, %62, %48, %21
  call void @llvm.lifetime.end.p0(i64 25, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %135 = load ptr, ptr %5, align 8
  ret ptr %135
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_image_load(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local ptr @nifti_image_from_ascii(ptr noundef, ptr noundef) #4

declare i64 @znzseek(ptr noundef, i64 noundef, i32 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 0}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!14, !10, i64 488}
!14 = !{!"", !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, !15, i64 64, !10, i64 72, !10, 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, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, 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, !10, i64 480, !10, i64 484, !10, i64 488, !10, 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, !10, i64 648, !10, i64 652, !10, i64 656, !6, i64 664, !10, i64 672, !6, i64 680, !10, i64 688}
!15 = !{!"long", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"", !7, i64 0}
!18 = !{!14, !10, i64 648}
!19 = !{!14, !6, i64 664}


; 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.115 = external hidden unnamed_addr constant [24 x i8], align 1
@__const.nifti_read_ascii_image.lfunc = external hidden unnamed_addr constant [25 x i8], align 16
@.str.192 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.193 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.194 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.195 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.196 = external hidden unnamed_addr constant [47 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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

declare i32 @Xznzclose(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
declare dso_local i64 @nifti_get_volsize(ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_is_gzfile(ptr noundef) local_unnamed_addr #5

; 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 #6

declare i64 @znzread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local ptr @nifti_read_ascii_image(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #5 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca [25 x i8], align 16
  store ptr %0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 25, ptr nonnull %7) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(25) %7, ptr noundef nonnull align 16 dereferenceable(25) @__const.nifti_read_ascii_image.lfunc, i64 25, i1 false)
  %8 = tail call i32 @nifti_is_gzfile(ptr noundef %1)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %13, label %9

9:                                                ; preds = %4
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.115, ptr noundef nonnull %7, ptr noundef nonnull @.str.192, ptr noundef %1) #9
  call void @free(ptr noundef %1) #8
  %12 = call i32 @Xznzclose(ptr noundef nonnull %5) #8
  br label %73

13:                                               ; preds = %4
  %14 = load i32, ptr @g_opts, align 4, !tbaa !9
  %15 = icmp sgt i32 %14, 1
  br i1 %15, label %16, label %19

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

19:                                               ; preds = %16, %13
  %spec.store.select = tail call i32 @llvm.smin.i32(i32 %2, i32 65530)
  %20 = add nsw i32 %spec.store.select, 1
  %21 = sext i32 %20 to i64
  %22 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %21) #10
  %.not40 = icmp eq ptr %22, null
  br i1 %.not40, label %23, label %27

23:                                               ; preds = %19
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.194, ptr noundef nonnull %7, i32 noundef 65530) #9
  call void @free(ptr noundef %1) #8
  %26 = call i32 @Xznzclose(ptr noundef nonnull %5) #8
  br label %73

27:                                               ; preds = %19
  %28 = add nsw i32 %spec.store.select, -1
  %29 = sext i32 %28 to i64
  %30 = tail call i64 @znzread(ptr noundef nonnull %22, i64 noundef 1, i64 noundef %29, ptr noundef %0) #8
  %31 = icmp eq i64 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  tail call void @free(ptr noundef %1) #8
  %33 = call i32 @Xznzclose(ptr noundef nonnull %5) #8
  br label %73

34:                                               ; preds = %27
  %35 = call ptr @nifti_image_from_ascii(ptr noundef nonnull %22, ptr noundef nonnull %6)
  call void @free(ptr noundef nonnull %22) #8
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %41

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.115, ptr noundef nonnull %7, ptr noundef nonnull @.str.195, ptr noundef %1) #9
  call void @free(ptr noundef %1) #8
  %40 = call i32 @Xznzclose(ptr noundef nonnull %5) #8
  br label %73

41:                                               ; preds = %34
  %42 = getelementptr inbounds i8, ptr %35, i64 488
  store i32 3, ptr %42, align 8, !tbaa !12
  %43 = load i32, ptr %6, align 4, !tbaa !17
  %44 = call i64 @nifti_get_volsize(ptr noundef nonnull %35)
  %45 = trunc i64 %44 to i32
  %46 = add i32 %43, %45
  %47 = sub i32 %2, %46
  %48 = icmp sgt i32 %47, 4
  br i1 %48, label %49, label %60

49:                                               ; preds = %41
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i32, ptr %6, align 4, !tbaa !17
  %52 = sext i32 %51 to i64
  %53 = call i64 @znzseek(ptr noundef %50, i64 noundef %52, i32 noundef 0) #8
  %54 = icmp slt i64 %53, 0
  br i1 %54, label %55, label %57

55:                                               ; preds = %49
  call void @free(ptr noundef %1) #8
  %56 = call i32 @Xznzclose(ptr noundef nonnull %5) #8
  call void @free(ptr noundef nonnull %35) #8
  br label %73

57:                                               ; preds = %49
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = call i32 @nifti_read_extensions(ptr noundef nonnull %35, ptr noundef %58, i32 noundef %47)
  br label %60

60:                                               ; preds = %57, %41
  call void @free(ptr noundef %1) #8
  %61 = call i32 @Xznzclose(ptr noundef nonnull %5) #8
  %62 = getelementptr inbounds i8, ptr %35, i64 648
  store i32 -1, ptr %62, align 8, !tbaa !18
  %.not41 = icmp eq i32 %3, 0
  br i1 %.not41, label %.critedge, label %63

63:                                               ; preds = %60
  %64 = call i32 @nifti_image_load(ptr noundef nonnull %35)
  %.not42 = icmp eq i32 %64, 0
  br i1 %.not42, label %73, label %66

.critedge:                                        ; preds = %60
  %65 = getelementptr inbounds i8, ptr %35, i64 664
  store ptr null, ptr %65, align 8, !tbaa !19
  br label %73

66:                                               ; preds = %63
  %67 = load i32, ptr @g_opts, align 4, !tbaa !9
  %68 = icmp sgt i32 %67, 1
  br i1 %68, label %69, label %72

69:                                               ; preds = %66
  %70 = load ptr, ptr @stderr, align 8, !tbaa !5
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef nonnull @.str.196) #9
  br label %72

72:                                               ; preds = %69, %66
  call void @free(ptr noundef nonnull %35) #8
  br label %73

73:                                               ; preds = %63, %.critedge, %72, %55, %37, %32, %23, %9
  %.0 = phi ptr [ null, %9 ], [ null, %32 ], [ null, %37 ], [ null, %55 ], [ null, %72 ], [ null, %23 ], [ %35, %.critedge ], [ %35, %63 ]
  call void @llvm.lifetime.end.p0(i64 25, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  ret ptr %.0
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_image_load(ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare dso_local ptr @nifti_image_from_ascii(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i64 @znzseek(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7

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 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { cold nounwind }
attributes #10 = { 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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 488}
!13 = !{!"", !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, !14, i64 64, !11, i64 72, !11, i64 76, !15, i64 80, !15, i64 84, !15, i64 88, !15, i64 92, !15, i64 96, !15, i64 100, !15, i64 104, !7, i64 108, !15, i64 140, !15, i64 144, !15, i64 148, !15, 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, !15, i64 188, !15, i64 192, !15, i64 196, !15, i64 200, !15, i64 204, !15, i64 208, !15, i64 212, !15, i64 216, !16, i64 220, !16, i64 284, !16, i64 348, !16, i64 412, !15, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !15, i64 496, !15, i64 500, !15, 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}
!14 = !{!"long", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"", !7, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!13, !11, i64 648}
!19 = !{!13, !6, i64 664}


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