; LLVM IR from openssl/openssl :: crypto/ct (ct_oct)

; 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.sct_st = type { i32, ptr, i64, ptr, i64, i64, ptr, i64, i8, i8, ptr, i64, i32, i32, i32 }

@.str = external hidden unnamed_addr constant [68 x i8], align 1
@__func__.i2o_SCT_signature = external hidden unnamed_addr constant [18 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

declare void @ERR_new() #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) #1

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) #1

; 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 i32 @i2o_SCT_signature(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store ptr null, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = call i32 @SCT_signature_is_complete(ptr noundef %10)
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %14, label %13

13:                                               ; preds = %2
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 159, ptr noundef @__func__.i2o_SCT_signature)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 50, i32 noundef 107, ptr noundef null)
  br label %85

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.sct_st, ptr %15, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %14
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 164, ptr noundef @__func__.i2o_SCT_signature)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 50, i32 noundef 103, ptr noundef null)
  br label %85

20:                                               ; preds = %14
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.sct_st, ptr %21, i32 0, i32 11
  %23 = load i64, ptr %22, align 8, !tbaa !13
  %24 = add i64 4, %23
  store i64 %24, ptr %6, align 8, !tbaa !14
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %82

27:                                               ; preds = %20
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %38

31:                                               ; preds = %27
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  store ptr %33, ptr %7, align 8, !tbaa !5
  %34 = load i64, ptr %6, align 8, !tbaa !14
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i64 %34
  store ptr %37, ptr %35, align 8, !tbaa !5
  br label %47

38:                                               ; preds = %27
  %39 = load i64, ptr %6, align 8, !tbaa !14
  %40 = call ptr @CRYPTO_malloc(i64 noundef %39, ptr noundef @.str, i32 noundef 180)
  store ptr %40, ptr %7, align 8, !tbaa !5
  store ptr %40, ptr %8, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  br label %85

44:                                               ; preds = %38
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %45, ptr %46, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %44, %31
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.sct_st, ptr %48, i32 0, i32 8
  %50 = load i8, ptr %49, align 8, !tbaa !15
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i32 1
  store ptr %52, ptr %7, align 8, !tbaa !5
  store i8 %50, ptr %51, align 1, !tbaa !16
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.sct_st, ptr %53, i32 0, i32 9
  %55 = load i8, ptr %54, align 1, !tbaa !17
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i32 1
  store ptr %57, ptr %7, align 8, !tbaa !5
  store i8 %55, ptr %56, align 1, !tbaa !16
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.sct_st, ptr %58, i32 0, i32 11
  %60 = load i64, ptr %59, align 8, !tbaa !13
  %61 = lshr i64 %60, 8
  %62 = and i64 %61, 255
  %63 = trunc i64 %62 to i8
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i64 0
  store i8 %63, ptr %65, align 1, !tbaa !16
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.sct_st, ptr %66, i32 0, i32 11
  %68 = load i64, ptr %67, align 8, !tbaa !13
  %69 = and i64 %68, 255
  %70 = trunc i64 %69 to i8
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 1
  store i8 %70, ptr %72, align 1, !tbaa !16
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %73, i64 2
  store ptr %74, ptr %7, align 8, !tbaa !5
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.sct_st, ptr %76, i32 0, i32 10
  %78 = load ptr, ptr %77, align 8, !tbaa !18
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.sct_st, ptr %79, i32 0, i32 11
  %81 = load i64, ptr %80, align 8, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %75, ptr align 1 %78, i64 %81, i1 false)
  br label %82

82:                                               ; preds = %47, %20
  %83 = load i64, ptr %6, align 8, !tbaa !14
  %84 = trunc i64 %83 to i32
  store i32 %84, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %87

85:                                               ; preds = %43, %19, %13
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %86, ptr noundef @.str, i32 noundef 194)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %87

87:                                               ; preds = %85, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %88 = load i32, ptr %3, align 4
  ret i32 %88
}

declare i32 @SCT_signature_is_complete(ptr noundef) #1

declare ptr @CRYPTO_malloc(i64 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare void @CRYPTO_free(ptr noundef, ptr noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!10, !11, i64 0}
!10 = !{!"sct_st", !11, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !12, i64 32, !12, i64 40, !6, i64 48, !12, i64 56, !7, i64 64, !7, i64 65, !6, i64 72, !12, i64 80, !11, i64 88, !11, i64 92, !11, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !12, i64 80}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !7, i64 64}
!16 = !{!7, !7, i64 0}
!17 = !{!10, !7, i64 65}
!18 = !{!10, !6, i64 72}


; 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 = external hidden unnamed_addr constant [68 x i8], align 1
@__func__.i2o_SCT_signature = external hidden unnamed_addr constant [18 x i8], align 1

declare void @ERR_new() local_unnamed_addr #0

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @i2o_SCT_signature(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = tail call i32 @SCT_signature_is_complete(ptr noundef %0) #3
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %.sink.split, label %4

4:                                                ; preds = %2
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %.not31 = icmp eq i32 %5, 0
  br i1 %.not31, label %6, label %.sink.split

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 80
  %8 = load i64, ptr %7, align 8, !tbaa !12
  %9 = add i64 %8, 4
  %.not32 = icmp eq ptr %1, null
  br i1 %.not32, label %34, label %10

10:                                               ; preds = %6
  %11 = load ptr, ptr %1, align 8, !tbaa !13
  %.not33 = icmp eq ptr %11, null
  br i1 %.not33, label %14, label %12

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %11, i64 %9
  br label %17

14:                                               ; preds = %10
  %15 = tail call ptr @CRYPTO_malloc(i64 noundef %9, ptr noundef nonnull @.str, i32 noundef 180) #3
  %16 = icmp eq ptr %15, null
  br i1 %16, label %36, label %17

17:                                               ; preds = %14, %12
  %storemerge = phi ptr [ %13, %12 ], [ %15, %14 ]
  %.026 = phi ptr [ %11, %12 ], [ %15, %14 ]
  store ptr %storemerge, ptr %1, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %0, i64 64
  %19 = load i8, ptr %18, align 8, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %.026, i64 1
  store i8 %19, ptr %.026, align 1, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %0, i64 65
  %22 = load i8, ptr %21, align 1, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %.026, i64 2
  store i8 %22, ptr %20, align 1, !tbaa !15
  %24 = load i64, ptr %7, align 8, !tbaa !12
  %25 = lshr i64 %24, 8
  %26 = trunc i64 %25 to i8
  store i8 %26, ptr %23, align 1, !tbaa !15
  %27 = load i64, ptr %7, align 8, !tbaa !12
  %28 = trunc i64 %27 to i8
  %29 = getelementptr inbounds i8, ptr %.026, i64 3
  store i8 %28, ptr %29, align 1, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %.026, i64 4
  %31 = getelementptr inbounds i8, ptr %0, i64 72
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  %33 = load i64, ptr %7, align 8, !tbaa !12
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %30, ptr align 1 %32, i64 %33, i1 false)
  br label %34

34:                                               ; preds = %17, %6
  %35 = trunc i64 %9 to i32
  br label %37

.sink.split:                                      ; preds = %4, %2
  %.sink34 = phi i32 [ 159, %2 ], [ 164, %4 ]
  %.sink = phi i32 [ 107, %2 ], [ 103, %4 ]
  tail call void @ERR_new() #3
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef %.sink34, ptr noundef nonnull @__func__.i2o_SCT_signature) #3
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 50, i32 noundef %.sink, ptr noundef null) #3
  br label %36

36:                                               ; preds = %.sink.split, %14
  tail call void @CRYPTO_free(ptr noundef null, ptr noundef nonnull @.str, i32 noundef 194) #3
  br label %37

37:                                               ; preds = %36, %34
  %.027 = phi i32 [ -1, %36 ], [ %35, %34 ]
  ret i32 %.027
}

declare i32 @SCT_signature_is_complete(ptr noundef) local_unnamed_addr #0

declare ptr @CRYPTO_malloc(i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare void @CRYPTO_free(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

attributes #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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !7, i64 0}
!6 = !{!"sct_st", !7, i64 0, !10, i64 8, !11, i64 16, !10, i64 24, !11, i64 32, !11, i64 40, !10, i64 48, !11, i64 56, !8, i64 64, !8, i64 65, !10, i64 72, !11, i64 80, !7, i64 88, !7, i64 92, !7, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !11, i64 80}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !8, i64 64}
!15 = !{!8, !8, i64 0}
!16 = !{!6, !8, i64 65}
!17 = !{!6, !10, i64 72}


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