; LLVM IR from rociodellasala/TP3_SO :: Userland/parabolicGraph (parabolicGraph)

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

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

declare void @draw_pixel(i32 noundef, i32 noundef) #1

; 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 @draw(i32 noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %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
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  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
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %40

13:                                               ; preds = %3
  store i32 -128, ptr %9, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %36, %13
  %15 = load i32, ptr %9, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 896
  br i1 %16, label %17, label %39

17:                                               ; preds = %14
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = load i32, ptr %9, align 4, !tbaa !5
  %20 = mul nsw i32 %18, %19
  %21 = load i32, ptr %9, align 4, !tbaa !5
  %22 = mul nsw i32 %20, %21
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = mul nsw i32 %23, %24
  %26 = add nsw i32 %22, %25
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = add nsw i32 %26, %27
  store i32 %28, ptr %10, align 4, !tbaa !5
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = add nsw i32 %29, 512
  store i32 %30, ptr %7, align 4, !tbaa !5
  %31 = load i32, ptr %10, align 4, !tbaa !5
  %32 = sdiv i32 %31, 25
  %33 = sub nsw i32 384, %32
  store i32 %33, ptr %8, align 4, !tbaa !5
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = load i32, ptr %8, align 4, !tbaa !5
  call void @draw_pixel(i32 noundef %34, i32 noundef %35)
  br label %36

36:                                               ; preds = %17
  %37 = load i32, ptr %9, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %9, align 4, !tbaa !5
  br label %14, !llvm.loop !9

39:                                               ; preds = %14
  br label %76

40:                                               ; preds = %3
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %55

43:                                               ; preds = %40
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %51, %43
  %45 = load i32, ptr %9, align 4, !tbaa !5
  %46 = icmp slt i32 %45, 1024
  br i1 %46, label %47, label %54

47:                                               ; preds = %44
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = sub nsw i32 384, %49
  call void @draw_pixel(i32 noundef %48, i32 noundef %50)
  br label %51

51:                                               ; preds = %47
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %9, align 4, !tbaa !5
  br label %44, !llvm.loop !11

54:                                               ; preds = %44
  br label %75

55:                                               ; preds = %40
  store i32 -384, ptr %9, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %71, %55
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = icmp slt i32 %57, 896
  br i1 %58, label %59, label %74

59:                                               ; preds = %56
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = load i32, ptr %9, align 4, !tbaa !5
  %62 = mul nsw i32 %60, %61
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = add nsw i32 %62, %63
  store i32 %64, ptr %10, align 4, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = add nsw i32 %65, 512
  store i32 %66, ptr %7, align 4, !tbaa !5
  %67 = load i32, ptr %10, align 4, !tbaa !5
  %68 = sub nsw i32 384, %67
  store i32 %68, ptr %8, align 4, !tbaa !5
  %69 = load i32, ptr %7, align 4, !tbaa !5
  %70 = load i32, ptr %8, align 4, !tbaa !5
  call void @draw_pixel(i32 noundef %69, i32 noundef %70)
  br label %71

71:                                               ; preds = %59
  %72 = load i32, ptr %9, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %9, align 4, !tbaa !5
  br label %56, !llvm.loop !12

74:                                               ; preds = %56
  br label %75

75:                                               ; preds = %74, %54
  br label %76

76:                                               ; preds = %75, %39
  br label %77

77:                                               ; preds = %80, %76
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = icmp slt i32 %78, 100000000
  br i1 %79, label %80, label %83

80:                                               ; preds = %77
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %9, align 4, !tbaa !5
  br label %77, !llvm.loop !13

83:                                               ; preds = %77
  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
  ret void
}

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 = !{!"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 = distinct !{!12, !10}
!13 = distinct !{!13, !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"

declare void @draw_pixel(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @draw(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %11, label %.preheader36

.preheader36:                                     ; preds = %3, %.preheader36
  %.038 = phi i32 [ %10, %.preheader36 ], [ -128, %3 ]
  %4 = mul nsw i32 %.038, %0
  %5 = add i32 %4, %1
  %6 = mul i32 %5, %.038
  %7 = add nsw i32 %6, %2
  %8 = add nsw i32 %.038, 512
  %.neg = sdiv i32 %7, -25
  %9 = add nsw i32 %.neg, 384
  tail call void @draw_pixel(i32 noundef %8, i32 noundef %9) #2
  %10 = add nsw i32 %.038, 1
  %exitcond.not = icmp eq i32 %10, 896
  br i1 %exitcond.not, label %.loopexit, label %.preheader36, !llvm.loop !5

11:                                               ; preds = %3
  %12 = icmp eq i32 %1, 0
  br i1 %12, label %.preheader, label %.preheader34

.preheader:                                       ; preds = %11
  %13 = sub nsw i32 384, %2
  br label %14

14:                                               ; preds = %.preheader, %14
  %.140 = phi i32 [ 0, %.preheader ], [ %15, %14 ]
  tail call void @draw_pixel(i32 noundef %.140, i32 noundef %13) #2
  %15 = add nuw nsw i32 %.140, 1
  %exitcond46.not = icmp eq i32 %15, 1024
  br i1 %exitcond46.not, label %.loopexit, label %14, !llvm.loop !7

.preheader34:                                     ; preds = %11, %.preheader34
  %.239 = phi i32 [ %20, %.preheader34 ], [ -384, %11 ]
  %16 = mul i32 %.239, %1
  %17 = add nsw i32 %.239, 512
  %18 = add i32 %16, %2
  %19 = sub i32 384, %18
  tail call void @draw_pixel(i32 noundef %17, i32 noundef %19) #2
  %20 = add nsw i32 %.239, 1
  %exitcond45.not = icmp eq i32 %20, 896
  br i1 %exitcond45.not, label %.loopexit, label %.preheader34, !llvm.loop !8

.loopexit:                                        ; preds = %.preheader36, %.preheader34, %14
  ret void
}

attributes #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 = { 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 = { 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 = distinct !{!7, !6}
!8 = distinct !{!8, !6}


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