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

; 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
@_ZL10g_scrollId = external hidden global i32, align 4
@_ZL11g_scrollTop = external hidden global i32, align 4
@_ZL14g_scrollBottom = external hidden global i32, align 4
@_ZL13g_scrollRight = external hidden global i32, align 4
@_ZL11g_scrollVal = external hidden global ptr, align 8
@_ZL15g_scrollAreaTop = external hidden global i32, align 4
@_ZL10g_focusTop = external hidden global i32, align 4
@_ZL13g_focusBottom = external hidden global i32, align 4
@_ZL18g_insideScrollArea = external hidden global i8, align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z20imguiBeginScrollAreaPKciiiiPi(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !5
  %13 = load i32, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 19), align 4, !tbaa !11
  %14 = add i32 %13, 1
  store i32 %14, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 19), align 4, !tbaa !11
  store i32 0, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 20), align 4, !tbaa !15
  %15 = load i32, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 19), align 4, !tbaa !11
  %16 = shl i32 %15, 16
  %17 = load i32, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 20), align 4, !tbaa !15
  %18 = or i32 %16, %17
  store i32 %18, ptr @_ZL10g_scrollId, align 4, !tbaa !9
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = add nsw i32 %19, 6
  store i32 %20, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 15), align 4, !tbaa !16
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = add nsw i32 %21, %22
  %24 = sub nsw i32 %23, 28
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = add nsw i32 %24, %26
  store i32 %27, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 16), align 4, !tbaa !17
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = sub nsw i32 %28, 24
  store i32 %29, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 17), align 4, !tbaa !18
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = sub nsw i32 %30, 28
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = add nsw i32 %31, %32
  store i32 %33, ptr @_ZL11g_scrollTop, align 4, !tbaa !9
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = add nsw i32 %34, 6
  store i32 %35, ptr @_ZL14g_scrollBottom, align 4, !tbaa !9
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = add nsw i32 %36, %37
  %39 = sub nsw i32 %38, 18
  store i32 %39, ptr @_ZL13g_scrollRight, align 4, !tbaa !9
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %40, ptr @_ZL11g_scrollVal, align 8, !tbaa !5
  %41 = load i32, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 16), align 4, !tbaa !17
  store i32 %41, ptr @_ZL15g_scrollAreaTop, align 4, !tbaa !9
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = sub nsw i32 %42, 28
  store i32 %43, ptr @_ZL10g_focusTop, align 4, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = sub nsw i32 %44, 28
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = add nsw i32 %45, %46
  store i32 %47, ptr @_ZL13g_focusBottom, align 4, !tbaa !9
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = load i32, ptr %11, align 4, !tbaa !9
  %52 = call noundef zeroext i1 @_Z6inRectiiiib(i32 noundef %48, i32 noundef %49, i32 noundef %50, i32 noundef %51, i1 noundef zeroext false)
  %53 = zext i1 %52 to i8
  store i8 %53, ptr @_ZL18g_insideScrollArea, align 1, !tbaa !19
  %54 = load i8, ptr @_ZL18g_insideScrollArea, align 1, !tbaa !19, !range !20, !noundef !21
  %55 = trunc i8 %54 to i1
  %56 = zext i1 %55 to i8
  store i8 %56, ptr getelementptr inbounds (%struct.GuiState, ptr @_ZL7g_state, i32 0, i32 18), align 4, !tbaa !22
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = sitofp i32 %57 to float
  %59 = load i32, ptr %9, align 4, !tbaa !9
  %60 = sitofp i32 %59 to float
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = sitofp i32 %61 to float
  %63 = load i32, ptr %11, align 4, !tbaa !9
  %64 = sitofp i32 %63 to float
  %65 = call noundef i32 @_Z9imguiRGBAhhhh(i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext -64)
  call void @_ZL20addGfxCmdRoundedRectfffffj(float noundef %58, float noundef %60, float noundef %62, float noundef %64, float noundef 6.000000e+00, i32 noundef %65)
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = add nsw i32 %66, 14
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = load i32, ptr %11, align 4, !tbaa !9
  %70 = add nsw i32 %68, %69
  %71 = sub nsw i32 %70, 14
  %72 = sub nsw i32 %71, 4
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = call noundef i32 @_Z9imguiRGBAhhhh(i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -128)
  call void @_ZL13addGfxCmdTextiiiPKcj(i32 noundef %67, i32 noundef %72, i32 noundef 0, ptr noundef %73, i32 noundef %74)
  %75 = load i32, ptr %8, align 4, !tbaa !9
  %76 = add nsw i32 %75, 6
  %77 = load i32, ptr %9, align 4, !tbaa !9
  %78 = add nsw i32 %77, 6
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = sub nsw i32 %79, 24
  %81 = load i32, ptr %11, align 4, !tbaa !9
  %82 = sub nsw i32 %81, 28
  %83 = sub nsw i32 %82, 6
  call void @_ZL16addGfxCmdScissoriiii(i32 noundef %76, i32 noundef %78, i32 noundef %80, i32 noundef %83)
  %84 = load i8, ptr @_ZL18g_insideScrollArea, align 1, !tbaa !19, !range !20, !noundef !21
  %85 = trunc i8 %84 to i1
  ret i1 %85
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z6inRectiiiib(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL20addGfxCmdRoundedRectfffffj(float noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9imguiRGBAhhhh(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL13addGfxCmdTextiiiPKcj(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL16addGfxCmdScissoriiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

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 = { inlinehint 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 #2 = { 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 = !{!"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}
!11 = !{!12, !10, i64 60}
!12 = !{!"_ZTS8GuiState", !13, i64 0, !13, i64 1, !13, i64 2, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !13, i64 28, !13, i64 29, !13, i64 30, !10, i64 32, !10, i64 36, !14, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !13, i64 56, !10, i64 60, !10, i64 64}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!12, !10, i64 64}
!16 = !{!12, !10, i64 44}
!17 = !{!12, !10, i64 48}
!18 = !{!12, !10, i64 52}
!19 = !{!13, !13, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!12, !13, i64 56}


; 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
@_ZL10g_scrollId = external hidden local_unnamed_addr global i32, align 4
@_ZL11g_scrollTop = external hidden local_unnamed_addr global i32, align 4
@_ZL14g_scrollBottom = external hidden local_unnamed_addr global i32, align 4
@_ZL13g_scrollRight = external hidden local_unnamed_addr global i32, align 4
@_ZL11g_scrollVal = external hidden local_unnamed_addr global ptr, align 8
@_ZL15g_scrollAreaTop = external hidden local_unnamed_addr global i32, align 4
@_ZL10g_focusTop = external hidden local_unnamed_addr global i32, align 4
@_ZL13g_focusBottom = external hidden local_unnamed_addr global i32, align 4
@_ZL18g_insideScrollArea = external hidden local_unnamed_addr global i8, align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z20imguiBeginScrollAreaPKciiiiPi(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 60), align 4, !tbaa !5
  %8 = add i32 %7, 1
  store i32 %8, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 60), align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 64), align 4, !tbaa !12
  %9 = shl i32 %8, 16
  store i32 %9, ptr @_ZL10g_scrollId, align 4, !tbaa !13
  %10 = add nsw i32 %1, 6
  store i32 %10, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 44), align 4, !tbaa !14
  %11 = add nsw i32 %4, %2
  %12 = add nsw i32 %11, -28
  %13 = load i32, ptr %5, align 4, !tbaa !13
  %14 = add nsw i32 %12, %13
  store i32 %14, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 48), align 4, !tbaa !15
  %15 = add nsw i32 %3, -24
  store i32 %15, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 52), align 4, !tbaa !16
  %16 = add nsw i32 %2, -28
  %17 = add nsw i32 %16, %4
  store i32 %17, ptr @_ZL11g_scrollTop, align 4, !tbaa !13
  %18 = add nsw i32 %2, 6
  store i32 %18, ptr @_ZL14g_scrollBottom, align 4, !tbaa !13
  %19 = add i32 %1, -18
  %20 = add i32 %19, %3
  store i32 %20, ptr @_ZL13g_scrollRight, align 4, !tbaa !13
  store ptr %5, ptr @_ZL11g_scrollVal, align 8, !tbaa !17
  store i32 %14, ptr @_ZL15g_scrollAreaTop, align 4, !tbaa !13
  store i32 %16, ptr @_ZL10g_focusTop, align 4, !tbaa !13
  store i32 %17, ptr @_ZL13g_focusBottom, align 4, !tbaa !13
  %21 = tail call noundef zeroext i1 @_Z6inRectiiiib(i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i1 noundef zeroext false)
  %22 = zext i1 %21 to i8
  store i8 %22, ptr @_ZL18g_insideScrollArea, align 1, !tbaa !19
  store i8 %22, ptr getelementptr inbounds (i8, ptr @_ZL7g_state, i64 56), align 4, !tbaa !20
  %23 = sitofp i32 %1 to float
  %24 = sitofp i32 %2 to float
  %25 = sitofp i32 %3 to float
  %26 = sitofp i32 %4 to float
  %27 = tail call noundef i32 @_Z9imguiRGBAhhhh(i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext -64)
  tail call void @_ZL20addGfxCmdRoundedRectfffffj(float noundef %23, float noundef %24, float noundef %25, float noundef %26, float noundef 6.000000e+00, i32 noundef %27)
  %28 = add nsw i32 %1, 14
  %29 = add nsw i32 %11, -18
  %30 = tail call noundef i32 @_Z9imguiRGBAhhhh(i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -128)
  tail call void @_ZL13addGfxCmdTextiiiPKcj(i32 noundef %28, i32 noundef %29, i32 noundef 0, ptr noundef %0, i32 noundef %30)
  %31 = add nsw i32 %4, -34
  tail call void @_ZL16addGfxCmdScissoriiii(i32 noundef %10, i32 noundef %18, i32 noundef %15, i32 noundef %31)
  %32 = load i8, ptr @_ZL18g_insideScrollArea, align 1, !tbaa !19, !range !21, !noundef !22
  %33 = trunc nuw i8 %32 to i1
  ret i1 %33
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z6inRectiiiib(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL20addGfxCmdRoundedRectfffffj(float noundef, float noundef, float noundef, float noundef, float noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9imguiRGBAhhhh(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL13addGfxCmdTextiiiPKcj(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL16addGfxCmdScissoriiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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 = { inlinehint 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 #2 = { 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, !10, i64 60}
!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 64}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !10, i64 44}
!15 = !{!6, !10, i64 48}
!16 = !{!6, !10, i64 52}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !8, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{!6, !7, i64 56}
!21 = !{i8 0, i8 2}
!22 = !{}


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