; LLVM IR from kajott/GIPS :: src/gips_core.ll (ZN4GIPS8Pipeline4initEv)

; 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.GIPS::Pipeline" = type <{ %"class.std::vector.3", i32, i32, i32, [2 x i32], %"class.GLutil::FBO", i8, [3 x i8], %"class.GLutil::Shader", i32, i8, i8, [2 x i8], float, [4 x i8] }>
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl" }
%"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl" = type { %"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.GLutil::FBO" = type { i32, i32 }
%"class.GLutil::Shader" = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8] }>

@.str.6 = external hidden unnamed_addr constant [307 x i8], align 1
@glad_glGenTextures = external global ptr, align 8
@glad_glBindTexture = external global ptr, align 8
@glad_glTexParameteri = external global ptr, align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4GIPS8Pipeline4initEv(ptr noundef nonnull align 8 dereferenceable(100) %0) #1 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 10
  %7 = load i8, ptr %6, align 4, !tbaa !9, !range !21, !noundef !22
  %8 = trunc i8 %7 to i1
  br i1 %8, label %9, label %13

9:                                                ; preds = %1
  %10 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 11
  %11 = load i8, ptr %10, align 1, !tbaa !23, !range !21, !noundef !22
  %12 = trunc i8 %11 to i1
  store i1 %12, ptr %2, align 1
  br label %47

13:                                               ; preds = %1
  %14 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 8
  %15 = call noundef zeroext i1 @_ZN6GLutil6Shader7compileEjPKc(ptr noundef nonnull align 8 dereferenceable(25) %14, i32 noundef 35633, ptr noundef @.str.6)
  %16 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 5
  %17 = call noundef zeroext i1 @_ZN6GLutil3FBO4initEv(ptr noundef nonnull align 4 dereferenceable(8) %16)
  %18 = load ptr, ptr @glad_glGenTextures, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 4
  %20 = getelementptr inbounds [2 x i32], ptr %19, i64 0, i64 0
  call void %18(i32 noundef 2, ptr noundef %20)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !24
  br label %21

21:                                               ; preds = %34, %13
  %22 = load i32, ptr %4, align 4, !tbaa !24
  %23 = icmp slt i32 %22, 2
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %37

25:                                               ; preds = %21
  %26 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 4
  %28 = load i32, ptr %4, align 4, !tbaa !24
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2 x i32], ptr %27, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !24
  call void %26(i32 noundef 3553, i32 noundef %31)
  %32 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %32(i32 noundef 3553, i32 noundef 10242, i32 noundef 33071)
  %33 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %33(i32 noundef 3553, i32 noundef 10243, i32 noundef 33071)
  br label %34

34:                                               ; preds = %25
  %35 = load i32, ptr %4, align 4, !tbaa !24
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %4, align 4, !tbaa !24
  br label %21, !llvm.loop !25

37:                                               ; preds = %24
  %38 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !5
  call void %38(i32 noundef 3553, i32 noundef 0)
  %39 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 8
  %40 = call noundef zeroext i1 @_ZNK6GLutil6Shader4goodEv(ptr noundef nonnull align 8 dereferenceable(25) %39)
  %41 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 11
  %42 = zext i1 %40 to i8
  store i8 %42, ptr %41, align 1, !tbaa !23
  %43 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 10
  store i8 1, ptr %43, align 4, !tbaa !9
  %44 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 11
  %45 = load i8, ptr %44, align 1, !tbaa !23, !range !21, !noundef !22
  %46 = trunc i8 %45 to i1
  store i1 %46, ptr %2, align 1
  br label %47

47:                                               ; preds = %37, %9
  %48 = load i1, ptr %2, align 1
  ret i1 %48
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6GLutil6Shader7compileEjPKc(ptr noundef nonnull align 8 dereferenceable(25), i32 noundef, ptr noundef) #2 align 2

declare noundef zeroext i1 @_ZN6GLutil3FBO4initEv(ptr noundef nonnull align 4 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6GLutil6Shader4goodEv(ptr noundef nonnull align 8 dereferenceable(25)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint 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 #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 = { 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 #5 = { 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++ TBAA"}
!9 = !{!10, !18, i64 92}
!10 = !{!"_ZTSN4GIPS8PipelineE", !11, i64 0, !15, i64 24, !15, i64 28, !16, i64 32, !7, i64 36, !17, i64 44, !18, i64 52, !19, i64 56, !15, i64 88, !18, i64 92, !18, i64 93, !20, i64 96}
!11 = !{!"_ZTSSt6vectorIPN4GIPS4NodeESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSN4GIPS11PixelFormatE", !7, i64 0}
!17 = !{!"_ZTSN6GLutil3FBOE", !15, i64 0, !15, i64 4}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSN6GLutil6ShaderE", !15, i64 0, !15, i64 4, !15, i64 8, !6, i64 16, !18, i64 24}
!20 = !{!"float", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!10, !18, i64 93}
!24 = !{!15, !15, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


; 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.6 = external hidden unnamed_addr constant [307 x i8], align 1
@glad_glGenTextures = external local_unnamed_addr global ptr, align 8
@glad_glBindTexture = external local_unnamed_addr global ptr, align 8
@glad_glTexParameteri = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4GIPS8Pipeline4initEv(ptr noundef nonnull align 8 dereferenceable(100) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 92
  %3 = load i8, ptr %2, align 4, !tbaa !5, !range !20, !noundef !21
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %5, label %9

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 93
  %7 = load i8, ptr %6, align 1, !tbaa !22, !range !20, !noundef !21
  %8 = trunc nuw i8 %7 to i1
  br label %29

9:                                                ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 56
  %11 = tail call noundef zeroext i1 @_ZN6GLutil6Shader7compileEjPKc(ptr noundef nonnull align 8 dereferenceable(25) %10, i32 noundef 35633, ptr noundef nonnull @.str.6)
  %12 = getelementptr inbounds i8, ptr %0, i64 44
  %13 = tail call noundef zeroext i1 @_ZN6GLutil3FBO4initEv(ptr noundef nonnull align 4 dereferenceable(8) %12)
  %14 = load ptr, ptr @glad_glGenTextures, align 8, !tbaa !23
  %15 = getelementptr inbounds i8, ptr %0, i64 36
  tail call void %14(i32 noundef 2, ptr noundef nonnull %15)
  %16 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !23
  %17 = load i32, ptr %15, align 4, !tbaa !24
  tail call void %16(i32 noundef 3553, i32 noundef %17)
  %18 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !23
  tail call void %18(i32 noundef 3553, i32 noundef 10242, i32 noundef 33071)
  %19 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !23
  tail call void %19(i32 noundef 3553, i32 noundef 10243, i32 noundef 33071)
  %20 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !23
  %21 = getelementptr inbounds i8, ptr %0, i64 40
  %22 = load i32, ptr %21, align 8, !tbaa !24
  tail call void %20(i32 noundef 3553, i32 noundef %22)
  %23 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !23
  tail call void %23(i32 noundef 3553, i32 noundef 10242, i32 noundef 33071)
  %24 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !23
  tail call void %24(i32 noundef 3553, i32 noundef 10243, i32 noundef 33071)
  %25 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !23
  tail call void %25(i32 noundef 3553, i32 noundef 0)
  %26 = tail call noundef zeroext i1 @_ZNK6GLutil6Shader4goodEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
  %27 = getelementptr inbounds i8, ptr %0, i64 93
  %28 = zext i1 %26 to i8
  store i8 %28, ptr %27, align 1, !tbaa !22
  store i8 1, ptr %2, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %9, %5
  %.04 = phi i1 [ %8, %5 ], [ %26, %9 ]
  ret i1 %.04
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6GLutil6Shader7compileEjPKc(ptr noundef nonnull align 8 dereferenceable(25), i32 noundef, ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZN6GLutil3FBO4initEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6GLutil6Shader4goodEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 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 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 = { "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 = { 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" }

!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, !17, i64 92}
!6 = !{!"_ZTSN4GIPS8PipelineE", !7, i64 0, !14, i64 24, !14, i64 28, !15, i64 32, !12, i64 36, !16, i64 44, !17, i64 52, !18, i64 56, !14, i64 88, !17, i64 92, !17, i64 93, !19, i64 96}
!7 = !{!"_ZTSSt6vectorIPN4GIPS4NodeESaIS2_EE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"int", !12, i64 0}
!15 = !{!"_ZTSN4GIPS11PixelFormatE", !12, i64 0}
!16 = !{!"_ZTSN6GLutil3FBOE", !14, i64 0, !14, i64 4}
!17 = !{!"bool", !12, i64 0}
!18 = !{!"_ZTSN6GLutil6ShaderE", !14, i64 0, !14, i64 4, !14, i64 8, !11, i64 16, !17, i64 24}
!19 = !{!"float", !12, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!6, !17, i64 93}
!23 = !{!11, !11, i64 0}
!24 = !{!14, !14, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass