; LLVM IR from paroj/gltut :: glsdk/freeglut/progs/demos/Fractals (fractals)

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

@window_title = external dso_local global [80 x i8], align 16
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@continue_in_main_loop = external hidden global i32, align 4
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @readConfigFile(ptr noundef) #0

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

declare i32 @printf(ptr noundef, ...) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @glutInitWindowSize(i32 noundef 500, i32 noundef 250)
  call void @glutInitWindowPosition(i32 noundef 140, i32 noundef 140)
  call void @glutInitDisplayMode(i32 noundef 2)
  %7 = load ptr, ptr %5, align 8, !tbaa !9
  call void @glutInit(ptr noundef %4, ptr noundef %7)
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 1
  br i1 %9, label %10, label %14

10:                                               ; preds = %2
  %11 = load ptr, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds ptr, ptr %11, i64 1
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  call void @readConfigFile(ptr noundef %13)
  br label %15

14:                                               ; preds = %2
  call void @readConfigFile(ptr noundef @.str.6)
  br label %15

15:                                               ; preds = %14, %10
  %16 = call i32 @glutCreateWindow(ptr noundef @window_title)
  store i32 %16, ptr %6, align 4, !tbaa !5
  call void @glClearColor(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00)
  call void @glutReshapeFunc(ptr noundef @Reshape)
  call void @glutKeyboardFunc(ptr noundef @Key)
  call void @glutSpecialFunc(ptr noundef @Special)
  call void @glutDisplayFunc(ptr noundef @Display)
  br label %17

17:                                               ; preds = %20, %15
  %18 = load i32, ptr @continue_in_main_loop, align 4, !tbaa !5
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  call void @glutMainLoopEvent()
  br label %17, !llvm.loop !11

21:                                               ; preds = %17
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  ret i32 0
}

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

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

declare void @glutInitDisplayMode(i32 noundef) #2

declare void @glutInit(ptr noundef, ptr noundef) #2

declare i32 @glutCreateWindow(ptr noundef) #2

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

declare void @glutReshapeFunc(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @Reshape(i32 noundef, i32 noundef) #0

declare void @glutKeyboardFunc(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @Key(i8 noundef zeroext, i32 noundef, i32 noundef) #0

declare void @glutSpecialFunc(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @Special(i32 noundef, i32 noundef, i32 noundef) #0

declare void @glutDisplayFunc(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @Display() #0

declare void @glutMainLoopEvent() #2

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

@window_title = external dso_local global [80 x i8], align 16
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@continue_in_main_loop = external hidden local_unnamed_addr global i32, align 4
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @readConfigFile(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  tail call void @glutInitWindowSize(i32 noundef 500, i32 noundef 250) #3
  tail call void @glutInitWindowPosition(i32 noundef 140, i32 noundef 140) #3
  tail call void @glutInitDisplayMode(i32 noundef 2) #3
  call void @glutInit(ptr noundef nonnull %3, ptr noundef %1) #3
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 1
  br i1 %5, label %6, label %9

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  call void @readConfigFile(ptr noundef %8)
  br label %10

9:                                                ; preds = %2
  call void @readConfigFile(ptr noundef nonnull @.str.6)
  br label %10

10:                                               ; preds = %9, %6
  %11 = call i32 @glutCreateWindow(ptr noundef nonnull @window_title) #3
  call void @glClearColor(float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00, float noundef 1.000000e+00) #3
  call void @glutReshapeFunc(ptr noundef nonnull @Reshape) #3
  call void @glutKeyboardFunc(ptr noundef nonnull @Key) #3
  call void @glutSpecialFunc(ptr noundef nonnull @Special) #3
  call void @glutDisplayFunc(ptr noundef nonnull @Display) #3
  %12 = load i32, ptr @continue_in_main_loop, align 4, !tbaa !5
  %.not2 = icmp eq i32 %12, 0
  br i1 %.not2, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10, %.lr.ph
  call void @glutMainLoopEvent() #3
  %13 = load i32, ptr @continue_in_main_loop, align 4, !tbaa !5
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %10
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  ret i32 0
}

declare void @glutInitWindowSize(i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @glutInitWindowPosition(i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @glutInitDisplayMode(i32 noundef) local_unnamed_addr #2

declare void @glutInit(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @glutCreateWindow(ptr noundef) local_unnamed_addr #2

declare void @glClearColor(float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2

declare void @glutReshapeFunc(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @Reshape(i32 noundef, i32 noundef) #0

declare void @glutKeyboardFunc(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @Key(i8 noundef zeroext, i32 noundef, i32 noundef) #0

declare void @glutSpecialFunc(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @Special(i32 noundef, i32 noundef, i32 noundef) #0

declare void @glutDisplayFunc(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @Display() #0

declare void @glutMainLoopEvent() local_unnamed_addr #2

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 = { 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 = { "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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass