; LLVM IR from cieslarmichal/rpg :: src/Input.ll (ZN5Input4readEv)

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

%class.Input = type { [2 x i32] }

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN5Input4readEv(ptr noundef nonnull align 4 dereferenceable(8) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %5 = getelementptr inbounds [2 x i32], ptr %4, i64 0, i64 0
  store i32 -1, ptr %5, align 4, !tbaa !9
  %6 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %7 = getelementptr inbounds [2 x i32], ptr %6, i64 0, i64 1
  store i32 -1, ptr %7, align 4, !tbaa !9
  %8 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 73)
  br i1 %8, label %9, label %12

9:                                                ; preds = %1
  %10 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %11 = getelementptr inbounds [2 x i32], ptr %10, i64 0, i64 0
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %30

12:                                               ; preds = %1
  %13 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 74)
  br i1 %13, label %14, label %17

14:                                               ; preds = %12
  %15 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %16 = getelementptr inbounds [2 x i32], ptr %15, i64 0, i64 0
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %29

17:                                               ; preds = %12
  %18 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 71)
  br i1 %18, label %19, label %22

19:                                               ; preds = %17
  %20 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %21 = getelementptr inbounds [2 x i32], ptr %20, i64 0, i64 0
  store i32 2, ptr %21, align 4, !tbaa !9
  br label %28

22:                                               ; preds = %17
  %23 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 72)
  br i1 %23, label %24, label %27

24:                                               ; preds = %22
  %25 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %26 = getelementptr inbounds [2 x i32], ptr %25, i64 0, i64 0
  store i32 3, ptr %26, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %24, %22
  br label %28

28:                                               ; preds = %27, %19
  br label %29

29:                                               ; preds = %28, %14
  br label %30

30:                                               ; preds = %29, %9
  %31 = call noundef zeroext i1 @_ZN2sf5Mouse15isButtonPressedENS0_6ButtonE(i32 noundef 0)
  br i1 %31, label %32, label %35

32:                                               ; preds = %30
  %33 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %34 = getelementptr inbounds [2 x i32], ptr %33, i64 0, i64 1
  store i32 4, ptr %34, align 4, !tbaa !9
  br label %65

35:                                               ; preds = %30
  %36 = call noundef zeroext i1 @_ZN2sf5Mouse15isButtonPressedENS0_6ButtonE(i32 noundef 1)
  br i1 %36, label %37, label %40

37:                                               ; preds = %35
  %38 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %39 = getelementptr inbounds [2 x i32], ptr %38, i64 0, i64 1
  store i32 5, ptr %39, align 4, !tbaa !9
  br label %64

40:                                               ; preds = %35
  %41 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 4)
  br i1 %41, label %42, label %45

42:                                               ; preds = %40
  %43 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %44 = getelementptr inbounds [2 x i32], ptr %43, i64 0, i64 1
  store i32 6, ptr %44, align 4, !tbaa !9
  br label %63

45:                                               ; preds = %40
  %46 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 60)
  br i1 %46, label %47, label %50

47:                                               ; preds = %45
  %48 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %49 = getelementptr inbounds [2 x i32], ptr %48, i64 0, i64 1
  store i32 7, ptr %49, align 4, !tbaa !9
  br label %62

50:                                               ; preds = %45
  %51 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 16)
  br i1 %51, label %52, label %55

52:                                               ; preds = %50
  %53 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %54 = getelementptr inbounds [2 x i32], ptr %53, i64 0, i64 1
  store i32 8, ptr %54, align 4, !tbaa !9
  br label %61

55:                                               ; preds = %50
  %56 = call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 23)
  br i1 %56, label %57, label %60

57:                                               ; preds = %55
  %58 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %59 = getelementptr inbounds [2 x i32], ptr %58, i64 0, i64 1
  store i32 9, ptr %59, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %57, %55
  br label %61

61:                                               ; preds = %60, %52
  br label %62

62:                                               ; preds = %61, %47
  br label %63

63:                                               ; preds = %62, %42
  br label %64

64:                                               ; preds = %63, %37
  br label %65

65:                                               ; preds = %64, %32
  %66 = getelementptr inbounds %class.Input, ptr %3, i32 0, i32 0
  %67 = getelementptr inbounds [2 x i32], ptr %66, i64 0, i64 0
  ret ptr %67
}

declare noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef) #1

declare noundef zeroext i1 @_ZN2sf5Mouse15isButtonPressedENS0_6ButtonE(i32 noundef) #1

attributes #0 = { mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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 uwtable
define dso_local noundef nonnull ptr @_ZN5Input4readEv(ptr noundef nonnull returned writeonly align 4 dereferenceable(8) %0) local_unnamed_addr #0 align 2 {
  store i32 -1, ptr %0, align 4, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 -1, ptr %2, align 4, !tbaa !5
  %3 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 73)
  br i1 %3, label %.sink.split, label %4

4:                                                ; preds = %1
  %5 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 74)
  br i1 %5, label %.sink.split, label %6

6:                                                ; preds = %4
  %7 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 71)
  br i1 %7, label %.sink.split, label %8

8:                                                ; preds = %6
  %9 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 72)
  br i1 %9, label %.sink.split, label %10

.sink.split:                                      ; preds = %8, %6, %4, %1
  %.sink = phi i32 [ 0, %1 ], [ 1, %4 ], [ 2, %6 ], [ 3, %8 ]
  store i32 %.sink, ptr %0, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %.sink.split, %8
  %11 = tail call noundef zeroext i1 @_ZN2sf5Mouse15isButtonPressedENS0_6ButtonE(i32 noundef 0)
  br i1 %11, label %.sink.split1, label %12

12:                                               ; preds = %10
  %13 = tail call noundef zeroext i1 @_ZN2sf5Mouse15isButtonPressedENS0_6ButtonE(i32 noundef 1)
  br i1 %13, label %.sink.split1, label %14

14:                                               ; preds = %12
  %15 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 4)
  br i1 %15, label %.sink.split1, label %16

16:                                               ; preds = %14
  %17 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 60)
  br i1 %17, label %.sink.split1, label %18

18:                                               ; preds = %16
  %19 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 16)
  br i1 %19, label %.sink.split1, label %20

20:                                               ; preds = %18
  %21 = tail call noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef 23)
  br i1 %21, label %.sink.split1, label %22

.sink.split1:                                     ; preds = %20, %18, %16, %14, %12, %10
  %.sink2 = phi i32 [ 4, %10 ], [ 5, %12 ], [ 6, %14 ], [ 7, %16 ], [ 8, %18 ], [ 9, %20 ]
  store i32 %.sink2, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %.sink.split1, %20
  ret ptr %0
}

declare noundef zeroext i1 @_ZN2sf8Keyboard12isKeyPressedENS0_3KeyE(i32 noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN2sf5Mouse15isButtonPressedENS0_6ButtonE(i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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