; LLVM IR from yettabaa/cub3D :: Mandatory (rendering_wall)

; 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_data = type { double, double, double, double, double, double, double, double, double, double, i32, double, double, ptr, %struct.s_sprites, %struct.s_minimap, %struct.s_door, %struct.s_textures, %struct.s_hook, %struct.s_map_result, %struct.s_rycast, %struct.s_mlx, ptr }
%struct.s_sprites = type { ptr, i32, i32, i32, i32, i32, i32 }
%struct.s_minimap = type { double, double, double, double, double }
%struct.s_door = type { ptr, i32, i32, i32 }
%struct.s_textures = type { i32, ptr, i32, i32, i32, ptr, i32, i32, i32, ptr, i32, i32, i32, ptr, i32, i32, i32, ptr, i32, i32, i32 }
%struct.s_hook = type { double, i32, double, double, double }
%struct.s_map_result = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i8 }
%struct.s_rycast = type { double, double, double, double, double, double, double, double, double }
%struct.s_mlx = type { ptr, ptr, ptr, ptr, ptr, i32, i32, i32 }

; 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

; Function Attrs: nounwind uwtable
declare dso_local void @fill_textures(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @dda_textures(ptr noundef, double noundef, double noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @rendering_wall(ptr noundef %0, double noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %7 = call double @rad(double noundef 3.000000e+01)
  %8 = call double @tan(double noundef %7) #4
  %9 = fdiv double 8.000000e+02, %8
  store double %9, ptr %5, align 8, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.s_data, ptr %10, i32 0, i32 2
  %12 = load double, ptr %11, align 8, !tbaa !11
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.s_data, ptr %13, i32 0, i32 6
  %15 = load double, ptr %14, align 8, !tbaa !22
  %16 = fdiv double %12, %15
  %17 = load double, ptr %5, align 8, !tbaa !9
  %18 = fmul double %16, %17
  store double %18, ptr %6, align 8, !tbaa !9
  %19 = load double, ptr %6, align 8, !tbaa !9
  %20 = fdiv double %19, 2.000000e+00
  %21 = fsub double 5.000000e+02, %20
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.s_data, ptr %22, i32 0, i32 11
  store double %21, ptr %23, align 8, !tbaa !23
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.s_data, ptr %24, i32 0, i32 11
  %26 = load double, ptr %25, align 8, !tbaa !23
  %27 = load double, ptr %6, align 8, !tbaa !9
  %28 = fadd double %26, %27
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.s_data, ptr %29, i32 0, i32 12
  store double %28, ptr %30, align 8, !tbaa !24
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = load double, ptr %4, align 8, !tbaa !9
  %33 = call i32 @is(ptr noundef %31, double noundef %32, i32 noundef 2)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %42, label %35

35:                                               ; preds = %2
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.s_data, ptr %36, i32 0, i32 20
  %38 = getelementptr inbounds %struct.s_rycast, ptr %37, i32 0, i32 2
  %39 = load double, ptr %38, align 8, !tbaa !25
  %40 = fptosi double %39 to i32
  %41 = icmp eq i32 %40, 180
  br i1 %41, label %42, label %50

42:                                               ; preds = %35, %2
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.s_data, ptr %43, i32 0, i32 17
  %45 = getelementptr inbounds %struct.s_textures, ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !26
  %47 = icmp eq i32 %46, 7
  br i1 %47, label %48, label %50

48:                                               ; preds = %42
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  call void @fill_textures(ptr noundef %49, i32 noundef 15)
  br label %92

50:                                               ; preds = %42, %35
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = load double, ptr %4, align 8, !tbaa !9
  %53 = call i32 @is(ptr noundef %51, double noundef %52, i32 noundef 3)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %63

55:                                               ; preds = %50
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.s_data, ptr %56, i32 0, i32 17
  %58 = getelementptr inbounds %struct.s_textures, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !26
  %60 = icmp eq i32 %59, 7
  br i1 %60, label %61, label %63

61:                                               ; preds = %55
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  call void @fill_textures(ptr noundef %62, i32 noundef 16)
  br label %91

63:                                               ; preds = %55, %50
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = load double, ptr %4, align 8, !tbaa !9
  %66 = call i32 @is(ptr noundef %64, double noundef %65, i32 noundef 4)
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %76

68:                                               ; preds = %63
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.s_data, ptr %69, i32 0, i32 17
  %71 = getelementptr inbounds %struct.s_textures, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !26
  %73 = icmp eq i32 %72, 8
  br i1 %73, label %74, label %76

74:                                               ; preds = %68
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  call void @fill_textures(ptr noundef %75, i32 noundef 18)
  br label %90

76:                                               ; preds = %68, %63
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = load double, ptr %4, align 8, !tbaa !9
  %79 = call i32 @is(ptr noundef %77, double noundef %78, i32 noundef 5)
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %89

81:                                               ; preds = %76
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.s_data, ptr %82, i32 0, i32 17
  %84 = getelementptr inbounds %struct.s_textures, ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 8, !tbaa !26
  %86 = icmp eq i32 %85, 8
  br i1 %86, label %87, label %89

87:                                               ; preds = %81
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  call void @fill_textures(ptr noundef %88, i32 noundef 17)
  br label %89

89:                                               ; preds = %87, %81, %76
  br label %90

90:                                               ; preds = %89, %74
  br label %91

91:                                               ; preds = %90, %61
  br label %92

92:                                               ; preds = %91, %48
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.s_data, ptr %94, i32 0, i32 11
  %96 = load double, ptr %95, align 8, !tbaa !23
  call void @dda_textures(ptr noundef %93, double noundef 0.000000e+00, double noundef %96, i32 noundef 20)
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.s_data, ptr %98, i32 0, i32 11
  %100 = load double, ptr %99, align 8, !tbaa !23
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.s_data, ptr %101, i32 0, i32 12
  %103 = load double, ptr %102, align 8, !tbaa !24
  call void @dda_textures(ptr noundef %97, double noundef %100, double noundef %103, i32 noundef 19)
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.s_data, ptr %105, i32 0, i32 12
  %107 = load double, ptr %106, align 8, !tbaa !24
  call void @dda_textures(ptr noundef %104, double noundef %107, double noundef 1.000000e+03, i32 noundef 21)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

; Function Attrs: nounwind
declare double @tan(double noundef) #2

declare double @rad(double noundef) #3

declare i32 @is(ptr noundef, double noundef, i32 noundef) #3

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

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"s_data", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !13, i64 80, !10, i64 88, !10, i64 96, !6, i64 104, !14, i64 112, !15, i64 144, !16, i64 184, !17, i64 208, !18, i64 336, !19, i64 376, !20, i64 456, !21, i64 528, !6, i64 584}
!13 = !{!"int", !7, i64 0}
!14 = !{!"s_sprites", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28}
!15 = !{!"s_minimap", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!16 = !{!"s_door", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!17 = !{!"s_textures", !13, i64 0, !6, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !6, i64 56, !13, i64 64, !13, i64 68, !13, i64 72, !6, i64 80, !13, i64 88, !13, i64 92, !13, i64 96, !6, i64 104, !13, i64 112, !13, i64 116, !13, i64 120}
!18 = !{!"s_hook", !10, i64 0, !13, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!19 = !{!"s_map_result", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !7, i64 72}
!20 = !{!"s_rycast", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!21 = !{!"s_mlx", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48}
!22 = !{!12, !10, i64 48}
!23 = !{!12, !10, i64 88}
!24 = !{!12, !10, i64 96}
!25 = !{!12, !10, i64 472}
!26 = !{!12, !13, i64 208}


; 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
declare dso_local void @fill_textures(ptr noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @rendering_wall(ptr noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = tail call double @rad(double noundef 3.000000e+01) #3
  %4 = tail call double @tan(double noundef %3) #3
  %5 = fdiv double 8.000000e+02, %4
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = load double, ptr %8, align 8, !tbaa !20
  %10 = fdiv double %7, %9
  %11 = fmul double %5, %10
  %12 = fmul double %11, 5.000000e-01
  %13 = fsub double 5.000000e+02, %12
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  store double %13, ptr %14, align 8, !tbaa !21
  %15 = fadd double %11, %13
  %16 = getelementptr inbounds i8, ptr %0, i64 96
  store double %15, ptr %16, align 8, !tbaa !22
  %17 = tail call i32 @is(ptr noundef %0, double noundef %1, i32 noundef 2) #3
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %18, label %23

18:                                               ; preds = %2
  %19 = getelementptr inbounds i8, ptr %0, i64 472
  %20 = load double, ptr %19, align 8, !tbaa !23
  %21 = fptosi double %20 to i32
  %22 = icmp eq i32 %21, 180
  br i1 %22, label %23, label %27

23:                                               ; preds = %18, %2
  %24 = getelementptr inbounds i8, ptr %0, i64 208
  %25 = load i32, ptr %24, align 8, !tbaa !24
  %26 = icmp eq i32 %25, 7
  br i1 %26, label %.sink.split, label %27

27:                                               ; preds = %23, %18
  %28 = tail call i32 @is(ptr noundef nonnull %0, double noundef %1, i32 noundef 3) #3
  %.not32 = icmp eq i32 %28, 0
  br i1 %.not32, label %33, label %29

29:                                               ; preds = %27
  %30 = getelementptr inbounds i8, ptr %0, i64 208
  %31 = load i32, ptr %30, align 8, !tbaa !24
  %32 = icmp eq i32 %31, 7
  br i1 %32, label %.sink.split, label %33

33:                                               ; preds = %29, %27
  %34 = tail call i32 @is(ptr noundef nonnull %0, double noundef %1, i32 noundef 4) #3
  %.not33 = icmp eq i32 %34, 0
  br i1 %.not33, label %39, label %35

35:                                               ; preds = %33
  %36 = getelementptr inbounds i8, ptr %0, i64 208
  %37 = load i32, ptr %36, align 8, !tbaa !24
  %38 = icmp eq i32 %37, 8
  br i1 %38, label %.sink.split, label %39

39:                                               ; preds = %35, %33
  %40 = tail call i32 @is(ptr noundef nonnull %0, double noundef %1, i32 noundef 5) #3
  %.not34 = icmp eq i32 %40, 0
  br i1 %.not34, label %45, label %41

41:                                               ; preds = %39
  %42 = getelementptr inbounds i8, ptr %0, i64 208
  %43 = load i32, ptr %42, align 8, !tbaa !24
  %44 = icmp eq i32 %43, 8
  br i1 %44, label %.sink.split, label %45

.sink.split:                                      ; preds = %41, %35, %29, %23
  %.sink = phi i32 [ 15, %23 ], [ 16, %29 ], [ 18, %35 ], [ 17, %41 ]
  tail call void @fill_textures(ptr noundef nonnull %0, i32 noundef %.sink)
  br label %45

45:                                               ; preds = %.sink.split, %39, %41
  %46 = load double, ptr %14, align 8, !tbaa !21
  tail call void @dda_textures(ptr noundef nonnull %0, double noundef 0.000000e+00, double noundef %46, i32 noundef 20)
  %47 = load double, ptr %14, align 8, !tbaa !21
  %48 = load double, ptr %16, align 8, !tbaa !22
  tail call void @dda_textures(ptr noundef nonnull %0, double noundef %47, double noundef %48, i32 noundef 19)
  %49 = load double, ptr %16, align 8, !tbaa !22
  tail call void @dda_textures(ptr noundef nonnull %0, double noundef %49, double noundef 1.000000e+03, i32 noundef 21)
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @tan(double noundef) local_unnamed_addr #1

declare double @rad(double noundef) local_unnamed_addr #2

declare i32 @is(ptr noundef, double noundef, i32 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 nofree nounwind willreturn memory(write) "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 = { "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, !7, i64 16}
!6 = !{!"s_data", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !10, i64 80, !7, i64 88, !7, i64 96, !11, i64 104, !12, i64 112, !13, i64 144, !14, i64 184, !15, i64 208, !16, i64 336, !17, i64 376, !18, i64 456, !19, i64 528, !11, i64 584}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"s_sprites", !11, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!13 = !{!"s_minimap", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!14 = !{!"s_door", !11, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!15 = !{!"s_textures", !10, i64 0, !11, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !11, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !11, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !11, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !11, i64 104, !10, i64 112, !10, i64 116, !10, i64 120}
!16 = !{!"s_hook", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!17 = !{!"s_map_result", !10, i64 0, !10, i64 4, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !8, i64 72}
!18 = !{!"s_rycast", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64}
!19 = !{!"s_mlx", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !10, i64 40, !10, i64 44, !10, i64 48}
!20 = !{!6, !7, i64 48}
!21 = !{!6, !7, i64 88}
!22 = !{!6, !7, i64 96}
!23 = !{!6, !7, i64 472}
!24 = !{!6, !10, i64 208}


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