; LLVM IR from Discngine/fpocket :: src (write_visu)

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

@write_mode = external global [10 x i8], align 1
@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @write_visualization(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load i8, ptr @write_mode, align 1, !tbaa !9
  %7 = sext i8 %6 to i32
  %8 = icmp eq i32 %7, 112
  br i1 %8, label %13, label %9

9:                                                ; preds = %2
  %10 = load i8, ptr @write_mode, align 1, !tbaa !9
  %11 = sext i8 %10 to i32
  %12 = icmp eq i32 %11, 98
  br i1 %12, label %13, label %18

13:                                               ; preds = %9, %2
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  call void @write_vmd(ptr noundef %14, ptr noundef %15)
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  call void @write_pymol(ptr noundef %16, ptr noundef %17)
  br label %18

18:                                               ; preds = %13, %9
  %19 = load i8, ptr @write_mode, align 1, !tbaa !9
  %20 = sext i8 %19 to i32
  %21 = icmp eq i32 %20, 109
  br i1 %21, label %26, label %22

22:                                               ; preds = %18
  %23 = load i8, ptr @write_mode, align 1, !tbaa !9
  %24 = sext i8 %23 to i32
  %25 = icmp eq i32 %24, 98
  br i1 %25, label %26, label %35

26:                                               ; preds = %22, %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr @.str, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @remove_ext(ptr noundef %27)
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call ptr @strcat(ptr noundef %28, ptr noundef %29) #4
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  call void @write_vmd_mmcif(ptr noundef %31, ptr noundef %32)
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  call void @write_pymol_mmcif(ptr noundef %33, ptr noundef %34)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %35

35:                                               ; preds = %26, %22
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @write_pymol(ptr noundef, 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 void @remove_ext(ptr noundef) #2

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #3

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

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

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

!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 = !{!7, !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"

@write_mode = external local_unnamed_addr global [10 x i8], align 1
@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @write_visualization(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = load i8, ptr @write_mode, align 1
  switch i8 %3, label %5 [
    i8 112, label %4
    i8 98, label %4
  ]

4:                                                ; preds = %2, %2
  tail call void @write_vmd(ptr noundef %0, ptr noundef %1)
  tail call void @write_pymol(ptr noundef %0, ptr noundef %1)
  %.pr = load i8, ptr @write_mode, align 1
  br label %5

5:                                                ; preds = %2, %4
  %6 = phi i8 [ %3, %2 ], [ %.pr, %4 ]
  switch i8 %6, label %9 [
    i8 109, label %7
    i8 98, label %7
  ]

7:                                                ; preds = %5, %5
  tail call void @remove_ext(ptr noundef %1) #3
  %8 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str) #3
  tail call void @write_vmd_mmcif(ptr noundef %0, ptr noundef %1)
  tail call void @write_pymol_mmcif(ptr noundef %0, ptr noundef %1)
  br label %9

9:                                                ; preds = %5, %7
  ret void
}

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

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

declare void @remove_ext(ptr noundef) local_unnamed_addr #1

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

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

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

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


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