; LLVM IR from NOAA-PMEL/Ferret :: fer/ef_utility (ef_set_axis_reduction_6d)

; 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.ExternalFunction = type { ptr, [40 x i8], [128 x i8], i32, i32, ptr }
%struct.ExternalFunctionInternals = type { float, [128 x i8], [40 x i8], [40 x i8], i32, i32, i32, i32, [9 x [6 x i32]], [9 x [6 x i32]], [6 x i32], [6 x i32], [6 x i32], i32, [6 x i32], [6 x %struct.Axis], [9 x [6 x i32]], [9 x [6 x i32]], [9 x [6 x i32]], [9 x i32], [9 x [40 x i8]], [9 x [40 x i8]], [9 x [128 x i8]] }
%struct.Axis = type { i32, i32, i32, i32, i32, double, double, double, [40 x i8] }

@.str = external hidden unnamed_addr constant [53 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [53 x i8], align 1

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

20:                                               ; preds = %7
  call void @abort() #5
  unreachable

21:                                               ; preds = %7
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 201
  br i1 %24, label %25, label %31

25:                                               ; preds = %21
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 202
  br i1 %28, label %29, label %31

29:                                               ; preds = %25
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ef_err_bail_out_(ptr noundef %30, ptr noundef @.str)
  call void @abort() #5
  unreachable

31:                                               ; preds = %25, %21
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 201
  br i1 %34, label %35, label %41

35:                                               ; preds = %31
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 202
  br i1 %38, label %39, label %41

39:                                               ; preds = %35
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ef_err_bail_out_(ptr noundef %40, ptr noundef @.str.1)
  call void @abort() #5
  unreachable

41:                                               ; preds = %35, %31
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 201
  br i1 %44, label %45, label %51

45:                                               ; preds = %41
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = icmp ne i32 %47, 202
  br i1 %48, label %49, label %51

49:                                               ; preds = %45
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ef_err_bail_out_(ptr noundef %50, ptr noundef @.str.2)
  call void @abort() #5
  unreachable

51:                                               ; preds = %45, %41
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = icmp ne i32 %53, 201
  br i1 %54, label %55, label %61

55:                                               ; preds = %51
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = icmp ne i32 %57, 202
  br i1 %58, label %59, label %61

59:                                               ; preds = %55
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ef_err_bail_out_(ptr noundef %60, ptr noundef @.str.3)
  call void @abort() #5
  unreachable

61:                                               ; preds = %55, %51
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = icmp ne i32 %63, 201
  br i1 %64, label %65, label %71

65:                                               ; preds = %61
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 202
  br i1 %68, label %69, label %71

69:                                               ; preds = %65
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ef_err_bail_out_(ptr noundef %70, ptr noundef @.str.4)
  call void @abort() #5
  unreachable

71:                                               ; preds = %65, %61
  %72 = load ptr, ptr %14, align 8, !tbaa !5
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = icmp ne i32 %73, 201
  br i1 %74, label %75, label %81

75:                                               ; preds = %71
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = icmp ne i32 %77, 202
  br i1 %78, label %79, label %81

79:                                               ; preds = %75
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ef_err_bail_out_(ptr noundef %80, ptr noundef @.str.5)
  call void @abort() #5
  unreachable

81:                                               ; preds = %75, %71
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = load ptr, ptr %15, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ExternalFunction, ptr %84, i32 0, i32 5
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  %87 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %86, i32 0, i32 11
  %88 = getelementptr inbounds [6 x i32], ptr %87, i64 0, i64 0
  store i32 %83, ptr %88, align 4, !tbaa !9
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = load ptr, ptr %15, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.ExternalFunction, ptr %91, i32 0, i32 5
  %93 = load ptr, ptr %92, align 8, !tbaa !11
  %94 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %93, i32 0, i32 11
  %95 = getelementptr inbounds [6 x i32], ptr %94, i64 0, i64 1
  store i32 %90, ptr %95, align 4, !tbaa !9
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = load ptr, ptr %15, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.ExternalFunction, ptr %98, i32 0, i32 5
  %100 = load ptr, ptr %99, align 8, !tbaa !11
  %101 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %100, i32 0, i32 11
  %102 = getelementptr inbounds [6 x i32], ptr %101, i64 0, i64 2
  store i32 %97, ptr %102, align 4, !tbaa !9
  %103 = load ptr, ptr %12, align 8, !tbaa !5
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ExternalFunction, ptr %105, i32 0, i32 5
  %107 = load ptr, ptr %106, align 8, !tbaa !11
  %108 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %107, i32 0, i32 11
  %109 = getelementptr inbounds [6 x i32], ptr %108, i64 0, i64 3
  store i32 %104, ptr %109, align 4, !tbaa !9
  %110 = load ptr, ptr %13, align 8, !tbaa !5
  %111 = load i32, ptr %110, align 4, !tbaa !9
  %112 = load ptr, ptr %15, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.ExternalFunction, ptr %112, i32 0, i32 5
  %114 = load ptr, ptr %113, align 8, !tbaa !11
  %115 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %114, i32 0, i32 11
  %116 = getelementptr inbounds [6 x i32], ptr %115, i64 0, i64 4
  store i32 %111, ptr %116, align 4, !tbaa !9
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.ExternalFunction, ptr %119, i32 0, i32 5
  %121 = load ptr, ptr %120, align 8, !tbaa !11
  %122 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %121, i32 0, i32 11
  %123 = getelementptr inbounds [6 x i32], ptr %122, i64 0, i64 5
  store i32 %118, ptr %123, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @ef_ptr_from_id_ptr(ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @abort() #3

declare void @ef_err_bail_out_(ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

!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 184}
!12 = !{!"", !6, i64 0, !7, i64 8, !7, i64 48, !10, i64 176, !10, i64 180, !6, i64 184}


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

@.str = external hidden unnamed_addr constant [53 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @ef_set_axis_reduction_6d_(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr nocapture noundef readonly %6) local_unnamed_addr #0 {
  %8 = tail call ptr @ef_ptr_from_id_ptr(ptr noundef %0) #3
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %7
  tail call void @abort() #4
  unreachable

11:                                               ; preds = %7
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %.off = add i32 %12, -201
  %switch = icmp ult i32 %.off, 2
  br i1 %switch, label %14, label %13

13:                                               ; preds = %11
  tail call void @ef_err_bail_out_(ptr noundef %0, ptr noundef nonnull @.str) #3
  tail call void @abort() #4
  unreachable

14:                                               ; preds = %11
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %.off49 = add i32 %15, -201
  %switch50 = icmp ult i32 %.off49, 2
  br i1 %switch50, label %17, label %16

16:                                               ; preds = %14
  tail call void @ef_err_bail_out_(ptr noundef %0, ptr noundef nonnull @.str.1) #3
  tail call void @abort() #4
  unreachable

17:                                               ; preds = %14
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %.off51 = add i32 %18, -201
  %switch52 = icmp ult i32 %.off51, 2
  br i1 %switch52, label %20, label %19

19:                                               ; preds = %17
  tail call void @ef_err_bail_out_(ptr noundef %0, ptr noundef nonnull @.str.2) #3
  tail call void @abort() #4
  unreachable

20:                                               ; preds = %17
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %.off53 = add i32 %21, -201
  %switch54 = icmp ult i32 %.off53, 2
  br i1 %switch54, label %23, label %22

22:                                               ; preds = %20
  tail call void @ef_err_bail_out_(ptr noundef %0, ptr noundef nonnull @.str.3) #3
  tail call void @abort() #4
  unreachable

23:                                               ; preds = %20
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %.off55 = add i32 %24, -201
  %switch56 = icmp ult i32 %.off55, 2
  br i1 %switch56, label %26, label %25

25:                                               ; preds = %23
  tail call void @ef_err_bail_out_(ptr noundef %0, ptr noundef nonnull @.str.4) #3
  tail call void @abort() #4
  unreachable

26:                                               ; preds = %23
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %.off57 = add i32 %27, -201
  %switch58 = icmp ult i32 %.off57, 2
  br i1 %switch58, label %29, label %28

28:                                               ; preds = %26
  tail call void @ef_err_bail_out_(ptr noundef %0, ptr noundef nonnull @.str.5) #3
  tail call void @abort() #4
  unreachable

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %8, i64 184
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds i8, ptr %31, i64 684
  store i32 %12, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %31, i64 688
  store i32 %33, ptr %34, align 4, !tbaa !5
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %31, i64 692
  store i32 %35, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %31, i64 696
  store i32 %37, ptr %38, align 4, !tbaa !5
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %31, i64 700
  store i32 %39, ptr %40, align 4, !tbaa !5
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %31, i64 704
  store i32 %41, ptr %42, align 4, !tbaa !5
  ret void
}

declare ptr @ef_ptr_from_id_ptr(ptr noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #2

declare void @ef_err_bail_out_(ptr noundef, ptr noundef) local_unnamed_addr #1

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 = { "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 = { noreturn 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 }
attributes #4 = { noreturn nounwind }

!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, !11, i64 184}
!10 = !{!"", !11, i64 0, !7, i64 8, !7, i64 48, !6, i64 176, !6, i64 180, !11, i64 184}
!11 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass