; LLVM IR from nde-jesu/Doom_Nukem :: libbmp/srcs/setup (image)

; 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_file = type { [15 x ptr], %struct.s_info, ptr, ptr }
%struct.s_info = type { %struct.s_hdr, %struct.s_dib, i8, i8, i8, i32, i32, i32 }
%struct.s_hdr = type { i32, i32 }
%struct.s_dib = type { %struct.s_vec, %struct.s_vec, i8, i8, i8, i8, i32, i32, i32 }
%struct.s_vec = type { i32, i32 }
%struct.s_bmp = type { i32, i32, ptr }

; Function Attrs: nounwind uwtable
define dso_local void @load_image(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ft_bzero(ptr noundef %5, i64 noundef 16)
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.s_file, ptr %6, i32 0, i32 1
  %8 = getelementptr inbounds %struct.s_info, ptr %7, i32 0, i32 1
  %9 = getelementptr inbounds %struct.s_dib, ptr %8, i32 0, i32 1
  %10 = getelementptr inbounds %struct.s_vec, ptr %9, i32 0, i32 0
  %11 = load i32, ptr %10, align 8, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.s_bmp, ptr %12, i32 0, i32 0
  store i32 %11, ptr %13, align 8, !tbaa !16
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.s_file, ptr %14, i32 0, i32 1
  %16 = getelementptr inbounds %struct.s_info, ptr %15, i32 0, i32 1
  %17 = getelementptr inbounds %struct.s_dib, ptr %16, i32 0, i32 1
  %18 = getelementptr inbounds %struct.s_vec, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !18
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.s_bmp, ptr %20, i32 0, i32 1
  store i32 %19, ptr %21, align 4, !tbaa !19
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.s_file, ptr %22, i32 0, i32 3
  %24 = load ptr, ptr %23, align 8, !tbaa !20
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.s_bmp, ptr %25, i32 0, i32 2
  store ptr %24, ptr %26, align 8, !tbaa !21
  ret void
}

declare void @ft_bzero(ptr noundef, i64 noundef) #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 = { "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, !13, i64 136}
!10 = !{!"s_file", !7, i64 0, !11, i64 120, !6, i64 176, !6, i64 184}
!11 = !{!"s_info", !12, i64 0, !14, i64 8, !7, i64 40, !7, i64 41, !7, i64 42, !13, i64 44, !13, i64 48, !13, i64 52}
!12 = !{!"s_hdr", !13, i64 0, !13, i64 4}
!13 = !{!"int", !7, i64 0}
!14 = !{!"s_dib", !15, i64 0, !15, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !13, i64 20, !13, i64 24, !13, i64 28}
!15 = !{!"s_vec", !13, i64 0, !13, i64 4}
!16 = !{!17, !13, i64 0}
!17 = !{!"s_bmp", !13, i64 0, !13, i64 4, !6, i64 8}
!18 = !{!10, !13, i64 140}
!19 = !{!17, !13, i64 4}
!20 = !{!10, !6, i64 184}
!21 = !{!17, !6, i64 8}


; 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 @load_image(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  tail call void @ft_bzero(ptr noundef %1, i64 noundef 16) #2
  %3 = getelementptr inbounds i8, ptr %0, i64 136
  %4 = load <2 x i32>, ptr %3, align 8, !tbaa !5
  store <2 x i32> %4, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 184
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %6, ptr %7, align 8, !tbaa !16
  ret void
}

declare void @ft_bzero(ptr noundef, i64 noundef) local_unnamed_addr #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 = { "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 }

!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, !15, i64 184}
!10 = !{!"s_file", !7, i64 0, !11, i64 120, !15, i64 176, !15, i64 184}
!11 = !{!"s_info", !12, i64 0, !13, i64 8, !7, i64 40, !7, i64 41, !7, i64 42, !6, i64 44, !6, i64 48, !6, i64 52}
!12 = !{!"s_hdr", !6, i64 0, !6, i64 4}
!13 = !{!"s_dib", !14, i64 0, !14, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !6, i64 20, !6, i64 24, !6, i64 28}
!14 = !{!"s_vec", !6, i64 0, !6, i64 4}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!17, !15, i64 8}
!17 = !{!"s_bmp", !6, i64 0, !6, i64 4, !15, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass