; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_MatNd)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.193 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.195 = external hidden unnamed_addr constant [9 x i8], align 1
@__func__.MatNd_setBlockZero = external hidden unnamed_addr constant [19 x i8], align 1
@.str.211 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.212 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.213 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.214 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.215 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.216 = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

declare void @print_trace() #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @MatNd_set(ptr noundef, i32 noundef, i32 noundef, double noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @MatNd_setBlockZero(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #4 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  br label %13

13:                                               ; preds = %5
  %14 = load i32, ptr %9, align 4, !tbaa !9
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = icmp uge i32 %14, %15
  br i1 %16, label %26, label %17

17:                                               ; preds = %13
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_setBlockZero, i32 noundef 3381, ptr noundef @.str.193) #5
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str.211, i32 noundef %21, i32 noundef %22) #5
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

26:                                               ; preds = %13
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = icmp uge i32 %30, %31
  br i1 %32, label %42, label %33

33:                                               ; preds = %29
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_setBlockZero, i32 noundef 3382, ptr noundef @.str.195) #5
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str.212, i32 noundef %37, i32 noundef %38) #5
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

42:                                               ; preds = %29
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._MatNd, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = icmp ugt i32 %48, %49
  br i1 %50, label %62, label %51

51:                                               ; preds = %45
  %52 = load ptr, ptr @stderr, align 8, !tbaa !5
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_setBlockZero, i32 noundef 3383, ptr noundef @.str.213) #5
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._MatNd, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 8, !tbaa !11
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.214, i32 noundef %57, i32 noundef %58) #5
  %60 = load ptr, ptr @stderr, align 8, !tbaa !5
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

62:                                               ; preds = %45
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._MatNd, ptr %66, i32 0, i32 2
  %68 = load i32, ptr %67, align 4, !tbaa !14
  %69 = load i32, ptr %10, align 4, !tbaa !9
  %70 = icmp ugt i32 %68, %69
  br i1 %70, label %82, label %71

71:                                               ; preds = %65
  %72 = load ptr, ptr @stderr, align 8, !tbaa !5
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_setBlockZero, i32 noundef 3384, ptr noundef @.str.215) #5
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._MatNd, ptr %75, i32 0, i32 2
  %77 = load i32, ptr %76, align 4, !tbaa !14
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.216, i32 noundef %77, i32 noundef %78) #5
  %80 = load ptr, ptr @stderr, align 8, !tbaa !5
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

82:                                               ; preds = %65
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %85, ptr %11, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %104, %84
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = load i32, ptr %9, align 4, !tbaa !9
  %89 = icmp ule i32 %87, %88
  br i1 %89, label %90, label %107

90:                                               ; preds = %86
  %91 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %91, ptr %12, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %100, %90
  %93 = load i32, ptr %12, align 4, !tbaa !9
  %94 = load i32, ptr %10, align 4, !tbaa !9
  %95 = icmp ule i32 %93, %94
  br i1 %95, label %96, label %103

96:                                               ; preds = %92
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = load i32, ptr %12, align 4, !tbaa !9
  call void @MatNd_set(ptr noundef %97, i32 noundef %98, i32 noundef %99, double noundef 0.000000e+00)
  br label %100

100:                                              ; preds = %96
  %101 = load i32, ptr %12, align 4, !tbaa !9
  %102 = add i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !9
  br label %92, !llvm.loop !15

103:                                              ; preds = %92
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = add i32 %105, 1
  store i32 %106, ptr %11, align 4, !tbaa !9
  br label %86, !llvm.loop !17

107:                                              ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  ret void
}

attributes #0 = { 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" }
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" }
attributes #2 = { noreturn 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" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 }
attributes #6 = { noreturn 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_MatNd", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 20}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!12, !10, i64 12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.193 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.195 = external hidden unnamed_addr constant [9 x i8], align 1
@__func__.MatNd_setBlockZero = external hidden unnamed_addr constant [19 x i8], align 1
@.str.211 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.212 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.213 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.214 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.215 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.216 = external hidden unnamed_addr constant [30 x i8], align 1

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

declare void @print_trace() local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @MatNd_set(ptr noundef, i32 noundef, i32 noundef, double noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @MatNd_setBlockZero(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #3 {
  %.not = icmp ult i32 %3, %1
  br i1 %.not, label %6, label %13

6:                                                ; preds = %5
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_setBlockZero, i32 noundef 3381, ptr noundef nonnull @.str.193) #4
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.211, i32 noundef %3, i32 noundef %1) #4
  %11 = load ptr, ptr @stderr, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

13:                                               ; preds = %5
  %.not33 = icmp ult i32 %4, %2
  br i1 %.not33, label %14, label %21

14:                                               ; preds = %13
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_setBlockZero, i32 noundef 3382, ptr noundef nonnull @.str.195) #4
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.212, i32 noundef %4, i32 noundef %2) #4
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

21:                                               ; preds = %13
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = icmp ugt i32 %23, %3
  br i1 %24, label %33, label %25

25:                                               ; preds = %21
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_setBlockZero, i32 noundef 3383, ptr noundef nonnull @.str.213) #4
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = load i32, ptr %22, align 8, !tbaa !9
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.214, i32 noundef %29, i32 noundef %3) #4
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

33:                                               ; preds = %21
  %34 = getelementptr inbounds i8, ptr %0, i64 12
  %35 = load i32, ptr %34, align 4, !tbaa !13
  %36 = icmp ugt i32 %35, %4
  br i1 %36, label %.preheader, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_setBlockZero, i32 noundef 3384, ptr noundef nonnull @.str.215) #4
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  %41 = load i32, ptr %34, align 4, !tbaa !13
  %42 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.216, i32 noundef %41, i32 noundef %4) #4
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

.preheader:                                       ; preds = %33, %._crit_edge
  %.02640 = phi i32 [ %47, %._crit_edge ], [ %1, %33 ]
  br label %45

45:                                               ; preds = %.preheader, %45
  %.038 = phi i32 [ %2, %.preheader ], [ %46, %45 ]
  tail call void @MatNd_set(ptr noundef %0, i32 noundef %.02640, i32 noundef %.038, double noundef 0.000000e+00)
  %46 = add i32 %.038, 1
  %.not35 = icmp ugt i32 %46, %4
  br i1 %.not35, label %._crit_edge, label %45, !llvm.loop !14

._crit_edge:                                      ; preds = %45
  %47 = add i32 %.02640, 1
  %.not34 = icmp ugt i32 %47, %3
  br i1 %.not34, label %._crit_edge41, label %.preheader, !llvm.loop !16

._crit_edge41:                                    ; preds = %._crit_edge
  ret void
}

attributes #0 = { 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" }
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" }
attributes #2 = { noreturn 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" }
attributes #3 = { 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 #4 = { cold nounwind }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_MatNd", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 20}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !11, i64 12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass