; LLVM IR from FSmallenburg/EDMD :: Grow (mdgrow)

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

@shellsize = external dso_local global double, align 8
@stop = external dso_local global i32, align 4
@xsize = external dso_local global double, align 8
@ysize = external dso_local global double, align 8
@zsize = external dso_local global double, align 8
@cxsize = external dso_local global double, align 8
@cysize = external dso_local global double, align 8
@czsize = external dso_local global double, align 8
@celllist = external dso_local global [75 x [75 x [75 x ptr]]], align 16
@cx = external dso_local global i32, align 4
@cy = external dso_local global i32, align 4
@cz = external dso_local global i32, align 4
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @initcelllist() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %5 = load double, ptr @xsize, align 8, !tbaa !5
  %6 = fsub double %5, 1.000000e-04
  %7 = fptosi double %6 to i32
  %8 = sitofp i32 %7 to double
  %9 = load double, ptr @shellsize, align 8, !tbaa !5
  %10 = fdiv double %8, %9
  %11 = fptosi double %10 to i32
  store i32 %11, ptr @cx, align 4, !tbaa !9
  %12 = load double, ptr @ysize, align 8, !tbaa !5
  %13 = fsub double %12, 1.000000e-04
  %14 = fptosi double %13 to i32
  %15 = sitofp i32 %14 to double
  %16 = load double, ptr @shellsize, align 8, !tbaa !5
  %17 = fdiv double %15, %16
  %18 = fptosi double %17 to i32
  store i32 %18, ptr @cy, align 4, !tbaa !9
  %19 = load double, ptr @zsize, align 8, !tbaa !5
  %20 = fsub double %19, 1.000000e-04
  %21 = fptosi double %20 to i32
  %22 = sitofp i32 %21 to double
  %23 = load double, ptr @shellsize, align 8, !tbaa !5
  %24 = fdiv double %22, %23
  %25 = fptosi double %24 to i32
  store i32 %25, ptr @cz, align 4, !tbaa !9
  %26 = load i32, ptr @cx, align 4, !tbaa !9
  %27 = load i32, ptr @cy, align 4, !tbaa !9
  %28 = load i32, ptr @cz, align 4, !tbaa !9
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %26, i32 noundef %27, i32 noundef %28)
  %30 = load i32, ptr @cx, align 4, !tbaa !9
  %31 = icmp sge i32 %30, 75
  br i1 %31, label %38, label %32

32:                                               ; preds = %0
  %33 = load i32, ptr @cy, align 4, !tbaa !9
  %34 = icmp sge i32 %33, 75
  br i1 %34, label %38, label %35

35:                                               ; preds = %32
  %36 = load i32, ptr @cz, align 4, !tbaa !9
  %37 = icmp sge i32 %36, 75
  br i1 %37, label %38, label %40

38:                                               ; preds = %35, %32, %0
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  store i32 1, ptr @stop, align 4, !tbaa !9
  store i32 1, ptr %4, align 4
  br label %86

40:                                               ; preds = %35
  %41 = load double, ptr @xsize, align 8, !tbaa !5
  %42 = load i32, ptr @cx, align 4, !tbaa !9
  %43 = sitofp i32 %42 to double
  %44 = fdiv double %41, %43
  store double %44, ptr @cxsize, align 8, !tbaa !5
  %45 = load double, ptr @ysize, align 8, !tbaa !5
  %46 = load i32, ptr @cy, align 4, !tbaa !9
  %47 = sitofp i32 %46 to double
  %48 = fdiv double %45, %47
  store double %48, ptr @cysize, align 8, !tbaa !5
  %49 = load double, ptr @zsize, align 8, !tbaa !5
  %50 = load i32, ptr @cz, align 4, !tbaa !9
  %51 = sitofp i32 %50 to double
  %52 = fdiv double %49, %51
  store double %52, ptr @czsize, align 8, !tbaa !5
  store i32 0, ptr %1, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %82, %40
  %54 = load i32, ptr %1, align 4, !tbaa !9
  %55 = icmp slt i32 %54, 75
  br i1 %55, label %56, label %85

56:                                               ; preds = %53
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %78, %56
  %58 = load i32, ptr %2, align 4, !tbaa !9
  %59 = icmp slt i32 %58, 75
  br i1 %59, label %60, label %81

60:                                               ; preds = %57
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %74, %60
  %62 = load i32, ptr %3, align 4, !tbaa !9
  %63 = icmp slt i32 %62, 75
  br i1 %63, label %64, label %77

64:                                               ; preds = %61
  %65 = load i32, ptr %1, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [75 x [75 x [75 x ptr]]], ptr @celllist, i64 0, i64 %66
  %68 = load i32, ptr %2, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [75 x [75 x ptr]], ptr %67, i64 0, i64 %69
  %71 = load i32, ptr %3, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [75 x ptr], ptr %70, i64 0, i64 %72
  store ptr null, ptr %73, align 8, !tbaa !11
  br label %74

74:                                               ; preds = %64
  %75 = load i32, ptr %3, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %3, align 4, !tbaa !9
  br label %61, !llvm.loop !13

77:                                               ; preds = %61
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %2, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %2, align 4, !tbaa !9
  br label %57, !llvm.loop !15

81:                                               ; preds = %57
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %1, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %1, align 4, !tbaa !9
  br label %53, !llvm.loop !16

85:                                               ; preds = %53
  store i32 0, ptr %4, align 4
  br label %86

86:                                               ; preds = %85, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  %87 = load i32, ptr %4, align 4
  switch i32 %87, label %89 [
    i32 0, label %88
    i32 1, label %88
  ]

88:                                               ; preds = %86, %86
  ret void

89:                                               ; preds = %86
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 = !{!"double", !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, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

@shellsize = external dso_local local_unnamed_addr global double, align 8
@stop = external dso_local local_unnamed_addr global i32, align 4
@xsize = external dso_local local_unnamed_addr global double, align 8
@ysize = external dso_local local_unnamed_addr global double, align 8
@zsize = external dso_local local_unnamed_addr global double, align 8
@cxsize = external dso_local local_unnamed_addr global double, align 8
@cysize = external dso_local local_unnamed_addr global double, align 8
@czsize = external dso_local local_unnamed_addr global double, align 8
@celllist = external dso_local local_unnamed_addr global [75 x [75 x [75 x ptr]]], align 16
@cx = external dso_local local_unnamed_addr global i32, align 4
@cy = external dso_local local_unnamed_addr global i32, align 4
@cz = external dso_local local_unnamed_addr global i32, align 4
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @initcelllist() local_unnamed_addr #1 {
  %1 = load double, ptr @xsize, align 8, !tbaa !5
  %2 = fadd double %1, -1.000000e-04
  %3 = fptosi double %2 to i32
  %4 = sitofp i32 %3 to double
  %5 = load double, ptr @shellsize, align 8, !tbaa !5
  %6 = fdiv double %4, %5
  %7 = fptosi double %6 to i32
  store i32 %7, ptr @cx, align 4, !tbaa !9
  %8 = load double, ptr @ysize, align 8, !tbaa !5
  %9 = fadd double %8, -1.000000e-04
  %10 = fptosi double %9 to i32
  %11 = sitofp i32 %10 to double
  %12 = fdiv double %11, %5
  %13 = fptosi double %12 to i32
  store i32 %13, ptr @cy, align 4, !tbaa !9
  %14 = load double, ptr @zsize, align 8, !tbaa !5
  %15 = fadd double %14, -1.000000e-04
  %16 = fptosi double %15 to i32
  %17 = sitofp i32 %16 to double
  %18 = fdiv double %17, %5
  %19 = fptosi double %18 to i32
  store i32 %19, ptr @cz, align 4, !tbaa !9
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %7, i32 noundef %13, i32 noundef %19)
  %21 = load i32, ptr @cx, align 4, !tbaa !9
  %22 = icmp sgt i32 %21, 74
  %23 = load i32, ptr @cy, align 4
  %24 = icmp sgt i32 %23, 74
  %or.cond = select i1 %22, i1 true, i1 %24
  %25 = load i32, ptr @cz, align 4
  %26 = icmp sgt i32 %25, 74
  %or.cond3 = select i1 %or.cond, i1 true, i1 %26
  br i1 %or.cond3, label %27, label %.loopexit.loopexit

27:                                               ; preds = %0
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  store i32 1, ptr @stop, align 4, !tbaa !9
  br label %.loopexit

.loopexit.loopexit:                               ; preds = %0
  %29 = load double, ptr @xsize, align 8, !tbaa !5
  %30 = sitofp i32 %21 to double
  %31 = fdiv double %29, %30
  store double %31, ptr @cxsize, align 8, !tbaa !5
  %32 = load double, ptr @ysize, align 8, !tbaa !5
  %33 = sitofp i32 %23 to double
  %34 = fdiv double %32, %33
  store double %34, ptr @cysize, align 8, !tbaa !5
  %35 = load double, ptr @zsize, align 8, !tbaa !5
  %36 = sitofp i32 %25 to double
  %37 = fdiv double %35, %36
  store double %37, ptr @czsize, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3375000) @celllist, i8 0, i64 3375000, i1 false), !tbaa !11
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %27
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { 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 #1 = { nofree 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"double", !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, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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