; LLVM IR from hans-ob1/neural_cam_ros :: src/detector (data)

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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [7 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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare i32 @fclose(ptr noundef) #1

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

declare void @find_replace(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) #1

declare i32 @printf(ptr noundef, ...) #1

declare { i64, ptr } @make_matrix(i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local { i64, ptr } @load_tags_paths(ptr noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca %struct.matrix, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [4096 x i8], align 16
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = call { i64, ptr } @make_matrix(i32 noundef %14, i32 noundef %15)
  %17 = getelementptr inbounds { i64, ptr }, ptr %4, i32 0, i32 0
  %18 = extractvalue { i64, ptr } %16, 0
  store i64 %18, ptr %17, align 8
  %19 = getelementptr inbounds { i64, ptr }, ptr %4, i32 0, i32 1
  %20 = extractvalue { i64, ptr } %16, 1
  store ptr %20, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %75, %3
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %25, label %78

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4096, ptr %10) #3
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds ptr, ptr %26, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  call void @find_replace(ptr noundef %30, ptr noundef @.str.15, ptr noundef @.str.3, ptr noundef %31)
  %32 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  %33 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  call void @find_replace(ptr noundef %32, ptr noundef @.str.16, ptr noundef @.str.6, ptr noundef %33)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %34 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  %35 = call noalias ptr @fopen(ptr noundef %34, ptr noundef @.str)
  store ptr %35, ptr %11, align 8, !tbaa !5
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %47, label %38

38:                                               ; preds = %25
  %39 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  %40 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  call void @find_replace(ptr noundef %39, ptr noundef @.str.3, ptr noundef @.str.17, ptr noundef %40)
  %41 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  %42 = call noalias ptr @fopen(ptr noundef %41, ptr noundef @.str)
  store ptr %42, ptr %11, align 8, !tbaa !5
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %46, label %45

45:                                               ; preds = %38
  store i32 4, ptr %12, align 4
  br label %72

46:                                               ; preds = %38
  br label %47

47:                                               ; preds = %46, %25
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  br label %50

50:                                               ; preds = %68, %47
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %51, ptr noundef @.str.18, ptr noundef %13)
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %54, label %69

54:                                               ; preds = %50
  %55 = load i32, ptr %13, align 4, !tbaa !9
  %56 = load i32, ptr %7, align 4, !tbaa !9
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %58, label %68

58:                                               ; preds = %54
  %59 = getelementptr inbounds %struct.matrix, ptr %4, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !11
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = load i32, ptr %13, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds float, ptr %64, i64 %66
  store float 1.000000e+00, ptr %67, align 4, !tbaa !13
  br label %68

68:                                               ; preds = %58, %54
  br label %50, !llvm.loop !15

69:                                               ; preds = %50
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = call i32 @fclose(ptr noundef %70)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  store i32 0, ptr %12, align 4
  br label %72

72:                                               ; preds = %69, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4096, ptr %10) #3
  %73 = load i32, ptr %12, align 4
  switch i32 %73, label %83 [
    i32 0, label %74
    i32 4, label %75
  ]

74:                                               ; preds = %72
  br label %75

75:                                               ; preds = %74, %72
  %76 = load i32, ptr %8, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %8, align 4, !tbaa !9
  br label %21, !llvm.loop !17

78:                                               ; preds = %21
  %79 = load i32, ptr %9, align 4, !tbaa !9
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %79, i32 noundef %80)
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %82 = load { i64, ptr }, ptr %4, align 8
  ret { i64, ptr } %82

83:                                               ; preds = %72
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"matrix", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!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"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

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

declare void @find_replace(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

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

declare { i64, ptr } @make_matrix(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local { i64, ptr } @load_tags_paths(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #3 {
  %4 = alloca [4096 x i8], align 16
  %5 = alloca i32, align 4
  %6 = tail call { i64, ptr } @make_matrix(i32 noundef %1, i32 noundef %2) #4
  %7 = extractvalue { i64, ptr } %6, 1
  %8 = icmp sgt i32 %1, 0
  br i1 %8, label %.lr.ph25.preheader, label %._crit_edge26

.lr.ph25.preheader:                               ; preds = %3
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %.lr.ph25

.lr.ph25:                                         ; preds = %.lr.ph25.preheader, %30
  %indvars.iv = phi i64 [ 0, %.lr.ph25.preheader ], [ %indvars.iv.next, %30 ]
  %.01523 = phi i32 [ 0, %.lr.ph25.preheader ], [ %.1, %30 ]
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %4) #4
  %9 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  call void @find_replace(ptr noundef %10, ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.3, ptr noundef nonnull %4) #4
  call void @find_replace(ptr noundef nonnull %4, ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.6, ptr noundef nonnull %4) #4
  %11 = call noalias ptr @fopen(ptr noundef nonnull %4, ptr noundef nonnull @.str)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %14

12:                                               ; preds = %.lr.ph25
  call void @find_replace(ptr noundef nonnull %4, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.17, ptr noundef nonnull %4) #4
  %13 = call noalias ptr @fopen(ptr noundef nonnull %4, ptr noundef nonnull @.str)
  %.not21 = icmp eq ptr %13, null
  br i1 %.not21, label %30, label %14

14:                                               ; preds = %12, %.lr.ph25
  %.0 = phi ptr [ %11, %.lr.ph25 ], [ %13, %12 ]
  %15 = add nsw i32 %.01523, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %16 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %.0, ptr noundef nonnull @.str.18, ptr noundef nonnull %5) #4
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %14
  %18 = getelementptr inbounds ptr, ptr %7, i64 %indvars.iv
  br label %19

19:                                               ; preds = %.lr.ph, %26
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = icmp slt i32 %20, %2
  br i1 %21, label %22, label %26

22:                                               ; preds = %19
  %23 = load ptr, ptr %18, align 8, !tbaa !5
  %24 = sext i32 %20 to i64
  %25 = getelementptr inbounds float, ptr %23, i64 %24
  store float 1.000000e+00, ptr %25, align 4, !tbaa !11
  br label %26

26:                                               ; preds = %22, %19
  %27 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %.0, ptr noundef nonnull @.str.18, ptr noundef nonnull %5) #4
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %19, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %26, %14
  %29 = call i32 @fclose(ptr noundef nonnull %.0)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %30

30:                                               ; preds = %12, %._crit_edge
  %.1 = phi i32 [ %15, %._crit_edge ], [ %.01523, %12 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %4) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge26, label %.lr.ph25, !llvm.loop !15

._crit_edge26:                                    ; preds = %30, %3
  %.015.lcssa = phi i32 [ 0, %3 ], [ %.1, %30 ]
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %.015.lcssa, i32 noundef %1)
  ret { i64, ptr } %6
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 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 = { 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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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