; LLVM IR from Xingyu-Lin/softgym :: PyFlex/bindings/demo/imgui.ll (Z15imguiBeginFrameiihi)

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

@_ZL7g_state = external hidden global %struct.GuiState, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z15imguiBeginFrameiihi(i32 noundef %0, i32 noundef %1, i8 noundef zeroext %2, i32 noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i8 %2, ptr %7, align 1, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !5
  %9 = load i32, ptr %5, align 4, !tbaa !5
  %10 = load i32, ptr %6, align 4, !tbaa !5
  %11 = load i8, ptr %7, align 1, !tbaa !9
  %12 = load i32, ptr %8, align 4, !tbaa !5
  call void @_ZL11updateInputiihi(i32 noundef %9, i32 noundef %10, i8 noundef zeroext %11, i32 noundef %12)
  %13 = load i32, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 8), align 4, !tbaa !10
  store i32 %13, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 7), align 4, !tbaa !14
  store i32 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 8), align 4, !tbaa !10
  store i8 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 11), align 2, !tbaa !15
  store i8 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 10), align 1, !tbaa !16
  store i8 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 9), align 4, !tbaa !17
  store i32 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 15), align 4, !tbaa !18
  store i32 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 16), align 4, !tbaa !19
  store i32 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 17), align 4, !tbaa !20
  store i32 1, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 19), align 4, !tbaa !21
  store i32 1, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 20), align 4, !tbaa !22
  call void @_ZL16resetGfxCmdQueuev()
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL11updateInputiihi(i32 noundef, i32 noundef, i8 noundef zeroext, i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL16resetGfxCmdQueuev() #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 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 24}
!11 = !{!"_ZTS8GuiState", !12, i64 0, !12, i64 1, !12, i64 2, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !12, i64 28, !12, i64 29, !12, i64 30, !6, i64 32, !6, i64 36, !13, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !12, i64 56, !6, i64 60, !6, i64 64}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!11, !6, i64 20}
!15 = !{!11, !12, i64 30}
!16 = !{!11, !12, i64 29}
!17 = !{!11, !12, i64 28}
!18 = !{!11, !6, i64 44}
!19 = !{!11, !6, i64 48}
!20 = !{!11, !6, i64 52}
!21 = !{!11, !6, i64 60}
!22 = !{!11, !6, i64 64}


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

%struct.GuiState = type { i8, i8, i8, i32, i32, i32, i32, i32, i32, i8, i8, i8, i32, i32, float, i32, i32, i32, i8, i32, i32 }

@_ZL7g_state = external hidden local_unnamed_addr global %struct.GuiState, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z15imguiBeginFrameiihi(i32 noundef %0, i32 noundef %1, i8 noundef zeroext %2, i32 noundef %3) local_unnamed_addr #0 {
  tail call void @_ZL11updateInputiihi(i32 noundef %0, i32 noundef %1, i8 noundef zeroext %2, i32 noundef %3)
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 24), align 4, !tbaa !5
  store i32 %5, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 20), align 4, !tbaa !12
  store i32 0, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 44), align 4, !tbaa !13
  store i32 0, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 48), align 4, !tbaa !14
  store i32 0, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 52), align 4, !tbaa !15
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(7) getelementptr inbounds (i8, ptr @_ZL7g_state, i64 24), i8 0, i64 7, i1 false)
  store i32 1, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 60), align 4, !tbaa !16
  store i32 1, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 64), align 4, !tbaa !17
  tail call void @_ZL16resetGfxCmdQueuev()
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL11updateInputiihi(i32 noundef, i32 noundef, i8 noundef zeroext, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL16resetGfxCmdQueuev() local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { mustprogress 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 nounwind willreturn memory(argmem: write) }

!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 24}
!6 = !{!"_ZTS8GuiState", !7, i64 0, !7, i64 1, !7, i64 2, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 28, !7, i64 29, !7, i64 30, !10, i64 32, !10, i64 36, !11, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !7, i64 56, !10, i64 60, !10, i64 64}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 20}
!13 = !{!6, !10, i64 44}
!14 = !{!6, !10, i64 48}
!15 = !{!6, !10, i64 52}
!16 = !{!6, !10, i64 60}
!17 = !{!6, !10, i64 64}


; Effective O3 passes: GlobalOptPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass