; LLVM IR from PacktPublishing/Demystifying-Cryptography-with-OpenSSL-3 :: Chapter04 (hmac)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [107 x i8], align 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
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store ptr null, ptr %8, align 8, !tbaa !9
  %15 = call ptr @llvm.stacksave.p0()
  store ptr %15, ptr %9, align 8
  %16 = alloca i8, i64 32, align 16
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = icmp ne i32 %17, 3
  br i1 %18, label %19, label %25

19:                                               ; preds = %2
  %20 = load ptr, ptr @stderr, align 8, !tbaa !9
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = getelementptr inbounds ptr, ptr %21, i64 0
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str, ptr noundef %23) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %80

25:                                               ; preds = %2
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 1
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  store ptr %28, ptr %10, align 8, !tbaa !9
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i64 2
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  store ptr %31, ptr %11, align 8, !tbaa !9
  store i64 0, ptr %12, align 8, !tbaa !11
  %32 = load ptr, ptr %11, align 8, !tbaa !9
  %33 = call ptr @OPENSSL_hexstr2buf(ptr noundef %32, ptr noundef %12)
  store ptr %33, ptr %8, align 8, !tbaa !9
  %34 = load ptr, ptr %8, align 8, !tbaa !9
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %39

36:                                               ; preds = %25
  %37 = load i64, ptr %12, align 8, !tbaa !11
  %38 = icmp sle i64 %37, 0
  br i1 %38, label %39, label %43

39:                                               ; preds = %36, %25
  %40 = load ptr, ptr @stderr, align 8, !tbaa !9
  %41 = load ptr, ptr %11, align 8, !tbaa !9
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.1, ptr noundef %41) #5
  br label %79

43:                                               ; preds = %36
  %44 = load ptr, ptr %10, align 8, !tbaa !9
  %45 = call noalias ptr @fopen(ptr noundef %44, ptr noundef @.str.2)
  store ptr %45, ptr %7, align 8, !tbaa !9
  %46 = load ptr, ptr %7, align 8, !tbaa !9
  %47 = icmp ne ptr %46, null
  br i1 %47, label %52, label %48

48:                                               ; preds = %43
  %49 = load ptr, ptr @stderr, align 8, !tbaa !9
  %50 = load ptr, ptr %10, align 8, !tbaa !9
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.3, ptr noundef %50) #5
  br label %79

52:                                               ; preds = %43
  %53 = load ptr, ptr %7, align 8, !tbaa !9
  %54 = load ptr, ptr %8, align 8, !tbaa !9
  %55 = load i64, ptr %12, align 8, !tbaa !11
  %56 = load ptr, ptr @stderr, align 8, !tbaa !9
  %57 = call i32 @calculate_hmac(ptr noundef %53, ptr noundef %54, i64 noundef %55, ptr noundef %16, ptr noundef %56)
  store i32 %57, ptr %13, align 4, !tbaa !5
  %58 = load i32, ptr %13, align 4, !tbaa !5
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %63

60:                                               ; preds = %52
  %61 = load ptr, ptr @stderr, align 8, !tbaa !9
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.4) #5
  br label %79

63:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %64

64:                                               ; preds = %74, %63
  %65 = load i64, ptr %14, align 8, !tbaa !11
  %66 = icmp ult i64 %65, 32
  br i1 %66, label %68, label %67

67:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %77

68:                                               ; preds = %64
  %69 = load i64, ptr %14, align 8, !tbaa !11
  %70 = getelementptr inbounds i8, ptr %16, i64 %69
  %71 = load i8, ptr %70, align 1, !tbaa !13
  %72 = zext i8 %71 to i32
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %72)
  br label %74

74:                                               ; preds = %68
  %75 = load i64, ptr %14, align 8, !tbaa !11
  %76 = add i64 %75, 1
  store i64 %76, ptr %14, align 8, !tbaa !11
  br label %64, !llvm.loop !14

77:                                               ; preds = %67
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %80

79:                                               ; preds = %60, %48, %39
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %79, %77, %19
  %81 = load ptr, ptr %8, align 8, !tbaa !9
  call void @CRYPTO_free(ptr noundef %81, ptr noundef @.str.7, i32 noundef 56)
  %82 = load ptr, ptr %7, align 8, !tbaa !9
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %87

84:                                               ; preds = %80
  %85 = load ptr, ptr %7, align 8, !tbaa !9
  %86 = call i32 @fclose(ptr noundef %85)
  br label %87

87:                                               ; preds = %84, %80
  %88 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %88, ptr %3, align 4
  %89 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %89)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %90 = load i32, ptr %3, align 4
  ret i32 %90
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

declare ptr @OPENSSL_hexstr2buf(ptr noundef, ptr noundef) #4

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @calculate_hmac(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

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

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

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

declare i32 @fclose(ptr noundef) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { nocallback nofree nosync nounwind willreturn }
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 = { "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 }

!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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [107 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = alloca [32 x i8], align 16
  %.not = icmp eq i32 %0, 3
  br i1 %.not, label %9, label %5

5:                                                ; preds = %2
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str, ptr noundef %7) #3
  br label %.thread

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 0, ptr %3, align 8, !tbaa !9
  %14 = call ptr @OPENSSL_hexstr2buf(ptr noundef %13, ptr noundef nonnull %3) #4
  %15 = icmp eq ptr %14, null
  %16 = load i64, ptr %3, align 8
  %17 = icmp slt i64 %16, 1
  %or.cond = select i1 %15, i1 true, i1 %17
  br i1 %or.cond, label %18, label %21

18:                                               ; preds = %9
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.1, ptr noundef %13) #3
  br label %.thread

21:                                               ; preds = %9
  %22 = call noalias ptr @fopen(ptr noundef %11, ptr noundef nonnull @.str.2)
  %.not28 = icmp eq ptr %22, null
  br i1 %.not28, label %23, label %26

23:                                               ; preds = %21
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.3, ptr noundef %11) #3
  br label %.thread

26:                                               ; preds = %21
  %27 = load i64, ptr %3, align 8, !tbaa !9
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 @calculate_hmac(ptr noundef nonnull %22, ptr noundef nonnull %14, i64 noundef %27, ptr noundef nonnull %4, ptr noundef %28)
  %.not29 = icmp eq i32 %29, 0
  br i1 %.not29, label %.preheader.preheader, label %.thread36

.preheader.preheader:                             ; preds = %26
  %30 = load i8, ptr %4, align 16, !tbaa !11
  %31 = zext i8 %30 to i32
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %31)
  %33 = getelementptr inbounds i8, ptr %4, i64 1
  %34 = load i8, ptr %33, align 1, !tbaa !11
  %35 = zext i8 %34 to i32
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %35)
  %37 = getelementptr inbounds i8, ptr %4, i64 2
  %38 = load i8, ptr %37, align 2, !tbaa !11
  %39 = zext i8 %38 to i32
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %39)
  %41 = getelementptr inbounds i8, ptr %4, i64 3
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = zext i8 %42 to i32
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %43)
  %45 = getelementptr inbounds i8, ptr %4, i64 4
  %46 = load i8, ptr %45, align 4, !tbaa !11
  %47 = zext i8 %46 to i32
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %47)
  %49 = getelementptr inbounds i8, ptr %4, i64 5
  %50 = load i8, ptr %49, align 1, !tbaa !11
  %51 = zext i8 %50 to i32
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %51)
  %53 = getelementptr inbounds i8, ptr %4, i64 6
  %54 = load i8, ptr %53, align 2, !tbaa !11
  %55 = zext i8 %54 to i32
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %55)
  %57 = getelementptr inbounds i8, ptr %4, i64 7
  %58 = load i8, ptr %57, align 1, !tbaa !11
  %59 = zext i8 %58 to i32
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %59)
  %61 = getelementptr inbounds i8, ptr %4, i64 8
  %62 = load i8, ptr %61, align 8, !tbaa !11
  %63 = zext i8 %62 to i32
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %63)
  %65 = getelementptr inbounds i8, ptr %4, i64 9
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = zext i8 %66 to i32
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %67)
  %69 = getelementptr inbounds i8, ptr %4, i64 10
  %70 = load i8, ptr %69, align 2, !tbaa !11
  %71 = zext i8 %70 to i32
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %71)
  %73 = getelementptr inbounds i8, ptr %4, i64 11
  %74 = load i8, ptr %73, align 1, !tbaa !11
  %75 = zext i8 %74 to i32
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %75)
  %77 = getelementptr inbounds i8, ptr %4, i64 12
  %78 = load i8, ptr %77, align 4, !tbaa !11
  %79 = zext i8 %78 to i32
  %80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %79)
  %81 = getelementptr inbounds i8, ptr %4, i64 13
  %82 = load i8, ptr %81, align 1, !tbaa !11
  %83 = zext i8 %82 to i32
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %83)
  %85 = getelementptr inbounds i8, ptr %4, i64 14
  %86 = load i8, ptr %85, align 2, !tbaa !11
  %87 = zext i8 %86 to i32
  %88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %87)
  %89 = getelementptr inbounds i8, ptr %4, i64 15
  %90 = load i8, ptr %89, align 1, !tbaa !11
  %91 = zext i8 %90 to i32
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %91)
  %93 = getelementptr inbounds i8, ptr %4, i64 16
  %94 = load i8, ptr %93, align 16, !tbaa !11
  %95 = zext i8 %94 to i32
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %95)
  %97 = getelementptr inbounds i8, ptr %4, i64 17
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = zext i8 %98 to i32
  %100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %99)
  %101 = getelementptr inbounds i8, ptr %4, i64 18
  %102 = load i8, ptr %101, align 2, !tbaa !11
  %103 = zext i8 %102 to i32
  %104 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %103)
  %105 = getelementptr inbounds i8, ptr %4, i64 19
  %106 = load i8, ptr %105, align 1, !tbaa !11
  %107 = zext i8 %106 to i32
  %108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %107)
  %109 = getelementptr inbounds i8, ptr %4, i64 20
  %110 = load i8, ptr %109, align 4, !tbaa !11
  %111 = zext i8 %110 to i32
  %112 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %111)
  %113 = getelementptr inbounds i8, ptr %4, i64 21
  %114 = load i8, ptr %113, align 1, !tbaa !11
  %115 = zext i8 %114 to i32
  %116 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %115)
  %117 = getelementptr inbounds i8, ptr %4, i64 22
  %118 = load i8, ptr %117, align 2, !tbaa !11
  %119 = zext i8 %118 to i32
  %120 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %119)
  %121 = getelementptr inbounds i8, ptr %4, i64 23
  %122 = load i8, ptr %121, align 1, !tbaa !11
  %123 = zext i8 %122 to i32
  %124 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %123)
  %125 = getelementptr inbounds i8, ptr %4, i64 24
  %126 = load i8, ptr %125, align 8, !tbaa !11
  %127 = zext i8 %126 to i32
  %128 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %127)
  %129 = getelementptr inbounds i8, ptr %4, i64 25
  %130 = load i8, ptr %129, align 1, !tbaa !11
  %131 = zext i8 %130 to i32
  %132 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %131)
  %133 = getelementptr inbounds i8, ptr %4, i64 26
  %134 = load i8, ptr %133, align 2, !tbaa !11
  %135 = zext i8 %134 to i32
  %136 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %135)
  %137 = getelementptr inbounds i8, ptr %4, i64 27
  %138 = load i8, ptr %137, align 1, !tbaa !11
  %139 = zext i8 %138 to i32
  %140 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %139)
  %141 = getelementptr inbounds i8, ptr %4, i64 28
  %142 = load i8, ptr %141, align 4, !tbaa !11
  %143 = zext i8 %142 to i32
  %144 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %143)
  %145 = getelementptr inbounds i8, ptr %4, i64 29
  %146 = load i8, ptr %145, align 1, !tbaa !11
  %147 = zext i8 %146 to i32
  %148 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %147)
  %149 = getelementptr inbounds i8, ptr %4, i64 30
  %150 = load i8, ptr %149, align 2, !tbaa !11
  %151 = zext i8 %150 to i32
  %152 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %151)
  %153 = getelementptr inbounds i8, ptr %4, i64 31
  %154 = load i8, ptr %153, align 1, !tbaa !11
  %155 = zext i8 %154 to i32
  %156 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %155)
  %157 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %160

.thread36:                                        ; preds = %26
  %158 = load ptr, ptr @stderr, align 8, !tbaa !5
  %159 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %158, ptr noundef nonnull @.str.4) #3
  br label %160

.thread:                                          ; preds = %5, %18, %23
  %.024.ph = phi ptr [ %14, %18 ], [ %14, %23 ], [ null, %5 ]
  call void @CRYPTO_free(ptr noundef %.024.ph, ptr noundef nonnull @.str.7, i32 noundef 56) #4
  br label %162

160:                                              ; preds = %.preheader.preheader, %.thread36
  %.02242 = phi i32 [ 1, %.thread36 ], [ 0, %.preheader.preheader ]
  call void @CRYPTO_free(ptr noundef nonnull %14, ptr noundef nonnull @.str.7, i32 noundef 56) #4
  %161 = call i32 @fclose(ptr noundef nonnull %22)
  br label %162

162:                                              ; preds = %.thread, %160
  %.02235 = phi i32 [ 1, %.thread ], [ %.02242, %160 ]
  ret i32 %.02235
}

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

declare ptr @OPENSSL_hexstr2buf(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @calculate_hmac(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #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 = { 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 = { cold nounwind }
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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass