; LLVM IR from aws/s2n-tls :: bin (common)

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

%struct.verify_data = type { ptr }

@.str.50 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [14 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @unsafe_verify_host(ptr noundef %0, i64 noundef %1, ptr noundef %2) #1 {
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %13, ptr %8, align 8, !tbaa !5
  %14 = load i64, ptr %6, align 8, !tbaa !9
  %15 = icmp ugt i64 %14, 2
  br i1 %15, label %16, label %40

16:                                               ; preds = %3
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 0
  %19 = load i8, ptr %18, align 1, !tbaa !11
  %20 = sext i8 %19 to i32
  %21 = icmp eq i32 %20, 42
  br i1 %21, label %22, label %40

22:                                               ; preds = %16
  %23 = load ptr, ptr %5, 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 eq i32 %26, 46
  br i1 %27, label %28, label %40

28:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.verify_data, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !12
  %32 = call ptr @strstr(ptr noundef %31, ptr noundef @.str.50) #4
  store ptr %32, ptr %9, align 8, !tbaa !5
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 1
  %36 = call i32 @strcasecmp(ptr noundef %33, ptr noundef %35) #4
  %37 = icmp eq i32 %36, 0
  %38 = zext i1 %37 to i32
  %39 = trunc i32 %38 to i8
  store i8 %39, ptr %4, align 1
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %99

40:                                               ; preds = %22, %16, %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #3
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.verify_data, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !12
  %44 = call i32 @strcasecmp(ptr noundef %43, ptr noundef @.str.51) #4
  %45 = icmp eq i32 %44, 0
  %46 = zext i1 %45 to i8
  store i8 %46, ptr %11, align 1, !tbaa !14
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.verify_data, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !12
  %50 = call i32 @strcasecmp(ptr noundef %49, ptr noundef @.str.52) #4
  %51 = icmp eq i32 %50, 0
  %52 = zext i1 %51 to i32
  %53 = load i8, ptr %11, align 1, !tbaa !14, !range !16, !noundef !17
  %54 = trunc i8 %53 to i1
  %55 = zext i1 %54 to i32
  %56 = or i32 %55, %52
  %57 = icmp ne i32 %56, 0
  %58 = zext i1 %57 to i8
  store i8 %58, ptr %11, align 1, !tbaa !14
  %59 = load i8, ptr %11, align 1, !tbaa !14, !range !16, !noundef !17
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %89

61:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #3
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = call i32 @strcasecmp(ptr noundef %62, ptr noundef @.str.51) #4
  %64 = icmp eq i32 %63, 0
  %65 = zext i1 %64 to i8
  store i8 %65, ptr %12, align 1, !tbaa !14
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = call i32 @strcasecmp(ptr noundef %66, ptr noundef @.str.52) #4
  %68 = icmp eq i32 %67, 0
  %69 = zext i1 %68 to i32
  %70 = load i8, ptr %12, align 1, !tbaa !14, !range !16, !noundef !17
  %71 = trunc i8 %70 to i1
  %72 = zext i1 %71 to i32
  %73 = or i32 %72, %69
  %74 = icmp ne i32 %73, 0
  %75 = zext i1 %74 to i8
  store i8 %75, ptr %12, align 1, !tbaa !14
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = call i32 @strcasecmp(ptr noundef %76, ptr noundef @.str.53) #4
  %78 = icmp eq i32 %77, 0
  %79 = zext i1 %78 to i32
  %80 = load i8, ptr %12, align 1, !tbaa !14, !range !16, !noundef !17
  %81 = trunc i8 %80 to i1
  %82 = zext i1 %81 to i32
  %83 = or i32 %82, %79
  %84 = icmp ne i32 %83, 0
  %85 = zext i1 %84 to i8
  store i8 %85, ptr %12, align 1, !tbaa !14
  %86 = load i8, ptr %12, align 1, !tbaa !14, !range !16, !noundef !17
  %87 = trunc i8 %86 to i1
  %88 = zext i1 %87 to i8
  store i8 %88, ptr %4, align 1
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #3
  br label %98

89:                                               ; preds = %40
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.verify_data, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !12
  %94 = call i32 @strcasecmp(ptr noundef %90, ptr noundef %93) #4
  %95 = icmp eq i32 %94, 0
  %96 = zext i1 %95 to i32
  %97 = trunc i32 %96 to i8
  store i8 %97, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %98

98:                                               ; preds = %89, %61
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  br label %99

99:                                               ; preds = %98, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %100 = load i8, ptr %4, align 1
  ret i8 %100
}

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strstr(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcasecmp(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nounwind }
attributes #4 = { 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 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"verify_data", !6, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}


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

@.str.50 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(read) uwtable
define dso_local zeroext range(i8 0, 2) i8 @unsafe_verify_host(ptr nocapture noundef readonly %0, i64 noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = icmp ugt i64 %1, 2
  br i1 %4, label %5, label %17

5:                                                ; preds = %3
  %6 = load i8, ptr %0, align 1, !tbaa !5
  %7 = icmp eq i8 %6, 42
  br i1 %7, label %8, label %17

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 1
  %10 = load i8, ptr %9, align 1, !tbaa !5
  %11 = icmp eq i8 %10, 46
  br i1 %11, label %12, label %17

12:                                               ; preds = %8
  %13 = load ptr, ptr %2, align 8, !tbaa !8
  %14 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.50) #3
  %15 = tail call i32 @strcasecmp(ptr noundef %14, ptr noundef nonnull %9) #3
  %16 = icmp eq i32 %15, 0
  br label %36

17:                                               ; preds = %8, %5, %3
  %18 = load ptr, ptr %2, align 8, !tbaa !8
  %19 = tail call i32 @strcasecmp(ptr noundef %18, ptr noundef nonnull @.str.51) #3
  %20 = icmp eq i32 %19, 0
  %21 = tail call i32 @strcasecmp(ptr noundef %18, ptr noundef nonnull @.str.52) #3
  %22 = icmp eq i32 %21, 0
  %23 = or i1 %20, %22
  br i1 %23, label %24, label %33

24:                                               ; preds = %17
  %25 = tail call i32 @strcasecmp(ptr noundef %0, ptr noundef nonnull @.str.51) #3
  %26 = icmp eq i32 %25, 0
  %27 = tail call i32 @strcasecmp(ptr noundef %0, ptr noundef nonnull @.str.52) #3
  %28 = icmp eq i32 %27, 0
  %29 = or i1 %26, %28
  %30 = tail call i32 @strcasecmp(ptr noundef %0, ptr noundef nonnull @.str.53) #3
  %31 = icmp eq i32 %30, 0
  %32 = or i1 %29, %31
  br label %36

33:                                               ; preds = %17
  %34 = tail call i32 @strcasecmp(ptr noundef %0, ptr noundef %18) #3
  %35 = icmp eq i32 %34, 0
  br label %36

36:                                               ; preds = %24, %33, %12
  %.1.in = phi i1 [ %16, %12 ], [ %32, %24 ], [ %35, %33 ]
  %.1 = zext i1 %.1.in to i8
  ret i8 %.1
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare i32 @strcasecmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nofree 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 #3 = { 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, !10, i64 0}
!9 = !{!"verify_data", !10, i64 0}
!10 = !{!"any pointer", !6, i64 0}


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