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

; 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._win = type { i32, i32, i32, i32, i32, i32, i32, i64, i64, i8, i8, i8, i8, i8, i8, i8, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, i32 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@__PRETTY_FUNCTION__.wdeleteln = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @wdeleteln(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %1
  br label %13

12:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 64, ptr noundef @__PRETTY_FUNCTION__.wdeleteln) #5
  unreachable

13:                                               ; preds = %11
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %102

17:                                               ; preds = %13
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._win, ptr %18, i32 0, i32 8
  %20 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %20, ptr %4, align 8, !tbaa !14
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._win, ptr %21, i32 0, i32 16
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._win, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !16
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds ptr, ptr %23, i64 %27
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr %29, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._win, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !16
  store i32 %32, ptr %7, align 4, !tbaa !17
  br label %33

33:                                               ; preds = %56, %17
  %34 = load i32, ptr %7, align 4, !tbaa !17
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._win, ptr %35, i32 0, i32 20
  %37 = load i32, ptr %36, align 4, !tbaa !18
  %38 = icmp slt i32 %34, %37
  br i1 %38, label %39, label %59

39:                                               ; preds = %33
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._win, ptr %40, i32 0, i32 16
  %42 = load ptr, ptr %41, align 8, !tbaa !15
  %43 = load i32, ptr %7, align 4, !tbaa !17
  %44 = add nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds ptr, ptr %42, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._win, ptr %48, i32 0, i32 16
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = load i32, ptr %7, align 4, !tbaa !17
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds ptr, ptr %50, i64 %52
  store ptr %47, ptr %53, align 8, !tbaa !5
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !17
  call void @PDC_mark_line_as_changed(ptr noundef %54, i32 noundef %55)
  br label %56

56:                                               ; preds = %39
  %57 = load i32, ptr %7, align 4, !tbaa !17
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %7, align 4, !tbaa !17
  br label %33, !llvm.loop !19

59:                                               ; preds = %33
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %60, ptr %6, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %76, %59
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = ptrtoint ptr %62 to i64
  %65 = ptrtoint ptr %63 to i64
  %66 = sub i64 %64, %65
  %67 = sdiv exact i64 %66, 8
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._win, ptr %68, i32 0, i32 3
  %70 = load i32, ptr %69, align 4, !tbaa !21
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %67, %71
  br i1 %72, label %73, label %79

73:                                               ; preds = %61
  %74 = load i64, ptr %4, align 8, !tbaa !14
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 %74, ptr %75, align 8, !tbaa !14
  br label %76

76:                                               ; preds = %73
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds i64, ptr %77, i32 1
  store ptr %78, ptr %6, align 8, !tbaa !5
  br label %61, !llvm.loop !22

79:                                               ; preds = %61
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._win, ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !16
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._win, ptr %83, i32 0, i32 20
  %85 = load i32, ptr %84, align 4, !tbaa !18
  %86 = icmp sle i32 %82, %85
  br i1 %86, label %87, label %101

87:                                               ; preds = %79
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._win, ptr %89, i32 0, i32 20
  %91 = load i32, ptr %90, align 4, !tbaa !18
  call void @PDC_mark_line_as_changed(ptr noundef %88, i32 noundef %91)
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._win, ptr %93, i32 0, i32 16
  %95 = load ptr, ptr %94, align 8, !tbaa !15
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._win, ptr %96, i32 0, i32 20
  %98 = load i32, ptr %97, align 4, !tbaa !18
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds ptr, ptr %95, i64 %99
  store ptr %92, ptr %100, align 8, !tbaa !5
  br label %101

101:                                              ; preds = %87, %79
  store i32 0, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %102

102:                                              ; preds = %101, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %103 = load i32, ptr %2, align 4
  ret i32 %103
}

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

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

declare void @PDC_mark_line_as_changed(ptr noundef, i32 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 }
attributes #5 = { 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, !12, i64 40}
!10 = !{!"_win", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !12, i64 32, !12, i64 40, !13, i64 48, !13, i64 49, !13, i64 50, !13, i64 51, !13, i64 52, !13, i64 53, !13, i64 54, !6, i64 56, !6, i64 64, !6, i64 72, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !6, i64 56}
!16 = !{!10, !11, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !11, i64 84}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !11, i64 12}
!22 = distinct !{!22, !20}


; 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 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@__PRETTY_FUNCTION__.wdeleteln = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @wdeleteln(ptr noundef %0) local_unnamed_addr #0 {
  %.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, ptr noundef nonnull @.str.1, i32 noundef 64, ptr noundef nonnull @__PRETTY_FUNCTION__.wdeleteln) #3
  unreachable

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = load ptr, ptr %6, align 8, !tbaa !13
  %8 = load i32, ptr %0, align 8, !tbaa !14
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds ptr, ptr %7, i64 %9
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 84
  %13 = load i32, ptr %12, align 4, !tbaa !16
  %14 = icmp slt i32 %8, %13
  br i1 %14, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %3
  %.lcssa = phi i32 [ %13, %3 ], [ %25, %.lr.ph ]
  %15 = ptrtoint ptr %11 to i64
  %16 = getelementptr inbounds i8, ptr %0, i64 12
  %17 = load i32, ptr %16, align 4, !tbaa !17
  %18 = sext i32 %17 to i64
  %19 = icmp sgt i32 %17, 0
  br i1 %19, label %.lr.ph37, label %._crit_edge

.lr.ph:                                           ; preds = %3, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %9, %3 ]
  %20 = load ptr, ptr %6, align 8, !tbaa !13
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %21 = getelementptr inbounds ptr, ptr %20, i64 %indvars.iv.next
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = getelementptr inbounds ptr, ptr %20, i64 %indvars.iv
  store ptr %22, ptr %23, align 8, !tbaa !15
  %24 = trunc nsw i64 %indvars.iv to i32
  tail call void @PDC_mark_line_as_changed(ptr noundef nonnull %0, i32 noundef %24) #4
  %25 = load i32, ptr %12, align 4, !tbaa !16
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %.preheader, !llvm.loop !18

.lr.ph37:                                         ; preds = %.preheader, %.lr.ph37
  %.02936 = phi ptr [ %28, %.lr.ph37 ], [ %11, %.preheader ]
  store i64 %5, ptr %.02936, align 8, !tbaa !20
  %28 = getelementptr inbounds i8, ptr %.02936, i64 8
  %29 = ptrtoint ptr %28 to i64
  %30 = sub i64 %29, %15
  %31 = ashr exact i64 %30, 3
  %32 = icmp slt i64 %31, %18
  br i1 %32, label %.lr.ph37, label %._crit_edge, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph37, %.preheader
  %33 = load i32, ptr %0, align 8, !tbaa !14
  %.not33 = icmp sgt i32 %33, %.lcssa
  br i1 %.not33, label %39, label %34

34:                                               ; preds = %._crit_edge
  tail call void @PDC_mark_line_as_changed(ptr noundef nonnull %0, i32 noundef %.lcssa) #4
  %35 = load ptr, ptr %6, align 8, !tbaa !13
  %36 = load i32, ptr %12, align 4, !tbaa !16
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds ptr, ptr %35, i64 %37
  store ptr %11, ptr %38, align 8, !tbaa !15
  br label %39

39:                                               ; preds = %._crit_edge, %34
  ret i32 0
}

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

declare void @PDC_mark_line_as_changed(ptr 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 = { 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 #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 = { noreturn nounwind }
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, !10, i64 40}
!6 = !{!"_win", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !11, i64 49, !11, i64 50, !11, i64 51, !11, i64 52, !11, i64 53, !11, i64 54, !12, i64 56, !12, i64 64, !12, i64 72, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !12, i64 104, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !12, i64 56}
!14 = !{!6, !7, i64 0}
!15 = !{!12, !12, i64 0}
!16 = !{!6, !7, i64 84}
!17 = !{!6, !7, i64 12}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !10, i64 0}
!21 = distinct !{!21, !19}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass