; 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_analyze75 = type { i32, [10 x i8], [18 x i8], i32, i16, i8, i8, [8 x i16], i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, [8 x float], float, float, float, float, float, float, float, float, i32, i32, [80 x i8], [24 x i8], i8, [10 x i8], [10 x i8], [10 x i8], [10 x i8], [10 x i8], [10 x i8], [3 x i8], i32, i32, i32, i32, i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
declare dso_local void @nifti_swap_2bytes(i64 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @nifti_swap_4bytes(i64 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @nifti_swap_as_analyze(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp ne ptr %4, null
  br i1 %5, label %7, label %6

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

7:                                                ; preds = %1
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.nifti_analyze75, ptr %8, i32 0, i32 0
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %9)
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.nifti_analyze75, ptr %10, i32 0, i32 3
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %11)
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.nifti_analyze75, ptr %12, i32 0, i32 4
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %13)
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.nifti_analyze75, ptr %14, i32 0, i32 7
  %16 = getelementptr inbounds [8 x i16], ptr %15, i64 0, i64 0
  call void @nifti_swap_2bytes(i64 noundef 8, ptr noundef %16)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.nifti_analyze75, ptr %17, i32 0, i32 8
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %18)
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.nifti_analyze75, ptr %19, i32 0, i32 9
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %20)
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.nifti_analyze75, ptr %21, i32 0, i32 10
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %22)
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.nifti_analyze75, ptr %23, i32 0, i32 11
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %24)
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.nifti_analyze75, ptr %25, i32 0, i32 12
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %26)
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.nifti_analyze75, ptr %27, i32 0, i32 13
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %28)
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.nifti_analyze75, ptr %29, i32 0, i32 14
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %30)
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.nifti_analyze75, ptr %31, i32 0, i32 15
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %32)
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.nifti_analyze75, ptr %33, i32 0, i32 16
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %34)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.nifti_analyze75, ptr %35, i32 0, i32 17
  call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef %36)
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.nifti_analyze75, ptr %37, i32 0, i32 18
  %39 = getelementptr inbounds [8 x float], ptr %38, i64 0, i64 0
  call void @nifti_swap_4bytes(i64 noundef 8, ptr noundef %39)
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.nifti_analyze75, ptr %40, i32 0, i32 19
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %41)
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.nifti_analyze75, ptr %42, i32 0, i32 20
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %43)
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.nifti_analyze75, ptr %44, i32 0, i32 21
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %45)
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.nifti_analyze75, ptr %46, i32 0, i32 22
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %47)
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.nifti_analyze75, ptr %48, i32 0, i32 23
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %49)
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.nifti_analyze75, ptr %50, i32 0, i32 24
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %51)
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.nifti_analyze75, ptr %52, i32 0, i32 25
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %53)
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.nifti_analyze75, ptr %54, i32 0, i32 26
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %55)
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.nifti_analyze75, ptr %56, i32 0, i32 27
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %57)
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.nifti_analyze75, ptr %58, i32 0, i32 28
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %59)
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.nifti_analyze75, ptr %60, i32 0, i32 39
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %61)
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.nifti_analyze75, ptr %62, i32 0, i32 40
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %63)
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.nifti_analyze75, ptr %64, i32 0, i32 41
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %65)
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.nifti_analyze75, ptr %66, i32 0, i32 42
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %67)
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.nifti_analyze75, ptr %68, i32 0, i32 43
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %69)
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.nifti_analyze75, ptr %70, i32 0, i32 44
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %71)
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.nifti_analyze75, ptr %72, i32 0, i32 45
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %73)
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.nifti_analyze75, ptr %74, i32 0, i32 46
  call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef %75)
  store i32 0, ptr %2, align 4
  br label %76

76:                                               ; preds = %7, %6
  %77 = load i32, ptr %2, align 4
  ret i32 %77
}

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" }

!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"}


; 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"

; Function Attrs: nounwind uwtable
declare dso_local void @nifti_swap_2bytes(i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @nifti_swap_4bytes(i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @nifti_swap_as_analyze(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %35, label %2

2:                                                ; preds = %1
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 36
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @nifti_swap_2bytes(i64 noundef 8, ptr noundef nonnull %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 58
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 60
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 62
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 66
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %11)
  %12 = getelementptr inbounds i8, ptr %0, i64 68
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 70
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %13)
  %14 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %14)
  %15 = getelementptr inbounds i8, ptr %0, i64 74
  tail call void @nifti_swap_2bytes(i64 noundef 1, ptr noundef nonnull %15)
  %16 = getelementptr inbounds i8, ptr %0, i64 76
  tail call void @nifti_swap_4bytes(i64 noundef 8, ptr noundef nonnull %16)
  %17 = getelementptr inbounds i8, ptr %0, i64 108
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %17)
  %18 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %18)
  %19 = getelementptr inbounds i8, ptr %0, i64 116
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %19)
  %20 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %20)
  %21 = getelementptr inbounds i8, ptr %0, i64 124
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %21)
  %22 = getelementptr inbounds i8, ptr %0, i64 128
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %22)
  %23 = getelementptr inbounds i8, ptr %0, i64 132
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %23)
  %24 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %24)
  %25 = getelementptr inbounds i8, ptr %0, i64 140
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %25)
  %26 = getelementptr inbounds i8, ptr %0, i64 144
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %26)
  %27 = getelementptr inbounds i8, ptr %0, i64 316
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %27)
  %28 = getelementptr inbounds i8, ptr %0, i64 320
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %28)
  %29 = getelementptr inbounds i8, ptr %0, i64 324
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %29)
  %30 = getelementptr inbounds i8, ptr %0, i64 328
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %30)
  %31 = getelementptr inbounds i8, ptr %0, i64 332
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %31)
  %32 = getelementptr inbounds i8, ptr %0, i64 336
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %32)
  %33 = getelementptr inbounds i8, ptr %0, i64 340
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %33)
  %34 = getelementptr inbounds i8, ptr %0, i64 344
  tail call void @nifti_swap_4bytes(i64 noundef 1, ptr noundef nonnull %34)
  br label %35

35:                                               ; preds = %1, %2
  %.0 = phi i32 [ 0, %2 ], [ 1, %1 ]
  ret i32 %.0
}

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" }

!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)"}


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