; LLVM IR from dynexcoin/Dynex :: external/miniupnpc (testminiwget)

; 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 [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 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 ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca [64 x i8], align 16
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  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 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 -1, ptr %11, align 4, !tbaa !5
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 3
  br i1 %14, label %15, label %26

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

26:                                               ; preds = %2
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = getelementptr inbounds ptr, ptr %27, i64 1
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds [64 x i8], ptr %10, i64 0, i64 0
  %31 = call ptr @miniwget_getaddr(ptr noundef %29, ptr noundef %7, ptr noundef %30, i32 noundef 64, i32 noundef 0, ptr noundef %11)
  store ptr %31, ptr %6, align 8, !tbaa !9
  %32 = load ptr, ptr %6, align 8, !tbaa !9
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %37

34:                                               ; preds = %26
  %35 = load i32, ptr %11, align 4, !tbaa !5
  %36 = icmp ne i32 %35, 200
  br i1 %36, label %37, label %49

37:                                               ; preds = %34, %26
  %38 = load ptr, ptr %6, align 8, !tbaa !9
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %42

40:                                               ; preds = %37
  %41 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %41) #4
  br label %42

42:                                               ; preds = %40, %37
  %43 = load ptr, ptr @stderr, align 8, !tbaa !9
  %44 = load i32, ptr %11, align 4, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !9
  %46 = getelementptr inbounds ptr, ptr %45, i64 1
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str.2, i32 noundef %44, ptr noundef %47) #4
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %95

49:                                               ; preds = %34
  %50 = getelementptr inbounds [64 x i8], ptr %10, i64 0, i64 0
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %50)
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %52)
  %54 = load ptr, ptr %5, align 8, !tbaa !9
  %55 = getelementptr inbounds ptr, ptr %54, i64 2
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = call noalias ptr @fopen(ptr noundef %56, ptr noundef @.str.5)
  store ptr %57, ptr %9, align 8, !tbaa !9
  %58 = load ptr, ptr %9, align 8, !tbaa !9
  %59 = icmp ne ptr %58, null
  br i1 %59, label %67, label %60

60:                                               ; preds = %49
  %61 = load ptr, ptr @stderr, align 8, !tbaa !9
  %62 = load ptr, ptr %5, align 8, !tbaa !9
  %63 = getelementptr inbounds ptr, ptr %62, i64 2
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.6, ptr noundef %64) #4
  %66 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %66) #4
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %95

67:                                               ; preds = %49
  %68 = load ptr, ptr %6, align 8, !tbaa !9
  %69 = load i32, ptr %7, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = load ptr, ptr %9, align 8, !tbaa !9
  %72 = call i64 @fwrite(ptr noundef %68, i64 noundef 1, i64 noundef %70, ptr noundef %71)
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %8, align 4, !tbaa !5
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = icmp ne i32 %74, %75
  br i1 %76, label %77, label %85

77:                                               ; preds = %67
  %78 = load ptr, ptr @stderr, align 8, !tbaa !9
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = load ptr, ptr %5, align 8, !tbaa !9
  %82 = getelementptr inbounds ptr, ptr %81, i64 2
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef @.str.7, i32 noundef %79, i32 noundef %80, ptr noundef %83) #4
  br label %91

85:                                               ; preds = %67
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = load ptr, ptr %5, align 8, !tbaa !9
  %88 = getelementptr inbounds ptr, ptr %87, i64 2
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %86, ptr noundef %89)
  br label %91

91:                                               ; preds = %85, %77
  %92 = load ptr, ptr %9, align 8, !tbaa !9
  %93 = call i32 @fclose(ptr noundef %92)
  %94 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %94) #4
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %95

95:                                               ; preds = %91, %60, %42, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %96 = load i32, ptr %3, align 4
  ret i32 %96
}

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

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

declare ptr @miniwget_getaddr(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #3

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

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

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

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

declare i32 @fclose(ptr noundef) #3

; 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 = { 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 #3 = { "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 }

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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 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 i32, align 4
  %4 = alloca [64 x i8], align 16
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 -1, ptr %5, align 4, !tbaa !5
  %6 = icmp slt i32 %0, 3
  br i1 %6, label %7, label %14

7:                                                ; preds = %2
  %8 = load ptr, ptr @stderr, align 8, !tbaa !9
  %9 = load ptr, ptr %1, align 8, !tbaa !9
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str, ptr noundef %9) #6
  %11 = load ptr, ptr @stderr, align 8, !tbaa !9
  %12 = load ptr, ptr %1, align 8, !tbaa !9
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.1, ptr noundef %12) #6
  br label %54

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = call ptr @miniwget_getaddr(ptr noundef %16, ptr noundef nonnull %3, ptr noundef nonnull %4, i32 noundef 64, i32 noundef 0, ptr noundef nonnull %5) #5
  %18 = icmp eq ptr %17, null
  %19 = load i32, ptr %5, align 4
  %20 = icmp ne i32 %19, 200
  %or.cond = select i1 %18, i1 true, i1 %20
  br i1 %or.cond, label %21, label %28

21:                                               ; preds = %14
  br i1 %18, label %23, label %22

22:                                               ; preds = %21
  call void @free(ptr noundef nonnull %17) #5
  %.pre = load i32, ptr %5, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %22, %21
  %24 = phi i32 [ %.pre, %22 ], [ %19, %21 ]
  %25 = load ptr, ptr @stderr, align 8, !tbaa !9
  %26 = load ptr, ptr %15, align 8, !tbaa !9
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.2, i32 noundef %24, ptr noundef %26) #6
  br label %54

28:                                               ; preds = %14
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %4)
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %30)
  %32 = getelementptr inbounds i8, ptr %1, i64 16
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call noalias ptr @fopen(ptr noundef %33, ptr noundef nonnull @.str.5)
  %.not = icmp eq ptr %34, null
  br i1 %.not, label %35, label %39

35:                                               ; preds = %28
  %36 = load ptr, ptr @stderr, align 8, !tbaa !9
  %37 = load ptr, ptr %32, align 8, !tbaa !9
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.6, ptr noundef %37) #6
  call void @free(ptr noundef nonnull %17) #5
  br label %54

39:                                               ; preds = %28
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = call i64 @fwrite(ptr noundef nonnull %17, i64 noundef 1, i64 noundef %41, ptr noundef nonnull %34)
  %43 = trunc i64 %42 to i32
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %.not27 = icmp eq i32 %44, %43
  br i1 %.not27, label %49, label %45

45:                                               ; preds = %39
  %46 = load ptr, ptr @stderr, align 8, !tbaa !9
  %47 = load ptr, ptr %32, align 8, !tbaa !9
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.7, i32 noundef %43, i32 noundef %44, ptr noundef %47) #6
  br label %52

49:                                               ; preds = %39
  %50 = load ptr, ptr %32, align 8, !tbaa !9
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %43, ptr noundef %50)
  br label %52

52:                                               ; preds = %49, %45
  %53 = call i32 @fclose(ptr noundef nonnull %34)
  call void @free(ptr noundef nonnull %17) #5
  br label %54

54:                                               ; preds = %52, %35, %23, %7
  %.0 = phi i32 [ 1, %7 ], [ 1, %23 ], [ 0, %52 ], [ 1, %35 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret i32 %.0
}

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

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

declare ptr @miniwget_getaddr(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

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

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

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

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 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 #5 = { nounwind }
attributes #6 = { cold 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}


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