; LLVM IR from tleonhardt/practical_cryptography_engineering :: sodium (nacl_sign)

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

@.str = external hidden unnamed_addr constant [60 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 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 ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca [64 x i8], align 16
  %17 = alloca [129 x i8], align 16
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca ptr, align 8
  %26 = 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) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store ptr null, ptr %11, align 8, !tbaa !9
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = icmp ne i32 %27, 4
  br i1 %28, label %29, label %34

29:                                               ; preds = %2
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 0
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %32)
  br label %167

34:                                               ; preds = %2
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %35, i64 1
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  store ptr %37, ptr %12, align 8, !tbaa !9
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 2
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  store ptr %40, ptr %13, align 8, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 3
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  store ptr %43, ptr %14, align 8, !tbaa !9
  %44 = call i32 @sodium_init()
  %45 = icmp slt i32 %44, 0
  br i1 %45, label %46, label %48

46:                                               ; preds = %34
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %201

48:                                               ; preds = %34
  %49 = load ptr, ptr %12, align 8, !tbaa !9
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %49)
  %51 = load ptr, ptr %12, align 8, !tbaa !9
  %52 = call noalias ptr @fopen(ptr noundef %51, ptr noundef @.str.3)
  store ptr %52, ptr %7, align 8, !tbaa !9
  %53 = load ptr, ptr %7, align 8, !tbaa !9
  %54 = icmp eq ptr null, %53
  br i1 %54, label %55, label %58

55:                                               ; preds = %48
  %56 = load ptr, ptr %12, align 8, !tbaa !9
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %56)
  br label %167

58:                                               ; preds = %48
  %59 = getelementptr inbounds [64 x i8], ptr %16, i64 0, i64 0
  %60 = load ptr, ptr %7, align 8, !tbaa !9
  %61 = call i64 @fread(ptr noundef %59, i64 noundef 1, i64 noundef 64, ptr noundef %60)
  store i64 %61, ptr %18, align 8, !tbaa !11
  %62 = load i64, ptr %18, align 8, !tbaa !11
  %63 = icmp ne i64 64, %62
  br i1 %63, label %64, label %66

64:                                               ; preds = %58
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  br label %167

66:                                               ; preds = %58
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %68 = getelementptr inbounds [129 x i8], ptr %17, i64 0, i64 0
  %69 = getelementptr inbounds [64 x i8], ptr %16, i64 0, i64 0
  %70 = call ptr @sodium_bin2hex(ptr noundef %68, i64 noundef 129, ptr noundef %69, i64 noundef 64)
  %71 = getelementptr inbounds [129 x i8], ptr %17, i64 0, i64 0
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %71)
  %73 = load ptr, ptr %13, align 8, !tbaa !9
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %73)
  %75 = load ptr, ptr %13, align 8, !tbaa !9
  %76 = call noalias ptr @fopen(ptr noundef %75, ptr noundef @.str.3)
  store ptr %76, ptr %8, align 8, !tbaa !9
  %77 = load ptr, ptr %8, align 8, !tbaa !9
  %78 = icmp eq ptr null, %77
  br i1 %78, label %79, label %82

79:                                               ; preds = %66
  %80 = load ptr, ptr %13, align 8, !tbaa !9
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %80)
  br label %167

82:                                               ; preds = %66
  %83 = load ptr, ptr %8, align 8, !tbaa !9
  %84 = call i32 @fileno(ptr noundef %83) #6
  %85 = call i64 @lseek(i32 noundef %84, i64 noundef 0, i32 noundef 2) #6
  store i64 %85, ptr %19, align 8, !tbaa !11
  %86 = icmp slt i64 %85, 0
  br i1 %86, label %87, label %89

87:                                               ; preds = %82
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %167

89:                                               ; preds = %82
  %90 = load i64, ptr %19, align 8, !tbaa !11
  store i64 %90, ptr %20, align 8, !tbaa !11
  %91 = load ptr, ptr %8, align 8, !tbaa !9
  %92 = call i32 @fseek(ptr noundef %91, i64 noundef 0, i32 noundef 0)
  %93 = icmp slt i32 %92, 0
  br i1 %93, label %94, label %96

94:                                               ; preds = %89
  %95 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  br label %167

96:                                               ; preds = %89
  %97 = load i64, ptr %20, align 8, !tbaa !11
  store i64 %97, ptr %21, align 8, !tbaa !13
  %98 = load i64, ptr %21, align 8, !tbaa !13
  %99 = add i64 64, %98
  store i64 %99, ptr %22, align 8, !tbaa !13
  %100 = load i64, ptr %21, align 8, !tbaa !13
  %101 = add i64 %100, 1
  %102 = call noalias ptr @malloc(i64 noundef %101) #7
  store ptr %102, ptr %10, align 8, !tbaa !9
  %103 = load i64, ptr %22, align 8, !tbaa !13
  %104 = add i64 %103, 1
  %105 = call noalias ptr @malloc(i64 noundef %104) #7
  store ptr %105, ptr %11, align 8, !tbaa !9
  %106 = load ptr, ptr %10, align 8, !tbaa !9
  %107 = load i64, ptr %21, align 8, !tbaa !13
  %108 = load ptr, ptr %8, align 8, !tbaa !9
  %109 = call i64 @fread(ptr noundef %106, i64 noundef 1, i64 noundef %107, ptr noundef %108)
  store i64 %109, ptr %18, align 8, !tbaa !11
  %110 = load i64, ptr %21, align 8, !tbaa !13
  %111 = load i64, ptr %18, align 8, !tbaa !11
  %112 = icmp ne i64 %110, %111
  br i1 %112, label %113, label %115

113:                                              ; preds = %96
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  br label %167

115:                                              ; preds = %96
  %116 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %117 = load i64, ptr %21, align 8, !tbaa !13
  %118 = load ptr, ptr %10, align 8, !tbaa !9
  %119 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i64 noundef %117, ptr noundef %118)
  store i64 0, ptr %23, align 8, !tbaa !13
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %121 = load ptr, ptr %11, align 8, !tbaa !9
  %122 = load ptr, ptr %10, align 8, !tbaa !9
  %123 = load i64, ptr %21, align 8, !tbaa !13
  %124 = getelementptr inbounds [64 x i8], ptr %16, i64 0, i64 0
  %125 = call i32 @crypto_sign(ptr noundef %121, ptr noundef %23, ptr noundef %122, i64 noundef %123, ptr noundef %124)
  store i32 %125, ptr %6, align 4, !tbaa !5
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = icmp ne i32 0, %126
  br i1 %127, label %128, label %130

128:                                              ; preds = %115
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %130

130:                                              ; preds = %128, %115
  %131 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %132 = load i64, ptr %22, align 8, !tbaa !13
  %133 = mul i64 2, %132
  %134 = add i64 %133, 1
  store i64 %134, ptr %24, align 8, !tbaa !11
  %135 = load i64, ptr %24, align 8, !tbaa !11
  %136 = call noalias ptr @malloc(i64 noundef %135) #7
  store ptr %136, ptr %25, align 8, !tbaa !9
  %137 = load ptr, ptr %25, align 8, !tbaa !9
  %138 = load i64, ptr %24, align 8, !tbaa !11
  %139 = load ptr, ptr %11, align 8, !tbaa !9
  %140 = load i64, ptr %22, align 8, !tbaa !13
  %141 = call ptr @sodium_bin2hex(ptr noundef %137, i64 noundef %138, ptr noundef %139, i64 noundef %140)
  %142 = load i64, ptr %22, align 8, !tbaa !13
  %143 = load ptr, ptr %25, align 8, !tbaa !9
  %144 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i64 noundef %142, ptr noundef %143)
  %145 = load ptr, ptr %25, align 8, !tbaa !9
  call void @free(ptr noundef %145) #6
  %146 = load ptr, ptr %14, align 8, !tbaa !9
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %146)
  %148 = load ptr, ptr %14, align 8, !tbaa !9
  %149 = call noalias ptr @fopen(ptr noundef %148, ptr noundef @.str.16)
  store ptr %149, ptr %9, align 8, !tbaa !9
  %150 = load ptr, ptr %9, align 8, !tbaa !9
  %151 = icmp eq ptr null, %150
  br i1 %151, label %152, label %155

152:                                              ; preds = %130
  %153 = load ptr, ptr %14, align 8, !tbaa !9
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, ptr noundef %153)
  br label %167

155:                                              ; preds = %130
  %156 = load ptr, ptr %11, align 8, !tbaa !9
  %157 = load i64, ptr %22, align 8, !tbaa !13
  %158 = load ptr, ptr %9, align 8, !tbaa !9
  %159 = call i64 @fwrite(ptr noundef %156, i64 noundef 1, i64 noundef %157, ptr noundef %158)
  store i64 %159, ptr %26, align 8, !tbaa !11
  %160 = load i64, ptr %22, align 8, !tbaa !13
  %161 = load i64, ptr %26, align 8, !tbaa !11
  %162 = icmp ne i64 %160, %161
  br i1 %162, label %163, label %165

163:                                              ; preds = %155
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  br label %167

165:                                              ; preds = %155
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %167

167:                                              ; preds = %165, %163, %152, %113, %94, %87, %79, %64, %55, %29
  %168 = load ptr, ptr %7, align 8, !tbaa !9
  %169 = icmp ne ptr %168, null
  br i1 %169, label %170, label %173

170:                                              ; preds = %167
  %171 = load ptr, ptr %7, align 8, !tbaa !9
  %172 = call i32 @fclose(ptr noundef %171)
  br label %173

173:                                              ; preds = %170, %167
  %174 = load ptr, ptr %8, align 8, !tbaa !9
  %175 = icmp ne ptr %174, null
  br i1 %175, label %176, label %179

176:                                              ; preds = %173
  %177 = load ptr, ptr %8, align 8, !tbaa !9
  %178 = call i32 @fclose(ptr noundef %177)
  br label %179

179:                                              ; preds = %176, %173
  %180 = load ptr, ptr %9, align 8, !tbaa !9
  %181 = icmp ne ptr %180, null
  br i1 %181, label %182, label %185

182:                                              ; preds = %179
  %183 = load ptr, ptr %9, align 8, !tbaa !9
  %184 = call i32 @fclose(ptr noundef %183)
  br label %185

185:                                              ; preds = %182, %179
  %186 = load ptr, ptr %10, align 8, !tbaa !9
  %187 = icmp ne ptr %186, null
  br i1 %187, label %188, label %192

188:                                              ; preds = %185
  %189 = load ptr, ptr %10, align 8, !tbaa !9
  %190 = load i64, ptr %21, align 8, !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 1 %189, i8 0, i64 %190, i1 false)
  %191 = load ptr, ptr %10, align 8, !tbaa !9
  call void @free(ptr noundef %191) #6
  br label %192

192:                                              ; preds = %188, %185
  %193 = load ptr, ptr %11, align 8, !tbaa !9
  %194 = icmp ne ptr %193, null
  br i1 %194, label %195, label %199

195:                                              ; preds = %192
  %196 = load ptr, ptr %11, align 8, !tbaa !9
  %197 = load i64, ptr %22, align 8, !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 1 %196, i8 0, i64 %197, i1 false)
  %198 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %198) #6
  br label %199

199:                                              ; preds = %195, %192
  %200 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %200, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %201

201:                                              ; preds = %199, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %202 = load i32, ptr %3, align 4
  ret i32 %202
}

; 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

declare i32 @sodium_init() #2

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

declare ptr @sodium_bin2hex(ptr noundef, i64 noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) #3

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

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

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

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; 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 allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

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

@.str = external hidden unnamed_addr constant [60 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 x i8], align 1

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

6:                                                ; preds = %2
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %7)
  br label %.thread172

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
  %14 = getelementptr inbounds i8, ptr %1, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = tail call i32 @sodium_init() #6
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %9
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.thread172

20:                                               ; preds = %9
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %11)
  %22 = tail call noalias ptr @fopen(ptr noundef %11, ptr noundef nonnull @.str.3)
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %26

24:                                               ; preds = %20
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %11)
  br label %.thread172

26:                                               ; preds = %20
  %27 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 1, i64 noundef 64, ptr noundef nonnull %22)
  %.not82 = icmp eq i64 %27, 64
  br i1 %.not82, label %30, label %28

28:                                               ; preds = %26
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %84

30:                                               ; preds = %26
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %32 = call ptr @sodium_bin2hex(ptr noundef nonnull %4, i64 noundef 129, ptr noundef nonnull %3, i64 noundef 64) #6
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef nonnull %4)
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %13)
  %35 = call noalias ptr @fopen(ptr noundef %13, ptr noundef nonnull @.str.3)
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %39

37:                                               ; preds = %30
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %13)
  br label %84

39:                                               ; preds = %30
  %40 = call i32 @fileno(ptr noundef nonnull %35) #6
  %41 = call i64 @lseek(i32 noundef %40, i64 noundef 0, i32 noundef 2) #6
  %42 = icmp slt i64 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %39
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %86

45:                                               ; preds = %39
  %46 = call i32 @fseek(ptr noundef nonnull %35, i64 noundef 0, i32 noundef 0)
  %47 = icmp slt i32 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %45
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %86

50:                                               ; preds = %45
  %51 = add nuw i64 %41, 64
  %52 = add nuw i64 %41, 1
  %53 = call noalias ptr @malloc(i64 noundef %52) #7
  %54 = add nuw i64 %41, 65
  %55 = call noalias ptr @malloc(i64 noundef %54) #7
  %56 = call i64 @fread(ptr noundef %53, i64 noundef 1, i64 noundef %41, ptr noundef nonnull %35)
  %.not83 = icmp eq i64 %41, %56
  br i1 %.not83, label %59, label %57

57:                                               ; preds = %50
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %86

59:                                               ; preds = %50
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i64 noundef %41, ptr noundef %53)
  store i64 0, ptr %5, align 8, !tbaa !9
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %63 = call i32 @crypto_sign(ptr noundef %55, ptr noundef nonnull %5, ptr noundef %53, i64 noundef %41, ptr noundef nonnull %3) #6
  %.not84 = icmp eq i32 %63, 0
  br i1 %.not84, label %66, label %64

64:                                               ; preds = %59
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %66

66:                                               ; preds = %64, %59
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %68 = shl i64 %51, 1
  %69 = or disjoint i64 %68, 1
  %70 = call noalias ptr @malloc(i64 noundef %69) #7
  %71 = call ptr @sodium_bin2hex(ptr noundef %70, i64 noundef %69, ptr noundef %55, i64 noundef %51) #6
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i64 noundef %51, ptr noundef %70)
  call void @free(ptr noundef %70) #6
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef %15)
  %74 = call noalias ptr @fopen(ptr noundef %15, ptr noundef nonnull @.str.16)
  %75 = icmp eq ptr %74, null
  br i1 %75, label %76, label %78

76:                                               ; preds = %66
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef %15)
  br label %86

78:                                               ; preds = %66
  %79 = call i64 @fwrite(ptr noundef %55, i64 noundef 1, i64 noundef %51, ptr noundef nonnull %74)
  %.not85 = icmp eq i64 %51, %79
  br i1 %.not85, label %82, label %80

80:                                               ; preds = %78
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  br label %86

82:                                               ; preds = %78
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %86

84:                                               ; preds = %37, %28
  %85 = call i32 @fclose(ptr noundef nonnull %22)
  br label %.thread172

86:                                               ; preds = %43, %48, %57, %76, %80, %82
  %.073.ph.ph = phi ptr [ null, %43 ], [ null, %48 ], [ %55, %57 ], [ %55, %76 ], [ %55, %80 ], [ %55, %82 ]
  %.072.ph.ph = phi ptr [ null, %43 ], [ null, %48 ], [ %53, %57 ], [ %53, %76 ], [ %53, %80 ], [ %53, %82 ]
  %.071.ph.ph = phi ptr [ null, %43 ], [ null, %48 ], [ null, %57 ], [ null, %76 ], [ %74, %80 ], [ %74, %82 ]
  %.066.ph.ph = phi i32 [ 1, %43 ], [ 1, %48 ], [ 1, %57 ], [ %63, %76 ], [ %63, %80 ], [ 0, %82 ]
  %87 = call i32 @fclose(ptr noundef nonnull %22)
  %88 = call i32 @fclose(ptr noundef nonnull %35)
  %.not88 = icmp eq ptr %.071.ph.ph, null
  br i1 %.not88, label %91, label %89

89:                                               ; preds = %86
  %90 = call i32 @fclose(ptr noundef nonnull %.071.ph.ph)
  br label %91

91:                                               ; preds = %89, %86
  %.not89 = icmp eq ptr %.072.ph.ph, null
  br i1 %.not89, label %93, label %92

92:                                               ; preds = %91
  call void @free(ptr noundef nonnull %.072.ph.ph) #6
  br label %93

93:                                               ; preds = %92, %91
  %.not90 = icmp eq ptr %.073.ph.ph, null
  br i1 %.not90, label %.thread172, label %94

94:                                               ; preds = %93
  call void @free(ptr noundef nonnull %.073.ph.ph) #6
  br label %.thread172

.thread172:                                       ; preds = %24, %6, %84, %93, %94, %18
  %.0 = phi i32 [ 1, %18 ], [ %.066.ph.ph, %94 ], [ %.066.ph.ph, %93 ], [ 1, %84 ], [ 1, %6 ], [ 1, %24 ]
  ret i32 %.0
}

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

declare i32 @sodium_init() 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: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

declare ptr @sodium_bin2hex(ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fileno(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; 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 = { 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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 long", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass