; 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.nifti_brick_list = type { i32, i64, ptr }
%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.477 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.478 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.479 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.480 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.481 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.482 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.483 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.484 = external hidden unnamed_addr constant [22 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

; 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_cbl(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %struct.nifti_brick_list, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  %12 = load i32, ptr @g_debug, align 4, !tbaa !9
  %13 = icmp sgt i32 %12, 2
  br i1 %13, label %14, label %26

14:                                               ; preds = %1
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.nt_opts, ptr %16, i32 0, i32 33
  %18 = getelementptr inbounds %struct.str_list, ptr %17, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds ptr, ptr %19, i64 0
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %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 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str.477, ptr noundef %21, ptr noundef %24) #5
  br label %26

26:                                               ; preds = %14, %1
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.nt_opts, ptr %27, i32 0, i32 28
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = icmp ne ptr %29, null
  br i1 %30, label %34, label %31

31:                                               ; preds = %26
  %32 = load ptr, ptr @stderr, align 8, !tbaa !5
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef @.str.478) #5
  store i32 1, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %187

34:                                               ; preds = %26
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.nt_opts, ptr %35, i32 0, i32 33
  %37 = getelementptr inbounds %struct.str_list, ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !15
  %39 = icmp sgt i32 %38, 1
  br i1 %39, label %40, label %43

40:                                               ; preds = %34
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef @.str.479) #5
  store i32 1, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %187

43:                                               ; preds = %34
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.nt_opts, ptr %45, i32 0, i32 33
  %47 = getelementptr inbounds %struct.str_list, ptr %46, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = getelementptr inbounds ptr, ptr %48, i64 0
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %51 = call ptr @nifti_strdup(ptr noundef %50)
  store ptr %51, ptr %6, align 8, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = call ptr @strchr(ptr noundef %52, i32 noundef 91) #6
  store ptr %53, ptr %8, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %59, label %56

56:                                               ; preds = %44
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = call ptr @strchr(ptr noundef %57, i32 noundef 123) #6
  store ptr %58, ptr %8, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %56, %44
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %71, label %62

62:                                               ; preds = %59
  %63 = load i32, ptr @g_debug, align 4, !tbaa !9
  %64 = icmp sgt i32 %63, 1
  br i1 %64, label %65, label %69

65:                                               ; preds = %62
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.480, ptr noundef %67) #5
  br label %69

69:                                               ; preds = %65, %62
  %70 = call ptr @nifti_strdup(ptr noundef @.str.481)
  store ptr %70, ptr %7, align 8, !tbaa !5
  br label %75

71:                                               ; preds = %59
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = call ptr @nifti_strdup(ptr noundef %72)
  store ptr %73, ptr %7, align 8, !tbaa !5
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  store i8 0, ptr %74, align 1, !tbaa !16
  br label %75

75:                                               ; preds = %71, %69
  %76 = load i32, ptr @g_debug, align 4, !tbaa !9
  %77 = icmp sgt i32 %76, 1
  br i1 %77, label %78, label %82

78:                                               ; preds = %75
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef @.str.482, ptr noundef %80) #5
  br label %82

82:                                               ; preds = %78, %75
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = call ptr @nt_image_read(ptr noundef %83, ptr noundef %84, i32 noundef 0)
  store ptr %85, ptr %5, align 8, !tbaa !5
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = icmp ne ptr %86, null
  br i1 %87, label %89, label %88

88:                                               ; preds = %82
  store i32 1, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %187

89:                                               ; preds = %82
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.nifti_image, ptr %90, i32 0, i32 4
  %92 = load i32, ptr %91, align 8, !tbaa !17
  %93 = icmp sgt i32 %92, 0
  br i1 %93, label %94, label %97

94:                                               ; preds = %89
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = call i32 @num_volumes(ptr noundef %95)
  br label %98

97:                                               ; preds = %89
  br label %98

98:                                               ; preds = %97, %94
  %99 = phi i32 [ %96, %94 ], [ 1, %97 ]
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = call ptr @nifti_get_intlist(i32 noundef %99, ptr noundef %100)
  store ptr %101, ptr %9, align 8, !tbaa !5
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %102)
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = icmp ne ptr %103, null
  br i1 %104, label %111, label %105

105:                                              ; preds = %98
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.483, ptr noundef %107) #5
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %109) #5
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %110) #5
  store i32 1, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %187

111:                                              ; preds = %98
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = getelementptr inbounds i32, ptr %114, i64 0
  %116 = load i32, ptr %115, align 4, !tbaa !9
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = getelementptr inbounds i32, ptr %117, i64 1
  %119 = call ptr @nt_read_bricks(ptr noundef %112, ptr noundef %113, i32 noundef %116, ptr noundef %118, ptr noundef %4)
  store ptr %119, ptr %5, align 8, !tbaa !5
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %120) #5
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = icmp ne ptr %121, null
  br i1 %122, label %126, label %123

123:                                              ; preds = %111
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %124) #5
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %125) #5
  store i32 1, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %187

126:                                              ; preds = %111
  %127 = load i32, ptr @g_debug, align 4, !tbaa !9
  %128 = icmp sgt i32 %127, 1
  br i1 %128, label %129, label %132

129:                                              ; preds = %126
  %130 = load ptr, ptr @stderr, align 8, !tbaa !5
  %131 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef @.str.484) #5
  br label %132

132:                                              ; preds = %129, %126
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.nt_opts, ptr %133, i32 0, i32 26
  %135 = load i32, ptr %134, align 8, !tbaa !22
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %152

137:                                              ; preds = %132
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.nt_opts, ptr %139, i32 0, i32 34
  %141 = getelementptr inbounds [2048 x i8], ptr %140, i64 0, i64 0
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.nt_opts, ptr %142, i32 0, i32 34
  %144 = getelementptr inbounds [2048 x i8], ptr %143, i64 0, i64 0
  %145 = call i64 @strlen(ptr noundef %144) #6
  %146 = trunc i64 %145 to i32
  %147 = call i32 @nifti_add_extension(ptr noundef %138, ptr noundef %141, i32 noundef %146, i32 noundef 6)
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %149, label %152

149:                                              ; preds = %137
  %150 = load ptr, ptr @stderr, align 8, !tbaa !5
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %150, ptr noundef @.str.230) #5
  br label %152

152:                                              ; preds = %149, %137, %132
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.nt_opts, ptr %154, i32 0, i32 28
  %156 = load ptr, ptr %155, align 8, !tbaa !14
  %157 = call i32 @nifti_set_filenames(ptr noundef %153, ptr noundef %156, i32 noundef 1, i32 noundef 1)
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %167

159:                                              ; preds = %152
  %160 = load ptr, ptr @stderr, align 8, !tbaa !5
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.nt_opts, ptr %161, i32 0, i32 28
  %163 = load ptr, ptr %162, align 8, !tbaa !14
  %164 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %160, ptr noundef @.str.485, ptr noundef %163) #5
  %165 = load i32, ptr %10, align 4, !tbaa !9
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %10, align 4, !tbaa !9
  br label %167

167:                                              ; preds = %159, %152
  %168 = load i32, ptr @g_debug, align 4, !tbaa !9
  %169 = icmp sgt i32 %168, 2
  br i1 %169, label %170, label %173

170:                                              ; preds = %167
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = call i32 @disp_field(ptr noundef @.str.486, ptr noundef @g_nim_fields, ptr noundef %171, i32 noundef 63, i32 noundef 1)
  br label %173

173:                                              ; preds = %170, %167
  %174 = load i32, ptr %10, align 4, !tbaa !9
  %175 = icmp eq i32 %174, 0
  br i1 %175, label %176, label %183

176:                                              ; preds = %173
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = load i32, ptr @g_debug, align 4, !tbaa !9
  %179 = call i32 @nifti_nim_is_valid(ptr noundef %177, i32 noundef %178)
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %181, label %183

181:                                              ; preds = %176
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  call void @nifti_image_write_bricks(ptr noundef %182, ptr noundef %4)
  br label %183

183:                                              ; preds = %181, %176, %173
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %184)
  call void @nifti_free_NBL(ptr noundef %4)
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %185) #5
  %186 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %186) #5
  store i32 0, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %187

187:                                              ; preds = %183, %123, %105, %88, %40, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  %188 = load i32, ptr %2, align 4
  ret i32 %188
}

; 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

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

declare i32 @nifti_set_filenames(ptr noundef, ptr noundef, i32 noundef, i32 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 ptr @nifti_strdup(ptr noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strchr(ptr noundef, i32 noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @num_volumes(ptr noundef) #1

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

declare void @nifti_image_write_bricks(ptr noundef, ptr noundef) #4

declare void @nifti_free_NBL(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 = !{!7, !7, i64 0}
!17 = !{!18, !10, i64 16}
!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, !19, i64 64, !10, i64 72, !10, i64 76, !20, i64 80, !20, i64 84, !20, i64 88, !20, i64 92, !20, i64 96, !20, i64 100, !20, i64 104, !7, i64 108, !20, i64 140, !20, i64 144, !20, i64 148, !20, 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, !20, i64 188, !20, i64 192, !20, i64 196, !20, i64 200, !20, i64 204, !20, i64 208, !20, i64 212, !20, i64 216, !21, i64 220, !21, i64 284, !21, i64 348, !21, i64 412, !20, i64 476, !10, i64 480, !10, i64 484, !10, i64 488, !10, i64 492, !20, i64 496, !20, i64 500, !20, 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 = !{!"long", !7, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = !{!"", !7, i64 0}
!22 = !{!12, !10, i64 160}


; 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] }
%struct.nifti_brick_list = type { i32, i64, ptr }

@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.477 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.478 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.479 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.480 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.481 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.482 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.483 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.484 = external hidden unnamed_addr constant [22 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

; 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: nounwind uwtable
define dso_local range(i32 0, 2) i32 @act_cbl(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca %struct.nifti_brick_list, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  %3 = load i32, ptr @g_debug, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 2
  br i1 %4, label %5, label %13

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

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

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

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

23:                                               ; preds = %19
  %24 = load ptr, ptr @stderr, align 8, !tbaa !9
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.479) #7
  br label %103

26:                                               ; preds = %19
  %27 = getelementptr inbounds i8, ptr %0, i64 248
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = tail call ptr @nifti_strdup(ptr noundef %29) #6
  %31 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %30, i32 noundef 91) #8
  %.not54 = icmp eq ptr %31, null
  br i1 %.not54, label %32, label %.thread

32:                                               ; preds = %26
  %33 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %30, i32 noundef 123) #8
  %.not55 = icmp eq ptr %33, null
  br i1 %.not55, label %34, label %.thread

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

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !9
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.480, ptr noundef %30) #7
  br label %40

40:                                               ; preds = %37, %34
  %41 = tail call ptr @nifti_strdup(ptr noundef nonnull @.str.481) #6
  br label %43

.thread:                                          ; preds = %26, %32
  %.04865 = phi ptr [ %33, %32 ], [ %31, %26 ]
  %42 = tail call ptr @nifti_strdup(ptr noundef nonnull %.04865) #6
  store i8 0, ptr %.04865, align 1, !tbaa !16
  br label %43

43:                                               ; preds = %.thread, %40
  %.049 = phi ptr [ %42, %.thread ], [ %41, %40 ]
  %44 = load i32, ptr @g_debug, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 1
  br i1 %45, label %46, label %49

46:                                               ; preds = %43
  %47 = load ptr, ptr @stderr, align 8, !tbaa !9
  %48 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.482, ptr noundef %.049) #7
  br label %49

49:                                               ; preds = %46, %43
  %50 = tail call ptr @nt_image_read(ptr noundef nonnull %0, ptr noundef %30, i32 noundef 0)
  %.not56 = icmp eq ptr %50, null
  br i1 %.not56, label %103, label %51

51:                                               ; preds = %49
  %52 = getelementptr inbounds i8, ptr %50, i64 16
  %53 = load i32, ptr %52, align 8, !tbaa !17
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %57

55:                                               ; preds = %51
  %56 = tail call i32 @num_volumes(ptr noundef nonnull %50)
  br label %57

57:                                               ; preds = %51, %55
  %58 = phi i32 [ %56, %55 ], [ 1, %51 ]
  %59 = tail call ptr @nifti_get_intlist(i32 noundef %58, ptr noundef %.049) #6
  tail call void @nifti_image_free(ptr noundef nonnull %50) #6
  %.not57 = icmp eq ptr %59, null
  br i1 %.not57, label %60, label %63

60:                                               ; preds = %57
  %61 = load ptr, ptr @stderr, align 8, !tbaa !9
  %62 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.483, ptr noundef %.049) #7
  tail call void @free(ptr noundef %30) #6
  tail call void @free(ptr noundef %.049) #6
  br label %103

63:                                               ; preds = %57
  %64 = load i32, ptr %59, align 4, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %59, i64 4
  %66 = call ptr @nt_read_bricks(ptr noundef nonnull %0, ptr noundef %30, i32 noundef %64, ptr noundef nonnull %65, ptr noundef nonnull %2)
  call void @free(ptr noundef nonnull %59) #6
  %.not58 = icmp eq ptr %66, null
  br i1 %.not58, label %67, label %68

67:                                               ; preds = %63
  call void @free(ptr noundef %30) #6
  call void @free(ptr noundef %.049) #6
  br label %103

68:                                               ; preds = %63
  %69 = load i32, ptr @g_debug, align 4, !tbaa !5
  %70 = icmp sgt i32 %69, 1
  br i1 %70, label %71, label %74

71:                                               ; preds = %68
  %72 = load ptr, ptr @stderr, align 8, !tbaa !9
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef nonnull @.str.484) #7
  br label %74

74:                                               ; preds = %71, %68
  %75 = getelementptr inbounds i8, ptr %0, i64 160
  %76 = load i32, ptr %75, align 8, !tbaa !22
  %.not59 = icmp eq i32 %76, 0
  br i1 %.not59, label %85, label %77

77:                                               ; preds = %74
  %78 = getelementptr inbounds i8, ptr %0, i64 256
  %79 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %78) #8
  %80 = trunc i64 %79 to i32
  %81 = call i32 @nifti_add_extension(ptr noundef nonnull %66, ptr noundef nonnull %78, i32 noundef %80, i32 noundef 6) #6
  %.not60 = icmp eq i32 %81, 0
  br i1 %.not60, label %85, label %82

82:                                               ; preds = %77
  %83 = load ptr, ptr @stderr, align 8, !tbaa !9
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef nonnull @.str.230) #7
  br label %85

85:                                               ; preds = %82, %77, %74
  %86 = load ptr, ptr %14, align 8, !tbaa !14
  %87 = call i32 @nifti_set_filenames(ptr noundef nonnull %66, ptr noundef %86, i32 noundef 1, i32 noundef 1) #6
  %.not61 = icmp eq i32 %87, 0
  br i1 %.not61, label %92, label %88

88:                                               ; preds = %85
  %89 = load ptr, ptr @stderr, align 8, !tbaa !9
  %90 = load ptr, ptr %14, align 8, !tbaa !14
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.485, ptr noundef %90) #7
  br label %92

92:                                               ; preds = %88, %85
  %93 = load i32, ptr @g_debug, align 4, !tbaa !5
  %94 = icmp sgt i32 %93, 2
  br i1 %94, label %95, label %97

95:                                               ; preds = %92
  %96 = call i32 @disp_field(ptr noundef nonnull @.str.486, ptr noundef nonnull @g_nim_fields, ptr noundef nonnull %66, i32 noundef 63, i32 noundef 1)
  br label %97

97:                                               ; preds = %95, %92
  br i1 %.not61, label %98, label %102

98:                                               ; preds = %97
  %99 = load i32, ptr @g_debug, align 4, !tbaa !5
  %100 = call i32 @nifti_nim_is_valid(ptr noundef nonnull %66, i32 noundef %99) #6
  %.not62 = icmp eq i32 %100, 0
  br i1 %.not62, label %102, label %101

101:                                              ; preds = %98
  call void @nifti_image_write_bricks(ptr noundef nonnull %66, ptr noundef nonnull %2) #6
  br label %102

102:                                              ; preds = %101, %98, %97
  call void @nifti_image_free(ptr noundef nonnull %66) #6
  call void @nifti_free_NBL(ptr noundef nonnull %2) #6
  call void @free(ptr noundef %30) #6
  call void @free(ptr noundef %.049) #6
  br label %103

103:                                              ; preds = %49, %102, %67, %60, %23, %16
  %.047 = phi i32 [ 1, %23 ], [ 0, %102 ], [ 1, %67 ], [ 1, %60 ], [ 1, %16 ], [ 1, %49 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  ret i32 %.047
}

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

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

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

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

declare void @nifti_image_free(ptr noundef) local_unnamed_addr #4

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

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

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

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

declare ptr @nifti_strdup(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @nifti_get_intlist(i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden i32 @num_volumes(ptr noundef) local_unnamed_addr #1

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

declare void @nifti_image_write_bricks(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @nifti_free_NBL(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress 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 = { 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 #3 = { 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 #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 = { 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 #6 = { nounwind }
attributes #7 = { cold nounwind }
attributes #8 = { 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 = !{!7, !7, i64 0}
!17 = !{!18, !6, i64 16}
!18 = !{!"", !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, !19, i64 64, !6, i64 72, !6, i64 76, !20, i64 80, !20, i64 84, !20, i64 88, !20, i64 92, !20, i64 96, !20, i64 100, !20, i64 104, !7, i64 108, !20, i64 140, !20, i64 144, !20, i64 148, !20, 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, !20, i64 188, !20, i64 192, !20, i64 196, !20, i64 200, !20, i64 204, !20, i64 208, !20, i64 212, !20, i64 216, !21, i64 220, !21, i64 284, !21, i64 348, !21, i64 412, !20, i64 476, !6, i64 480, !6, i64 484, !6, i64 488, !6, i64 492, !20, i64 496, !20, i64 500, !20, 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}
!19 = !{!"long", !7, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = !{!"", !7, i64 0}
!22 = !{!12, !6, i64 160}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass