; LLVM IR from clangen/musikcube :: src/3rdparty/win32_src/pdcurses (initscr)

; 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.PDC_VERSION = type { i16, i16, i8, i8, i8, i8, i8, i32 }

@.str.2 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.PDC_get_version = external hidden unnamed_addr constant [36 x i8], align 1
@PDC_port_val = external global i32, align 4

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @PDC_get_version(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp ne ptr %3, null
  br i1 %4, label %5, label %6

5:                                                ; preds = %1
  br label %7

6:                                                ; preds = %1
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.2, i32 noundef 455, ptr noundef @__PRETTY_FUNCTION__.PDC_get_version) #2
  unreachable

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

10:                                               ; preds = %7
  br label %29

11:                                               ; preds = %7
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.PDC_VERSION, ptr %12, i32 0, i32 0
  store i16 0, ptr %13, align 4, !tbaa !9
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.PDC_VERSION, ptr %14, i32 0, i32 1
  store i16 4306, ptr %15, align 2, !tbaa !13
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.PDC_VERSION, ptr %16, i32 0, i32 2
  store i8 4, ptr %17, align 4, !tbaa !14
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.PDC_VERSION, ptr %18, i32 0, i32 3
  store i8 3, ptr %19, align 1, !tbaa !15
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.PDC_VERSION, ptr %20, i32 0, i32 4
  store i8 6, ptr %21, align 2, !tbaa !16
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.PDC_VERSION, ptr %22, i32 0, i32 5
  store i8 8, ptr %23, align 1, !tbaa !17
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.PDC_VERSION, ptr %24, i32 0, i32 6
  store i8 1, ptr %25, align 4, !tbaa !18
  %26 = load i32, ptr @PDC_port_val, align 4, !tbaa !19
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.PDC_VERSION, ptr %27, i32 0, i32 7
  store i32 %26, ptr %28, align 4, !tbaa !20
  br label %29

29:                                               ; preds = %11, %10
  ret void
}

attributes #0 = { noreturn 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 #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 = { noreturn 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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 2, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !12, i64 12}
!11 = !{!"short", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !11, i64 2}
!14 = !{!10, !7, i64 4}
!15 = !{!10, !7, i64 5}
!16 = !{!10, !7, i64 6}
!17 = !{!10, !7, i64 7}
!18 = !{!10, !7, i64 8}
!19 = !{!12, !12, i64 0}
!20 = !{!10, !12, i64 12}


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

@.str.2 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.PDC_get_version = external hidden unnamed_addr constant [36 x i8], align 1
@PDC_port_val = external local_unnamed_addr global i32, align 4

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @PDC_get_version(ptr noundef writeonly %0) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %2, label %3

2:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.2, i32 noundef 455, ptr noundef nonnull @__PRETTY_FUNCTION__.PDC_get_version) #2
  unreachable

3:                                                ; preds = %1
  store i16 0, ptr %0, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 2
  store i16 4306, ptr %4, align 2, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  store <4 x i8> <i8 4, i8 3, i8 6, i8 8>, ptr %5, align 4, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store i8 1, ptr %6, align 4, !tbaa !13
  %7 = load i32, ptr @PDC_port_val, align 4, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %7, ptr %8, align 4, !tbaa !15
  ret void
}

attributes #0 = { noreturn 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 #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 = { noreturn 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 0}
!6 = !{!"", !7, i64 0, !7, i64 2, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !10, i64 12}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 2}
!12 = !{!8, !8, i64 0}
!13 = !{!6, !8, i64 8}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 12}


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