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

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

@texture_id = external dso_local global i32, align 4
@texture_bmp = external dso_local global ptr, align 8
@texture_data = external dso_local global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13buildTexturesv() #0 {
  %1 = alloca float, align 4
  %2 = alloca [4 x float], align 16
  %3 = alloca [4 x float], align 16
  call void @glGenTextures(i32 noundef 1, ptr noundef @texture_id)
  %4 = load i32, ptr @texture_id, align 4, !tbaa !5
  call void @glBindTexture(i32 noundef 3553, i32 noundef %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store float 0x3FB99999A0000000, ptr %1, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #3
  %5 = load float, ptr %1, align 4, !tbaa !9
  store float %5, ptr %2, align 4, !tbaa !9
  %6 = getelementptr inbounds float, ptr %2, i64 1
  store float 0.000000e+00, ptr %6, align 4, !tbaa !9
  %7 = getelementptr inbounds float, ptr %2, i64 2
  store float 0.000000e+00, ptr %7, align 4, !tbaa !9
  %8 = getelementptr inbounds float, ptr %2, i64 3
  store float 0.000000e+00, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #3
  store float 0.000000e+00, ptr %3, align 4, !tbaa !9
  %9 = getelementptr inbounds float, ptr %3, i64 1
  %10 = load float, ptr %1, align 4, !tbaa !9
  store float %10, ptr %9, align 4, !tbaa !9
  %11 = getelementptr inbounds float, ptr %3, i64 2
  store float 0.000000e+00, ptr %11, align 4, !tbaa !9
  %12 = getelementptr inbounds float, ptr %3, i64 3
  store float 0.000000e+00, ptr %12, align 4, !tbaa !9
  %13 = getelementptr inbounds [4 x float], ptr %2, i64 0, i64 0
  call void @glTexGenfv(i32 noundef 8192, i32 noundef 9473, ptr noundef %13)
  %14 = getelementptr inbounds [4 x float], ptr %3, i64 0, i64 0
  call void @glTexGenfv(i32 noundef 8193, i32 noundef 9473, ptr noundef %14)
  call void @glTexGeni(i32 noundef 8192, i32 noundef 9472, i32 noundef 9217)
  call void @glTexGeni(i32 noundef 8193, i32 noundef 9472, i32 noundef 9217)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10242, i32 noundef 10497)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10243, i32 noundef 10497)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10241, i32 noundef 9985)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10240, i32 noundef 9729)
  %15 = load ptr, ptr @texture_bmp, align 8, !tbaa !11
  %16 = call noundef i32 @_ZN3Bmp8getWidthEv(ptr noundef nonnull align 8 dereferenceable(88) %15)
  %17 = load ptr, ptr @texture_bmp, align 8, !tbaa !11
  %18 = call noundef i32 @_ZN3Bmp9getHeightEv(ptr noundef nonnull align 8 dereferenceable(88) %17)
  %19 = load ptr, ptr @texture_data, align 8, !tbaa !11
  %20 = call i32 @gluBuild2DMipmaps(i32 noundef 3553, i32 noundef 6407, i32 noundef %16, i32 noundef %18, i32 noundef 6407, i32 noundef 5121, ptr noundef %19)
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  ret void
}

declare void @glGenTextures(i32 noundef, ptr noundef) #1

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

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

declare void @glTexGenfv(i32 noundef, i32 noundef, ptr noundef) #1

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

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

declare i32 @gluBuild2DMipmaps(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #1

declare noundef i32 @_ZN3Bmp8getWidthEv(ptr noundef nonnull align 8 dereferenceable(88)) #1

declare noundef i32 @_ZN3Bmp9getHeightEv(ptr noundef nonnull align 8 dereferenceable(88)) #1

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

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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

@texture_id = external dso_local global i32, align 4
@texture_bmp = external dso_local local_unnamed_addr global ptr, align 8
@texture_data = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13buildTexturesv() local_unnamed_addr #0 {
  %1 = alloca [4 x float], align 16
  %2 = alloca [4 x float], align 16
  tail call void @glGenTextures(i32 noundef 1, ptr noundef nonnull @texture_id)
  %3 = load i32, ptr @texture_id, align 4, !tbaa !5
  tail call void @glBindTexture(i32 noundef 3553, i32 noundef %3)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #3
  store <4 x float> <float 0x3FB99999A0000000, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, ptr %1, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  store <4 x float> <float 0.000000e+00, float 0x3FB99999A0000000, float 0.000000e+00, float 0.000000e+00>, ptr %2, align 16, !tbaa !9
  call void @glTexGenfv(i32 noundef 8192, i32 noundef 9473, ptr noundef nonnull %1)
  call void @glTexGenfv(i32 noundef 8193, i32 noundef 9473, ptr noundef nonnull %2)
  call void @glTexGeni(i32 noundef 8192, i32 noundef 9472, i32 noundef 9217)
  call void @glTexGeni(i32 noundef 8193, i32 noundef 9472, i32 noundef 9217)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10242, i32 noundef 10497)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10243, i32 noundef 10497)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10241, i32 noundef 9985)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10240, i32 noundef 9729)
  %4 = load ptr, ptr @texture_bmp, align 8, !tbaa !11
  %5 = call noundef i32 @_ZN3Bmp8getWidthEv(ptr noundef nonnull align 8 dereferenceable(88) %4)
  %6 = load ptr, ptr @texture_bmp, align 8, !tbaa !11
  %7 = call noundef i32 @_ZN3Bmp9getHeightEv(ptr noundef nonnull align 8 dereferenceable(88) %6)
  %8 = load ptr, ptr @texture_data, align 8, !tbaa !11
  %9 = call i32 @gluBuild2DMipmaps(i32 noundef 3553, i32 noundef 6407, i32 noundef %5, i32 noundef %7, i32 noundef 6407, i32 noundef 5121, ptr noundef %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #3
  ret void
}

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

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

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

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

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

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

declare i32 @gluBuild2DMipmaps(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare noundef i32 @_ZN3Bmp8getWidthEv(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #1

declare noundef i32 @_ZN3Bmp9getHeightEv(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #1

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass