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

; 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.IGDdatas = type { [128 x i8], [128 x i8], [128 x i8], i32, %struct.IGDdatas_service, %struct.IGDdatas_service, %struct.IGDdatas_service, %struct.IGDdatas_service, %struct.IGDdatas_service }
%struct.IGDdatas_service = type { [128 x i8], [128 x i8], [128 x i8], [128 x i8] }

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [47 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: 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) #1

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

; 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 void @IGDendelt(ptr noundef %0, ptr noundef %1, i32 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %8, ptr %7, align 8, !tbaa !5
  %9 = load ptr, ptr %7, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.IGDdatas, ptr %9, i32 0, i32 3
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr %10, align 4, !tbaa !11
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = icmp eq i32 %13, 7
  br i1 %14, label %15, label %81

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = call i32 @memcmp(ptr noundef %16, ptr noundef @.str, i64 noundef %18) #5
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %81, label %21

21:                                               ; preds = %15
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.IGDdatas, ptr %22, i32 0, i32 8
  %24 = getelementptr inbounds %struct.IGDdatas_service, ptr %23, i32 0, i32 3
  %25 = getelementptr inbounds [128 x i8], ptr %24, i64 0, i64 0
  %26 = call i32 @memcmp(ptr noundef %25, ptr noundef @.str.1, i64 noundef 54) #5
  %27 = icmp eq i32 0, %26
  br i1 %27, label %28, label %33

28:                                               ; preds = %21
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.IGDdatas, ptr %29, i32 0, i32 4
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.IGDdatas, ptr %31, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %32, i64 512, i1 false)
  br label %80

33:                                               ; preds = %21
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.IGDdatas, ptr %34, i32 0, i32 8
  %36 = getelementptr inbounds %struct.IGDdatas_service, ptr %35, i32 0, i32 3
  %37 = getelementptr inbounds [128 x i8], ptr %36, i64 0, i64 0
  %38 = call i32 @memcmp(ptr noundef %37, ptr noundef @.str.2, i64 noundef 52) #5
  %39 = icmp eq i32 0, %38
  br i1 %39, label %40, label %45

40:                                               ; preds = %33
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.IGDdatas, ptr %41, i32 0, i32 7
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.IGDdatas, ptr %43, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %42, ptr align 4 %44, i64 512, i1 false)
  br label %79

45:                                               ; preds = %33
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.IGDdatas, ptr %46, i32 0, i32 8
  %48 = getelementptr inbounds %struct.IGDdatas_service, ptr %47, i32 0, i32 3
  %49 = getelementptr inbounds [128 x i8], ptr %48, i64 0, i64 0
  %50 = call i32 @memcmp(ptr noundef %49, ptr noundef @.str.3, i64 noundef 45) #5
  %51 = icmp eq i32 0, %50
  br i1 %51, label %59, label %52

52:                                               ; preds = %45
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.IGDdatas, ptr %53, i32 0, i32 8
  %55 = getelementptr inbounds %struct.IGDdatas_service, ptr %54, i32 0, i32 3
  %56 = getelementptr inbounds [128 x i8], ptr %55, i64 0, i64 0
  %57 = call i32 @memcmp(ptr noundef %56, ptr noundef @.str.4, i64 noundef 46) #5
  %58 = icmp eq i32 0, %57
  br i1 %58, label %59, label %78

59:                                               ; preds = %52, %45
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.IGDdatas, ptr %60, i32 0, i32 5
  %62 = getelementptr inbounds %struct.IGDdatas_service, ptr %61, i32 0, i32 3
  %63 = getelementptr inbounds [128 x i8], ptr %62, i64 0, i64 0
  %64 = load i8, ptr %63, align 4, !tbaa !14
  %65 = sext i8 %64 to i32
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %72

67:                                               ; preds = %59
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.IGDdatas, ptr %68, i32 0, i32 5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.IGDdatas, ptr %70, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %69, ptr align 4 %71, i64 512, i1 false)
  br label %77

72:                                               ; preds = %59
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.IGDdatas, ptr %73, i32 0, i32 6
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.IGDdatas, ptr %75, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %74, ptr align 4 %76, i64 512, i1 false)
  br label %77

77:                                               ; preds = %72, %67
  br label %78

78:                                               ; preds = %77, %52
  br label %79

79:                                               ; preds = %78, %40
  br label %80

80:                                               ; preds = %79, %28
  br label %81

81:                                               ; preds = %80, %15, %3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nounwind }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 384}
!12 = !{!"IGDdatas", !7, i64 0, !7, i64 128, !7, i64 256, !10, i64 384, !13, i64 388, !13, i64 900, !13, i64 1412, !13, i64 1924, !13, i64 2436}
!13 = !{!"IGDdatas_service", !7, i64 0, !7, i64 128, !7, i64 256, !7, i64 384}
!14 = !{!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 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [47 x i8], align 1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @IGDendelt(ptr nocapture noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 384
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr %4, align 4, !tbaa !5
  %7 = icmp eq i32 %2, 7
  br i1 %7, label %8, label %24

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

9:                                                ; preds = %8
  %10 = getelementptr inbounds i8, ptr %0, i64 2436
  %11 = getelementptr inbounds i8, ptr %0, i64 2820
  %bcmp17 = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(54) %11, ptr noundef nonnull dereferenceable(54) @.str.1, i64 54)
  %12 = icmp eq i32 %bcmp17, 0
  br i1 %12, label %.sink.split, label %13

13:                                               ; preds = %9
  %bcmp18 = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(52) %11, ptr noundef nonnull dereferenceable(52) @.str.2, i64 52)
  %14 = icmp eq i32 %bcmp18, 0
  br i1 %14, label %.sink.split, label %15

15:                                               ; preds = %13
  %bcmp19 = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(45) %11, ptr noundef nonnull dereferenceable(45) @.str.3, i64 45)
  %16 = icmp eq i32 %bcmp19, 0
  br i1 %16, label %19, label %17

17:                                               ; preds = %15
  %bcmp20 = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(46) %11, ptr noundef nonnull dereferenceable(46) @.str.4, i64 46)
  %18 = icmp eq i32 %bcmp20, 0
  br i1 %18, label %19, label %24

19:                                               ; preds = %17, %15
  %20 = getelementptr inbounds i8, ptr %0, i64 1284
  %21 = load i8, ptr %20, align 4, !tbaa !11
  %22 = icmp eq i8 %21, 0
  %. = select i1 %22, i64 900, i64 1412
  br label %.sink.split

.sink.split:                                      ; preds = %19, %13, %9
  %.sink21 = phi i64 [ 388, %9 ], [ 1924, %13 ], [ %., %19 ]
  %23 = getelementptr inbounds i8, ptr %0, i64 %.sink21
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(512) %23, ptr noundef nonnull align 4 dereferenceable(512) %10, i64 512, i1 false)
  br label %24

24:                                               ; preds = %.sink.split, %17, %8, %3
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) 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 willreturn memory(argmem: 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, !9, i64 384}
!6 = !{!"IGDdatas", !7, i64 0, !7, i64 128, !7, i64 256, !9, i64 384, !10, i64 388, !10, i64 900, !10, i64 1412, !10, i64 1924, !10, i64 2436}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"IGDdatas_service", !7, i64 0, !7, i64 128, !7, i64 256, !7, i64 384}
!11 = !{!7, !7, i64 0}


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