; LLVM IR from NOAA-PMEL/Ferret :: fer/ef_utility (ef_set_work_array_lens_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] }

; Function Attrs: nounwind uwtable
define dso_local void @ef_set_work_array_lens_6d_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #0 {
  %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
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = sub nsw i32 %20, 1
  store i32 %21, ptr %18, align 4, !tbaa !9
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = call ptr @ef_ptr_from_id_ptr(ptr noundef %22)
  store ptr %23, ptr %17, align 8, !tbaa !5
  %24 = load ptr, ptr %17, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %8
  call void @abort() #5
  unreachable

27:                                               ; preds = %8
  %28 = load ptr, ptr %17, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ExternalFunction, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %30, i32 0, i32 8
  %32 = load i32, ptr %18, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [9 x [6 x i32]], ptr %31, i64 0, i64 %33
  %35 = getelementptr inbounds [6 x i32], ptr %34, i64 0, i64 0
  store i32 1, ptr %35, align 4, !tbaa !9
  %36 = load ptr, ptr %17, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ExternalFunction, ptr %36, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %38, i32 0, i32 8
  %40 = load i32, ptr %18, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [9 x [6 x i32]], ptr %39, i64 0, i64 %41
  %43 = getelementptr inbounds [6 x i32], ptr %42, i64 0, i64 1
  store i32 1, ptr %43, align 4, !tbaa !9
  %44 = load ptr, ptr %17, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ExternalFunction, ptr %44, i32 0, i32 5
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %46, i32 0, i32 8
  %48 = load i32, ptr %18, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [9 x [6 x i32]], ptr %47, i64 0, i64 %49
  %51 = getelementptr inbounds [6 x i32], ptr %50, i64 0, i64 2
  store i32 1, ptr %51, align 4, !tbaa !9
  %52 = load ptr, ptr %17, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ExternalFunction, ptr %52, i32 0, i32 5
  %54 = load ptr, ptr %53, align 8, !tbaa !11
  %55 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %54, i32 0, i32 8
  %56 = load i32, ptr %18, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [9 x [6 x i32]], ptr %55, i64 0, i64 %57
  %59 = getelementptr inbounds [6 x i32], ptr %58, i64 0, i64 3
  store i32 1, ptr %59, align 4, !tbaa !9
  %60 = load ptr, ptr %17, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.ExternalFunction, ptr %60, i32 0, i32 5
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %62, i32 0, i32 8
  %64 = load i32, ptr %18, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [9 x [6 x i32]], ptr %63, i64 0, i64 %65
  %67 = getelementptr inbounds [6 x i32], ptr %66, i64 0, i64 4
  store i32 1, ptr %67, align 4, !tbaa !9
  %68 = load ptr, ptr %17, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.ExternalFunction, ptr %68, i32 0, i32 5
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  %71 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %70, i32 0, i32 8
  %72 = load i32, ptr %18, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [9 x [6 x i32]], ptr %71, i64 0, i64 %73
  %75 = getelementptr inbounds [6 x i32], ptr %74, i64 0, i64 5
  store i32 1, ptr %75, align 4, !tbaa !9
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = load ptr, ptr %17, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.ExternalFunction, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !11
  %81 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %80, i32 0, i32 9
  %82 = load i32, ptr %18, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [9 x [6 x i32]], ptr %81, i64 0, i64 %83
  %85 = getelementptr inbounds [6 x i32], ptr %84, i64 0, i64 0
  store i32 %77, ptr %85, align 4, !tbaa !9
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = load ptr, ptr %17, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ExternalFunction, ptr %88, i32 0, i32 5
  %90 = load ptr, ptr %89, align 8, !tbaa !11
  %91 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %90, i32 0, i32 9
  %92 = load i32, ptr %18, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [9 x [6 x i32]], ptr %91, i64 0, i64 %93
  %95 = getelementptr inbounds [6 x i32], ptr %94, i64 0, i64 1
  store i32 %87, ptr %95, align 4, !tbaa !9
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = load ptr, ptr %17, 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 9
  %102 = load i32, ptr %18, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [9 x [6 x i32]], ptr %101, i64 0, i64 %103
  %105 = getelementptr inbounds [6 x i32], ptr %104, i64 0, i64 2
  store i32 %97, ptr %105, align 4, !tbaa !9
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = load ptr, ptr %17, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.ExternalFunction, ptr %108, i32 0, i32 5
  %110 = load ptr, ptr %109, align 8, !tbaa !11
  %111 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %110, i32 0, i32 9
  %112 = load i32, ptr %18, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [9 x [6 x i32]], ptr %111, i64 0, i64 %113
  %115 = getelementptr inbounds [6 x i32], ptr %114, i64 0, i64 3
  store i32 %107, ptr %115, align 4, !tbaa !9
  %116 = load ptr, ptr %15, align 8, !tbaa !5
  %117 = load i32, ptr %116, align 4, !tbaa !9
  %118 = load ptr, ptr %17, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ExternalFunction, ptr %118, i32 0, i32 5
  %120 = load ptr, ptr %119, align 8, !tbaa !11
  %121 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %120, i32 0, i32 9
  %122 = load i32, ptr %18, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [9 x [6 x i32]], ptr %121, i64 0, i64 %123
  %125 = getelementptr inbounds [6 x i32], ptr %124, i64 0, i64 4
  store i32 %117, ptr %125, align 4, !tbaa !9
  %126 = load ptr, ptr %16, align 8, !tbaa !5
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = load ptr, ptr %17, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.ExternalFunction, ptr %128, i32 0, i32 5
  %130 = load ptr, ptr %129, align 8, !tbaa !11
  %131 = getelementptr inbounds %struct.ExternalFunctionInternals, ptr %130, i32 0, i32 9
  %132 = load i32, ptr %18, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [9 x [6 x i32]], ptr %131, i64 0, i64 %133
  %135 = getelementptr inbounds [6 x i32], ptr %134, i64 0, i64 5
  store i32 %127, ptr %135, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #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

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

; Function Attrs: nounwind uwtable
define dso_local void @ef_set_work_array_lens_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, ptr nocapture noundef readonly %7) local_unnamed_addr #0 {
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = tail call ptr @ef_ptr_from_id_ptr(ptr noundef %0) #3
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %8
  tail call void @abort() #4
  unreachable

13:                                               ; preds = %8
  %14 = add nsw i32 %9, -1
  %15 = getelementptr inbounds i8, ptr %10, i64 184
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %16, i64 228
  %18 = sext i32 %14 to i64
  %19 = getelementptr inbounds [9 x [6 x i32]], ptr %17, i64 0, i64 %18
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %19, align 4, !tbaa !5
  %20 = getelementptr inbounds [9 x [6 x i32]], ptr %17, i64 0, i64 %18, i64 4
  store i32 1, ptr %20, align 4, !tbaa !5
  %21 = getelementptr inbounds [9 x [6 x i32]], ptr %17, i64 0, i64 %18, i64 5
  store i32 1, ptr %21, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %16, i64 444
  %24 = getelementptr inbounds [9 x [6 x i32]], ptr %23, i64 0, i64 %18
  store i32 %22, ptr %24, align 4, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = getelementptr inbounds [9 x [6 x i32]], ptr %23, i64 0, i64 %18, i64 1
  store i32 %25, ptr %26, align 4, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = getelementptr inbounds [9 x [6 x i32]], ptr %23, i64 0, i64 %18, i64 2
  store i32 %27, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = getelementptr inbounds [9 x [6 x i32]], ptr %23, i64 0, i64 %18, i64 3
  store i32 %29, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = getelementptr inbounds [9 x [6 x i32]], ptr %23, i64 0, i64 %18, i64 4
  store i32 %31, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = getelementptr inbounds [9 x [6 x i32]], ptr %23, i64 0, i64 %18, i64 5
  store i32 %33, ptr %34, 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

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,SLPVectorizerPass,SROAPass,TailCallElimPass