; LLVM IR from VAR-solutions/Algorithms :: Graphs/Bellman-ford/c (bellman)

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

@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@a = external dso_local global [1000 x %struct.node], align 16
@d = external dso_local global [1000 x i32], align 16
@pi = external dso_local global [1000 x i32], align 16
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1

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

13:                                               ; preds = %32, %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %17, label %35

17:                                               ; preds = %13
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %20
  %22 = getelementptr inbounds %struct.node, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %24
  %26 = getelementptr inbounds %struct.node, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %28
  %30 = getelementptr inbounds %struct.node, ptr %29, i32 0, i32 2
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %22, ptr noundef %26, ptr noundef %30)
  br label %32

32:                                               ; preds = %17
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %13, !llvm.loop !9

35:                                               ; preds = %13
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %47, %35
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %50

40:                                               ; preds = %36
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %42
  store i32 999999, ptr %43, align 4, !tbaa !5
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %45
  store i32 -1, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %40
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %36, !llvm.loop !11

50:                                               ; preds = %36
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %9)
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %54
  store i32 0, ptr %55, align 4, !tbaa !5
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %57
  store i32 -1, ptr %58, align 4, !tbaa !5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %145, %50
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  %63 = icmp slt i32 %60, %62
  br i1 %63, label %64, label %148

64:                                               ; preds = %59
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %141, %64
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %144

69:                                               ; preds = %65
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %71
  %73 = getelementptr inbounds %struct.node, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 4, !tbaa !12
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = icmp ne i32 %77, 999999
  br i1 %78, label %79, label %140

79:                                               ; preds = %69
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %81
  %83 = getelementptr inbounds %struct.node, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 4, !tbaa !12
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %3, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %89
  %91 = getelementptr inbounds %struct.node, ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 4, !tbaa !14
  %93 = add nsw i32 %87, %92
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %95
  %97 = getelementptr inbounds %struct.node, ptr %96, i32 0, i32 1
  %98 = load i32, ptr %97, align 4, !tbaa !15
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = icmp slt i32 %93, %101
  br i1 %102, label %103, label %140

103:                                              ; preds = %79
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %105
  %107 = getelementptr inbounds %struct.node, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 4, !tbaa !12
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %113
  %115 = getelementptr inbounds %struct.node, ptr %114, i32 0, i32 2
  %116 = load i32, ptr %115, align 4, !tbaa !14
  %117 = add nsw i32 %111, %116
  %118 = load i32, ptr %3, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %119
  %121 = getelementptr inbounds %struct.node, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !15
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %123
  store i32 %117, ptr %124, align 4, !tbaa !5
  %125 = load i32, ptr %3, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %126
  %128 = getelementptr inbounds %struct.node, ptr %127, i32 0, i32 0
  %129 = load i32, ptr %128, align 4, !tbaa !12
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %3, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.node, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !15
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %138
  store i32 %132, ptr %139, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %103, %79, %69
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %3, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %3, align 4, !tbaa !5
  br label %65, !llvm.loop !16

144:                                              ; preds = %65
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %2, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %2, align 4, !tbaa !5
  br label %59, !llvm.loop !17

148:                                              ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 1, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %189, %148
  %150 = load i32, ptr %2, align 4, !tbaa !5
  %151 = load i32, ptr %4, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %153, label %192

153:                                              ; preds = %149
  %154 = load i32, ptr %2, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %155
  %157 = getelementptr inbounds %struct.node, ptr %156, i32 0, i32 0
  %158 = load i32, ptr %157, align 4, !tbaa !12
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = icmp ne i32 %161, 999999
  br i1 %162, label %163, label %188

163:                                              ; preds = %153
  %164 = load i32, ptr %2, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %165
  %167 = getelementptr inbounds %struct.node, ptr %166, i32 0, i32 0
  %168 = load i32, ptr %167, align 4, !tbaa !12
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = load i32, ptr %2, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %173
  %175 = getelementptr inbounds %struct.node, ptr %174, i32 0, i32 2
  %176 = load i32, ptr %175, align 4, !tbaa !14
  %177 = add nsw i32 %171, %176
  %178 = load i32, ptr %2, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %179
  %181 = getelementptr inbounds %struct.node, ptr %180, i32 0, i32 1
  %182 = load i32, ptr %181, align 4, !tbaa !15
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = icmp slt i32 %177, %185
  br i1 %186, label %187, label %188

187:                                              ; preds = %163
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %193

188:                                              ; preds = %163, %153
  br label %189

189:                                              ; preds = %188
  %190 = load i32, ptr %2, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %2, align 4, !tbaa !5
  br label %149, !llvm.loop !18

192:                                              ; preds = %149
  br label %193

193:                                              ; preds = %192, %187
  %194 = load i32, ptr %10, align 4, !tbaa !5
  %195 = icmp eq i32 %194, 0
  br i1 %195, label %196, label %198

196:                                              ; preds = %193
  %197 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %214

198:                                              ; preds = %193
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %199

199:                                              ; preds = %210, %198
  %200 = load i32, ptr %2, align 4, !tbaa !5
  %201 = load i32, ptr %5, align 4, !tbaa !5
  %202 = icmp slt i32 %200, %201
  br i1 %202, label %203, label %213

203:                                              ; preds = %199
  %204 = load i32, ptr %2, align 4, !tbaa !5
  %205 = load i32, ptr %2, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %204, i32 noundef %208)
  br label %210

210:                                              ; preds = %203
  %211 = load i32, ptr %2, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %2, align 4, !tbaa !5
  br label %199, !llvm.loop !19

213:                                              ; preds = %199
  br label %214

214:                                              ; preds = %213, %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  ret void
}

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

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

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


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

%struct.node = type { i32, i32, i32 }

@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@a = external dso_local global [1000 x %struct.node], align 16
@d = external dso_local local_unnamed_addr global [1000 x i32], align 16
@pi = external dso_local local_unnamed_addr global [1000 x i32], align 16
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %1)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.preheader40

.preheader40:                                     ; preds = %.lr.ph, %0
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph43.preheader, label %._crit_edge

.lr.ph43.preheader:                               ; preds = %.preheader40
  %10 = zext nneg i32 %8 to i64
  %11 = shl nuw nsw i64 %10, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @pi, i8 -1, i64 %11, i1 false), !tbaa !5
  %min.iters.check = icmp ult i32 %8, 8
  br i1 %min.iters.check, label %.lr.ph43.preheader73, label %vector.ph

.lr.ph43.preheader73:                             ; preds = %middle.block, %.lr.ph43.preheader
  %indvars.iv55.ph = phi i64 [ 0, %.lr.ph43.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph43

vector.ph:                                        ; preds = %.lr.ph43.preheader
  %n.vec = and i64 %10, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %12 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %index
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  store <4 x i32> <i32 999999, i32 999999, i32 999999, i32 999999>, ptr %12, align 16, !tbaa !5
  store <4 x i32> <i32 999999, i32 999999, i32 999999, i32 999999>, ptr %13, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %14 = icmp eq i64 %index.next, %n.vec
  br i1 %14, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %10
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph43.preheader73

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %16 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %indvars.iv
  %17 = getelementptr inbounds i8, ptr %16, i64 4
  %18 = getelementptr inbounds i8, ptr %16, i64 8
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %.preheader40, !llvm.loop !13

.lr.ph43:                                         ; preds = %.lr.ph43.preheader73, %.lr.ph43
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %.lr.ph43 ], [ %indvars.iv55.ph, %.lr.ph43.preheader73 ]
  %23 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv55
  store i32 999999, ptr %23, align 4, !tbaa !5
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next56, %10
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph43, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph43, %middle.block, %.preheader40
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %3)
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %27
  store i32 0, ptr %28, align 4, !tbaa !5
  %29 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %27
  store i32 -1, ptr %29, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 1
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br i1 %31, label %.preheader39.lr.ph, label %.preheader

.preheader39.lr.ph:                               ; preds = %._crit_edge
  %32 = icmp sgt i32 %.pre, 0
  br i1 %32, label %.preheader39.us.preheader, label %.critedge.preheader72

.preheader39.us.preheader:                        ; preds = %.preheader39.lr.ph
  %wide.trip.count61 = zext nneg i32 %.pre to i64
  %33 = add nsw i32 %30, -2
  br label %.preheader39.us

.preheader39.us:                                  ; preds = %.preheader39.us.preheader, %._crit_edge46.us
  %.247.us = phi i32 [ %55, %._crit_edge46.us ], [ 0, %.preheader39.us.preheader ]
  br label %34

34:                                               ; preds = %.preheader39.us, %54
  %indvars.iv58 = phi i64 [ 0, %.preheader39.us ], [ %indvars.iv.next59, %54 ]
  %35 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %indvars.iv58
  %36 = load i32, ptr %35, align 4, !tbaa !15
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %.not38.us = icmp eq i32 %39, 999999
  br i1 %.not38.us, label %54, label %40

40:                                               ; preds = %34
  %41 = getelementptr inbounds i8, ptr %35, i64 8
  %42 = load i32, ptr %41, align 4, !tbaa !17
  %43 = add nsw i32 %42, %39
  %44 = getelementptr inbounds i8, ptr %35, i64 4
  %45 = load i32, ptr %44, align 4, !tbaa !18
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = icmp slt i32 %43, %48
  br i1 %49, label %50, label %54

50:                                               ; preds = %40
  store i32 %43, ptr %47, align 4, !tbaa !5
  %51 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %37
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = getelementptr inbounds [1000 x i32], ptr @pi, i64 0, i64 %46
  store i32 %52, ptr %53, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %50, %40, %34
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count61
  br i1 %exitcond62.not, label %._crit_edge46.us, label %34, !llvm.loop !19

._crit_edge46.us:                                 ; preds = %54
  %55 = add nuw nsw i32 %.247.us, 1
  %exitcond63.not = icmp eq i32 %.247.us, %33
  br i1 %exitcond63.not, label %.preheader, label %.preheader39.us, !llvm.loop !20

.preheader:                                       ; preds = %._crit_edge46.us, %._crit_edge
  %56 = icmp sgt i32 %.pre, 0
  br i1 %56, label %.lr.ph49.preheader, label %.critedge.preheader

.lr.ph49.preheader:                               ; preds = %.preheader
  %wide.trip.count67 = zext nneg i32 %.pre to i64
  br label %.lr.ph49

.critedge.preheader:                              ; preds = %73, %.preheader
  %57 = icmp sgt i32 %30, 0
  br i1 %57, label %.critedge.preheader72, label %.loopexit

.critedge.preheader72:                            ; preds = %.preheader39.lr.ph, %.critedge.preheader
  br label %.critedge

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %73
  %indvars.iv64 = phi i64 [ 0, %.lr.ph49.preheader ], [ %indvars.iv.next65, %73 ]
  %58 = getelementptr inbounds [1000 x %struct.node], ptr @a, i64 0, i64 %indvars.iv64
  %59 = load i32, ptr %58, align 4, !tbaa !15
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %.not = icmp eq i32 %62, 999999
  br i1 %.not, label %73, label %63

63:                                               ; preds = %.lr.ph49
  %64 = getelementptr inbounds i8, ptr %58, i64 8
  %65 = load i32, ptr %64, align 4, !tbaa !17
  %66 = add nsw i32 %65, %62
  %67 = getelementptr inbounds i8, ptr %58, i64 4
  %68 = load i32, ptr %67, align 4, !tbaa !18
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp slt i32 %66, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %.lr.ph49, %63
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %exitcond68.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count67
  br i1 %exitcond68.not, label %.critedge.preheader, label %.lr.ph49, !llvm.loop !21

74:                                               ; preds = %63
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.loopexit

.critedge:                                        ; preds = %.critedge.preheader72, %.critedge
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %.critedge ], [ 0, %.critedge.preheader72 ]
  %76 = getelementptr inbounds [1000 x i32], ptr @d, i64 0, i64 %indvars.iv69
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = trunc nuw nsw i64 %indvars.iv69 to i32
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %78, i32 noundef %77)
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %80 = load i32, ptr %2, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = icmp slt i64 %indvars.iv.next70, %81
  br i1 %82, label %.critedge, label %.loopexit, !llvm.loop !22

.loopexit:                                        ; preds = %.critedge, %.critedge.preheader, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void
}

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = !{!16, !6, i64 0}
!16 = !{!"node", !6, i64 0, !6, i64 4, !6, i64 8}
!17 = !{!16, !6, i64 8}
!18 = !{!16, !6, i64 4}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass