; LLVM IR from Dovyski/opengl-demos :: src/bezier/main.ll (Z6renderv)

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

@x = external dso_local global [4 x double], align 16
@y = external dso_local global [4 x double], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6renderv() #0 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  call void @glLoadIdentity()
  call void @glTranslated(double noundef -2.500000e-01, double noundef -2.000000e-01, double noundef 0.000000e+00)
  call void @glScaled(double noundef 2.000000e-01, double noundef 2.000000e-01, double noundef 0.000000e+00)
  call void @glColor3f(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 0.000000e+00)
  call void @glBegin(i32 noundef 0)
  %4 = load double, ptr @x, align 16, !tbaa !5
  %5 = load double, ptr @y, align 16, !tbaa !5
  call void @glVertex2d(double noundef %4, double noundef %5)
  %6 = load double, ptr getelementptr inbounds ([4 x double], ptr @x, i64 0, i64 1), align 8, !tbaa !5
  %7 = load double, ptr getelementptr inbounds ([4 x double], ptr @y, i64 0, i64 1), align 8, !tbaa !5
  call void @glVertex2d(double noundef %6, double noundef %7)
  %8 = load double, ptr getelementptr inbounds ([4 x double], ptr @x, i64 0, i64 2), align 16, !tbaa !5
  %9 = load double, ptr getelementptr inbounds ([4 x double], ptr @y, i64 0, i64 2), align 16, !tbaa !5
  call void @glVertex2d(double noundef %8, double noundef %9)
  %10 = load double, ptr getelementptr inbounds ([4 x double], ptr @x, i64 0, i64 3), align 8, !tbaa !5
  %11 = load double, ptr getelementptr inbounds ([4 x double], ptr @y, i64 0, i64 3), align 8, !tbaa !5
  call void @glVertex2d(double noundef %10, double noundef %11)
  call void @glEnd()
  call void @glColor3f(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00)
  call void @glBegin(i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  store double 0.000000e+00, ptr %1, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %69, %0
  %13 = load double, ptr %1, align 8, !tbaa !5
  %14 = fcmp olt double %13, 1.000000e+00
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  br label %72

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %17 = load double, ptr %1, align 8, !tbaa !5
  %18 = fsub double 1.000000e+00, %17
  %19 = call double @pow(double noundef %18, double noundef 3.000000e+00) #5
  %20 = load double, ptr @x, align 16, !tbaa !5
  %21 = load double, ptr %1, align 8, !tbaa !5
  %22 = fmul double 3.000000e+00, %21
  %23 = load double, ptr %1, align 8, !tbaa !5
  %24 = fsub double 1.000000e+00, %23
  %25 = call double @pow(double noundef %24, double noundef 2.000000e+00) #5
  %26 = fmul double %22, %25
  %27 = load double, ptr getelementptr inbounds ([4 x double], ptr @x, i64 0, i64 1), align 8, !tbaa !5
  %28 = fmul double %26, %27
  %29 = call double @llvm.fmuladd.f64(double %19, double %20, double %28)
  %30 = load double, ptr %1, align 8, !tbaa !5
  %31 = call double @pow(double noundef %30, double noundef 2.000000e+00) #5
  %32 = fmul double 3.000000e+00, %31
  %33 = load double, ptr %1, align 8, !tbaa !5
  %34 = fsub double 1.000000e+00, %33
  %35 = fmul double %32, %34
  %36 = load double, ptr getelementptr inbounds ([4 x double], ptr @x, i64 0, i64 2), align 16, !tbaa !5
  %37 = call double @llvm.fmuladd.f64(double %35, double %36, double %29)
  %38 = load double, ptr %1, align 8, !tbaa !5
  %39 = call double @pow(double noundef %38, double noundef 3.000000e+00) #5
  %40 = load double, ptr getelementptr inbounds ([4 x double], ptr @x, i64 0, i64 3), align 8, !tbaa !5
  %41 = call double @llvm.fmuladd.f64(double %39, double %40, double %37)
  store double %41, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %42 = load double, ptr %1, align 8, !tbaa !5
  %43 = fsub double 1.000000e+00, %42
  %44 = call double @pow(double noundef %43, double noundef 3.000000e+00) #5
  %45 = load double, ptr @y, align 16, !tbaa !5
  %46 = load double, ptr %1, align 8, !tbaa !5
  %47 = fmul double 3.000000e+00, %46
  %48 = load double, ptr %1, align 8, !tbaa !5
  %49 = fsub double 1.000000e+00, %48
  %50 = call double @pow(double noundef %49, double noundef 2.000000e+00) #5
  %51 = fmul double %47, %50
  %52 = load double, ptr getelementptr inbounds ([4 x double], ptr @y, i64 0, i64 1), align 8, !tbaa !5
  %53 = fmul double %51, %52
  %54 = call double @llvm.fmuladd.f64(double %44, double %45, double %53)
  %55 = load double, ptr %1, align 8, !tbaa !5
  %56 = call double @pow(double noundef %55, double noundef 2.000000e+00) #5
  %57 = fmul double 3.000000e+00, %56
  %58 = load double, ptr %1, align 8, !tbaa !5
  %59 = fsub double 1.000000e+00, %58
  %60 = fmul double %57, %59
  %61 = load double, ptr getelementptr inbounds ([4 x double], ptr @y, i64 0, i64 2), align 16, !tbaa !5
  %62 = call double @llvm.fmuladd.f64(double %60, double %61, double %54)
  %63 = load double, ptr %1, align 8, !tbaa !5
  %64 = call double @pow(double noundef %63, double noundef 3.000000e+00) #5
  %65 = load double, ptr getelementptr inbounds ([4 x double], ptr @y, i64 0, i64 3), align 8, !tbaa !5
  %66 = call double @llvm.fmuladd.f64(double %64, double %65, double %62)
  store double %66, ptr %3, align 8, !tbaa !5
  %67 = load double, ptr %2, align 8, !tbaa !5
  %68 = load double, ptr %3, align 8, !tbaa !5
  call void @glVertex2d(double noundef %67, double noundef %68)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %69

69:                                               ; preds = %16
  %70 = load double, ptr %1, align 8, !tbaa !5
  %71 = fadd double %70, 1.000000e-04
  store double %71, ptr %1, align 8, !tbaa !5
  br label %12, !llvm.loop !9

72:                                               ; preds = %15
  call void @glEnd()
  ret void
}

declare void @glLoadIdentity() #1

declare void @glTranslated(double noundef, double noundef, double noundef) #1

declare void @glScaled(double noundef, double noundef, double noundef) #1

declare void @glColor3f(float noundef, float noundef, float noundef) #1

declare void @glBegin(i32 noundef) #1

declare void @glVertex2d(double noundef, double noundef) #1

declare void @glEnd() #1

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

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

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

attributes #0 = { mustprogress 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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"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"

@x = external dso_local local_unnamed_addr global [4 x double], align 16
@y = external dso_local local_unnamed_addr global [4 x double], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6renderv() local_unnamed_addr #0 {
  tail call void @glLoadIdentity()
  tail call void @glTranslated(double noundef -2.500000e-01, double noundef -2.000000e-01, double noundef 0.000000e+00)
  tail call void @glScaled(double noundef 2.000000e-01, double noundef 2.000000e-01, double noundef 0.000000e+00)
  tail call void @glColor3f(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 0.000000e+00)
  tail call void @glBegin(i32 noundef 0)
  %1 = load double, ptr @x, align 16, !tbaa !5
  %2 = load double, ptr @y, align 16, !tbaa !5
  tail call void @glVertex2d(double noundef %1, double noundef %2)
  %3 = load double, ptr getelementptr inbounds (i8, ptr @x, i64 8), align 8, !tbaa !5
  %4 = load double, ptr getelementptr inbounds (i8, ptr @y, i64 8), align 8, !tbaa !5
  tail call void @glVertex2d(double noundef %3, double noundef %4)
  %5 = load double, ptr getelementptr inbounds (i8, ptr @x, i64 16), align 16, !tbaa !5
  %6 = load double, ptr getelementptr inbounds (i8, ptr @y, i64 16), align 16, !tbaa !5
  tail call void @glVertex2d(double noundef %5, double noundef %6)
  %7 = load double, ptr getelementptr inbounds (i8, ptr @x, i64 24), align 8, !tbaa !5
  %8 = load double, ptr getelementptr inbounds (i8, ptr @y, i64 24), align 8, !tbaa !5
  tail call void @glVertex2d(double noundef %7, double noundef %8)
  tail call void @glEnd()
  tail call void @glColor3f(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00)
  tail call void @glBegin(i32 noundef 0)
  br label %10

9:                                                ; preds = %10
  tail call void @glEnd()
  ret void

10:                                               ; preds = %0, %10
  %.019 = phi double [ 0.000000e+00, %0 ], [ %36, %10 ]
  %11 = fsub double 1.000000e+00, %.019
  %12 = tail call double @pow(double noundef %11, double noundef 3.000000e+00) #4
  %13 = load double, ptr @x, align 16, !tbaa !5
  %14 = fmul double %.019, 3.000000e+00
  %square = fmul double %11, %11
  %15 = fmul double %14, %square
  %16 = load double, ptr getelementptr inbounds (i8, ptr @x, i64 8), align 8, !tbaa !5
  %17 = fmul double %15, %16
  %18 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %17)
  %square16 = fmul double %.019, %.019
  %19 = fmul double %square16, 3.000000e+00
  %20 = fmul double %11, %19
  %21 = load double, ptr getelementptr inbounds (i8, ptr @x, i64 16), align 16, !tbaa !5
  %22 = tail call double @llvm.fmuladd.f64(double %20, double %21, double %18)
  %23 = tail call double @pow(double noundef %.019, double noundef 3.000000e+00) #4
  %24 = load double, ptr getelementptr inbounds (i8, ptr @x, i64 24), align 8, !tbaa !5
  %25 = tail call double @llvm.fmuladd.f64(double %23, double %24, double %22)
  %26 = tail call double @pow(double noundef %11, double noundef 3.000000e+00) #4
  %27 = load double, ptr @y, align 16, !tbaa !5
  %28 = load double, ptr getelementptr inbounds (i8, ptr @y, i64 8), align 8, !tbaa !5
  %29 = fmul double %15, %28
  %30 = tail call double @llvm.fmuladd.f64(double %26, double %27, double %29)
  %31 = load double, ptr getelementptr inbounds (i8, ptr @y, i64 16), align 16, !tbaa !5
  %32 = tail call double @llvm.fmuladd.f64(double %20, double %31, double %30)
  %33 = tail call double @pow(double noundef %.019, double noundef 3.000000e+00) #4
  %34 = load double, ptr getelementptr inbounds (i8, ptr @y, i64 24), align 8, !tbaa !5
  %35 = tail call double @llvm.fmuladd.f64(double %33, double %34, double %32)
  tail call void @glVertex2d(double noundef %25, double noundef %35)
  %36 = fadd double %.019, 1.000000e-04
  %37 = fcmp olt double %36, 1.000000e+00
  br i1 %37, label %10, label %9, !llvm.loop !9
}

declare void @glLoadIdentity() local_unnamed_addr #1

declare void @glTranslated(double noundef, double noundef, double noundef) local_unnamed_addr #1

declare void @glScaled(double noundef, double noundef, double noundef) local_unnamed_addr #1

declare void @glColor3f(float noundef, float noundef, float noundef) local_unnamed_addr #1

declare void @glBegin(i32 noundef) local_unnamed_addr #1

declare void @glVertex2d(double noundef, double noundef) local_unnamed_addr #1

declare void @glEnd() local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

attributes #0 = { mustprogress 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 = { "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 = { mustprogress nofree nounwind willreturn memory(write) "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass