; LLVM IR from aap/librw :: src/ps2/ps2.ll (ZN2rw3ps211MatPipeline4dumpEv)

; 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.rw::Pipeline" = type { i32, i32, i32 }
%"class.rw::ps2::MatPipeline" = type { %"class.rw::Pipeline", i32, i32, i32, i32, [10 x ptr], ptr, ptr, ptr, ptr }
%"struct.rw::ps2::PipeAttribute" = type { ptr, i32 }

@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [2 x i8], align 1

; 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 void @_ZN2rw3ps211MatPipeline4dumpEv(ptr noundef nonnull align 8 dereferenceable(144) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %"class.rw::Pipeline", ptr %5, i32 0, i32 2
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = icmp ne i32 %7, 4
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  br label %62

10:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %11 = getelementptr inbounds %"class.rw::Pipeline", ptr %5, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !12
  %13 = getelementptr inbounds %"class.rw::Pipeline", ptr %5, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, i32 noundef %12, i32 noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !14
  br label %16

16:                                               ; preds = %39, %10
  %17 = load i32, ptr %4, align 4, !tbaa !14
  %18 = zext i32 %17 to i64
  %19 = icmp ult i64 %18, 10
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %42

21:                                               ; preds = %16
  %22 = getelementptr inbounds %"class.rw::ps2::MatPipeline", ptr %5, i32 0, i32 5
  %23 = load i32, ptr %4, align 4, !tbaa !14
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [10 x ptr], ptr %22, i64 0, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  store ptr %26, ptr %3, align 8, !tbaa !5
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %38

29:                                               ; preds = %21
  %30 = load i32, ptr %4, align 4, !tbaa !14
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.rw::ps2::PipeAttribute", ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.rw::ps2::PipeAttribute", ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 8, !tbaa !17
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, i32 noundef %30, ptr noundef %33, i32 noundef %36)
  br label %38

38:                                               ; preds = %29, %21
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %4, align 4, !tbaa !14
  %41 = add i32 %40, 1
  store i32 %41, ptr %4, align 4, !tbaa !14
  br label %16, !llvm.loop !18

42:                                               ; preds = %20
  %43 = getelementptr inbounds %"class.rw::ps2::MatPipeline", ptr %5, i32 0, i32 2
  %44 = load i32, ptr %43, align 8, !tbaa !20
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %44)
  %46 = getelementptr inbounds %"class.rw::ps2::MatPipeline", ptr %5, i32 0, i32 1
  %47 = load i32, ptr %46, align 4, !tbaa !22
  %48 = getelementptr inbounds %"class.rw::ps2::MatPipeline", ptr %5, i32 0, i32 2
  %49 = load i32, ptr %48, align 8, !tbaa !20
  %50 = udiv i32 %47, %49
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, i32 noundef %50)
  %52 = getelementptr inbounds %"class.rw::ps2::MatPipeline", ptr %5, i32 0, i32 3
  %53 = load i32, ptr %52, align 4, !tbaa !23
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %53)
  %55 = getelementptr inbounds %"class.rw::ps2::MatPipeline", ptr %5, i32 0, i32 4
  %56 = load i32, ptr %55, align 8, !tbaa !24
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.22, i32 noundef %56)
  %58 = getelementptr inbounds %"class.rw::ps2::MatPipeline", ptr %5, i32 0, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !22
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.23, i32 noundef %59)
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.24)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %62

62:                                               ; preds = %42, %9
  ret void
}

declare i32 @printf(ptr noundef, ...) #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 = { "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 = { 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, !11, i64 8}
!10 = !{!"_ZTSN2rw8PipelineE", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSN2rw3ps213PipeAttributeE", !6, i64 0, !11, i64 8}
!17 = !{!16, !11, i64 8}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !11, i64 16}
!21 = !{!"_ZTSN2rw3ps211MatPipelineE", !10, i64 0, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !7, i64 32, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136}
!22 = !{!21, !11, i64 12}
!23 = !{!21, !11, i64 20}
!24 = !{!21, !11, i64 24}


; 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.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local void @_ZN2rw3ps211MatPipeline4dumpEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(144) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i32 %3, 4
  br i1 %.not, label %4, label %106

4:                                                ; preds = %1
  %5 = load i32, ptr %0, align 8, !tbaa !10
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, i32 noundef %5, i32 noundef %7)
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %.not9 = icmp eq ptr %10, null
  br i1 %.not9, label %16, label %11

11:                                               ; preds = %4
  %12 = load ptr, ptr %10, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %10, i64 8
  %14 = load i32, ptr %13, align 8, !tbaa !16
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 0, ptr noundef %12, i32 noundef %14)
  br label %16

16:                                               ; preds = %4, %11
  %17 = getelementptr inbounds i8, ptr %0, i64 40
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %.not9.1 = icmp eq ptr %18, null
  br i1 %.not9.1, label %24, label %19

19:                                               ; preds = %16
  %20 = load ptr, ptr %18, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %18, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !16
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 1, ptr noundef %20, i32 noundef %22)
  br label %24

24:                                               ; preds = %19, %16
  %25 = getelementptr inbounds i8, ptr %0, i64 48
  %26 = load ptr, ptr %25, align 8, !tbaa !12
  %.not9.2 = icmp eq ptr %26, null
  br i1 %.not9.2, label %32, label %27

27:                                               ; preds = %24
  %28 = load ptr, ptr %26, align 8, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %26, i64 8
  %30 = load i32, ptr %29, align 8, !tbaa !16
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 2, ptr noundef %28, i32 noundef %30)
  br label %32

32:                                               ; preds = %27, %24
  %33 = getelementptr inbounds i8, ptr %0, i64 56
  %34 = load ptr, ptr %33, align 8, !tbaa !12
  %.not9.3 = icmp eq ptr %34, null
  br i1 %.not9.3, label %40, label %35

35:                                               ; preds = %32
  %36 = load ptr, ptr %34, align 8, !tbaa !14
  %37 = getelementptr inbounds i8, ptr %34, i64 8
  %38 = load i32, ptr %37, align 8, !tbaa !16
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 3, ptr noundef %36, i32 noundef %38)
  br label %40

40:                                               ; preds = %35, %32
  %41 = getelementptr inbounds i8, ptr %0, i64 64
  %42 = load ptr, ptr %41, align 8, !tbaa !12
  %.not9.4 = icmp eq ptr %42, null
  br i1 %.not9.4, label %48, label %43

43:                                               ; preds = %40
  %44 = load ptr, ptr %42, align 8, !tbaa !14
  %45 = getelementptr inbounds i8, ptr %42, i64 8
  %46 = load i32, ptr %45, align 8, !tbaa !16
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 4, ptr noundef %44, i32 noundef %46)
  br label %48

48:                                               ; preds = %43, %40
  %49 = getelementptr inbounds i8, ptr %0, i64 72
  %50 = load ptr, ptr %49, align 8, !tbaa !12
  %.not9.5 = icmp eq ptr %50, null
  br i1 %.not9.5, label %56, label %51

51:                                               ; preds = %48
  %52 = load ptr, ptr %50, align 8, !tbaa !14
  %53 = getelementptr inbounds i8, ptr %50, i64 8
  %54 = load i32, ptr %53, align 8, !tbaa !16
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 5, ptr noundef %52, i32 noundef %54)
  br label %56

56:                                               ; preds = %51, %48
  %57 = getelementptr inbounds i8, ptr %0, i64 80
  %58 = load ptr, ptr %57, align 8, !tbaa !12
  %.not9.6 = icmp eq ptr %58, null
  br i1 %.not9.6, label %64, label %59

59:                                               ; preds = %56
  %60 = load ptr, ptr %58, align 8, !tbaa !14
  %61 = getelementptr inbounds i8, ptr %58, i64 8
  %62 = load i32, ptr %61, align 8, !tbaa !16
  %63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 6, ptr noundef %60, i32 noundef %62)
  br label %64

64:                                               ; preds = %59, %56
  %65 = getelementptr inbounds i8, ptr %0, i64 88
  %66 = load ptr, ptr %65, align 8, !tbaa !12
  %.not9.7 = icmp eq ptr %66, null
  br i1 %.not9.7, label %72, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr %66, align 8, !tbaa !14
  %69 = getelementptr inbounds i8, ptr %66, i64 8
  %70 = load i32, ptr %69, align 8, !tbaa !16
  %71 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 7, ptr noundef %68, i32 noundef %70)
  br label %72

72:                                               ; preds = %67, %64
  %73 = getelementptr inbounds i8, ptr %0, i64 96
  %74 = load ptr, ptr %73, align 8, !tbaa !12
  %.not9.8 = icmp eq ptr %74, null
  br i1 %.not9.8, label %80, label %75

75:                                               ; preds = %72
  %76 = load ptr, ptr %74, align 8, !tbaa !14
  %77 = getelementptr inbounds i8, ptr %74, i64 8
  %78 = load i32, ptr %77, align 8, !tbaa !16
  %79 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 8, ptr noundef %76, i32 noundef %78)
  br label %80

80:                                               ; preds = %75, %72
  %81 = getelementptr inbounds i8, ptr %0, i64 104
  %82 = load ptr, ptr %81, align 8, !tbaa !12
  %.not9.9 = icmp eq ptr %82, null
  br i1 %.not9.9, label %88, label %83

83:                                               ; preds = %80
  %84 = load ptr, ptr %82, align 8, !tbaa !14
  %85 = getelementptr inbounds i8, ptr %82, i64 8
  %86 = load i32, ptr %85, align 8, !tbaa !16
  %87 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, i32 noundef 9, ptr noundef %84, i32 noundef %86)
  br label %88

88:                                               ; preds = %83, %80
  %89 = getelementptr inbounds i8, ptr %0, i64 16
  %90 = load i32, ptr %89, align 8, !tbaa !17
  %91 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %90)
  %92 = getelementptr inbounds i8, ptr %0, i64 12
  %93 = load i32, ptr %92, align 4, !tbaa !19
  %94 = load i32, ptr %89, align 8, !tbaa !17
  %95 = udiv i32 %93, %94
  %96 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, i32 noundef %95)
  %97 = getelementptr inbounds i8, ptr %0, i64 20
  %98 = load i32, ptr %97, align 4, !tbaa !20
  %99 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %98)
  %100 = getelementptr inbounds i8, ptr %0, i64 24
  %101 = load i32, ptr %100, align 8, !tbaa !21
  %102 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22, i32 noundef %101)
  %103 = load i32, ptr %92, align 4, !tbaa !19
  %104 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23, i32 noundef %103)
  %105 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24)
  br label %106

106:                                              ; preds = %1, %88
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { mustprogress nofree 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 = { nofree 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" }

!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, !7, i64 8}
!6 = !{!"_ZTSN2rw8PipelineE", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"_ZTSN2rw3ps213PipeAttributeE", !13, i64 0, !7, i64 8}
!16 = !{!15, !7, i64 8}
!17 = !{!18, !7, i64 16}
!18 = !{!"_ZTSN2rw3ps211MatPipelineE", !6, i64 0, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !8, i64 32, !13, i64 112, !13, i64 120, !13, i64 128, !13, i64 136}
!19 = !{!18, !7, i64 12}
!20 = !{!18, !7, i64 20}
!21 = !{!18, !7, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass