; LLVM IR from yettabaa/cub3D :: bonus (render_wall_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_object = type { i32, double, double, double, double, i32, double, double, double, double, double, ptr }

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @render_objects(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s_object, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 96, ptr %6) #3
  br label %7

7:                                                ; preds = %35, %2
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %41

10:                                               ; preds = %7
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %11, ptr %5, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %31, %10
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %35

15:                                               ; preds = %12
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.s_object, ptr %16, i32 0, i32 4
  %18 = load double, ptr %17, align 8, !tbaa !9
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.s_object, ptr %19, i32 0, i32 4
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = fcmp olt double %18, %21
  br i1 %22, label %23, label %31

23:                                               ; preds = %15
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call ptr @ft_memmove(ptr noundef %6, ptr noundef %24, i64 noundef 88)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call ptr @ft_memmove(ptr noundef %26, ptr noundef %27, i64 noundef 88)
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = call ptr @ft_memmove(ptr noundef %29, ptr noundef %6, i64 noundef 88)
  br label %31

31:                                               ; preds = %23, %15
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.s_object, ptr %32, i32 0, i32 11
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  store ptr %34, ptr %5, align 8, !tbaa !5
  br label %12, !llvm.loop !14

35:                                               ; preds = %12
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  call void @texel_object(ptr noundef %36, ptr noundef %37)
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.s_object, ptr %38, i32 0, i32 11
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  store ptr %40, ptr %4, align 8, !tbaa !5
  br label %7, !llvm.loop !16

41:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 96, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

declare ptr @ft_memmove(ptr noundef, ptr noundef, i64 noundef) #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 = { 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 = { 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, !12, i64 32}
!10 = !{!"s_object", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !11, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !6, i64 88}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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

%struct.s_object = type { i32, double, double, double, double, i32, double, double, double, double, double, ptr }

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @render_objects(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.s_object, align 8
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %3) #3
  %.not16 = icmp eq ptr %1, null
  br i1 %.not16, label %._crit_edge, label %.preheader

.preheader:                                       ; preds = %2, %17
  %.01317 = phi ptr [ %19, %17 ], [ %1, %2 ]
  %4 = getelementptr inbounds i8, ptr %.01317, i64 32
  br label %5

5:                                                ; preds = %.preheader, %14
  %.015 = phi ptr [ %.01317, %.preheader ], [ %16, %14 ]
  %6 = load double, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %.015, i64 32
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = fcmp olt double %6, %8
  br i1 %9, label %10, label %14

10:                                               ; preds = %5
  %11 = call ptr @ft_memmove(ptr noundef nonnull %3, ptr noundef nonnull %.015, i64 noundef 88) #3
  %12 = call ptr @ft_memmove(ptr noundef nonnull %.015, ptr noundef nonnull %.01317, i64 noundef 88) #3
  %13 = call ptr @ft_memmove(ptr noundef nonnull %.01317, ptr noundef nonnull %3, i64 noundef 88) #3
  br label %14

14:                                               ; preds = %10, %5
  %15 = getelementptr inbounds i8, ptr %.015, i64 88
  %16 = load ptr, ptr %15, align 8, !tbaa !12
  %.not14 = icmp eq ptr %16, null
  br i1 %.not14, label %17, label %5, !llvm.loop !13

17:                                               ; preds = %14
  call void @texel_object(ptr noundef %0, ptr noundef nonnull %.01317)
  %18 = getelementptr inbounds i8, ptr %.01317, i64 88
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %._crit_edge, label %.preheader, !llvm.loop !15

._crit_edge:                                      ; preds = %17, %2
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %3) #3
  ret void
}

declare ptr @ft_memmove(ptr noundef, ptr noundef, i64 noundef) 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 = { mustprogress 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 = { 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, !10, i64 32}
!6 = !{!"s_object", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !11, i64 88}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !11, i64 88}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass