; LLVM IR from Eukky/TRender :: lib/glew/src (visualinfo)

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

@file = external dso_local global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @PrintExtensions(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca [80 x i8], align 16
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr null, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 79
  store i8 0, ptr %6, align 1, !tbaa !11
  br label %7

7:                                                ; preds = %65, %1
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = load i8, ptr %8, align 1, !tbaa !11
  %10 = icmp ne i8 %9, 0
  br i1 %10, label %11, label %68

11:                                               ; preds = %7
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = load i8, ptr %12, align 1, !tbaa !11
  %14 = load i32, ptr %4, align 4, !tbaa !9
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr %4, align 4, !tbaa !9
  %16 = sext i32 %14 to i64
  %17 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 %16
  store i8 %13, ptr %17, align 1, !tbaa !11
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = load i8, ptr %18, align 1, !tbaa !11
  %20 = sext i8 %19 to i32
  %21 = icmp eq i32 %20, 32
  br i1 %21, label %22, label %46

22:                                               ; preds = %11
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 1
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = sext i8 %25 to i32
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %40

28:                                               ; preds = %22
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = sub nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 %31
  store i8 44, ptr %32, align 1, !tbaa !11
  %33 = load i32, ptr %4, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 %34
  store i8 32, ptr %35, align 1, !tbaa !11
  %36 = load i32, ptr %4, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %4, align 4, !tbaa !9
  %38 = sext i32 %36 to i64
  %39 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 %38
  store ptr %39, ptr %5, align 8, !tbaa !5
  br label %45

40:                                               ; preds = %22
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = sub nsw i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 %43
  store i8 0, ptr %44, align 1, !tbaa !11
  br label %45

45:                                               ; preds = %40, %28
  br label %46

46:                                               ; preds = %45, %11
  %47 = load i32, ptr %4, align 4, !tbaa !9
  %48 = icmp sgt i32 %47, 75
  br i1 %48, label %49, label %65

49:                                               ; preds = %46
  %50 = load i32, ptr %4, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 %51
  store i8 0, ptr %52, align 1, !tbaa !11
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  store i8 0, ptr %53, align 1, !tbaa !11
  %54 = load ptr, ptr @file, align 8, !tbaa !5
  %55 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 0
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.13, ptr noundef %55) #4
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i32 1
  store ptr %58, ptr %5, align 8, !tbaa !5
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = call i64 @strlen(ptr noundef %59) #5
  %61 = trunc i64 %60 to i32
  store i32 %61, ptr %4, align 4, !tbaa !9
  %62 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 0
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = call ptr @strcpy(ptr noundef %62, ptr noundef %63) #4
  br label %65

65:                                               ; preds = %49, %46
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i32 1
  store ptr %67, ptr %2, align 8, !tbaa !5
  br label %7, !llvm.loop !12

68:                                               ; preds = %7
  %69 = load i32, ptr %4, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 %70
  store i8 0, ptr %71, align 1, !tbaa !11
  %72 = load ptr, ptr @file, align 8, !tbaa !5
  %73 = getelementptr inbounds [80 x i8], ptr %3, i64 0, i64 0
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.14, ptr noundef %73) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #4
  ret void
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 willreturn memory(read) "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 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

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

@file = external dso_local local_unnamed_addr global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind uwtable
define dso_local void @PrintExtensions(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = alloca [80 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #5
  %3 = getelementptr inbounds i8, ptr %2, i64 79
  store i8 0, ptr %3, align 1, !tbaa !5
  %4 = load i8, ptr %0, align 1, !tbaa !5
  %.not22 = icmp eq i8 %4, 0
  br i1 %.not22, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %29
  %5 = phi i8 [ %31, %29 ], [ %4, %1 ]
  %.025 = phi ptr [ %.2, %29 ], [ null, %1 ]
  %.01624 = phi i32 [ %.218, %29 ], [ 0, %1 ]
  %.01923 = phi ptr [ %30, %29 ], [ %0, %1 ]
  %6 = add nsw i32 %.01624, 1
  %7 = sext i32 %.01624 to i64
  %8 = getelementptr inbounds [80 x i8], ptr %2, i64 0, i64 %7
  store i8 %5, ptr %8, align 1, !tbaa !5
  %9 = icmp eq i8 %5, 32
  br i1 %9, label %10, label %18

10:                                               ; preds = %.lr.ph
  %11 = getelementptr inbounds i8, ptr %.01923, i64 1
  %12 = load i8, ptr %11, align 1, !tbaa !5
  %.not21 = icmp eq i8 %12, 0
  br i1 %.not21, label %17, label %13

13:                                               ; preds = %10
  store i8 44, ptr %8, align 1, !tbaa !5
  %14 = sext i32 %6 to i64
  %15 = getelementptr inbounds [80 x i8], ptr %2, i64 0, i64 %14
  store i8 32, ptr %15, align 1, !tbaa !5
  %16 = add nsw i32 %.01624, 2
  br label %18

17:                                               ; preds = %10
  store i8 0, ptr %8, align 1, !tbaa !5
  br label %18

18:                                               ; preds = %13, %17, %.lr.ph
  %.117 = phi i32 [ %16, %13 ], [ %6, %17 ], [ %6, %.lr.ph ]
  %.1 = phi ptr [ %15, %13 ], [ %.025, %17 ], [ %.025, %.lr.ph ]
  %19 = icmp sgt i32 %.117, 75
  br i1 %19, label %20, label %29

20:                                               ; preds = %18
  %21 = zext nneg i32 %.117 to i64
  %22 = getelementptr inbounds [80 x i8], ptr %2, i64 0, i64 %21
  store i8 0, ptr %22, align 1, !tbaa !5
  store i8 0, ptr %.1, align 1, !tbaa !5
  %23 = load ptr, ptr @file, align 8, !tbaa !8
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.13, ptr noundef nonnull %2) #5
  %25 = getelementptr inbounds i8, ptr %.1, i64 1
  %26 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %25) #6
  %27 = trunc i64 %26 to i32
  %28 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) %25) #5
  br label %29

29:                                               ; preds = %20, %18
  %.218 = phi i32 [ %27, %20 ], [ %.117, %18 ]
  %.2 = phi ptr [ %25, %20 ], [ %.1, %18 ]
  %30 = getelementptr inbounds i8, ptr %.01923, i64 1
  %31 = load i8, ptr %30, align 1, !tbaa !5
  %.not = icmp eq i8 %31, 0
  br i1 %.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !10

._crit_edge.loopexit:                             ; preds = %29
  %32 = sext i32 %.218 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %1
  %.016.lcssa = phi i64 [ 0, %1 ], [ %32, %._crit_edge.loopexit ]
  %33 = getelementptr inbounds [80 x i8], ptr %2, i64 0, i64 %.016.lcssa
  store i8 0, ptr %33, align 1, !tbaa !5
  %34 = load ptr, ptr @file, align 8, !tbaa !8
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.14, ptr noundef nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #5
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree 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 #2 = { nofree 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass