; 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.field_s = type { i32, i32, i32, i32, [20 x i8] }
%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_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]] }

@g_nim_fields = external hidden global [63 x %struct.field_s], align 16
@stderr = external global ptr, align 8
@g_debug = external hidden global i32, align 4
@.str.230 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.232 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.485 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.486 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.487 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.488 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.489 = external hidden unnamed_addr constant [50 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 uwtable
define dso_local i32 @act_cci(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %7 = load i32, ptr @g_debug, align 4, !tbaa !9
  %8 = icmp sgt i32 %7, 2
  br i1 %8, label %9, label %21

9:                                                ; preds = %1
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.nt_opts, ptr %11, i32 0, i32 33
  %13 = getelementptr inbounds %struct.str_list, ptr %12, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds ptr, ptr %14, i64 0
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.nt_opts, ptr %17, i32 0, i32 28
  %19 = load ptr, ptr %18, align 8, !tbaa !14
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef @.str.487, ptr noundef %16, ptr noundef %19) #5
  br label %21

21:                                               ; preds = %9, %1
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.nt_opts, ptr %22, i32 0, i32 28
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = icmp ne ptr %24, null
  br i1 %25, label %29, label %26

26:                                               ; preds = %21
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.488) #5
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %147

29:                                               ; preds = %21
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.nt_opts, ptr %30, i32 0, i32 33
  %32 = getelementptr inbounds %struct.str_list, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !15
  %34 = icmp sgt i32 %33, 1
  br i1 %34, label %35, label %38

35:                                               ; preds = %29
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str.489) #5
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %147

38:                                               ; preds = %29
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.nt_opts, ptr %41, i32 0, i32 33
  %43 = getelementptr inbounds %struct.str_list, ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = getelementptr inbounds ptr, ptr %44, i64 0
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = call ptr @nt_image_read(ptr noundef %40, ptr noundef %46, i32 noundef 0)
  store ptr %47, ptr %4, align 8, !tbaa !5
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %51, label %50

50:                                               ; preds = %39
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %147

51:                                               ; preds = %39
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.nifti_image, ptr %52, i32 0, i32 60
  store ptr null, ptr %53, align 8, !tbaa !16
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.nt_opts, ptr %55, i32 0, i32 22
  %57 = getelementptr inbounds [8 x i32], ptr %56, i64 0, i64 0
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.nifti_image, ptr %58, i32 0, i32 60
  %60 = call i32 @nifti_read_collapsed_image(ptr noundef %54, ptr noundef %57, ptr noundef %59)
  %61 = icmp slt i32 %60, 0
  br i1 %61, label %62, label %64

62:                                               ; preds = %51
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %63)
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %147

64:                                               ; preds = %51
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.nt_opts, ptr %65, i32 0, i32 26
  %67 = load i32, ptr %66, align 8, !tbaa !21
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %84

69:                                               ; preds = %64
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.nt_opts, ptr %71, i32 0, i32 34
  %73 = getelementptr inbounds [2048 x i8], ptr %72, i64 0, i64 0
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.nt_opts, ptr %74, i32 0, i32 34
  %76 = getelementptr inbounds [2048 x i8], ptr %75, i64 0, i64 0
  %77 = call i64 @strlen(ptr noundef %76) #6
  %78 = trunc i64 %77 to i32
  %79 = call i32 @nifti_add_extension(ptr noundef %70, ptr noundef %73, i32 noundef %78, i32 noundef 6)
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %84

81:                                               ; preds = %69
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.230) #5
  br label %84

84:                                               ; preds = %81, %69, %64
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.nt_opts, ptr %86, i32 0, i32 28
  %88 = load ptr, ptr %87, align 8, !tbaa !14
  %89 = call i32 @nifti_set_filenames(ptr noundef %85, ptr noundef %88, i32 noundef 1, i32 noundef 1)
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %98

91:                                               ; preds = %84
  %92 = load ptr, ptr @stderr, align 8, !tbaa !5
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.nt_opts, ptr %93, i32 0, i32 28
  %95 = load ptr, ptr %94, align 8, !tbaa !14
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str.485, ptr noundef %95) #5
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %97)
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %147

98:                                               ; preds = %84
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %117, %98
  %100 = load i32, ptr %5, align 4, !tbaa !9
  %101 = icmp slt i32 %100, 8
  br i1 %101, label %102, label %120

102:                                              ; preds = %99
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.nt_opts, ptr %103, i32 0, i32 22
  %105 = load i32, ptr %5, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [8 x i32], ptr %104, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = icmp sge i32 %108, 0
  br i1 %109, label %110, label %116

110:                                              ; preds = %102
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.nifti_image, ptr %111, i32 0, i32 8
  %113 = load i32, ptr %5, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [8 x i32], ptr %112, i64 0, i64 %114
  store i32 1, ptr %115, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %110, %102
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %5, align 4, !tbaa !9
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %5, align 4, !tbaa !9
  br label %99, !llvm.loop !22

120:                                              ; preds = %99
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = call i32 @nifti_update_dims_from_array(ptr noundef %121)
  %123 = load i32, ptr @g_debug, align 4, !tbaa !9
  %124 = icmp sgt i32 %123, 2
  br i1 %124, label %125, label %128

125:                                              ; preds = %120
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = call i32 @disp_field(ptr noundef @.str.486, ptr noundef @g_nim_fields, ptr noundef %126, i32 noundef 63, i32 noundef 1)
  br label %128

128:                                              ; preds = %125, %120
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = load i32, ptr @g_debug, align 4, !tbaa !9
  %131 = call i32 @nifti_nim_is_valid(ptr noundef %129, i32 noundef %130)
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %145

133:                                              ; preds = %128
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = call i32 @nifti_image_write_status(ptr noundef %134)
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %144

137:                                              ; preds = %133
  %138 = load ptr, ptr @stderr, align 8, !tbaa !5
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.nifti_image, ptr %139, i32 0, i32 55
  %141 = load ptr, ptr %140, align 8, !tbaa !24
  %142 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %138, ptr noundef @.str.232, ptr noundef %141) #5
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %143)
  store i32 1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %147

144:                                              ; preds = %133
  br label %145

145:                                              ; preds = %144, %128
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %146)
  store i32 0, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %147

147:                                              ; preds = %145, %137, %91, %62, %50, %35, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %148 = load i32, ptr %2, align 4
  ret i32 %148
}

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

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

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

declare i32 @nifti_add_extension(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #4

declare void @nifti_image_free(ptr noundef) #4

declare i32 @nifti_set_filenames(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #4

declare i32 @nifti_image_write_status(ptr noundef) #4

declare i32 @nifti_nim_is_valid(ptr noundef, i32 noundef) #4

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

declare i32 @nifti_read_collapsed_image(ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @nifti_update_dims_from_array(ptr noundef) #4

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 248}
!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 = !{!12, !6, i64 168}
!15 = !{!12, !10, i64 240}
!16 = !{!17, !6, i64 664}
!17 = !{!"", !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, !18, 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}
!18 = !{!"long", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"", !7, i64 0}
!21 = !{!12, !10, i64 160}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!17, !6, i64 632}


; 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.field_s = type { i32, i32, i32, i32, [20 x i8] }

@g_nim_fields = external hidden global [63 x %struct.field_s], align 16
@stderr = external local_unnamed_addr global ptr, align 8
@g_debug = external hidden local_unnamed_addr global i32, align 4
@.str.230 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.232 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.485 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.486 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.487 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.488 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.489 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @act_cci(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @g_debug, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 2
  br i1 %3, label %4, label %12

4:                                                ; preds = %1
  %5 = load ptr, ptr @stderr, align 8, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %0, i64 248
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %0, i64 168
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.487, ptr noundef %8, ptr noundef %10) #4
  br label %12

12:                                               ; preds = %4, %1
  %13 = getelementptr inbounds i8, ptr %0, i64 168
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %15, label %18

15:                                               ; preds = %12
  %16 = load ptr, ptr @stderr, align 8, !tbaa !9
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.488) #4
  br label %112

18:                                               ; preds = %12
  %19 = getelementptr inbounds i8, ptr %0, i64 240
  %20 = load i32, ptr %19, align 8, !tbaa !15
  %21 = icmp sgt i32 %20, 1
  br i1 %21, label %22, label %25

22:                                               ; preds = %18
  %23 = load ptr, ptr @stderr, align 8, !tbaa !9
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.489) #4
  br label %112

25:                                               ; preds = %18
  %26 = getelementptr inbounds i8, ptr %0, i64 248
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = tail call ptr @nt_image_read(ptr noundef nonnull %0, ptr noundef %28, i32 noundef 0)
  %.not35 = icmp eq ptr %29, null
  br i1 %.not35, label %112, label %30

30:                                               ; preds = %25
  %31 = getelementptr inbounds i8, ptr %29, i64 664
  store ptr null, ptr %31, align 8, !tbaa !16
  %32 = getelementptr inbounds i8, ptr %0, i64 88
  %33 = tail call i32 @nifti_read_collapsed_image(ptr noundef nonnull %29, ptr noundef nonnull %32, ptr noundef nonnull %31) #5
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %30
  tail call void @nifti_image_free(ptr noundef nonnull %29) #5
  br label %112

36:                                               ; preds = %30
  %37 = getelementptr inbounds i8, ptr %0, i64 160
  %38 = load i32, ptr %37, align 8, !tbaa !21
  %.not36 = icmp eq i32 %38, 0
  br i1 %.not36, label %47, label %39

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %0, i64 256
  %41 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %40) #6
  %42 = trunc i64 %41 to i32
  %43 = tail call i32 @nifti_add_extension(ptr noundef nonnull %29, ptr noundef nonnull %40, i32 noundef %42, i32 noundef 6) #5
  %.not37 = icmp eq i32 %43, 0
  br i1 %.not37, label %47, label %44

44:                                               ; preds = %39
  %45 = load ptr, ptr @stderr, align 8, !tbaa !9
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.230) #4
  br label %47

47:                                               ; preds = %44, %39, %36
  %48 = load ptr, ptr %13, align 8, !tbaa !14
  %49 = tail call i32 @nifti_set_filenames(ptr noundef nonnull %29, ptr noundef %48, i32 noundef 1, i32 noundef 1) #5
  %.not38 = icmp eq i32 %49, 0
  br i1 %.not38, label %.preheader, label %53

.preheader:                                       ; preds = %47
  %50 = getelementptr inbounds i8, ptr %0, i64 92
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp sgt i32 %51, -1
  br i1 %52, label %57, label %59

53:                                               ; preds = %47
  %54 = load ptr, ptr @stderr, align 8, !tbaa !9
  %55 = load ptr, ptr %13, align 8, !tbaa !14
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.485, ptr noundef %55) #4
  tail call void @nifti_image_free(ptr noundef nonnull %29) #5
  br label %112

57:                                               ; preds = %.preheader
  %58 = getelementptr inbounds i8, ptr %29, i64 36
  store i32 1, ptr %58, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %.preheader, %57
  %60 = getelementptr inbounds i8, ptr %0, i64 96
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp sgt i32 %61, -1
  br i1 %62, label %63, label %65

63:                                               ; preds = %59
  %64 = getelementptr inbounds i8, ptr %29, i64 40
  store i32 1, ptr %64, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %63, %59
  %66 = getelementptr inbounds i8, ptr %0, i64 100
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = icmp sgt i32 %67, -1
  br i1 %68, label %69, label %71

69:                                               ; preds = %65
  %70 = getelementptr inbounds i8, ptr %29, i64 44
  store i32 1, ptr %70, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %69, %65
  %72 = getelementptr inbounds i8, ptr %0, i64 104
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp sgt i32 %73, -1
  br i1 %74, label %75, label %77

75:                                               ; preds = %71
  %76 = getelementptr inbounds i8, ptr %29, i64 48
  store i32 1, ptr %76, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %75, %71
  %78 = getelementptr inbounds i8, ptr %0, i64 108
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp sgt i32 %79, -1
  br i1 %80, label %81, label %83

81:                                               ; preds = %77
  %82 = getelementptr inbounds i8, ptr %29, i64 52
  store i32 1, ptr %82, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %81, %77
  %84 = getelementptr inbounds i8, ptr %0, i64 112
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = icmp sgt i32 %85, -1
  br i1 %86, label %87, label %89

87:                                               ; preds = %83
  %88 = getelementptr inbounds i8, ptr %29, i64 56
  store i32 1, ptr %88, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %87, %83
  %90 = getelementptr inbounds i8, ptr %0, i64 116
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = icmp sgt i32 %91, -1
  br i1 %92, label %93, label %95

93:                                               ; preds = %89
  %94 = getelementptr inbounds i8, ptr %29, i64 60
  store i32 1, ptr %94, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %93, %89
  %96 = tail call i32 @nifti_update_dims_from_array(ptr noundef nonnull %29) #5
  %97 = load i32, ptr @g_debug, align 4, !tbaa !5
  %98 = icmp sgt i32 %97, 2
  br i1 %98, label %99, label %101

99:                                               ; preds = %95
  %100 = tail call i32 @disp_field(ptr noundef nonnull @.str.486, ptr noundef nonnull @g_nim_fields, ptr noundef nonnull %29, i32 noundef 63, i32 noundef 1)
  %.pre = load i32, ptr @g_debug, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %99, %95
  %102 = phi i32 [ %.pre, %99 ], [ %97, %95 ]
  %103 = tail call i32 @nifti_nim_is_valid(ptr noundef nonnull %29, i32 noundef %102) #5
  %.not39 = icmp eq i32 %103, 0
  br i1 %.not39, label %111, label %104

104:                                              ; preds = %101
  %105 = tail call i32 @nifti_image_write_status(ptr noundef nonnull %29) #5
  %.not40 = icmp eq i32 %105, 0
  br i1 %.not40, label %111, label %106

106:                                              ; preds = %104
  %107 = load ptr, ptr @stderr, align 8, !tbaa !9
  %108 = getelementptr inbounds i8, ptr %29, i64 632
  %109 = load ptr, ptr %108, align 8, !tbaa !22
  %110 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef nonnull @.str.232, ptr noundef %109) #4
  tail call void @nifti_image_free(ptr noundef nonnull %29) #5
  br label %112

111:                                              ; preds = %104, %101
  tail call void @nifti_image_free(ptr noundef nonnull %29) #5
  br label %112

112:                                              ; preds = %25, %111, %106, %53, %35, %22, %15
  %.033 = phi i32 [ 1, %22 ], [ 1, %35 ], [ 1, %53 ], [ 1, %106 ], [ 0, %111 ], [ 1, %15 ], [ 1, %25 ]
  ret i32 %.033
}

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

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

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

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

declare void @nifti_image_free(ptr noundef) local_unnamed_addr #3

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

declare i32 @nifti_image_write_status(ptr noundef) local_unnamed_addr #3

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

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

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

declare i32 @nifti_update_dims_from_array(ptr noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 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 #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 = { cold nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass