; LLVM IR from bonamarton/phys_num :: gauss_jordan_elim (gauss)

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

@.str.5 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [17 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: nounwind uwtable
define dso_local void @makeTensor(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca [512 x i8], align 16
  %10 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 16, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 512, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #8
  %11 = load i32, ptr %8, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = mul i64 %12, 8
  %14 = call noalias ptr @malloc(i64 noundef %13) #9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.tensor, ptr %15, i32 0, i32 0
  store ptr %14, ptr %16, align 8, !tbaa !11
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %21

19:                                               ; preds = %2
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  call void @exit(i32 noundef 0) #10
  unreachable

21:                                               ; preds = %2
  br label %22

22:                                               ; preds = %120, %21
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = call i32 @feof(ptr noundef %23) #8
  %25 = icmp ne i32 %24, 0
  %26 = xor i1 %25, true
  br i1 %26, label %27, label %121

27:                                               ; preds = %22
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %50, %27
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %29, ptr noundef @.str.6, ptr noundef %10)
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %48

32:                                               ; preds = %28
  %33 = load i8, ptr %10, align 1, !tbaa !13
  %34 = sext i8 %33 to i32
  %35 = icmp ne i32 %34, 32
  br i1 %35, label %36, label %48

36:                                               ; preds = %32
  %37 = load i8, ptr %10, align 1, !tbaa !13
  %38 = sext i8 %37 to i32
  %39 = icmp ne i32 %38, 9
  br i1 %39, label %40, label %48

40:                                               ; preds = %36
  %41 = load i8, ptr %10, align 1, !tbaa !13
  %42 = sext i8 %41 to i32
  %43 = icmp ne i32 %42, 13
  br i1 %43, label %44, label %48

44:                                               ; preds = %40
  %45 = load i8, ptr %10, align 1, !tbaa !13
  %46 = sext i8 %45 to i32
  %47 = icmp ne i32 %46, 10
  br label %48

48:                                               ; preds = %44, %40, %36, %32, %28
  %49 = phi i1 [ false, %40 ], [ false, %36 ], [ false, %32 ], [ false, %28 ], [ %47, %44 ]
  br i1 %49, label %50, label %56

50:                                               ; preds = %48
  %51 = load i8, ptr %10, align 1, !tbaa !13
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %7, align 4, !tbaa !9
  %54 = sext i32 %52 to i64
  %55 = getelementptr inbounds [512 x i8], ptr %9, i64 0, i64 %54
  store i8 %51, ptr %55, align 1, !tbaa !13
  br label %28, !llvm.loop !14

56:                                               ; preds = %48
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %7, align 4, !tbaa !9
  %59 = sext i32 %57 to i64
  %60 = getelementptr inbounds [512 x i8], ptr %9, i64 0, i64 %59
  store i8 0, ptr %60, align 1, !tbaa !13
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = icmp sgt i32 %61, 1
  br i1 %62, label %63, label %94

63:                                               ; preds = %56
  %64 = load i32, ptr %6, align 4, !tbaa !9
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = icmp sge i32 %64, %65
  br i1 %66, label %67, label %80

67:                                               ; preds = %63
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.tensor, ptr %68, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = mul nsw i32 %71, 2
  %73 = sext i32 %72 to i64
  %74 = mul i64 %73, 8
  %75 = call ptr @realloc(ptr noundef %70, i64 noundef %74) #11
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.tensor, ptr %76, i32 0, i32 0
  store ptr %75, ptr %77, align 8, !tbaa !11
  %78 = load i32, ptr %8, align 4, !tbaa !9
  %79 = mul nsw i32 %78, 2
  store i32 %79, ptr %8, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %67, %63
  %81 = getelementptr inbounds [512 x i8], ptr %9, i64 0, i64 0
  %82 = call double @atof(ptr noundef %81) #12
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.tensor, ptr %83, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !11
  %86 = load i32, ptr %6, align 4, !tbaa !9
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %6, align 4, !tbaa !9
  %88 = sext i32 %86 to i64
  %89 = getelementptr inbounds double, ptr %85, i64 %88
  store double %82, ptr %89, align 8, !tbaa !16
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.tensor, ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 4, !tbaa !18
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %91, align 4, !tbaa !18
  br label %94

94:                                               ; preds = %80, %56
  %95 = load i8, ptr %10, align 1, !tbaa !13
  %96 = sext i8 %95 to i32
  %97 = icmp eq i32 %96, 10
  br i1 %97, label %98, label %120

98:                                               ; preds = %94
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.tensor, ptr %99, i32 0, i32 2
  %101 = load i32, ptr %100, align 4, !tbaa !18
  %102 = icmp sgt i32 %101, 0
  br i1 %102, label %103, label %120

103:                                              ; preds = %98
  %104 = load i32, ptr %5, align 4, !tbaa !9
  %105 = icmp sgt i32 %104, 0
  br i1 %105, label %106, label %114

106:                                              ; preds = %103
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.tensor, ptr %107, i32 0, i32 2
  %109 = load i32, ptr %108, align 4, !tbaa !18
  %110 = load i32, ptr %5, align 4, !tbaa !9
  %111 = icmp ne i32 %109, %110
  br i1 %111, label %112, label %114

112:                                              ; preds = %106
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @exit(i32 noundef 0) #10
  unreachable

114:                                              ; preds = %106, %103
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.tensor, ptr %115, i32 0, i32 2
  %117 = load i32, ptr %116, align 4, !tbaa !18
  store i32 %117, ptr %5, align 4, !tbaa !9
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.tensor, ptr %118, i32 0, i32 2
  store i32 0, ptr %119, align 4, !tbaa !18
  br label %120

120:                                              ; preds = %114, %98, %94
  br label %22, !llvm.loop !19

121:                                              ; preds = %22
  %122 = load i32, ptr %5, align 4, !tbaa !9
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.tensor, ptr %123, i32 0, i32 2
  store i32 %122, ptr %124, align 4, !tbaa !18
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.tensor, ptr %125, i32 0, i32 2
  %127 = load i32, ptr %126, align 4, !tbaa !18
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %121
  %130 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  call void @exit(i32 noundef 0) #10
  unreachable

131:                                              ; preds = %121
  %132 = load i32, ptr %6, align 4, !tbaa !9
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.tensor, ptr %133, i32 0, i32 2
  %135 = load i32, ptr %134, align 4, !tbaa !18
  %136 = sdiv i32 %132, %135
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.tensor, ptr %137, i32 0, i32 1
  store i32 %136, ptr %138, align 8, !tbaa !20
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.tensor, ptr %139, i32 0, i32 1
  %141 = load i32, ptr %140, align 8, !tbaa !20
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.tensor, ptr %142, i32 0, i32 2
  %144 = load i32, ptr %143, align 4, !tbaa !18
  %145 = mul nsw i32 %141, %144
  %146 = load i32, ptr %6, align 4, !tbaa !9
  %147 = icmp ne i32 %145, %146
  br i1 %147, label %148, label %150

148:                                              ; preds = %131
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  call void @exit(i32 noundef 0) #10
  unreachable

150:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 512, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  ret void
}

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

; Function Attrs: nounwind
declare i32 @feof(ptr noundef) #5

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #6

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare double @atof(ptr noundef nonnull) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 allocsize(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 "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 #6 = { nounwind allocsize(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 #7 = { inlinehint nounwind willreturn memory(read) 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(1) }
attributes #12 = { nounwind willreturn memory(read) }

!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 0}
!12 = !{!"tensor", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!12, !10, i64 12}
!19 = distinct !{!19, !15}
!20 = !{!12, !10, i64 8}


; 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.5 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [17 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @makeTensor(ptr noundef %0, ptr nocapture noundef %1) local_unnamed_addr #1 {
  %3 = alloca [512 x i8], align 16
  %4 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #8
  %5 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #9
  store ptr %5, ptr %1, align 8, !tbaa !5
  %6 = icmp eq ptr %0, null
  br i1 %6, label %9, label %.preheader52

.preheader52:                                     ; preds = %2
  %7 = tail call i32 @feof(ptr noundef nonnull %0) #8
  %.not64 = icmp eq i32 %7, 0
  %8 = getelementptr inbounds i8, ptr %1, i64 12
  br i1 %.not64, label %.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader52
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %50

9:                                                ; preds = %2
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  tail call void @exit(i32 noundef 0) #10
  unreachable

.preheader:                                       ; preds = %.preheader52, %46
  %.067 = phi i32 [ %.2, %46 ], [ 16, %.preheader52 ]
  %.04366 = phi i32 [ %.144, %46 ], [ 0, %.preheader52 ]
  %.04565 = phi i32 [ %.146, %46 ], [ 0, %.preheader52 ]
  %11 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %0, ptr noundef nonnull @.str.6, ptr noundef nonnull %4) #8
  %.fr55 = freeze i32 %11
  %12 = icmp eq i32 %.fr55, 1
  br i1 %12, label %switch.early.test, label %.critedge.thread

.critedge.thread:                                 ; preds = %.preheader
  store i8 0, ptr %3, align 16, !tbaa !12
  br label %35

switch.early.test:                                ; preds = %.preheader, %14
  %indvars.iv = phi i64 [ %indvars.iv.next, %14 ], [ 0, %.preheader ]
  %13 = load i8, ptr %4, align 1
  switch i8 %13, label %14 [
    i8 32, label %.critedge
    i8 13, label %.critedge
    i8 10, label %.critedge
    i8 9, label %.critedge
  ]

14:                                               ; preds = %switch.early.test
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = getelementptr inbounds [512 x i8], ptr %3, i64 0, i64 %indvars.iv
  store i8 %13, ptr %15, align 1, !tbaa !12
  %16 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %0, ptr noundef nonnull @.str.6, ptr noundef nonnull %4) #8
  %.fr = freeze i32 %16
  %17 = icmp eq i32 %.fr, 1
  br i1 %17, label %switch.early.test, label %.critedge, !llvm.loop !13

.critedge:                                        ; preds = %14, %switch.early.test, %switch.early.test, %switch.early.test, %switch.early.test
  %.042.lcssa.ph.in = phi i64 [ %indvars.iv.next, %14 ], [ %indvars.iv, %switch.early.test ], [ %indvars.iv, %switch.early.test ], [ %indvars.iv, %switch.early.test ], [ %indvars.iv, %switch.early.test ]
  %18 = and i64 %.042.lcssa.ph.in, 4294967295
  %19 = getelementptr inbounds [512 x i8], ptr %3, i64 0, i64 %18
  store i8 0, ptr %19, align 1, !tbaa !12
  %20 = and i64 %.042.lcssa.ph.in, 4294967295
  %.not49 = icmp eq i64 %20, 0
  br i1 %.not49, label %35, label %21

21:                                               ; preds = %.critedge
  %.not50 = icmp slt i32 %.04366, %.067
  %.pre = load ptr, ptr %1, align 8, !tbaa !5
  br i1 %.not50, label %27, label %22

22:                                               ; preds = %21
  %23 = shl nsw i32 %.067, 1
  %24 = sext i32 %23 to i64
  %25 = shl nsw i64 %24, 3
  %26 = call ptr @realloc(ptr noundef %.pre, i64 noundef %25) #11
  store ptr %26, ptr %1, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %22, %21
  %28 = phi ptr [ %26, %22 ], [ %.pre, %21 ]
  %.1 = phi i32 [ %23, %22 ], [ %.067, %21 ]
  %29 = call double @atof(ptr noundef %3) #12
  %30 = add nsw i32 %.04366, 1
  %31 = sext i32 %.04366 to i64
  %32 = getelementptr inbounds double, ptr %28, i64 %31
  store double %29, ptr %32, align 8, !tbaa !15
  %33 = load i32, ptr %8, align 4, !tbaa !11
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %8, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %.critedge.thread, %27, %.critedge
  %.144 = phi i32 [ %30, %27 ], [ %.04366, %.critedge ], [ %.04366, %.critedge.thread ]
  %.2 = phi i32 [ %.1, %27 ], [ %.067, %.critedge ], [ %.067, %.critedge.thread ]
  %36 = load i8, ptr %4, align 1, !tbaa !12
  %37 = icmp eq i8 %36, 10
  br i1 %37, label %38, label %46

38:                                               ; preds = %35
  %39 = load i32, ptr %8, align 4, !tbaa !11
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %46

41:                                               ; preds = %38
  %42 = icmp slt i32 %.04565, 1
  %.not51 = icmp eq i32 %39, %.04565
  %or.cond = or i1 %42, %.not51
  br i1 %or.cond, label %45, label %43

43:                                               ; preds = %41
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  call void @exit(i32 noundef 0) #10
  unreachable

45:                                               ; preds = %41
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %46

46:                                               ; preds = %45, %38, %35
  %.146 = phi i32 [ %39, %45 ], [ %.04565, %38 ], [ %.04565, %35 ]
  %47 = call i32 @feof(ptr noundef nonnull %0) #8
  %.not = icmp eq i32 %47, 0
  br i1 %.not, label %.preheader, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %46
  %48 = getelementptr inbounds i8, ptr %1, i64 12
  store i32 %.146, ptr %48, align 4, !tbaa !11
  %49 = icmp eq i32 %.146, 0
  br i1 %49, label %50, label %52

50:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  call void @exit(i32 noundef 0) #10
  unreachable

52:                                               ; preds = %._crit_edge
  %53 = sdiv i32 %.144, %.146
  %54 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 %53, ptr %54, align 8, !tbaa !18
  %55 = mul nsw i32 %53, %.146
  %.not48 = icmp eq i32 %55, %.144
  br i1 %.not48, label %58, label %56

56:                                               ; preds = %52
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  call void @exit(i32 noundef 0) #10
  unreachable

58:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %3) #8
  ret void
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare double @atof(ptr nocapture noundef nonnull) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 #6 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #7 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(1) }
attributes #12 = { nounwind willreturn memory(read) }

!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 0}
!6 = !{!"tensor", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 12}
!12 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !8, i64 0}
!17 = distinct !{!17, !14}
!18 = !{!6, !10, i64 8}


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