; LLVM IR from yettabaa/FdF :: fdf (initialisation_bonus)

; 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.s_colect = type { i32, i32, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, %struct.s_mlx }
%struct.s_mlx = type { ptr, ptr, ptr, ptr, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local void @initialisation_bonus(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.s_colect, ptr %9, i32 0, i32 1
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %12 = icmp sgt i32 %11, 100
  br i1 %12, label %13, label %28

13:                                               ; preds = %4
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.s_colect, ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = sdiv i32 1200, %16
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.s_colect, ptr %18, i32 0, i32 6
  store i32 %17, ptr %19, align 8, !tbaa !15
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.s_colect, ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = sdiv i32 1200, %22
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.s_colect, ptr %24, i32 0, i32 7
  store i32 %23, ptr %25, align 4, !tbaa !16
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.s_colect, ptr %26, i32 0, i32 8
  store i32 2, ptr %27, align 8, !tbaa !17
  br label %49

28:                                               ; preds = %4
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.s_colect, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = sdiv i32 800, %31
  %33 = sitofp i32 %32 to double
  %34 = fmul double %33, 8.000000e-01
  %35 = fptosi double %34 to i32
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.s_colect, ptr %36, i32 0, i32 6
  store i32 %35, ptr %37, align 8, !tbaa !15
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.s_colect, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = sdiv i32 800, %40
  %42 = sitofp i32 %41 to double
  %43 = fmul double %42, 8.000000e-01
  %44 = fptosi double %43 to i32
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.s_colect, ptr %45, i32 0, i32 7
  store i32 %44, ptr %46, align 4, !tbaa !16
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.s_colect, ptr %47, i32 0, i32 8
  store i32 3, ptr %48, align 8, !tbaa !17
  br label %49

49:                                               ; preds = %28, %13
  %50 = load i32, ptr %6, align 4, !tbaa !9
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.s_colect, ptr %51, i32 0, i32 9
  store i32 %50, ptr %52, align 4, !tbaa !18
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.s_colect, ptr %54, i32 0, i32 10
  store i32 %53, ptr %55, align 8, !tbaa !19
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.s_colect, ptr %57, i32 0, i32 11
  store i32 %56, ptr %58, align 4, !tbaa !20
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.s_colect, ptr %59, i32 0, i32 12
  store i32 680, ptr %60, align 8, !tbaa !21
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.s_colect, ptr %61, i32 0, i32 13
  store i32 400, ptr %62, align 4, !tbaa !22
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.s_colect, ptr %63, i32 0, i32 15
  store i32 0, ptr %64, align 4, !tbaa !23
  ret void
}

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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"s_colect", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !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, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !14, i64 104}
!13 = !{!"double", !7, i64 0}
!14 = !{!"s_mlx", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40}
!15 = !{!12, !10, i64 32}
!16 = !{!12, !10, i64 36}
!17 = !{!12, !10, i64 40}
!18 = !{!12, !10, i64 44}
!19 = !{!12, !10, i64 48}
!20 = !{!12, !10, i64 52}
!21 = !{!12, !10, i64 56}
!22 = !{!12, !10, i64 60}
!23 = !{!12, !10, i64 68}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @initialisation_bonus(ptr nocapture noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 100
  br i1 %7, label %8, label %10

8:                                                ; preds = %4
  %9 = udiv i32 1200, %6
  br label %15

10:                                               ; preds = %4
  %11 = sdiv i32 800, %6
  %12 = sitofp i32 %11 to double
  %13 = fmul double %12, 8.000000e-01
  %14 = fptosi double %13 to i32
  br label %15

15:                                               ; preds = %10, %8
  %.sink20 = phi i32 [ %9, %8 ], [ %14, %10 ]
  %.sink = phi i32 [ 2, %8 ], [ 3, %10 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink20, ptr %16, align 8
  %17 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %.sink20, ptr %17, align 4
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %.sink, ptr %18, align 8
  %19 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %1, ptr %19, align 4, !tbaa !13
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %2, ptr %20, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %3, ptr %21, align 4, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 680, ptr %22, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %0, i64 60
  store i32 400, ptr %23, align 4, !tbaa !17
  %24 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 0, ptr %24, align 4, !tbaa !18
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !7, i64 4}
!6 = !{!"s_colect", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !12, i64 104}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"s_mlx", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 36, !7, i64 40}
!13 = !{!6, !7, i64 44}
!14 = !{!6, !7, i64 48}
!15 = !{!6, !7, i64 52}
!16 = !{!6, !7, i64 56}
!17 = !{!6, !7, i64 60}
!18 = !{!6, !7, i64 68}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InstCombinePass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass