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

; 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.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 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: nounwind uwtable
define dso_local i32 @requestDevicesFromMiniSSDPD(i32 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [256 x i8], align 16
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, 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 256, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %11 = load ptr, ptr %5, align 8, !tbaa !9
  %12 = call i64 @strlen(ptr noundef %11) #6
  %13 = trunc i64 %12 to i32
  store i32 %13, ptr %8, align 4, !tbaa !5
  %14 = load i32, ptr %8, align 4, !tbaa !5
  %15 = icmp eq i32 %14, 8
  br i1 %15, label %16, label %22

16:                                               ; preds = %2
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = call i32 @memcmp(ptr noundef %17, ptr noundef @.str.2, i64 noundef 8) #6
  %19 = icmp eq i32 0, %18
  br i1 %19, label %20, label %22

20:                                               ; preds = %16
  %21 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  store i8 3, ptr %21, align 16, !tbaa !11
  br label %24

22:                                               ; preds = %16, %2
  %23 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  store i8 1, ptr %23, align 16, !tbaa !11
  br label %24

24:                                               ; preds = %22, %20
  %25 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  %26 = getelementptr inbounds i8, ptr %25, i64 1
  store ptr %26, ptr %7, align 8, !tbaa !9
  %27 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %27, ptr %9, align 4, !tbaa !5
  %28 = load i32, ptr %9, align 4, !tbaa !5
  %29 = icmp uge i32 %28, 268435456
  br i1 %29, label %30, label %37

30:                                               ; preds = %24
  %31 = load i32, ptr %9, align 4, !tbaa !5
  %32 = lshr i32 %31, 28
  %33 = or i32 %32, 128
  %34 = trunc i32 %33 to i8
  %35 = load ptr, ptr %7, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %35, i32 1
  store ptr %36, ptr %7, align 8, !tbaa !9
  store i8 %34, ptr %35, align 1, !tbaa !11
  br label %37

37:                                               ; preds = %30, %24
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = icmp uge i32 %38, 2097152
  br i1 %39, label %40, label %47

40:                                               ; preds = %37
  %41 = load i32, ptr %9, align 4, !tbaa !5
  %42 = lshr i32 %41, 21
  %43 = or i32 %42, 128
  %44 = trunc i32 %43 to i8
  %45 = load ptr, ptr %7, align 8, !tbaa !9
  %46 = getelementptr inbounds i8, ptr %45, i32 1
  store ptr %46, ptr %7, align 8, !tbaa !9
  store i8 %44, ptr %45, align 1, !tbaa !11
  br label %47

47:                                               ; preds = %40, %37
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = icmp uge i32 %48, 16384
  br i1 %49, label %50, label %57

50:                                               ; preds = %47
  %51 = load i32, ptr %9, align 4, !tbaa !5
  %52 = lshr i32 %51, 14
  %53 = or i32 %52, 128
  %54 = trunc i32 %53 to i8
  %55 = load ptr, ptr %7, align 8, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %55, i32 1
  store ptr %56, ptr %7, align 8, !tbaa !9
  store i8 %54, ptr %55, align 1, !tbaa !11
  br label %57

57:                                               ; preds = %50, %47
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = icmp uge i32 %58, 128
  br i1 %59, label %60, label %67

60:                                               ; preds = %57
  %61 = load i32, ptr %9, align 4, !tbaa !5
  %62 = lshr i32 %61, 7
  %63 = or i32 %62, 128
  %64 = trunc i32 %63 to i8
  %65 = load ptr, ptr %7, align 8, !tbaa !9
  %66 = getelementptr inbounds i8, ptr %65, i32 1
  store ptr %66, ptr %7, align 8, !tbaa !9
  store i8 %64, ptr %65, align 1, !tbaa !11
  br label %67

67:                                               ; preds = %60, %57
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = and i32 %68, 127
  %70 = trunc i32 %69 to i8
  %71 = load ptr, ptr %7, align 8, !tbaa !9
  %72 = getelementptr inbounds i8, ptr %71, i32 1
  store ptr %72, ptr %7, align 8, !tbaa !9
  store i8 %70, ptr %71, align 1, !tbaa !11
  %73 = load ptr, ptr %7, align 8, !tbaa !9
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds i8, ptr %73, i64 %75
  %77 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  %78 = getelementptr inbounds i8, ptr %77, i64 256
  %79 = icmp ugt ptr %76, %78
  br i1 %79, label %80, label %81

80:                                               ; preds = %67
  store i32 -103, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %101

81:                                               ; preds = %67
  %82 = load ptr, ptr %7, align 8, !tbaa !9
  %83 = load ptr, ptr %5, align 8, !tbaa !9
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = zext i32 %84 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %82, ptr align 1 %83, i64 %85, i1 false)
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = load ptr, ptr %7, align 8, !tbaa !9
  %88 = zext i32 %86 to i64
  %89 = getelementptr inbounds i8, ptr %87, i64 %88
  store ptr %89, ptr %7, align 8, !tbaa !9
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  %92 = load ptr, ptr %7, align 8, !tbaa !9
  %93 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  %94 = ptrtoint ptr %92 to i64
  %95 = ptrtoint ptr %93 to i64
  %96 = sub i64 %94, %95
  %97 = call i64 @write(i32 noundef %90, ptr noundef %91, i64 noundef %96)
  %98 = icmp slt i64 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %81
  call void @perror(ptr noundef @.str.3)
  store i32 -101, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %101

100:                                              ; preds = %81
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %101

101:                                              ; preds = %100, %99, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr %6) #5
  %102 = load i32, ptr %3, align 4
  ret i32 %102
}

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

declare void @perror(ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #3

; 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) #4

declare i64 @write(i32 noundef, ptr noundef, i64 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 = { "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) "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { 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 = !{!"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 = !{!7, !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.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 -103, 1) i32 @requestDevicesFromMiniSSDPD(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = alloca [256 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #7
  %4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #8
  %5 = trunc i64 %4 to i32
  %6 = icmp eq i32 %5, 8
  %.027.idx.sroa.gep = getelementptr inbounds i8, ptr %3, i64 2
  %.027.idx.sroa.gep39 = getelementptr inbounds i8, ptr %3, i64 1
  br i1 %6, label %7, label %9

7:                                                ; preds = %2
  %bcmp = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %1, ptr noundef nonnull dereferenceable(8) @.str.2, i64 8)
  %8 = icmp eq i32 %bcmp, 0
  br i1 %8, label %.thread, label %.thread41

.thread41:                                        ; preds = %7
  store i8 1, ptr %3, align 16, !tbaa !5
  br label %.thread58

.thread:                                          ; preds = %7
  store i8 3, ptr %3, align 16, !tbaa !5
  br label %.thread58

9:                                                ; preds = %2
  store i8 1, ptr %3, align 16, !tbaa !5
  %10 = icmp ugt i32 %5, 268435455
  br i1 %10, label %.thread45, label %14

.thread45:                                        ; preds = %9
  %11 = lshr i32 %5, 28
  %12 = trunc nuw nsw i32 %11 to i8
  %13 = or disjoint i8 %12, -128
  store i8 %13, ptr %.027.idx.sroa.gep39, align 1, !tbaa !5
  br label %.thread50

14:                                               ; preds = %9
  %15 = icmp ugt i32 %5, 2097151
  br i1 %15, label %.thread50, label %19

.thread50:                                        ; preds = %14, %.thread45
  %.027.idx49 = phi i64 [ 3, %.thread45 ], [ 2, %14 ]
  %.027.idx.sroa.phi48 = phi ptr [ %.027.idx.sroa.gep, %.thread45 ], [ %.027.idx.sroa.gep39, %14 ]
  %16 = lshr i64 %4, 21
  %17 = trunc i64 %16 to i8
  %18 = or i8 %17, -128
  store i8 %18, ptr %.027.idx.sroa.phi48, align 1, !tbaa !5
  br label %.thread55

19:                                               ; preds = %14
  %20 = icmp ugt i32 %5, 16383
  br i1 %20, label %.thread55, label %24

.thread55:                                        ; preds = %19, %.thread50
  %.1.idx52 = phi i64 [ %.027.idx49, %.thread50 ], [ 1, %19 ]
  %.1.ptr = getelementptr inbounds i8, ptr %3, i64 %.1.idx52
  %21 = lshr i64 %4, 14
  %22 = trunc i64 %21 to i8
  %23 = or i8 %22, -128
  %.1.add = add nuw nsw i64 %.1.idx52, 1
  store i8 %23, ptr %.1.ptr, align 1, !tbaa !5
  br label %26

24:                                               ; preds = %19
  %25 = icmp ugt i32 %5, 127
  br i1 %25, label %26, label %.thread58

26:                                               ; preds = %.thread55, %24
  %.2.idx57 = phi i64 [ %.1.add, %.thread55 ], [ 1, %24 ]
  %.2.ptr = getelementptr inbounds i8, ptr %3, i64 %.2.idx57
  %27 = lshr i64 %4, 7
  %28 = trunc i64 %27 to i8
  %29 = or i8 %28, -128
  %.2.add = add nuw nsw i64 %.2.idx57, 1
  store i8 %29, ptr %.2.ptr, align 1, !tbaa !5
  br label %.thread58

.thread58:                                        ; preds = %.thread, %.thread41, %26, %24
  %.3.idx = phi i64 [ %.2.add, %26 ], [ 1, %24 ], [ 1, %.thread41 ], [ 1, %.thread ]
  %.3.ptr = getelementptr inbounds i8, ptr %3, i64 %.3.idx
  %30 = trunc i64 %4 to i8
  %31 = and i8 %30, 127
  %.3.add = add nuw nsw i64 %.3.idx, 1
  store i8 %31, ptr %.3.ptr, align 1, !tbaa !5
  %32 = and i64 %4, 4294967295
  %.add = add nuw nsw i64 %.3.add, %32
  %33 = icmp ugt i64 %.add, 256
  br i1 %33, label %38, label %34

34:                                               ; preds = %.thread58
  %.ptr = getelementptr inbounds i8, ptr %3, i64 %.3.add
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %.ptr, ptr align 1 %1, i64 %32, i1 false)
  %35 = call i64 @write(i32 noundef %0, ptr noundef nonnull %3, i64 noundef %.add) #7
  %36 = icmp slt i64 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  tail call void @perror(ptr noundef nonnull @.str.3) #9
  br label %38

38:                                               ; preds = %34, %.thread58, %37
  %.0 = phi i32 [ -101, %37 ], [ -103, %.thread58 ], [ 0, %34 ]
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #7
  ret i32 %.0
}

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; 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) #4

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree 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 = { 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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree "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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { cold }

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


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