; LLVM IR from gost-engine/engine :: test_tls (main)

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

@verbose = external hidden global i32, align 4
@.str.26 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [34 x i8], align 1
@cipher_list = external hidden global ptr, align 8
@.str.29 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @test(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 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
  %7 = alloca ptr, align 8
  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) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  %8 = call i32 @OPENSSL_init_crypto(i64 noundef 76, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %9 = call ptr @getenv(ptr noundef @.str.26) #5
  store ptr %9, ptr %7, align 8, !tbaa !9
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %14

11:                                               ; preds = %2
  %12 = load ptr, ptr %7, align 8, !tbaa !9
  %13 = call i32 @atoi(ptr noundef %12) #6
  store i32 %13, ptr @verbose, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %11, %2
  %15 = call i32 @test(ptr noundef @.str.27, ptr noundef null)
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = or i32 %16, %15
  store i32 %17, ptr %6, align 4, !tbaa !5
  store ptr @.str.28, ptr @cipher_list, align 8, !tbaa !9
  %18 = call i32 @test(ptr noundef @.str.29, ptr noundef @.str.30)
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = or i32 %19, %18
  store i32 %20, ptr %6, align 4, !tbaa !5
  %21 = call i32 @test(ptr noundef @.str.29, ptr noundef @.str.31)
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = or i32 %22, %21
  store i32 %23, ptr %6, align 4, !tbaa !5
  %24 = call i32 @test(ptr noundef @.str.29, ptr noundef @.str.32)
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = or i32 %25, %24
  store i32 %26, ptr %6, align 4, !tbaa !5
  %27 = call i32 @test(ptr noundef @.str.29, ptr noundef @.str.33)
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = or i32 %28, %27
  store i32 %29, ptr %6, align 4, !tbaa !5
  %30 = call i32 @test(ptr noundef @.str.34, ptr noundef @.str.30)
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = or i32 %31, %30
  store i32 %32, ptr %6, align 4, !tbaa !5
  %33 = call i32 @test(ptr noundef @.str.34, ptr noundef @.str.31)
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = or i32 %34, %33
  store i32 %35, ptr %6, align 4, !tbaa !5
  %36 = call i32 @test(ptr noundef @.str.34, ptr noundef @.str.32)
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = or i32 %37, %36
  store i32 %38, ptr %6, align 4, !tbaa !5
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %14
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.35)
  br label %45

43:                                               ; preds = %14
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.36)
  br label %45

45:                                               ; preds = %43, %41
  %46 = load i32, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  ret i32 %46
}

declare i32 @OPENSSL_init_crypto(i64 noundef, ptr noundef) #2

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #4

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 = { inlinehint nounwind willreturn memory(read) 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 #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 = !{!"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}


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

@verbose = external hidden local_unnamed_addr global i32, align 4
@.str.26 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [34 x i8], align 1
@cipher_list = external hidden local_unnamed_addr global ptr, align 8
@.str.29 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @test(ptr noundef, 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 i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = tail call i32 @OPENSSL_init_crypto(i64 noundef 76, ptr noundef null) #5
  %4 = tail call ptr @getenv(ptr noundef nonnull @.str.26) #5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %7, label %5

5:                                                ; preds = %2
  %6 = tail call i32 @atoi(ptr nocapture noundef %4) #6
  store i32 %6, ptr @verbose, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %5, %2
  %8 = tail call i32 @test(ptr noundef nonnull @.str.27, ptr noundef null)
  store ptr @.str.28, ptr @cipher_list, align 8, !tbaa !9
  %9 = tail call i32 @test(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.30)
  %10 = or i32 %9, %8
  %11 = tail call i32 @test(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.31)
  %12 = or i32 %10, %11
  %13 = tail call i32 @test(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.32)
  %14 = or i32 %12, %13
  %15 = tail call i32 @test(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.33)
  %16 = or i32 %14, %15
  %17 = tail call i32 @test(ptr noundef nonnull @.str.34, ptr noundef nonnull @.str.30)
  %18 = or i32 %16, %17
  %19 = tail call i32 @test(ptr noundef nonnull @.str.34, ptr noundef nonnull @.str.31)
  %20 = or i32 %18, %19
  %21 = tail call i32 @test(ptr noundef nonnull @.str.34, ptr noundef nonnull @.str.32)
  %22 = or i32 %20, %21
  %.not10 = icmp eq i32 %22, 0
  %.str.36..str.35 = select i1 %.not10, ptr @.str.36, ptr @.str.35
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.36..str.35)
  ret i32 %22
}

declare i32 @OPENSSL_init_crypto(i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #4

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 = { nofree nounwind 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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #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 = !{!"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}


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