; LLVM IR from libtcod/libtcod :: src/libtcod (lex_c)

; 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.TCOD_lex_t = type { i32, i32, i32, i32, float, ptr, i32, i8, ptr, ptr, ptr, ptr, i32, i32, i32, [100 x [5 x i8]], [100 x [20 x i8]], ptr, ptr, ptr, ptr, ptr, i8, i8, i8 }

; Function Attrs: nounwind uwtable
define dso_local void @TCOD_lex_set_data_buffer_internal(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.TCOD_lex_t, ptr %3, i32 0, i32 0
  store i32 1, ptr %4, align 8, !tbaa !9
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.TCOD_lex_t, ptr %5, i32 0, i32 9
  %7 = load ptr, ptr %6, align 8, !tbaa !14
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.TCOD_lex_t, ptr %8, i32 0, i32 8
  store ptr %7, ptr %9, align 8, !tbaa !15
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.TCOD_lex_t, ptr %10, i32 0, i32 1
  store i32 0, ptr %11, align 4, !tbaa !16
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.TCOD_lex_t, ptr %12, i32 0, i32 2
  store i32 0, ptr %13, align 8, !tbaa !17
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.TCOD_lex_t, ptr %14, i32 0, i32 4
  store float 0.000000e+00, ptr %15, align 8, !tbaa !18
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.TCOD_lex_t, ptr %16, i32 0, i32 3
  store i32 -1, ptr %17, align 4, !tbaa !19
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.TCOD_lex_t, ptr %18, i32 0, i32 5
  %20 = load ptr, ptr %19, align 8, !tbaa !20
  %21 = getelementptr inbounds i8, ptr %20, i64 0
  store i8 0, ptr %21, align 1, !tbaa !21
  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, !11, i64 0}
!10 = !{!"TCOD_lex_t", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !12, i64 16, !6, i64 24, !11, i64 32, !7, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !7, i64 84, !7, i64 584, !6, i64 2584, !6, i64 2592, !6, i64 2600, !6, i64 2608, !6, i64 2616, !13, i64 2624, !13, i64 2625, !13, i64 2626}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !6, i64 48}
!15 = !{!10, !6, i64 40}
!16 = !{!10, !11, i64 4}
!17 = !{!10, !11, i64 8}
!18 = !{!10, !12, i64 16}
!19 = !{!10, !11, i64 12}
!20 = !{!10, !6, i64 24}
!21 = !{!7, !7, i64 0}


; 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(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @TCOD_lex_set_data_buffer_internal(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 48
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %3, ptr %4, align 8, !tbaa !13
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  store float 0.000000e+00, ptr %5, align 8, !tbaa !14
  store <4 x i32> <i32 1, i32 0, i32 0, i32 -1>, ptr %0, align 8, !tbaa !15
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load ptr, ptr %6, align 8, !tbaa !16
  store i8 0, ptr %7, align 1, !tbaa !17
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) 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, !11, i64 48}
!6 = !{!"TCOD_lex_t", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !11, i64 24, !7, i64 32, !8, i64 36, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !7, i64 72, !7, i64 76, !7, i64 80, !8, i64 84, !8, i64 584, !11, i64 2584, !11, i64 2592, !11, i64 2600, !11, i64 2608, !11, i64 2616, !12, i64 2624, !12, i64 2625, !12, i64 2626}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_Bool", !8, i64 0}
!13 = !{!6, !11, i64 40}
!14 = !{!6, !10, i64 16}
!15 = !{!7, !7, i64 0}
!16 = !{!6, !11, i64 24}
!17 = !{!8, !8, i64 0}


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