; 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
@__func__.MatNd_setColumnZero = external hidden unnamed_addr constant [20 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [29 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
define dso_local void @MatNd_setColumnZero(ptr noundef %0, i32 noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  br label %6

6:                                                ; preds = %2
  %7 = load i32, ptr %4, align 4, !tbaa !9
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct._MatNd, ptr %8, i32 0, i32 2
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = icmp ult i32 %7, %10
  br i1 %11, label %23, label %12

12:                                               ; preds = %6
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.MatNd_setColumnZero, i32 noundef 993, ptr noundef @.str.73) #5
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._MatNd, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 4, !tbaa !11
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str.74, i32 noundef %16, i32 noundef %19) #5
  %21 = load ptr, ptr @stderr, align 8, !tbaa !5
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

23:                                               ; preds = %6
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %45, %25
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._MatNd, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !14
  %31 = icmp ult i32 %27, %30
  br i1 %31, label %32, label %48

32:                                               ; preds = %26
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._MatNd, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = load i32, ptr %5, align 4, !tbaa !9
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._MatNd, ptr %37, i32 0, i32 2
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = mul i32 %36, %39
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = add i32 %40, %41
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds double, ptr %35, i64 %43
  store double 0.000000e+00, ptr %44, align 8, !tbaa !16
  br label %45

45:                                               ; preds = %32
  %46 = load i32, ptr %5, align 4, !tbaa !9
  %47 = add i32 %46, 1
  store i32 %47, ptr %5, align 4, !tbaa !9
  br label %26, !llvm.loop !18

48:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #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 12}
!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 8}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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"

@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
@__func__.MatNd_setColumnZero = external hidden unnamed_addr constant [20 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [29 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
define dso_local void @MatNd_setColumnZero(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %0, i64 12
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp ugt i32 %4, %1
  br i1 %5, label %.preheader, label %29

.preheader:                                       ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !12
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %8 = load ptr, ptr %0, align 8, !tbaa !13
  %wide.trip.count = zext i32 %7 to i64
  %min.iters.check = icmp ult i32 %7, 14
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.scevcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.scevcheck, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph.prol ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %9 = trunc nuw i64 %indvars.iv.prol to i32
  %10 = mul i32 %4, %9
  %11 = add i32 %10, %1
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds double, ptr %8, i64 %12
  store double 0.000000e+00, ptr %13, align 8, !tbaa !14
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !16

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %14 = sub nsw i64 %indvars.iv.ph, %wide.trip.count
  %15 = icmp ugt i64 %14, -4
  br i1 %15, label %._crit_edge, label %scalar.ph

vector.scevcheck:                                 ; preds = %.lr.ph
  %ident.check = icmp ne i32 %4, 1
  %16 = add nsw i64 %wide.trip.count, -1
  %17 = trunc i64 %16 to i32
  %18 = xor i32 %1, -1
  %19 = icmp ult i32 %18, %17
  %20 = icmp ugt i64 %16, 4294967295
  %21 = or i1 %19, %20
  %22 = or i1 %ident.check, %21
  br i1 %22, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i64 %wide.trip.count, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %23 = trunc i64 %index to i32
  %24 = add i32 %23, %1
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds double, ptr %8, i64 %25
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  store <2 x double> zeroinitializer, ptr %26, align 8, !tbaa !14
  store <2 x double> zeroinitializer, ptr %27, align 8, !tbaa !14
  %index.next = add nuw i64 %index, 4
  %28 = icmp eq i64 %index.next, %n.vec
  br i1 %28, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

29:                                               ; preds = %2
  %30 = load ptr, ptr @stderr, align 8, !tbaa !22
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.MatNd_setColumnZero, i32 noundef 993, ptr noundef nonnull @.str.73) #4
  %32 = load ptr, ptr @stderr, align 8, !tbaa !22
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.74, i32 noundef %1, i32 noundef %33) #4
  %35 = load ptr, ptr @stderr, align 8, !tbaa !22
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %37 = trunc nuw i64 %indvars.iv to i32
  %38 = mul i32 %4, %37
  %39 = add i32 %38, %1
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds double, ptr %8, i64 %40
  store double 0.000000e+00, ptr %41, align 8, !tbaa !14
  %42 = trunc i64 %indvars.iv to i32
  %43 = add i32 %42, 1
  %44 = mul i32 %4, %43
  %45 = add i32 %44, %1
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds double, ptr %8, i64 %46
  store double 0.000000e+00, ptr %47, align 8, !tbaa !14
  %48 = trunc i64 %indvars.iv to i32
  %49 = add i32 %48, 2
  %50 = mul i32 %4, %49
  %51 = add i32 %50, %1
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds double, ptr %8, i64 %52
  store double 0.000000e+00, ptr %53, align 8, !tbaa !14
  %54 = trunc i64 %indvars.iv to i32
  %55 = add i32 %54, 3
  %56 = mul i32 %4, %55
  %57 = add i32 %56, %1
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds double, ptr %8, i64 %58
  store double 0.000000e+00, ptr %59, align 8, !tbaa !14
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %._crit_edge, label %scalar.ph, !llvm.loop !23

._crit_edge:                                      ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %.preheader
  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, !10, i64 12}
!6 = !{!"_MatNd", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !19, !20, !21}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !19, !20}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass