; LLVM IR from paroj/gltut :: glsdk/freeglut/progs/demos/One (one)

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

@glutBitmapHelvetica18 = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local void @PrintText(i32 noundef %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @glDisable(i32 noundef 2896)
  call void @glDisable(i32 noundef 2929)
  call void @glMatrixMode(i32 noundef 5889)
  call void @glPushMatrix()
  call void @glLoadIdentity()
  %9 = call i32 @glutGet(i32 noundef 102)
  %10 = sitofp i32 %9 to double
  %11 = call i32 @glutGet(i32 noundef 103)
  %12 = sitofp i32 %11 to double
  call void @glOrtho(double noundef 0.000000e+00, double noundef %10, double noundef 0.000000e+00, double noundef %12, double noundef -1.000000e+00, double noundef 1.000000e+00)
  call void @glMatrixMode(i32 noundef 5888)
  call void @glPushMatrix()
  call void @glLoadIdentity()
  call void @glColor3ub(i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0)
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = load i32, ptr %5, align 4, !tbaa !5
  call void @glRasterPos2i(i32 noundef %13, i32 noundef %14)
  %15 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %15, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %37, %3
  %17 = load ptr, ptr %8, align 8, !tbaa !9
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %20, label %40

20:                                               ; preds = %16
  %21 = load ptr, ptr %8, align 8, !tbaa !9
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = sext i8 %22 to i32
  %24 = icmp eq i32 %23, 10
  br i1 %24, label %25, label %33

25:                                               ; preds = %20
  %26 = load i32, ptr %7, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %7, align 4, !tbaa !5
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = mul nsw i32 %30, 18
  %32 = sub nsw i32 %29, %31
  call void @glRasterPos2i(i32 noundef %28, i32 noundef %32)
  br label %33

33:                                               ; preds = %25, %20
  %34 = load ptr, ptr %8, align 8, !tbaa !9
  %35 = load i8, ptr %34, align 1, !tbaa !11
  %36 = sext i8 %35 to i32
  call void @glutBitmapCharacter(ptr noundef @glutBitmapHelvetica18, i32 noundef %36)
  br label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %8, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %38, i32 1
  store ptr %39, ptr %8, align 8, !tbaa !9
  br label %16, !llvm.loop !12

40:                                               ; preds = %16
  call void @glMatrixMode(i32 noundef 5889)
  call void @glPopMatrix()
  call void @glMatrixMode(i32 noundef 5888)
  call void @glPopMatrix()
  call void @glColor4f(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00)
  call void @glEnable(i32 noundef 2929)
  call void @glEnable(i32 noundef 2896)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #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 void @glDisable(i32 noundef) #2

declare void @glMatrixMode(i32 noundef) #2

declare void @glPushMatrix() #2

declare void @glLoadIdentity() #2

declare void @glOrtho(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) #2

declare i32 @glutGet(i32 noundef) #2

declare void @glColor3ub(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #2

declare void @glRasterPos2i(i32 noundef, i32 noundef) #2

declare void @glutBitmapCharacter(ptr noundef, i32 noundef) #2

declare void @glPopMatrix() #2

declare void @glColor4f(float noundef, float noundef, float noundef, float noundef) #2

declare void @glEnable(i32 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@glutBitmapHelvetica18 = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local void @PrintText(i32 noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  tail call void @glDisable(i32 noundef 2896) #2
  tail call void @glDisable(i32 noundef 2929) #2
  tail call void @glMatrixMode(i32 noundef 5889) #2
  tail call void @glPushMatrix() #2
  tail call void @glLoadIdentity() #2
  %4 = tail call i32 @glutGet(i32 noundef 102) #2
  %5 = sitofp i32 %4 to double
  %6 = tail call i32 @glutGet(i32 noundef 103) #2
  %7 = sitofp i32 %6 to double
  tail call void @glOrtho(double noundef 0.000000e+00, double noundef %5, double noundef 0.000000e+00, double noundef %7, double noundef -1.000000e+00, double noundef 1.000000e+00) #2
  tail call void @glMatrixMode(i32 noundef 5888) #2
  tail call void @glPushMatrix() #2
  tail call void @glLoadIdentity() #2
  tail call void @glColor3ub(i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0) #2
  tail call void @glRasterPos2i(i32 noundef %0, i32 noundef %1) #2
  br label %8

8:                                                ; preds = %13, %3
  %.010 = phi i32 [ 0, %3 ], [ %.1, %13 ]
  %.0 = phi ptr [ %2, %3 ], [ %16, %13 ]
  %9 = load i8, ptr %.0, align 1, !tbaa !5
  switch i8 %9, label %13 [
    i8 0, label %17
    i8 10, label %10
  ]

10:                                               ; preds = %8
  %11 = add nsw i32 %.010, 1
  %.neg = mul i32 %11, -18
  %12 = add i32 %.neg, %1
  tail call void @glRasterPos2i(i32 noundef %0, i32 noundef %12) #2
  %.pre = load i8, ptr %.0, align 1, !tbaa !5
  br label %13

13:                                               ; preds = %8, %10
  %14 = phi i8 [ %.pre, %10 ], [ %9, %8 ]
  %.1 = phi i32 [ %11, %10 ], [ %.010, %8 ]
  %15 = sext i8 %14 to i32
  tail call void @glutBitmapCharacter(ptr noundef nonnull @glutBitmapHelvetica18, i32 noundef %15) #2
  %16 = getelementptr inbounds i8, ptr %.0, i64 1
  br label %8, !llvm.loop !8

17:                                               ; preds = %8
  tail call void @glMatrixMode(i32 noundef 5889) #2
  tail call void @glPopMatrix() #2
  tail call void @glMatrixMode(i32 noundef 5888) #2
  tail call void @glPopMatrix() #2
  tail call void @glColor4f(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00) #2
  tail call void @glEnable(i32 noundef 2929) #2
  tail call void @glEnable(i32 noundef 2896) #2
  ret void
}

declare void @glDisable(i32 noundef) local_unnamed_addr #1

declare void @glMatrixMode(i32 noundef) local_unnamed_addr #1

declare void @glPushMatrix() local_unnamed_addr #1

declare void @glLoadIdentity() local_unnamed_addr #1

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

declare i32 @glutGet(i32 noundef) local_unnamed_addr #1

declare void @glColor3ub(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

declare void @glRasterPos2i(i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @glutBitmapCharacter(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @glPopMatrix() local_unnamed_addr #1

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

declare void @glEnable(i32 noundef) local_unnamed_addr #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 = { "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 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass