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

; 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.1 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.wmouse_trafo = external hidden unnamed_addr constant [56 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @wenclose(ptr noundef, i32 noundef, i32 noundef) #1

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

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

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

16:                                               ; preds = %4
  br label %18

17:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 255, ptr noundef @__PRETTY_FUNCTION__.wmouse_trafo) #4
  unreachable

18:                                               ; preds = %16
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %18
  br label %23

22:                                               ; preds = %18
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 256, ptr noundef @__PRETTY_FUNCTION__.wmouse_trafo) #4
  unreachable

23:                                               ; preds = %21
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  br label %28

27:                                               ; preds = %23
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 257, ptr noundef @__PRETTY_FUNCTION__.wmouse_trafo) #4
  unreachable

28:                                               ; preds = %26
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %37

31:                                               ; preds = %28
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %37

34:                                               ; preds = %31
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %34, %31, %28
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %85

38:                                               ; preds = %34
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load i32, ptr %39, align 4, !tbaa !11
  store i32 %40, ptr %10, align 4, !tbaa !11
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load i32, ptr %41, align 4, !tbaa !11
  store i32 %42, ptr %11, align 4, !tbaa !11
  %43 = load i8, ptr %9, align 1, !tbaa !9, !range !13, !noundef !14
  %44 = trunc i8 %43 to i1
  br i1 %44, label %45, label %62

45:                                               ; preds = %38
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._win, ptr %46, i32 0, i32 4
  %48 = load i32, ptr %47, align 8, !tbaa !15
  %49 = load i32, ptr %10, align 4, !tbaa !11
  %50 = add nsw i32 %49, %48
  store i32 %50, ptr %10, align 4, !tbaa !11
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._win, ptr %51, i32 0, i32 5
  %53 = load i32, ptr %52, align 4, !tbaa !18
  %54 = load i32, ptr %11, align 4, !tbaa !11
  %55 = add nsw i32 %54, %53
  store i32 %55, ptr %11, align 4, !tbaa !11
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load i32, ptr %10, align 4, !tbaa !11
  %58 = load i32, ptr %11, align 4, !tbaa !11
  %59 = call zeroext i1 @wenclose(ptr noundef %56, i32 noundef %57, i32 noundef %58)
  br i1 %59, label %61, label %60

60:                                               ; preds = %45
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %85

61:                                               ; preds = %45
  br label %80

62:                                               ; preds = %38
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load i32, ptr %10, align 4, !tbaa !11
  %65 = load i32, ptr %11, align 4, !tbaa !11
  %66 = call zeroext i1 @wenclose(ptr noundef %63, i32 noundef %64, i32 noundef %65)
  br i1 %66, label %67, label %78

67:                                               ; preds = %62
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._win, ptr %68, i32 0, i32 4
  %70 = load i32, ptr %69, align 8, !tbaa !15
  %71 = load i32, ptr %10, align 4, !tbaa !11
  %72 = sub nsw i32 %71, %70
  store i32 %72, ptr %10, align 4, !tbaa !11
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._win, ptr %73, i32 0, i32 5
  %75 = load i32, ptr %74, align 4, !tbaa !18
  %76 = load i32, ptr %11, align 4, !tbaa !11
  %77 = sub nsw i32 %76, %75
  store i32 %77, ptr %11, align 4, !tbaa !11
  br label %79

78:                                               ; preds = %62
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %85

79:                                               ; preds = %67
  br label %80

80:                                               ; preds = %79, %61
  %81 = load i32, ptr %10, align 4, !tbaa !11
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %81, ptr %82, align 4, !tbaa !11
  %83 = load i32, ptr %11, align 4, !tbaa !11
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %83, ptr %84, align 4, !tbaa !11
  store i1 true, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %85

85:                                               ; preds = %80, %78, %60, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %86 = load i1, ptr %5, align 1
  ret i1 %86
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind }
attributes #4 = { 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, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !12, i64 16}
!16 = !{!"_win", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !17, i64 32, !17, i64 40, !10, i64 48, !10, i64 49, !10, i64 50, !10, i64 51, !10, i64 52, !10, i64 53, !10, i64 54, !6, i64 56, !6, i64 64, !6, i64 72, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !6, i64 104, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132}
!17 = !{!"long", !7, i64 0}
!18 = !{!16, !12, i64 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.1 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.wmouse_trafo = external hidden unnamed_addr constant [56 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @wenclose(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

5:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 255, ptr noundef nonnull @__PRETTY_FUNCTION__.wmouse_trafo) #2
  unreachable

6:                                                ; preds = %4
  %.not35 = icmp eq ptr %2, null
  br i1 %.not35, label %7, label %8

7:                                                ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 256, ptr noundef nonnull @__PRETTY_FUNCTION__.wmouse_trafo) #2
  unreachable

8:                                                ; preds = %6
  %.not36 = icmp eq ptr %1, null
  br i1 %.not36, label %9, label %10

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

10:                                               ; preds = %8
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = load i32, ptr %2, align 4, !tbaa !5
  br i1 %3, label %13, label %21

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load i32, ptr %14, align 8, !tbaa !9
  %16 = add nsw i32 %15, %11
  %17 = getelementptr inbounds i8, ptr %0, i64 20
  %18 = load i32, ptr %17, align 4, !tbaa !14
  %19 = add nsw i32 %18, %12
  %20 = tail call zeroext i1 @wenclose(ptr noundef nonnull %0, i32 noundef %16, i32 noundef %19)
  br i1 %20, label %30, label %31

21:                                               ; preds = %10
  %22 = tail call zeroext i1 @wenclose(ptr noundef nonnull %0, i32 noundef %11, i32 noundef %12)
  br i1 %22, label %23, label %31

23:                                               ; preds = %21
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load i32, ptr %24, align 8, !tbaa !9
  %26 = sub nsw i32 %11, %25
  %27 = getelementptr inbounds i8, ptr %0, i64 20
  %28 = load i32, ptr %27, align 4, !tbaa !14
  %29 = sub nsw i32 %12, %28
  br label %30

30:                                               ; preds = %13, %23
  %.030 = phi i32 [ %16, %13 ], [ %26, %23 ]
  %.0 = phi i32 [ %19, %13 ], [ %29, %23 ]
  store i32 %.030, ptr %1, align 4, !tbaa !5
  store i32 %.0, ptr %2, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %21, %13, %30
  %.031 = phi i1 [ true, %30 ], [ false, %13 ], [ false, %21 ]
  ret i1 %.031
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"_win", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !11, i64 32, !11, i64 40, !12, i64 48, !12, i64 49, !12, i64 50, !12, i64 51, !12, i64 52, !12, i64 53, !12, i64 54, !13, i64 56, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 84, !6, i64 88, !6, i64 92, !6, i64 96, !13, i64 104, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132}
!11 = !{!"long", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!10, !6, i64 20}


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