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

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

@textureID = external dso_local global [3 x i32], align 4
@ang = external dso_local global float, align 4

declare void @glEnable(i32 noundef) #0

declare void @glDisable(i32 noundef) #0

declare void @glBindTexture(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7displayv() #2 {
  %1 = alloca float, align 4
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store float 3.500000e+01, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store float 1.000000e+00, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store float 2.000000e+02, ptr %3, align 4, !tbaa !5
  call void @glClear(i32 noundef 16640)
  call void @glMatrixMode(i32 noundef 5889)
  call void @glLoadIdentity()
  %6 = load float, ptr %1, align 4, !tbaa !5
  %7 = fpext float %6 to double
  %8 = load float, ptr %2, align 4, !tbaa !5
  %9 = fpext float %8 to double
  %10 = load float, ptr %3, align 4, !tbaa !5
  %11 = fpext float %10 to double
  call void @gluPerspective(double noundef %7, double noundef 3.000000e+00, double noundef %9, double noundef %11)
  call void @glMatrixMode(i32 noundef 5888)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 -60, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %12

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

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

16:                                               ; preds = %12
  call void @glLoadIdentity()
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = sitofp i32 %17 to double
  call void @glTranslated(double noundef %18, double noundef 0.000000e+00, double noundef -1.200000e+02)
  %19 = load float, ptr @ang, align 4, !tbaa !5
  %20 = fpext float %19 to double
  %21 = fadd double %20, 1.000000e-01
  %22 = fptrunc double %21 to float
  store float %22, ptr @ang, align 4, !tbaa !5
  %23 = fpext float %22 to double
  call void @glRotated(double noundef %23, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00)
  call void @glScalef(float noundef 5.000000e+00, float noundef 5.000000e+00, float noundef 5.000000e+00)
  call void @glTranslated(double noundef -5.000000e+00, double noundef -5.000000e+00, double noundef 0.000000e+00)
  %24 = load i32, ptr %4, align 4, !tbaa !9
  %25 = add nsw i32 %24, 60
  store i32 %25, ptr %4, align 4, !tbaa !9
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [3 x i32], ptr @textureID, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !9
  call void @glBindTexture(i32 noundef 3553, i32 noundef %29)
  %30 = load i32, ptr %5, align 4, !tbaa !9
  %31 = icmp slt i32 %30, 2
  br i1 %31, label %32, label %33

32:                                               ; preds = %16
  call void @glDisable(i32 noundef 3168)
  call void @glDisable(i32 noundef 3169)
  call void @glBegin(i32 noundef 7)
  call void @glTexCoord2f(float noundef 0.000000e+00, float noundef 0.000000e+00)
  call void @glVertex3f(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  call void @glTexCoord2f(float noundef 2.000000e+00, float noundef 0.000000e+00)
  call void @glVertex3f(float noundef 1.000000e+01, float noundef 0.000000e+00, float noundef 0.000000e+00)
  call void @glTexCoord2f(float noundef 2.000000e+00, float noundef 2.000000e+00)
  call void @glVertex3f(float noundef 1.000000e+01, float noundef 1.000000e+01, float noundef 0.000000e+00)
  call void @glTexCoord2f(float noundef 0.000000e+00, float noundef 2.000000e+00)
  call void @glVertex3f(float noundef 0.000000e+00, float noundef 1.000000e+01, float noundef 0.000000e+00)
  call void @glEnd()
  br label %34

33:                                               ; preds = %16
  call void @glEnable(i32 noundef 3168)
  call void @glEnable(i32 noundef 3169)
  call void @glBegin(i32 noundef 7)
  call void @glVertex3f(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  call void @glVertex3f(float noundef 1.000000e+01, float noundef 0.000000e+00, float noundef 0.000000e+00)
  call void @glVertex3f(float noundef 1.000000e+01, float noundef 1.000000e+01, float noundef 0.000000e+00)
  call void @glVertex3f(float noundef 0.000000e+00, float noundef 1.000000e+01, float noundef 0.000000e+00)
  call void @glEnd()
  br label %34

34:                                               ; preds = %33, %32
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr %5, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %5, align 4, !tbaa !9
  br label %12, !llvm.loop !11

38:                                               ; preds = %15
  call void @glutSwapBuffers()
  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
}

declare void @glClear(i32 noundef) #0

declare void @glMatrixMode(i32 noundef) #0

declare void @glLoadIdentity() #0

declare void @gluPerspective(double noundef, double noundef, double noundef, double noundef) #0

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

declare void @glRotated(double noundef, double noundef, double noundef, double noundef) #0

declare void @glScalef(float noundef, float noundef, float noundef) #0

declare void @glBegin(i32 noundef) #0

declare void @glTexCoord2f(float noundef, float noundef) #0

declare void @glVertex3f(float noundef, float noundef, float noundef) #0

declare void @glEnd() #0

declare void @glutSwapBuffers() #0

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple 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"

@textureID = external dso_local local_unnamed_addr global [3 x i32], align 4
@ang = external dso_local local_unnamed_addr global float, align 4

declare void @glEnable(i32 noundef) local_unnamed_addr #0

declare void @glDisable(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7displayv() local_unnamed_addr #1 {
  tail call void @glClear(i32 noundef 16640)
  tail call void @glMatrixMode(i32 noundef 5889)
  tail call void @glLoadIdentity()
  tail call void @gluPerspective(double noundef 3.500000e+01, double noundef 3.000000e+00, double noundef 1.000000e+00, double noundef 2.000000e+02)
  tail call void @glMatrixMode(i32 noundef 5888)
  tail call void @glLoadIdentity()
  tail call void @glTranslated(double noundef -6.000000e+01, double noundef 0.000000e+00, double noundef -1.200000e+02)
  %1 = load float, ptr @ang, align 4, !tbaa !5
  %2 = fpext float %1 to double
  %3 = fadd double %2, 1.000000e-01
  %4 = fptrunc double %3 to float
  store float %4, ptr @ang, align 4, !tbaa !5
  %5 = fpext float %4 to double
  tail call void @glRotated(double noundef %5, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00)
  tail call void @glScalef(float noundef 5.000000e+00, float noundef 5.000000e+00, float noundef 5.000000e+00)
  tail call void @glTranslated(double noundef -5.000000e+00, double noundef -5.000000e+00, double noundef 0.000000e+00)
  %6 = load i32, ptr @textureID, align 4, !tbaa !9
  tail call void @glBindTexture(i32 noundef 3553, i32 noundef %6)
  tail call void @glDisable(i32 noundef 3168)
  tail call void @glDisable(i32 noundef 3169)
  tail call void @glBegin(i32 noundef 7)
  tail call void @glTexCoord2f(float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glVertex3f(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glTexCoord2f(float noundef 2.000000e+00, float noundef 0.000000e+00)
  tail call void @glVertex3f(float noundef 1.000000e+01, float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glTexCoord2f(float noundef 2.000000e+00, float noundef 2.000000e+00)
  tail call void @glVertex3f(float noundef 1.000000e+01, float noundef 1.000000e+01, float noundef 0.000000e+00)
  tail call void @glTexCoord2f(float noundef 0.000000e+00, float noundef 2.000000e+00)
  tail call void @glVertex3f(float noundef 0.000000e+00, float noundef 1.000000e+01, float noundef 0.000000e+00)
  tail call void @glEnd()
  tail call void @glLoadIdentity()
  tail call void @glTranslated(double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef -1.200000e+02)
  %7 = load float, ptr @ang, align 4, !tbaa !5
  %8 = fpext float %7 to double
  %9 = fadd double %8, 1.000000e-01
  %10 = fptrunc double %9 to float
  store float %10, ptr @ang, align 4, !tbaa !5
  %11 = fpext float %10 to double
  tail call void @glRotated(double noundef %11, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00)
  tail call void @glScalef(float noundef 5.000000e+00, float noundef 5.000000e+00, float noundef 5.000000e+00)
  tail call void @glTranslated(double noundef -5.000000e+00, double noundef -5.000000e+00, double noundef 0.000000e+00)
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @textureID, i64 4), align 4, !tbaa !9
  tail call void @glBindTexture(i32 noundef 3553, i32 noundef %12)
  tail call void @glDisable(i32 noundef 3168)
  tail call void @glDisable(i32 noundef 3169)
  tail call void @glBegin(i32 noundef 7)
  tail call void @glTexCoord2f(float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glVertex3f(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glTexCoord2f(float noundef 2.000000e+00, float noundef 0.000000e+00)
  tail call void @glVertex3f(float noundef 1.000000e+01, float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glTexCoord2f(float noundef 2.000000e+00, float noundef 2.000000e+00)
  tail call void @glVertex3f(float noundef 1.000000e+01, float noundef 1.000000e+01, float noundef 0.000000e+00)
  tail call void @glTexCoord2f(float noundef 0.000000e+00, float noundef 2.000000e+00)
  tail call void @glVertex3f(float noundef 0.000000e+00, float noundef 1.000000e+01, float noundef 0.000000e+00)
  tail call void @glEnd()
  tail call void @glLoadIdentity()
  tail call void @glTranslated(double noundef 6.000000e+01, double noundef 0.000000e+00, double noundef -1.200000e+02)
  %13 = load float, ptr @ang, align 4, !tbaa !5
  %14 = fpext float %13 to double
  %15 = fadd double %14, 1.000000e-01
  %16 = fptrunc double %15 to float
  store float %16, ptr @ang, align 4, !tbaa !5
  %17 = fpext float %16 to double
  tail call void @glRotated(double noundef %17, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00)
  tail call void @glScalef(float noundef 5.000000e+00, float noundef 5.000000e+00, float noundef 5.000000e+00)
  tail call void @glTranslated(double noundef -5.000000e+00, double noundef -5.000000e+00, double noundef 0.000000e+00)
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @textureID, i64 8), align 4, !tbaa !9
  tail call void @glBindTexture(i32 noundef 3553, i32 noundef %18)
  tail call void @glEnable(i32 noundef 3168)
  tail call void @glEnable(i32 noundef 3169)
  tail call void @glBegin(i32 noundef 7)
  tail call void @glVertex3f(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glVertex3f(float noundef 1.000000e+01, float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @glVertex3f(float noundef 1.000000e+01, float noundef 1.000000e+01, float noundef 0.000000e+00)
  tail call void @glVertex3f(float noundef 0.000000e+00, float noundef 1.000000e+01, float noundef 0.000000e+00)
  tail call void @glEnd()
  tail call void @glutSwapBuffers()
  ret void
}

declare void @glClear(i32 noundef) local_unnamed_addr #0

declare void @glMatrixMode(i32 noundef) local_unnamed_addr #0

declare void @glLoadIdentity() local_unnamed_addr #0

declare void @gluPerspective(double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0

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

declare void @glRotated(double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0

declare void @glScalef(float noundef, float noundef, float noundef) local_unnamed_addr #0

declare void @glBegin(i32 noundef) local_unnamed_addr #0

declare void @glTexCoord2f(float noundef, float noundef) local_unnamed_addr #0

declare void @glVertex3f(float noundef, float noundef, float noundef) local_unnamed_addr #0

declare void @glEnd() local_unnamed_addr #0

declare void @glutSwapBuffers() local_unnamed_addr #0

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 = { 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" }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass