; LLVM IR from Discngine/fpocket :: src (dparams)

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

@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [6 x i8], align 1
@stderr = external global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [26 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
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @add_list_complexes(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca [4006 x i8], align 16
  %9 = alloca [2000 x i8], align 16
  %10 = alloca [5 x 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 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4006, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 2000, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 5, ptr %10) #4
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call noalias ptr @fopen(ptr noundef %11, ptr noundef @.str.14)
  store ptr %12, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %38

15:                                               ; preds = %2
  br label %16

16:                                               ; preds = %36, %15
  %17 = getelementptr inbounds [4006 x i8], ptr %8, i64 0, i64 0
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call ptr @fgets(ptr noundef %17, i32 noundef 210, ptr noundef %18)
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %37

21:                                               ; preds = %16
  %22 = getelementptr inbounds [4006 x i8], ptr %8, i64 0, i64 0
  %23 = getelementptr inbounds [2000 x i8], ptr %9, i64 0, i64 0
  %24 = getelementptr inbounds [5 x i8], ptr %10, i64 0, i64 0
  %25 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %22, ptr noundef @.str.15, ptr noundef %23, ptr noundef %24) #4
  store i32 %25, ptr %7, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp slt i32 %26, 2
  br i1 %27, label %28, label %29

28:                                               ; preds = %21
  br label %36

29:                                               ; preds = %21
  %30 = getelementptr inbounds [2000 x i8], ptr %9, i64 0, i64 0
  %31 = getelementptr inbounds [5 x i8], ptr %10, i64 0, i64 0
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call i32 @add_complexe(ptr noundef %30, ptr noundef %31, ptr noundef %32)
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = add nsw i32 %34, %33
  store i32 %35, ptr %6, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %29, %28
  br label %16, !llvm.loop !11

37:                                               ; preds = %16
  br label %42

38:                                               ; preds = %2
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.16, ptr noundef %40) #4
  br label %42

42:                                               ; preds = %38, %37
  %43 = load i32, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 5, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 2000, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4006, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret i32 %43
}

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

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @add_complexe(ptr noundef, ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = { "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 = distinct !{!11, !12}
!12 = !{!"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"

@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [6 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [26 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @add_list_complexes(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca [4006 x i8], align 16
  %4 = alloca [2000 x i8], align 16
  %5 = alloca [5 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 4006, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %5) #3
  %6 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str.14)
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %15, label %.preheader

.preheader:                                       ; preds = %2
  %7 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 210, ptr noundef nonnull %6)
  %.not78 = icmp eq ptr %7, null
  br i1 %.not78, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %13
  %.09 = phi i32 [ %.1, %13 ], [ 0, %.preheader ]
  %8 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %3, ptr noundef nonnull @.str.15, ptr noundef nonnull %4, ptr noundef nonnull %5) #3
  %9 = icmp slt i32 %8, 2
  br i1 %9, label %13, label %10

10:                                               ; preds = %.lr.ph
  %11 = call i32 @add_complexe(ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef %1)
  %12 = add nsw i32 %11, %.09
  br label %13

13:                                               ; preds = %.lr.ph, %10
  %.1 = phi i32 [ %.09, %.lr.ph ], [ %12, %10 ]
  %14 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 210, ptr noundef nonnull %6)
  %.not7 = icmp eq ptr %14, null
  br i1 %.not7, label %.loopexit, label %.lr.ph, !llvm.loop !5

15:                                               ; preds = %2
  %16 = load ptr, ptr @stderr, align 8, !tbaa !7
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.16, ptr noundef %0) #4
  br label %.loopexit

.loopexit:                                        ; preds = %13, %.preheader, %15
  %.2 = phi i32 [ 0, %15 ], [ 0, %.preheader ], [ %.1, %13 ]
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4006, ptr nonnull %3) #3
  ret i32 %.2
}

; 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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @add_complexe(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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 = { 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 }
attributes #4 = { cold 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}


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